From patchwork Fri Jun 24 07:35:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 16365 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 C3FBCBD808 for ; Fri, 24 Jun 2022 07:35:37 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 600CB6563D; Fri, 24 Jun 2022 09:35:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1656056137; bh=aw/1NuVF+9SHjjIH3cFOZ7ydPEJYmnwxzpNmg/Cnowo=; 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=COV8hlAnwYTFNlZ7JbHHMZBP+aH7prFKZ1hSkP3hOOl75mQ2wbCfjmW2q1WRnIDiK jj9sbFlcoX9+gsVZ5ElYdTwo8A9FmUWoKOdDZjI+nMZCu8gaEuo9jXWJXQ8PVzU5xC oSfYExTzyy2Dke/LZSVJJLzn5YyEctVr96pViuoWCo118+wZOTiW+r12ZwS54rJTIE z5EjqtN4cmUT+u7MqfbuSzUWAM6BZror8kcnRKSMVqf6ony+NQ8IKfzNj5mLDs/O9C GfHGKUDshJxN6VPZ1L8v8febjNCqUhJNBUskLFOQ4wVG5Fw2mtgGFK9kz57qawT0a2 kaQRGLWJITjQQ== Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4A69965633 for ; Fri, 24 Jun 2022 09:35:33 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="oOKPzor8"; dkim-atps=neutral Received: by mail-wm1-x336.google.com with SMTP id r81-20020a1c4454000000b003a0297a61ddso1368224wma.2 for ; Fri, 24 Jun 2022 00:35:33 -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=KJAuSaTd++kex691QD4SoGtyc7WqZ/kD/BSuFWZ8jMk=; b=oOKPzor80VfkdmMtxikvZ5oViBctb+7I58LEbxgg5Rp4zu2EXXAl1yOANZhuzqVUrN Gpa8efTdONjI4SUhAWwaGGLUrWPzKm2sjrlCJXYweHJu9X82GTzUzJ3g+mzJc8yIqFNF CKaZRhDnZPDFq9I+6yHmig5hCswM5ik0i6BJ8MolOxIHqzQ8nnngSmtp0tcCc43SPpBb yTFFCoLvg0lrLb1GFxGH40qmvuaGSl55SvYiJqsrFXN6kA8LUK9JUjTEvd0ZzB9DCJTj hFrUNLT88zeXvM1wCyjCRVaLAY9e8tvp1vr1w5uz0YXM1jCR4y9Y2jw12E3DfXtcgNtN mjtA== 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=KJAuSaTd++kex691QD4SoGtyc7WqZ/kD/BSuFWZ8jMk=; b=pk0hkCu34sIfXrvLD8jgt0xmIke89D4UTg3YrJLouHCo7vSF53rwfcfud35VsrF8AA wapLCrJCBBldvYyxs+cv76D4KxmAmH2ZRCbY2wNYyqhM6pGHvc6CplshyrEpLrp8PhoI 5DaO20qICs0fKFdvkMeCMaFqz1VtAFZwCmF/tEYg/e2u1dFEbOttWmy+B5U4JyMuBMPX qbGE2ZPWZn8VzRLzNcBUkTEEekgrE/taTbarGXj3eTPt+IQq4T/8szhvRhO5GnL7T2cK w3eq4grqgjFFeQP7LmNBuLYEbLUQUXKzzO9hxtTquTqEvz+wXQ2eABJziIJdvr61Py6h wMgw== X-Gm-Message-State: AJIora9eqA0y+Az3QPAUXN92KaEKmrohhHjFqtZS7+DS0yFkkN29g6lF PRS+KGX2ZGOW6bEGs4jfCJjimOZ31yG8mGBW X-Google-Smtp-Source: AGRyM1u7FV7mwUPKbveum89Q5+7WpZZDkf/SMbQ2/RK7TYqRkN8B/xF7Sh6jJ1mRcVw1r64RPPFd1Q== X-Received: by 2002:a05:600c:5021:b0:39c:6571:e0b0 with SMTP id n33-20020a05600c502100b0039c6571e0b0mr2083182wmr.177.1656056132729; Fri, 24 Jun 2022 00:35:32 -0700 (PDT) Received: from naush-laptop.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id f13-20020a05600c154d00b0039ee391a024sm6695195wmg.14.2022.06.24.00.35.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 00:35:32 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Fri, 24 Jun 2022 08:35:27 +0100 Message-Id: <20220624073528.26670-4-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220624073528.26670-1-naush@raspberrypi.com> References: <20220624073528.26670-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 3/4] 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 Reviewed-by: David Plowman --- 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); }