From patchwork Thu Jun 10 09:52:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 12312519 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CACE1C47094 for ; Thu, 10 Jun 2021 09:59:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A51FB61359 for ; Thu, 10 Jun 2021 09:59:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229778AbhFJKBU (ORCPT ); Thu, 10 Jun 2021 06:01:20 -0400 Received: from mo4-p02-ob.smtp.rzone.de ([85.215.255.83]:25443 "EHLO mo4-p02-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229770AbhFJKBU (ORCPT ); Thu, 10 Jun 2021 06:01:20 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1623318984; cv=none; d=strato.com; s=strato-dkim-0002; b=UxKBtim/qhiLdKMmOn+dupV9i0xsO0nfs3FrpT84mNIi85Rr/yYCSgeFfTZpNXcbdP DHCPCibMSf5TXr7YIniETY8QRQnaPfW6bPKu2byQevYqcw4I2sShNtwLkvr7r0xaTcHE wsir3py74UxoR2C2y1+zEn+AJS/K/H4hBpS0UmrykQfhht/Iz22MPnydKP5ydgfmFaj0 E4QSp024B9nD8m5a64zbrwqRTTOJNBzy0bKBPg7+uTK5c40nynuMGNJXDsi9GbAPhVRv 0nyf8oYgRxuKn2fpWEQX5M5QE3MUBYg3lg2TOyRhx+9NAmjk5BHt9nOrQB6vPxcELNfd aGYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1623318984; s=strato-dkim-0002; d=strato.com; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=ZBrKvpayqrI6RhcSuPGx5OIyUigdkTCBJlRkGtVotVs=; b=MP7ZeJePUErohuB4m6ZRBKJIH5eXQk8xNmMiAdPwSayWAM8BtDxfgRMmS7isxn6JQ9 NpemilgixvfrBYWxGNAu01LjU11ZYE0D0QmcGy4y6sXHjOMtS7UsdbPPOSem79eRyMUW osYYuQHIy9wiC2xrtwNz0Y+251Uh/W2dsYGkI0TeNk4hv6xgcyFFLIPW1dz7z8nXFJRK H3Ua19dRGSQlQXaEKP+5U/QYVmlmOC8Mbud6YCW+39nzKchMkpl0n0TunT5MmxHYkRju HTJMMO7zyQOPTv+Gu4GvRyy3BZrrBZCHMYeSxbiAT6j+biTDUsqa7iMCOsFnzbdruk0C AAow== ARC-Authentication-Results: i=1; strato.com; dkim=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1623318984; s=strato-dkim-0002; d=gerhold.net; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=ZBrKvpayqrI6RhcSuPGx5OIyUigdkTCBJlRkGtVotVs=; b=GoDmoQ6HZJXare0qr4lCE0s2JWJbbjp3DLXaZJuwpKMbM80v6/DVT763R8o5x+AKjV txk+9lw6gKiQWe2uDhQw+5R3hKBMf1aOMQ/qSw4h0ILfaCXY5mfF6vMFAnuhN2KcWy2j byfmJg5knci5hxtm1nEzSl8LmkiR1xk4CZvaXmJra3/wh5ECMPPR6u+SdQAwkzJgA3x+ tbLGgLpw4ew76bpuWHwwCefK49BxpxySLnIDnpoW2yNBW2wQVV56gQDf6SUMZk2Z9NTb e001BBSQNb112cjFTevLX/kYCd4IbiLLASM+Pd//XmxGrAHGYCgMZi17QaOICEfEBOtA 5MYQ== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXS7IYBkLahKxA626NTAM6" X-RZG-CLASS-ID: mo00 Received: from droid.. by smtp.strato.de (RZmta 47.27.2 DYNA|AUTH) with ESMTPSA id y01375x5A9uNsnz (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Thu, 10 Jun 2021 11:56:23 +0200 (CEST) From: Stephan Gerhold To: Jonathan Cameron Cc: Lars-Peter Clausen , Rob Herring , Linus Walleij , Peter Meerwald , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, Bastien Nocera , Laurentiu Palcu , Hans de Goede , Andy Shevchenko , Stephan Gerhold Subject: [PATCH 1/6] iio: accel: bmc150: Drop misleading/duplicate chip identifiers Date: Thu, 10 Jun 2021 11:52:55 +0200 Message-Id: <20210610095300.3613-2-stephan@gerhold.net> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210610095300.3613-1-stephan@gerhold.net> References: <20210610095300.3613-1-stephan@gerhold.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Commit 0ad4bf370176 ("iio:accel:bmc150-accel: Use the chip ID to detect sensor variant") stopped using the I2C/ACPI match data to look up the bmc150_accel_chip_info. However, the bmc150_accel_chip_info_tbl remained as-is, with multiple entries with the same chip_id (e.g. 0xFA for BMC150/BMI055/BMA255). This is redundant now because actually the driver will always select the first entry with a matching chip_id. So even if a device probes e.g. with BMA0255 it will end up using the chip_info for BMC150. And in general that's fine for now, the entries for BMC150/BMI055/BMA255 were exactly the same anyway (except for the name, which is replaced with the more accurate one later). But in this case it's misleading because it suggests that one should add even more entries with the same chip_id when adding support for new variants. Let's make that more clear by removing the enum with the chip identifiers entirely and instead have only one entry per chip_id. Note that we may need to bring back some mechanism to differentiate between different chips with the same chip_id in the future. For example, BMA250 (currently supported by the bma180 driver) has the same chip_id = 0x03 as BMA222 even though they have different channel sizes (8 bits vs 10 bits). But in any case, that mechanism would need to look quite different from what we have right now. Cc: Bastien Nocera Reviewed-by: Linus Walleij Signed-off-by: Stephan Gerhold --- drivers/iio/accel/bmc150-accel-core.c | 34 ++++++--------------------- drivers/iio/accel/bmc150-accel-i2c.c | 30 +++++++++++------------ drivers/iio/accel/bmc150-accel-spi.c | 30 +++++++++++------------ drivers/iio/accel/bmc150-accel.h | 10 -------- 4 files changed, 37 insertions(+), 67 deletions(-) diff --git a/drivers/iio/accel/bmc150-accel-core.c b/drivers/iio/accel/bmc150-accel-core.c index a3d08d713362..d4349f749485 100644 --- a/drivers/iio/accel/bmc150-accel-core.c +++ b/drivers/iio/accel/bmc150-accel-core.c @@ -1097,28 +1097,8 @@ static const struct iio_chan_spec bma280_accel_channels[] = BMC150_ACCEL_CHANNELS(14); static const struct bmc150_accel_chip_info bmc150_accel_chip_info_tbl[] = { - [bmc150] = { - .name = "BMC150A", - .chip_id = 0xFA, - .channels = bmc150_accel_channels, - .num_channels = ARRAY_SIZE(bmc150_accel_channels), - .scale_table = { {9610, BMC150_ACCEL_DEF_RANGE_2G}, - {19122, BMC150_ACCEL_DEF_RANGE_4G}, - {38344, BMC150_ACCEL_DEF_RANGE_8G}, - {76590, BMC150_ACCEL_DEF_RANGE_16G} }, - }, - [bmi055] = { - .name = "BMI055A", - .chip_id = 0xFA, - .channels = bmc150_accel_channels, - .num_channels = ARRAY_SIZE(bmc150_accel_channels), - .scale_table = { {9610, BMC150_ACCEL_DEF_RANGE_2G}, - {19122, BMC150_ACCEL_DEF_RANGE_4G}, - {38344, BMC150_ACCEL_DEF_RANGE_8G}, - {76590, BMC150_ACCEL_DEF_RANGE_16G} }, - }, - [bma255] = { - .name = "BMA0255", + { + .name = "BMC150/BMI055/BMA255", .chip_id = 0xFA, .channels = bmc150_accel_channels, .num_channels = ARRAY_SIZE(bmc150_accel_channels), @@ -1127,7 +1107,7 @@ static const struct bmc150_accel_chip_info bmc150_accel_chip_info_tbl[] = { {38344, BMC150_ACCEL_DEF_RANGE_8G}, {76590, BMC150_ACCEL_DEF_RANGE_16G} }, }, - [bma250e] = { + { .name = "BMA250E", .chip_id = 0xF9, .channels = bma250e_accel_channels, @@ -1137,7 +1117,7 @@ static const struct bmc150_accel_chip_info bmc150_accel_chip_info_tbl[] = { {153277, BMC150_ACCEL_DEF_RANGE_8G}, {306457, BMC150_ACCEL_DEF_RANGE_16G} }, }, - [bma222] = { + { .name = "BMA222", .chip_id = 0x03, .channels = bma222e_accel_channels, @@ -1151,7 +1131,7 @@ static const struct bmc150_accel_chip_info bmc150_accel_chip_info_tbl[] = { {625000, BMC150_ACCEL_DEF_RANGE_8G}, {1250000, BMC150_ACCEL_DEF_RANGE_16G} }, }, - [bma222e] = { + { .name = "BMA222E", .chip_id = 0xF8, .channels = bma222e_accel_channels, @@ -1161,8 +1141,8 @@ static const struct bmc150_accel_chip_info bmc150_accel_chip_info_tbl[] = { {612915, BMC150_ACCEL_DEF_RANGE_8G}, {1225831, BMC150_ACCEL_DEF_RANGE_16G} }, }, - [bma280] = { - .name = "BMA0280", + { + .name = "BMA280", .chip_id = 0xFB, .channels = bma280_accel_channels, .num_channels = ARRAY_SIZE(bma280_accel_channels), diff --git a/drivers/iio/accel/bmc150-accel-i2c.c b/drivers/iio/accel/bmc150-accel-i2c.c index d34dddb850d9..b8bda0dfb495 100644 --- a/drivers/iio/accel/bmc150-accel-i2c.c +++ b/drivers/iio/accel/bmc150-accel-i2c.c @@ -221,14 +221,14 @@ static int bmc150_accel_remove(struct i2c_client *client) } static const struct acpi_device_id bmc150_accel_acpi_match[] = { - {"BSBA0150", bmc150}, - {"BMC150A", bmc150}, - {"BMI055A", bmi055}, - {"BMA0255", bma255}, - {"BMA250E", bma250e}, - {"BMA222", bma222}, - {"BMA222E", bma222e}, - {"BMA0280", bma280}, + {"BSBA0150"}, + {"BMC150A"}, + {"BMI055A"}, + {"BMA0255"}, + {"BMA250E"}, + {"BMA222"}, + {"BMA222E"}, + {"BMA0280"}, {"BOSC0200"}, {"DUAL250E"}, { }, @@ -236,13 +236,13 @@ static const struct acpi_device_id bmc150_accel_acpi_match[] = { MODULE_DEVICE_TABLE(acpi, bmc150_accel_acpi_match); static const struct i2c_device_id bmc150_accel_id[] = { - {"bmc150_accel", bmc150}, - {"bmi055_accel", bmi055}, - {"bma255", bma255}, - {"bma250e", bma250e}, - {"bma222", bma222}, - {"bma222e", bma222e}, - {"bma280", bma280}, + {"bmc150_accel"}, + {"bmi055_accel"}, + {"bma255"}, + {"bma250e"}, + {"bma222"}, + {"bma222e"}, + {"bma280"}, {} }; diff --git a/drivers/iio/accel/bmc150-accel-spi.c b/drivers/iio/accel/bmc150-accel-spi.c index 74a8aee4f612..01b42fa6a015 100644 --- a/drivers/iio/accel/bmc150-accel-spi.c +++ b/drivers/iio/accel/bmc150-accel-spi.c @@ -34,26 +34,26 @@ static int bmc150_accel_remove(struct spi_device *spi) } static const struct acpi_device_id bmc150_accel_acpi_match[] = { - {"BSBA0150", bmc150}, - {"BMC150A", bmc150}, - {"BMI055A", bmi055}, - {"BMA0255", bma255}, - {"BMA250E", bma250e}, - {"BMA222", bma222}, - {"BMA222E", bma222e}, - {"BMA0280", bma280}, + {"BSBA0150"}, + {"BMC150A"}, + {"BMI055A"}, + {"BMA0255"}, + {"BMA250E"}, + {"BMA222"}, + {"BMA222E"}, + {"BMA0280"}, { }, }; MODULE_DEVICE_TABLE(acpi, bmc150_accel_acpi_match); static const struct spi_device_id bmc150_accel_id[] = { - {"bmc150_accel", bmc150}, - {"bmi055_accel", bmi055}, - {"bma255", bma255}, - {"bma250e", bma250e}, - {"bma222", bma222}, - {"bma222e", bma222e}, - {"bma280", bma280}, + {"bmc150_accel"}, + {"bmi055_accel"}, + {"bma255"}, + {"bma250e"}, + {"bma222"}, + {"bma222e"}, + {"bma280"}, {} }; MODULE_DEVICE_TABLE(spi, bmc150_accel_id); diff --git a/drivers/iio/accel/bmc150-accel.h b/drivers/iio/accel/bmc150-accel.h index d67d6ed6ae77..47121f070fe9 100644 --- a/drivers/iio/accel/bmc150-accel.h +++ b/drivers/iio/accel/bmc150-accel.h @@ -68,16 +68,6 @@ struct bmc150_accel_data { struct iio_mount_matrix orientation; }; -enum { - bmc150, - bmi055, - bma255, - bma250e, - bma222, - bma222e, - bma280, -}; - int bmc150_accel_core_probe(struct device *dev, struct regmap *regmap, int irq, const char *name, bool block_supported); int bmc150_accel_core_remove(struct device *dev); From patchwork Thu Jun 10 09:52:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 12312511 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43AB3C47094 for ; Thu, 10 Jun 2021 09:56:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2AE75601FA for ; Thu, 10 Jun 2021 09:56:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230103AbhFJJ6a (ORCPT ); Thu, 10 Jun 2021 05:58:30 -0400 Received: from mo4-p02-ob.smtp.rzone.de ([85.215.255.82]:15075 "EHLO mo4-p02-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229935AbhFJJ63 (ORCPT ); Thu, 10 Jun 2021 05:58:29 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1623318985; cv=none; d=strato.com; s=strato-dkim-0002; b=kL1jJXcE0xo6QWSo9ju02qX17Yja6qia0RHHSaDIPaePqE581EnCVbPLab1M/dr9MY BSVxYNH6Gwtzy6fvgAr1DFjPXIsahkBXVHuioozgvBLxfzND4uzyGewwtt8KNlgTiAMM fUiJR8yZsD50vf1IbE3hHugPiIQJo0veBWYemaPJIcOT3Sb1B9EqTh4vsCFqhSKoeQpn PxFaAlmBVn9CMkG0ggCTHm2fH1LrOayrlBj+g52l0+63+qiCp69n7XchGVOso7URMCvJ /aIy2hjwUfyZw8ZUihWkdUzXyxZurJSvfpzqyyEhaQ1PiZV6lUpCivQraZ6oPdoSBSMD aYNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1623318985; s=strato-dkim-0002; d=strato.com; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=FwZnaZ8gRC2vRn8D/qw8fV39RZrjSrX/Xoxl+96C+g4=; b=CN5FOKVr8Brm4CDj7PvePzvTTIXEUU6UCeeIvMVP9BQnRESV61V8CQDNz83qwJWHW4 vEflBz4qq7gE9OrPwNb8Chjj0miHqua+IuDr6Y2EvLn2s6zDlExzeZsqVjoYZuq8qlwb LPT1Jk+DboDpIyldBYb6XiVZCeAEpLVfaVajjeHh9xiuxiQnWG4XJJrEDUEDgDfoq0fM UOew+Gw4CNuzDbu3zWHaYXM5hceUmkU4Gg1zDeXCEV/+Mfavek+OKFHZBQRWA9e2KjNn EyQdpSA5qETdoYx/dqFCWjlGblcLyF+pKuYrztdQltacGsG1CKNCgkpMIDgeH2QU1P3z Ewyg== ARC-Authentication-Results: i=1; strato.com; dkim=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1623318985; s=strato-dkim-0002; d=gerhold.net; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=FwZnaZ8gRC2vRn8D/qw8fV39RZrjSrX/Xoxl+96C+g4=; b=CArtXx1t0EXSp1IAED9rA14stamWxSdP3DsLHg9E6P4gDOpYQjFduTIsorOX9EWmZR Y7QPGnTKHWpt7eDljrwnukswnql4PtnKVlJd2ifBRV08dmZIe157RvK1iej/nuEv3xZj gqR8qDZ7pyS07/gngfFhw9Sb9p+HXGrdi5AA4PzY/wrmlpVzp2+yh/a79eQYlpAMZf6M QdT0n0qSyh/Zrmba5cydYEjr8Vk9pZVwSTTXlLFRt3sGI2guqpn1e8mX4DO26qvL0+5p s3QcnBswoSsIG35ed7BfwHMY86K+cmEzVeEI9UH19WzsItiFOcAUtcPz2nOZ1htxdVeC LNbg== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXS7IYBkLahKxA626NTAM6" X-RZG-CLASS-ID: mo00 Received: from droid.. by smtp.strato.de (RZmta 47.27.2 DYNA|AUTH) with ESMTPSA id y01375x5A9uOso0 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Thu, 10 Jun 2021 11:56:24 +0200 (CEST) From: Stephan Gerhold To: Jonathan Cameron Cc: Lars-Peter Clausen , Rob Herring , Linus Walleij , Peter Meerwald , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, Bastien Nocera , Laurentiu Palcu , Hans de Goede , Andy Shevchenko , Stephan Gerhold Subject: [PATCH 2/6] dt-bindings: iio: accel: bma255: Document bosch,bma253 Date: Thu, 10 Jun 2021 11:52:56 +0200 Message-Id: <20210610095300.3613-3-stephan@gerhold.net> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210610095300.3613-1-stephan@gerhold.net> References: <20210610095300.3613-1-stephan@gerhold.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org BMA253 is mostly like BMA255 that is already supported by the bmc150-accel driver. Document an extra bosch,bma253 compatible for it. Reviewed-by: Linus Walleij Signed-off-by: Stephan Gerhold --- Documentation/devicetree/bindings/iio/accel/bosch,bma255.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/iio/accel/bosch,bma255.yaml b/Documentation/devicetree/bindings/iio/accel/bosch,bma255.yaml index c2efbb813ca2..8afb0fe8ef5c 100644 --- a/Documentation/devicetree/bindings/iio/accel/bosch,bma255.yaml +++ b/Documentation/devicetree/bindings/iio/accel/bosch,bma255.yaml @@ -18,6 +18,7 @@ properties: enum: - bosch,bmc150_accel - bosch,bmi055_accel + - bosch,bma253 - bosch,bma255 - bosch,bma250e - bosch,bma222 From patchwork Thu Jun 10 09:52:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 12312513 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73CACC48BD1 for ; Thu, 10 Jun 2021 09:56:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 488A661414 for ; Thu, 10 Jun 2021 09:56:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229990AbhFJJ6a (ORCPT ); Thu, 10 Jun 2021 05:58:30 -0400 Received: from mo4-p02-ob.smtp.rzone.de ([85.215.255.82]:31446 "EHLO mo4-p02-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229979AbhFJJ63 (ORCPT ); Thu, 10 Jun 2021 05:58:29 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1623318985; cv=none; d=strato.com; s=strato-dkim-0002; b=TZ4VVvG4RUQAdQRUoxY+AjEPZWcE6lII0Kdvtw91QA+gtLeAOrHFBLETkcli3Gff3f nB3gpHVGMEDDHgSsjSNREvQtKv+EEo/8T9d4zFJTEpZq67Czlqc1XrtBl7fQhOd9X9eZ mPyKWsNm3Oi7Nm2f6MD+YZ4SWe2B8j1ZTMN/tFTULdru/KoSjNVCUnQnppVvGm6Syq/j P4lH4VnRjlDK3y+lS6nifHyW1RTU5lbUAQfef0ztVmNJpIbQ0bRLthoCQRR9UPwFria0 W7/HpJZKV7CE/26xH5RsUovqASAHYKUvZB7tF4x4c8xc2vAWHfSOIGOjTeXrabOwtuVd 0dMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1623318985; s=strato-dkim-0002; d=strato.com; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=WNlaHF78g9bl4CygxMSmelkWWtwJ1TUDvf6CaasmChQ=; b=LFI1U2/AkL7jCzVsXIYo5yAHMce6P2O2vNU8FiwOLo9Qx96FOS999GPg4IcEs0Hb31 2Ac3YDmGkusP2iW+f4l2/QapdUb5X908iQjDNFWRRnTpzSeiMe/9/GWcWahqziejHDsA /4kNoOlvoeoaPGdUFXreoLG5r0URrfhuPZVoY/0o9VEsrCGyFAYt/C9vH/oDTr88IbAa nBCtyQfM+tFk+V7TYZ65C3WzTQfhdOuVUDnOTotQfJ2a+8bNdhbivpYameenrDSmtpOa fhZAs22lfuSXEiyhhjwW80RWdxhuSIFbIfovPaTKiwTeXX4dPVsP4XryX6rkCa8iLNy5 z+EA== ARC-Authentication-Results: i=1; strato.com; dkim=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1623318985; s=strato-dkim-0002; d=gerhold.net; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=WNlaHF78g9bl4CygxMSmelkWWtwJ1TUDvf6CaasmChQ=; b=l01FliAmrKTbJNzKaORDZySSz1POe1RY0YV8VWHkYWUdOhJqXx9MZSn5njXNXgVFZ1 0ZJDC4UqyhxEeB9hgFP6LQFC7qLFUkBLLgtCB+kjh7Ju8Jg89BT+aeRV+yzn1OV7oGNT mnyngE0BqFHHFY1TmXaeLKlr5Ik3LkHw1ClYXyx1ywvLPym6LJX8wF8SuIEzYt0j+W9z 8tzaFQlQeBRAu14fs7qz+LG121dCEYL2OLJUAYQ7REbUWfdyJgUyjZFbMAkuEmlWpbWh LYIn1SfhiAyT1sE5LaGgHPA43WVyQD8SgaS09cX/E9tdP3ZlS8x0les+Z19xmZ1N8DML vSag== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXS7IYBkLahKxA626NTAM6" X-RZG-CLASS-ID: mo00 Received: from droid.. by smtp.strato.de (RZmta 47.27.2 DYNA|AUTH) with ESMTPSA id y01375x5A9uPso1 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Thu, 10 Jun 2021 11:56:25 +0200 (CEST) From: Stephan Gerhold To: Jonathan Cameron Cc: Lars-Peter Clausen , Rob Herring , Linus Walleij , Peter Meerwald , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, Bastien Nocera , Laurentiu Palcu , Hans de Goede , Andy Shevchenko , Stephan Gerhold Subject: [PATCH 3/6] iio: accel: bmc150: Add device IDs for BMA253 Date: Thu, 10 Jun 2021 11:52:57 +0200 Message-Id: <20210610095300.3613-4-stephan@gerhold.net> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210610095300.3613-1-stephan@gerhold.net> References: <20210610095300.3613-1-stephan@gerhold.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org BMA253 is mostly like BMA255 and has exactly the same register layout as used by the bmc150-accel driver as far I can tell. Making it work is as simple as adding new device IDs for it since it has the same chip_id = 0xFA (250) as BMA255 and others. Reviewed-by: Linus Walleij Signed-off-by: Stephan Gerhold --- drivers/iio/accel/Kconfig | 2 +- drivers/iio/accel/bmc150-accel-core.c | 4 ++-- drivers/iio/accel/bmc150-accel-i2c.c | 2 ++ drivers/iio/accel/bmc150-accel-spi.c | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig index 17f6bdcf1db3..f68c14f02d6b 100644 --- a/drivers/iio/accel/Kconfig +++ b/drivers/iio/accel/Kconfig @@ -143,7 +143,7 @@ config BMC150_ACCEL select BMC150_ACCEL_SPI if SPI help Say yes here to build support for the following Bosch accelerometers: - BMC150, BMI055, BMA250E, BMA222E, BMA255, BMA280. + BMC150, BMI055, BMA250E, BMA222E, BMA253, BMA255, BMA280. This is a combo module with both accelerometer and magnetometer. This driver is only implementing accelerometer part, which has diff --git a/drivers/iio/accel/bmc150-accel-core.c b/drivers/iio/accel/bmc150-accel-core.c index d4349f749485..21abc8d166e6 100644 --- a/drivers/iio/accel/bmc150-accel-core.c +++ b/drivers/iio/accel/bmc150-accel-core.c @@ -3,7 +3,7 @@ * 3-axis accelerometer driver supporting following Bosch-Sensortec chips: * - BMC150 * - BMI055 - * - BMA255 + * - BMA253/BMA255 * - BMA250E * - BMA222 * - BMA222E @@ -1098,7 +1098,7 @@ static const struct iio_chan_spec bma280_accel_channels[] = static const struct bmc150_accel_chip_info bmc150_accel_chip_info_tbl[] = { { - .name = "BMC150/BMI055/BMA255", + .name = "BMC150/BMI055/BMA253/BMA255", .chip_id = 0xFA, .channels = bmc150_accel_channels, .num_channels = ARRAY_SIZE(bmc150_accel_channels), diff --git a/drivers/iio/accel/bmc150-accel-i2c.c b/drivers/iio/accel/bmc150-accel-i2c.c index b8bda0dfb495..a87306f03a4c 100644 --- a/drivers/iio/accel/bmc150-accel-i2c.c +++ b/drivers/iio/accel/bmc150-accel-i2c.c @@ -238,6 +238,7 @@ MODULE_DEVICE_TABLE(acpi, bmc150_accel_acpi_match); static const struct i2c_device_id bmc150_accel_id[] = { {"bmc150_accel"}, {"bmi055_accel"}, + {"bma253"}, {"bma255"}, {"bma250e"}, {"bma222"}, @@ -251,6 +252,7 @@ MODULE_DEVICE_TABLE(i2c, bmc150_accel_id); static const struct of_device_id bmc150_accel_of_match[] = { { .compatible = "bosch,bmc150_accel" }, { .compatible = "bosch,bmi055_accel" }, + { .compatible = "bosch,bma253" }, { .compatible = "bosch,bma255" }, { .compatible = "bosch,bma250e" }, { .compatible = "bosch,bma222" }, diff --git a/drivers/iio/accel/bmc150-accel-spi.c b/drivers/iio/accel/bmc150-accel-spi.c index 01b42fa6a015..dec7dd252658 100644 --- a/drivers/iio/accel/bmc150-accel-spi.c +++ b/drivers/iio/accel/bmc150-accel-spi.c @@ -49,6 +49,7 @@ MODULE_DEVICE_TABLE(acpi, bmc150_accel_acpi_match); static const struct spi_device_id bmc150_accel_id[] = { {"bmc150_accel"}, {"bmi055_accel"}, + {"bma253"}, {"bma255"}, {"bma250e"}, {"bma222"}, From patchwork Thu Jun 10 09:52:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 12312521 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2658C48BD1 for ; Thu, 10 Jun 2021 09:59:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 83A7961359 for ; Thu, 10 Jun 2021 09:59:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229935AbhFJKBY (ORCPT ); Thu, 10 Jun 2021 06:01:24 -0400 Received: from mo4-p02-ob.smtp.rzone.de ([85.215.255.80]:33276 "EHLO mo4-p02-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229770AbhFJKBY (ORCPT ); Thu, 10 Jun 2021 06:01:24 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1623318986; cv=none; d=strato.com; s=strato-dkim-0002; b=TTLliUPITIGp9qJoCkRy9QEboMPfPULvED4DLCYnZ0krf4+/5P41izI9Rr2ju6/jH6 ZTPt7m9q1x3G5HvpSgvmKNnMQYrcyFmVWNt36K8Y2eqHPo0+vyeGPRJa19/a+KuV+DMy QWfh1an9z1NBN3YnCbzR7uBpecjS4WVJCrZ60M7sBK5SjoLd20KQaGFFxNmHD5Fib3uG BdYGpsN3DL3A7GdWAo7lmBDT+7o2s3+vf9KqcMuMixeQM41NnJjBAqVs2uiW/cFiA6q6 6jtDYBHqTbtNACc0QzLct0Osug5Y5kq3GVlm4vBdIJkb9BA+DxrVWI1CCSLj6w75e+Hf 9iUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1623318986; s=strato-dkim-0002; d=strato.com; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=Q3vxYG9DwGWTpHZF0muiHrGzUfeM8Kn9aAfnCoRgf8w=; b=lzfKLLYBvGaaShc/XWjIJRXh7frgqdLFFiweCrQkrPiQYGZllU/z6mUtzQxHFsgUdP 5HX3awpnm/7tDu5TYJaIYuFpeHuHn2bqG0sEkOl5vX+v955hY4QpFofNhAZtVaiOd+kA NQsstxFHz85XBs5i5rlUZj46ggYxDEsxuTt6YZO8qHWOGJJ8SfL6Rd74DLIALjeWVByn ZeMji+A958+E8zK0xE+nqpIRxoP2x2nqaZNkGanYDD65RsCiTbMAweS9LFF/ZuCqncqa uZl5JUx8Z2MAD82YB+kM4Ypwy6NEKCnOZMT3D3OMe/2I0IQjNBsUFInkuO1fSQW3C8vo wHAQ== ARC-Authentication-Results: i=1; strato.com; dkim=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1623318986; s=strato-dkim-0002; d=gerhold.net; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=Q3vxYG9DwGWTpHZF0muiHrGzUfeM8Kn9aAfnCoRgf8w=; b=lEHXrVIEyRaH5tmEBLJTqhYBjpfmbOPV37r47sOxRSyTLGOwCPyw+IvYVg31HWk9vk J7HbpTaB1xn6vIrz76UJd0NxvbrzgKD5gW6FC2TZACfFGuhvXVIIcyIBMK2FHKrDUgAn CzNxY4vdPLwfVmaf5PdYwcc8hzDqJ+jCs7W2HL5yMiAnHmKAw11PXKMHLV+mo39/eLpy PA1/0SS+I/vITFKTCOyM2uAwAo8FRUcnN5HJnwJGTnYSELYTrj0AAVHVMhe8i5nwYwlj GAkNUsZJTIkTSUpFX954zjweBPB+tzzFUdY/dAnSub+iuB612ZgF1tcGHP8+n+l+DYmY mEhA== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXS7IYBkLahKxA626NTAM6" X-RZG-CLASS-ID: mo00 Received: from droid.. by smtp.strato.de (RZmta 47.27.2 DYNA|AUTH) with ESMTPSA id y01375x5A9uPso2 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Thu, 10 Jun 2021 11:56:25 +0200 (CEST) From: Stephan Gerhold To: Jonathan Cameron Cc: Lars-Peter Clausen , Rob Herring , Linus Walleij , Peter Meerwald , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, Bastien Nocera , Laurentiu Palcu , Hans de Goede , Andy Shevchenko , Stephan Gerhold Subject: [PATCH 4/6] dt-bindings: iio: bma255: Allow multiple interrupts Date: Thu, 10 Jun 2021 11:52:58 +0200 Message-Id: <20210610095300.3613-5-stephan@gerhold.net> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210610095300.3613-1-stephan@gerhold.net> References: <20210610095300.3613-1-stephan@gerhold.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org BMA253 has two interrupt pins (INT1 and INT2) that can be configured independently. At the moment the bmc150-accel driver does not make use of them but it might be able to in the future, so it's useful to already specify all available interrupts in the device tree. Set maxItems: 2 for interrupts to allow specifying a second one. This is necessary as preparation to move the bosch,bma254 compatible from bosch,bma180.yaml to bosch,bma255.yaml since bma180 allows two interrupts, but BMA254 is better supported by the bmc150-accel driver. Reviewed-by: Linus Walleij Signed-off-by: Stephan Gerhold --- .../devicetree/bindings/iio/accel/bosch,bma255.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/iio/accel/bosch,bma255.yaml b/Documentation/devicetree/bindings/iio/accel/bosch,bma255.yaml index 8afb0fe8ef5c..65b299a5619b 100644 --- a/Documentation/devicetree/bindings/iio/accel/bosch,bma255.yaml +++ b/Documentation/devicetree/bindings/iio/accel/bosch,bma255.yaml @@ -32,7 +32,12 @@ properties: vddio-supply: true interrupts: - maxItems: 1 + minItems: 1 + maxItems: 2 + description: | + The first interrupt listed must be the one connected to the INT1 pin, + the second (optional) interrupt listed must be the one connected to the + INT2 pin (if available). mount-matrix: description: an optional 3x3 mounting rotation matrix. From patchwork Thu Jun 10 09:52:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 12312527 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76231C47094 for ; Thu, 10 Jun 2021 10:02:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5D26461184 for ; Thu, 10 Jun 2021 10:02:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229770AbhFJKE1 (ORCPT ); Thu, 10 Jun 2021 06:04:27 -0400 Received: from mo4-p02-ob.smtp.rzone.de ([85.215.255.82]:18624 "EHLO mo4-p02-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229937AbhFJKE1 (ORCPT ); Thu, 10 Jun 2021 06:04:27 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1623318987; cv=none; d=strato.com; s=strato-dkim-0002; b=fxgXaoic9waSnvARpFd+Os3vVaEyzZ0wc1nVBXtaRvquoezsGFFIXauCRxRZeGtuy4 gfS4sfD6UjjvOP3KSoeUFJfBQb/94lkLrNimZ4nmTSaxxYcEsafsscx32Z33aOzBcG95 Oyija0NHOcfdlTMp5IBlA/Y2fVh39OOIT6fKMchWDfR9c6xTvdrQ7hQQs+tdWB+pKqhQ Lvl8TQDJl9UBGsxU8iuQEnO8eBRFZyJQmD1aKGbFDAakxYFDM6tnGW4oJ8SoN3JBkaVz 8K8ImBlg0iUBTC5Mou74C1Se82+8RvsYnBZT0MaKC3GsE936hIRgCWT6je9w7sKQXLh6 //aA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1623318987; s=strato-dkim-0002; d=strato.com; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=AH2P9XfKb0PEYAd9xaBbRcSiO7z56XjX7li+ixOW9Ww=; b=pLuGvtHZkxoeE93rlX6PxRKULbl7OZm8so5SIGTZghbHdMzCYz4DP7/gNTkqeL72Kn YJOFYyb7f1BC/rVf9j0GXnohucGVdt2pjvePMdhiYq7QKqLoTE9TE1AJEgPSDdYwhJNi xTpCAoi+YYY9fRPHWBjmsu2POb6rQYj2vyvpROvzldkJFl0rV+vo/0mwhEfK6fmFoyKt gYHE1QSFR+H7AunCYhPCOVPgvf3phwFnDFXCd2yOVSZr0j0weEokvDU4xo8Ti7vtt24u Lk5NXvE5jezdJ2E1SzktUDwvqDxZ5d11h+yFkMpage9lFc0H7zoEJRyciRDjb1g6wEru b8+A== ARC-Authentication-Results: i=1; strato.com; dkim=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1623318987; s=strato-dkim-0002; d=gerhold.net; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=AH2P9XfKb0PEYAd9xaBbRcSiO7z56XjX7li+ixOW9Ww=; b=bo4Lhqu2H7jnLd4cbaxhp0liYvO0DlJGA3YVlT6qj+ALwOGrche7LmnSpRhTq3AJOO k7CZ1UzpsDirNlCs3cgo950X4h+DrtSCjgs5nRHTDu/VUOvRDdGqR6PqSWpkyO3o8O51 RpCe+//i8r911cDHSs6aa1qJnrzY4FyC32Lrambtk9LeqKBpNa3Am5WTo6RHdzkncjy8 J+PjoWzqfXrCmDWYA8W5XvBe6aHF9UdJ5x7hEk+dKa2tG9kLhgHYO57Rm0SSNa8csLDG k9AVnkX7jy0CILPlbq64ltXwlRd5eJq/IpWIIbxRROk9pcAVy59KdQwb79+t3K08bfnd NmHg== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXS7IYBkLahKxA626NTAM6" X-RZG-CLASS-ID: mo00 Received: from droid.. by smtp.strato.de (RZmta 47.27.2 DYNA|AUTH) with ESMTPSA id y01375x5A9uQso3 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Thu, 10 Jun 2021 11:56:26 +0200 (CEST) From: Stephan Gerhold To: Jonathan Cameron Cc: Lars-Peter Clausen , Rob Herring , Linus Walleij , Peter Meerwald , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, Bastien Nocera , Laurentiu Palcu , Hans de Goede , Andy Shevchenko , Stephan Gerhold Subject: [PATCH 5/6] dt-bindings: iio: accel: bma180/bma255: Move bma254 to bma255 schema Date: Thu, 10 Jun 2021 11:52:59 +0200 Message-Id: <20210610095300.3613-6-stephan@gerhold.net> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210610095300.3613-1-stephan@gerhold.net> References: <20210610095300.3613-1-stephan@gerhold.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org BMA254 is very similar to BMA253/BMA255 which are both supported by the bmc150-accel driver. In general, there is quite some overlap between the bma180 and bmc150-accel driver, but the bmc150-accel driver has a few more features (e.g. motion trigger/interrupt). Let's move bma254 over to the bma255 schema (bmc150-accel driver). Reviewed-by: Linus Walleij Signed-off-by: Stephan Gerhold --- Documentation/devicetree/bindings/iio/accel/bosch,bma180.yaml | 3 +-- Documentation/devicetree/bindings/iio/accel/bosch,bma255.yaml | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/iio/accel/bosch,bma180.yaml b/Documentation/devicetree/bindings/iio/accel/bosch,bma180.yaml index 45b3abde298f..a7e84089cc3d 100644 --- a/Documentation/devicetree/bindings/iio/accel/bosch,bma180.yaml +++ b/Documentation/devicetree/bindings/iio/accel/bosch,bma180.yaml @@ -4,7 +4,7 @@ $id: http://devicetree.org/schemas/iio/accel/bosch,bma180.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# -title: Bosch BMA023 / BMA150/ BMA180 / BMA25x / SMB380 triaxial accelerometers +title: Bosch BMA023 / BMA150/ BMA180 / BMA250 / SMB380 triaxial accelerometers maintainers: - Jonathan Cameron @@ -21,7 +21,6 @@ properties: - bosch,bma150 - bosch,bma180 - bosch,bma250 - - bosch,bma254 - bosch,smb380 reg: diff --git a/Documentation/devicetree/bindings/iio/accel/bosch,bma255.yaml b/Documentation/devicetree/bindings/iio/accel/bosch,bma255.yaml index 65b299a5619b..e830d5295b92 100644 --- a/Documentation/devicetree/bindings/iio/accel/bosch,bma255.yaml +++ b/Documentation/devicetree/bindings/iio/accel/bosch,bma255.yaml @@ -19,6 +19,7 @@ properties: - bosch,bmc150_accel - bosch,bmi055_accel - bosch,bma253 + - bosch,bma254 - bosch,bma255 - bosch,bma250e - bosch,bma222 From patchwork Thu Jun 10 09:53:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 12312523 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D826C47094 for ; Thu, 10 Jun 2021 09:59:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 484E161359 for ; Thu, 10 Jun 2021 09:59:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229961AbhFJKBY (ORCPT ); Thu, 10 Jun 2021 06:01:24 -0400 Received: from mo4-p03-ob.smtp.rzone.de ([85.215.255.101]:32022 "EHLO mo4-p03-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229935AbhFJKBX (ORCPT ); Thu, 10 Jun 2021 06:01:23 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1623318987; cv=none; d=strato.com; s=strato-dkim-0002; b=I7G05qoF5TMj7qf8zcKJM09yC2BGb1c3UFjWoEx6vcN9qEi6aoP8qk95AHjpVJyVK9 yNd8cv4+wuY5BOQgUqx1lOZw51AVvzmx17GargE5ANYyewaW7Jzq94Jrmyb+KfNhzb77 z8hbyVdsJriUA342LYE25Awg0h3fQTQTpLkjjtsdqT8YIwKB61KJAgoR8ENO2X10I+9d mB7hNLlxEf2IIYbYfphBZElm3LjL1ujHlxcar+LKbBTwHRTENO4vqf+tjOYG9BqM7jne SMzuruiVhfCxLaXwGU6u9R2vmWonigc0uinVbgQFrP6ZogT7NbdWbRadXmuWDcFLwE/r juSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1623318987; s=strato-dkim-0002; d=strato.com; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=s/8S0a6AHAFtunnNacWQ6tVD7pAvYC0ejOcx8N11Img=; b=GNwJyMyGoAH//G39Agxbcyk4OXSWMshJI0SfEO8HmwVF0g4+JYNF6wyJxnlWVAz1zA vyDRYsVKrP73hI1J4Qci0M1m6hUskeiH2AFWozkk+wrCQsuJwUAusLPy+YKnsf6vOdMR HMNorf3OKtvzqC8ptmVLgmxIoAwMCVyfUh+KwyC2h2BhOIieJRjxLsu+HbpDHXgnnhbZ b+wYOr1T0XYtWFIT3p5SrdNx/RJzMYlOtv9foPGI5OExLYDmsrCcqQNWjslEIYHu2dBC FwkUQOnaoth2xFqWMqvb6dO1W4ZbCzBs1BRUpMiGPF+CO52Jtka95qTIw1mYlzahhmXg gZKw== ARC-Authentication-Results: i=1; strato.com; dkim=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1623318987; s=strato-dkim-0002; d=gerhold.net; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=s/8S0a6AHAFtunnNacWQ6tVD7pAvYC0ejOcx8N11Img=; b=beYR1zvuSdrxhbnYOSMJi68EX8q6XZAP64fNUU4/ugc0d2W2vkBNaBTIiG+R68dO41 WSZyZlrHgeLtf/1uv0RYE1EZfFwM5IcLjASRfagMYiM8dLPwVk9IgDPYfRhETN87RjNn Mu8b4x7lrZOeyLUHSBrOryCBMcbe506KhpiUCilUR4sCJ3w1I8ZXETkrv1d46Y+Ondpg wxbqZ9fNoBZstTbg7L6vxAq2ynnlrwVd0YCk3pv0a00r3ToN3iQr7FVY7vzRcncpwp6z ObfUSChK5EjqtKL1bZDqrBDwHmVFYaS1DgPY0Fi3NLA63f6f1U3lSXd/mU76EUogwejl dsZg== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXS7IYBkLahKxA626NTAM6" X-RZG-CLASS-ID: mo00 Received: from droid.. by smtp.strato.de (RZmta 47.27.2 DYNA|AUTH) with ESMTPSA id y01375x5A9uRso4 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Thu, 10 Jun 2021 11:56:27 +0200 (CEST) From: Stephan Gerhold To: Jonathan Cameron Cc: Lars-Peter Clausen , Rob Herring , Linus Walleij , Peter Meerwald , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, Bastien Nocera , Laurentiu Palcu , Hans de Goede , Andy Shevchenko , Stephan Gerhold Subject: [PATCH 6/6] iio: accel: bma180/bmc150: Move BMA254 to bmc150-accel driver Date: Thu, 10 Jun 2021 11:53:00 +0200 Message-Id: <20210610095300.3613-7-stephan@gerhold.net> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210610095300.3613-1-stephan@gerhold.net> References: <20210610095300.3613-1-stephan@gerhold.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Commit c1d1c4a62db5 ("iio: accel: bma180: BMA254 support") added BMA254 support to the bma180 driver and changed some naming to BMA25x to make it easier to add support for BMA253 and BMA255. Unfortunately, there is quite some overlap between the bma180 driver and the bmc150-accel driver. Back when the commit was made, the bmc150-accel driver actually already had support for BMA255, and adding support for BMA254 would have been as simple as adding a new compatible to bmc150-accel. The bmc150-accel driver is a bit better for BMA254 since it also supports the motion trigger/interrupt functionality. Fortunately, moving BMA254 support over to bmc150-accel is fairly simple because the drivers have compatible device tree bindings. Revert most of the changes for BMA254 support in bma180 and move BMA254 over to bmc150-accel. This has the following advantages: - Support for motion trigger/interrupt - Fix incorrect scale values (BMA254 currently uses the same as BMA250 but actually they're different because of 10 vs 12 bits data size) - Less code than before :) BMA250 could be potentially also moved but it's more complicated because its chip_id conflicts with the one for BMA222 in bmc150-accel. Perhaps there are also other register differences, I did not investigate further yet (and I have no way to test it). Cc: Peter Meerwald Cc: Laurentiu Palcu Reviewed-by: Linus Walleij Signed-off-by: Stephan Gerhold --- Note that the similarity between bma180 and bmc150-accel has already caused a lot of confusion in the past. See e.g. [1] where Hans accidentally added BMA250E support to bma180 even though that was already supported in bmc150-accel. Having BMA250 in bma180 and BMA250E in bmc150-accel was also discussed before in [2] but for some reason back then the conclusion was that they are different enough to justify that. Also note that this patch only applies cleanly on top of the "iio: accel: bma180: Fix BMA25x bandwidth register values" patch [3] that I sent earlier, which is not present in togreg/testing at the moment (only in fixes-togreg). [1]: https://lore.kernel.org/linux-iio/20170606203538.15250-1-hdegoede@redhat.com/ [2]: https://lore.kernel.org/linux-iio/alpine.DEB.2.01.1408281111250.3259@pmeerw.net/ [3]: https://lore.kernel.org/linux-iio/20210526094408.34298-2-stephan@gerhold.net/ --- drivers/iio/accel/Kconfig | 6 +- drivers/iio/accel/bma180.c | 91 ++++----------------------- drivers/iio/accel/bmc150-accel-core.c | 4 +- drivers/iio/accel/bmc150-accel-i2c.c | 2 + 4 files changed, 19 insertions(+), 84 deletions(-) diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig index f68c14f02d6b..b00c228b9bdc 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/BMA1x0/BMA25x 3-Axis Accelerometer Driver" + tristate "Bosch BMA023/BMA1x0/BMA250 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, BMA150 - BMA180, SMB380, or BMA25x triaxial acceleration sensor. + BMA180, SMB380, or BMA250 triaxial acceleration sensor. To compile this driver as a module, choose M here: the module will be called bma180. @@ -143,7 +143,7 @@ config BMC150_ACCEL select BMC150_ACCEL_SPI if SPI help Say yes here to build support for the following Bosch accelerometers: - BMC150, BMI055, BMA250E, BMA222E, BMA253, BMA255, BMA280. + BMC150, BMI055, BMA250E, BMA222E, BMA253, BMA254, BMA255, BMA280. This is a combo module with both accelerometer and magnetometer. This driver is only implementing accelerometer part, which has diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c index e7c6b3096cb7..ea1a604a53bf 100644 --- a/drivers/iio/accel/bma180.c +++ b/drivers/iio/accel/bma180.c @@ -38,7 +38,6 @@ enum chip_ids { BMA150, BMA180, BMA250, - BMA254, }; struct bma180_data; @@ -59,7 +58,6 @@ struct bma180_part_info { u8 scale_reg, scale_mask; 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, softreset_val; int (*chip_config)(struct bma180_data *data); @@ -112,7 +110,6 @@ struct bma180_part_info { #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 */ /* Chip power modes */ #define BMA180_LOW_POWER 0x03 @@ -134,24 +131,6 @@ struct bma180_part_info { #define BMA250_INT1_DATA_MASK BIT(0) #define BMA250_INT_RESET_MASK BIT(7) /* Reset pending interrupts */ -#define BMA254_RANGE_REG 0x0f -#define BMA254_BW_REG 0x10 -#define BMA254_POWER_REG 0x11 -#define BMA254_RESET_REG 0x14 -#define BMA254_INT_ENABLE_REG 0x17 -#define BMA254_INT_MAP_REG 0x1a -#define BMA254_INT_RESET_REG 0x21 - -#define BMA254_RANGE_MASK GENMASK(3, 0) /* Range of accel values */ -#define BMA254_BW_MASK GENMASK(4, 0) /* Accel bandwidth */ -#define BMA254_BW_OFFSET 8 -#define BMA254_SUSPEND_MASK BIT(7) /* chip will sleep */ -#define BMA254_LOWPOWER_MASK BIT(6) -#define BMA254_DATA_INTEN_MASK BIT(4) -#define BMA254_INT2_DATA_MASK BIT(7) -#define BMA254_INT1_DATA_MASK BIT(0) -#define BMA254_INT_RESET_MASK BIT(7) /* Reset pending interrupts */ - struct bma180_data { struct regulator *vdd_supply; struct regulator *vddio_supply; @@ -184,8 +163,8 @@ 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 }; -static int bma25x_bw_table[] = { 8, 16, 31, 63, 125, 250, 500, 1000 }; /* Hz */ -static int bma25x_scale_table[] = { 0, 0, 0, 38344, 0, 76590, 0, 0, 153180, 0, +static int bma250_bw_table[] = { 8, 16, 31, 63, 125, 250, 500, 1000 }; /* Hz */ +static int bma250_scale_table[] = { 0, 0, 0, 38344, 0, 76590, 0, 0, 153180, 0, 0, 0, 306458 }; static int bma180_get_data_reg(struct bma180_data *data, enum bma180_chan chan) @@ -432,7 +411,7 @@ static int bma180_chip_config(struct bma180_data *data) return ret; } -static int bma25x_chip_config(struct bma180_data *data) +static int bma250_chip_config(struct bma180_data *data) { int ret = bma180_chip_init(data); @@ -451,8 +430,7 @@ static int bma25x_chip_config(struct bma180_data *data) * This enables dataready interrupt on the INT1 pin * FIXME: support using the INT2 pin */ - ret = bma180_set_bits(data, data->part_info->int_map_reg, - data->part_info->int_enable_dataready_int1_mask, 1); + ret = bma180_set_bits(data, BMA250_INT_MAP_REG, BMA250_INT1_DATA_MASK, 1); if (ret) goto err; @@ -489,7 +467,7 @@ static void bma180_chip_disable(struct bma180_data *data) dev_err(&data->client->dev, "failed to disable the chip\n"); } -static void bma25x_chip_disable(struct bma180_data *data) +static void bma250_chip_disable(struct bma180_data *data) { if (bma180_set_new_data_intr_state(data, false)) goto err; @@ -775,14 +753,6 @@ static const struct iio_chan_spec bma250_channels[] = { IIO_CHAN_SOFT_TIMESTAMP(4), }; -static const struct iio_chan_spec bma254_channels[] = { - BMA180_ACC_CHANNEL(X, 12), - BMA180_ACC_CHANNEL(Y, 12), - BMA180_ACC_CHANNEL(Z, 12), - BMA180_TEMP_CHANNEL, - IIO_CHAN_SOFT_TIMESTAMP(4), -}; - static const struct bma180_part_info bma180_part_info[] = { [BMA023] = { .chip_id = BMA023_ID_REG_VAL, @@ -872,10 +842,10 @@ static const struct bma180_part_info bma180_part_info[] = { .chip_id = BMA250_ID_REG_VAL, .channels = bma250_channels, .num_channels = ARRAY_SIZE(bma250_channels), - .scale_table = bma25x_scale_table, - .num_scales = ARRAY_SIZE(bma25x_scale_table), - .bw_table = bma25x_bw_table, - .num_bw = ARRAY_SIZE(bma25x_bw_table), + .scale_table = bma250_scale_table, + .num_scales = ARRAY_SIZE(bma250_scale_table), + .bw_table = bma250_bw_table, + .num_bw = ARRAY_SIZE(bma250_bw_table), .temp_offset = 48, /* 0 LSB @ 24 degree C */ .int_reset_reg = BMA250_INT_RESET_REG, .int_reset_mask = BMA250_INT_RESET_MASK, @@ -891,42 +861,10 @@ static const struct bma180_part_info bma180_part_info[] = { .lowpower_val = 1, .int_enable_reg = BMA250_INT_ENABLE_REG, .int_enable_mask = BMA250_DATA_INTEN_MASK, - .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, - }, - [BMA254] = { - .chip_id = BMA254_ID_REG_VAL, - .channels = bma254_channels, - .num_channels = ARRAY_SIZE(bma254_channels), - .scale_table = bma25x_scale_table, - .num_scales = ARRAY_SIZE(bma25x_scale_table), - .bw_table = bma25x_bw_table, - .num_bw = ARRAY_SIZE(bma25x_bw_table), - .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, - .sleep_mask = BMA254_SUSPEND_MASK, - .bw_reg = BMA254_BW_REG, - .bw_mask = BMA254_BW_MASK, - .bw_offset = BMA254_BW_OFFSET, - .scale_reg = BMA254_RANGE_REG, - .scale_mask = BMA254_RANGE_MASK, - .power_reg = BMA254_POWER_REG, - .power_mask = BMA254_LOWPOWER_MASK, - .lowpower_val = 1, - .int_enable_reg = BMA254_INT_ENABLE_REG, - .int_enable_mask = BMA254_DATA_INTEN_MASK, - .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, + .chip_config = bma250_chip_config, + .chip_disable = bma250_chip_disable, }, }; @@ -1166,7 +1104,6 @@ static const struct i2c_device_id bma180_ids[] = { { "bma150", BMA150 }, { "bma180", BMA180 }, { "bma250", BMA250 }, - { "bma254", BMA254 }, { "smb380", BMA150 }, { } }; @@ -1190,10 +1127,6 @@ static const struct of_device_id bma180_of_match[] = { .compatible = "bosch,bma250", .data = (void *)BMA250 }, - { - .compatible = "bosch,bma254", - .data = (void *)BMA254 - }, { .compatible = "bosch,smb380", .data = (void *)BMA150 @@ -1217,5 +1150,5 @@ module_i2c_driver(bma180_driver); MODULE_AUTHOR("Kravchenko Oleksandr "); MODULE_AUTHOR("Texas Instruments, Inc."); -MODULE_DESCRIPTION("Bosch BMA023/BMA1x0/BMA25x triaxial acceleration sensor"); +MODULE_DESCRIPTION("Bosch BMA023/BMA1x0/BMA250 triaxial acceleration sensor"); MODULE_LICENSE("GPL"); diff --git a/drivers/iio/accel/bmc150-accel-core.c b/drivers/iio/accel/bmc150-accel-core.c index 21abc8d166e6..979da58fdb60 100644 --- a/drivers/iio/accel/bmc150-accel-core.c +++ b/drivers/iio/accel/bmc150-accel-core.c @@ -3,7 +3,7 @@ * 3-axis accelerometer driver supporting following Bosch-Sensortec chips: * - BMC150 * - BMI055 - * - BMA253/BMA255 + * - BMA253/BMA254/BMA255 * - BMA250E * - BMA222 * - BMA222E @@ -1098,7 +1098,7 @@ static const struct iio_chan_spec bma280_accel_channels[] = static const struct bmc150_accel_chip_info bmc150_accel_chip_info_tbl[] = { { - .name = "BMC150/BMI055/BMA253/BMA255", + .name = "BMC150/BMI055/BMA253/BMA254/BMA255", .chip_id = 0xFA, .channels = bmc150_accel_channels, .num_channels = ARRAY_SIZE(bmc150_accel_channels), diff --git a/drivers/iio/accel/bmc150-accel-i2c.c b/drivers/iio/accel/bmc150-accel-i2c.c index a87306f03a4c..8f0dfe03c919 100644 --- a/drivers/iio/accel/bmc150-accel-i2c.c +++ b/drivers/iio/accel/bmc150-accel-i2c.c @@ -239,6 +239,7 @@ static const struct i2c_device_id bmc150_accel_id[] = { {"bmc150_accel"}, {"bmi055_accel"}, {"bma253"}, + {"bma254"}, {"bma255"}, {"bma250e"}, {"bma222"}, @@ -253,6 +254,7 @@ static const struct of_device_id bmc150_accel_of_match[] = { { .compatible = "bosch,bmc150_accel" }, { .compatible = "bosch,bmi055_accel" }, { .compatible = "bosch,bma253" }, + { .compatible = "bosch,bma254" }, { .compatible = "bosch,bma255" }, { .compatible = "bosch,bma250e" }, { .compatible = "bosch,bma222" },