[{"id":23555,"web_url":"https://patchwork.libcamera.org/comment/23555/","msgid":"<165600127838.1149771.14029796880955302778@Monstersaurus>","date":"2022-06-23T16:21:18","subject":"Re: [libcamera-devel] [PATCH 3/3] ipa: raspberrypi: imx477: Get\n\tsensor temperature from embedded data","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Naushir Patuck via libcamera-devel (2022-06-23 15:44:10)\n> Fetch the sensor temperature value from the embedded data buffer and add it to\n> the DeviceStatus structure in CamHelperImx477::PopulateMetadata().\n> \n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> ---\n>  src/ipa/raspberrypi/cam_helper_imx477.cpp | 5 ++++-\n>  1 file changed, 4 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/ipa/raspberrypi/cam_helper_imx477.cpp b/src/ipa/raspberrypi/cam_helper_imx477.cpp\n> index 338fdc0c416a..0e1c0dbd142f 100644\n> --- a/src/ipa/raspberrypi/cam_helper_imx477.cpp\n> +++ b/src/ipa/raspberrypi/cam_helper_imx477.cpp\n> @@ -5,6 +5,7 @@\n>   * cam_helper_imx477.cpp - camera helper for imx477 sensor\n>   */\n>  \n> +#include <algorithm>\n>  #include <assert.h>\n>  #include <cmath>\n>  #include <stddef.h>\n> @@ -34,8 +35,9 @@ constexpr uint32_t gainHiReg = 0x0204;\n>  constexpr uint32_t gainLoReg = 0x0205;\n>  constexpr uint32_t frameLengthHiReg = 0x0340;\n>  constexpr uint32_t frameLengthLoReg = 0x0341;\n> +constexpr uint32_t temperatureReg = 0x013a;\n>  constexpr std::initializer_list<uint32_t> registerList =\n> -       { expHiReg, expLoReg, gainHiReg, gainLoReg, frameLengthHiReg, frameLengthLoReg  };\n> +       { expHiReg, expLoReg, gainHiReg, gainLoReg, frameLengthHiReg, frameLengthLoReg, temperatureReg  };\n>  \n>  class CamHelperImx477 : public CamHelper\n>  {\n> @@ -171,6 +173,7 @@ void CamHelperImx477::PopulateMetadata(const MdParser::RegisterMap &registers,\n>         deviceStatus.shutter_speed = Exposure(registers.at(expHiReg) * 256 + registers.at(expLoReg));\n>         deviceStatus.analogue_gain = Gain(registers.at(gainHiReg) * 256 + registers.at(gainLoReg));\n>         deviceStatus.frame_length = registers.at(frameLengthHiReg) * 256 + registers.at(frameLengthLoReg);\n> +       deviceStatus.sensor_temperature = std::clamp<int8_t>(registers.at(temperatureReg), -20, 80);\n\nI don't think this code changes even if the sensor_temperature was a\nstd::optional<>, so:\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n\n>  \n>         metadata.Set(\"device.status\", deviceStatus);\n>  }\n> -- \n> 2.25.1\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 72AF9BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 23 Jun 2022 16:21:23 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C5DC765635;\n\tThu, 23 Jun 2022 18:21:22 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 37D926048F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 23 Jun 2022 18:21:21 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 977FCDD;\n\tThu, 23 Jun 2022 18:21:20 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1656001282;\n\tbh=N663+9Z87trZPEWv3tegZ20tY11OA8jh8j1VpXuB6zM=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=e+73JF51pOKNJf9kz6Qg8+KqYjK7G4YZIY+E6HOx8N5q0ES746uaRp4zKjrECYyzA\n\tdPEERJrAAXKy2djyrYYW3yVeo/9aNwyTRlptp0I/ghSn4NVbX/lgj+wVA08u5hgvbP\n\tRlL1k7Y3kl3hYmP44GZtjAjhDA6Sr8TUzb7p5GJ/zqBH1x4fuvwdoID/RFNdpidnDc\n\tuZKgmFBv2Of1hwcTmdjlTpqcZam67fRB20lEjrQnKm0h06AwEMAmwKYXhjJZPFmnU6\n\tU6hDaMTHDwmy77ntse9wHqZfqhHApeXeDJQfGFEr3r8Y6o6kv/+iXX4TA0XyOwqOrb\n\trVsRX9XUrkc6A==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1656001280;\n\tbh=N663+9Z87trZPEWv3tegZ20tY11OA8jh8j1VpXuB6zM=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=vunBSBoHUx6Tnt/Imo+l2RIjTY0g0rLdYz2BvgsD9lv6LG/OQUwnCBTEpRKPziJAw\n\tGcSZ0nMMalRMYX1rNGYu1W4mxhTGSFpg+fE5+/KzrFjzNrN6miTRfWutpRPk0nRv+G\n\t2+5ZoViqS/q51xNSou57tqPHlC5kERIKQGZQak7E="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"vunBSBoH\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20220623144410.20725-4-naush@raspberrypi.com>","References":"<20220623144410.20725-1-naush@raspberrypi.com>\n\t<20220623144410.20725-4-naush@raspberrypi.com>","To":"Naushir Patuck <naush@raspberrypi.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Thu, 23 Jun 2022 17:21:18 +0100","Message-ID":"<165600127838.1149771.14029796880955302778@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH 3/3] ipa: raspberrypi: imx477: Get\n\tsensor temperature from embedded data","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]