From patchwork Thu May 14 20:48:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Bakker X-Patchwork-Id: 11549759 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D319590 for ; Thu, 14 May 2020 20:50:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BEF8620727 for ; Thu, 14 May 2020 20:50:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727981AbgENUtl (ORCPT ); Thu, 14 May 2020 16:49:41 -0400 Received: from mail-dm6nam11olkn2036.outbound.protection.outlook.com ([40.92.19.36]:51009 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725975AbgENUtk (ORCPT ); Thu, 14 May 2020 16:49:40 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PNrVWVYDnfkAfUiGkW4kT7MAH58GowoVUpRcQ8rSti3fgnPaBmPXlnvjvJPXDbtB26y1iKqy8CoUu0vvug0yWO1FaHA1c8TgNQV7h9Q0Uj5rMkt3Qxx3bN2nDVJqMs8d4UoPj7K+cCwtl7hg4+2ySbrcKp4ZiQQOaTMlK12wzcpOS9X4IUV/oLqXDPUUcHKtzareOFB9G7EYsQU+q09j2LLvL1PH/qxYkYeZkw1XrPAmJv7nuCN54jlic8wrnj1dYVfxbJoMD6Gpx4lwBeENTsm/eD/4mjJN1TSgQuDEoG41ul6SYTBb6TTMMv2pNJyz/JrJaJVs7fe1GWgraiOLMA== 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-SenderADCheck; bh=CLXfwEjJh8MGAMcbEiQap2tlbnExuEi6e1wy4y7mRUE=; b=g8VPVckCs54nv5EVJ3pt1WvKuZdMa8snna1JShUCJh2A7lbmDS6GPIEI2+VxWbuCnmad2BAvcBlr8gDSuNex48r+xtxITWCYumB2N8SQnEuDyKauWDWKq/f1Nd2QvYS6vhT4V63L5kjI/YN0kb9RWybEA8gwViDSdr2dsKQnCl3GyR7aZ/7vUm5GwJ1ajeE1/Fa6KzivG1j0vIeNaFtAdcfl7DXpRgK6KUAnFGp40ix0PZw33PTGQLG8V3tTV4br9cPutwT1pLfveJf8GAByBUXurusnrkk+HTxKesDb4ilw9VIBp49rFeLJHnI3JntyP8YYiD8oqrSmrLtxcrQ9XA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=live.ca; dmarc=pass action=none header.from=live.ca; dkim=pass header.d=live.ca; arc=none Received: from DM6NAM11FT024.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4d::4e) by DM6NAM11HT250.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4d::227) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.19; Thu, 14 May 2020 20:49:38 +0000 Received: from BN6PR04MB0660.namprd04.prod.outlook.com (2a01:111:e400:fc4d::47) by DM6NAM11FT024.mail.protection.outlook.com (2a01:111:e400:fc4d::159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.19 via Frontend Transport; Thu, 14 May 2020 20:49:38 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:B91955B90F133AC969426355792BB32C1643662F4EC65DF2C9027C2F4EAFB0A6;UpperCasedChecksum:A02372C0B7D5EDF370E687DBAF6F5101144928A35B396FE563535BBE444C0406;SizeAsReceived:7917;Count:50 Received: from BN6PR04MB0660.namprd04.prod.outlook.com ([fe80::ad10:4127:4bc8:76fc]) by BN6PR04MB0660.namprd04.prod.outlook.com ([fe80::ad10:4127:4bc8:76fc%6]) with mapi id 15.20.3000.022; Thu, 14 May 2020 20:49:38 +0000 From: Jonathan Bakker To: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, robh+dt@kernel.org, linus.walleij@linaro.org, kstewart@linuxfoundation.org, tglx@linutronix.de, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Bakker Subject: [PATCH v2 1/7] iio: accel: bma180: Prepare for different reset values Date: Thu, 14 May 2020 13:48:55 -0700 Message-ID: X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200514204901.3199-1-xc-racer2@live.ca> References: <20200514204901.3199-1-xc-racer2@live.ca> X-ClientProxiedBy: MWHPR1701CA0009.namprd17.prod.outlook.com (2603:10b6:301:14::19) To BN6PR04MB0660.namprd04.prod.outlook.com (2603:10b6:404:d9::21) X-Microsoft-Original-Message-ID: <20200514204901.3199-2-xc-racer2@live.ca> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from jon-hp-6570b.telus (2001:569:fb68:9c00:8067:f823:1e15:7520) by MWHPR1701CA0009.namprd17.prod.outlook.com (2603:10b6:301:14::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.25 via Frontend Transport; Thu, 14 May 2020 20:49:36 +0000 X-Mailer: git-send-email 2.20.1 X-Microsoft-Original-Message-ID: <20200514204901.3199-2-xc-racer2@live.ca> X-TMN: [j0hnrinodcWUyjMVXxy3JkaqSHZlxk0uzD0HcfS0OVhF/q6fn4I5CV8E3onM4U4X] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 14db704b-2699-406e-514e-08d7f8485126 X-MS-TrafficTypeDiagnostic: DM6NAM11HT250: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6swGnZvLmwTWxEf1TA+vuEVGejRgx++PH/qlyFJDQ/5pye9Px08dJiFVYUoPSGn/iv8J0QzMyeB9xR//g4EN3mfnizzQuNxYd3AV0++/RGaqMM5pTzk+yfwtunH4TGUvSTzdxOrDCAaRYdBfYJBsRKZbxMDOkDcI7eNH2fx0CjsCnfWRDqro2tV9Vw0C2zisV8vsuEJl2CU70eK6Co44RA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:0;SRV:;IPV:NLI;SFV:NSPM;H:BN6PR04MB0660.namprd04.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:;DIR:OUT;SFP:1901; X-MS-Exchange-AntiSpam-MessageData: xi+MrQoDzcs2Apb5hJQj/3rShqghMK/UWK1M4dqFNnzYZt90Bs4PyGQdaF1qHFb6t/qz2TnGq0QmpFjIWduvrPLqMhl1Md4Y+kJzBTZ6L6rWoFqvDGncBF+R91F9fJ1DSK7+IC9hWTkw35biygR34Gk/IHhYqTcwm+Chvah4IiBSAMV1uiCMdji9wagERFH3MR39ZOrcuAa/joTcMabxSw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 14db704b-2699-406e-514e-08d7f8485126 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 May 2020 20:49:38.3002 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6NAM11HT250 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Some variants of the bma180 (eg bma023) have different reset values. In preparation for adding support for them, factor out the reset value into the chip specific data. Reviewed-by: Linus Walleij Signed-off-by: Jonathan Bakker --- Changes from v1 - Added R-b tag --- drivers/iio/accel/bma180.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c index fcd91d5f05fd..75440dd83ec4 100644 --- a/drivers/iio/accel/bma180.c +++ b/drivers/iio/accel/bma180.c @@ -57,7 +57,7 @@ struct bma180_part_info { u8 power_reg, power_mask, lowpower_val; u8 int_enable_reg, int_enable_mask; u8 int_map_reg, int_enable_dataready_int1_mask; - u8 softreset_reg; + u8 softreset_reg, softreset_val; int (*chip_config)(struct bma180_data *data); void (*chip_disable)(struct bma180_data *data); @@ -319,7 +319,8 @@ static int bma180_set_pmode(struct bma180_data *data, bool mode) static int bma180_soft_reset(struct bma180_data *data) { int ret = i2c_smbus_write_byte_data(data->client, - data->part_info->softreset_reg, BMA180_RESET_VAL); + data->part_info->softreset_reg, + data->part_info->softreset_val); if (ret) dev_err(&data->client->dev, "failed to reset the chip\n"); @@ -693,6 +694,7 @@ static const struct bma180_part_info bma180_part_info[] = { .int_enable_reg = BMA180_CTRL_REG3, .int_enable_mask = BMA180_NEW_DATA_INT, .softreset_reg = BMA180_RESET, + .softreset_val = BMA180_RESET_VAL, .chip_config = bma180_chip_config, .chip_disable = bma180_chip_disable, }, @@ -721,6 +723,7 @@ static const struct bma180_part_info bma180_part_info[] = { .int_map_reg = BMA250_INT_MAP_REG, .int_enable_dataready_int1_mask = BMA250_INT1_DATA_MASK, .softreset_reg = BMA250_RESET_REG, + .softreset_val = BMA180_RESET_VAL, .chip_config = bma25x_chip_config, .chip_disable = bma25x_chip_disable, }, @@ -749,6 +752,7 @@ static const struct bma180_part_info bma180_part_info[] = { .int_map_reg = BMA254_INT_MAP_REG, .int_enable_dataready_int1_mask = BMA254_INT1_DATA_MASK, .softreset_reg = BMA254_RESET_REG, + .softreset_val = BMA180_RESET_VAL, .chip_config = bma25x_chip_config, .chip_disable = bma25x_chip_disable, }, From patchwork Thu May 14 20:48:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Bakker X-Patchwork-Id: 11549757 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E694C912 for ; Thu, 14 May 2020 20:50:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D828C20727 for ; Thu, 14 May 2020 20:50:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728039AbgENUtn (ORCPT ); Thu, 14 May 2020 16:49:43 -0400 Received: from mail-bn8nam11olkn2086.outbound.protection.outlook.com ([40.92.20.86]:51936 "EHLO NAM11-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728003AbgENUtm (ORCPT ); Thu, 14 May 2020 16:49:42 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ThLnv5lSmws+vUYa+ZgxIfkojhG9IJpWEO9C8dozW8EWVZBgK+Na+xXP+ZTTxukV6AnX6XtbEqIuiUGsq5Hq8rO1K8DL0OKoW2c8/veUGtj3zHBR0OxgqYZYp7n5gusk2Q3tE0KlqGLap/rc/N+G3YTMy2JKq8DCzM1hVqhYKfF3J9GJBJNU1RcFYU9hQ1VJuBw8P6Zh6UaUaD9GBZ0B/HpZC3ZrbVpuNWUxaGMYGea7rGUcIZC3L4AGAO4UjvAF8EEp11pxcqNO6onvMj37eszxWAZcoeuzAI3H08d4UVfSkUjmMIBx/0jGU03Aa+oNzlIT/a5D/mKM1Ynt7ZQ42w== 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-SenderADCheck; bh=+RsMuAs/ZPNrfZ7RCX424suZ/MYZz2ohqipYKr1Jd2g=; b=KHeUh87mDCBcZU8YZKCOjmCdsRP8IzGIjv/aqE/RLge6cdTCMTvCNopriXCn0BwEVcAnzH9X6LT51dyVc4AN1+HbfjOO1YlycEpTgmezj0kmHTo7UM36coYZcsJyr3asFsFWsgyr2kCtF0tB3npsrqM2Dtdc6gHng0Ihf5Hw+TI78ZhAcrg7EkPKPUZS/zLzmGVoqC13h8CvmUJHlsXIf6kL2/m8GA6dsPJwZBLZxuTSqSmS+snrgO08MS3dMCefYPC8SRG1Bv6yRw+lGxf7kzp1lppd8PwqVfpJwoL4RYx3/bxLFGgFudIYpZQ5SQ5MLGkfr9VhWCMb+gk2XBJlZg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=live.ca; dmarc=pass action=none header.from=live.ca; dkim=pass header.d=live.ca; arc=none Received: from DM6NAM11FT024.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4d::40) by DM6NAM11HT166.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4d::314) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.19; Thu, 14 May 2020 20:49:40 +0000 Received: from BN6PR04MB0660.namprd04.prod.outlook.com (2a01:111:e400:fc4d::47) by DM6NAM11FT024.mail.protection.outlook.com (2a01:111:e400:fc4d::159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.19 via Frontend Transport; Thu, 14 May 2020 20:49:40 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:A36B77B61527388797D60F30556D9B683C6C6CE0F8DA9ED8F111124A23243BBF;UpperCasedChecksum:6CEC7650E5006B7F0739E7E06465655965F27F1CB2BF508A2473C4D47F190E7F;SizeAsReceived:7916;Count:50 Received: from BN6PR04MB0660.namprd04.prod.outlook.com ([fe80::ad10:4127:4bc8:76fc]) by BN6PR04MB0660.namprd04.prod.outlook.com ([fe80::ad10:4127:4bc8:76fc%6]) with mapi id 15.20.3000.022; Thu, 14 May 2020 20:49:40 +0000 From: Jonathan Bakker To: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, robh+dt@kernel.org, linus.walleij@linaro.org, kstewart@linuxfoundation.org, tglx@linutronix.de, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Bakker Subject: [PATCH v2 2/7] iio: accel: Make bma180 conflict with input's bma150 Date: Thu, 14 May 2020 13:48:56 -0700 Message-ID: X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200514204901.3199-1-xc-racer2@live.ca> References: <20200514204901.3199-1-xc-racer2@live.ca> X-ClientProxiedBy: MWHPR1701CA0009.namprd17.prod.outlook.com (2603:10b6:301:14::19) To BN6PR04MB0660.namprd04.prod.outlook.com (2603:10b6:404:d9::21) X-Microsoft-Original-Message-ID: <20200514204901.3199-3-xc-racer2@live.ca> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from jon-hp-6570b.telus (2001:569:fb68:9c00:8067:f823:1e15:7520) by MWHPR1701CA0009.namprd17.prod.outlook.com (2603:10b6:301:14::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.25 via Frontend Transport; Thu, 14 May 2020 20:49:38 +0000 X-Mailer: git-send-email 2.20.1 X-Microsoft-Original-Message-ID: <20200514204901.3199-3-xc-racer2@live.ca> X-TMN: [vTw3+WUsAml8BNH0USNY/YseRjzFYgwgAwack7XAIxrMaTHZHBYDBffO798iLn9T] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: acc3de34-4ef8-4b6f-e790-08d7f848524d X-MS-TrafficTypeDiagnostic: DM6NAM11HT166: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JYkKbpjntwU9JeBNGhy/V5z+KYoOGfiAscLtGJWLHMMNJVxRgLIizH6f6FmF7ThunoFcK6mRlBTJa9IoHqEz2356v7lWcTXxtyovb+5jwrPGOVbWtzJsEqJo7as3hNdqiHNyLQSGcIvNJNRVV/i0MUApp1idZ/KlNQBf+o+Qm+8s9ajpLiO6mVW3MEur0vbUJx/LRpgpxe4qlNZWBVQ6Mg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:0;SRV:;IPV:NLI;SFV:NSPM;H:BN6PR04MB0660.namprd04.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:;DIR:OUT;SFP:1901; X-MS-Exchange-AntiSpam-MessageData: uHCmMiNcTR3/h9dWdQb1+MddOQKOpCOxIaYcuqBR3BHJpjhT+AVUVvQyUSJrABa2eOu08b/OziiT/RgTpFSY+a8i7uPkIbqoFhshFsRgBm++7mNBlWeumagK5nqPe9weIYabVgE+07IvvSk4SIxlf+r71EBW4wg1EEY2I1fKQJ89SegSnUsp6yBt1LpWzBtV5jvPQkDK8ylZacQYNJLkBA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: acc3de34-4ef8-4b6f-e790-08d7f848524d X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 May 2020 20:49:40.2673 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6NAM11HT166 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org The bma180 IIO driver is being extended for support for the chips support by input's bma150 driver (bma023, bma150, smb380). Don't allow both drivers to be enabled simultaneously as they're for the same hardware. Signed-off-by: Jonathan Bakker Reviewed-by: Linus Walleij --- drivers/iio/accel/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig index 5d91a6dda894..09e8c51f854a 100644 --- a/drivers/iio/accel/Kconfig +++ b/drivers/iio/accel/Kconfig @@ -90,7 +90,7 @@ config ADXL372_I2C config BMA180 tristate "Bosch BMA180/BMA25x 3-Axis Accelerometer Driver" - depends on I2C + depends on I2C && INPUT_BMA150=n select IIO_BUFFER select IIO_TRIGGERED_BUFFER help From patchwork Thu May 14 20:48:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Bakker X-Patchwork-Id: 11549755 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 52EFD912 for ; Thu, 14 May 2020 20:50:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4408320727 for ; Thu, 14 May 2020 20:50:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728140AbgENUtp (ORCPT ); Thu, 14 May 2020 16:49:45 -0400 Received: from mail-co1nam11olkn2099.outbound.protection.outlook.com ([40.92.18.99]:17094 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728043AbgENUto (ORCPT ); Thu, 14 May 2020 16:49:44 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bb6hRy9ddj3dXjHy1nMXDh5DPQgEoBXxWTJRM2l6v8FBqMdsnFphp0VGuk/VQzLUqcgU2bYlXTv58vc4UJ58CYrGbUdlVFv6RWYMdiWl/ZypTmCUVDGevf9J9uZQOLhf46PQh1rIQuIGRWnXxOinL30Ya1MI0u5yAxERDgyG+CqtXGg9qDwJbdlW41WZckJu2GJ2jLcPa51UNnjnPPhyRFDbkZMp6CXUQ5WiF4KpKYMf56dUnPyVw2wTvcGXu/oQ9Z4+6QvaZmcNKqja7ivP4NUahWF2HTZ4+GZMibz7NoDq7fu7XVwM44OTnTnzqP0M/f+A6nBOjONcFZc9pRZiqA== 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-SenderADCheck; bh=QfEHPjQV3/S3/BubNXOrz/qI5VTIYVI0tRKCgSR1bcc=; b=H1huJZXdy02AloXBGBKoZjv5LEpp00CO3ZYAyB69u8uxFKSurY6vJu1fzEE+0axSSI+gD6NIaUbgRgOtGmsNQN4E7bxrT+y0GE6HeoU4mvaKDQ1lPnLV2h8VlVERFSpK3E6xFi98cr/WteN134XXxmktdpdQbYWTBC6F1vA1pIyoXNUFhnpt8Ba9lKR4UiDO4I5sQ6UDfHkOFIWChajXJdiSP4/prTTjThPz4/Ap5XhmAILwBsbOW8pagYfDo2xtZ+NKHbKXNKT7nw7QVm9ycan1ehlZSE6bGzu6K7BogaPVrTTWkLU5zCZ/A64ulXSVYxwBWWxk/pyr+wv1sDBQ7A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=live.ca; dmarc=pass action=none header.from=live.ca; dkim=pass header.d=live.ca; arc=none Received: from DM6NAM11FT024.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4d::40) by DM6NAM11HT064.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4d::306) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.19; Thu, 14 May 2020 20:49:42 +0000 Received: from BN6PR04MB0660.namprd04.prod.outlook.com (2a01:111:e400:fc4d::47) by DM6NAM11FT024.mail.protection.outlook.com (2a01:111:e400:fc4d::159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.19 via Frontend Transport; Thu, 14 May 2020 20:49:42 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:3509A4331E9A7B6A52478916A01C093A3E959AA3239CC90AB3B8829C18BF1D07;UpperCasedChecksum:5E1D8BCCAD08570790C7D84D82554A1051091F87155F47D7D6DFF4691B046C3C;SizeAsReceived:7927;Count:50 Received: from BN6PR04MB0660.namprd04.prod.outlook.com ([fe80::ad10:4127:4bc8:76fc]) by BN6PR04MB0660.namprd04.prod.outlook.com ([fe80::ad10:4127:4bc8:76fc%6]) with mapi id 15.20.3000.022; Thu, 14 May 2020 20:49:42 +0000 From: Jonathan Bakker To: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, robh+dt@kernel.org, linus.walleij@linaro.org, kstewart@linuxfoundation.org, tglx@linutronix.de, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Bakker Subject: [PATCH v2 3/7] dt-bindings: iio: accel: Add bma150 family compatibles to bma180 Date: Thu, 14 May 2020 13:48:57 -0700 Message-ID: X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200514204901.3199-1-xc-racer2@live.ca> References: <20200514204901.3199-1-xc-racer2@live.ca> X-ClientProxiedBy: MWHPR1701CA0009.namprd17.prod.outlook.com (2603:10b6:301:14::19) To BN6PR04MB0660.namprd04.prod.outlook.com (2603:10b6:404:d9::21) X-Microsoft-Original-Message-ID: <20200514204901.3199-4-xc-racer2@live.ca> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from jon-hp-6570b.telus (2001:569:fb68:9c00:8067:f823:1e15:7520) by MWHPR1701CA0009.namprd17.prod.outlook.com (2603:10b6:301:14::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.25 via Frontend Transport; Thu, 14 May 2020 20:49:40 +0000 X-Mailer: git-send-email 2.20.1 X-Microsoft-Original-Message-ID: <20200514204901.3199-4-xc-racer2@live.ca> X-TMN: [tqFHEkPrfGGfie177htcY6hU0921D5YNadUo8b5BV1p0iZ4d0uU06bydvhql4FdF] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 42d6530f-24d7-4b52-3cf6-08d7f848536f X-MS-TrafficTypeDiagnostic: DM6NAM11HT064: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: V53LVQGT4L41L144iN1tEOjkzz6y88M9ogwMkToAkAB6hGywAaOzLRsffLjmTUoqXUuVbvx0mzaFY01mZxILT2xmexgP/SRm6hkO6SlMlqaSrZ8i6ailxLznX7AMglyW6C/z+VTC7CxTAkqDCQhf5r2uLYwAgjkLbt2/JaO5asFdO5tL9efqZVsp3YO1FCuOz4qTq39lKIKCZxkQcTBw9aFxmf13MBr47dUwExn9PC1RdsSdr4RryES1oyDMreG2 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:0;SRV:;IPV:NLI;SFV:NSPM;H:BN6PR04MB0660.namprd04.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:;DIR:OUT;SFP:1901; X-MS-Exchange-AntiSpam-MessageData: DpzgYHpY+ndRQLeHat6m563tlQvu4X/9i6huGzukl6W2HUG0RFu7XRATdTX9NOCvPHqFJdr4LRyclyMu0O3r0OUCPe6y1jYxFO8vK81YFMUAcAvDSpMmJo7Tc+wumIj8wOxyr0Afij0ZjyYCE+2wzD8LBiEeiNtnwQ9+gDra15KiVmmANaquF1DjNYqA5V/YWu6DCR+nDkDuQVHp3m0VTg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 42d6530f-24d7-4b52-3cf6-08d7f848536f X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 May 2020 20:49:42.1585 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6NAM11HT064 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org The bma023, bma150, and smb380 are in the same family as the bma180 and support is being added to the bma180 IIO driver for them. Reviewed-by: Linus Walleij Signed-off-by: Jonathan Bakker --- Changes from v1 - Added bma150 and smb380 compatibles - Added R-b tag --- Documentation/devicetree/bindings/iio/accel/bma180.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/iio/accel/bma180.txt b/Documentation/devicetree/bindings/iio/accel/bma180.txt index f53237270b32..cfbfc6276b3c 100644 --- a/Documentation/devicetree/bindings/iio/accel/bma180.txt +++ b/Documentation/devicetree/bindings/iio/accel/bma180.txt @@ -1,14 +1,18 @@ -* Bosch BMA180 / BMA25x triaxial acceleration sensor +* Bosch BMA023 / BMA150/ BMA180 / BMA25x / SMB380 triaxial acceleration sensor +https://media.digikey.com/pdf/Data%20Sheets/Bosch/BMA150.pdf http://omapworld.com/BMA180_111_1002839.pdf http://ae-bst.resource.bosch.com/media/products/dokumente/bma250/bst-bma250-ds002-05.pdf Required properties: - compatible : should be one of: + "bosch,bma023" + "bosch,bma150" "bosch,bma180" "bosch,bma250" "bosch,bma254" + "bosch,smb380" - reg : the I2C address of the sensor Optional properties: From patchwork Thu May 14 20:48:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Bakker X-Patchwork-Id: 11549753 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1711E90 for ; Thu, 14 May 2020 20:50:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0761320727 for ; Thu, 14 May 2020 20:50:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728191AbgENUts (ORCPT ); Thu, 14 May 2020 16:49:48 -0400 Received: from mail-dm6nam11olkn2093.outbound.protection.outlook.com ([40.92.19.93]:48058 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728003AbgENUtq (ORCPT ); Thu, 14 May 2020 16:49:46 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZcOmOW8zA1feULF53AcRbXjIJstUUBtiEh7tnPtjGoPJ04qITaEqpx9wzESDr2P/XzwAOEEShWVgGtkeyT7b9UpSkVridkCFqK6AqUmomkbl8ZTJY8OsUvnsJTeAKhoHJd0jYMPjQzb6iqPFrO9GjjsLeYGBP0Qloe+HOQPZdHGHo4ImNlKAsXJUS7VSZfA57ZwQA5dNI0RXftCqWSfR7uikqLjZGIkNABk2JUgfdDv9zjlIuEAHHBTISgaKRLEQdNl7E5iJeCQoxQZhtv4svaicNdraeq2x5+SzGI9rWbMvL8NoyTF0ecK1n7AhatJiAXF1ePW7L+FMvbLNa4enhw== 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-SenderADCheck; bh=zsEikIOzJN2KycAeXhRu+tBV0xRUZUbNCQ0DCyMIZUE=; b=NRY5PEtFP+lTSMowznJSSPYJ1EKE2T+Qn7OUW7zzugiclYaa7NlT2v67D++ImOFvRk+qeojTHA/BCvkrLRlugx9vqxbtQcelnjm9eWGvR5ZjnMpnfk+TjUSRnxzIOTehQz3e8dKFvyvdwb4UHdDHBRH7XuZxfnv0lha0rfh2fqyhZUvIM7NPobpL1fAKfusje6r/ljq7VAdGlWUzRyiNOt0A6l5pDFew12mcrAX0U2fE97tdsKMj5WirHXNfRAofMchA8udPsOeymKx3SLs628TND84CBvF8sClD7RXPk4dhJbObC4Vz2QhqQDFCzDqpFdcBbUycAjmxXABKokJBnA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=live.ca; dmarc=pass action=none header.from=live.ca; dkim=pass header.d=live.ca; arc=none Received: from DM6NAM11FT024.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4d::47) by DM6NAM11HT016.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4d::318) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.27; Thu, 14 May 2020 20:49:44 +0000 Received: from BN6PR04MB0660.namprd04.prod.outlook.com (2a01:111:e400:fc4d::47) by DM6NAM11FT024.mail.protection.outlook.com (2a01:111:e400:fc4d::159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.19 via Frontend Transport; Thu, 14 May 2020 20:49:44 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:28633F0303056D566FB772015C9B2A5FF4795E81433F76C27336099CFF12E5BC;UpperCasedChecksum:C5D5CE817A689E16DD0152159F1B48BDDDEE8DD7AFCA5B77A3EBA36078800A4B;SizeAsReceived:7960;Count:50 Received: from BN6PR04MB0660.namprd04.prod.outlook.com ([fe80::ad10:4127:4bc8:76fc]) by BN6PR04MB0660.namprd04.prod.outlook.com ([fe80::ad10:4127:4bc8:76fc%6]) with mapi id 15.20.3000.022; Thu, 14 May 2020 20:49:44 +0000 From: Jonathan Bakker To: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, robh+dt@kernel.org, linus.walleij@linaro.org, kstewart@linuxfoundation.org, tglx@linutronix.de, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Bakker , Rob Herring Subject: [PATCH v2 4/7] dt-bindings: iio: accel: Add required regulators to bma180 Date: Thu, 14 May 2020 13:48:58 -0700 Message-ID: X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200514204901.3199-1-xc-racer2@live.ca> References: <20200514204901.3199-1-xc-racer2@live.ca> X-ClientProxiedBy: MWHPR1701CA0009.namprd17.prod.outlook.com (2603:10b6:301:14::19) To BN6PR04MB0660.namprd04.prod.outlook.com (2603:10b6:404:d9::21) X-Microsoft-Original-Message-ID: <20200514204901.3199-5-xc-racer2@live.ca> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from jon-hp-6570b.telus (2001:569:fb68:9c00:8067:f823:1e15:7520) by MWHPR1701CA0009.namprd17.prod.outlook.com (2603:10b6:301:14::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.25 via Frontend Transport; Thu, 14 May 2020 20:49:42 +0000 X-Mailer: git-send-email 2.20.1 X-Microsoft-Original-Message-ID: <20200514204901.3199-5-xc-racer2@live.ca> X-TMN: [8c870iym5EcBr0ghbNkOHaFOsTMF5sMgb0kJzzciGAYyp04V6XYvMvpSH/FY6LKv] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: c2131170-5491-4b13-43f2-08d7f8485499 X-MS-TrafficTypeDiagnostic: DM6NAM11HT016: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: df7HjPx3RdsRwkxbSyDsGmGX8IeVYj7MpZLbmrjjGE817mQSXO18QxMGw4OraQgJcGakH2XEVDzgi3EcWmBtLP7He/n15mSN2HMy9uclT4UxcUqoSTo4RB5vY5P+Hgd+AdMSYKY88QObxHbtHVIRz05StyVHJ4x0AuTvrzp0N0QJhZrtNsB5LGl4in2kW7U8Hnj0EMDkHwXT+wN7YNoNjQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:0;SRV:;IPV:NLI;SFV:NSPM;H:BN6PR04MB0660.namprd04.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:;DIR:OUT;SFP:1901; X-MS-Exchange-AntiSpam-MessageData: sbGAwNrDlBydH45auQolmi+icC67xd17RMSFOIqZY5l+fGl2PRXwzDVUu36tj/1JBe9954yHkGjWE1/AitiEqRESE7ivhUfVRdtFlTZuWi2ujEZ9HXfywCLJ8ClUr4YIK0lN9m9+bW6a1Gz+0TLU/Bq8X0QGGQrqktc/a+mFmvGlG2mSxBFch1SUzD2cX5yCTKVIaadAnDXzNg+j2YSedw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c2131170-5491-4b13-43f2-08d7f8485499 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 May 2020 20:49:44.1656 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6NAM11HT016 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org The bma180 and related chips should have two registers attached to them. The IIO driver currently uses them, document them here as well. Acked-by: Rob Herring Reviewed-by: Linus Walleij Signed-off-by: Jonathan Bakker --- Changes from v1 - Added A-b and R-b tags --- Documentation/devicetree/bindings/iio/accel/bma180.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/iio/accel/bma180.txt b/Documentation/devicetree/bindings/iio/accel/bma180.txt index cfbfc6276b3c..33da4a6fdb39 100644 --- a/Documentation/devicetree/bindings/iio/accel/bma180.txt +++ b/Documentation/devicetree/bindings/iio/accel/bma180.txt @@ -14,6 +14,8 @@ Required properties: "bosch,bma254" "bosch,smb380" - reg : the I2C address of the sensor + - vdd-supply : regulator phandle connected to the VDD pin + - vddio-supply : regulator phandle connected to the VDDIO pin Optional properties: From patchwork Thu May 14 20:48:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Bakker X-Patchwork-Id: 11549749 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6CB5C14E3 for ; Thu, 14 May 2020 20:50:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 51DA420734 for ; Thu, 14 May 2020 20:50:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728227AbgENUtu (ORCPT ); Thu, 14 May 2020 16:49:50 -0400 Received: from mail-bn8nam11olkn2081.outbound.protection.outlook.com ([40.92.20.81]:63969 "EHLO NAM11-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728043AbgENUtt (ORCPT ); Thu, 14 May 2020 16:49:49 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KnqF32cXLX34ow0H+ZpzzzrHLsVyiIB4JhxPZjJinMYC6/X9bTkAafxQ3Fd8U+35SVqZmTLiroVuh3XU41MJLxQAMbb+48jqunSzLdb5OyJxygdeLRSZh3m57s8XXJyvOREMcCZdMzjV4k+g6dydT/ap7nBPGKXT3kw6bDd2jh6hrSgCC7nB9+7FV2JedwXOWBIHPlPEr0cvFHN9o+S9De+Ecr1hd0tegkVB5/TIVMlSaU1uPP1CZJelSKGsDW2Q3UHcymjJvx854yRRlPO2heUqZzE8HQdXw5xPL2P8lcmSd+ptuMt6LJ9oaIKLtEgi50uLHWMT+NIjklcyvadn8Q== 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-SenderADCheck; bh=RaRcQ9/Il/aT997Jo7FaGNbPgm9nFCvuObEflLYHYsw=; b=a94Yh/IdrtwbBI+55GjpIQy0fRiCuhDZlYygl/BYnsoLBaNyGYkvA+bDAgPdMEvAc8BHYtGG5SdAU59AxhiNmimwKppKJwwqKA24TpXuB5B9bMz2aY5pW79Ahx3EzxVHRatzXuZqVuiEkzWps8dVR427hlO5dn0b/cu4ilLIh2n0h24r55RfFT/MQRMWkQHmw4GRqX7yoo4GOHBZDvKOSyyDc8P8d8gtjHJY6oATWxqBnjxkgZGdpxtbhgj7xVxQlsBhZe/SZo1dpCetAvYoVF2rUDV2eqa9+nQiYoooef2JD+/hPMroZvfKPrwXt7baNGVPGeEO62yEWHW5kGp8og== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=live.ca; dmarc=pass action=none header.from=live.ca; dkim=pass header.d=live.ca; arc=none Received: from DM6NAM11FT024.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4d::46) by DM6NAM11HT173.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4d::371) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.27; Thu, 14 May 2020 20:49:46 +0000 Received: from BN6PR04MB0660.namprd04.prod.outlook.com (2a01:111:e400:fc4d::47) by DM6NAM11FT024.mail.protection.outlook.com (2a01:111:e400:fc4d::159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.19 via Frontend Transport; Thu, 14 May 2020 20:49:46 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:2B734988CE0B50EDFAF848F00D67389A37D517FC83E8614CF0E6DF6E03D75DE7;UpperCasedChecksum:A99B1EE16D623DB0D00AE009F55A4F4CAE765DF83D104FD35AD512FCD6C14EAF;SizeAsReceived:7906;Count:50 Received: from BN6PR04MB0660.namprd04.prod.outlook.com ([fe80::ad10:4127:4bc8:76fc]) by BN6PR04MB0660.namprd04.prod.outlook.com ([fe80::ad10:4127:4bc8:76fc%6]) with mapi id 15.20.3000.022; Thu, 14 May 2020 20:49:46 +0000 From: Jonathan Bakker To: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, robh+dt@kernel.org, linus.walleij@linaro.org, kstewart@linuxfoundation.org, tglx@linutronix.de, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Bakker Subject: [PATCH v2 5/7] iio: accel: bma180: Add support for bma023 Date: Thu, 14 May 2020 13:48:59 -0700 Message-ID: X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200514204901.3199-1-xc-racer2@live.ca> References: <20200514204901.3199-1-xc-racer2@live.ca> X-ClientProxiedBy: MWHPR1701CA0009.namprd17.prod.outlook.com (2603:10b6:301:14::19) To BN6PR04MB0660.namprd04.prod.outlook.com (2603:10b6:404:d9::21) X-Microsoft-Original-Message-ID: <20200514204901.3199-6-xc-racer2@live.ca> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from jon-hp-6570b.telus (2001:569:fb68:9c00:8067:f823:1e15:7520) by MWHPR1701CA0009.namprd17.prod.outlook.com (2603:10b6:301:14::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.25 via Frontend Transport; Thu, 14 May 2020 20:49:44 +0000 X-Mailer: git-send-email 2.20.1 X-Microsoft-Original-Message-ID: <20200514204901.3199-6-xc-racer2@live.ca> X-TMN: [X9uPtXZ/MhR9tfptPyr6+fm95nojnHT03a1d/HewEGvC6JLNoQA9Ladb+jcpsyiY] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 67f9096f-7f76-4830-09bf-08d7f84855c6 X-MS-TrafficTypeDiagnostic: DM6NAM11HT173: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aHcHHWzxRPTTUwJfl7yW9MmUFIyypeR1xwnS44170Hk6z7JKg053e9mAHDZG+nAKIWAK/Cd4V4jPXBZPrPHC7TDzfgVKrydH9HXaF9Q4jK53Sl4bYifcqGIHqczq+H2bDX/wiasnp2tK2ckWKTN8cmDduxWsTgf4AcdZ+xx4TphuGmDhhNhA6CMhs57DZ4incbczQ4n6ixMVa+8mLkRjEA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:0;SRV:;IPV:NLI;SFV:NSPM;H:BN6PR04MB0660.namprd04.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:;DIR:OUT;SFP:1901; X-MS-Exchange-AntiSpam-MessageData: jqcWbomRZ5P0Y9LIrU3Sflu7WIsliRg2zczhxc3FnoEuKwa5ezH+rfhUiK4bdeGtwRAdCXAjr91RevbUe/PSCJIcD3PdSHgDEUm831+vBCOHThO8UbYqMxceUMcXeIPhssCo3dXOnggkFzCrkGdsazB717OOCPttIJfGUFkS87BjeRVQNLWpttplE0aZ3Slr21cIQZ8vVq9Kv1LI1MZcQA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 67f9096f-7f76-4830-09bf-08d7f84855c6 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 May 2020 20:49:46.0158 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6NAM11HT173 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org The bma023 chip is similar enough to the bma180 and bma25x that the same driver can support all of them. The biggest differences are the lack of a temperature channel and no low power but still working mode. The bma150 is a close relative of the bma023, but it does have a temperature channel so support is not added for it. Reviewed-by: Linus Walleij Signed-off-by: Jonathan Bakker --- Changes from v1 - Added R-b tag --- drivers/iio/accel/Kconfig | 6 +- drivers/iio/accel/bma180.c | 123 +++++++++++++++++++++++++++++++++++-- 2 files changed, 122 insertions(+), 7 deletions(-) diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig index 09e8c51f854a..60d1be99f93b 100644 --- a/drivers/iio/accel/Kconfig +++ b/drivers/iio/accel/Kconfig @@ -89,13 +89,13 @@ config ADXL372_I2C module will be called adxl372_i2c. config BMA180 - tristate "Bosch BMA180/BMA25x 3-Axis Accelerometer Driver" + tristate "Bosch BMA023/BMA180/BMA25x 3-Axis Accelerometer Driver" depends on I2C && INPUT_BMA150=n select IIO_BUFFER select IIO_TRIGGERED_BUFFER help - Say Y here if you want to build a driver for the Bosch BMA180 or - BMA25x triaxial acceleration sensor. + Say Y here if you want to build a driver for the Bosch BMA023, BMA180 + or BMA25x triaxial acceleration sensor. To compile this driver as a module, choose M here: the module will be called bma180. diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c index 75440dd83ec4..19d4f174a890 100644 --- a/drivers/iio/accel/bma180.c +++ b/drivers/iio/accel/bma180.c @@ -7,6 +7,7 @@ * Support for BMA250 (c) Peter Meerwald * * SPI is not supported by driver + * BMA023: 7-bit I2C slave address 0x38 * BMA180: 7-bit I2C slave address 0x40 or 0x41 * BMA250: 7-bit I2C slave address 0x18 or 0x19 * BMA254: 7-bit I2C slave address 0x18 or 0x19 @@ -33,6 +34,7 @@ #define BMA180_IRQ_NAME "bma180_event" enum chip_ids { + BMA023, BMA180, BMA250, BMA254, @@ -64,6 +66,18 @@ struct bma180_part_info { }; /* Register set */ +#define BMA023_CTRL_REG0 0x0a +#define BMA023_CTRL_REG1 0x0b +#define BMA023_CTRL_REG2 0x14 +#define BMA023_CTRL_REG3 0x15 + +#define BMA023_RANGE_MASK GENMASK(4, 3) /* Range of accel values */ +#define BMA023_BW_MASK GENMASK(2, 0) /* Accel bandwidth */ +#define BMA023_SLEEP BIT(0) +#define BMA023_INT_RESET_MASK BIT(6) +#define BMA023_NEW_DATA_INT BIT(5) /* Intr every new accel data is ready */ +#define BMA023_RESET_VAL BIT(1) + #define BMA180_CHIP_ID 0x00 /* Need to distinguish BMA180 from other */ #define BMA180_ACC_X_LSB 0x02 /* First of 6 registers of accel data */ #define BMA180_TEMP 0x08 @@ -94,6 +108,7 @@ struct bma180_part_info { /* We have to write this value in reset register to do soft reset */ #define BMA180_RESET_VAL 0xb6 +#define BMA023_ID_REG_VAL 0x02 #define BMA180_ID_REG_VAL 0x03 #define BMA250_ID_REG_VAL 0x03 #define BMA254_ID_REG_VAL 0xfa /* 250 decimal */ @@ -156,6 +171,9 @@ enum bma180_chan { TEMP }; +static int bma023_bw_table[] = { 25, 50, 100, 190, 375, 750, 1500 }; /* Hz */ +static int bma023_scale_table[] = { 2452, 4903, 9709, }; + static int bma180_bw_table[] = { 10, 20, 40, 75, 150, 300 }; /* Hz */ static int bma180_scale_table[] = { 1275, 1863, 2452, 3727, 4903, 9709, 19417 }; @@ -350,17 +368,37 @@ static int bma180_chip_init(struct bma180_data *data) */ msleep(20); - ret = bma180_set_new_data_intr_state(data, false); + return bma180_set_new_data_intr_state(data, false); +} + +static int bma023_chip_config(struct bma180_data *data) +{ + int ret = bma180_chip_init(data); + if (ret) - return ret; + goto err; + + ret = bma180_set_bw(data, 50); /* 50 Hz */ + if (ret) + goto err; + ret = bma180_set_scale(data, 2452); /* 2 G */ + if (ret) + goto err; - return bma180_set_pmode(data, false); + return 0; + +err: + dev_err(&data->client->dev, "failed to config the chip\n"); + return ret; } static int bma180_chip_config(struct bma180_data *data) { int ret = bma180_chip_init(data); + if (ret) + goto err; + ret = bma180_set_pmode(data, false); if (ret) goto err; ret = bma180_set_bits(data, BMA180_CTRL_REG0, BMA180_DIS_WAKE_UP, 1); @@ -390,6 +428,9 @@ static int bma25x_chip_config(struct bma180_data *data) { int ret = bma180_chip_init(data); + if (ret) + goto err; + ret = bma180_set_pmode(data, false); if (ret) goto err; ret = bma180_set_bw(data, 16); /* 16 Hz */ @@ -414,6 +455,17 @@ static int bma25x_chip_config(struct bma180_data *data) return ret; } +static void bma023_chip_disable(struct bma180_data *data) +{ + if (bma180_set_sleep_state(data, true)) + goto err; + + return; + +err: + dev_err(&data->client->dev, "failed to disable the chip\n"); +} + static void bma180_chip_disable(struct bma180_data *data) { if (bma180_set_new_data_intr_state(data, false)) @@ -610,6 +662,11 @@ static const struct iio_enum bma180_power_mode_enum = { .set = bma180_set_power_mode, }; +static const struct iio_chan_spec_ext_info bma023_ext_info[] = { + IIO_MOUNT_MATRIX(IIO_SHARED_BY_DIR, bma180_accel_get_mount_matrix), + { } +}; + static const struct iio_chan_spec_ext_info bma180_ext_info[] = { IIO_ENUM("power_mode", true, &bma180_power_mode_enum), IIO_ENUM_AVAILABLE("power_mode", &bma180_power_mode_enum), @@ -617,6 +674,23 @@ static const struct iio_chan_spec_ext_info bma180_ext_info[] = { { } }; +#define BMA023_ACC_CHANNEL(_axis, _bits) { \ + .type = IIO_ACCEL, \ + .modified = 1, \ + .channel2 = IIO_MOD_##_axis, \ + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \ + .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) | \ + BIT(IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY), \ + .scan_index = AXIS_##_axis, \ + .scan_type = { \ + .sign = 's', \ + .realbits = _bits, \ + .storagebits = 16, \ + .shift = 16 - _bits, \ + }, \ + .ext_info = bma023_ext_info, \ +} + #define BMA180_ACC_CHANNEL(_axis, _bits) { \ .type = IIO_ACCEL, \ .modified = 1, \ @@ -646,6 +720,13 @@ static const struct iio_chan_spec_ext_info bma180_ext_info[] = { }, \ } +static const struct iio_chan_spec bma023_channels[] = { + BMA023_ACC_CHANNEL(X, 10), + BMA023_ACC_CHANNEL(Y, 10), + BMA023_ACC_CHANNEL(Z, 10), + IIO_CHAN_SOFT_TIMESTAMP(4), +}; + static const struct iio_chan_spec bma180_channels[] = { BMA180_ACC_CHANNEL(X, 14), BMA180_ACC_CHANNEL(Y, 14), @@ -671,6 +752,35 @@ static const struct iio_chan_spec bma254_channels[] = { }; static const struct bma180_part_info bma180_part_info[] = { + [BMA023] = { + .chip_id = BMA023_ID_REG_VAL, + .channels = bma023_channels, + .num_channels = ARRAY_SIZE(bma023_channels), + .scale_table = bma023_scale_table, + .num_scales = ARRAY_SIZE(bma023_scale_table), + .bw_table = bma023_bw_table, + .num_bw = ARRAY_SIZE(bma023_bw_table), + /* No temperature channel */ + .center_temp = 0, + .int_reset_reg = BMA023_CTRL_REG0, + .int_reset_mask = BMA023_INT_RESET_MASK, + .sleep_reg = BMA023_CTRL_REG0, + .sleep_mask = BMA023_SLEEP, + .bw_reg = BMA023_CTRL_REG2, + .bw_mask = BMA023_BW_MASK, + .scale_reg = BMA023_CTRL_REG2, + .scale_mask = BMA023_RANGE_MASK, + /* No power mode on bma023 */ + .power_reg = 0, + .power_mask = 0, + .lowpower_val = 0, + .int_enable_reg = BMA023_CTRL_REG3, + .int_enable_mask = BMA023_NEW_DATA_INT, + .softreset_reg = BMA023_CTRL_REG0, + .softreset_val = BMA023_RESET_VAL, + .chip_config = bma023_chip_config, + .chip_disable = bma023_chip_disable, + }, [BMA180] = { .chip_id = BMA180_ID_REG_VAL, .channels = bma180_channels, @@ -994,6 +1104,7 @@ static SIMPLE_DEV_PM_OPS(bma180_pm_ops, bma180_suspend, bma180_resume); #endif static const struct i2c_device_id bma180_ids[] = { + { "bma023", BMA023 }, { "bma180", BMA180 }, { "bma250", BMA250 }, { "bma254", BMA254 }, @@ -1003,6 +1114,10 @@ static const struct i2c_device_id bma180_ids[] = { MODULE_DEVICE_TABLE(i2c, bma180_ids); static const struct of_device_id bma180_of_match[] = { + { + .compatible = "bosch,bma023", + .data = (void *)BMA023 + }, { .compatible = "bosch,bma180", .data = (void *)BMA180 @@ -1034,5 +1149,5 @@ module_i2c_driver(bma180_driver); MODULE_AUTHOR("Kravchenko Oleksandr "); MODULE_AUTHOR("Texas Instruments, Inc."); -MODULE_DESCRIPTION("Bosch BMA180/BMA25x triaxial acceleration sensor"); +MODULE_DESCRIPTION("Bosch BMA023/BMA180/BMA25x triaxial acceleration sensor"); MODULE_LICENSE("GPL"); From patchwork Thu May 14 20:49:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Bakker X-Patchwork-Id: 11549751 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 08BAC912 for ; Thu, 14 May 2020 20:50:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EEA6720727 for ; Thu, 14 May 2020 20:50:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728213AbgENUtu (ORCPT ); Thu, 14 May 2020 16:49:50 -0400 Received: from mail-co1nam11olkn2010.outbound.protection.outlook.com ([40.92.18.10]:19105 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728190AbgENUtt (ORCPT ); Thu, 14 May 2020 16:49:49 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bBxSVm4gaXnl0czx48Tv/e1Ky3a7a1gDxpMSPhr2DVM+gwqIL+9S27xbaP6kUDnGp5KKp6vIcXYlhBlRes75zciDn7M5ugszXpol2QeDFRO89Nni4Kt/Vqa3Cna/y2Zy8aP4SrJAyWBezYox/bKivTnXvmCNsARZgaZG/lKdCwA8cinJEFESO1lyGkDhz8P3Q0WJAwrri4N8+Z4L6HqE7+JJrTe4amiELczKn3A9oSKEDj16mfPF6mlB30LDaiTLcZFTq30YIrrPnY4MctsSWsqd/DEozJDwNFXZQWUF5DupUdo+UHPVEBvxDhmto8BO/eexYdPXCgd8LwOVAPOxSw== 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-SenderADCheck; bh=a7JgeEF2TaH/6k7kyijCKJhoo4dka1HfSqyBgHiI6KI=; b=NXzgFrM+3CFj8TFwzUUjlDzpNV2vj27igYJjwMmIR0q8jVGFj4tiIBUgQqvpzmjV2XLupT3FcV5AmXax9O75uOrwUI7VsdtLniirxFiPVuOL5Pr7QtFm+kgfhUavZjkjpv7ZEFDWnA7I9lx45VOLWekW3WkU6IMbJqHRBfc5ghlVUuZ+3IxpGcP85fzkJfrmr7OPKXi3rhAJddOf315qzGZ7ChvrsUAUCjusIQoIJKUWdEJc1Nn36vml4J0OqcYp1fqwXp2g3Hg8GEnk9A12TQ08UTMDZNXeglYKcEU5Otr7LSj84mCAv05Im8qq/NN0rPAN1gOzPDY4mGItqwYt9Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=live.ca; dmarc=pass action=none header.from=live.ca; dkim=pass header.d=live.ca; arc=none Received: from DM6NAM11FT024.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4d::40) by DM6NAM11HT064.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4d::306) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.19; Thu, 14 May 2020 20:49:48 +0000 Received: from BN6PR04MB0660.namprd04.prod.outlook.com (2a01:111:e400:fc4d::47) by DM6NAM11FT024.mail.protection.outlook.com (2a01:111:e400:fc4d::159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.19 via Frontend Transport; Thu, 14 May 2020 20:49:48 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:9F951078177A2491ABC5874BCBEE8D2355BFA6B9DBB806DD9B8E838ADD5CF2BF;UpperCasedChecksum:06DCA2CD2D75EF62A742B426E0D9CCDB6F31FFC36DFA9B14FB0A6CAE9DE38C75;SizeAsReceived:7916;Count:50 Received: from BN6PR04MB0660.namprd04.prod.outlook.com ([fe80::ad10:4127:4bc8:76fc]) by BN6PR04MB0660.namprd04.prod.outlook.com ([fe80::ad10:4127:4bc8:76fc%6]) with mapi id 15.20.3000.022; Thu, 14 May 2020 20:49:47 +0000 From: Jonathan Bakker To: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, robh+dt@kernel.org, linus.walleij@linaro.org, kstewart@linuxfoundation.org, tglx@linutronix.de, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Bakker Subject: [PATCH v2 6/7] iio: accel: bma180: Rename center_temp to temp_offset Date: Thu, 14 May 2020 13:49:00 -0700 Message-ID: X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200514204901.3199-1-xc-racer2@live.ca> References: <20200514204901.3199-1-xc-racer2@live.ca> X-ClientProxiedBy: MWHPR1701CA0009.namprd17.prod.outlook.com (2603:10b6:301:14::19) To BN6PR04MB0660.namprd04.prod.outlook.com (2603:10b6:404:d9::21) X-Microsoft-Original-Message-ID: <20200514204901.3199-7-xc-racer2@live.ca> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from jon-hp-6570b.telus (2001:569:fb68:9c00:8067:f823:1e15:7520) by MWHPR1701CA0009.namprd17.prod.outlook.com (2603:10b6:301:14::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.25 via Frontend Transport; Thu, 14 May 2020 20:49:46 +0000 X-Mailer: git-send-email 2.20.1 X-Microsoft-Original-Message-ID: <20200514204901.3199-7-xc-racer2@live.ca> X-TMN: [A6eiZlCL3MtHRfvI5xl/b9AQ8gteEcsk+5uo5NyEx+rqDA1B/SvdCa+6kXJFTGXZ] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 73988799-defb-41d9-d907-08d7f84856dc X-MS-TrafficTypeDiagnostic: DM6NAM11HT064: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: P46JhXodGyJT6Q7dR08yUb7wR/BSrHS4dvxiSrjgsvhkurPW1O7FPYbb3pT7HhUAqx539PhXQUYGgadHklKkqSv6649Qh3WHiDKGlJSOnrYQI4a3m2DY+MJkEtCAlKNHHBfCEgPiMOn6/Jy4yRvGH++mu+D1wTPTPi248WbS9QRKvNBD8e2SFAgvBQESAOrY8g0VKPe2S24sWlQG72cBCA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:0;SRV:;IPV:NLI;SFV:NSPM;H:BN6PR04MB0660.namprd04.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:;DIR:OUT;SFP:1901; X-MS-Exchange-AntiSpam-MessageData: vVF3nWvMVJK1wVgHs0XrudcN3jnK6wECJbT6VstgxAfvVeeACp7DFHTMQ0WkOuTPpKXQ5vJ6wiRskOcpitxFgACbbB880By7A1qfcr7NevEMo+0qmwyPqQJknMHMGEuhO+dxNKzJL7JUe8CjhSoLdxpRhsYbu6Hb3kohCi5ah4I8vj3lpMFOTqCblj3NAJf7rWY/zP4dcEo8wCgqo2PuEw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 73988799-defb-41d9-d907-08d7f84856dc X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 May 2020 20:49:47.8580 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6NAM11HT064 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org The bma180 driver is being extended to support the bma150. Its temperature channel is unsigned so the center_temp naming no longer makes. Signed-off-by: Jonathan Bakker Reviewed-by: Linus Walleij --- drivers/iio/accel/bma180.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c index 19d4f174a890..23da0a79b0c4 100644 --- a/drivers/iio/accel/bma180.c +++ b/drivers/iio/accel/bma180.c @@ -50,7 +50,7 @@ struct bma180_part_info { unsigned int num_scales; const int *bw_table; unsigned int num_bw; - int center_temp; + int temp_offset; u8 int_reset_reg, int_reset_mask; u8 sleep_reg, sleep_mask; @@ -584,7 +584,7 @@ static int bma180_read_raw(struct iio_dev *indio_dev, return -EINVAL; } case IIO_CHAN_INFO_OFFSET: - *val = data->part_info->center_temp; + *val = data->part_info->temp_offset; return IIO_VAL_INT; default: return -EINVAL; @@ -761,7 +761,7 @@ static const struct bma180_part_info bma180_part_info[] = { .bw_table = bma023_bw_table, .num_bw = ARRAY_SIZE(bma023_bw_table), /* No temperature channel */ - .center_temp = 0, + .temp_offset = 0, .int_reset_reg = BMA023_CTRL_REG0, .int_reset_mask = BMA023_INT_RESET_MASK, .sleep_reg = BMA023_CTRL_REG0, @@ -789,7 +789,7 @@ static const struct bma180_part_info bma180_part_info[] = { .num_scales = ARRAY_SIZE(bma180_scale_table), .bw_table = bma180_bw_table, .num_bw = ARRAY_SIZE(bma180_bw_table), - .center_temp = 48, /* 0 LSB @ 24 degree C */ + .temp_offset = 48, /* 0 LSB @ 24 degree C */ .int_reset_reg = BMA180_CTRL_REG0, .int_reset_mask = BMA180_RESET_INT, .sleep_reg = BMA180_CTRL_REG0, @@ -816,7 +816,7 @@ static const struct bma180_part_info bma180_part_info[] = { .num_scales = ARRAY_SIZE(bma25x_scale_table), .bw_table = bma25x_bw_table, .num_bw = ARRAY_SIZE(bma25x_bw_table), - .center_temp = 48, /* 0 LSB @ 24 degree C */ + .temp_offset = 48, /* 0 LSB @ 24 degree C */ .int_reset_reg = BMA250_INT_RESET_REG, .int_reset_mask = BMA250_INT_RESET_MASK, .sleep_reg = BMA250_POWER_REG, @@ -845,7 +845,7 @@ static const struct bma180_part_info bma180_part_info[] = { .num_scales = ARRAY_SIZE(bma25x_scale_table), .bw_table = bma25x_bw_table, .num_bw = ARRAY_SIZE(bma25x_bw_table), - .center_temp = 46, /* 0 LSB @ 23 degree C */ + .temp_offset = 46, /* 0 LSB @ 23 degree C */ .int_reset_reg = BMA254_INT_RESET_REG, .int_reset_mask = BMA254_INT_RESET_MASK, .sleep_reg = BMA254_POWER_REG, From patchwork Thu May 14 20:49:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Bakker X-Patchwork-Id: 11549747 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 25718912 for ; Thu, 14 May 2020 20:50:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0BCE520727 for ; Thu, 14 May 2020 20:50:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727122AbgENUt4 (ORCPT ); Thu, 14 May 2020 16:49:56 -0400 Received: from mail-dm6nam11olkn2104.outbound.protection.outlook.com ([40.92.19.104]:49984 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728223AbgENUtw (ORCPT ); Thu, 14 May 2020 16:49:52 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R1XUWmTjgtOtGog1hnVlBaPHK8LZ70AD8nQF0GC5sVevUP8Y9mC3aGSdPfU7+OxlC5GfFg61KkqTa2A9ilGsGohD20RwUAcucnf2XUH92pBzpQkMGuWYSIZdOSg0rz4x9Q1juQ1oZEUTX3KpZ4dZvzzu/T8aaFLKo3vfI8b/wUhgpdoSk+0n8BXlfngiInaMOYhYGkygG0E4uDhI5K8pg6MXqg4SXE0CUqVE7Fo29b5lfywKzEQLQ2Zx+AxmFKygMPr72Oh9K4w7M0YKXs1lI4kgF9Q9xsUr8YNqSZnKXT6iYZCaFvNMfDOjoItQItpAO31hl+ifz45whnh1B3reqw== 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-SenderADCheck; bh=3j9qJz4PM4ZSKlQ9ZzkDz0EpE+IxmCEECJ65foa+kDI=; b=NruFuZQLDAOYX8zuawQ4c8Wm0HbrFmOOZL4Uic5tPpwPgEX971Xj6KhLnsPThXnqU5GL/ZRzHMUJyhGDYikgPP0J6ZCnux2QR6EoNsVyx6EW+ukOs9tK7A2qaT25bdYPYikBMoqTW9N/mMDzrdrKR1q1RiyRLHoN9bIs7x9jcYsm2kkFPyxLP8x/nJ1mqJt9DwrJYi+nXX+pfXX5/dt9dz4fdRNEA7aY+5bX+JdGbgEdDlpTwJ/BekCY80VmEdi2DPoqLvtXD6nIk421PXrk/e3eF+W9R3LblXToQicK4YaU0GAtfEah7BA+vPcZXyFUUkbhKOLt3aV8m4qFdOwpwg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=live.ca; dmarc=pass action=none header.from=live.ca; dkim=pass header.d=live.ca; arc=none Received: from DM6NAM11FT024.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4d::47) by DM6NAM11HT098.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4d::342) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.27; Thu, 14 May 2020 20:49:49 +0000 Received: from BN6PR04MB0660.namprd04.prod.outlook.com (2a01:111:e400:fc4d::47) by DM6NAM11FT024.mail.protection.outlook.com (2a01:111:e400:fc4d::159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.19 via Frontend Transport; Thu, 14 May 2020 20:49:49 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:BA8C6AF82B30B9DB9038A2ABB23D8EA3C59A23E0607A4A9F115369F0611DA563;UpperCasedChecksum:97CD823E61BC5BEA0C82221EF84D61D07DFF037AB672703A7669A3F2DD62567C;SizeAsReceived:7909;Count:50 Received: from BN6PR04MB0660.namprd04.prod.outlook.com ([fe80::ad10:4127:4bc8:76fc]) by BN6PR04MB0660.namprd04.prod.outlook.com ([fe80::ad10:4127:4bc8:76fc%6]) with mapi id 15.20.3000.022; Thu, 14 May 2020 20:49:49 +0000 From: Jonathan Bakker To: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, robh+dt@kernel.org, linus.walleij@linaro.org, kstewart@linuxfoundation.org, tglx@linutronix.de, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Bakker Subject: [PATCH v2 7/7] iio: accel: Add bma150/smb380 support to bma180 Date: Thu, 14 May 2020 13:49:01 -0700 Message-ID: X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200514204901.3199-1-xc-racer2@live.ca> References: <20200514204901.3199-1-xc-racer2@live.ca> X-ClientProxiedBy: MWHPR1701CA0009.namprd17.prod.outlook.com (2603:10b6:301:14::19) To BN6PR04MB0660.namprd04.prod.outlook.com (2603:10b6:404:d9::21) X-Microsoft-Original-Message-ID: <20200514204901.3199-8-xc-racer2@live.ca> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from jon-hp-6570b.telus (2001:569:fb68:9c00:8067:f823:1e15:7520) by MWHPR1701CA0009.namprd17.prod.outlook.com (2603:10b6:301:14::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.25 via Frontend Transport; Thu, 14 May 2020 20:49:48 +0000 X-Mailer: git-send-email 2.20.1 X-Microsoft-Original-Message-ID: <20200514204901.3199-8-xc-racer2@live.ca> X-TMN: [ZRDDjGEj1+SdB0d0Vp8G+9BYUFgb1FI+zwjA3RDXfOyK0n6CQvdNo4ZYI6gXuoH6] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 760e60a7-27d7-4100-dc32-08d7f84857f6 X-MS-TrafficTypeDiagnostic: DM6NAM11HT098: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7Y8gytcjjJj8skHfYM86rhusaAomWtq6909OZr7pWXlz5xfNOZzd0LQXVKeSj3uUxhLOrlZJ4Jwk5NgLUNBJG3jg76EqnXA7FBbKWPz0a9KaAPS9KlHzmtNGd80XyH7KccqV+6r441ELfbCMR3pr6NttkAmaeJo9ym9AWr+368uGBS2ShBEELpLxUP2MFlEQle4JiptLw7CSLp8GZLjZiw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:0;SRV:;IPV:NLI;SFV:NSPM;H:BN6PR04MB0660.namprd04.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:;DIR:OUT;SFP:1901; X-MS-Exchange-AntiSpam-MessageData: 2za/Lf335B7o3NCc2S0gKBnesmHMREZ2pmSdlnhz1XSi7nunS0ep8S+pWSAfYplE/N5wNKJqGY0ZMNScc1Bf39a8FSUDbUvi1itKEwRAvk392r5j/9j60JcCRrtWf8n2ezJsXhUSPTlmDQ6K9qfm74MSEENLt7MvPLAc6wfMeLkeTeBqIpx7GhA85M/r7LyB1VsgBQeh7on0cPbtraweDQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 760e60a7-27d7-4100-dc32-08d7f84857f6 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 May 2020 20:49:49.7242 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6NAM11HT098 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org The bma150/smb380 are very similar to the bma023 but have a temperature channel as well. Signed-off-by: Jonathan Bakker Reviewed-by: Linus Walleij --- drivers/iio/accel/Kconfig | 6 ++-- drivers/iio/accel/bma180.c | 71 +++++++++++++++++++++++++++++++++++--- 2 files changed, 70 insertions(+), 7 deletions(-) diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig index 60d1be99f93b..109ae0c8b35d 100644 --- a/drivers/iio/accel/Kconfig +++ b/drivers/iio/accel/Kconfig @@ -89,13 +89,13 @@ config ADXL372_I2C module will be called adxl372_i2c. config BMA180 - tristate "Bosch BMA023/BMA180/BMA25x 3-Axis Accelerometer Driver" + tristate "Bosch BMA023/BMA1x0/BMA25x 3-Axis Accelerometer Driver" depends on I2C && INPUT_BMA150=n select IIO_BUFFER select IIO_TRIGGERED_BUFFER help - Say Y here if you want to build a driver for the Bosch BMA023, BMA180 - or BMA25x triaxial acceleration sensor. + Say Y here if you want to build a driver for the Bosch BMA023, BMA150 + BMA180, SMB380, or BMA25x triaxial acceleration sensor. To compile this driver as a module, choose M here: the module will be called bma180. diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c index 23da0a79b0c4..265722e4b13f 100644 --- a/drivers/iio/accel/bma180.c +++ b/drivers/iio/accel/bma180.c @@ -7,7 +7,7 @@ * Support for BMA250 (c) Peter Meerwald * * SPI is not supported by driver - * BMA023: 7-bit I2C slave address 0x38 + * BMA023/BMA150/SMB380: 7-bit I2C slave address 0x38 * BMA180: 7-bit I2C slave address 0x40 or 0x41 * BMA250: 7-bit I2C slave address 0x18 or 0x19 * BMA254: 7-bit I2C slave address 0x18 or 0x19 @@ -35,6 +35,7 @@ enum chip_ids { BMA023, + BMA150, BMA180, BMA250, BMA254, @@ -565,8 +566,12 @@ static int bma180_read_raw(struct iio_dev *indio_dev, iio_device_release_direct_mode(indio_dev); if (ret < 0) return ret; - *val = sign_extend32(ret >> chan->scan_type.shift, - chan->scan_type.realbits - 1); + if (chan->scan_type.sign == 's') { + *val = sign_extend32(ret >> chan->scan_type.shift, + chan->scan_type.realbits - 1); + } else { + *val = ret; + } return IIO_VAL_INT; case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY: *val = data->bw; @@ -691,6 +696,18 @@ static const struct iio_chan_spec_ext_info bma180_ext_info[] = { .ext_info = bma023_ext_info, \ } +#define BMA150_TEMP_CHANNEL { \ + .type = IIO_TEMP, \ + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ + BIT(IIO_CHAN_INFO_SCALE) | BIT(IIO_CHAN_INFO_OFFSET), \ + .scan_index = TEMP, \ + .scan_type = { \ + .sign = 'u', \ + .realbits = 8, \ + .storagebits = 16, \ + }, \ +} + #define BMA180_ACC_CHANNEL(_axis, _bits) { \ .type = IIO_ACCEL, \ .modified = 1, \ @@ -727,6 +744,14 @@ static const struct iio_chan_spec bma023_channels[] = { IIO_CHAN_SOFT_TIMESTAMP(4), }; +static const struct iio_chan_spec bma150_channels[] = { + BMA023_ACC_CHANNEL(X, 10), + BMA023_ACC_CHANNEL(Y, 10), + BMA023_ACC_CHANNEL(Z, 10), + BMA150_TEMP_CHANNEL, + IIO_CHAN_SOFT_TIMESTAMP(4), +}; + static const struct iio_chan_spec bma180_channels[] = { BMA180_ACC_CHANNEL(X, 14), BMA180_ACC_CHANNEL(Y, 14), @@ -781,6 +806,34 @@ static const struct bma180_part_info bma180_part_info[] = { .chip_config = bma023_chip_config, .chip_disable = bma023_chip_disable, }, + [BMA150] = { + .chip_id = BMA023_ID_REG_VAL, + .channels = bma150_channels, + .num_channels = ARRAY_SIZE(bma150_channels), + .scale_table = bma023_scale_table, + .num_scales = ARRAY_SIZE(bma023_scale_table), + .bw_table = bma023_bw_table, + .num_bw = ARRAY_SIZE(bma023_bw_table), + .temp_offset = -60, /* 0 LSB @ -30 degree C */ + .int_reset_reg = BMA023_CTRL_REG0, + .int_reset_mask = BMA023_INT_RESET_MASK, + .sleep_reg = BMA023_CTRL_REG0, + .sleep_mask = BMA023_SLEEP, + .bw_reg = BMA023_CTRL_REG2, + .bw_mask = BMA023_BW_MASK, + .scale_reg = BMA023_CTRL_REG2, + .scale_mask = BMA023_RANGE_MASK, + /* No power mode on bma150 */ + .power_reg = 0, + .power_mask = 0, + .lowpower_val = 0, + .int_enable_reg = BMA023_CTRL_REG3, + .int_enable_mask = BMA023_NEW_DATA_INT, + .softreset_reg = BMA023_CTRL_REG0, + .softreset_val = BMA023_RESET_VAL, + .chip_config = bma023_chip_config, + .chip_disable = bma023_chip_disable, + }, [BMA180] = { .chip_id = BMA180_ID_REG_VAL, .channels = bma180_channels, @@ -1105,9 +1158,11 @@ static SIMPLE_DEV_PM_OPS(bma180_pm_ops, bma180_suspend, bma180_resume); static const struct i2c_device_id bma180_ids[] = { { "bma023", BMA023 }, + { "bma150", BMA150 }, { "bma180", BMA180 }, { "bma250", BMA250 }, { "bma254", BMA254 }, + { "smb380", BMA150 }, { } }; @@ -1118,6 +1173,10 @@ static const struct of_device_id bma180_of_match[] = { .compatible = "bosch,bma023", .data = (void *)BMA023 }, + { + .compatible = "bosch,bma150", + .data = (void *)BMA150 + }, { .compatible = "bosch,bma180", .data = (void *)BMA180 @@ -1130,6 +1189,10 @@ static const struct of_device_id bma180_of_match[] = { .compatible = "bosch,bma254", .data = (void *)BMA254 }, + { + .compatible = "bosch,smb380", + .data = (void *)BMA150 + }, { } }; MODULE_DEVICE_TABLE(of, bma180_of_match); @@ -1149,5 +1212,5 @@ module_i2c_driver(bma180_driver); MODULE_AUTHOR("Kravchenko Oleksandr "); MODULE_AUTHOR("Texas Instruments, Inc."); -MODULE_DESCRIPTION("Bosch BMA023/BMA180/BMA25x triaxial acceleration sensor"); +MODULE_DESCRIPTION("Bosch BMA023/BMA1x0/BMA25x triaxial acceleration sensor"); MODULE_LICENSE("GPL");