From patchwork Thu Jun 23 14:44:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 16335 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 9FDFBBE173 for ; Thu, 23 Jun 2022 14:44:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 15F466563D; Thu, 23 Jun 2022 16:44:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1655995468; bh=2g8qfZ/BzIF6vOv5vlNCQq8m7DZEPOZH02d8b4AMRqM=; 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=rS/3arwTfRJOTjMN7Oo5elslkZ0+90cLd497R0X3ixymeaOJCkY5IiRqV4DtfWneG D4m6BT0/oe9HxJV2/0ntn2Zm77wlWEvCckm1WEUWKVJldNc/JkNv9ryE3b5KKhg8e4 GEZqBJIa5cwOGSvspXrEOHodLKveDihZ7CMv1gwucvbdHmQnV18Q/RBgR31BqTubkd YksTeu8b5EcLHpSzLHxe87CnRd1dnXJ45ZYUiQga34T5oQL4QN2dJ4GRRsL/avPfVA yMZM5oym1ROQX0jjvrW/Wxpchwa2G7SkB6ZGli0h6/ydKtDqsJBs+OZT43G7lxG2x/ lHgz15aQPmx6A== Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B3FDC6048F for ; Thu, 23 Jun 2022 16:44:25 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="RSXgyp54"; dkim-atps=neutral Received: by mail-wr1-x42e.google.com with SMTP id i10so24523542wrc.0 for ; Thu, 23 Jun 2022 07:44:25 -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=HIaOx4I+brmBYzrNODHpznjH6x8JPYnEK2PGNcsYeKM=; b=RSXgyp54qNv2iJ4n99VcCMe4DNZQakKixLzfAgVJLV82Lz4tkVsSfbNvB3vQec/pzt RwMNLX5TDb/Dq1IwEw5OpvLDhnaCl3PhpuJ/otsrWgr2MGJA88HeSU8z+lPsdlobj4Lb Tl4JzpGi9zeucY5IkwJPDi/LASOoKudPI17OodTlU+4tmSMoJMmNVDwZ27EYLdAlcOrp aKe+VKJ1IoZKw7/bHJAoRN8LtRGSoJ2A7xaTD5f2yXNsgguwLb+/KEonTfYYQLk7ln/J Sf63iU1SL4O2K0fFIKxjRZ+oRRyTLbWM4bXUE4HhFLIN9NkHyflE1TQihDXHcVlfgBW5 CLcg== 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=HIaOx4I+brmBYzrNODHpznjH6x8JPYnEK2PGNcsYeKM=; b=IMes326pwlnqUuIn6WoLN/kS+JgKzf3179sELnNpq8LgvF/+kHmWBUX6BrdGNTH50Q D4+4jBDLZcU7ySadRjBWnfbAnvBX5nU6ld0ujWX/AQssARiAXHuLmNdMrCWIOicEY2Nu XKACwkCNE5kE8fSy7QSF4/UZspJa/31yh+Ac9VSAUntQ/koIXA1ulSnwsqM7u6BxXXJV NgIwKQC2YRr03+X53gsuHGJI5VM6Cwq99rgo2ZsFdfgAe31Bp3NP+7POj0a950P6CNKu qin15I7QaCrzmN4DBblx8wme4P5rhXIrxA1Q+jX7VF18TTmKf5gh5QQ5w0CxevtIsuNm 7/CA== X-Gm-Message-State: AJIora/WQLABslvmaoueiYGtJCPWYnqNlD/JvQ9SMxyQfUioz2o0d3DU gEdXU/v0lS2bNsySqyYU03P+ZG4+oTvYZniX X-Google-Smtp-Source: AGRyM1terWBCEQcu/U5wgXtogkrEUWi8ImWNWhBPNQckGDHVPmePkLddFydMuQ/NGvDvViDkpXvnsA== X-Received: by 2002:a05:6000:1f82:b0:21b:9241:a65b with SMTP id bw2-20020a0560001f8200b0021b9241a65bmr9034740wrb.42.1655995465271; Thu, 23 Jun 2022 07:44:25 -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.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 07:44:24 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Thu, 23 Jun 2022 15:44:08 +0100 Message-Id: <20220623144410.20725-2-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 1/3] libcamera: controls: Add SensorTemperature control 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" Add a SensorTemperature control to return the temperature of the camera sensor in Celsius. This control will only be present in the Request metadata if a thermal sensor is available to the camera sensor. Signed-off-by: Naushir Patuck Reviewed-by: Kieran Bingham --- src/libcamera/control_ids.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml index cd1d4512bf2e..ecab3ae97260 100644 --- a/src/libcamera/control_ids.yaml +++ b/src/libcamera/control_ids.yaml @@ -367,6 +367,16 @@ controls: size: [2] + - SensorTemperature: + type: float + description: | + Temperature measure from the camera sensor in Celsius. This is typically + obtained by a thermal sensor present on-die or in the camera module. The + range of reported temperatures is device dependent. + + The SensorTemperature control will only be returned in metadata if a + themal sensor is present. + - SensorTimestamp: type: int64_t description: | From patchwork Thu Jun 23 14:44:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 16336 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 42C01BE173 for ; Thu, 23 Jun 2022 14:44:31 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id ED17265640; Thu, 23 Jun 2022 16:44:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1655995471; bh=03a2ANdsxrFRWD+2YAbQ23SGmxqYgsIsFuZ86YP/8cI=; 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=I34OIA1c9+ew7Goxmh8zVOM8zEbezKuIjAtGh66GYNiqQjwM6RWWuVS17jZzOqt4m G95DpIrd6I9bNCiutSELKtEdgQV0CDnjjt5MagnX1gVQsqEscV1cHRgBMq1PeklLFC NUuxF/CUluLcYS8/oXUFLsPPJ5QzIBKpWPSUQVqBdgPFXqWtPXk/d0njpX3iQRZiSV pJuNjx8DWD9YwpWxVnlsy88nHn48/g0GAxC8s7wQdtZyj/WQRKdmTCUUzY8q2OoyKS 5gu2XTcJsysIgxmg5jjtaRQi3PY6T6ixPg95UvFqjDBsvcb0nZFVECLoT5DkBl7i8O efRJf4o7U/kjg== Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id ECF8A6563A for ; Thu, 23 Jun 2022 16:44:26 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="OdPY7SAh"; dkim-atps=neutral Received: by mail-wr1-x42a.google.com with SMTP id r20so7864595wra.1 for ; Thu, 23 Jun 2022 07:44:26 -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=E86bYylqH36xxjXjHLA0Hj3cU2ciiltp7NwZLTqDbMI=; b=OdPY7SAhlDlrssi1T/GjJoXZcd03ROMd7MccBviNSmmbrwtft23YkN2Q/DCOG34PLz dlE/o0igMQX+AdqSgAl3/LoOmWlHqAYPqZu3CqFtdVJv2VNQiQIPoeypBFCt3N2Iqhhe HiFj7iW/M1dI62o01G97uOljcJJYp46nI/zLBakReGMKyB027XKdkRQpM2l3qNXVf4ZJ 1u4VNJRIK0t97fv7rIx8l0nhXzmojvsrKNsoUk6oP0PXq6s9Y/tPej5MLxTCXj3U1PvQ anefIpIFSe19hTlJurn9AQVOfsPSXJ8FaM/0xYaqaQPtKCzQN5sGNLWXePkBf3hbmMC2 JC7Q== 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=E86bYylqH36xxjXjHLA0Hj3cU2ciiltp7NwZLTqDbMI=; b=fplSZ6xEHEhN6sVm2/gTq/5BZWU6HtnnOV5xpYLgmAqKS+CTLtPY7H4rk9YBpVwD8x 432f0RR0OPU9N2NzaVqes5tK2+NbhOcclw+l136mQctiO2DXx4Md4uXTMtsTCN58e9tb R3mqRloy29LF3PPNQ9lNgE05qj2EiIiafYK7kODMjqIfDVSOiCwTLo/50EDU6VUk3k0E ycPhJFBjbbKW2oFG51lR7CvErAKdZAYhOd052z1NZ/RWXTerUSNnjCZvzYFWQl/93Jv/ L7OmFdt1Am9dErubM2lhH3CHuXa4jVLVdG6NqG1wjF8Eck+P3Pgagcp1mVwLvhJw17fN o0LA== X-Gm-Message-State: AJIora87LOM4zmCemYM2RmUn62UqPv7EqNEQGjki7trS7Z3mDPpGkp8a /MnCQcH3LK67x/g7qDzCPJcdu5x0jrWsq8Mc X-Google-Smtp-Source: AGRyM1sbocVh5BUuQyz1jsD9/cXx18hoB6RygQzqrB1tgyTO6CBBe/bGFpF4BQHCUH9t/3YuPGAHGA== X-Received: by 2002:adf:d1ed:0:b0:215:98d7:2a93 with SMTP id g13-20020adfd1ed000000b0021598d72a93mr8807420wrd.637.1655995466319; Thu, 23 Jun 2022 07:44:26 -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.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 07:44:25 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Thu, 23 Jun 2022 15:44:09 +0100 Message-Id: <20220623144410.20725-3-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 2/3] ipa: raspberrypi: Add sensor temperature to DeviceStatus 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" Add a sensor_temperature field to the DeviceStatus structure. The default value of -300.0 indicates a temperature measurement is unavilable. If a temperature measurement is available for a frame, the value is returned out through the SensorTemperature control in the Request metadata. Additionally, provide the sensor temperature value from the std::ostream &operator<< overload. Signed-off-by: Naushir Patuck --- src/ipa/raspberrypi/cam_helper.cpp | 7 ++++--- src/ipa/raspberrypi/controller/device_status.cpp | 3 +++ src/ipa/raspberrypi/controller/device_status.h | 4 +++- src/ipa/raspberrypi/raspberrypi.cpp | 2 ++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/ipa/raspberrypi/cam_helper.cpp b/src/ipa/raspberrypi/cam_helper.cpp index 74179399e86a..046428de8545 100644 --- a/src/ipa/raspberrypi/cam_helper.cpp +++ b/src/ipa/raspberrypi/cam_helper.cpp @@ -185,9 +185,9 @@ void CamHelper::parseEmbeddedData(Span buffer, metadata.Merge(parsedMetadata); /* - * Overwrite the exposure/gain values in the existing DeviceStatus with - * values from the parsed embedded buffer. Fetch it first in case any - * other fields were set meaningfully. + * Overwrite the exposure/gain, frame length and sensor temperature values + * in the existing DeviceStatus with values from the parsed embedded buffer. + * Fetch it first in case any other fields were set meaningfully. */ DeviceStatus deviceStatus, parsedDeviceStatus; if (metadata.Get("device.status", deviceStatus) || @@ -199,6 +199,7 @@ void CamHelper::parseEmbeddedData(Span buffer, deviceStatus.shutter_speed = parsedDeviceStatus.shutter_speed; deviceStatus.analogue_gain = parsedDeviceStatus.analogue_gain; deviceStatus.frame_length = parsedDeviceStatus.frame_length; + deviceStatus.sensor_temperature = parsedDeviceStatus.sensor_temperature; LOG(IPARPI, Debug) << "Metadata updated - " << deviceStatus; diff --git a/src/ipa/raspberrypi/controller/device_status.cpp b/src/ipa/raspberrypi/controller/device_status.cpp index f052ea8b7bed..1a376eecb1c3 100644 --- a/src/ipa/raspberrypi/controller/device_status.cpp +++ b/src/ipa/raspberrypi/controller/device_status.cpp @@ -17,5 +17,8 @@ std::ostream &operator<<(std::ostream &out, const DeviceStatus &d) << " Lens: " << d.lens_position << " Flash: " << d.flash_intensity; + if (d.sensor_temperature != -300) + out << " Temperature: " << d.sensor_temperature; + return out; } diff --git a/src/ipa/raspberrypi/controller/device_status.h b/src/ipa/raspberrypi/controller/device_status.h index c4a5d9c8e8c7..53cfeedc2956 100644 --- a/src/ipa/raspberrypi/controller/device_status.h +++ b/src/ipa/raspberrypi/controller/device_status.h @@ -19,7 +19,7 @@ struct DeviceStatus { DeviceStatus() : shutter_speed(std::chrono::seconds(0)), frame_length(0), analogue_gain(0.0), lens_position(0.0), aperture(0.0), - flash_intensity(0.0) + flash_intensity(0.0), sensor_temperature(-300.0) { } @@ -36,4 +36,6 @@ struct DeviceStatus { double aperture; /* proportional to brightness with 0 = no flash, 1 = maximum flash */ double flash_intensity; + /* Sensor reported temperature value (in degrees) */ + double sensor_temperature; }; diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 3b126bb5175e..fb91c8d11f6c 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -491,6 +491,8 @@ void IPARPi::reportMetadata() libcameraMetadata_.set(controls::AnalogueGain, deviceStatus->analogue_gain); libcameraMetadata_.set(controls::FrameDuration, helper_->Exposure(deviceStatus->frame_length).get()); + if (deviceStatus->sensor_temperature != -300) + libcameraMetadata_.set(controls::SensorTemperature, deviceStatus->sensor_temperature); } AgcStatus *agcStatus = rpiMetadata_.GetLocked("agc.status"); 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); }