* [PATCH 0/3] iio: st-sensors: Add LSM303C accelerometer+magnetometer
@ 2023-01-06 10:22 Stephan Gerhold
2023-01-06 10:22 ` [PATCH 1/3] dt-bindings: " Stephan Gerhold
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Stephan Gerhold @ 2023-01-06 10:22 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Lars-Peter Clausen, Rob Herring, Krzysztof Kozlowski,
Denis Ciocca, Linus Walleij, linux-iio, devicetree,
~postmarketos/upstreaming, Stephan Gerhold
Add support for the ST LSM303C [1] accelerometer and magnetometer combo
sensor in st_accel and st_magn. LSM303C seems to be more or less
a combination of LIS2HH12 as accelerometer and LIS3MDL as magnetometer
so this series just adds two new compatibles for the two sensors that
are already supported.
[1]: https://www.st.com/resource/en/datasheet/lsm303c.pdf
Stephan Gerhold (3):
dt-bindings: iio: st-sensors: Add LSM303C accelerometer+magnetometer
iio: accel: st_accel: Add LSM303C
iio: magnetometer: st_magn: Add LSM303C
Documentation/devicetree/bindings/iio/st,st-sensors.yaml | 2 ++
drivers/iio/accel/Kconfig | 2 +-
drivers/iio/accel/st_accel.h | 1 +
drivers/iio/accel/st_accel_core.c | 1 +
drivers/iio/accel/st_accel_i2c.c | 5 +++++
drivers/iio/accel/st_accel_spi.c | 5 +++++
drivers/iio/magnetometer/Kconfig | 2 +-
drivers/iio/magnetometer/st_magn.h | 1 +
drivers/iio/magnetometer/st_magn_core.c | 1 +
drivers/iio/magnetometer/st_magn_i2c.c | 5 +++++
drivers/iio/magnetometer/st_magn_spi.c | 5 +++++
11 files changed, 28 insertions(+), 2 deletions(-)
--
2.39.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] dt-bindings: iio: st-sensors: Add LSM303C accelerometer+magnetometer
2023-01-06 10:22 [PATCH 0/3] iio: st-sensors: Add LSM303C accelerometer+magnetometer Stephan Gerhold
@ 2023-01-06 10:22 ` Stephan Gerhold
2023-01-06 12:35 ` Krzysztof Kozlowski
2023-01-06 10:22 ` [PATCH 2/3] iio: accel: st_accel: Add LSM303C Stephan Gerhold
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Stephan Gerhold @ 2023-01-06 10:22 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Lars-Peter Clausen, Rob Herring, Krzysztof Kozlowski,
Denis Ciocca, Linus Walleij, linux-iio, devicetree,
~postmarketos/upstreaming, Stephan Gerhold
The ST LSM303C [1] is a accelerometer and magnetometer combo sensor
compatible with the existing ST sensor bindings. Accelerometer and
magnetometer are exposed through separate I2C/SPI devices, so document
separate compatibles with -accel and -magn suffix.
[1]: https://www.st.com/resource/en/datasheet/lsm303c.pdf
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
Documentation/devicetree/bindings/iio/st,st-sensors.yaml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Documentation/devicetree/bindings/iio/st,st-sensors.yaml b/Documentation/devicetree/bindings/iio/st,st-sensors.yaml
index 250439b13152..c6201976378f 100644
--- a/Documentation/devicetree/bindings/iio/st,st-sensors.yaml
+++ b/Documentation/devicetree/bindings/iio/st,st-sensors.yaml
@@ -39,6 +39,7 @@ properties:
- st,lis3lv02dl-accel
- st,lng2dm-accel
- st,lsm303agr-accel
+ - st,lsm303c-accel
- st,lsm303dl-accel
- st,lsm303dlh-accel
- st,lsm303dlhc-accel
@@ -66,6 +67,7 @@ properties:
- st,lis2mdl
- st,lis3mdl-magn
- st,lsm303agr-magn
+ - st,lsm303c-magn
- st,lsm303dlh-magn
- st,lsm303dlhc-magn
- st,lsm303dlm-magn
--
2.39.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/3] iio: accel: st_accel: Add LSM303C
2023-01-06 10:22 [PATCH 0/3] iio: st-sensors: Add LSM303C accelerometer+magnetometer Stephan Gerhold
2023-01-06 10:22 ` [PATCH 1/3] dt-bindings: " Stephan Gerhold
@ 2023-01-06 10:22 ` Stephan Gerhold
2023-01-06 10:22 ` [PATCH 3/3] iio: magnetometer: st_magn: " Stephan Gerhold
2023-01-07 23:56 ` [PATCH 0/3] iio: st-sensors: Add LSM303C accelerometer+magnetometer Linus Walleij
3 siblings, 0 replies; 7+ messages in thread
From: Stephan Gerhold @ 2023-01-06 10:22 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Lars-Peter Clausen, Rob Herring, Krzysztof Kozlowski,
Denis Ciocca, Linus Walleij, linux-iio, devicetree,
~postmarketos/upstreaming, Stephan Gerhold
The accelerometer part of ST LSM303C is similar (perhaps even identical)
to the already supported standalone LIS2HH12 accelerometer, so just
add the new st,lsm303c-accel compatible for the existing definitions.
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
drivers/iio/accel/Kconfig | 2 +-
drivers/iio/accel/st_accel.h | 1 +
drivers/iio/accel/st_accel_core.c | 1 +
drivers/iio/accel/st_accel_i2c.c | 5 +++++
drivers/iio/accel/st_accel_spi.c | 5 +++++
5 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig
index 03ac410c162e..b6b45d359f28 100644
--- a/drivers/iio/accel/Kconfig
+++ b/drivers/iio/accel/Kconfig
@@ -380,7 +380,7 @@ config IIO_ST_ACCEL_3AXIS
select IIO_TRIGGERED_BUFFER if (IIO_BUFFER)
help
Say yes here to build support for STMicroelectronics accelerometers:
- LSM303DLH, LSM303DLHC, LIS3DH, LSM330D, LSM330DL, LSM330DLC,
+ LSM303C, LSM303DLH, LSM303DLHC, LIS3DH, LSM330D, LSM330DL, LSM330DLC,
LIS331DLH, LSM303DL, LSM303DLM, LSM330, LIS2DH12, H3LIS331DL,
LNG2DM, LIS3DE, LIS2DE12, LIS2HH12
diff --git a/drivers/iio/accel/st_accel.h b/drivers/iio/accel/st_accel.h
index 5b0f54e33d9e..56ed0c776d4a 100644
--- a/drivers/iio/accel/st_accel.h
+++ b/drivers/iio/accel/st_accel.h
@@ -37,6 +37,7 @@
#define LIS2DE12_ACCEL_DEV_NAME "lis2de12"
#define LIS2HH12_ACCEL_DEV_NAME "lis2hh12"
#define LIS302DL_ACCEL_DEV_NAME "lis302dl"
+#define LSM303C_ACCEL_DEV_NAME "lsm303c_accel"
#define SC7A20_ACCEL_DEV_NAME "sc7a20"
diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
index c8c8eb15c34e..6b8562f684d5 100644
--- a/drivers/iio/accel/st_accel_core.c
+++ b/drivers/iio/accel/st_accel_core.c
@@ -929,6 +929,7 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
.wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS,
.sensors_supported = {
[0] = LIS2HH12_ACCEL_DEV_NAME,
+ [1] = LSM303C_ACCEL_DEV_NAME,
},
.ch = (struct iio_chan_spec *)st_accel_16bit_channels,
.odr = {
diff --git a/drivers/iio/accel/st_accel_i2c.c b/drivers/iio/accel/st_accel_i2c.c
index 45ee0ddc133c..3f02fd5d5946 100644
--- a/drivers/iio/accel/st_accel_i2c.c
+++ b/drivers/iio/accel/st_accel_i2c.c
@@ -111,6 +111,10 @@ static const struct of_device_id st_accel_of_match[] = {
.compatible = "st,lis302dl",
.data = LIS302DL_ACCEL_DEV_NAME,
},
+ {
+ .compatible = "st,lsm303c-accel",
+ .data = LSM303C_ACCEL_DEV_NAME,
+ },
{
.compatible = "silan,sc7a20",
.data = SC7A20_ACCEL_DEV_NAME,
@@ -151,6 +155,7 @@ static const struct i2c_device_id st_accel_id_table[] = {
{ LIS2DE12_ACCEL_DEV_NAME },
{ LIS2HH12_ACCEL_DEV_NAME },
{ LIS302DL_ACCEL_DEV_NAME },
+ { LSM303C_ACCEL_DEV_NAME },
{ SC7A20_ACCEL_DEV_NAME },
{},
};
diff --git a/drivers/iio/accel/st_accel_spi.c b/drivers/iio/accel/st_accel_spi.c
index 6c0917750288..5740dc1820bd 100644
--- a/drivers/iio/accel/st_accel_spi.c
+++ b/drivers/iio/accel/st_accel_spi.c
@@ -96,6 +96,10 @@ static const struct of_device_id st_accel_of_match[] = {
.compatible = "st,lis302dl",
.data = LIS302DL_ACCEL_DEV_NAME,
},
+ {
+ .compatible = "st,lsm303c-accel",
+ .data = LSM303C_ACCEL_DEV_NAME,
+ },
{}
};
MODULE_DEVICE_TABLE(of, st_accel_of_match);
@@ -152,6 +156,7 @@ static const struct spi_device_id st_accel_id_table[] = {
{ LIS3DHH_ACCEL_DEV_NAME },
{ LIS3DE_ACCEL_DEV_NAME },
{ LIS302DL_ACCEL_DEV_NAME },
+ { LSM303C_ACCEL_DEV_NAME },
{},
};
MODULE_DEVICE_TABLE(spi, st_accel_id_table);
--
2.39.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] iio: magnetometer: st_magn: Add LSM303C
2023-01-06 10:22 [PATCH 0/3] iio: st-sensors: Add LSM303C accelerometer+magnetometer Stephan Gerhold
2023-01-06 10:22 ` [PATCH 1/3] dt-bindings: " Stephan Gerhold
2023-01-06 10:22 ` [PATCH 2/3] iio: accel: st_accel: Add LSM303C Stephan Gerhold
@ 2023-01-06 10:22 ` Stephan Gerhold
2023-01-07 23:56 ` [PATCH 0/3] iio: st-sensors: Add LSM303C accelerometer+magnetometer Linus Walleij
3 siblings, 0 replies; 7+ messages in thread
From: Stephan Gerhold @ 2023-01-06 10:22 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Lars-Peter Clausen, Rob Herring, Krzysztof Kozlowski,
Denis Ciocca, Linus Walleij, linux-iio, devicetree,
~postmarketos/upstreaming, Stephan Gerhold
The magnetometer part of ST LSM303C is similar (perhaps even identical)
to the already supported standalone LIS3MDL magnetometer, so just
add the new st,lsm303c-magn compatible for the existing definitions.
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
drivers/iio/magnetometer/Kconfig | 2 +-
drivers/iio/magnetometer/st_magn.h | 1 +
drivers/iio/magnetometer/st_magn_core.c | 1 +
drivers/iio/magnetometer/st_magn_i2c.c | 5 +++++
drivers/iio/magnetometer/st_magn_spi.c | 5 +++++
5 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/magnetometer/Kconfig b/drivers/iio/magnetometer/Kconfig
index 467819335588..38532d840f2a 100644
--- a/drivers/iio/magnetometer/Kconfig
+++ b/drivers/iio/magnetometer/Kconfig
@@ -119,7 +119,7 @@ config IIO_ST_MAGN_3AXIS
select IIO_TRIGGERED_BUFFER if (IIO_BUFFER)
help
Say yes here to build support for STMicroelectronics magnetometers:
- LSM303DLHC, LSM303DLM, LIS3MDL.
+ LSM303C, LSM303DLHC, LSM303DLM, LIS3MDL.
Also need to enable at least one of I2C and SPI interface drivers
below.
diff --git a/drivers/iio/magnetometer/st_magn.h b/drivers/iio/magnetometer/st_magn.h
index 785b7f7b8b06..89945984d966 100644
--- a/drivers/iio/magnetometer/st_magn.h
+++ b/drivers/iio/magnetometer/st_magn.h
@@ -22,6 +22,7 @@
#define LIS2MDL_MAGN_DEV_NAME "lis2mdl"
#define LSM9DS1_MAGN_DEV_NAME "lsm9ds1_magn"
#define IIS2MDC_MAGN_DEV_NAME "iis2mdc"
+#define LSM303C_MAGN_DEV_NAME "lsm303c_magn"
#ifdef CONFIG_IIO_BUFFER
int st_magn_allocate_ring(struct iio_dev *indio_dev);
diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c
index e2fd233b3626..8faa7409d9e1 100644
--- a/drivers/iio/magnetometer/st_magn_core.c
+++ b/drivers/iio/magnetometer/st_magn_core.c
@@ -305,6 +305,7 @@ static const struct st_sensor_settings st_magn_sensors_settings[] = {
.sensors_supported = {
[0] = LIS3MDL_MAGN_DEV_NAME,
[1] = LSM9DS1_MAGN_DEV_NAME,
+ [2] = LSM303C_MAGN_DEV_NAME,
},
.ch = (struct iio_chan_spec *)st_magn_2_16bit_channels,
.odr = {
diff --git a/drivers/iio/magnetometer/st_magn_i2c.c b/drivers/iio/magnetometer/st_magn_i2c.c
index b4098d3b3813..cc0e0e94b129 100644
--- a/drivers/iio/magnetometer/st_magn_i2c.c
+++ b/drivers/iio/magnetometer/st_magn_i2c.c
@@ -50,6 +50,10 @@ static const struct of_device_id st_magn_of_match[] = {
.compatible = "st,iis2mdc",
.data = IIS2MDC_MAGN_DEV_NAME,
},
+ {
+ .compatible = "st,lsm303c-magn",
+ .data = LSM303C_MAGN_DEV_NAME,
+ },
{},
};
MODULE_DEVICE_TABLE(of, st_magn_of_match);
@@ -97,6 +101,7 @@ static const struct i2c_device_id st_magn_id_table[] = {
{ LIS2MDL_MAGN_DEV_NAME },
{ LSM9DS1_MAGN_DEV_NAME },
{ IIS2MDC_MAGN_DEV_NAME },
+ { LSM303C_MAGN_DEV_NAME },
{},
};
MODULE_DEVICE_TABLE(i2c, st_magn_id_table);
diff --git a/drivers/iio/magnetometer/st_magn_spi.c b/drivers/iio/magnetometer/st_magn_spi.c
index 6ddc4318564a..f203e1f87eec 100644
--- a/drivers/iio/magnetometer/st_magn_spi.c
+++ b/drivers/iio/magnetometer/st_magn_spi.c
@@ -45,6 +45,10 @@ static const struct of_device_id st_magn_of_match[] = {
.compatible = "st,iis2mdc",
.data = IIS2MDC_MAGN_DEV_NAME,
},
+ {
+ .compatible = "st,lsm303c-magn",
+ .data = LSM303C_MAGN_DEV_NAME,
+ },
{}
};
MODULE_DEVICE_TABLE(of, st_magn_of_match);
@@ -89,6 +93,7 @@ static const struct spi_device_id st_magn_id_table[] = {
{ LIS2MDL_MAGN_DEV_NAME },
{ LSM9DS1_MAGN_DEV_NAME },
{ IIS2MDC_MAGN_DEV_NAME },
+ { LSM303C_MAGN_DEV_NAME },
{},
};
MODULE_DEVICE_TABLE(spi, st_magn_id_table);
--
2.39.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] dt-bindings: iio: st-sensors: Add LSM303C accelerometer+magnetometer
2023-01-06 10:22 ` [PATCH 1/3] dt-bindings: " Stephan Gerhold
@ 2023-01-06 12:35 ` Krzysztof Kozlowski
0 siblings, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2023-01-06 12:35 UTC (permalink / raw)
To: Stephan Gerhold, Jonathan Cameron
Cc: Lars-Peter Clausen, Rob Herring, Krzysztof Kozlowski,
Denis Ciocca, Linus Walleij, linux-iio, devicetree,
~postmarketos/upstreaming
On 06/01/2023 11:22, Stephan Gerhold wrote:
> The ST LSM303C [1] is a accelerometer and magnetometer combo sensor
> compatible with the existing ST sensor bindings. Accelerometer and
> magnetometer are exposed through separate I2C/SPI devices, so document
> separate compatibles with -accel and -magn suffix.
>
> [1]: https://www.st.com/resource/en/datasheet/lsm303c.pdf
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/3] iio: st-sensors: Add LSM303C accelerometer+magnetometer
2023-01-06 10:22 [PATCH 0/3] iio: st-sensors: Add LSM303C accelerometer+magnetometer Stephan Gerhold
` (2 preceding siblings ...)
2023-01-06 10:22 ` [PATCH 3/3] iio: magnetometer: st_magn: " Stephan Gerhold
@ 2023-01-07 23:56 ` Linus Walleij
2023-01-08 13:02 ` Jonathan Cameron
3 siblings, 1 reply; 7+ messages in thread
From: Linus Walleij @ 2023-01-07 23:56 UTC (permalink / raw)
To: Stephan Gerhold
Cc: Jonathan Cameron, Lars-Peter Clausen, Rob Herring,
Krzysztof Kozlowski, Denis Ciocca, linux-iio, devicetree,
~postmarketos/upstreaming
On Fri, Jan 6, 2023 at 11:24 AM Stephan Gerhold <stephan@gerhold.net> wrote:
> Add support for the ST LSM303C [1] accelerometer and magnetometer combo
> sensor in st_accel and st_magn. LSM303C seems to be more or less
> a combination of LIS2HH12 as accelerometer and LIS3MDL as magnetometer
> so this series just adds two new compatibles for the two sensors that
> are already supported.
>
> [1]: https://www.st.com/resource/en/datasheet/lsm303c.pdf
>
> Stephan Gerhold (3):
> dt-bindings: iio: st-sensors: Add LSM303C accelerometer+magnetometer
> iio: accel: st_accel: Add LSM303C
> iio: magnetometer: st_magn: Add LSM303C
This patch set:
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/3] iio: st-sensors: Add LSM303C accelerometer+magnetometer
2023-01-07 23:56 ` [PATCH 0/3] iio: st-sensors: Add LSM303C accelerometer+magnetometer Linus Walleij
@ 2023-01-08 13:02 ` Jonathan Cameron
0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2023-01-08 13:02 UTC (permalink / raw)
To: Linus Walleij
Cc: Stephan Gerhold, Lars-Peter Clausen, Rob Herring,
Krzysztof Kozlowski, Denis Ciocca, linux-iio, devicetree,
~postmarketos/upstreaming
On Sun, 8 Jan 2023 00:56:22 +0100
Linus Walleij <linus.walleij@linaro.org> wrote:
> On Fri, Jan 6, 2023 at 11:24 AM Stephan Gerhold <stephan@gerhold.net> wrote:
>
> > Add support for the ST LSM303C [1] accelerometer and magnetometer combo
> > sensor in st_accel and st_magn. LSM303C seems to be more or less
> > a combination of LIS2HH12 as accelerometer and LIS3MDL as magnetometer
> > so this series just adds two new compatibles for the two sensors that
> > are already supported.
> >
> > [1]: https://www.st.com/resource/en/datasheet/lsm303c.pdf
> >
> > Stephan Gerhold (3):
> > dt-bindings: iio: st-sensors: Add LSM303C accelerometer+magnetometer
> > iio: accel: st_accel: Add LSM303C
> > iio: magnetometer: st_magn: Add LSM303C
>
> This patch set:
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Series applied to the togreg branch of iio.git and pushed out as testing
for 0-day to take a poke at it.
Note, still time for others to review as I'll probably not push this out as
a non rebasing tree until next weekendish.
Thanks,
Jonathan
>
> Yours,
> Linus Walleij
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-01-08 12:48 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-06 10:22 [PATCH 0/3] iio: st-sensors: Add LSM303C accelerometer+magnetometer Stephan Gerhold
2023-01-06 10:22 ` [PATCH 1/3] dt-bindings: " Stephan Gerhold
2023-01-06 12:35 ` Krzysztof Kozlowski
2023-01-06 10:22 ` [PATCH 2/3] iio: accel: st_accel: Add LSM303C Stephan Gerhold
2023-01-06 10:22 ` [PATCH 3/3] iio: magnetometer: st_magn: " Stephan Gerhold
2023-01-07 23:56 ` [PATCH 0/3] iio: st-sensors: Add LSM303C accelerometer+magnetometer Linus Walleij
2023-01-08 13:02 ` Jonathan Cameron
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.