[{"id":23636,"web_url":"https://patchwork.libcamera.org/comment/23636/","msgid":"<CAHW6GYKq=mhSGYSFF=nhCUdy3O4oB3A4tiz=rerBx+f-jzetHg@mail.gmail.com>","date":"2022-06-28T08:30:36","subject":"Re: [libcamera-devel] [PATCH v2 3/4] ipa: raspberrypi: imx477: Get\n\tsensor temperature from embedded data","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/people/42/","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"content":"Hi Naush\n\nThanks for the patch!\n\nOn Fri, 24 Jun 2022 at 08:35, Naushir Patuck via libcamera-devel\n<libcamera-devel@lists.libcamera.org> wrote:\n>\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> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.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 guess I'm mildly curious if out-of-bounds values from the register\nmean anything, but probably not worth worrying ourselves about too\nmuch. So:\n\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n\nThanks\nDavid\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 08038BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 28 Jun 2022 08:30:51 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1ED9B65635;\n\tTue, 28 Jun 2022 10:30:50 +0200 (CEST)","from mail-ed1-x535.google.com (mail-ed1-x535.google.com\n\t[IPv6:2a00:1450:4864:20::535])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A71E26559A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Jun 2022 10:30:48 +0200 (CEST)","by mail-ed1-x535.google.com with SMTP id fd6so16459154edb.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Jun 2022 01:30:48 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1656405050;\n\tbh=+Vlz/CQI1sNFkYDbdKPIu45BSfrEEwmCak9i5Kh+oxs=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=uaH4vDCRk1/Zbr9fFdYPh4dbfSp8akedrrOkTiKi/e4zmGIBcIyMpJqjfNZW/jZ93\n\t6OT0OYhy3Q/BufC428v3jY4dnCuVY04X2ybiIRVP0ol9Mn8CVcrSkba3gsdwRapFs6\n\tKJPCOJZ0pLlxg7N0bVN6d5FnrAqNPgSb/lPAAUHcnlIkfYp2N0BhNAmqZLiO6kUETh\n\tlvfKtiIxXRXiIpi+wRVJLy3QRJIvsjxd6WvcJo3U1teRu9jqGbQjpYRYLqqLI1+r3w\n\t1E3yqjCke6aqCD4lY5uxJGsqY2VUlCQGU5bYCyo5zxLdSlqTO7s/HJcQvjQG1Sfzpr\n\tN7UMvq8JWrXDg==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=N5W+gtmVhCakDlA+/kuiDcpouhT1mwcVCUHabOrHyfw=;\n\tb=NMxVKsl80j4AtRyhfQ6iHs6ipy8e71/aDZtNDwKBBxzUDwTSH1A1x/6MPDa/Ym7tLn\n\tPxUfzAMYOzfboNTF/tF1Xzxp/OylX+mfi78QRhrVpd8hhFSUzmFPFk5NK30dfgvTT1tJ\n\tylfCLYXQi3k3mg1ZZVpdW9Y+/3YqMeQCdIheIXk3seu65qtS1jJkjKGofCY+xs2UjjHj\n\tcrm7cvyMfjToadC7+fB1Tk0j+ZBRkeR0NrSJUHWTBtiNKIH9vyYa2elq0KhT8u4LgH/K\n\twucfGA1yR9Sr7ZyrMxfBOubyVzIb/RJ6boBr6eUvDNpMW+gP1pHqM6/mOzMkhFoVQcxL\n\twRSw=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"NMxVKsl8\"; 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:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=N5W+gtmVhCakDlA+/kuiDcpouhT1mwcVCUHabOrHyfw=;\n\tb=meLn5qZ7JDcNO16HeN334ir+c/DENXW4i8gb9SxQrehdAUiGXOzKCjAGdAjHyqrsIN\n\tIaGJ0bENW30KzLBWf7b+LaBBlOwvVafoqaEtOxmmQETaF1Q5JGIS89H9aWV2eTKfxGrz\n\tiamrEtIfG0NQu8E4WioItidVEX+u8HOWC0DMRQbVs6vAnYiAE9N1fq1l0UQbK7P/bqnp\n\tOo0QjF2rPa8fcVRJVa9EUcrsINiS57r6Qdel31Bxyiw1XgxIRTaU53WcheNL3SL1wER7\n\t5IDupnzeYo7dqL3czQa8F3nILSTmBvKOhDIhYkSCnZq9VW8uPwSOI7TAfsLbu7sBt0Ja\n\tusow==","X-Gm-Message-State":"AJIora8tlcc9zMNpRm9h9iSXm3x3O68bBOwPsXJOxBDsyap90spBfVjD\n\tvZoPENk9f7uKwp68lwu+KF1CFxVpIA/0HUPwbkAKLxpFRs3wEQ==","X-Google-Smtp-Source":"AGRyM1s7ertdfpqT6dRNIqG2fAaUbBRozFxz6S0KsjSA1+d4Nz1AUBsr2ioGhlf6Ojv/YHyqek+qIanBnnv+Vx9BsU8=","X-Received":"by 2002:a05:6402:2392:b0:435:824e:b661 with SMTP id\n\tj18-20020a056402239200b00435824eb661mr21840533eda.13.1656405047549;\n\tTue, 28 Jun 2022 01:30:47 -0700 (PDT)","MIME-Version":"1.0","References":"<20220624073528.26670-1-naush@raspberrypi.com>\n\t<20220624073528.26670-4-naush@raspberrypi.com>","In-Reply-To":"<20220624073528.26670-4-naush@raspberrypi.com>","Date":"Tue, 28 Jun 2022 09:30:36 +0100","Message-ID":"<CAHW6GYKq=mhSGYSFF=nhCUdy3O4oB3A4tiz=rerBx+f-jzetHg@mail.gmail.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH v2 3/4] 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":"David Plowman via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"David Plowman <david.plowman@raspberrypi.com>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":23638,"web_url":"https://patchwork.libcamera.org/comment/23638/","msgid":"<CAEmqJPqbmq18psGVE1CjFYv58ZZbckcJL9hyfcHpyi4FD-SWBQ@mail.gmail.com>","date":"2022-06-28T08:38:18","subject":"Re: [libcamera-devel] [PATCH v2 3/4] ipa: raspberrypi: imx477: Get\n\tsensor temperature from embedded data","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"content":"Hi David,\n\nThanks for your feedback.\n\nOn Tue, 28 Jun 2022 at 09:30, David Plowman <david.plowman@raspberrypi.com>\nwrote:\n\n> Hi Naush\n>\n> Thanks for the patch!\n>\n> On Fri, 24 Jun 2022 at 08:35, Naushir Patuck via libcamera-devel\n> <libcamera-devel@lists.libcamera.org> wrote:\n> >\n> > Fetch the sensor temperature value from the embedded data buffer and add\n> it to\n> > the DeviceStatus structure in CamHelperImx477::PopulateMetadata().\n> >\n> > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.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\n> 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,\n> frameLengthLoReg  };\n> > +       { expHiReg, expLoReg, gainHiReg, gainLoReg, frameLengthHiReg,\n> frameLengthLoReg, temperatureReg  };\n> >\n> >  class CamHelperImx477 : public CamHelper\n> >  {\n> > @@ -171,6 +173,7 @@ void CamHelperImx477::PopulateMetadata(const\n> MdParser::RegisterMap &registers,\n> >         deviceStatus.shutter_speed = Exposure(registers.at(expHiReg) *\n> 256 + registers.at(expLoReg));\n> >         deviceStatus.analogue_gain = Gain(registers.at(gainHiReg) * 256\n> + registers.at(gainLoReg));\n> >         deviceStatus.frame_length = registers.at(frameLengthHiReg) *\n> 256 + registers.at(frameLengthLoReg);\n> > +       deviceStatus.sensor_temperature = std::clamp<int8_t>(\n> registers.at(temperatureReg), -20, 80);\n>\n> I guess I'm mildly curious if out-of-bounds values from the register\n> mean anything, but probably not worth worrying ourselves about too\n> much.\n\n\nFrom the datasheet, the register is treated as a signed 8-bit value, but\nwith the\n-20 C to 80 C limits. I'm not sure if this means that these limits are\nrecommended and\nthe register can provide temperature measurements of -128C to 127C. Or\nperhaps the\nregister never goes beyond the -20 C to 80 C limits..? Either way, I am not\nworrying too\nmuch about it.\n\nNaush\n\n\n\n> So:\n>\n> Reviewed-by: David Plowman <david.plowman@raspberrypi.com>\n>\n> Thanks\n> David\n>\n> >\n> >         metadata.Set(\"device.status\", deviceStatus);\n> >  }\n> > --\n> > 2.25.1\n> >\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 EFAFABE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 28 Jun 2022 08:38:35 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 333BC65635;\n\tTue, 28 Jun 2022 10:38:35 +0200 (CEST)","from mail-lf1-x134.google.com (mail-lf1-x134.google.com\n\t[IPv6:2a00:1450:4864:20::134])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 88CF16559A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Jun 2022 10:38:33 +0200 (CEST)","by mail-lf1-x134.google.com with SMTP id j21so21049943lfe.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Jun 2022 01:38:33 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1656405515;\n\tbh=+zJ9v3Z9xRpdDsGW3wAcgmxCdVy0jHgbaz8bdxXo3dY=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=p7RQl2IteI3bu/4R+lB2w2MNMynZFPFzs1pLG3irC3Dp5SWK2RZQj9Pdu6wYk9N6m\n\tmim0TABP1GJ2tCaMvCq/3E8qXjuP8HxX/SKup3bgy8rwsbFphhRJAJCuILi7rGY+Fy\n\t3LfjQ1xWAPQMgAi2oG7WPhZZuukRR0Q9NZiFJO0UGQ+Y4N1EiCiu3C8DyK5pcijJSY\n\tkHCHujJD94uAZMK38Hh6qKyidryhA3G2i5FtBGqDVL0g284G4YF+w1uz6/qgROn4Ww\n\tsBJNiLcCyfpFqn5a7/tviv0I007yq1ld3Y9R68LHzzqGkbnCdmen6Ihew1CgmhnyT7\n\tzDEflXG5yTY7w==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=e5Ykou1KYgmidAGxsr2CyE9eAg+aWLVGcjz+ncoZz1M=;\n\tb=o9HNLvrAwSrUzN0EHlfVdeI/VqxyAFkiiYeakG3PbHibopbF4sa3WndKHpjYs7aOwQ\n\tOHyfyODbSCJP3AlU6aTbTOH8YU+1zCHMf3VjVlyJoyBmR/jhBrByeiAyNBjPS1IS+mde\n\tBqDugPuYO09h6EAtUOKaUDmOx/yx8wSaZ+8wqMdNfgFu54NCAbrgf0FXwmzlQo8FhVnV\n\tnulEDApSeHVgSLPVf5h3xnj4oFoObruB7gIyZKd8ybZE30peZzjNDaEYmgb9HMiDBVcI\n\tYGQJUvXGhFDVQg4ddU6ryDXdymSL913NRY9OhV6J0c8uAZjKncbhk91UunmOPLUX//wO\n\tiySQ=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"o9HNLvrA\"; 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:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=e5Ykou1KYgmidAGxsr2CyE9eAg+aWLVGcjz+ncoZz1M=;\n\tb=1CYPn8GQ4xV39h2jGy3bg/108d/W+eR3Sl4gTSQJaO1vS936p7KleNcr7XpwpauxxK\n\tF5m6mct2WxZ8+iAjD96cYJppGnaslHXqOdQ++1ZY8e5DCySzT9EZ3mkG+DDuoxKTKPi7\n\tskh85NFV0eQmUcEGQjXNqnRKmAJqczi8Z+s3df5kHKOe3jALmOMZytrTx9IY5QvKujY9\n\tPCIdVzOcjCi/Zj9cjK+lN/I42qL9Rd3lgreFtqrwXVlRGD6tgkPEiG7kP20vtL7He4/R\n\tyXRmcojwFuE4455qAmbdeoVW0zkcBkz+iv277Hj7aN0Pw7GaTingbz0sfyHy3tM9wH1j\n\t2x0Q==","X-Gm-Message-State":"AJIora9vuLSDU3qlF5im6fAeuRHIZo5uFbnXZBei1p7/C6i3KJE95sW8\n\tXEC2kt0BwJWNo+nBvJ2Lwzq2SxQ5o98/xJgyLHzxOw==","X-Google-Smtp-Source":"AGRyM1u35c4SENSr+TmMDbQFBA3XrXhQmUTt6ZLSAr69RiwvP1gTCi4A5TLC1DYElQ+/MV62e8tvNWTBRRErZ185Utk=","X-Received":"by 2002:a05:6512:1149:b0:480:77ae:cdbe with SMTP id\n\tm9-20020a056512114900b0048077aecdbemr10828221lfg.604.1656405512745;\n\tTue, 28 Jun 2022 01:38:32 -0700 (PDT)","MIME-Version":"1.0","References":"<20220624073528.26670-1-naush@raspberrypi.com>\n\t<20220624073528.26670-4-naush@raspberrypi.com>\n\t<CAHW6GYKq=mhSGYSFF=nhCUdy3O4oB3A4tiz=rerBx+f-jzetHg@mail.gmail.com>","In-Reply-To":"<CAHW6GYKq=mhSGYSFF=nhCUdy3O4oB3A4tiz=rerBx+f-jzetHg@mail.gmail.com>","Date":"Tue, 28 Jun 2022 09:38:18 +0100","Message-ID":"<CAEmqJPqbmq18psGVE1CjFYv58ZZbckcJL9hyfcHpyi4FD-SWBQ@mail.gmail.com>","To":"David Plowman <david.plowman@raspberrypi.com>","Content-Type":"multipart/alternative; boundary=\"000000000000310e6205e27df6c5\"","Subject":"Re: [libcamera-devel] [PATCH v2 3/4] 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":"Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Naushir Patuck <naush@raspberrypi.com>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]