Message ID | 20231023-topic-tmag5273x1_temp_offset-v2-1-52ef3f3bd80a@wolfvision.net |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp724786vqb; Fri, 27 Oct 2023 09:21:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFPmHIVuGVLXlifZ6mpIz63NNc6r1Ulodrs21ZPbhitx7FbV7lqTjeCKMxTlZEbRXNLla6G X-Received: by 2002:a81:c64a:0:b0:5a8:62f2:996a with SMTP id q10-20020a81c64a000000b005a862f2996amr3072331ywj.6.1698423698865; Fri, 27 Oct 2023 09:21:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698423698; cv=pass; d=google.com; s=arc-20160816; b=ECiL5/qkbU0ZSym6R2DqnI5CR+p4NuoC5YhFEjZbOFfy2C1btUOGIh0HCOt+69Xfpx tOs1h9tpOQCcx/L9iZfI7430fYJy+eTiE2Eo2xnez3sK90jjCtfwm1hPK9/rv9IApRNg DRM5j6R3BAn+fkruMopjDZId5L+cK4h7u5/HO9a6As5hkK8FVb9vUV3OylseVhe8DLGX N4zGThN1cZQI8S98ii+IKz1t8p0Ts00IgqDMrlOFaaBM2JmF8Ky2PIwmR/n4U1mbloy9 2g1FlZwmxLJAbG1O6Xt98POa44GueJsSNxJ/z12w0q+HZd+l6bohE2EW6VEzxWRoduv+ HGXw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:cc:to:message-id :content-transfer-encoding:subject:date:from:dkim-signature; bh=oXfF10Q0mLsJLnXv+HwPR6voKQgjC1TRr/6WR5NxZxQ=; fh=lHb194UoI3hE2GdudDE9iL30O/HczIDPD66GffS+/rA=; b=h4BEYEs7cXoXVZFGtl3a3NXTePNls+wJluCK8p8I4R71vqaMJO1rcyVYgX4AoQdTOx SuS4H9i0ZeTXZHNLeqQxQvjr9hnljWWsphreAHzfD9RIo/1Eul65Ihq2cQohmsVRP2tY 7c4xqmjAwEY+w4Fbl7QmQzS7Ma0I1qV3fxyiD6unRlplRiY7wL+9EqXN7wnNIUG3qbBD UTtv6uXVpJ81Njd3gJhp9RQ35V4q2Xze8UZZjZtlDzHhUeLKCguqgkL+cgoHK9eIWIcy 1+BMQmrUujUdacPaWx2/Cwhil0m3nxzm8Ofgx9xI54Hxi3niGDOvALUxrcdWvJfyOhzi iNfg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b=DfvKINUb; arc=pass (i=1 spf=pass spfdomain=wolfvision.net dkim=pass dkdomain=wolfvision.net dmarc=pass fromdomain=wolfvision.net); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wolfvision.net Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id s84-20020a817757000000b005a7dbd1488dsi2871225ywc.130.2023.10.27.09.21.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 09:21:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b=DfvKINUb; arc=pass (i=1 spf=pass spfdomain=wolfvision.net dkim=pass dkdomain=wolfvision.net dmarc=pass fromdomain=wolfvision.net); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wolfvision.net Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id EDF8483F9306; Fri, 27 Oct 2023 09:21:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231722AbjJ0QVQ (ORCPT <rfc822;a1648639935@gmail.com> + 25 others); Fri, 27 Oct 2023 12:21:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231302AbjJ0QVO (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 27 Oct 2023 12:21:14 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2074.outbound.protection.outlook.com [40.107.7.74]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C064128; Fri, 27 Oct 2023 09:21:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GMOG9qOWDYGNTHMuJ6glRD22F0s4p2FYZM3vAw7FtsWhqVHP10Dp3Q4Xl0d6F/tVdaq7R5vCIpaeCl9EP1i37stetGJ3PWvqWhDQoU3Sg2NmaY4CgZO/j/z0Mm80JnET8nXWAIPaZP1dWKcMe2CdQx3HllD7K2RP0bPUgzrtqv6Enmp41NtAlB3FZsW2I9kBk5o6lKVWrVlPosKradDfzM+LT015boL25aGjl5s8l9H4Zqc0GAUieSi7SsKEjDeowd9/d4vJZM0DkNBLF7PiYfYoSU14W4c7Sxg4l9LJVavhSjzvpl1yy9A2J92pQ1lDmWzyfM3/74nGVFEDNftqdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=oXfF10Q0mLsJLnXv+HwPR6voKQgjC1TRr/6WR5NxZxQ=; b=dToX/WfEAJ3FFAas7RISV1McGYA/zQuFJa1T8cy7H3NwflLJLqJf5fdadycNjRT/JPF5gXWJYwW4W4BRGVT/gjY+1h0kYIGNDZCcVORbdIAvwXR6nrDPjD6RRCfjwaChEiKT8Pu+tzuiGRlRZWnb1dbTWCeKtNuHA1UzD8LajxI/zw+jb4uP0Go8mG9F+s4dpA8MhXOf7nzaiL+ykRPFva0M4akqViacXcDOHJIDJ2qVHi229fNYrJoVsM781artl+0ecVH2/VIL588FJdEq7QFpO+ojtUTXxfvd/xRq3s2UAP0vX642lejq+8lZyT3oamxVjN7XrNObECGnhp2mRQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wolfvision.net; dmarc=pass action=none header.from=wolfvision.net; dkim=pass header.d=wolfvision.net; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfvision.net; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oXfF10Q0mLsJLnXv+HwPR6voKQgjC1TRr/6WR5NxZxQ=; b=DfvKINUb8OeghUf8HHC5+aMxgz5dpiKg4UPCaVxSkiT3Rm1cGI+fD84sXQ3PElcnMQhN1qw2vt0KPdgk659gjrNB4IDZDr1cEBiR8zxsRKJj3mc/FyaQs4wLxo8CGE1xzM4k7S1DyIsjWcQF4ke8G/3OZujek8BM/WlyhVcDOwg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=wolfvision.net; Received: from VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) by DB9PR08MB9563.eurprd08.prod.outlook.com (2603:10a6:10:451::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.22; Fri, 27 Oct 2023 16:21:09 +0000 Received: from VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::a309:1d65:f5fb:436b]) by VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::a309:1d65:f5fb:436b%6]) with mapi id 15.20.6933.019; Fri, 27 Oct 2023 16:21:08 +0000 From: Javier Carrasco <javier.carrasco@wolfvision.net> Date: Fri, 27 Oct 2023 18:21:00 +0200 Subject: [PATCH v2] iio: tmag5273: fix temperature offset Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20231023-topic-tmag5273x1_temp_offset-v2-1-52ef3f3bd80a@wolfvision.net> X-B4-Tracking: v=1; b=H4sIAGvjO2UC/42PTQ6DIBCFr2JmXZoCtlRXvUdjDOKgJAUMEGtjv HvRXqCLWXzzkvezQsRgMEJdrBBwNtF4l4GdClCjdAMS02cGdmGc5iPJT0aRZOVwZYIvtE1op9Z rHTERKoQoVaewulHIFp2MSLognRp3E2tlTBh2ZQqozXIEP5vMo4nJh8/RY6b798/ImRJKqjvvl Sw5q5h6vP1L/4acHSZotm37Au058wLnAAAA To: Gerald Loacker <gerald.loacker@wolfvision.net>, Jonathan Cameron <jic23@kernel.org>, Lars-Peter Clausen <lars@metafoo.de> Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Javier Carrasco <javier.carrasco@wolfvision.net> X-Mailer: b4 0.12.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1698423668; l=1858; i=javier.carrasco@wolfvision.net; s=20230509; h=from:subject:message-id; bh=WvsUO69p4hTpuJAC8gJYwF1xi3E+Aecqkb1+b5Fd9dA=; b=FoqMTsTUzIPyZdEMLq7muIbfvnU6UY1K8ywCUF5dKwxPT5SQW+S3gRmXJGwf3r5zmxpXiPxUj v0dzpc3wc+4C89wdVbRXkXNl/tWJH4jOv0hvrJLa2uqQ1anvOwquq3l X-Developer-Key: i=javier.carrasco@wolfvision.net; a=ed25519; pk=tIGJV7M+tCizagNijF0eGMBGcOsPD+0cWGfKjl4h6K8= X-ClientProxiedBy: VI1P189CA0012.EURP189.PROD.OUTLOOK.COM (2603:10a6:802:2a::25) To VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR08MB4974:EE_|DB9PR08MB9563:EE_ X-MS-Office365-Filtering-Correlation-Id: 0e63c9c6-c9f6-473b-f164-08dbd708ba0b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UleYKHlZtJsZbzm4HagEF5avsA5BNSzv5FVW39JApu/RXf4EHExIQyi78JdvyogUTUD0tueIHW0/hTInpEUJAvDYdcHdeRMKJigxQE4wcyGuBkQLbuGeZBa3euX/hF9ie+VBd2dXWCtQYNVn9fkvYvDAUd0gfJHDRVik7j0GEkqngmYR2XjPNsbwxGGjLZL+afVOGALyBB1DDsaUrtjgLA6sfuxtWbIOHaPOpvhQZGYMtt9KCCMhCTCy4VSclaf/qld1ARksvwJ+CNSPxWh2WBbgC3yek0gpkUGGpphbdNu3hUbMd20uW/ii8fqqMl9IEnvMZpSCgWtdtIS2deHEk1krQRbfLLkoPIbC6zK2AgFRvrk9BwWIXsrNbC4nmhhnIsK7tWiPUAFBmiW+4Fd5otkcJ9ISKP/9531Uh7bBNr7mkCO1DeDn25DVZW5i6Ds0afTGeMS55HXSeK7ZvedfYk6seMOQ2ZZ/iLJJqgVBWzpKI09X2TOVdmXD+iRKanGGk9PLYrf+Wg61Fkea4gHdo9tbFoVE26zJraLqwvuoEVYqTG8L7gJzF6VGAOUWJMKff61wf1gUBViafiPQ5wx+2TSIxRt9wuOf2deYBVLJqqM= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR08MB4974.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(366004)(346002)(396003)(136003)(39850400004)(230922051799003)(186009)(64100799003)(1800799009)(451199024)(6512007)(2616005)(41300700001)(44832011)(5660300002)(107886003)(6486002)(26005)(8676002)(966005)(8936002)(4326008)(478600001)(110136005)(66556008)(38350700005)(66476007)(316002)(66946007)(36756003)(6506007)(52116002)(6666004)(86362001)(38100700002)(2906002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?tOh9XtKsmn1BdiwDx9CwYwsAG7mM?= =?utf-8?q?lAtrrzcBAWBR0rTTdENjVdbX3aiXR1wXAxMJSFfc61PklDE1y3ppi70x0K70TaCAS?= =?utf-8?q?c4IYBxRjP4El83IMN8Xup9+4YhLh4W0xlF78HuyI/ZTqMx6m7cVzhMDPDxJLsAGx4?= =?utf-8?q?fODKY2Nsj4WqYfrQkLbgo1C89OYvZ+4uB/CjjaZqz2HcyjWxN03Ml7Fo3tC26zycb?= =?utf-8?q?+i2LodOYEU1f0hYs+C419s0BqZ82IovUUrr16ryU5UYEykxDKmHb1SLPmPFuXxhHK?= =?utf-8?q?1BtpxzzKiukj341a81u+YUtbD2fMkheXYxqITHoiB/8xnCs94QnYlgdMZt0qyqtLg?= =?utf-8?q?ek47dkP7RM0dn7NKoj4TZYYkP94am7dNaCnvxGYe3aRsUKUZWiOoCxQCtfu0HC3vL?= =?utf-8?q?354//M6eh34OQl43fLzQfwqYc+fpk+DF9Q+1ZvkgdZaS8uB4nuxJNrGIbdkgojQQr?= =?utf-8?q?Yw8kVic5jJwYvNYNq4A1G6E36ap9Szzx6OLUA9EvOi39br43Qopo+VBjwrwbxr7uY?= =?utf-8?q?KTOPZEWr/q+Ot4J53DBBv1LojGwocC7bL8Xd58mDXp7S9gFQlHCQhKxjhT0UuJUuE?= =?utf-8?q?vAPj3qaS1AvGHztLi5KfJr76hbqI0UtRDzUGOKwZHMLMG2awVoSjtuUsq5AN/rVwe?= =?utf-8?q?rCynAaMxZEoIZxNEpM21/hAk9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I/jBsA6y+H/tiLffx1udsB45FU=3D?= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: 0e63c9c6-c9f6-473b-f164-08dbd708ba0b X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB4974.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2023 16:21:08.5582 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e94ec9da-9183-471e-83b3-51baa8eb804f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: zWAmNfEmuuj4Q6QSZonxZ2FyHC2+86Xr6UyVJ8XGnQQNbHG+o/oYCgNS2HVWs7oUUp7i7/P+F9H2E3qmNczczo+RU4T5olKhYYo5xLv2hfQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB9563 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 27 Oct 2023 09:21:29 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780539380131876624 X-GMAIL-MSGID: 1780926328285489413 |
Series |
[v2] iio: tmag5273: fix temperature offset
|
|
Commit Message
Javier Carrasco
Oct. 27, 2023, 4:21 p.m. UTC
The current offset has the scale already applied to it. The ABI
documentation defines the offset parameter as "offset to be added
to <type>[Y]_raw prior to scaling by <type>[Y]_scale in order to
obtain value in the <type> units as specified in <type>[Y]_raw
documentation"
The right value is obtained at 0 degrees Celsius by the formula provided
in the datasheet:
T = Tsens_t0 + (Tadc_t - Tadc_t0) / Tadc_res
where:
T = 0 degrees Celsius
Tsens_t0 (reference temperature) = 25 degrees Celsius
Tadc_t0 (16-bit format for Tsens_t0) = 17508
Tadc_res = 60.1 LSB/degree Celsius
The resulting offset is 16005.5, which has been truncated to 16005 to
provide an integer value with a precision loss smaller than the 1-LSB
measurement precision.
Fix the offset to apply its value prior to scaling.
Signed-off-by: Javier Carrasco <javier.carrasco@wolfvision.net>
---
Changes in v2:
- Fixed typo in the offset value (16005 instead of 16605) (Jonathan Cameron)
- Link to v1: https://lore.kernel.org/r/20231023-topic-tmag5273x1_temp_offset-v1-1-983dca43292c@wolfvision.net
---
drivers/iio/magnetometer/tmag5273.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
base-commit: 05d3ef8bba77c1b5f98d941d8b2d4aeab8118ef1
change-id: 20231023-topic-tmag5273x1_temp_offset-17774cbce961
Best regards,
diff --git a/drivers/iio/magnetometer/tmag5273.c b/drivers/iio/magnetometer/tmag5273.c index c5e5c4ad681e..e8c4ca142d21 100644 --- a/drivers/iio/magnetometer/tmag5273.c +++ b/drivers/iio/magnetometer/tmag5273.c @@ -356,7 +356,7 @@ static int tmag5273_read_raw(struct iio_dev *indio_dev, case IIO_CHAN_INFO_OFFSET: switch (chan->type) { case IIO_TEMP: - *val = -266314; + *val = -16005; return IIO_VAL_INT; default: return -EINVAL;