From patchwork Wed Jun 29 08:57:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 16424 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 0D1B6BD808 for ; Wed, 29 Jun 2022 08:57:34 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B505A6563B; Wed, 29 Jun 2022 10:57:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1656493053; bh=YTK5Noc2Q2lbhWo+rp4bSjy1UOV7qDRJES7u6OCqZJA=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=odmUpdFAxHoRaBeY4TYgQDaa77u8oUsdBbrJGDsoQ9WWl8oSn3GajKuEN73S6OTkP ExTXnvvFS/csSELl+KcKlXQz8n51RwDUlQR4CNFBxdy7i2pBVZXG2YM5YlX7vrgXA9 SLW8VHWuLcb2h4lJSRwcHFf4BzaTh4gMQU53AScRX840zfQi2jZUKUkkKiswKrZ3Gq Y8A5tX55UENmP5Q0frzso75l6Z2O5M3QlDrfVZMFBBfH1+YmqGCzOA22G+WkhBN5c7 yVhWkS7eNE4RiESIItedZxhrh2lUjVUZrYtalUT5cqdof7mJg1Pa16e5wICUGIPr3b bUTDxTY/S5zRw== Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2988760552 for ; Wed, 29 Jun 2022 10:57:30 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="ApE8xHjB"; dkim-atps=neutral Received: by mail-wm1-x331.google.com with SMTP id l2-20020a05600c4f0200b0039c55c50482so11019812wmq.0 for ; Wed, 29 Jun 2022 01:57:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YqAxiP9TCv8odUus2VXRkdrejIzP2Ylpisi7DvbfMtc=; b=ApE8xHjBt6xqMMaqRfM4wLRC2WbeFrXaYdtu6d+Kwma/XQkfnu0lQ3UlJsF4m5c/2E 4k53uZtS7Yn1V/DmnF0/f9SsVhSamjD5f638JYncqpQgB9mwnOZ0DGK1KqzVs69EWzU0 cNugxS9ipeaGQzccl/yxYSoNAW5xFP17XRgl/USfQZRAOm3GSF9EowPcn12KOYcvBk+k Co5AuL17Os8pvee5cnSAl6YI7Za/HX6smYzHrjfOWezdQZ4QWtL4FQqhwrVHnImxbKtJ xbT9C44uTRjuHxy1jNSFT43CKcEjtPqEnsfIEUV3NxlKo2RlPg8029v4bVQCrpWRf1zs Pa3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YqAxiP9TCv8odUus2VXRkdrejIzP2Ylpisi7DvbfMtc=; b=UbrAP/soU6fc12+FMlbmIqLGE7afJ0iDvJp/kWQ4jIdhUnZIt5+rfG59X3OuR5Tp4a /D4OhY421xndDEo17osiUuF42z343yxwv0zgVjIMXfcOtTAuMabtaijhth+DeGjxgAE9 qyH8Iv0jr7mA0E7tW8VFSqPGdvGNecOWcnfStzVWiZJ989NdBGWGUHkz0r1OJpToLVQA I2icJkS7qocjH9nlWmx1+aNe0eFt2JyBFGtdtCktxN7ozXpEakygyAQOusovd2lm1/Uq qhwX2Leb06aU6KsD3unnTAiEsMME79alkoBrF/PqROUYNj2Bvy9H0uAVqF1SdEKpnSr3 OSLg== X-Gm-Message-State: AJIora+fYL2W22LyUFrOuPsCGBs1Gx+7ygkVDzuzW+HWxQ44hJIl73hi SNH6a3snqsyD2jhfuBjNORrUbaR1nBkhHCdK X-Google-Smtp-Source: AGRyM1s0fQviXlV1MbmGpdzRD1utZoJEVkLoOZPclN9kx0oHAEysU6F9VPmCidgt59Pa+gvHo2HSxw== X-Received: by 2002:a05:600c:4e54:b0:3a0:4e07:ce with SMTP id e20-20020a05600c4e5400b003a04e0700cemr2470555wmq.37.1656493049462; Wed, 29 Jun 2022 01:57:29 -0700 (PDT) Received: from naush-laptop.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id f15-20020a05600c154f00b003a032c88877sm2897102wmg.15.2022.06.29.01.57.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jun 2022 01:57:28 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Wed, 29 Jun 2022 09:57:21 +0100 Message-Id: <20220629085722.11786-4-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220629085722.11786-1-naush@raspberrypi.com> References: <20220629085722.11786-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 3/4] ipa: raspberrypi: imx477: Get sensor temperature from embedded data X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Naushir Patuck via libcamera-devel From: Naushir Patuck Reply-To: Naushir Patuck Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Fetch the sensor temperature value from the embedded data buffer and add it to the DeviceStatus structure in CamHelperImx477::PopulateMetadata(). Signed-off-by: Naushir Patuck Reviewed-by: Kieran Bingham Reviewed-by: David Plowman --- src/ipa/raspberrypi/cam_helper_imx477.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ipa/raspberrypi/cam_helper_imx477.cpp b/src/ipa/raspberrypi/cam_helper_imx477.cpp index 338fdc0c416a..0e1c0dbd142f 100644 --- a/src/ipa/raspberrypi/cam_helper_imx477.cpp +++ b/src/ipa/raspberrypi/cam_helper_imx477.cpp @@ -5,6 +5,7 @@ * cam_helper_imx477.cpp - camera helper for imx477 sensor */ +#include #include #include #include @@ -34,8 +35,9 @@ constexpr uint32_t gainHiReg = 0x0204; constexpr uint32_t gainLoReg = 0x0205; constexpr uint32_t frameLengthHiReg = 0x0340; constexpr uint32_t frameLengthLoReg = 0x0341; +constexpr uint32_t temperatureReg = 0x013a; constexpr std::initializer_list registerList = - { expHiReg, expLoReg, gainHiReg, gainLoReg, frameLengthHiReg, frameLengthLoReg }; + { expHiReg, expLoReg, gainHiReg, gainLoReg, frameLengthHiReg, frameLengthLoReg, temperatureReg }; class CamHelperImx477 : public CamHelper { @@ -171,6 +173,7 @@ void CamHelperImx477::PopulateMetadata(const MdParser::RegisterMap ®isters, deviceStatus.shutter_speed = Exposure(registers.at(expHiReg) * 256 + registers.at(expLoReg)); deviceStatus.analogue_gain = Gain(registers.at(gainHiReg) * 256 + registers.at(gainLoReg)); deviceStatus.frame_length = registers.at(frameLengthHiReg) * 256 + registers.at(frameLengthLoReg); + deviceStatus.sensor_temperature = std::clamp(registers.at(temperatureReg), -20, 80); metadata.Set("device.status", deviceStatus); }