From patchwork Wed May 18 15:04:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: LI Qingwu X-Patchwork-Id: 12853790 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 9EB45C433F5 for ; Wed, 18 May 2022 15:05:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239061AbiERPFV (ORCPT ); Wed, 18 May 2022 11:05:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239171AbiERPFT (ORCPT ); Wed, 18 May 2022 11:05:19 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60124.outbound.protection.outlook.com [40.107.6.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C407A1DF659; Wed, 18 May 2022 08:05:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U1eUJozGcFzeVi9XV+cJgYqSbrLF2Q6uB7W4QBorhaE1tP1L4tjFVtwiEpnjRaf+eUfz3CKO1dW8Aqf66xs7jAkwZZMbmcjXYl8N3I5dMvLC2m2vH62ORDi0bb/6E7KKRdaL3qsbtjyCVfX5frpaN03PCvtEdUQM8wjMM8yAIKZl8X325gPy9XX41ljNxMlrdrVorjQ2bhhcytBig/SafaHJ38MlJOFiaALYNRoIdqZDxr7Qw1B6GfAjMA6iEcOWmXVSwko7asuDUz6VswjyaTHtM7kk3GMs+p3sFXeUViDemiWibG3g7W35t+eOcb6Uc1hHa6Bre8wZKoeoBpg7XQ== 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=Pge+B86GgAWoO5oMnHYETK/lg/AE/VuzUzmyMbW4Pdo=; b=OiuW2qbdKmu9OmevGnmwoakZjVpPSVEwsPhv1c9c+cc49xOgOVA3oUSRUt/ueheC2k1o+yLN+ijS0YTwTAjK2QD4sHK8m45y6Gh4QJLXMscC3LU1x1gBgJHk6oo9vBUkwx6+4hoE1VCUIsGxkIHj8d2w0593lmhyQgTfiqLP9sdImzIFpokCbNtn8Or7tTpNf+/tl7RAKTPvjlgeeKyaNjFqoh5A1GDVRVN6M8URs2l7FViF2Urn7vxOP5JEZpC90oH0wCtQzwKfP6mVw5p/ZexTsamSQdQUIqK1XprZah1uxHt8GM3n8fRgWkwC0SPCTiD09EQuCyuaQ4jbTSfChw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 193.8.40.94) smtp.rcpttodomain=kernel.org smtp.mailfrom=leica-geosystems.com.cn; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=leica-geosystems.com.cn; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leica-geosystems.com.cn; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Pge+B86GgAWoO5oMnHYETK/lg/AE/VuzUzmyMbW4Pdo=; b=f673qDPE9sRZfRBsjWqeOuC0y46pqEBUC9O9+daKeh/5RiCY1mc9jMs6YSiaBQtOwTy3j/cGqMN2vUs6kwbNuobJEd3LWhxwkCF84pLRWfALRlz/WjI1YY3WJAyVzO5Cr5MC67lbXW0o2fjm2d7YYPqI8ISO9ZfMHEFaRav8Sm4= Received: from AS8PR05CA0003.eurprd05.prod.outlook.com (2603:10a6:20b:311::8) by HE1PR06MB3996.eurprd06.prod.outlook.com (2603:10a6:7:a3::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.23; Wed, 18 May 2022 15:04:29 +0000 Received: from AM5EUR02FT028.eop-EUR02.prod.protection.outlook.com (2603:10a6:20b:311:cafe::39) by AS8PR05CA0003.outlook.office365.com (2603:10a6:20b:311::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.15 via Frontend Transport; Wed, 18 May 2022 15:04:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 193.8.40.94) smtp.mailfrom=leica-geosystems.com.cn; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=leica-geosystems.com.cn; Received-SPF: Pass (protection.outlook.com: domain of leica-geosystems.com.cn designates 193.8.40.94 as permitted sender) receiver=protection.outlook.com; client-ip=193.8.40.94; helo=aherlnxbspsrv01.lgs-net.com; Received: from aherlnxbspsrv01.lgs-net.com (193.8.40.94) by AM5EUR02FT028.mail.protection.outlook.com (10.152.8.115) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.13 via Frontend Transport; Wed, 18 May 2022 15:04:29 +0000 From: LI Qingwu To: jic23@kernel.org, lars@metafoo.de, mchehab+huawei@kernel.org, ardeleanalex@gmail.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Qing-wu.Li@leica-geosystems.com.cn, robh+dt@kernel.org, mike.looijmans@topic.nl, devicetree@vger.kernel.org, thomas.haemmerle@leica-geosystems.com Subject: [PATCH V3 1/6] iio: accel: bmi088: Modified the scale calculate Date: Wed, 18 May 2022 15:04:20 +0000 Message-Id: <20220518150425.927988-2-Qing-wu.Li@leica-geosystems.com.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220518150425.927988-1-Qing-wu.Li@leica-geosystems.com.cn> References: <20220518150425.927988-1-Qing-wu.Li@leica-geosystems.com.cn> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9a359563-cfff-4f38-647f-08da38dfb515 X-MS-TrafficTypeDiagnostic: HE1PR06MB3996:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XxIODZHPXRlQOCkg4Pw3fVW2XW+WiGjS51uLa0y9B9w+Fggk8EHyYmtoIKwhhMKHa/3N7hc7AoWdzuv0mipBZN1MxQfpnHG+6jWqTin2/ovPN3sEfDh9jZAbN1Ak91TLa4nc+prs7kVbdLthVoKcVSbl1AJCjC0H9Dk6q7m/zzy8xDXJeKH69LUZzuLgdXxOyBGTCE43DINn1IjV+zXwmX88bSv3IOhnrxnEX7tGXs6ge3CyyccERMAMKsW7s6XEk57PxAP9RG3jgtpqQo5FVfchrRSe4seatl7s0SBLtzjLCElkNs1lrCov3mt5NBy8hJQ/qs7XjKM3ouiULo33EeLb4+lFjZdziXDvecGEIuZ226N2vtb7GBptFp/oGX0s/lO2fwc6/Fn/t5KU3nGP2I7mRI2tvkO5FzRd5eY9UMdEjpshySf8z7OlKTy1UBZNq8DVTFFsAZfrLQu7OIjy64joW0RQR0GRzuek0EGt0W4oHqbm1VeSC7en0WYyntqCjqDsVVpOd+UikOPlEOsV+6ArlJnxx1hG7L1hlNoTbPDHNIODi5Oxn711IrzHJno37T/+P4ChATRGN1BEd2AYMOxEJjV8VdLVi0snwHcVPLHfwbMXFrvM6VSGbc8O03t8Z22ptr8L92wni5I5Y4wU4KRjAM1H1vYb6ymZgx7svfuTvdlqSlSk0rYgNc42FzT/GnuQ5WSWLBvT+RovnptofA== X-Forefront-Antispam-Report: CIP:193.8.40.94;CTRY:CH;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:aherlnxbspsrv01.lgs-net.com;PTR:ahersrvdom50.leica-geosystems.com;CAT:NONE;SFS:(13230001)(4636009)(36840700001)(40470700004)(46966006)(356005)(26005)(921005)(508600001)(1076003)(6512007)(2906002)(2616005)(956004)(186003)(36736006)(316002)(47076005)(86362001)(5660300002)(336012)(40460700003)(83380400001)(81166007)(82310400005)(6506007)(70586007)(70206006)(36756003)(8676002)(36860700001)(6486002)(118246002)(6666004)(8936002);DIR:OUT;SFP:1102; X-OriginatorOrg: leica-geosystems.com.cn X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2022 15:04:29.0630 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9a359563-cfff-4f38-647f-08da38dfb515 X-MS-Exchange-CrossTenant-Id: 1b16ab3e-b8f6-4fe3-9f3e-2db7fe549f6a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=1b16ab3e-b8f6-4fe3-9f3e-2db7fe549f6a;Ip=[193.8.40.94];Helo=[aherlnxbspsrv01.lgs-net.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR02FT028.eop-EUR02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR06MB3996 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org The units after application of scale are 100*m/s^2, The scale calculation is only for the device with the range of 3, 6, 12, and 24g, but some other chips have a range of 2, 4, 6, and 8g. Modified the formula to a scale list. The scales in the list are calculated by 1/sensitivity*9.8. The new units after the application of scale are m/s^2. Reviewed-by: Alexandru Ardelean Signed-off-by: LI Qingwu --- drivers/iio/accel/bmi088-accel-core.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/iio/accel/bmi088-accel-core.c b/drivers/iio/accel/bmi088-accel-core.c index a06dae5c971d..21bddee869af 100644 --- a/drivers/iio/accel/bmi088-accel-core.c +++ b/drivers/iio/accel/bmi088-accel-core.c @@ -73,6 +73,8 @@ #define BMI088_ACCEL_FIFO_MODE_FIFO 0x40 #define BMI088_ACCEL_FIFO_MODE_STREAM 0x80 +#define BMIO088_ACCEL_ACC_RANGE_MSK GENMASK(1, 0) + enum bmi088_accel_axis { AXIS_X, AXIS_Y, @@ -119,6 +121,7 @@ struct bmi088_accel_chip_info { u8 chip_id; const struct iio_chan_spec *channels; int num_channels; + const int scale_table[4][2]; }; struct bmi088_accel_data { @@ -280,6 +283,7 @@ static int bmi088_accel_read_raw(struct iio_dev *indio_dev, struct bmi088_accel_data *data = iio_priv(indio_dev); struct device *dev = regmap_get_device(data->regmap); int ret; + int reg; switch (mask) { case IIO_CHAN_INFO_RAW: @@ -330,13 +334,14 @@ static int bmi088_accel_read_raw(struct iio_dev *indio_dev, return ret; ret = regmap_read(data->regmap, - BMI088_ACCEL_REG_ACC_RANGE, val); + BMI088_ACCEL_REG_ACC_RANGE, ®); if (ret) goto out_read_raw_pm_put; - *val2 = 15 - (*val & 0x3); - *val = 3 * 980; - ret = IIO_VAL_FRACTIONAL_LOG2; + reg = FIELD_GET(BMIO088_ACCEL_ACC_RANGE_MSK, reg); + *val = data->chip_info->scale_table[reg][0]; + *val2 = data->chip_info->scale_table[reg][1]; + ret = IIO_VAL_INT_PLUS_MICRO; goto out_read_raw_pm_put; default: @@ -432,6 +437,7 @@ static const struct bmi088_accel_chip_info bmi088_accel_chip_info_tbl[] = { .chip_id = 0x1E, .channels = bmi088_accel_channels, .num_channels = ARRAY_SIZE(bmi088_accel_channels), + .scale_table = {{0, 897}, {0, 1795}, {0, 3590}, {0, 7179}}, }, }; From patchwork Wed May 18 15:04:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: LI Qingwu X-Patchwork-Id: 12853785 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 13042C433F5 for ; Wed, 18 May 2022 15:05:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239052AbiERPE7 (ORCPT ); Wed, 18 May 2022 11:04:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238988AbiERPE6 (ORCPT ); Wed, 18 May 2022 11:04:58 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60109.outbound.protection.outlook.com [40.107.6.109]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AC1F66AEA; Wed, 18 May 2022 08:04:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OWiXGlWivomJssOKbkihmXNq0wKhtIpLUNyV7hgad7z2fJsS6XXJedTVOzG3V+CkrHDGiNlozjdeG+gb1f8p2Pehj7ziRXVK2FU6y5hwNEfYXQMpJu0pbVuXNNBG7JM1ppuPmtCqw9ygDIW4+BSNmvTf0w9eu3S/Oqy8BcEIQY2fJrn5hmxmWFkHvBdvdRYRs81wiBXaocXOCVsY3zNojpgtCx0PymGBh4oSnIL0WzSTLZMDOCreUs299tK/bcu4wnt+g+zFPwGXcijulA0MP19XAQHJ0LQUmND6UqjAHRW96gASeNZrZJwUevZAxS0eRoCj/Oilf3igReCuadvUqg== 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=TTKetEO1dkr1bJcpovsjZfBULsfuWIAoVlCe3e9j71M=; b=eucGJCOdY1o6cGwFGlYeo1ZYo5LQDyjLDXgstik4fd7Lysk0YPfaTzxMPVpUZJRSSAUS0vTNeDCU1gVBriIiqx9RepgaUbKI/DCwOLmc+OdRU2xoXkaunihONK8tiic9WimJljRvbmh1+/xZoNK+FPD0j3z/2gdjaNQSxZq+a5G0ub748wYRbcT0Z5NSAsn8/FzMrRuAxiIl0m2q1ecqHE2NXqD/vdc6swXHK4VW8uXf8Ai2gvQbm/Al8oqI7HnOKp5EwdgZGqBe1M9a45ErxkCCWjDupJwpTFL7TmS3qociPz7/7fPQpb5HyotRJd00oKlfrVXaNQhMSnvo+4vZfA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 193.8.40.94) smtp.rcpttodomain=kernel.org smtp.mailfrom=leica-geosystems.com.cn; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=leica-geosystems.com.cn; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leica-geosystems.com.cn; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TTKetEO1dkr1bJcpovsjZfBULsfuWIAoVlCe3e9j71M=; b=tPo11pC3nt5uRStqOWlg5p0E0Ehbbn57u/Cur7dNJPdUQ3Q4aP6/BWiGanBkEqYawvqISYQbkDrN0MAvqgM1o8uIZV0UchM6Bw5uvdiBy7AjfgATcv0v0Vo9hA+86UgcB00YLm7gC7jNjugJTF6NxjP1RnSQb0Z++ByFcbDwazI= Received: from AM6P195CA0034.EURP195.PROD.OUTLOOK.COM (2603:10a6:209:81::47) by DB7PR06MB5020.eurprd06.prod.outlook.com (2603:10a6:10:6f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.18; Wed, 18 May 2022 15:04:55 +0000 Received: from AM5EUR02FT028.eop-EUR02.prod.protection.outlook.com (2603:10a6:209:81:cafe::df) by AM6P195CA0034.outlook.office365.com (2603:10a6:209:81::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.14 via Frontend Transport; Wed, 18 May 2022 15:04:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 193.8.40.94) smtp.mailfrom=leica-geosystems.com.cn; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=leica-geosystems.com.cn; Received-SPF: Pass (protection.outlook.com: domain of leica-geosystems.com.cn designates 193.8.40.94 as permitted sender) receiver=protection.outlook.com; client-ip=193.8.40.94; helo=aherlnxbspsrv01.lgs-net.com; Received: from aherlnxbspsrv01.lgs-net.com (193.8.40.94) by AM5EUR02FT028.mail.protection.outlook.com (10.152.8.115) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.13 via Frontend Transport; Wed, 18 May 2022 15:04:54 +0000 From: LI Qingwu To: jic23@kernel.org, lars@metafoo.de, mchehab+huawei@kernel.org, ardeleanalex@gmail.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Qing-wu.Li@leica-geosystems.com.cn, robh+dt@kernel.org, mike.looijmans@topic.nl, devicetree@vger.kernel.org, thomas.haemmerle@leica-geosystems.com Subject: [PATCH V3 2/6] iio: accel: bmi088: Make it possible to config scales Date: Wed, 18 May 2022 15:04:21 +0000 Message-Id: <20220518150425.927988-3-Qing-wu.Li@leica-geosystems.com.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220518150425.927988-1-Qing-wu.Li@leica-geosystems.com.cn> References: <20220518150425.927988-1-Qing-wu.Li@leica-geosystems.com.cn> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 811b4249-bb6f-40da-0a47-08da38dfc454 X-MS-TrafficTypeDiagnostic: DB7PR06MB5020:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: e9dqoUAscWWrWdYE7FKWz8rMVMIE38sBJJsPUrneF8mzx4MXBvW/iwUrOtHiixltqIkI9iywrlCamj+cGl3uFaaT+L8SLqhppyUrprP7f28nmUlhkmfumpNlf5bBcYJJxY3G3l68OSHpA2G0+xkMRvGPdxhuovuhUKINrgL6H2wYlN3gvjnFhVU5BU+Z/cJIe4ONJnnNshHfxRmJIO68AX+ROyB/6xEUUdZUWCyGGElcs2eqTDfh3rH0GLIn4pGCCYygPHP937C2BwWkz/vm5MEYD6AcpJTC/bpkP2y33+rP6O2kguaWomJWvTtlfCPF2MiNDzljqDKxhGRN/nK73XoYI0xHGMT19DMigsmWPD9bZZQUvVF2Vgs8z45ieRyRoUa4p5pF4mdiTbJhyrMCBKb5d7lhgNav9QtoTcuN+IlXnxaU3s16jHchkK1YGPewtipmd0JRHQzQJt1daOir+VRwSiyo6bEl2nxzFlNQqBwSXg/qSqv2cjMkc2d+2O3jKHWwds6HEjO8yoBdrCo/yWsOhA1AG+4Ve8Rc2gtjm6MCU8fWwFKRhD9VvFSgNBe066hwQFZlaR/yO0Ut5sl2jN1aoSth6x5yL4xejsJWjVyXYwLgpHoXRs3zkXq/3MotjeAT5ZlCoFIXQx1EzhuXGwbZQQ+gkPcUbfpBoToehwIW+Ljniz/QRuW1JLpsdEGh X-Forefront-Antispam-Report: CIP:193.8.40.94;CTRY:CH;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:aherlnxbspsrv01.lgs-net.com;PTR:ahersrvdom50.leica-geosystems.com;CAT:NONE;SFS:(13230001)(4636009)(36840700001)(46966006)(40470700004)(8676002)(83380400001)(36860700001)(40460700003)(86362001)(6486002)(81166007)(508600001)(356005)(921005)(186003)(8936002)(70206006)(6506007)(1076003)(36756003)(956004)(5660300002)(2906002)(82310400005)(2616005)(336012)(6666004)(47076005)(118246002)(36736006)(316002)(26005)(70586007)(6512007);DIR:OUT;SFP:1102; X-OriginatorOrg: leica-geosystems.com.cn X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2022 15:04:54.6238 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 811b4249-bb6f-40da-0a47-08da38dfc454 X-MS-Exchange-CrossTenant-Id: 1b16ab3e-b8f6-4fe3-9f3e-2db7fe549f6a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=1b16ab3e-b8f6-4fe3-9f3e-2db7fe549f6a;Ip=[193.8.40.94];Helo=[aherlnxbspsrv01.lgs-net.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR02FT028.eop-EUR02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR06MB5020 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org The sensor can set the scales by writing the range register 0x41, The current driver has no interface to configure it. The commit adds the interface for config the scales. Reviewed-by: Alexandru Ardelean Signed-off-by: LI Qingwu --- drivers/iio/accel/bmi088-accel-core.c | 33 ++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/drivers/iio/accel/bmi088-accel-core.c b/drivers/iio/accel/bmi088-accel-core.c index 21bddee869af..563bcc311844 100644 --- a/drivers/iio/accel/bmi088-accel-core.c +++ b/drivers/iio/accel/bmi088-accel-core.c @@ -239,6 +239,21 @@ static int bmi088_accel_set_sample_freq(struct bmi088_accel_data *data, int val) BMI088_ACCEL_MODE_ODR_MASK, regval); } +static int bmi088_accel_set_scale(struct bmi088_accel_data *data, int val, int val2) +{ + unsigned int i; + + for (i = 0; i < 4; i++) + if (val == data->chip_info->scale_table[i][0] && + val2 == data->chip_info->scale_table[i][1]) + break; + + if (i == 4) + return -EINVAL; + + return regmap_write(data->regmap, BMI088_ACCEL_REG_ACC_RANGE, i); +} + static int bmi088_accel_get_temp(struct bmi088_accel_data *data, int *val) { int ret; @@ -372,7 +387,13 @@ static int bmi088_accel_read_avail(struct iio_dev *indio_dev, const int **vals, int *type, int *length, long mask) { + struct bmi088_accel_data *data = iio_priv(indio_dev); switch (mask) { + case IIO_CHAN_INFO_SCALE: + *vals = (const int *)data->chip_info->scale_table; + *length = 8; + *type = IIO_VAL_INT_PLUS_MICRO; + return IIO_AVAIL_LIST; case IIO_CHAN_INFO_SAMP_FREQ: *type = IIO_VAL_INT_PLUS_MICRO; *vals = bmi088_sample_freqs; @@ -392,6 +413,15 @@ static int bmi088_accel_write_raw(struct iio_dev *indio_dev, int ret; switch (mask) { + case IIO_CHAN_INFO_SCALE: + ret = pm_runtime_resume_and_get(dev); + if (ret) + return ret; + + ret = bmi088_accel_set_scale(data, val, val2); + pm_runtime_mark_last_busy(dev); + pm_runtime_put_autosuspend(dev); + return ret; case IIO_CHAN_INFO_SAMP_FREQ: ret = pm_runtime_resume_and_get(dev); if (ret) @@ -413,7 +443,8 @@ static int bmi088_accel_write_raw(struct iio_dev *indio_dev, .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \ .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) | \ BIT(IIO_CHAN_INFO_SAMP_FREQ), \ - .info_mask_shared_by_type_available = BIT(IIO_CHAN_INFO_SAMP_FREQ), \ + .info_mask_shared_by_type_available = BIT(IIO_CHAN_INFO_SAMP_FREQ) | \ + BIT(IIO_CHAN_INFO_SCALE), \ .scan_index = AXIS_##_axis, \ } From patchwork Wed May 18 15:04:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: LI Qingwu X-Patchwork-Id: 12853787 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 F38A9C4167B for ; Wed, 18 May 2022 15:05:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239098AbiERPFB (ORCPT ); Wed, 18 May 2022 11:05:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239062AbiERPFA (ORCPT ); Wed, 18 May 2022 11:05:00 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60120.outbound.protection.outlook.com [40.107.6.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF61766AEA; Wed, 18 May 2022 08:04:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dc63RNKF6KPM5f8HpYnNQSKdowRQwR7cQTit/VFE0ejcb0HHxwOWrMfdVcv+eb0Az2aYXNE8jcISLZUNHd7hWmmG16mPn6S86juKQdFsTeOLPcgcEf9vh2Ha/6B+t/yhg1v9SJccsy8aH/5QivD2mwE/xIRHBEaaDKNh89pn/shJw4BRuW/a7vHTvOPUW6X3XdRxSjpHZeAK3sxutrN0Tl7fi4p0n/i5GLpi0r/WXuUbdqDQJFdqwNPzqFhAgaxof+kg5GcYsU03gVrL/m59JQecJ3sIHXQ1JBjZY73MfkSI29YyqZTbQolJS/OpvdIC6M164nYIcWl7/1b25YtiHg== 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=H523Zh88b9B/1TgO3VcudpPlZ336TqyROCpGQQIxntw=; b=PUcI0LcWe3EbiJ2Lq4HE5Y07bkem8dXWjyCIepoHb8WDhd6WPMkcblbciYUqZqfRR7m1GP32USn1KbwRYaY1c++cjheTb64wJGmJwmHhojTRvBbq2W6CNSqs/MpkZGagq0PtRwWtAcVYnHBAXUsQOJtQhqcHeDZtZ53ObeOh0T2EwTans7htk3f0gG7+g6rqSIPK5Z1A/op/OOf981nCqtWLNKoOVZcUW3fyawRjoq7SzPQR1GzMKdTVWFLJtn3tbm8ZoqX5RsnRqHcplxJ/rEh1HsKR2Mov6Vqqu9DIoLx/YQZjx/ar0DLjGUwX6E51M/kwtY7iDqL34wADj+fr3g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 193.8.40.94) smtp.rcpttodomain=kernel.org smtp.mailfrom=leica-geosystems.com.cn; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=leica-geosystems.com.cn; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leica-geosystems.com.cn; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=H523Zh88b9B/1TgO3VcudpPlZ336TqyROCpGQQIxntw=; b=pVCt7b3KmnPkP6fm2bRxPlLcKsrLlzze5foSn8BJkMrJG59Sb2KuGYQlrQPVBWLde4dwo6+V9BA4RSGuUy59E9E/Wcw6LOTU3tNvocyOycsgnAmvsGevZUciNBt4qW6c1NYobpZw9f5BjSl9rZUIAYZ0DlaP/XSiM1rxkcYiviM= Received: from AM6P195CA0016.EURP195.PROD.OUTLOOK.COM (2603:10a6:209:81::29) by VI1PR06MB4301.eurprd06.prod.outlook.com (2603:10a6:803:68::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.18; Wed, 18 May 2022 15:04:55 +0000 Received: from AM5EUR02FT028.eop-EUR02.prod.protection.outlook.com (2603:10a6:209:81:cafe::a7) by AM6P195CA0016.outlook.office365.com (2603:10a6:209:81::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.13 via Frontend Transport; Wed, 18 May 2022 15:04:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 193.8.40.94) smtp.mailfrom=leica-geosystems.com.cn; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=leica-geosystems.com.cn; Received-SPF: Pass (protection.outlook.com: domain of leica-geosystems.com.cn designates 193.8.40.94 as permitted sender) receiver=protection.outlook.com; client-ip=193.8.40.94; helo=aherlnxbspsrv01.lgs-net.com; Received: from aherlnxbspsrv01.lgs-net.com (193.8.40.94) by AM5EUR02FT028.mail.protection.outlook.com (10.152.8.115) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.13 via Frontend Transport; Wed, 18 May 2022 15:04:55 +0000 From: LI Qingwu To: jic23@kernel.org, lars@metafoo.de, mchehab+huawei@kernel.org, ardeleanalex@gmail.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Qing-wu.Li@leica-geosystems.com.cn, robh+dt@kernel.org, mike.looijmans@topic.nl, devicetree@vger.kernel.org, thomas.haemmerle@leica-geosystems.com Subject: [PATCH V3 3/6] iio: accel: bmi088: modified the device name Date: Wed, 18 May 2022 15:04:22 +0000 Message-Id: <20220518150425.927988-4-Qing-wu.Li@leica-geosystems.com.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220518150425.927988-1-Qing-wu.Li@leica-geosystems.com.cn> References: <20220518150425.927988-1-Qing-wu.Li@leica-geosystems.com.cn> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f9bd7cbb-37ad-49de-7925-08da38dfc4c6 X-MS-TrafficTypeDiagnostic: VI1PR06MB4301:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rjGVAZ0059iIhSVrkIrZpWxZV/z9i8fKEgeqxs9L/mtmCrbJa1VGZRGbkaja5SceBpucNmS3pOi1TG8Wu5d5KkyUHHR/xghDUif2ewS+7YKqY6y3/ZmeqCQ6fVcjK+v3vgI3uRU2s1zlmBSrVWqGePcIWGpOIpNQyyQvaXaWq22XP0JVFk6dq3Fptc2wzPvhp4+HuETy9MWddVqeQgX9lMJjSeBpdY8N591OQaHu6Wjdxf83FsVbWgfj0rJjFgbH5LNddHMS2HrgGnH0XAJ3LMbDTD7FmccIhKXb6HwG1iPXMuruqCxPINE7Caaw1pHaLI4N8U7goFzmuooce2hRvXQFjIN9C+i3xn1FwF424wudc62RUZ+j6ywQwhvzmg9JichizzaUNgM4NRf0DW9Gn3+vz3rIQ3sm2a12d7BDsVj3CxfbEi1QbGDxhA/7FJu9P06NKyYNqTq5JqacSM3yJJsaBYs9iVB2Eh4+3mxhmgGGB/oL+8AtEN+6R2Ux5BH157gZ8ptmGAyIUFLahk8DwEy1HWxyUMaAgatQRwpyDzLddwfC0STQTd3HiYVm4/1ZSPr98Vjl3lnAf9uP3LqqzW/6oe7qp9axgznFsruBbSaCFjUxuKZDrQbsuxsTnkWp9INLWXco8x6Ym8jeJs6PFivMBwj826Rv5dM1N8uj8lEQUuKDLHEEr3wVlSBMcRxOacXutGJxr/+UEI+s02/+Qw== X-Forefront-Antispam-Report: CIP:193.8.40.94;CTRY:CH;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:aherlnxbspsrv01.lgs-net.com;PTR:ahersrvdom50.leica-geosystems.com;CAT:NONE;SFS:(13230001)(4636009)(36840700001)(40470700004)(46966006)(6506007)(6512007)(6666004)(8676002)(36736006)(47076005)(316002)(356005)(921005)(70586007)(6486002)(70206006)(118246002)(2906002)(36860700001)(86362001)(82310400005)(26005)(83380400001)(5660300002)(508600001)(2616005)(1076003)(956004)(186003)(336012)(36756003)(40460700003)(81166007)(8936002);DIR:OUT;SFP:1102; X-OriginatorOrg: leica-geosystems.com.cn X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2022 15:04:55.3894 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f9bd7cbb-37ad-49de-7925-08da38dfc4c6 X-MS-Exchange-CrossTenant-Id: 1b16ab3e-b8f6-4fe3-9f3e-2db7fe549f6a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=1b16ab3e-b8f6-4fe3-9f3e-2db7fe549f6a;Ip=[193.8.40.94];Helo=[aherlnxbspsrv01.lgs-net.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR02FT028.eop-EUR02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR06MB4301 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org iio: accel: bmi088: modified the device name It is possible to have multiple sensors connected on the same platform. For support of different sensors, making it possible to obtain the device name by reading the chip id. If the device was found in the table but the device tree binding is different, the driver will carry on with a warning. If no matching device was found, the driver load the binding chip info. Tested case, test with bmi085 and bmi090 patches applied: connect 3 bmi090l to the system, and set device tree compatible: spi2.0: compatible = "bosch,bmi090l-accel"; spi2.2: compatible = "bosch,bmi088-accel"; spi2.4: compatible = "bosch,bmi085-accel"; Get a warning for the mismatched devices: bmi088_accel_spi spi2.2: unexpected chip id 0x1A bmi088_accel_spi spi2.4: unexpected chip id 0x1A Get the real present device name: /sys/bus/iio/devices/iio:device1/name:bmi090l-accel /sys/bus/iio/devices/iio:device3/name:bmi090l-accel /sys/bus/iio/devices/iio:device5/name:bmi090l-accel Signed-off-by: LI Qingwu --- drivers/iio/accel/bmi088-accel-core.c | 35 +++++++++++++++------------ drivers/iio/accel/bmi088-accel-spi.c | 13 +++++++--- drivers/iio/accel/bmi088-accel.h | 7 +++++- 3 files changed, 36 insertions(+), 19 deletions(-) diff --git a/drivers/iio/accel/bmi088-accel-core.c b/drivers/iio/accel/bmi088-accel-core.c index 563bcc311844..c30c2d510b92 100644 --- a/drivers/iio/accel/bmi088-accel-core.c +++ b/drivers/iio/accel/bmi088-accel-core.c @@ -388,6 +388,7 @@ static int bmi088_accel_read_avail(struct iio_dev *indio_dev, long mask) { struct bmi088_accel_data *data = iio_priv(indio_dev); + switch (mask) { case IIO_CHAN_INFO_SCALE: *vals = (const int *)data->chip_info->scale_table; @@ -463,8 +464,8 @@ static const struct iio_chan_spec bmi088_accel_channels[] = { }; static const struct bmi088_accel_chip_info bmi088_accel_chip_info_tbl[] = { - [0] = { - .name = "bmi088a", + [BOSCH_BMI088] = { + .name = "bmi088-accel", .chip_id = 0x1E, .channels = bmi088_accel_channels, .num_channels = ARRAY_SIZE(bmi088_accel_channels), @@ -483,12 +484,15 @@ static const unsigned long bmi088_accel_scan_masks[] = { 0 }; -static int bmi088_accel_chip_init(struct bmi088_accel_data *data) +static int bmi088_accel_chip_init(struct bmi088_accel_data *data, enum bmi_device_type type) { struct device *dev = regmap_get_device(data->regmap); int ret, i; unsigned int val; + if (type >= BOSCH_UNKNOWN) + return -ENODEV; + /* Do a dummy read to enable SPI interface, won't harm I2C */ regmap_read(data->regmap, BMI088_ACCEL_REG_INT_STATUS, &val); @@ -514,22 +518,23 @@ static int bmi088_accel_chip_init(struct bmi088_accel_data *data) } /* Validate chip ID */ - for (i = 0; i < ARRAY_SIZE(bmi088_accel_chip_info_tbl); i++) { - if (bmi088_accel_chip_info_tbl[i].chip_id == val) { - data->chip_info = &bmi088_accel_chip_info_tbl[i]; + for (i = 0; i < ARRAY_SIZE(bmi088_accel_chip_info_tbl); i++) + if (bmi088_accel_chip_info_tbl[i].chip_id == val) break; - } - } - if (i == ARRAY_SIZE(bmi088_accel_chip_info_tbl)) { - dev_err(dev, "Invalid chip %x\n", val); - return -ENODEV; - } + + if (i == ARRAY_SIZE(bmi088_accel_chip_info_tbl)) + data->chip_info = &bmi088_accel_chip_info_tbl[type]; + else + data->chip_info = &bmi088_accel_chip_info_tbl[i]; + + if (i != type) + dev_warn(dev, "unexpected chip id 0x%X\n", val); return 0; } int bmi088_accel_core_probe(struct device *dev, struct regmap *regmap, - int irq, const char *name, bool block_supported) + int irq, enum bmi_device_type type) { struct bmi088_accel_data *data; struct iio_dev *indio_dev; @@ -544,13 +549,13 @@ int bmi088_accel_core_probe(struct device *dev, struct regmap *regmap, data->regmap = regmap; - ret = bmi088_accel_chip_init(data); + ret = bmi088_accel_chip_init(data, type); if (ret) return ret; indio_dev->channels = data->chip_info->channels; indio_dev->num_channels = data->chip_info->num_channels; - indio_dev->name = name ? name : data->chip_info->name; + indio_dev->name = data->chip_info->name; indio_dev->available_scan_masks = bmi088_accel_scan_masks; indio_dev->modes = INDIO_DIRECT_MODE; indio_dev->info = &bmi088_accel_info; diff --git a/drivers/iio/accel/bmi088-accel-spi.c b/drivers/iio/accel/bmi088-accel-spi.c index dd1e3f6cf211..24cdeb41d2a6 100644 --- a/drivers/iio/accel/bmi088-accel-spi.c +++ b/drivers/iio/accel/bmi088-accel-spi.c @@ -52,8 +52,8 @@ static int bmi088_accel_probe(struct spi_device *spi) return PTR_ERR(regmap); } - return bmi088_accel_core_probe(&spi->dev, regmap, spi->irq, id->name, - true); + return bmi088_accel_core_probe(&spi->dev, regmap, spi->irq, + id->driver_data); } static int bmi088_accel_remove(struct spi_device *spi) @@ -61,8 +61,14 @@ static int bmi088_accel_remove(struct spi_device *spi) return bmi088_accel_core_remove(&spi->dev); } +static const struct of_device_id bmi088_of_match[] = { + { .compatible = "bosch,bmi088-accel" }, + {} +}; +MODULE_DEVICE_TABLE(of, bmi088_of_match); + static const struct spi_device_id bmi088_accel_id[] = { - {"bmi088-accel", }, + {"bmi088-accel", BOSCH_BMI088}, {} }; MODULE_DEVICE_TABLE(spi, bmi088_accel_id); @@ -71,6 +77,7 @@ static struct spi_driver bmi088_accel_driver = { .driver = { .name = "bmi088_accel_spi", .pm = &bmi088_accel_pm_ops, + .of_match_table = bmi088_of_match, }, .probe = bmi088_accel_probe, .remove = bmi088_accel_remove, diff --git a/drivers/iio/accel/bmi088-accel.h b/drivers/iio/accel/bmi088-accel.h index 5c25f16b672c..b6a0281a847f 100644 --- a/drivers/iio/accel/bmi088-accel.h +++ b/drivers/iio/accel/bmi088-accel.h @@ -8,11 +8,16 @@ struct device; +enum bmi_device_type { + BOSCH_BMI088, + BOSCH_UNKNOWN, +}; + extern const struct regmap_config bmi088_regmap_conf; extern const struct dev_pm_ops bmi088_accel_pm_ops; int bmi088_accel_core_probe(struct device *dev, struct regmap *regmap, int irq, - const char *name, bool block_supported); + enum bmi_device_type type); int bmi088_accel_core_remove(struct device *dev); #endif /* BMI088_ACCEL_H */ From patchwork Wed May 18 15:04:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: LI Qingwu X-Patchwork-Id: 12853786 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 ADB75C433EF for ; Wed, 18 May 2022 15:05:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239084AbiERPFA (ORCPT ); Wed, 18 May 2022 11:05:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238995AbiERPE7 (ORCPT ); Wed, 18 May 2022 11:04:59 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2093.outbound.protection.outlook.com [40.107.22.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E374012698A; Wed, 18 May 2022 08:04:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y74Qel23OLDYrjNf6MzxhLEDxPLwDxkbYFlPGaZ4bJAuuGrtRYKXnuRbShcIsNNdtZH5ynQqWYZBhCX3uuBSe6jyDNR2387U98MMCNn4dWZ43nqnm4tGUUnZ/+ZkgY5H028cLRc3AhuBzPuIc1Dp6wbfQeQDgwyTu8pr00QO8PH1GqlNQ2hMOp2hY95FJBe3cEWJNAUTtBkwJG+0MkPSwltaTv5dtIeWYKitjG8jC7+VAT55BKCoeeGuVN5RzMDmR4LdQOXBI5PcbJ/p+uvxiu8H/Fppyff4LeAkRkLgdP8p9h6/lZmYCRsZmTkkNLbIQvLDbYU7+JZMt5End/v3Qg== 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=r3nVlUY3arakgnEbteJ31RLOHcKDB3NTycYAmSOOfek=; b=ahLI3QYrHsRPEvYTNnXCtCb9D97BM2wqD/2Z8tqXc/FVptDnlL1JbvhmAmQOvmWIvW0s7FUZW+JM6cWffiZu/44FSkBzwqKOwEr1wVqxPWecHXyHzxcoReeEIdGzZQf8n7poLccQiRb3iudFf5AFCQ22mlgQc21Wy/pd+qUO2Kyie86/2PKd7Oi7l6NIqcYU/0mGGkvyKno/9cvoSKI2jQQYbMeH2ZDzCjUw3u0oYY7tjIEQXeOdiUMvsYaUQt2RO1LU9aL7bl2D0brz6wYt0KjJSHtFn9Jr8/TIhdh3brcSoic9q6ouExy57Eucuj+TKOITMUo5eYa92jjno8RPVw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 193.8.40.94) smtp.rcpttodomain=kernel.org smtp.mailfrom=leica-geosystems.com.cn; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=leica-geosystems.com.cn; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leica-geosystems.com.cn; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=r3nVlUY3arakgnEbteJ31RLOHcKDB3NTycYAmSOOfek=; b=TgK0NbWdfeG8EpPgXQBrOA7dstKywyC7cfv/gOc1xqKEDoTbAHYWBOmA0VarW+ANKcmbi0yymNYgm9IcLIKKxFvRqubWpH9I4WGK48tYG34U/U7McurUNEs7HNkndEcoWoeqmoUbk4Jv7OtX8mDRcTJDHpYp9cs957sipYL5SYs= Received: from AM6P195CA0008.EURP195.PROD.OUTLOOK.COM (2603:10a6:209:81::21) by AM6PR06MB4962.eurprd06.prod.outlook.com (2603:10a6:20b:57::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.13; Wed, 18 May 2022 15:04:56 +0000 Received: from AM5EUR02FT028.eop-EUR02.prod.protection.outlook.com (2603:10a6:209:81:cafe::6b) by AM6P195CA0008.outlook.office365.com (2603:10a6:209:81::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.13 via Frontend Transport; Wed, 18 May 2022 15:04:56 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 193.8.40.94) smtp.mailfrom=leica-geosystems.com.cn; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=leica-geosystems.com.cn; Received-SPF: Pass (protection.outlook.com: domain of leica-geosystems.com.cn designates 193.8.40.94 as permitted sender) receiver=protection.outlook.com; client-ip=193.8.40.94; helo=aherlnxbspsrv01.lgs-net.com; Received: from aherlnxbspsrv01.lgs-net.com (193.8.40.94) by AM5EUR02FT028.mail.protection.outlook.com (10.152.8.115) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.13 via Frontend Transport; Wed, 18 May 2022 15:04:56 +0000 From: LI Qingwu To: jic23@kernel.org, lars@metafoo.de, mchehab+huawei@kernel.org, ardeleanalex@gmail.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Qing-wu.Li@leica-geosystems.com.cn, robh+dt@kernel.org, mike.looijmans@topic.nl, devicetree@vger.kernel.org, thomas.haemmerle@leica-geosystems.com Subject: [PATCH V3 4/6] iio: accel: bmi088: Add support for bmi085 accel Date: Wed, 18 May 2022 15:04:23 +0000 Message-Id: <20220518150425.927988-5-Qing-wu.Li@leica-geosystems.com.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220518150425.927988-1-Qing-wu.Li@leica-geosystems.com.cn> References: <20220518150425.927988-1-Qing-wu.Li@leica-geosystems.com.cn> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 20e06780-eab0-4a9f-33f4-08da38dfc566 X-MS-TrafficTypeDiagnostic: AM6PR06MB4962:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /joqSPPlr7tYB3bz3rWERkBRVy1x7P2qZrHTwpdCxKuSHjaMcytmD6gvWdGNiCPACDMN7EW1+1KB721TVRFBKeQ/1AEwz/33DtHZPLr4lbCM20jZ5g9M3KmUWognZyb6iqqAZlmnCZJir5MUc+Er2XcIeQt38rhob/LHh5YALD+Ti7XdpST7c2yCq0aC0ddJoY4Kk3JKwyrL9PJ4Itb42HwvofaA9kzqJ32NYbzWwO/LbgkkqKWKVK4DWkbkjdPHsKJtptJOm6D7SOdMkGKf/scPt4uOiFmaJ4iUEif4VOaGUgfI0V8oIlZEPcCWyV4XvDsEYztdtzg4CvjDJHK5X8GOzmOXcFrCl+8/QBbI24w5y0gq/mgmMXZP89vQp88ZDLsuCvk2cbzFP1TZ/q/sk4MHjS4Vw+F1CFZkRiNsUqdMHIEIsMgMqLh+QxTAZu3eUC7p7LYssY48YanFmF3QDN3ZBMg+MK9ou0JhFAx5VH6OqinKx55JtiThmDeeRfyI/OF/MUqjqrDTf490bN3a5EM6YIjwu4BTE2JKyvxlNxMK0dotoxx0MDipUonKxI6lGG6m4NngzY0JU/0zVPJ+jq1yxqIp9wpxS/lB0KYpXkjxCQjGNa3UgWXhohms/Mw/6BdIzp9iKKDZrCQm7gByrMhQuOKqLQ8WDZnsc/PJn1AfTxOFWGGlE7lG+htF/4TG X-Forefront-Antispam-Report: CIP:193.8.40.94;CTRY:CH;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:aherlnxbspsrv01.lgs-net.com;PTR:ahersrvdom50.leica-geosystems.com;CAT:NONE;SFS:(13230001)(4636009)(46966006)(40470700004)(36840700001)(36736006)(70586007)(70206006)(36756003)(8936002)(316002)(81166007)(40460700003)(356005)(36860700001)(82310400005)(508600001)(6666004)(336012)(8676002)(5660300002)(6486002)(6512007)(1076003)(6506007)(118246002)(186003)(26005)(2906002)(956004)(2616005)(86362001)(921005)(47076005);DIR:OUT;SFP:1102; X-OriginatorOrg: leica-geosystems.com.cn X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2022 15:04:56.4206 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 20e06780-eab0-4a9f-33f4-08da38dfc566 X-MS-Exchange-CrossTenant-Id: 1b16ab3e-b8f6-4fe3-9f3e-2db7fe549f6a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=1b16ab3e-b8f6-4fe3-9f3e-2db7fe549f6a;Ip=[193.8.40.94];Helo=[aherlnxbspsrv01.lgs-net.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR02FT028.eop-EUR02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR06MB4962 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Add supports for BMI085, an Inertial Measurement Unit, with an accelerometer and gyroscope. The commit adds the accelerometer driver for the SPI interface. The gyroscope part is already supported by the BMG160 driver. Different from BMI088, the BMI085 accelerometer has the range of +/-2, 4, 6, and 8g. Reviewed-by: Alexandru Ardelean Signed-off-by: LI Qingwu --- drivers/iio/accel/bmi088-accel-core.c | 7 +++++++ drivers/iio/accel/bmi088-accel-spi.c | 2 ++ drivers/iio/accel/bmi088-accel.h | 1 + 3 files changed, 10 insertions(+) diff --git a/drivers/iio/accel/bmi088-accel-core.c b/drivers/iio/accel/bmi088-accel-core.c index c30c2d510b92..d5e93ac7f1e1 100644 --- a/drivers/iio/accel/bmi088-accel-core.c +++ b/drivers/iio/accel/bmi088-accel-core.c @@ -464,6 +464,13 @@ static const struct iio_chan_spec bmi088_accel_channels[] = { }; static const struct bmi088_accel_chip_info bmi088_accel_chip_info_tbl[] = { + [BOSCH_BMI085] = { + .name = "bmi085-accel", + .chip_id = 0x1F, + .channels = bmi088_accel_channels, + .num_channels = ARRAY_SIZE(bmi088_accel_channels), + .scale_table = {{0, 598}, {0, 1196}, {0, 2393}, {0, 4785}}, + }, [BOSCH_BMI088] = { .name = "bmi088-accel", .chip_id = 0x1E, diff --git a/drivers/iio/accel/bmi088-accel-spi.c b/drivers/iio/accel/bmi088-accel-spi.c index 24cdeb41d2a6..f2cd70f362b8 100644 --- a/drivers/iio/accel/bmi088-accel-spi.c +++ b/drivers/iio/accel/bmi088-accel-spi.c @@ -62,12 +62,14 @@ static int bmi088_accel_remove(struct spi_device *spi) } static const struct of_device_id bmi088_of_match[] = { + { .compatible = "bosch,bmi085-accel" }, { .compatible = "bosch,bmi088-accel" }, {} }; MODULE_DEVICE_TABLE(of, bmi088_of_match); static const struct spi_device_id bmi088_accel_id[] = { + {"bmi085-accel", BOSCH_BMI085}, {"bmi088-accel", BOSCH_BMI088}, {} }; diff --git a/drivers/iio/accel/bmi088-accel.h b/drivers/iio/accel/bmi088-accel.h index b6a0281a847f..9b23f50c8271 100644 --- a/drivers/iio/accel/bmi088-accel.h +++ b/drivers/iio/accel/bmi088-accel.h @@ -9,6 +9,7 @@ struct device; enum bmi_device_type { + BOSCH_BMI085, BOSCH_BMI088, BOSCH_UNKNOWN, }; From patchwork Wed May 18 15:04:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: LI Qingwu X-Patchwork-Id: 12853788 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 D7238C433FE for ; Wed, 18 May 2022 15:05:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239124AbiERPFC (ORCPT ); Wed, 18 May 2022 11:05:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239063AbiERPFA (ORCPT ); Wed, 18 May 2022 11:05:00 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2103.outbound.protection.outlook.com [40.107.22.103]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33DD8149D83; Wed, 18 May 2022 08:04:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dSfomz6I1mT5f8bYcbsZhtfnyWGQl2hf2kccRYQsHwS2uXNCnYVVJvp+tfOk0Ebqsblz1spkHTGdYNkaeFL0cUsOhRMpLx/OQLWRj9lzJaGKqVzyvdmV4/nRXYzHVKVLbPsKr3dFLyN2VjMQxKQukNibuTzEKzQgGKwRoNuoCDqmJtd+fuqD22bSwJCpjMjHUTcGnibRhRguD3wc9kkUVeswLWie5Hl3PjnnbaNekAM/xQY/YjgKpi0YXnvwSCSZTbG9h/Y5mZ3e5s0I7fc2Vp2FNGg9YtNF3hmQsgWMZ/i4X/v/MPs3owVHFMGHfXRzD85wCKoqT8WfsWrHkmMXIg== 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=49NFpHwbqaffxqAbX6nZky9D9CNDXFD2dgbOOlE7D98=; b=GNMrILuQBD358n8ba93kufZf9sKlDmNlNK19kT+QYG4CHjlrx/7t+nnUOtSXERRUWxY9panxb/K+fgDOgoJxE3FfomyTPv2U8uimNaGCxIj2p/nilHH39d9CS9SaW/M2Hw/pUQAkhSicAq7jzQIVS+Y4yu8cGi7c8hKsgon/9mvkRXY4Anl5fKdfwvm2lGhGxhd/rwR92sqnGugsF9HSu2ZSBnavl8GIglQ+40mKMMA1opec9MTV1Y7mEiOuFPHzp/a2uvy551yldTr9kzb8WUkhvfSXbG4ODOZZMRYw9szgO0zQLixlrPEMaXhk5zz4U2epPYZzDe6cAR5nz4LzCA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 193.8.40.94) smtp.rcpttodomain=kernel.org smtp.mailfrom=leica-geosystems.com.cn; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=leica-geosystems.com.cn; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leica-geosystems.com.cn; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=49NFpHwbqaffxqAbX6nZky9D9CNDXFD2dgbOOlE7D98=; b=PRYwYUQnciQvPsSIhhCDr0jGffXnJM5j1DmlAe3Gf6cemq2klGAOZMP2JkJUmOEazLXKxFyooLXpvm1xGaPsPazVgaGQkuXm7YI6rIIyFS1MpNJba1NaqWcEy2QFPV1K+dT6EmblmjLXz2NLtF3yOk48mh6apfAt2rbuW2hIthI= Received: from AM6P195CA0015.EURP195.PROD.OUTLOOK.COM (2603:10a6:209:81::28) by AM6PR06MB5794.eurprd06.prod.outlook.com (2603:10a6:20b:33::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.18; Wed, 18 May 2022 15:04:57 +0000 Received: from AM5EUR02FT028.eop-EUR02.prod.protection.outlook.com (2603:10a6:209:81:cafe::ef) by AM6P195CA0015.outlook.office365.com (2603:10a6:209:81::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.14 via Frontend Transport; Wed, 18 May 2022 15:04:57 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 193.8.40.94) smtp.mailfrom=leica-geosystems.com.cn; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=leica-geosystems.com.cn; Received-SPF: Pass (protection.outlook.com: domain of leica-geosystems.com.cn designates 193.8.40.94 as permitted sender) receiver=protection.outlook.com; client-ip=193.8.40.94; helo=aherlnxbspsrv01.lgs-net.com; Received: from aherlnxbspsrv01.lgs-net.com (193.8.40.94) by AM5EUR02FT028.mail.protection.outlook.com (10.152.8.115) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.13 via Frontend Transport; Wed, 18 May 2022 15:04:56 +0000 From: LI Qingwu To: jic23@kernel.org, lars@metafoo.de, mchehab+huawei@kernel.org, ardeleanalex@gmail.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Qing-wu.Li@leica-geosystems.com.cn, robh+dt@kernel.org, mike.looijmans@topic.nl, devicetree@vger.kernel.org, thomas.haemmerle@leica-geosystems.com Subject: [PATCH V3 5/6] iio: accel: bmi088: Add support for bmi090l accel Date: Wed, 18 May 2022 15:04:24 +0000 Message-Id: <20220518150425.927988-6-Qing-wu.Li@leica-geosystems.com.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220518150425.927988-1-Qing-wu.Li@leica-geosystems.com.cn> References: <20220518150425.927988-1-Qing-wu.Li@leica-geosystems.com.cn> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8b241681-09e1-4d69-7df8-08da38dfc5b2 X-MS-TrafficTypeDiagnostic: AM6PR06MB5794:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5s2WAoEyNvkm4AETAN6sdFUP3WbLw/hcJOKJriNWK6wjH+va+kRrNk/41RVm6oqF/quq5usRnXTgFbAJx3fQNSA5O8pwdf7orDfhHR+9QO9fdVQLJ/ZgCcmtMljBtEz1WJscMR8cgYzfL6v7rW3eCm3KAnkc4kIoQzNQY3vevcaYV2Zb2BaBoWA2xv8SlyQ259zdvtXH5y8a4sSFoQmgod3+ZRtrePUFiU23mmFEV0CoBMhaNqnpBxCQLlvEmj+KuGeN2XJBN0WU1fS1POUvr1ZXdzMYhPrJ8m7j3hjGcGk/aPds/NfBdeTGgNmyjoMy1zaFoDkNCv0TDqA2xdZdBlU48ei4/d26zQ+Xy93o8gu9AnmoINk06sh4P3o14l1/kB2FMD/RmcJkr7rxmX95dkgAgzvV9HOV73hZ7sgoYTgyz5QZOV+hqCthKg/YHZgQR7+yEOhMDcGchevv9IP8kR5hfkhjBQj/lnOSuNA21NramCdNwM55NOg0JMX0IDizmHeyo6a9NByi94tkpvWF04HMQ4gQ/VMF5rVwZGi5bAhFRcBstqWOxRvRE4oVPc81a9nk1wN4m2+RdtU8/xyn4goDH45WbLNOngU6MzYgVBI+t2yBjvHi2FlC6G63y+LfEX5j3CJey6Xg0yOWGQ5kaq7dxIzjtBBdSIQNtjacUmORvEh+pdxoJ1qGou8cjFJ0T1fmQ/kO9Zbirc7KbJp5Kw== X-Forefront-Antispam-Report: CIP:193.8.40.94;CTRY:CH;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:aherlnxbspsrv01.lgs-net.com;PTR:ahersrvdom50.leica-geosystems.com;CAT:NONE;SFS:(13230001)(4636009)(40470700004)(46966006)(36840700001)(70206006)(36736006)(70586007)(6666004)(8676002)(6506007)(118246002)(86362001)(36756003)(36860700001)(6486002)(508600001)(316002)(81166007)(1076003)(2616005)(336012)(956004)(47076005)(82310400005)(356005)(186003)(921005)(8936002)(2906002)(40460700003)(26005)(6512007)(5660300002);DIR:OUT;SFP:1102; X-OriginatorOrg: leica-geosystems.com.cn X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2022 15:04:56.9362 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8b241681-09e1-4d69-7df8-08da38dfc5b2 X-MS-Exchange-CrossTenant-Id: 1b16ab3e-b8f6-4fe3-9f3e-2db7fe549f6a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=1b16ab3e-b8f6-4fe3-9f3e-2db7fe549f6a;Ip=[193.8.40.94];Helo=[aherlnxbspsrv01.lgs-net.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR02FT028.eop-EUR02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR06MB5794 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Add supports for BMI090L, it's a high-performance Inertial Measurement Unit, with an accelerometer and gyroscope. The commit adds the accelerometer driver for the SPI interface. The gyroscope part is already supported by the BMG160 driver. Same as BMI088, BMI090L have the range of +/-3, 6, 12, and 24g. Reviewed-by: Alexandru Ardelean Signed-off-by: LI Qingwu --- drivers/iio/accel/bmi088-accel-core.c | 7 +++++++ drivers/iio/accel/bmi088-accel-spi.c | 2 ++ drivers/iio/accel/bmi088-accel.h | 1 + 3 files changed, 10 insertions(+) diff --git a/drivers/iio/accel/bmi088-accel-core.c b/drivers/iio/accel/bmi088-accel-core.c index d5e93ac7f1e1..132781bfe872 100644 --- a/drivers/iio/accel/bmi088-accel-core.c +++ b/drivers/iio/accel/bmi088-accel-core.c @@ -478,6 +478,13 @@ static const struct bmi088_accel_chip_info bmi088_accel_chip_info_tbl[] = { .num_channels = ARRAY_SIZE(bmi088_accel_channels), .scale_table = {{0, 897}, {0, 1795}, {0, 3590}, {0, 7179}}, }, + [BOSCH_BMI090L] = { + .name = "bmi090l-accel", + .chip_id = 0x1A, + .channels = bmi088_accel_channels, + .num_channels = ARRAY_SIZE(bmi088_accel_channels), + .scale_table = {{0, 897}, {0, 1795}, {0, 3590}, {0, 7179}}, + }, }; static const struct iio_info bmi088_accel_info = { diff --git a/drivers/iio/accel/bmi088-accel-spi.c b/drivers/iio/accel/bmi088-accel-spi.c index f2cd70f362b8..a35de34399bd 100644 --- a/drivers/iio/accel/bmi088-accel-spi.c +++ b/drivers/iio/accel/bmi088-accel-spi.c @@ -64,6 +64,7 @@ static int bmi088_accel_remove(struct spi_device *spi) static const struct of_device_id bmi088_of_match[] = { { .compatible = "bosch,bmi085-accel" }, { .compatible = "bosch,bmi088-accel" }, + { .compatible = "bosch,bmi090l-accel" }, {} }; MODULE_DEVICE_TABLE(of, bmi088_of_match); @@ -71,6 +72,7 @@ MODULE_DEVICE_TABLE(of, bmi088_of_match); static const struct spi_device_id bmi088_accel_id[] = { {"bmi085-accel", BOSCH_BMI085}, {"bmi088-accel", BOSCH_BMI088}, + {"bmi090l-accel", BOSCH_BMI090L}, {} }; MODULE_DEVICE_TABLE(spi, bmi088_accel_id); diff --git a/drivers/iio/accel/bmi088-accel.h b/drivers/iio/accel/bmi088-accel.h index 9b23f50c8271..8ac9eec64d65 100644 --- a/drivers/iio/accel/bmi088-accel.h +++ b/drivers/iio/accel/bmi088-accel.h @@ -11,6 +11,7 @@ struct device; enum bmi_device_type { BOSCH_BMI085, BOSCH_BMI088, + BOSCH_BMI090L, BOSCH_UNKNOWN, }; From patchwork Wed May 18 15:04:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: LI Qingwu X-Patchwork-Id: 12853789 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 172CFC4321E for ; Wed, 18 May 2022 15:05:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239141AbiERPFD (ORCPT ); Wed, 18 May 2022 11:05:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239087AbiERPFB (ORCPT ); Wed, 18 May 2022 11:05:01 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2104.outbound.protection.outlook.com [40.107.20.104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD12617704A; Wed, 18 May 2022 08:04:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TqBbKOxrQVoX4T42X2YdFPDOLi95Ik98QM5k4xH2e1/XkhmKGpK35cheYOT2Ph8EyKSpqQLG/08nUAeUu16crSEWwtTp0ayeNtjdrCY3QmpladSrEY98EQblWEbbtL10JrJfCXrrY2D2GzLvoKIYnUifXKAqCLGr1WmOBmkpdSaRGI7QT3xHZTMb7KsKYlp667iAMfvaAMx92lYy9Sw0ZLK1NnUNZaJDB/2YaXOZUS9bzEvP5jyKtlu7S/gXPNJm7jgUrZi7qwyvZoaXUaoP5/EKUsCgxS/Q0dfxdK4fe0FYpSkh2/AZE0ak/z1Z+xkKt8WrLU91xZyOnDQAciAJQg== 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=MgOWtc0h84OfR0/XgjFODhvBKtLJ+qAcjYntEln1lJc=; b=aSs0rArYWlyoYLbdsQ3JEhQnwdya+6ijIRDZZ1tG3ITZa3UOAzKYvIivxRBnQ6R72WMaeynoepJQros8JDAmt7lHRCaRgYmXchqgsV7PcZYjKDFCo/4taCuNPARxDN9/ntRinGtzF4u4DLn7DzFxR1iUWr8q+TC8SGU62UmVTI2eBXtr+KZwi74PmHxjRyoCedDBbQK2ucyubZMwkKQCH6k/MdoYOI3U0dleUXeiYRTM3cXvIzHkieUl+Ek8l2eax8gqM3Uf1jXIOSYXrcj7e/7nxAgXVxNznyr+gTIj2zkPKZ79JF/MMrFv5qmKjmAiXn8brE1tAaYpbCRRQKwbVA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 193.8.40.94) smtp.rcpttodomain=kernel.org smtp.mailfrom=leica-geosystems.com.cn; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=leica-geosystems.com.cn; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leica-geosystems.com.cn; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MgOWtc0h84OfR0/XgjFODhvBKtLJ+qAcjYntEln1lJc=; b=Bme/Ah7+WLrJHJH/icaNBfUYG5Vd1y8CxzOdObcz6ZpPU2mff2Nxs5Mbf4V6cGVwa2AcCuoZGzAowYzyJlv74yFl8RJiVF+nP9RvAyyf1VTntOsjsNI/RzWIDvy6NfwN/4BCKUjuF8GUCoDCRn2lyul0sZn8zxv6au8H4sza6yo= Received: from AM6P195CA0015.EURP195.PROD.OUTLOOK.COM (2603:10a6:209:81::28) by AM8PR06MB7075.eurprd06.prod.outlook.com (2603:10a6:20b:1d2::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.13; Wed, 18 May 2022 15:04:57 +0000 Received: from AM5EUR02FT028.eop-EUR02.prod.protection.outlook.com (2603:10a6:209:81:cafe::ef) by AM6P195CA0015.outlook.office365.com (2603:10a6:209:81::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.14 via Frontend Transport; Wed, 18 May 2022 15:04:57 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 193.8.40.94) smtp.mailfrom=leica-geosystems.com.cn; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=leica-geosystems.com.cn; Received-SPF: Pass (protection.outlook.com: domain of leica-geosystems.com.cn designates 193.8.40.94 as permitted sender) receiver=protection.outlook.com; client-ip=193.8.40.94; helo=aherlnxbspsrv01.lgs-net.com; Received: from aherlnxbspsrv01.lgs-net.com (193.8.40.94) by AM5EUR02FT028.mail.protection.outlook.com (10.152.8.115) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.13 via Frontend Transport; Wed, 18 May 2022 15:04:57 +0000 From: LI Qingwu To: jic23@kernel.org, lars@metafoo.de, mchehab+huawei@kernel.org, ardeleanalex@gmail.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Qing-wu.Li@leica-geosystems.com.cn, robh+dt@kernel.org, mike.looijmans@topic.nl, devicetree@vger.kernel.org, thomas.haemmerle@leica-geosystems.com Subject: [PATCH V3 6/6] dt-bindings: iio: accel: Add bmi085 and bmi090l bindings Date: Wed, 18 May 2022 15:04:25 +0000 Message-Id: <20220518150425.927988-7-Qing-wu.Li@leica-geosystems.com.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220518150425.927988-1-Qing-wu.Li@leica-geosystems.com.cn> References: <20220518150425.927988-1-Qing-wu.Li@leica-geosystems.com.cn> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 242f40e7-ae68-463b-a0db-08da38dfc5f7 X-MS-TrafficTypeDiagnostic: AM8PR06MB7075:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5E6GGuschg/U8KnwFQEHHKHp7KzNr5dwhx2Uz6HvTfP7P04Zep0w1LObea7kqzVlzyPSeOFuL7aTD0V5mD4zfeAWsngzGkcB3+x4YckZ9SzoU/dIqyMeYnoApDdR5ro5yqfo2s8iUSZznNCUdZ4U/Ws2HIUIcVFF7oZhOJ9Z5oWVWcz5Cv1iRihKtVbpg/Uvh8NfXfNrdPBgjSR+W8QaU43zniMDfnZQ3Weu+zCryfOxhVR2gojCUY7lU86eTPoszQQDD/F0SATVWTK1ER4uRC+qis2ZdmTWuBg/LuTP4DZ3QfP9np9UUtgtHHlDiymjRHp3n+I/Z/lwM+iStxgG6cRfWLf+yynXxXkBIHoeswruCwn+3nDhSssFVBjRP3ByIGrJ93L3ZyFLLj5yBy41pHXxHRqY8b/4D1ybGj6ZG3m/0KhqS2G9pKNQW3ZOsMlrWspPYqlpAE7nUPV2eae462HazlyVEtWorLay67HV4yaDPguMMzIMlHztyMUKH+sdGe8BV4Ljd/qGarsSDyzcnRtARd7xQonEad360QE2H1UPVqhUeXRbkE76ZudR/VNY2onpIk74RJ5Tg4hVdby+d5vQbeokKAGnhvfcpS4isBDe2kMUONzP4RbfuDnBTUFdUVHva529+1x5WfY+otAuyqD1BoYU3WcmG8i0QPCVKPpMw6eRWOE3cgOkKvCsgzKD5sTgwjaoRXj4ZqmpnTtOI1FZMSnzWRbAnagTMHs4rsY9U63wv4497BiEHAaLagRNfIScP0mYsgHWiBqKJ++mz7IsDwg2NXxmpU/Ys1+uXJM= X-Forefront-Antispam-Report: CIP:193.8.40.94;CTRY:CH;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:aherlnxbspsrv01.lgs-net.com;PTR:ahersrvdom50.leica-geosystems.com;CAT:NONE;SFS:(13230001)(4636009)(40470700004)(36840700001)(46966006)(8936002)(6486002)(966005)(83380400001)(36756003)(6512007)(26005)(36860700001)(82310400005)(2616005)(508600001)(47076005)(186003)(316002)(6666004)(36736006)(5660300002)(336012)(956004)(118246002)(40460700003)(70586007)(70206006)(6506007)(81166007)(1076003)(8676002)(2906002)(86362001)(356005)(921005)(4744005);DIR:OUT;SFP:1102; X-OriginatorOrg: leica-geosystems.com.cn X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2022 15:04:57.3893 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 242f40e7-ae68-463b-a0db-08da38dfc5f7 X-MS-Exchange-CrossTenant-Id: 1b16ab3e-b8f6-4fe3-9f3e-2db7fe549f6a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=1b16ab3e-b8f6-4fe3-9f3e-2db7fe549f6a;Ip=[193.8.40.94];Helo=[aherlnxbspsrv01.lgs-net.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR02FT028.eop-EUR02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR06MB7075 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Adds the device-tree bindings for the Bosch BMI085 and BMI090L IMU, the accelerometer part. Datasheet: https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bmi085-ds001.pdf Datasheet: https://media.digikey.com/pdf/Data%20Sheets/Bosch/BST-BMI090L-DS000-00.pdf Signed-off-by: LI Qingwu --- Documentation/devicetree/bindings/iio/accel/bosch,bmi088.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/iio/accel/bosch,bmi088.yaml b/Documentation/devicetree/bindings/iio/accel/bosch,bmi088.yaml index 911a1ae9c83f..272eb48eef5a 100644 --- a/Documentation/devicetree/bindings/iio/accel/bosch,bmi088.yaml +++ b/Documentation/devicetree/bindings/iio/accel/bosch,bmi088.yaml @@ -17,7 +17,9 @@ description: | properties: compatible: enum: + - bosch,bmi085-accel - bosch,bmi088-accel + - bosch,bmi090l-accel reg: maxItems: 1