From patchwork Thu Apr 13 02:40:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marius Hoch X-Patchwork-Id: 13209706 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4980FC77B6C for ; Thu, 13 Apr 2023 02:43:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231386AbjDMCno (ORCPT ); Wed, 12 Apr 2023 22:43:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230368AbjDMCnb (ORCPT ); Wed, 12 Apr 2023 22:43:31 -0400 Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [IPv6:2001:67c:2050:0:465::201]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3474AF03; Wed, 12 Apr 2023 19:41:47 -0700 (PDT) Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4PxkN13ffqz9sRG; Thu, 13 Apr 2023 04:40:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mariushoch.de; s=MBO0001; t=1681353649; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ezPGoQ6QPL9E3+YlJ6ixpTBZV0SadJ4wrscpZIJ3NMk=; b=NyFJO2x81VdMnZ+DugaH+lK+f35Pg97wfEP3JY+AJanFWEtkKEeL4nwgBm1HEVpEkT50sN dxncQNfgFptAz3tDVVi6/acxdIIu7jfhaH8N/2FfmUqTGqCPErejCAB+0ltM9EBWy11FSP y+Z63ukRa5Daun5VEqIPTyq2nvlFiaGeD84M+hJl3NrUkWC0AAMYY0QmnKCK9Lc3tfG2b+ l2mZOBfzM6cfM0BD8ZLnnQTs8YgsBQAVvcsvaNi/fSTrmiARDap5UyRZuGSbEQn8+CJC3p U3/FV+VYtrZb6oCguTtbWxMV0xXBFnGHO5YBGN4Ru7CZWPKzBsxmbzBRaxBxuw== From: Marius Hoch To: Jonathan Cameron , Lars-Peter Clausen , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Hans de Goede , Marius Hoch Subject: [PATCH v2 1/6] iio: accel: st_accel: Add LSM303D Date: Thu, 13 Apr 2023 04:40:08 +0200 Message-Id: <20230413024013.450165-2-mail@mariushoch.de> In-Reply-To: <20230413024013.450165-1-mail@mariushoch.de> References: <20230413024013.450165-1-mail@mariushoch.de> MIME-Version: 1.0 X-Rspamd-Queue-Id: 4PxkN13ffqz9sRG Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org The lsm303d has the same register mapping as the lsm9ds0, thus we can just re-use that. Tested on a Lenovo Yoga Tablet 2 1051-F. Signed-off-by: Marius Hoch --- drivers/iio/accel/st_accel_core.c | 1 + include/linux/iio/common/st_sensors.h | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c index 6b8562f684d5..1628b177d0ed 100644 --- a/drivers/iio/accel/st_accel_core.c +++ b/drivers/iio/accel/st_accel_core.c @@ -1006,6 +1006,7 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = { .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS, .sensors_supported = { [0] = LSM9DS0_IMU_DEV_NAME, + [1] = LSM303D_IMU_DEV_NAME, }, .ch = (struct iio_chan_spec *)st_accel_16bit_channels, .odr = { diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h index f5f3ee57bc70..607c3a89a647 100644 --- a/include/linux/iio/common/st_sensors.h +++ b/include/linux/iio/common/st_sensors.h @@ -22,6 +22,7 @@ #include #define LSM9DS0_IMU_DEV_NAME "lsm9ds0" +#define LSM303D_IMU_DEV_NAME "lsm303d" /* * Buffer size max case: 2bytes per channel, 3 channels in total + From patchwork Thu Apr 13 02:40:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marius Hoch X-Patchwork-Id: 13209707 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D55AC77B6C for ; Thu, 13 Apr 2023 02:44:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231310AbjDMCoE (ORCPT ); Wed, 12 Apr 2023 22:44:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231344AbjDMCnv (ORCPT ); Wed, 12 Apr 2023 22:43:51 -0400 Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [IPv6:2001:67c:2050:0:465::101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7313B46B; Wed, 12 Apr 2023 19:42:13 -0700 (PDT) Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4PxkN22BQlz9sbr; Thu, 13 Apr 2023 04:40:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mariushoch.de; s=MBO0001; t=1681353650; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aaBdxoh2tTQE/D7UbYD1GfSy8FZRjzStnfxmiQyyUCU=; b=DxoskY+i2dbZ/tkqUH4kPxL2ephBrr4AA5K4PTbhRxM5SZrYFyk2oYMEojAxi9tSgvC3XZ 5vbs8TiuawzJNAv9rv7qXbXEWbFavWB1gUYjjmUyY9Km7UWKoDQi9qpRbGz9lekFnif5Qq kQyW0Y3TKK1SU+adYQF4g+zhXaA6Zg655RMCR2hqOfPS6hPFk3CvtGPlpo6gU/Gd7mt2aB MYj67gwB7+ME+gAYW2fuP56iieDh6z8GZCTJdfZXS69rZn3Xo6O14P8H5p2S7ZPtuN3HPX 4NAl+rr0ZUAvPbwwDjV6lM/JXubywo7uYRrL5eRfkQ1VPpG9R0KhiCASRCfEOQ== From: Marius Hoch To: Jonathan Cameron , Lars-Peter Clausen , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Hans de Goede , Marius Hoch Subject: [PATCH v2 2/6] iio: magnetometer: st_accel: Add LSM303D Date: Thu, 13 Apr 2023 04:40:09 +0200 Message-Id: <20230413024013.450165-3-mail@mariushoch.de> In-Reply-To: <20230413024013.450165-1-mail@mariushoch.de> References: <20230413024013.450165-1-mail@mariushoch.de> MIME-Version: 1.0 X-Rspamd-Queue-Id: 4PxkN22BQlz9sbr Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org The lsm303d has the same register mapping as the lsm9ds0, thus we can just re-use that. Tested on a Lenovo Yoga Tablet 2 1051-F. Signed-off-by: Marius Hoch --- drivers/iio/magnetometer/st_magn_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c index 8faa7409d9e1..6cc0dfd31821 100644 --- a/drivers/iio/magnetometer/st_magn_core.c +++ b/drivers/iio/magnetometer/st_magn_core.c @@ -427,6 +427,7 @@ static const struct st_sensor_settings st_magn_sensors_settings[] = { .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS, .sensors_supported = { [0] = LSM9DS0_IMU_DEV_NAME, + [1] = LSM303D_IMU_DEV_NAME, }, .ch = (struct iio_chan_spec *)st_magn_4_16bit_channels, .odr = { From patchwork Thu Apr 13 02:40:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marius Hoch X-Patchwork-Id: 13209710 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D81AC77B71 for ; Thu, 13 Apr 2023 02:47:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231476AbjDMCrx (ORCPT ); Wed, 12 Apr 2023 22:47:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231442AbjDMCre (ORCPT ); Wed, 12 Apr 2023 22:47:34 -0400 Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [IPv6:2001:67c:2050:0:465::201]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 754FD974D; Wed, 12 Apr 2023 19:46:52 -0700 (PDT) Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4PxkN31FL5z9sb6; Thu, 13 Apr 2023 04:40:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mariushoch.de; s=MBO0001; t=1681353651; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=usGOq1CJVdyzoBS9/FtpRn4wOOe3OcKpt0J8nGiDhmo=; b=TZKDdSchNdL2FRjSGpdzfn7EZVw32kQ6v19POPmppGLeGnKkha8lq254z5KvcV5gb5KxEe IVRlAErdAsnstZPgwEgjWyMYvgyPfrXJpJaU5QpfvKQrqxUQkeFOL63BIrp1LYCvQTyFZI KFY2/mSmFZkBYNvVo2No0aQuKFLXoIosKoy7vmBnxmJxJ5ad1oKxxLJ3o0qYHDWVXYjx6l 1OppeeJsXZcwYvIoBkSw+Zuli9WvaXSOHEp7AhPUzxGHw7zptzRdaXJeMjZlmorwRjGqEu 0QV2BTOlMtA08aerS/n1kKk6vOGEAXAANSxfy4+JSEyu0G3iPUT8VszJ6S2cLg== From: Marius Hoch To: Jonathan Cameron , Lars-Peter Clausen , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Hans de Goede , Marius Hoch Subject: [PATCH v2 3/6] iio: st_sensors: Add lsm303d support to the LSM9DS0 IMU driver Date: Thu, 13 Apr 2023 04:40:10 +0200 Message-Id: <20230413024013.450165-4-mail@mariushoch.de> In-Reply-To: <20230413024013.450165-1-mail@mariushoch.de> References: <20230413024013.450165-1-mail@mariushoch.de> MIME-Version: 1.0 X-Rspamd-Queue-Id: 4PxkN31FL5z9sb6 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org The lsm303d is basically the lsm9ds0 without the gyroscope (which the LSM9DS0 IMU driver doesn't handle), as far as I can tell. Signed-off-by: Marius Hoch --- drivers/iio/imu/st_lsm9ds0/Kconfig | 3 ++- drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c | 5 +++++ drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c | 5 +++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/iio/imu/st_lsm9ds0/Kconfig b/drivers/iio/imu/st_lsm9ds0/Kconfig index d29558edee60..7aef714b6ecb 100644 --- a/drivers/iio/imu/st_lsm9ds0/Kconfig +++ b/drivers/iio/imu/st_lsm9ds0/Kconfig @@ -10,7 +10,8 @@ config IIO_ST_LSM9DS0 help Say yes here to build support for STMicroelectronics LSM9DS0 IMU - sensor. Supported devices: accelerometer/magnetometer of lsm9ds0. + sensor. Supported devices: accelerometer/magnetometer of lsm9ds0 + and lsm303d. To compile this driver as a module, choose M here: the module will be called st_lsm9ds0. diff --git a/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c b/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c index a90138d8b06a..64fa77d302e2 100644 --- a/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c +++ b/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c @@ -22,12 +22,17 @@ static const struct of_device_id st_lsm9ds0_of_match[] = { .compatible = "st,lsm9ds0-imu", .data = LSM9DS0_IMU_DEV_NAME, }, + { + .compatible = "st,lsm303d-imu", + .data = LSM303D_IMU_DEV_NAME, + }, {} }; MODULE_DEVICE_TABLE(of, st_lsm9ds0_of_match); static const struct i2c_device_id st_lsm9ds0_id_table[] = { { LSM9DS0_IMU_DEV_NAME }, + { LSM303D_IMU_DEV_NAME }, {} }; MODULE_DEVICE_TABLE(i2c, st_lsm9ds0_id_table); diff --git a/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c b/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c index b743bf3546a7..997b5ff792be 100644 --- a/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c +++ b/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c @@ -22,12 +22,17 @@ static const struct of_device_id st_lsm9ds0_of_match[] = { .compatible = "st,lsm9ds0-imu", .data = LSM9DS0_IMU_DEV_NAME, }, + { + .compatible = "st,lsm303d-imu", + .data = LSM303D_IMU_DEV_NAME, + }, {} }; MODULE_DEVICE_TABLE(of, st_lsm9ds0_of_match); static const struct spi_device_id st_lsm9ds0_id_table[] = { { LSM9DS0_IMU_DEV_NAME }, + { LSM303D_IMU_DEV_NAME }, {} }; MODULE_DEVICE_TABLE(spi, st_lsm9ds0_id_table); From patchwork Thu Apr 13 02:40:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marius Hoch X-Patchwork-Id: 13209709 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B460CC7619A for ; Thu, 13 Apr 2023 02:47:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231367AbjDMCrv (ORCPT ); Wed, 12 Apr 2023 22:47:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231403AbjDMCrd (ORCPT ); Wed, 12 Apr 2023 22:47:33 -0400 X-Greylist: delayed 265 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 12 Apr 2023 19:46:49 PDT Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [IPv6:2001:67c:2050:0:465::202]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 840EA8688; Wed, 12 Apr 2023 19:46:49 -0700 (PDT) Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4PxkN4098Tz9sW7; Thu, 13 Apr 2023 04:40:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mariushoch.de; s=MBO0001; t=1681353652; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=u6B1bFXAyzsSJvYmAWEAApxtGKWP89Sc927vG7m18Ho=; b=qN/ysTgqnUtMu96dGz6+QOdq3DdleOZlC484HAX+2OI4wDQXEscsjJEav+aPj8bfHNfkEs SOPbj8z+sAuomNbJ1zCzNQkUugVmg/doGVVVLYOx4ceW58OZpdT7VyWXASBJykyDWx5ZFh 6xkQ0FXpcY28wwxArfBUq6C42lNBvlgPGp+j3wOL7/uR6l7Pt8brLfmq4/sFKvCprJflBi NO/nT2j73WfnfzmgueD3evVqQWjyyVAUj1BORVHVW+kj7YTs9HGOQw3YsiQRDsuP2wc+QX DYNIr4rPK9fj1BMbYWBqocYl3Uan4ax/k4ASECsV6fHP6N/PJmBKyJYmZ1Tt9g== From: Marius Hoch To: Jonathan Cameron , Lars-Peter Clausen , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Hans de Goede , Marius Hoch Subject: [PATCH v2 4/6] iio: st_sensors: Add ACPI support for lsm303d to the LSM9DS0 IMU driver Date: Thu, 13 Apr 2023 04:40:11 +0200 Message-Id: <20230413024013.450165-5-mail@mariushoch.de> In-Reply-To: <20230413024013.450165-1-mail@mariushoch.de> References: <20230413024013.450165-1-mail@mariushoch.de> MIME-Version: 1.0 X-Rspamd-Queue-Id: 4PxkN4098Tz9sW7 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org The lsm303d can be found as ACCL0001 on various Lenovo devices, including the Lenovo Yoga Tablet 2 1051-F, where I tested this patch. Signed-off-by: Marius Hoch --- drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c | 10 ++++++++++ drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c b/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c index 64fa77d302e2..79be8d28d965 100644 --- a/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c +++ b/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c @@ -12,6 +12,7 @@ #include #include #include +#include #include @@ -37,6 +38,14 @@ static const struct i2c_device_id st_lsm9ds0_id_table[] = { }; MODULE_DEVICE_TABLE(i2c, st_lsm9ds0_id_table); +#ifdef CONFIG_ACPI +static const struct acpi_device_id st_lsm9ds0_acpi_match[] = { + {"ACCL0001", (kernel_ulong_t)LSM303D_IMU_DEV_NAME}, + { }, +}; +MODULE_DEVICE_TABLE(acpi, st_lsm9ds0_acpi_match); +#endif + static const struct regmap_config st_lsm9ds0_regmap_config = { .reg_bits = 8, .val_bits = 8, @@ -73,6 +82,7 @@ static struct i2c_driver st_lsm9ds0_driver = { .driver = { .name = "st-lsm9ds0-i2c", .of_match_table = st_lsm9ds0_of_match, + .acpi_match_table = ACPI_PTR(st_lsm9ds0_acpi_match), }, .probe_new = st_lsm9ds0_i2c_probe, .id_table = st_lsm9ds0_id_table, diff --git a/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c b/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c index 997b5ff792be..27c5d99ce0e3 100644 --- a/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c +++ b/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c @@ -12,6 +12,7 @@ #include #include #include +#include #include @@ -37,6 +38,14 @@ static const struct spi_device_id st_lsm9ds0_id_table[] = { }; MODULE_DEVICE_TABLE(spi, st_lsm9ds0_id_table); +#ifdef CONFIG_ACPI +static const struct acpi_device_id st_lsm9ds0_acpi_match[] = { + {"ACCL0001", (kernel_ulong_t)LSM303D_IMU_DEV_NAME}, + { }, +}; +MODULE_DEVICE_TABLE(acpi, st_lsm9ds0_acpi_match); +#endif + static const struct regmap_config st_lsm9ds0_regmap_config = { .reg_bits = 8, .val_bits = 8, @@ -72,6 +81,7 @@ static struct spi_driver st_lsm9ds0_driver = { .driver = { .name = "st-lsm9ds0-spi", .of_match_table = st_lsm9ds0_of_match, + .acpi_match_table = ACPI_PTR(st_lsm9ds0_acpi_match), }, .probe = st_lsm9ds0_spi_probe, .id_table = st_lsm9ds0_id_table, From patchwork Thu Apr 13 02:40:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marius Hoch X-Patchwork-Id: 13209715 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1A29C77B73 for ; Thu, 13 Apr 2023 02:53:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230103AbjDMCxu (ORCPT ); Wed, 12 Apr 2023 22:53:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229965AbjDMCxs (ORCPT ); Wed, 12 Apr 2023 22:53:48 -0400 Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [IPv6:2001:67c:2050:0:465::202]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0A3530F3; Wed, 12 Apr 2023 19:53:35 -0700 (PDT) Received: from smtp2.mailbox.org (unknown [10.196.197.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4PxkN45v9Cz9sq6; Thu, 13 Apr 2023 04:40:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mariushoch.de; s=MBO0001; t=1681353652; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HD1lsfuCz1zmXZ1k8I21GKrPVmmS4V4XSfqP1z1rnxs=; b=z2Qt8IDEQEvOQ1bJm9Hbnt6VRPiPGwja0xbvii+FFXgsMng94u/EKMkTcBHlSCN2LV32up MY5SqXNLF3is69vBBr2d2Y97GDgSnrFOfLQb8KIQJRvShZ9YEd+Z1mqGqen3DDsetjVQaK R+sCxvKzbYNEDU0gDk1Pu1W2gAIYTiEqDHHsQNjeXuiv2EuQKOUWQBHbujf1G1C3jFe++L 0OAyqKlOVC4zP2Etwp564MIWtyn+RbtLJ2wkBxOwuDOxRRrAelNzLRFOky0yeHVx2GvLVF 5LJSgvfLCdFiYokFnYsPFKIsv6uEkYKt3uyQbGuVq3iIAXsTU5vEbqonCD2o1A== From: Marius Hoch To: Jonathan Cameron , Lars-Peter Clausen , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Hans de Goede , Marius Hoch Subject: [PATCH v2 5/6] iio: Comment that the LSM303D also has the Magnetometer DRDY Date: Thu, 13 Apr 2023 04:40:12 +0200 Message-Id: <20230413024013.450165-6-mail@mariushoch.de> In-Reply-To: <20230413024013.450165-1-mail@mariushoch.de> References: <20230413024013.450165-1-mail@mariushoch.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Per its datasheet, the LSM303D also features that pin. Signed-off-by: Marius Hoch --- include/linux/platform_data/st_sensors_pdata.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/platform_data/st_sensors_pdata.h b/include/linux/platform_data/st_sensors_pdata.h index 897051e51b78..a657830232ae 100644 --- a/include/linux/platform_data/st_sensors_pdata.h +++ b/include/linux/platform_data/st_sensors_pdata.h @@ -15,7 +15,7 @@ * @drdy_int_pin: Redirect DRDY on pin 1 (1) or pin 2 (2). * Available only for accelerometer, magnetometer and pressure sensors. * Accelerometer DRDY on LSM330 available only on pin 1 (see datasheet). - * Magnetometer DRDY is supported only on LSM9DS0. + * Magnetometer DRDY is supported only on LSM9DS0 and LSM303D. * @open_drain: set the interrupt line to be open drain if possible. * @spi_3wire: enable spi-3wire mode. * @pullups: enable/disable i2c controller pullup resistors. From patchwork Thu Apr 13 02:40:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marius Hoch X-Patchwork-Id: 13209714 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0201DC77B6C for ; Thu, 13 Apr 2023 02:53:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230027AbjDMCxt (ORCPT ); Wed, 12 Apr 2023 22:53:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229989AbjDMCxs (ORCPT ); Wed, 12 Apr 2023 22:53:48 -0400 Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [IPv6:2001:67c:2050:0:465::202]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF08E40F9; Wed, 12 Apr 2023 19:53:35 -0700 (PDT) Received: from smtp2.mailbox.org (unknown [10.196.197.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4PxkN56w2Sz9sqQ; Thu, 13 Apr 2023 04:40:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mariushoch.de; s=MBO0001; t=1681353653; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wlxmi8TjfHTxZJwdTO4o4SDvKTGV2TgJ+RNBxFINEus=; b=WhPoteKKHBOkFD2G/ED3bs1NLXeYQWqTunVzagAWi2FcijiIXxrXdQ83VSta7v0CXcIr9H R3j274R80yfAwna7I6f+e3GN1wg/6JLxWcZGU45k9QetGTe/7z5oVatCop6nLDKN47vuXX AAjVgdAhdGwMSPwVSZTdcx4zI1YZw+oR4ZTIn5r9a8X6Uf7/BCB1YcH+iGta6l+vPm+Jie suVX4HWy4rCJv2frtBuQWnau1kqMzoAsGntywOnEulk1hG3gsLlMueaEcWxMWNIq0W85c0 ukjRhCHPG/yKBJ9iWZWVMdQ/8pl1cZ2ycgtXg9VDZ8BkWMzYyiXuQOgT+Yn+WA== From: Marius Hoch To: Jonathan Cameron , Lars-Peter Clausen , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Hans de Goede , Marius Hoch Subject: [PATCH v2 6/6] dt-bindings: iio: st-sensors: Add LSM303D accelerometer+magnetometer Date: Thu, 13 Apr 2023 04:40:13 +0200 Message-Id: <20230413024013.450165-7-mail@mariushoch.de> In-Reply-To: <20230413024013.450165-1-mail@mariushoch.de> References: <20230413024013.450165-1-mail@mariushoch.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Same as the lsm9ds0, except that the lsm303d doesn't feature a gyroscope. Signed-off-by: Marius Hoch --- Documentation/devicetree/bindings/iio/st,st-sensors.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/iio/st,st-sensors.yaml b/Documentation/devicetree/bindings/iio/st,st-sensors.yaml index c6201976378f..194aca5542c2 100644 --- a/Documentation/devicetree/bindings/iio/st,st-sensors.yaml +++ b/Documentation/devicetree/bindings/iio/st,st-sensors.yaml @@ -85,6 +85,7 @@ properties: - description: IMUs enum: - st,lsm9ds0-imu + - st,lsm303d-imu - description: Deprecated bindings enum: - st,lis302dl-spi