From patchwork Thu Jun 23 14:44:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 16337 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 2435DBE173 for ; Thu, 23 Jun 2022 14:44:32 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C135965638; Thu, 23 Jun 2022 16:44:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1655995471; bh=37hjOdpLwMa/PiC2Ww4+G/GjXVltegnzcMZGoqmZ2G8=; 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=ld7pYmqwP8fRTFFzzS8SoJYgFPYlWdtnC0GSVwfJ72RSS0WMGhaxI/YdL58eKtKEE j1mzndJu6P9z/w89NYE2dT6AWmsBHDYvvXoGUaStFQ38UCqufAXRZit2/Aoj6VG5wU lAu4+8CUY1+wFXl/kCZ+HJa4j9lS/bNL2FYjDz369lazTU65vknLxiRAwVRt9HHX06 Z3EWmBWzWmtSh/E2HbKpu6rnQIAs2FB5JagtuNGnhtCOhXY7qeh514jJGfZI6WM207 vFL4ZBEUYecZsnpKPJBkJvPg0bVOGr3awCbusRIyn1VutlFbFeWX/jDxxlWTKxSaUm xDGjCAiF4WOTQ== Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CDBD765633 for ; Thu, 23 Jun 2022 16:44:27 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="XM2Vwxdo"; dkim-atps=neutral Received: by mail-wr1-x436.google.com with SMTP id o16so28290296wra.4 for ; Thu, 23 Jun 2022 07:44:27 -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=ZQSWfzGzI0Jg8Y+WHIkgHcAVBtEnTvGWKXJLaGMe5Q4=; b=XM2VwxdoBGaGrRbkngKbYrnP0i0XW36rMLMfwE0gl0RJu5BSwuBs4fFvSogadeH54b R3z5z0DGuD4SwQsNq2Tw7ieO1Mbgq6mhLTj93FILa6UwrNYiEOYwx7/kJ91Xcs/2Bu8P hKKgKn13OToBac5EyMwjgFvdJ6exLx0qP/3f/oKj/61bacK2fobay9MJ6XU0+mmil/Fg XWxqwK/xvyE2Ok/tzjchpc803vhpsAtqFOG4gXRQ/tU4QY8qkeIILreU6y3mlQs8ynJB xGijoLgjudgh7nvZmxAtuqWG0aB2uaj8MQfneZCQNLZ9PEYn3vf+fQSxe07zaS0+rOAZ OlCA== 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=ZQSWfzGzI0Jg8Y+WHIkgHcAVBtEnTvGWKXJLaGMe5Q4=; b=UkDkVSlydxB/2tpzF2gTpijgNKV26v0Ypscs3+k/jcOV9JRysI/k0NphuYzfzIBhJE EDu5Ib4a+dUC6HZDL+Hu25zjIgS3YfO6OfVIoabUwarm+rP3pjf1S7kEGjbXd5QN027y wn1PTvwfvr/lTUevtoQ8oHZ6PEa30Wl/CwKVLKX6zvzQiszON5AT9OpCWXBo4w8y8Q5P w5cTAioZShdrUYXa9TlG83No5KiN/Q+pwao1PeZxlZ4tMlpZaNDt6VpwyOZS414nJHi5 SlJ09p/vIuvQ1kEFFhjpscCMdyevHJahCQKmijETtPF1T9sp9s9nITPLduB0zquRfN84 V0NQ== X-Gm-Message-State: AJIora+mEWROfLNGEOFIN5iG6fu9rYL4kXCG3ipkM6KAdu1D9oV6Cggc E5rGXhOPCJAhK4T+lbQhvotxXQuzsrkT/wdH X-Google-Smtp-Source: AGRyM1ubcXhyam1Vo0+EcTxkmYc8xc3cPvZaZBxpfZu67Wz76nVz9JzgRBznZDvstvLmZp02vwYeGA== X-Received: by 2002:adf:fd84:0:b0:21a:3d9d:dfa5 with SMTP id d4-20020adffd84000000b0021a3d9ddfa5mr8644347wrr.345.1655995467120; Thu, 23 Jun 2022 07:44:27 -0700 (PDT) Received: from naush-laptop.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id v21-20020a05600c15d500b0039c96b97359sm3178578wmf.37.2022.06.23.07.44.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 07:44:26 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Thu, 23 Jun 2022 15:44:10 +0100 Message-Id: <20220623144410.20725-4-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220623144410.20725-1-naush@raspberrypi.com> References: <20220623144410.20725-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 3/3] 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 --- 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); }