From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D43C0219E0; Mon, 23 Jun 2025 21:22:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750713768; cv=none; b=q59osckpDPaPpM2bQEDKNPw+xynyPPrr+SYzCkeqOZguELpAkKPjexhLxmg0dLYaC4rpRoFtvMQtR7HmMXx9kBKUfnqx6hwEhZJjtOk0y+2TTY5FaCP1QcHO6k7YTmK00+W/9W1NQrV/rX1h8DrpreTnlVktad6GxdS8acJD9fs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750713768; c=relaxed/simple; bh=PssDxJ/HftaUASlRDgS7UHSr5EBRuyZ2RVOO9im6f7c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Pq68hDxkzpKXcizILWsZ04nKLKBZvXxkLmxn8gDMA3JZFm7HbjDOjQM74tQPaAihjQblrVG5jS3TJRM/OAj0I4FSBS0+TIGBdHXywUHoqPiK6GDOGQR4v2b4LOVTJHEyoz7sHkGXhBXs1skCMfQQldd0ZoyTalxp73op+nCTsOw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Sia4ttqc; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Sia4ttqc" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E58BC4CEEA; Mon, 23 Jun 2025 21:22:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750713768; bh=PssDxJ/HftaUASlRDgS7UHSr5EBRuyZ2RVOO9im6f7c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sia4ttqc6I7hOturmuLPZiMyKZvpW+eeLjYkXy6oEpQNpyYVVB70ouuAHOIO1Q1Rz Fm49+we7ISdUod1cJxvgYW5O2plktBqWNI40XaFKaBBdfcVx+252jqZVSFagWuo/w2 g0zYDwqCjexpePB98E/RrsA/7ytA4Zyw7EB75rH0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sean Nyekjaer , Jean-Baptiste Maneyrol , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 6.6 114/290] iio: imu: inv_icm42600: Fix temperature calculation Date: Mon, 23 Jun 2025 15:06:15 +0200 Message-ID: <20250623130630.378348186@linuxfoundation.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250623130626.910356556@linuxfoundation.org> References: <20250623130626.910356556@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sean Nyekjaer commit e2f820014239df9360064079ae93f838ff3b7f8c upstream. >>From the documentation: "offset to be added to [Y]_raw prior toscaling by [Y]_scale" Offset should be applied before multiplying scale, so divide offset by scale to make this correct. Fixes: bc3eb0207fb5 ("iio: imu: inv_icm42600: add temperature sensor support") Signed-off-by: Sean Nyekjaer Acked-by: Jean-Baptiste Maneyrol Link: https://patch.msgid.link/20250502-imu-v1-1-129b8391a4e3@geanix.com Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/imu/inv_icm42600/inv_icm42600_temp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/drivers/iio/imu/inv_icm42600/inv_icm42600_temp.c +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_temp.c @@ -67,16 +67,18 @@ int inv_icm42600_temp_read_raw(struct ii return IIO_VAL_INT; /* * T°C = (temp / 132.48) + 25 - * Tm°C = 1000 * ((temp * 100 / 13248) + 25) + * Tm°C = 1000 * ((temp / 132.48) + 25) + * Tm°C = 7.548309 * temp + 25000 + * Tm°C = (temp + 3312) * 7.548309 * scale: 100000 / 13248 ~= 7.548309 - * offset: 25000 + * offset: 3312 */ case IIO_CHAN_INFO_SCALE: *val = 7; *val2 = 548309; return IIO_VAL_INT_PLUS_MICRO; case IIO_CHAN_INFO_OFFSET: - *val = 25000; + *val = 3312; return IIO_VAL_INT; default: return -EINVAL;