{"id":16337,"url":"https://patchwork.libcamera.org/api/patches/16337/?format=json","web_url":"https://patchwork.libcamera.org/patch/16337/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20220623144410.20725-4-naush@raspberrypi.com>","date":"2022-06-23T14:44:10","name":"[libcamera-devel,3/3] ipa: raspberrypi: imx477: Get sensor temperature from embedded data","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"875e8690b818df4c8a535a46b90cba8ee50446e5","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/16337/mbox/","series":[{"id":3212,"url":"https://patchwork.libcamera.org/api/series/3212/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3212","date":"2022-06-23T14:44:07","name":"Add SensorTemperature control","version":1,"mbox":"https://patchwork.libcamera.org/series/3212/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16337/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16337/checks/","tags":{},"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 2435DBE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 23 Jun 2022 14:44:32 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C135965638;\n\tThu, 23 Jun 2022 16:44:31 +0200 (CEST)","from mail-wr1-x436.google.com (mail-wr1-x436.google.com\n\t[IPv6:2a00:1450:4864:20::436])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CDBD765633\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 23 Jun 2022 16:44:27 +0200 (CEST)","by mail-wr1-x436.google.com with SMTP id o16so28290296wra.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 23 Jun 2022 07:44:27 -0700 (PDT)","from naush-laptop.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tv21-20020a05600c15d500b0039c96b97359sm3178578wmf.37.2022.06.23.07.44.26\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 23 Jun 2022 07:44:26 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1655995471;\n\tbh=37hjOdpLwMa/PiC2Ww4+G/GjXVltegnzcMZGoqmZ2G8=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=ld7pYmqwP8fRTFFzzS8SoJYgFPYlWdtnC0GSVwfJ72RSS0WMGhaxI/YdL58eKtKEE\n\tj1mzndJu6P9z/w89NYE2dT6AWmsBHDYvvXoGUaStFQ38UCqufAXRZit2/Aoj6VG5wU\n\tlAu4+8CUY1+wFXl/kCZ+HJa4j9lS/bNL2FYjDz369lazTU65vknLxiRAwVRt9HHX06\n\tZ3EWmBWzWmtSh/E2HbKpu6rnQIAs2FB5JagtuNGnhtCOhXY7qeh514jJGfZI6WM207\n\tvFL4ZBEUYecZsnpKPJBkJvPg0bVOGr3awCbusRIyn1VutlFbFeWX/jDxxlWTKxSaUm\n\txDGjCAiF4WOTQ==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=ZQSWfzGzI0Jg8Y+WHIkgHcAVBtEnTvGWKXJLaGMe5Q4=;\n\tb=XM2VwxdoBGaGrRbkngKbYrnP0i0XW36rMLMfwE0gl0RJu5BSwuBs4fFvSogadeH54b\n\tR3z5z0DGuD4SwQsNq2Tw7ieO1Mbgq6mhLTj93FILa6UwrNYiEOYwx7/kJ91Xcs/2Bu8P\n\thKKgKn13OToBac5EyMwjgFvdJ6exLx0qP/3f/oKj/61bacK2fobay9MJ6XU0+mmil/Fg\n\tXWxqwK/xvyE2Ok/tzjchpc803vhpsAtqFOG4gXRQ/tU4QY8qkeIILreU6y3mlQs8ynJB\n\txGijoLgjudgh7nvZmxAtuqWG0aB2uaj8MQfneZCQNLZ9PEYn3vf+fQSxe07zaS0+rOAZ\n\tOlCA=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"XM2Vwxdo\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=ZQSWfzGzI0Jg8Y+WHIkgHcAVBtEnTvGWKXJLaGMe5Q4=;\n\tb=UkDkVSlydxB/2tpzF2gTpijgNKV26v0Ypscs3+k/jcOV9JRysI/k0NphuYzfzIBhJE\n\tEDu5Ib4a+dUC6HZDL+Hu25zjIgS3YfO6OfVIoabUwarm+rP3pjf1S7kEGjbXd5QN027y\n\twn1PTvwfvr/lTUevtoQ8oHZ6PEa30Wl/CwKVLKX6zvzQiszON5AT9OpCWXBo4w8y8Q5P\n\tw5cTAioZShdrUYXa9TlG83No5KiN/Q+pwao1PeZxlZ4tMlpZaNDt6VpwyOZS414nJHi5\n\tSlJ09p/vIuvQ1kEFFhjpscCMdyevHJahCQKmijETtPF1T9sp9s9nITPLduB0zquRfN84\n\tV0NQ==","X-Gm-Message-State":"AJIora+mEWROfLNGEOFIN5iG6fu9rYL4kXCG3ipkM6KAdu1D9oV6Cggc\n\tE5rGXhOPCJAhK4T+lbQhvotxXQuzsrkT/wdH","X-Google-Smtp-Source":"AGRyM1ubcXhyam1Vo0+EcTxkmYc8xc3cPvZaZBxpfZu67Wz76nVz9JzgRBznZDvstvLmZp02vwYeGA==","X-Received":"by 2002:adf:fd84:0:b0:21a:3d9d:dfa5 with SMTP id\n\td4-20020adffd84000000b0021a3d9ddfa5mr8644347wrr.345.1655995467120; \n\tThu, 23 Jun 2022 07:44:27 -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","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 3/3] ipa: raspberrypi: imx477: Get sensor\n\ttemperature 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":"Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Naushir Patuck <naush@raspberrypi.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Fetch the sensor temperature value from the embedded data buffer and add it to\nthe DeviceStatus structure in CamHelperImx477::PopulateMetadata().\n\nSigned-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(-)","diff":"diff --git a/src/ipa/raspberrypi/cam_helper_imx477.cpp b/src/ipa/raspberrypi/cam_helper_imx477.cpp\nindex 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-\t{ expHiReg, expLoReg, gainHiReg, gainLoReg, frameLengthHiReg, frameLengthLoReg  };\n+\t{ 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 \tdeviceStatus.shutter_speed = Exposure(registers.at(expHiReg) * 256 + registers.at(expLoReg));\n \tdeviceStatus.analogue_gain = Gain(registers.at(gainHiReg) * 256 + registers.at(gainLoReg));\n \tdeviceStatus.frame_length = registers.at(frameLengthHiReg) * 256 + registers.at(frameLengthLoReg);\n+\tdeviceStatus.sensor_temperature = std::clamp<int8_t>(registers.at(temperatureReg), -20, 80);\n \n \tmetadata.Set(\"device.status\", deviceStatus);\n }\n","prefixes":["libcamera-devel","3/3"]}