From patchwork Wed Dec 14 03:14:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Song X-Patchwork-Id: 13072737 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7281EC10F1B for ; Wed, 14 Dec 2022 03:15:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237284AbiLNDPN (ORCPT ); Tue, 13 Dec 2022 22:15:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237326AbiLNDOt (ORCPT ); Tue, 13 Dec 2022 22:14:49 -0500 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2055.outbound.protection.outlook.com [40.107.14.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E5D527CC5 for ; Tue, 13 Dec 2022 19:14:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eKVetoKodryQv00wM2Jc0KzoxQqiboTPICQDh5NxDMUOmKonrxGpJW2FlZN2e1HDPeppXF+TZRHsPsVWckXjKYWNbhb0WHyfBV7/DLe1d8GQuG6j427G6ooBn1adi+Pbq6YMANO+bLP0wSHi7MbWxiFcuAFgnHibtxShTkp1dsB3Cn1pRgdYN+AWadQKIBkuTdO0n3NZhZ4iL27slkssI1vrN+2TltQrQmS3GixRgjGASRrP//YbKYYlJ/UiOe+uPxJ4QYTXM+WBiAUCbISS2Wj1eYnzuzeJORNccFSiJwHLgQBUOhs6wePe3c18oddh8GPbjrOid3dsQZFtPBo+nA== 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=neatzXpN66ObfcHS/GqDzRuq1gGjSQznvklNvr5wufc=; b=G4fzCsbUILLKfxmf0mT7NqsjxPvDUtYWiInNiuBSwtehHYY83P6T7GXi72/baMFgvJp9JjEYY+Z5pEz3wPNctJPTMbxCi9U+9gR/pGQBH2IDfS9sMIvYpTBBrGgINcjea5YGjF1bWkkcUxO5G/K67Lk4uGsJJ1EN8O/YSpeR/jK8DAhl+VbYeDfcvxmItpnc2W1Hiy9IVx8Hcq6Pv1kTiDeajp/yhtA58UNGuQVhWtRUI2QVazwlB8HIkcJ5/cr30Imp/xchQ/Xt3BYlNsWQdiOnAXUeg9QUCAYKzetr8JjzS1W3Eq2hkoF+nyKDi2dLAkZe57tjp1b9saAe/wwB2g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=neatzXpN66ObfcHS/GqDzRuq1gGjSQznvklNvr5wufc=; b=Lv42wbzB9+DVM/p+RiXybJ+BV247wq9bkcPmVpsS7b1oIq7cUKs/I45HmFAVLnp6Y/V5AAQOsZrisOApWHi6JByu2w/4AY9Q1hq5IId91Rz8HfRzOJKyTfUu+KqLXOXWsMynqBtWBjvlSKJDM5QfLRFSogCme/6VX6C+rlZfAEo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5005.eurprd04.prod.outlook.com (2603:10a6:803:57::30) by AM8PR04MB7761.eurprd04.prod.outlook.com (2603:10a6:20b:248::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.10; Wed, 14 Dec 2022 03:14:38 +0000 Received: from VI1PR04MB5005.eurprd04.prod.outlook.com ([fe80::e2d1:cb8b:dc57:8749]) by VI1PR04MB5005.eurprd04.prod.outlook.com ([fe80::e2d1:cb8b:dc57:8749%3]) with mapi id 15.20.5880.019; Wed, 14 Dec 2022 03:14:37 +0000 From: carlos.song@nxp.com To: jic23@kernel.org, lars@metafoo.de Cc: rjones@gateworks.com, Jonathan.Cameron@huawei.com, haibo.chen@nxp.com, carlos.song@nxp.com, linux-imx@nxp.com, linux-iio@vger.kernel.org Subject: [PATCH v3 1/5] iio: imu: fxos8700: fix incorrect ODR mode readback Date: Wed, 14 Dec 2022 11:14:59 +0800 Message-Id: <20221214031503.3104251-2-carlos.song@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221214031503.3104251-1-carlos.song@nxp.com> References: <20221214031503.3104251-1-carlos.song@nxp.com> X-ClientProxiedBy: SI1PR02CA0037.apcprd02.prod.outlook.com (2603:1096:4:1f6::13) To VI1PR04MB5005.eurprd04.prod.outlook.com (2603:10a6:803:57::30) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5005:EE_|AM8PR04MB7761:EE_ X-MS-Office365-Filtering-Correlation-Id: babf006c-7840-4abe-55a8-08dadd815544 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: I/rurpxf4BGe5se7sqtY+16id/SPn6ikBx12qCsjnB6k+3fWSBjR3JWPeA5f2ZRo1k8SqyJPOvgAMh8ZBXOPsclmoZziwVaNoil2PmUZAsn6dB29TMTX0vQtCrLJWMJ55x+6SInm2RelPOdjLVDIC08mtAXyMECoD11pL1Dlj0tgR1hV/6uKpbkgMTw8TTaPJTWDAwccVeoIsWFPtnBMgYuz7aOIuqsgi+/aJp4IHShHNIaBVjR6xoxgiaThsVTwd7UilVnMSIcWNfGVQNzJZxIHBeGLKPSeXXwy6rjFHlUToVeaDsFYmrDOfVqSN8SBqh/HOYvGqnSDF7aTm49omWh+JfRI3A8FkwSmvHl01QVnTpFLTh7MNxxChNa6b7uWH8tQicXDw7sjIh3hkOBpsI7QgdKJ5YLsjxu7gYHL5JC+btdYJictnW77W70kNR3k0ypGgerifXjXjUoZEf3kFMPImxFTJbF9uJKZ3jYMTAMcEpE7tP2qiN2JTpxCRnRSonuhJQ4YSBQYqUtR9ypy3+9m6jGha8wQMzQyyWoYalFsOz6iD0sfyaBSc368RuXHnK6gTgmmikl9OgxbL4V8Yr03f1qPH4M2dNsSFYeZZDWphQun1ZlERIpDivoRTlJugSbLiHmuC7FqKf84cuFLAq9TSbTTZdDW7DHzO41v3KQ6OO2pY1osqiQ3XWvIXSD7wnx412nibm+NkocwIgeVhQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5005.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(376002)(39860400002)(396003)(346002)(366004)(136003)(451199015)(66556008)(4326008)(36756003)(66946007)(41300700001)(66476007)(8676002)(316002)(5660300002)(38350700002)(38100700002)(6666004)(478600001)(6486002)(6506007)(186003)(1076003)(86362001)(2616005)(26005)(9686003)(52116002)(6512007)(8936002)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: r2Tccuhp9fP51fS+OD3hnzay+UT7ylJLP4t1X8WQjLTYzAW+4L0JxQD29lo+wpmL72gNhdC8N3Tm72gA78xdrWjwYnGT0xE+5s4Ut8W334YyqxDgqvogvC+ftEe2zQ0oBaokOpObosx/LCDVmYWomLAj747AnLO9yxigbeFlWKXLtET42rCjsXnydr8RNsLirXBdWw3HPgEmDRwIpiV9eeUBrbkm8OhQFO1kzk16vMs9bm8Ty7wPsmxyu/Wzm2yuKYXGQpXrZ6jJl4B+RnE26QDLs8x2gwf6FutG66hT83UNVAv50AkRUVsx4l9k5Jqs2ZIXmeQRkYV2riaT6CIcmepNcVuKRszmhM1YQDeRDlFPSO07j5h/JkKMEtch61AaPcB4QuN1+BjXOjI9uFnPQ+vL8K1kbtzAVBzuLyiFv1eHcz9WvJQRg4vVNRvZ3Hk+lj7BAyxLu+hgll7rieRUb7PCnJ6e5IZEcAPwMYtsZ1Jgg00UuoFFC+bCa1Y2GnZw+ElyduJE8G28PBn2h9d2MQE28TjlXIZCjMFtitC2NGm9EDN3BjEp+2zHNkJuXDwPIEm78PRyRxbu+/Vu94Bb3aSp5GGgWkV5WQxTHSiJD6nwqtXg5vvpHf6Eb4RY6EwJQ0jjEePJva1jlwudJ+GVAFQS1e9wEkjeonzpChSG5k5PNu6187b7blmbvnraTSO0ycWCmRLmYPO4djbaF2nSTZPIcFwhMJ4mSNA74Xezh9eGMZmotLk0VMpn8dMSV7SDgKQ6xi5qhOgxWX04rY+2n/6M6LH02O3iK00nT9OvQ9tMskndQNyCAOtMZcxi3Auni7ZEC57HDxRQqZejvmjHs7QJh0KpgHDB+yptRJ9Gxdz7EDE5XCMH+g7CkIr6xjrlg9NWYn7shJg9HIho2xJhxkHPzZld7oUXHZbah0AY6xf0GLbxZhixnYrRU2oUeM4EGYK0XgRvJ0aKyJQnWow1uwk68ekdMWjwqa7OgZk4fKrl7iXaqtRtbVDsUTIt+nOP5tFThvCZ6y0HB2RR+avP5nsDnQo5nvYIgu+XaFt9tQjXRYBsCaOq9fXsDXcmY7LLbPAjcVn6HcHVIrQxNntz2zC+KkzLJbGRUSXtrKirJ++pzf/f48yyu9B6rtCcnNNnDXZ2LkABYyavFkSYirYDZCGiLnAAZGyr+smBI08c1L9Fb4Cn2wuOGuLtOmYiH+79h0g3pcHl0up9DADQoe0cQGYld/biNaow6bTaG7X1W1nvMz01bUnuEdNQ9Aaret0+lRUzgcxx4pPfn2N8ydB2nLQAwJoKIXYi5XMzf2Ud8uS2sav4DLJzTi50dwr+MDrtMIHVnJWks44TjRoFeO3HrDN4SO8QhuxoJCo7LDBzU8pkz0jxem5Rvvqmz52sBq2UgjpggjraYU5bZIOUr3XQTFD7beoZxgyion5/hZof8FmztklLovQMkHASOReFgJnBN/f+e2Y3ezoP+fbPIjyLlyVUQx6jCcptTuQCjcR3bep93tfqaLMZ8oap66bPd/uWRclBvzjy/KDrGVFy0P8VKtrAXQs+toYsulAyf86PUSIRFpzHdz9pwfby41z9k77r X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: babf006c-7840-4abe-55a8-08dadd815544 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5005.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2022 03:14:37.8970 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: yUbA7bPJsH3y8GlDhdJA9pqnJPe0d7mzAyTQ4nLnNrI+Jyx4F1Ozkm67X/dcQCaUv30njyMmbqwAz8kT+GCZKg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7761 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Carlos Song The absence of a correct offset leads an incorrect ODR mode readback after use a hexadecimal number to mark the value from FXOS8700_CTRL_REG1. Get ODR mode by field mask and FIELD_GET clearly and conveniently. Fixes: 84e5ddd5c46e ("iio: imu: Add support for the FXOS8700 IMU") Signed-off-by: Carlos Song Changes for V3: - Rework commit log diff --git a/drivers/iio/imu/fxos8700_core.c b/drivers/iio/imu/fxos8700_core.c index 773f62203bf0..83ab7d0f79b3 100644 --- a/drivers/iio/imu/fxos8700_core.c +++ b/drivers/iio/imu/fxos8700_core.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -147,6 +148,7 @@ #define FXOS8700_CTRL_ODR_MSK 0x38 #define FXOS8700_CTRL_ODR_MAX 0x00 #define FXOS8700_CTRL_ODR_MIN GENMASK(4, 3) +#define FXOS8700_CTRL_ODR_GENMSK GENMASK(5, 3) /* Bit definitions for FXOS8700_M_CTRL_REG1 */ #define FXOS8700_HMS_MASK GENMASK(1, 0) @@ -524,7 +526,7 @@ static int fxos8700_get_odr(struct fxos8700_data *data, enum fxos8700_sensor t, if (ret) return ret; - val &= FXOS8700_CTRL_ODR_MSK; + val = FIELD_GET(FXOS8700_CTRL_ODR_GENMSK, val); for (i = 0; i < odr_num; i++) if (val == fxos8700_odr[i].bits) From patchwork Wed Dec 14 03:15:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Song X-Patchwork-Id: 13072738 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48C02C4332F for ; Wed, 14 Dec 2022 03:15:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237258AbiLNDPO (ORCPT ); Tue, 13 Dec 2022 22:15:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237329AbiLNDOu (ORCPT ); Tue, 13 Dec 2022 22:14:50 -0500 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2072.outbound.protection.outlook.com [40.107.14.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F85427CCF for ; Tue, 13 Dec 2022 19:14:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bPGFhmNpV7oNHmYhpu0khjTlgbnchG1aO4DCVRjO68MZ86lFO+Odp0937cHoiQi4AX/vyQO+sNF4TrtA6Gkq2QAMbGvxXqUFU84DSSAeBtGXPPwaCNjvJzBQSqx3DAWS9r14CcHZFPdoptDB8fa3sRJy9jc/VdQYBZEhvaVxr269gNNILhLIyQAJCvJ6DOUi5oG2DP04oMtx9omaSwV+Fp1vS2NPtKAsdfK4ZquRRDF/V412WYCuwXinm6KCpfLcihzbU4bYkIibOJsLdr2Ap3VnLB6ZvM1awKpanU4hl6Jl5QXcl8UVNdwbY/VdHd3stzwg0/3FQROyb8nq3zy3KA== 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=/fXZcI2V/UEAZIy2v/VFNdEQbjB6+Csi87Pzq2/hjzE=; b=PHmwTSNiziyHDWNaEHBcemt/1X/DjcKjPlq0VRFo43fuSvUOpjEPVipz8ALQ/YNiS69nNGEOuykzkEQVSgIvmpFOMszKqjW0bXQB689K/yLTNy8qnD4moLIOSB2lqoWCaaBMmwRshVLev0Gzhli9StENmNnwnDwuwYfKgPxMMVQzKnBROr/ctcuY1v7IwZa1gwMm4iiOCiHV3t1y8M8x7YWPXSjrbKDuEvH/0MBa0IpWVLLfCnHPXxw4Czr1Exj1MveKhuCoyl2VY7M7+MxrMixAP3qZPDxjOH6A4jukQpGWbf45zFm3Q/SiH66hi2e7XBn8Z9PwTLZ8mXFt9/fipA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/fXZcI2V/UEAZIy2v/VFNdEQbjB6+Csi87Pzq2/hjzE=; b=X1ZoMlD0vCXCCU1GoAbddiDUkDq/lxGnUK8o6bqKFjZo2gyBuValPG3uNygomx2QzvkhPDcZZcPjXeo8Md9Lu2PeZ4lK5FFMvPHleNC9MTNWFfkezgzfGF4gguYKsPDLIR+opCrnrekQFhI0ZCSS+HGmLhyophJSI054tSmptWc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5005.eurprd04.prod.outlook.com (2603:10a6:803:57::30) by AM8PR04MB7761.eurprd04.prod.outlook.com (2603:10a6:20b:248::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.10; Wed, 14 Dec 2022 03:14:40 +0000 Received: from VI1PR04MB5005.eurprd04.prod.outlook.com ([fe80::e2d1:cb8b:dc57:8749]) by VI1PR04MB5005.eurprd04.prod.outlook.com ([fe80::e2d1:cb8b:dc57:8749%3]) with mapi id 15.20.5880.019; Wed, 14 Dec 2022 03:14:40 +0000 From: carlos.song@nxp.com To: jic23@kernel.org, lars@metafoo.de Cc: rjones@gateworks.com, Jonathan.Cameron@huawei.com, haibo.chen@nxp.com, carlos.song@nxp.com, linux-imx@nxp.com, linux-iio@vger.kernel.org Subject: [PATCH v3 2/5] iio: imu: fxos8700: improve readability by field mask and regmap_write Date: Wed, 14 Dec 2022 11:15:00 +0800 Message-Id: <20221214031503.3104251-3-carlos.song@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221214031503.3104251-1-carlos.song@nxp.com> References: <20221214031503.3104251-1-carlos.song@nxp.com> X-ClientProxiedBy: SI1PR02CA0037.apcprd02.prod.outlook.com (2603:1096:4:1f6::13) To VI1PR04MB5005.eurprd04.prod.outlook.com (2603:10a6:803:57::30) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5005:EE_|AM8PR04MB7761:EE_ X-MS-Office365-Filtering-Correlation-Id: 767f16ec-2f1d-47f6-4e56-08dadd8156ea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mkZuPPABAZW71pvcbp0maaD21wRz4ZJW3KbHBFClQffRnspi9caqDxA22D5meNjPnibq2yzvK6HF/DKGyk4MusV8uk2yPchix20p+7WC3yhcQjygiCGimUZs3Sd6RQbdK2j9sKFQ95NWI5XHEf45ib6PVknmt23DBvaRqFArQT/qV1u9/UYlbNs9TQY7+TQf4C3OhDXuUhmiE8VDbHprc3fjHTD008RhcxLhaRB9qMnTBB6VnOhOiVoxLTts6UV14tiOz9SWLs9HmaMHqUlVucWpSnCMwcTK9cUXTB8anqDkuJW5Nqprd5qYdiFxCjB5nQRM7ypSXyXWurB06/J+9V03irJMbShxbJQH9t5VOZttCwY1DhdQD/kOpv9bYBUt0h3KLIQ3xOx1L3Hxcxe4/9wTnwqEWZolAudDIEqCYsqaRoEuwFU0xlqFtug9Av7C+PmJGR787xU6ZR6DaSnF9BYnoPThvU4R/tXDy/oPI8+OXJQv4ZDbJ5lD/IsavJQht4US4LEx4JHhwGuUn64IG9vzk7JVguc9E8yWu0gQdObZyKr0lOrYA96zb+y5+3CyBRvoEpj8lxQmJHcCc0zjF29P0hYFu+ikSgkAiMcqucPehEhBNyOhTWnbHjv52aHUy9m/eejDQdsfGSS1g75VMwPcTQSfaKj36NK/NhYLVllosDDBG5zgc9svLgRRabyW9ZOw15FMBzzLzKqJ7trn1w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5005.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(376002)(39860400002)(396003)(346002)(366004)(136003)(451199015)(66556008)(4326008)(36756003)(66946007)(41300700001)(66476007)(8676002)(316002)(5660300002)(83380400001)(38350700002)(38100700002)(6666004)(478600001)(6486002)(6506007)(186003)(1076003)(86362001)(2616005)(26005)(9686003)(52116002)(6512007)(8936002)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: S/eUDgot67dvtRX8o5c9mPvXi/WEW5ZBHdC7zM/bFPLtVJGmbN52gBRJZhKji21aM6Jg4gddO9D2hksijIv5dn5TIUBU7ZZLAUoEZg4vXWHDrHB7ewe95aeqXDiFV9RHtdXA973IEfVffqRhbW9C7OJ/CuRf6Vc7jiofx94tclnS2n4cwoQTZXFpDNtHfddp3PBM9AbF1jJn1u09SCZ2VkJ7/1KLJSbHTIb822IHfMiQWpi9KvkrQGup/uXF9XeZLCK94Ur2eZVo7t1kMFintDU49E0guKIuam8DXTDFuLSRQVsKV9LdcakQzC6vqKn4uatiAUXl46fGehc/QgqcxYaCSBGVLJwwwPQ83muru6J9G6ugR1fgZ6I2cUtyfoGPsVroVsYf1UAsIyOxBwhNAPzpuuHBX84mbnvUELGfEGuZOOssKA8ABustUNYTgn7MBfcYFKNbg34/DhcfJej43qgyjtxNs+sH3GhWgy5ryZXRW5veUoPliWugHWbs8FlqiFpLOOiOD6J+ThbtdKzkM8fZ7Q89+ZHLRvbpPPhE7m8eSuZe8MRn0d8pn4IAZTG6hqOiBRnF3s1N2E7GYrgoVh0ID0EeVwpgLZji2sCaCV6yfFfNmjLRr0Kmr06nKFZdQLvmy+kkSI65kfoqaKevReGMqpJXA/Syylob+GPKWLNVuHziLTceKlRKaqc3EMZeelXjez0rHymBxbWvvwUCkhDkFAOpXVxM1S0zddrNciF1EmsURxV/siseH9wHzOumCk6XrvK3mzwNjWXQGO1W5g8BDdyyRM0Z6xZMjj9tmOfRHKf+xufz3t0qqEYPfS0bWZjMZG5Xxb/2H6HWQuloM5Fo+uIjiCUFsNd5g4W+67DFj15zoTUBSFSakXGmblSDN+F8ND3CTEvMAlqRz8FyWJlvyxd0ZZEa1CPlnHt0CmwJGabWayZ6dgflPLUMECusC+YuR5B0zQdtZIB0zAJu9k/C2bwWaYmA0zneqBzBkMvfxAYW9YQyNIoAaE3p60sCiJkfJtnRsWscu6Q1TsRAYsWMaxf7zQDtATCm6WIj9R4Of0Z7tZzDIhrpgEIMwrkz5FV6TTJJfes8PdWWln1y8QW1u4Rdeqe3CLt9eXywh1mzlh5aEUAPDLL8ylph1oysVUeqX7nsfYopUJBwX+TB1iYXmBvCxlHATgugJ8cFMU8MXEvbfNUczErK+4Md2IJksWzzwTldM57L3O1WO2jMikwdu3S1cVSzSjpcUKiWZCOAVReN7Jo7p21T9sfUWE3raVY1IEhGA52HrplVs1A6Bh0lNAa4PJxuZcnVYp0vUxklQfTSdWNmtJYh7tjQqqN1Yd08B+gG4Vve/oaGPgcByKWcAbD5n2d4GzC7QUJqLhW8t3249bsxGZ2Jdf8PsJsC1/kyB6zBMG2QzIbchsSMsFUl60JVUBWnnJ3eT8+dKUJfGwncTm6x3rReCq/qO3JX3hzmk07jVbo0MmSQRNJwJW67gVp1Og03yV3kTTJ3rXZnvud/c0Ia09XowAMJeMet2xHR+VOSzi7cyK4ySO8+fKPdGU5UxQwnrb79h8sJs/a/o8H/a/Obn7EfKIc/6pTj X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 767f16ec-2f1d-47f6-4e56-08dadd8156ea X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5005.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2022 03:14:40.7562 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: TAs281tfWmqAJ/jSk6pxLeNjATEcmT11DKuTPGn+9DIP7XdH3Jg8FqCor2dCp2fpMbYTZJqNjMif5rBOry+GZg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7761 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Carlos Song FXOS8700_CTRL_ODR_MSK is a hex digit mask and FXOS8700_CTRL_ODR_GENMSK is a field mask. They have a similar function. And mixing regmap_write and regmap_update_bits isn't good for readability. Remove FXOS8700_CTRL_ODR_GENMSK and set FXOS8700_CTRL_ODR_MSK a field mask definition with a synchronous change. Use regmap_write() instead of regmap_update_bits() to update bits. They are good for readability. Fixes: 84e5ddd5c46e ("iio: imu: Add support for the FXOS8700 IMU") Signed-off-by: Carlos Song Changes for V3: - Remove FXOS8700_CTRL_ODR_GENMSK and set FXOS8700_CTRL_ODR_MSK a field mask. - Legal use of filed mask and FIELD_PREP() to select ODR mode - Rework commit log diff --git a/drivers/iio/imu/fxos8700_core.c b/drivers/iio/imu/fxos8700_core.c index 83ab7d0f79b3..a1af5d0fde5d 100644 --- a/drivers/iio/imu/fxos8700_core.c +++ b/drivers/iio/imu/fxos8700_core.c @@ -145,10 +145,9 @@ #define FXOS8700_NVM_DATA_BNK0 0xa7 /* Bit definitions for FXOS8700_CTRL_REG1 */ -#define FXOS8700_CTRL_ODR_MSK 0x38 #define FXOS8700_CTRL_ODR_MAX 0x00 #define FXOS8700_CTRL_ODR_MIN GENMASK(4, 3) -#define FXOS8700_CTRL_ODR_GENMSK GENMASK(5, 3) +#define FXOS8700_CTRL_ODR_MSK GENMASK(5, 3) /* Bit definitions for FXOS8700_M_CTRL_REG1 */ #define FXOS8700_HMS_MASK GENMASK(1, 0) @@ -510,10 +509,8 @@ static int fxos8700_set_odr(struct fxos8700_data *data, enum fxos8700_sensor t, if (i >= odr_num) return -EINVAL; - return regmap_update_bits(data->regmap, - FXOS8700_CTRL_REG1, - FXOS8700_CTRL_ODR_MSK + FXOS8700_ACTIVE, - fxos8700_odr[i].bits << 3 | active_mode); + val = val | FIELD_PREP(FXOS8700_CTRL_ODR_MSK, fxos8700_odr[i].bits) | active_mode; + return regmap_write(data->regmap, FXOS8700_CTRL_REG1, val); } static int fxos8700_get_odr(struct fxos8700_data *data, enum fxos8700_sensor t, @@ -526,7 +523,7 @@ static int fxos8700_get_odr(struct fxos8700_data *data, enum fxos8700_sensor t, if (ret) return ret; - val = FIELD_GET(FXOS8700_CTRL_ODR_GENMSK, val); + val = FIELD_GET(FXOS8700_CTRL_ODR_MSK, val); for (i = 0; i < odr_num; i++) if (val == fxos8700_odr[i].bits) From patchwork Wed Dec 14 03:15:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Song X-Patchwork-Id: 13072739 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E9D1C25B04 for ; Wed, 14 Dec 2022 03:15:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237287AbiLNDPP (ORCPT ); Tue, 13 Dec 2022 22:15:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237298AbiLNDOw (ORCPT ); Tue, 13 Dec 2022 22:14:52 -0500 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2072.outbound.protection.outlook.com [40.107.14.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F25FF27CDF for ; Tue, 13 Dec 2022 19:14:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YMEdhUyvYKnUX4/CFb+nptiEwoMBNkZsrwVEsYscwppd+zp8eiK9kPO19SrhK6/OYzNf0OQwvXPhA0oYaeUBwfRaJi7Wr5aJM2zkAe92b024is/4LxlG/7NDtbL3BXDT0q5Gcw6ErRCy/VondXHLxCoA9wHOQfcaQv124dJb9gg9L2d0qnR4FYIzYLlN2WywOwyEVuX1ytsFUnQLAPaYvZ1GslMWsXjIpzW8o824xPL/Vfem5dOmlvtOvKXKdHMml/G0GlBigEMRu6n0zNaKOl/VgCMPhqwRxkMUYL2V8QNgfiZoUQqAZj1gyK38zRW6wejOxIClqiYhsLwzLD9XAQ== 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=aP3O1J8OSmjKxRgetyq1XE36/65/3uWRvh7n4jlxSyQ=; b=kXYSI/EVN0L3RVNon8h+eOkAh1vHH1uFcif7dlE5eFmYafrLhLC6AEp3U27WebqhLepzDNeE+SHXI10NvaVY40HPqHTTp78tEgDaxOvQHQVlx6JuIdltqAzifWI/a3SfFgWd7HewFatRmiPKnq+xJJGVpRVyrBwlJcTO6OJBgdQQEPEywQmK8fSWDQU1s9BKbDSDVsIEsDdPbg6xeN2VDtx18KN2R3IZsL24OXWFttrKRnWvrKae1G++t/npjKnAj+NMXIqkhC4TgVHoM9mKTPczY08NkHNw9pHAulgTSBOZ2Sm2Zp8LBd18jbX+lEXrozp38qDSPb38IUXE2Qkwxg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aP3O1J8OSmjKxRgetyq1XE36/65/3uWRvh7n4jlxSyQ=; b=LvK2yRWOzxEoIYn6MNzXJujJ15Bq2Tx7fzqS6sTU66qn4UJObjjqyw4MIBOAAiMSbTxrObFMtAuuSxaUXTiLGIBqKz0aIRqnJzRi0R6otg5DDWkZSxTXwH2xlvQfcFUaPQwGYzRdhP3xMNyFiNyQrEE+CNfVMSXMX1UQv7UeEno= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5005.eurprd04.prod.outlook.com (2603:10a6:803:57::30) by AM8PR04MB7761.eurprd04.prod.outlook.com (2603:10a6:20b:248::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.10; Wed, 14 Dec 2022 03:14:43 +0000 Received: from VI1PR04MB5005.eurprd04.prod.outlook.com ([fe80::e2d1:cb8b:dc57:8749]) by VI1PR04MB5005.eurprd04.prod.outlook.com ([fe80::e2d1:cb8b:dc57:8749%3]) with mapi id 15.20.5880.019; Wed, 14 Dec 2022 03:14:43 +0000 From: carlos.song@nxp.com To: jic23@kernel.org, lars@metafoo.de Cc: rjones@gateworks.com, Jonathan.Cameron@huawei.com, haibo.chen@nxp.com, carlos.song@nxp.com, linux-imx@nxp.com, linux-iio@vger.kernel.org Subject: [PATCH v3 3/5] iio: imu: fxos8700: fix failed initialization ODR mode assignment Date: Wed, 14 Dec 2022 11:15:01 +0800 Message-Id: <20221214031503.3104251-4-carlos.song@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221214031503.3104251-1-carlos.song@nxp.com> References: <20221214031503.3104251-1-carlos.song@nxp.com> X-ClientProxiedBy: SI1PR02CA0037.apcprd02.prod.outlook.com (2603:1096:4:1f6::13) To VI1PR04MB5005.eurprd04.prod.outlook.com (2603:10a6:803:57::30) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5005:EE_|AM8PR04MB7761:EE_ X-MS-Office365-Filtering-Correlation-Id: 5a3e244f-03b9-4455-94ea-08dadd81589e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FneJ8hOLkCW/iQuMSEvIF2jXxnAcYevn67o3yy8tqE6eTE/VCC80deoqYtcQbSaz44jSn1LmLYGcHcWj3YbQdrYxeqp5vxEQEKI2tgLJoD6ZLwtwF54jvknM+22MmobFnIGN6NiSkA6ZPgOY7tyeF0Njgukn2PjNBYQqEexSZ9APYI38KQ1UgZhTMZNgBuvkLEbHWJR2fIwODSsEY/WBYwij2iREfXjpK3VUhJRt0/CVMYlEhtagbE+sXK40ts9S22fhkukDsu2pi5/iZLshzm+IHK2E5kdW3+sEVzgpqRh/gThHXOJshAXFN0CJki4XcRSfLrsBSdAkkXuuDC7LnvT4alQAIkRTUd1A0r28KLEMOd1plmx9sREIKjmIYhlb5Sxy4pHRgJqAlH9efzg4H6ynJraeOkogIJ3pvl7aK6Xsdgiy1VXE5tUnsVTtpVIV3FbiaNU37DLzhcHKO2O7QqDFzqlrasWMJ/zvu79AzBZT30iCYYOA0KCpQvX4ge1w5D5Au5sGVfLBUrBvUnZXbZ5Nrb88PPmHwd0NVJwZQ4pcakHulRj/AVnLAzvTKNzjHzYq9t6BUstO19bbM7Dl/kSc/JWrFsPB6hl/zNfEzYhJVahOiSvR8xnn1CCdgXgEgmoxR3IZf17LbpCJBEUgKDAdFbVxeW4qDhbBubshLPzBTqRsKwEWu0FINRM7DAk4oFL4wc8l0/po4zsfZU2FTA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5005.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(376002)(39860400002)(396003)(346002)(366004)(136003)(451199015)(66556008)(4326008)(36756003)(66946007)(41300700001)(66476007)(8676002)(316002)(5660300002)(38350700002)(38100700002)(6666004)(478600001)(6486002)(6506007)(186003)(1076003)(86362001)(2616005)(26005)(9686003)(52116002)(6512007)(8936002)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uMAwuAJXUAaqyTRiCZ4Qh+crT0L1EtXdeZqrPmdWOp1Y1Yya7Me0X+xS93qIj9azb/JGI62zheSB9pa9nHlhOuJB6bAsOhd0Jp1o/mXSpY/Fay8pCEl86J6dCCTrRdq7F76/RLLGjWOi8YQs0o/tOdVJhmZYr3LZB//3ejBuTKtGj0hrKM4U/FxjhutFI+FbARKfw4STZKpd+qGZRE4oxtWed1X+deXyREDig90Bwwt4MliLWRDaZG7SIVPOss3QLyDVQ+NRuEey9jMp6m1SXSWkds/GOWwdcAaSS+To8mHqWND8PaeyhA0LUSiZYMGt1b7EUCDdk08S4pwmg5aAZviUziiwK3SzfNzslHcqCSWa0xajh2nT/TPCx3nJKMBWPdwrVvIXa3+X4ErAkczBB9llitJ+CNN+iEg7aEspzkaP6UwMbfgh8ovAH7UhM06I3ZLejkXm0ZhW0P0fj6I3L1wOMcMlsRkhB1G00SnmoDTFeeoi1Za6f0f4ZpqpL98wrBAweJhsISsq4V4ydsi+rq2zdRX6+zPpnJMdtyXVn2z1mNj83tP0LEIUTv02v99Eud63bNwoRjLXUQeTf2IFzBtZNocsHWud/AwomPlTCxV+wuMk17rAAFzHte3pBR0u89flE7YXok3hvCnWtN94zCPfOS/wRLjm81bel/sejF3EDF37Ghbl50A+VyJ6huNJrWLcD9idsQZiu4g2F/8NwT/x65PQrrgfLtu1ahAZLMIaBUvpuDcX4DsyHeBUmmGXjcEl6SXB2xLX7Bgq4iGB/lVspM8j5oi4vF2mIC4sx9rdbl8YDX0WRxRmkvilNZwknnFh8m7l/NszKSkHAJP5woFjuoM93cd4As8f7jvnmDjl0eWqDi/oZyN7JRw+v2gf7w2PK/N9WHqfBodEdRTRh0vCO6QMOu/y3NECmGoaGf+ACquFTkwsFhIuDnrsqU9AhAzWR9wIjOLUR7Nqzf6T70f8Wt2yYib/NQDaXCQBwIGTZ1WChp4Xoku1cwNtMAmrPjDkFHPxJEMvwA78Rp2KLWymnjSnwEJPWcuESFi5m/fz3qLe7pHfdLURU2Z4PGvcn59bX2q89Au7+W3enR3TyVEjZU0f/qvB+OxtpkqnM7PGdu9z56NlfxEPdhMREsNReJC8zrLs5QZ+K91XpmVz5C9+VCS8px+tng/q4DF0zNMM5xnjNk2zqO8Jhvl/UgtM1z+Kj6H98ZUZVYKi8TVIqdRzBRjeokS1a+kH7wWAdkPDm6W2f0L/Y1fyPTBVQXuKD9Ri20iInrdAXg88sIrnle1V0vcJGqmqrA6/TT2LXGfW5qRSdziBXbG+Znw0hDCZpxbv8gCO9og1SZlYtAuTcOCUKOTsFTcyBoiZDeBTz5BuRQ+4s6r7u/SNXherZbTxZexqDeZO22gwihP/OVst0JjpwjDRXUTdbfgBi1zhLA9D/Wg1N2Q3ShjFRMBJjOAmBWYUHs9+rvXu8kS1+8Xv0E1kfIh4mOOR2x6/nU1m8ptORwbxZdruPwncNwRJ/xSG9Fh4BU66VuncviTZ2ftNTv0Dvz0TiWyIqRZtfM+dOtNAla3JNaBUYbNhV4cLHghQ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5a3e244f-03b9-4455-94ea-08dadd81589e X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5005.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2022 03:14:43.5372 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: N9VjOfY4R+FrQDHkpYMQhqPtMw4hgi60W7AZ05BZtK5DK4BVlFkjUiMNLnH3KVYMb2EhcGx/HQUpSnU3V49pIw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7761 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Carlos Song The absence of correct offset leads a failed initialization ODR mode assignment. Select MAX ODR mode as the initialization ODR mode by field mask and FIELD_PREP. Fixes: 84e5ddd5c46e ("iio: imu: Add support for the FXOS8700 IMU") Signed-off-by: Carlos Song Changes for V3: - Legal use of FIELD_PREP() and field mask to select initialization ODR mode - Rework commit log diff --git a/drivers/iio/imu/fxos8700_core.c b/drivers/iio/imu/fxos8700_core.c index a1af5d0fde5d..de4ced979226 100644 --- a/drivers/iio/imu/fxos8700_core.c +++ b/drivers/iio/imu/fxos8700_core.c @@ -611,6 +611,7 @@ static const struct iio_info fxos8700_info = { static int fxos8700_chip_init(struct fxos8700_data *data, bool use_spi) { int ret; + int reg; unsigned int val; struct device *dev = regmap_get_device(data->regmap); @@ -663,8 +664,11 @@ static int fxos8700_chip_init(struct fxos8700_data *data, bool use_spi) return ret; /* Max ODR (800Hz individual or 400Hz hybrid), active mode */ - return regmap_write(data->regmap, FXOS8700_CTRL_REG1, - FXOS8700_CTRL_ODR_MAX | FXOS8700_ACTIVE); + ret = regmap_read(data->regmap, FXOS8700_CTRL_REG1, ®); + if (ret) + return ret; + reg = reg | FIELD_PREP(FXOS8700_CTRL_ODR_MSK, FXOS8700_CTRL_ODR_MAX) | FXOS8700_ACTIVE; + return regmap_write(data->regmap, FXOS8700_CTRL_REG1, reg); } static void fxos8700_chip_uninit(void *data) From patchwork Wed Dec 14 03:15:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Song X-Patchwork-Id: 13072740 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4F87C4167B for ; Wed, 14 Dec 2022 03:15:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237292AbiLNDPP (ORCPT ); Tue, 13 Dec 2022 22:15:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237301AbiLNDOy (ORCPT ); Tue, 13 Dec 2022 22:14:54 -0500 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2048.outbound.protection.outlook.com [40.107.6.48]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B56A27CCC for ; Tue, 13 Dec 2022 19:14:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XXmA+romryiYA5hAmeNj/Nl4UWrm6EmUHAJhIcwATZ3eSVufmIFJfJdIb/Hzi2WkbEQo4Nuo27t1YZb0fq20l3K6w/I1PBzXkvMNCvy2IGWpfJA+5BcjvPZhendus1ff1Jbr6r74bYLWoMPqVr1ZYzoeVus9fG2BysalB20Tz729SVQ5Qd1Xc3j9cY462/DX0tFL3Ue6QzlYoHxoBtAwvfIbq31ScOilRcae6xL7oVhWsP3m0bQUJUldC5j5nTo80s9KrHA2ZNmzqBV0b92D1y1cUbdKkfOKqhdgYj7C/OWBdDcVRm/ZZ1ZT/4i1kReN+1HQezXLe04CF1fbMW4tOA== 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=+9+t9eIVF4HhHRCYdy+8DWJPzM17OPpvrEq9+bpMmW0=; b=Kd9uOsh3SHGq+X/HAkqNdIXaz8YJ6GnIJH5+7l1gh3tnDu5M2rHQ1CEjeYGsxJMM2In5OwSOml8tH6m9fCXnL2r16f0nuph6phxCMS7F8I0yrVpXkQ6990ogVlqaaEfvL7HLlldBqq0A7KiC+e4cZ+xoukv0+cmLoMqC5FsyO4S0HF1n0DXcU4DtwlHxa3Ufgn7A4HLye42HwD+JBoQk+iygfcyJe7UXg9EqL/w+GIBUmF9MZS25sWuAPSVp934ROTX5SY24IEl/QSM0j1u6np7pPU/qJ9T7bWzN+zHvg4lkU7BJoeSReLdBS1eNYdgzjpNOlwtbHVNZYCIgN4b5Zg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+9+t9eIVF4HhHRCYdy+8DWJPzM17OPpvrEq9+bpMmW0=; b=SroQHFZnIbzJcmriWFKTTgaBfryYohH76g0yVFf9nY6MN+c9QwvWdN90a4GX5s6L7zMnVDJ9kQ/+iWPzaJuTv6B8CQ5LEMKWtClATCdSzZoFSDlQMiJoLXdbni97gASZBI7uT/1f+Lqcvbyck78A8c9wsair30MCPPUIpmX+2V4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5005.eurprd04.prod.outlook.com (2603:10a6:803:57::30) by AM8PR04MB7761.eurprd04.prod.outlook.com (2603:10a6:20b:248::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.10; Wed, 14 Dec 2022 03:14:46 +0000 Received: from VI1PR04MB5005.eurprd04.prod.outlook.com ([fe80::e2d1:cb8b:dc57:8749]) by VI1PR04MB5005.eurprd04.prod.outlook.com ([fe80::e2d1:cb8b:dc57:8749%3]) with mapi id 15.20.5880.019; Wed, 14 Dec 2022 03:14:46 +0000 From: carlos.song@nxp.com To: jic23@kernel.org, lars@metafoo.de Cc: rjones@gateworks.com, Jonathan.Cameron@huawei.com, haibo.chen@nxp.com, carlos.song@nxp.com, linux-imx@nxp.com, linux-iio@vger.kernel.org Subject: [PATCH v3 4/5] iio: imu: fxos8700: remove definition FXOS8700_CTRL_ODR_MIN Date: Wed, 14 Dec 2022 11:15:02 +0800 Message-Id: <20221214031503.3104251-5-carlos.song@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221214031503.3104251-1-carlos.song@nxp.com> References: <20221214031503.3104251-1-carlos.song@nxp.com> X-ClientProxiedBy: SI1PR02CA0037.apcprd02.prod.outlook.com (2603:1096:4:1f6::13) To VI1PR04MB5005.eurprd04.prod.outlook.com (2603:10a6:803:57::30) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5005:EE_|AM8PR04MB7761:EE_ X-MS-Office365-Filtering-Correlation-Id: 3d92347b-9af6-4e77-efe1-08dadd815a46 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Pb7g2rlBEKfSmgBfQCyLsIxzycGOGMHiVNvRNqUGQ7g5k/KTnkRoCxwh4wF+PXm+HlEtCB6GkVRCOvYrPVL/gSqpWwtzWm8HR1tw1oM7z6SGZMoqcQjOsdUjBxb+ocOzXgvapCqqe/qPSrvZt7Bipcb29cJvo5AMcQBXTUHAXfP1kVTn6HaZsV1nF3ttoIdoRFqMqVujIym7db+7fWkOgRzIL7upCrXnTv7dBWuw2SU3JMm2i4XO3NQqaB580A5IdEPa/0kEQ1GyF76j54cbgXmXCab9CpTBKe4cpVMZy+MPSNuw+66UCxiy6yLBJbL/WfaIycZCF+xgjcplGWvDE86zN7SEkdRpFRN8yYjxAbVjOeAVJGIIbZq+6dYpCRTHUJuw6cDU/rFR74J2pjxTPFLOf2lnjTIJrU9qtCFk8s6iF53lY+QWZ0l5Z6HOwQE347YyUxEP3UNsGuEHl76mWz1IY0Gc4+EPTdUoSHf1x5Ocb2+Xh4DUC5XW7BUVKie0MPYXC0tPqM+yzzjZuwC+J/szrxHdZsEl/Yqv7blD5PMeNIEXy9tr1qsNv7IrCpnlkivHAhlHLhi78vcnh4GcSisZaE/2O6i+uQ6BnpRNHgm27r+fEd/UicGWAO2QThPGu7DzgMirhm0CiDWFCuPgiYf+KzQ2O/PGGQR4vItOG0StoTkEW4sN5n8WTtLvqBPGtJ0rZCp5t6Rg0xRe4TFiLQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5005.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(376002)(39860400002)(396003)(346002)(366004)(136003)(451199015)(66556008)(4326008)(36756003)(66946007)(41300700001)(66476007)(8676002)(316002)(5660300002)(38350700002)(38100700002)(6666004)(478600001)(6486002)(6506007)(186003)(1076003)(86362001)(2616005)(26005)(9686003)(52116002)(6512007)(8936002)(2906002)(4744005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ipCffGGdDce1QBeV6PN34GwEhJEVvLUVNRy2pz2p20PLplyH71xW/5MD1cD1fWRc7ScFY2W0epAGv1TRxQVV3oZJfcEMtk/oylJCuJxBmy+yCwF0T5nYiDetT/p11vjKBlGcB1UUOVcAz9Wi8GMK3ihdQlcH/JT/BXv1xUqX0tHUEPXfUFTpQzH6gG8kvuBQPnXehH+BBk+nEwTzCZFh5BcXjFTronHDvrQ1FHxzlHRPU7HZXEjiqUlOVBekNGRpI+6OsvCmCANrHoLKWq2AymKp2gLXblZp70Twk2dc47XRJ1xji3zeuAuc7BmCyKKOmksH6G/4y9OHWle++X5q4JtGoHmxe5jfd7fa6iiWTgDwypT7TAzOO4wl3Ni5evUNP0bzmuZq1Lg+Gth5VnHAg1vjy8tYRox5oacgOBd4BK5DpGssnqDE3NILL7EwqxGa6dNNPdr8dW7VX89rjLQ26m6zYZEV0pqGNZdsmO2v1YUyjwt40aWRtoMEInfOp9ykgnbQjkKoyfCktMUMsYa5u9Jsg2lX8M4I5/uyZKbk49Ve+jaXckEvqsGBrCCnfo2HGTOMcxd6q+HMO5uS4bQzuyha/lbapkqbMTDd8p+89Nm18MusO31TcQ9VZthMosI/vSQqj0ytW3TFJ3Tv76HPkJ/pAq0iv7oDYBlSwLHowDusxEVltXsiv7hUxVRi8EaQHYeFeGBYNqMnbecFeWDMRXjjSZF6S5AhWrPl/ZgAmN7J5geVWvyHqQSY8w0cy389Zyc1wKbfrOG2B8yIeVRejlh3eKFqUp1ddcPzZjdWEdfT8XregARaG/bSzvkH3p/+K0hjCssj0CCRjXhbQUdAwcq8VA2ZGpS+iJcCEqzHTROorxcbEVPO5+aO0uLs0ehDWOvzQgtSayumb31gl5Q0Dk9JWTEj88+iclQZpGfy+BYA5vdStAPn21LzOh3KRJ7/GdXdHdxtPi0EZU5LcR3VFzyDxVog2xU66TtSwKy2JPNFNbyfY91M8qbHRI0mBQyBF1AYEe0oC95Uo0lYWNxJZ1SIBd+99KyVFZBGfylTbXZ6TwelVv/aFfJUZA+I4pqqUpRc1N69old6Mm4XYuIeu3ZR55f4OTaYqlcs8YAJy/FB4fVQPDqkmz1bzx92qN4omQ3uA7G9RB965dAzh2egZJ/NRqBl6SmpQd7pChSdagMh6dxiVp9usZ0fpz8ek314ah4wDGjcR1RuKcUNZCmA/14WwpasK1xYKJwfHmbQykYftnGGgUn9M8kpGdKG3Q05e1UEgRKGeqJlaS9nATUyXcAJS7J8kHVb4BOnT2J2VxRXGH8fEQYvj98v6ImEmSFS04ye9j6myZSC/bqs1Wl2KFdMIIad/fVlNS3VJYAwr7Typdvawgt/SovY27cqNI6NRcZCwtSJIcZ2sGRPej7rhnDJMSRbV672cLtIJY91BngKsDZpuRWn8NXmuANhx0lUlrVwyDmqGklQx05XBDTuuKNyRQhnGSkNBHshqb6++D2qxoEa1ey0fL0aiIPt/jRr7YKNRkrTr0ZaFOZN/aZvuNvWFC4ad7We6VNaI+GEcenbJZa5xRn9gQioqZY6Ub8S X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3d92347b-9af6-4e77-efe1-08dadd815a46 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5005.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2022 03:14:46.4433 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Q66a9ZR5YbF9T3DlhAHyWhOPG3T/JVObXWYqkOyK9w8wzdYnqkL1qGnYQ2msz+R6P1+z1iY5houTxg378O1ZJw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7761 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Carlos Song FXOS8700_CTRL_ODR_MIN is not used but value is probably wrong. Remove it for a good readability. Fixes: 84e5ddd5c46e ("iio: imu: Add support for the FXOS8700 IMU") Signed-off-by: Carlos Song Changes for V3: - Proposed a separate clean fix diff --git a/drivers/iio/imu/fxos8700_core.c b/drivers/iio/imu/fxos8700_core.c index de4ced979226..7b370bd643a1 100644 --- a/drivers/iio/imu/fxos8700_core.c +++ b/drivers/iio/imu/fxos8700_core.c @@ -146,7 +146,6 @@ /* Bit definitions for FXOS8700_CTRL_REG1 */ #define FXOS8700_CTRL_ODR_MAX 0x00 -#define FXOS8700_CTRL_ODR_MIN GENMASK(4, 3) #define FXOS8700_CTRL_ODR_MSK GENMASK(5, 3) /* Bit definitions for FXOS8700_M_CTRL_REG1 */ From patchwork Wed Dec 14 03:15:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Song X-Patchwork-Id: 13072741 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A41B1C4332F for ; Wed, 14 Dec 2022 03:15:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236287AbiLNDPQ (ORCPT ); Tue, 13 Dec 2022 22:15:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237337AbiLNDOy (ORCPT ); Tue, 13 Dec 2022 22:14:54 -0500 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2085.outbound.protection.outlook.com [40.107.14.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E75A327CE3 for ; Tue, 13 Dec 2022 19:14:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fNgiSTPjvKJH4kQkYPEv4o8aJPmy2eYAnK1OU2MTyMDOEjsnagvbfAcxVErNRl/sysDW3FVarhdHJniJhl5stDYlwSla90JcPtsWHWm/ZdDud2DpiLLqGKj1k1NF3n6pCzJwAigKHPPG0+5ld99ON6oFW2c7vN7Zs2Jn68VHbj7YANS4Rrpz57piwR2nYKpGGLMJK1zcA+IXmWCfqM46azaDYBmEbmm9K7wUj5TeDCSIb2rpdBuFMas6a9qjI8S1bvKliLT3m2fUcKhmG7HUEAkZpYd6L7425PC8ZHdpA+oMp8xBE2sqhrLbb4QJz0i4SbllNXxWSaj0j937yWMNPg== 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=kQl/pJwbK6c0byFAT3NvQhGtea7hloLnYS+JgV2X+NY=; b=nXndrIDOOekLegmcMTVfUDO5aFRsOsqVbzZ/jSoOJLt9SFWhc8Q3nzSAjtF8WmE+18zPxkMCB013XU+RoVyUVH5EDOSi2uhte8cfo7p9bE1pEaiPZ0rPBrl90G9EcEgL/Xq95RxJAYHC5pYBERSLH4+7eEstgPA0Rool0xft+qq8bnXJ5HBiBiVmTCyAaSVC+2XClVZluzr12q6iiL5UUsFO+ZlCk+VhEUJ1P6tHclvmtUsCgocjP+ylV2BUTot/maVKnhZrNbeC+pezMgnhFkSAlJSu0B9DFe4R/vGSA45afa2MUV6kvWmUoXXHH8XTBw+LiVvWAodeHaCzpsqumw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kQl/pJwbK6c0byFAT3NvQhGtea7hloLnYS+JgV2X+NY=; b=V6H/Zs0HG3KAu9em16YslKDp1kZdJVozRMIaFxoGzgVX2Q1Iv8m2Hum3HMD9x39s/2uGxKFgKmbUtKgDNFD7TqXYofQjF9uFIuEukGoldgM1G4/nl0hR4u2OUCLT0jt8Lwm2i1mdiwpCu1nHUGTd6GUMIYyd0v87McPxI29tuK0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5005.eurprd04.prod.outlook.com (2603:10a6:803:57::30) by AM8PR04MB7761.eurprd04.prod.outlook.com (2603:10a6:20b:248::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.10; Wed, 14 Dec 2022 03:14:49 +0000 Received: from VI1PR04MB5005.eurprd04.prod.outlook.com ([fe80::e2d1:cb8b:dc57:8749]) by VI1PR04MB5005.eurprd04.prod.outlook.com ([fe80::e2d1:cb8b:dc57:8749%3]) with mapi id 15.20.5880.019; Wed, 14 Dec 2022 03:14:49 +0000 From: carlos.song@nxp.com To: jic23@kernel.org, lars@metafoo.de Cc: rjones@gateworks.com, Jonathan.Cameron@huawei.com, haibo.chen@nxp.com, carlos.song@nxp.com, linux-imx@nxp.com, linux-iio@vger.kernel.org Subject: [PATCH v3 5/5] iio: imu: fxos8700: fix MAGN sensor scale and unit Date: Wed, 14 Dec 2022 11:15:03 +0800 Message-Id: <20221214031503.3104251-6-carlos.song@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221214031503.3104251-1-carlos.song@nxp.com> References: <20221214031503.3104251-1-carlos.song@nxp.com> X-ClientProxiedBy: SI1PR02CA0037.apcprd02.prod.outlook.com (2603:1096:4:1f6::13) To VI1PR04MB5005.eurprd04.prod.outlook.com (2603:10a6:803:57::30) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5005:EE_|AM8PR04MB7761:EE_ X-MS-Office365-Filtering-Correlation-Id: c3af92f4-fafa-45a9-0d7c-08dadd815c13 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wsSIlkPA8KflIXMN8vb57mWgf/a0xyZRadzQQh7TIt0NSLTWzZGUSFVmmUmtv5/Y2xbDaICrjWQm53UVJ3qTD2mFPJ66lzNC0rjJd6b3W7FJ68Ys9wahgDOnniVHKBkAR0jC9q3Z/AqXVUQsMQBXvA6HFjt6fM9NqmfcAltRygSnNwWKSMKWND/9EsgvGHfwYxbmRG9CgQ3I5OWHL3lMiZ4AC0bFx9dti6SkRrSJMgQLhRzRssJ7CkzgtLjIvvk0XP8CU7wjsJgigm716wa9i/pFLuQ5PjmSR9WE4EjsJXUBY0+CsnA4GV9L2z7rjhDrEa4TuiaecfkJ9ilIjI/BmZNXYkcVkd/PmDcZz5bGGEjPxXfvHrIL/YuKAE9dxRLq0Zi79rAQHoVaUEwaq670S6xR6Du5iEcJ6PzUEnjlU3VDgzsbZAPZSFywDCjj1kJ1+WbseU31EoI1zx79AQ1U12R+KPXuCKyRpb/sl1ORLIFheLDKEBCidB+7LC2CNNspwLCoUItpGgck1sN9KsP5KI8IOG/FTUEG8imLHjpEQbXbvaUaHih+odVh7YInJNW4jXgcOmHPHrAP25QmRDqOBVFQlbECfgV+HXZJa05ubVD+ggIzxZ0dqIfdqvqwiRT1saesrOHlMfHTHvlFiA7fXkDIOFtfxdxc++LDYTpo+whh1YwHcktuwasxCzWQHXURiU0nAZSnuKE4yVT9qH6T0w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5005.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(376002)(39860400002)(396003)(346002)(366004)(136003)(451199015)(66556008)(4326008)(36756003)(66946007)(41300700001)(66476007)(8676002)(316002)(5660300002)(83380400001)(38350700002)(38100700002)(6666004)(478600001)(6486002)(6506007)(186003)(1076003)(86362001)(2616005)(26005)(9686003)(52116002)(6512007)(8936002)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bB2YXZucYM9/oz5DGWdNfIbdqRepmTvynBOiDuLaJjyUozT1JblRSVRxGCQXYR7acL1Ufi29L1L5uDR05ZSiTMn1uRUDH5FhzzEBCTASYAuKOh2vo6u8aHL9xKs1TDDuum+axCws+r/J6a+ERrjsKDE+p0ME32QMUD4wGOLXYf2Ew9hlb8nBpNR3I7hbgOOCBd5F2q9OxRjok6BfFlDmERTH41ecEcAHh90+X3/k2RJ0fCqkR3UlHFh91Y9cNUUNqocFVnVfE4j6CTGoKjhufM84km6BYRWf+LLTfyxf4oxDkaybLsijiRkO/09DmYkhEHDeVQvsPu9eob6ETQK+daxLZ+ejl3PauG2eLVX5D9k1FEnVc0zxkfqZBs9vXQaDIlgQ1Y1L9BxfPMjRp8Qq6wLrJQlU+Dj7EUIAXkd7WXXHSR5KqKQ8iG8FXaszXhYBYsUgUHoJJ2pP+un5kMRZWhX92p8WM/l+uLJNiyR0IblgbtqLm0UlSLkXQKuTmk1aTX66DrEOnlZLC1AfIp1VoBNnJ+Ffz/CmKCG2ldEYieaGYe9LKodL87G80tgGJyROtkjxxuKiO1g2dDOKTaCHGeeWdfF5YSYfCdhLdX7abkDIu4ugLc2AX3mvbYeKD9/AV5rqRtizExlSMqCFkRro4TiIZBNFrEx7ijoRLUfhxWqy7p2IDy8tDoHaahlbEardwyTLga0hWLIvANFqP3sRG4XzEU+J1EFapLTIMH8kffuzBJnMg6KdccVho1zPZSrEnb3mzLR8nOjb4hLAPOO5liWSM/OZg2WU6nyJRonYlQTTygVvCMiCbzWsie4d4bCPZPgV2EkUY/c4fwfWSRDJpSaeoUOGyCQDYxh5zdcOx4HbnNkb7N9BlkEVW7mb34c62zR4oRcoRYdmm6zUmiB4Mq/1dpXRUlxXAqn94EC5v7Zy05TmUJZw1ox9b7Q9VJjHTG97ZDBzckF1mYx6dy8bpU1i9WvA39DjlI96hWWS0plKZI8Fp8+ZyeofbmpO9s8UFW8ArJciMM/+4p+AGGD9Y4CVuKM+MLeE6QbhXwvtLtNuf8jpTOCGLdd3s1UDGGdoL34FpYt6ecUunov6PnA6vldLicWkuqGbIOzSZBQaIguuyLJlPZjWs72ymvJS8yL4pEhl8qdd2QHlbxnFImPfTtrZL9/AhsNpq79IoVpYOiBB9gmsvYeDNWgnBnHbTdVXtFOcs2bPHOqU/iX+OTHv7S5n05HQgOaNCSNHo2E4cG10Q1bFDLEh1KyGZKKcl3E7ZWgnGnd+LrtMbKbZKAoQyUU3KbxZ37cjLEcZufQU6VArG7aXeWPX0xxKRB9J+/921/wA4kWDK8CdFk9LvE17HIztpmNdd22O2EHGr4z0gujnV/eX9+XU4OGj++atXNsQG7NfYb0B5h7uc5kyUixhGV/npmJNCrNz5VLlsNEvBlatpysPfYfG+f1HJ3MP0GFMe0jWRtRhNl5gWxNbh2MP0xNCaz57Q9kwhBbEFanyn377ZLK2R5dnOu447/vxpMOqyhqbv4wn1f/3nvWJsC70I/6nfKoEj5QYAkiehDxXxebIWq+k6fGqZ7IavP+IdogT X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c3af92f4-fafa-45a9-0d7c-08dadd815c13 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5005.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2022 03:14:49.4743 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: BXD2rFaSfK9+dD0IsZ5IuxKTvMx9afVOWjjowNG89g4Nj5u6/tmqt/G5n/UXejhru86gboN932PxUZAXVpkYdg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7761 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Carlos Song +/-1200uT is a MAGN sensor full measurement range. Magnetometer scale is the magnetic sensitivity parameter. It is referenced as 0.1uT according to datasheet and magnetometer channel unit is Gauss in sysfs-bus-iio documentation. Gauss and uTesla unit conversion relationship as follows: 0.1uT = 0.001Gs. Set magnetometer scale and available magnetometer scale as fixed 0.001Gs. Fixes: 84e5ddd5c46e ("iio: imu: Add support for the FXOS8700 IMU") Signed-off-by: Carlos Song Changes for V2: - Modify the magnetometer sensitivity unit to be consistent with the documentation as 0.001g - Rework commit log Changes for V3: - Modify the magnetometer sensitivity unit "g" to standard unit "Gs" - Check and confirm uscale value is correct. The readback of MAGN scale is 0.001 Gs - Rework commit log diff --git a/drivers/iio/imu/fxos8700_core.c b/drivers/iio/imu/fxos8700_core.c index 7b370bd643a1..8320a3b6f942 100644 --- a/drivers/iio/imu/fxos8700_core.c +++ b/drivers/iio/imu/fxos8700_core.c @@ -351,7 +351,7 @@ static int fxos8700_set_scale(struct fxos8700_data *data, struct device *dev = regmap_get_device(data->regmap); if (t == FXOS8700_MAGN) { - dev_err(dev, "Magnetometer scale is locked at 1200uT\n"); + dev_err(dev, "Magnetometer scale is locked at 0.001Gs\n"); return -EINVAL; } @@ -396,7 +396,7 @@ static int fxos8700_get_scale(struct fxos8700_data *data, static const int scale_num = ARRAY_SIZE(fxos8700_accel_scale); if (t == FXOS8700_MAGN) { - *uscale = 1200; /* Magnetometer is locked at 1200uT */ + *uscale = 1000; /* Magnetometer is locked at 0.001Gs */ return 0; } @@ -587,7 +587,7 @@ static IIO_CONST_ATTR(in_accel_sampling_frequency_available, static IIO_CONST_ATTR(in_magn_sampling_frequency_available, "1.5625 6.25 12.5 50 100 200 400 800"); static IIO_CONST_ATTR(in_accel_scale_available, "0.000244 0.000488 0.000976"); -static IIO_CONST_ATTR(in_magn_scale_available, "0.000001200"); +static IIO_CONST_ATTR(in_magn_scale_available, "0.001000"); static struct attribute *fxos8700_attrs[] = { &iio_const_attr_in_accel_sampling_frequency_available.dev_attr.attr,