Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1108356rda; Mon, 23 Oct 2023 02:50:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEMzjlouhRvZgLab6Dlk+d8gl2Z9Hwc9X+PrN9Q1nJQepGeGquha80Yz+V7pL6bitaq04I9 X-Received: by 2002:a17:90a:bf14:b0:27d:273f:779c with SMTP id c20-20020a17090abf1400b0027d273f779cmr6838051pjs.47.1698054658554; Mon, 23 Oct 2023 02:50:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698054658; cv=pass; d=google.com; s=arc-20160816; b=kXKgWrDaztNLc5nuvP6Q6gSHEKoGi6YDJzKbIqWe0Apw8XPueH53yr0G7rUaqO08Pa oVfYU4PvxkPL3PSPsQJxFr59Ngy/kardwbthJdE4pi2k7U/B5xXbmdu1M2bSx0SqMxC5 Pq6uvF7WVqjEQxuBaWccZ68IPKUaDDoa+HdODwRY+NOI+luIRDSVrbzIzbgDd5YWChDW zSnRTWVbNo6ZrqgnoIzepTWNhzVfKIx4pfAo7+X/sNCqp1vfKrmLJcgSECjOfGWhzZph 5qGwNooYg7c+stqDBRmrCRfHNZPG/Lo0em2354QNR21NEs0fXcmd5XAPyo5niiPKsHY7 LKww== 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=HsZWgVGxEw1SijQBMicQOvHLlV1xVTWpvaiizw4Ea20=; fh=lHb194UoI3hE2GdudDE9iL30O/HczIDPD66GffS+/rA=; b=Dyz9dvIwbxoXEopYs9K68fin5VIExfAP55n0aB+2zpoAG30UiC4iBpzWyGaXjibsAU uDM7FJxIan+O1m27+xXbqdcDKYCXHt0mg1+NutasG1kUODnSVuZJlnis7sbC+T5IddbK mZU8grtHNpQg9CkDmrkETFll/OPI1avXMrXhUOnNEnQlSz7GbNV5kpkjO2F/l0wEVDzB Dtu5fpFvF/TKWpJk9UK0aUXwKfiM3yJuIPx4p9zp/3gWx/Q2WkeDuoRKUzyN5FZ6ryEc YyB/IcVJFXdjL3E0fkGnCWh963gZqqMZacrBTcBgDwWO7IcZpZRmonwM4S2C1ry+Rcqd 2vTQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b=kQH6LIQA; 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:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wolfvision.net Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id x16-20020a17090abc9000b0027cf6bb27dfsi8911684pjr.39.2023.10.23.02.50.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 02:50:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b=kQH6LIQA; 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:3 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 lipwig.vger.email (Postfix) with ESMTP id 847F5807C64A; Mon, 23 Oct 2023 02:50:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232644AbjJWJuU (ORCPT + 99 others); Mon, 23 Oct 2023 05:50:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229825AbjJWJuT (ORCPT ); Mon, 23 Oct 2023 05:50:19 -0400 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2071.outbound.protection.outlook.com [40.107.105.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16FBFDF; Mon, 23 Oct 2023 02:50:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cClyaICvAudeFC/Ov3cPcyKsPRcy5/O+Kf1hHr16Q59QjZg3KxGcfXcdqloh+YdJs7InJc/euBibegIHjwIzBS8CgNc60NzeyiLEbKN+eZXGCb1Fj9OJFLQ29xPHqaSta3VlQ5XnmLd5aXg/qo7Z7oFSMX+UIzE8b3SM4ftJuqcs7/tDdkNjHVGYU6caIhpFZlCsH0kUTen+bX5q5QlqbGUWkVVuutn3Mf7auOQLjBcn8T2KQy97JQjb3vESt2Ck9SobiunYTcQzAM8IBvU7sing7ZXvParr3HWydh9mm13W/vtWEfnmDOILMlcJNAJjssksIImu8cq6Vj/qGFmjUA== 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=HsZWgVGxEw1SijQBMicQOvHLlV1xVTWpvaiizw4Ea20=; b=a0f+a5WgGmTCpBVGknzZSHpc/+0L4/l97p08RtphdwXD79p6FnAqJexZGcPZcqrMSdmMKDTAa/EjFPVOPPcOOGNmnH+EeWqBEbeSyYSpdoD7qVQwK8UkCPnk0IYyoSnpD5EocgcJCQ7qZnkTns7B8KYpVuhgb9p7t0BAVaedDyL9BBaty/3h+7B3JUWYYC0Uc2vYUfdGl6G8f3cGcRF1Nl1HS4hGQaVnyaY+mP+4T99lelnGJRl4bCCp2M1URAZaUlUUo6N9lbzz5+qIAtR9JprX7YixiT/I13AfBZhKabMQx9PoAMVc0Go9D+YFn/G48TcsHd5rLH+UiAqYbl+8aw== 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=HsZWgVGxEw1SijQBMicQOvHLlV1xVTWpvaiizw4Ea20=; b=kQH6LIQAnUoZfM8lL5GTlv6GgnEvnBvadsYdbh5oMeD5M050wa2U1VljxaWVnM9OzBwLGriEz2X1v6R0wK9qZ1PmUuyJkPfbZyrEWItqlF1ZQV8pLzBCz5Gnpzu+aEX/ptFnNL5GqvI8onuRcMjp3HhgKhG8sSrqZcoOi/c5Syg= 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 DBAPR08MB5590.eurprd08.prod.outlook.com (2603:10a6:10:1aa::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.33; Mon, 23 Oct 2023 09:50:13 +0000 Received: from VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::26e:c3c9:b87f:6372]) by VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::26e:c3c9:b87f:6372%4]) with mapi id 15.20.6907.025; Mon, 23 Oct 2023 09:50:13 +0000 From: Javier Carrasco Date: Mon, 23 Oct 2023 11:50:02 +0200 Subject: [PATCH] iio: tmag5273: fix temperature offset Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20231023-topic-tmag5273x1_temp_offset-v1-1-983dca43292c@wolfvision.net> X-B4-Tracking: v=1; b=H4sIAMlBNmUC/x2NywrCMBBFf6XM2oBJ1aC/IqVM4qSdRR5kghRK/ 93UxV0cLpyzg1BlEngNO1T6snBOHfRlAL9iWkjxpzOYqxl1n2q5sFct4nI3dtz03CiWOYcg1JS 21t688/R8aOgKh0LKVUx+PSUxojSq51MqBd7+4fd0HD9KtmNriAAAAA== To: Gerald Loacker , Jonathan Cameron , Lars-Peter Clausen Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.12.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1698054613; l=1645; i=javier.carrasco@wolfvision.net; s=20230509; h=from:subject:message-id; bh=NnHBG4GI1UfRI61xmOhQRV8cRNuKEWfcPQKhuf0xA3M=; b=53zaDEDu6QDz2VHmjHb2kabd3uO5MkIXxxNkJIAsRraP503o8TGHSggxH+hbM31/0YzPwAXPE PNUibpSl1jFDe0SDukNMHSo6lQ+kLTL/jMTcUpqCuJZFVLwj5M5KiyP X-Developer-Key: i=javier.carrasco@wolfvision.net; a=ed25519; pk=tIGJV7M+tCizagNijF0eGMBGcOsPD+0cWGfKjl4h6K8= X-ClientProxiedBy: VI1PR09CA0121.eurprd09.prod.outlook.com (2603:10a6:803:78::44) To VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR08MB4974:EE_|DBAPR08MB5590:EE_ X-MS-Office365-Filtering-Correlation-Id: f261093b-4d8f-4615-a93d-08dbd3ad7418 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: asWG+IT0ptxHlVDm3iTBEVdBrzvCbFR4rDNaT47aie9R5Jt9HxZvYu68SeT1zND/FXKRzqCLKob0EbYzGQHkWdG8EgGcuwwGvruGVYXkIyhmMelF3aDuF83F2A27qLVkO2iWR+R8YALNGeWM+Kv6Jr7xJKh0hW4CWAUD88pFY3Fo86FuGGjWaC4xsIubykW7v3wbDmH5y1gg+HQ0/xl5tlspzeyb1HIyk+bpVSxfYOzVzpKp18eVaS5l70jiOE9M6XE9H7Eofg72rrQZ2rnWtCC/Vl5luaUorgRyG7LtgfWgb0CdHPVqWAAJVJVC/Yqv2yORzN1nP4DYaEJo3sKVCG5rxTNefhzR3amEGHrEuhNNM8pSeVOl8jTNqKWy4a5ucpb9nlkOqYctLwyP9WuAMU5SyurIEOF7GDHsIUd9UcyXEvzGFe9DVDzid9JbCN3+RoA4/H3iNLoYpsCZZS8fTAXO56cOr7rsLOsCqn3akJmk5N/CYDeO9+IHjuzuHySo5lH9bfNlzTBCsjMtBqcj2+7sIB9KPfwvDNX171i2BQV5BijaD45F6UnfU2/jSJd5KddyXON4JxmFBujPB17A8ECjP9iDllDh+rWRSk3jXVDkd5/0SMVHG/7lV9T+nY7E 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)(136003)(39830400003)(396003)(230922051799003)(451199024)(64100799003)(186009)(1800799009)(6666004)(110136005)(86362001)(66476007)(66946007)(66556008)(41300700001)(5660300002)(6506007)(316002)(6512007)(478600001)(6486002)(44832011)(8936002)(4326008)(36756003)(8676002)(2906002)(38100700002)(26005)(2616005)(107886003)(52116002)(83380400001)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?OGJ0OGtsYkZOWGs0bC93aDd0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?= =?utf-8?B?UzRwK1dMZ1pyVFlVZ2x3NkhKajl2ODNuV0xnTzFYaWFLSDVDNGlHSGlsMXU1?= =?utf-8?B?SlREZEd2OVZMclVCdHFDZkxoN3lURnppNXpLUWRSbHNnOWVhdUJua0pGZjNG?= =?utf-8?B?Nzkvc3gwZzZTRFpJNzNuS1orWVduRjJvSHJITTNadDJBNUpsMkN5RmdpMTJC?= =?utf-8?B?dSs2Q2J0V1JzQ2szekVpL2hCUmpNWFNWSDIwRlhZTm16eHNrbEJ3cjZHa25v?= =?utf-8?B?VFQ1amIxbWlqY2dvTlcxYlZDMzl3NGZpNzZBL3YzTE90NFlKb0RYVTFKbGhQ?= =?utf-8?B?T3JHVlhCNURtZ0RyendHUkZnR1FHdzlyblRaTEp0VjZBSlNDY2VyQ2NtRjM0?= =?utf-8?Q?yWinNjZsHYAStvxI7UK28ZQ=3D?= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: f261093b-4d8f-4615-a93d-08dbd3ad7418 X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB4974.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2023 09:50:13.4925 (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: CyH8+krpdFX5W7PXWYLJeOE4RFOn3yHX7qweA63GmnpKBCaBj8vx6wfgL6As5Gh+li2ToxgL1rQruMiYHtm7/vrS5zc4XSdjXbnhByWJYKI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR08MB5590 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 lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 23 Oct 2023 02:50:30 -0700 (PDT) The current offset has the scale already applied to it. The ABI documentation defines the offset parameter as "offset to be added to [Y]_raw prior to scaling by [Y]_scale in order to obtain value in the units as specified in [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 16605.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 --- drivers/iio/magnetometer/tmag5273.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/magnetometer/tmag5273.c b/drivers/iio/magnetometer/tmag5273.c index c5e5c4ad681e..d22ca39007b6 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 = -16605; return IIO_VAL_INT; default: return -EINVAL; --- base-commit: 05d3ef8bba77c1b5f98d941d8b2d4aeab8118ef1 change-id: 20231023-topic-tmag5273x1_temp_offset-17774cbce961 Best regards, -- Javier Carrasco