diff mbox series

[V2,5/8] iio: accel: add support for IIS328DQ variant

Message ID 20230317103323.7741-6-stefan.wahren@chargebyte.com (mailing list archive)
State Superseded
Headers show
Series ARM: dts: imx6ull: Add chargebyte Tarragon support | expand

Commit Message

Stefan Wahren March 17, 2023, 10:33 a.m. UTC
Since the ST IIS328DQ accelerometer is compatible to the ST LIS331DL,
just add the new compatible to the st_accel framework.

Link: https://www.st.com/resource/en/datasheet/iis328dq.pdf
Signed-off-by: Stefan Wahren <stefan.wahren@chargebyte.com>
---
 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 +++++
 4 files changed, 12 insertions(+)

Comments

Jonathan Cameron March 18, 2023, 3:58 p.m. UTC | #1
On Fri, 17 Mar 2023 11:33:20 +0100
Stefan Wahren <stefan.wahren@chargebyte.com> wrote:

> Since the ST IIS328DQ accelerometer is compatible to the ST LIS331DL,
> just add the new compatible to the st_accel framework.
> 
> Link: https://www.st.com/resource/en/datasheet/iis328dq.pdf
> Signed-off-by: Stefan Wahren <stefan.wahren@chargebyte.com>

Hi Stefan,

Assuming the DT binding is fine with the DT maintainers, I plan to
pick the pair of IIO fixes up through my tree.  Is there any strong
reason they should go via another route?

It's common for the dts files to go via ARM soc in cases like this
and we tend not to worry that they are 'broken' until the binding docs
are visible via other trees. Other than that I can't see an obvious
reason not to split these up.

Thanks,

Jonathan

> ---
>  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 +++++
>  4 files changed, 12 insertions(+)
> 
> diff --git a/drivers/iio/accel/st_accel.h b/drivers/iio/accel/st_accel.h
> index 56ed0c776d4a..e7525615712b 100644
> --- a/drivers/iio/accel/st_accel.h
> +++ b/drivers/iio/accel/st_accel.h
> @@ -39,6 +39,7 @@
>  #define LIS302DL_ACCEL_DEV_NAME		"lis302dl"
>  #define LSM303C_ACCEL_DEV_NAME		"lsm303c_accel"
>  #define SC7A20_ACCEL_DEV_NAME		"sc7a20"
> +#define IIS328DQ_ACCEL_DEV_NAME		"iis328dq"
>  
>  
>  #ifdef CONFIG_IIO_BUFFER
> diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
> index 6b8562f684d5..5f7d81b44b1d 100644
> --- a/drivers/iio/accel/st_accel_core.c
> +++ b/drivers/iio/accel/st_accel_core.c
> @@ -517,6 +517,7 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
>  		.wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS,
>  		.sensors_supported = {
>  			[0] = H3LIS331DL_ACCEL_DEV_NAME,
> +			[1] = IIS328DQ_ACCEL_DEV_NAME,
>  		},
>  		.ch = (struct iio_chan_spec *)st_accel_12bit_channels,
>  		.odr = {
> diff --git a/drivers/iio/accel/st_accel_i2c.c b/drivers/iio/accel/st_accel_i2c.c
> index 3f02fd5d5946..fb9e2d6f4210 100644
> --- a/drivers/iio/accel/st_accel_i2c.c
> +++ b/drivers/iio/accel/st_accel_i2c.c
> @@ -119,6 +119,10 @@ static const struct of_device_id st_accel_of_match[] = {
>  		.compatible = "silan,sc7a20",
>  		.data = SC7A20_ACCEL_DEV_NAME,
>  	},
> +	{
> +		.compatible = "st,iis328dq",
> +		.data = IIS328DQ_ACCEL_DEV_NAME,
> +	},
>  	{},
>  };
>  MODULE_DEVICE_TABLE(of, st_accel_of_match);
> @@ -157,6 +161,7 @@ static const struct i2c_device_id st_accel_id_table[] = {
>  	{ LIS302DL_ACCEL_DEV_NAME },
>  	{ LSM303C_ACCEL_DEV_NAME },
>  	{ SC7A20_ACCEL_DEV_NAME },
> +	{ IIS328DQ_ACCEL_DEV_NAME },
>  	{},
>  };
>  MODULE_DEVICE_TABLE(i2c, st_accel_id_table);
> diff --git a/drivers/iio/accel/st_accel_spi.c b/drivers/iio/accel/st_accel_spi.c
> index 5740dc1820bd..f72a24f45322 100644
> --- a/drivers/iio/accel/st_accel_spi.c
> +++ b/drivers/iio/accel/st_accel_spi.c
> @@ -100,6 +100,10 @@ static const struct of_device_id st_accel_of_match[] = {
>  		.compatible = "st,lsm303c-accel",
>  		.data = LSM303C_ACCEL_DEV_NAME,
>  	},
> +	{
> +		.compatible = "st,iis328dq",
> +		.data = IIS328DQ_ACCEL_DEV_NAME,
> +	},
>  	{}
>  };
>  MODULE_DEVICE_TABLE(of, st_accel_of_match);
> @@ -157,6 +161,7 @@ static const struct spi_device_id st_accel_id_table[] = {
>  	{ LIS3DE_ACCEL_DEV_NAME },
>  	{ LIS302DL_ACCEL_DEV_NAME },
>  	{ LSM303C_ACCEL_DEV_NAME },
> +	{ IIS328DQ_ACCEL_DEV_NAME },
>  	{},
>  };
>  MODULE_DEVICE_TABLE(spi, st_accel_id_table);
Stefan Wahren March 18, 2023, 5:35 p.m. UTC | #2
Hi Jonathan,

Am 18.03.23 um 16:58 schrieb Jonathan Cameron:
> On Fri, 17 Mar 2023 11:33:20 +0100
> Stefan Wahren <stefan.wahren@chargebyte.com> wrote:
>
>> Since the ST IIS328DQ accelerometer is compatible to the ST LIS331DL,
>> just add the new compatible to the st_accel framework.
>>
>> Link: https://www.st.com/resource/en/datasheet/iis328dq.pdf
>> Signed-off-by: Stefan Wahren <stefan.wahren@chargebyte.com>
> Hi Stefan,
>
> Assuming the DT binding is fine with the DT maintainers, I plan to
> pick the pair of IIO fixes up through my tree.  Is there any strong
> reason they should go via another route?

i'm a little bit confused about consider this as "fixes", but i'm fine 
with them going your tree.

Best regards

>
> It's common for the dts files to go via ARM soc in cases like this
> and we tend not to worry that they are 'broken' until the binding docs
> are visible via other trees. Other than that I can't see an obvious
> reason not to split these up.
>
> Thanks,
>
> Jonathan
>
>> ---
>>   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 +++++
>>   4 files changed, 12 insertions(+)
>>
>> diff --git a/drivers/iio/accel/st_accel.h b/drivers/iio/accel/st_accel.h
>> index 56ed0c776d4a..e7525615712b 100644
>> --- a/drivers/iio/accel/st_accel.h
>> +++ b/drivers/iio/accel/st_accel.h
>> @@ -39,6 +39,7 @@
>>   #define LIS302DL_ACCEL_DEV_NAME		"lis302dl"
>>   #define LSM303C_ACCEL_DEV_NAME		"lsm303c_accel"
>>   #define SC7A20_ACCEL_DEV_NAME		"sc7a20"
>> +#define IIS328DQ_ACCEL_DEV_NAME		"iis328dq"
>>   
>>   
>>   #ifdef CONFIG_IIO_BUFFER
>> diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
>> index 6b8562f684d5..5f7d81b44b1d 100644
>> --- a/drivers/iio/accel/st_accel_core.c
>> +++ b/drivers/iio/accel/st_accel_core.c
>> @@ -517,6 +517,7 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
>>   		.wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS,
>>   		.sensors_supported = {
>>   			[0] = H3LIS331DL_ACCEL_DEV_NAME,
>> +			[1] = IIS328DQ_ACCEL_DEV_NAME,
>>   		},
>>   		.ch = (struct iio_chan_spec *)st_accel_12bit_channels,
>>   		.odr = {
>> diff --git a/drivers/iio/accel/st_accel_i2c.c b/drivers/iio/accel/st_accel_i2c.c
>> index 3f02fd5d5946..fb9e2d6f4210 100644
>> --- a/drivers/iio/accel/st_accel_i2c.c
>> +++ b/drivers/iio/accel/st_accel_i2c.c
>> @@ -119,6 +119,10 @@ static const struct of_device_id st_accel_of_match[] = {
>>   		.compatible = "silan,sc7a20",
>>   		.data = SC7A20_ACCEL_DEV_NAME,
>>   	},
>> +	{
>> +		.compatible = "st,iis328dq",
>> +		.data = IIS328DQ_ACCEL_DEV_NAME,
>> +	},
>>   	{},
>>   };
>>   MODULE_DEVICE_TABLE(of, st_accel_of_match);
>> @@ -157,6 +161,7 @@ static const struct i2c_device_id st_accel_id_table[] = {
>>   	{ LIS302DL_ACCEL_DEV_NAME },
>>   	{ LSM303C_ACCEL_DEV_NAME },
>>   	{ SC7A20_ACCEL_DEV_NAME },
>> +	{ IIS328DQ_ACCEL_DEV_NAME },
>>   	{},
>>   };
>>   MODULE_DEVICE_TABLE(i2c, st_accel_id_table);
>> diff --git a/drivers/iio/accel/st_accel_spi.c b/drivers/iio/accel/st_accel_spi.c
>> index 5740dc1820bd..f72a24f45322 100644
>> --- a/drivers/iio/accel/st_accel_spi.c
>> +++ b/drivers/iio/accel/st_accel_spi.c
>> @@ -100,6 +100,10 @@ static const struct of_device_id st_accel_of_match[] = {
>>   		.compatible = "st,lsm303c-accel",
>>   		.data = LSM303C_ACCEL_DEV_NAME,
>>   	},
>> +	{
>> +		.compatible = "st,iis328dq",
>> +		.data = IIS328DQ_ACCEL_DEV_NAME,
>> +	},
>>   	{}
>>   };
>>   MODULE_DEVICE_TABLE(of, st_accel_of_match);
>> @@ -157,6 +161,7 @@ static const struct spi_device_id st_accel_id_table[] = {
>>   	{ LIS3DE_ACCEL_DEV_NAME },
>>   	{ LIS302DL_ACCEL_DEV_NAME },
>>   	{ LSM303C_ACCEL_DEV_NAME },
>> +	{ IIS328DQ_ACCEL_DEV_NAME },
>>   	{},
>>   };
>>   MODULE_DEVICE_TABLE(spi, st_accel_id_table);
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Jonathan Cameron March 19, 2023, 3:42 p.m. UTC | #3
On Sat, 18 Mar 2023 18:35:19 +0100
Stefan Wahren <stefan.wahren@i2se.com> wrote:

> Hi Jonathan,
> 
> Am 18.03.23 um 16:58 schrieb Jonathan Cameron:
> > On Fri, 17 Mar 2023 11:33:20 +0100
> > Stefan Wahren <stefan.wahren@chargebyte.com> wrote:
> >  
> >> Since the ST IIS328DQ accelerometer is compatible to the ST LIS331DL,
> >> just add the new compatible to the st_accel framework.
> >>
> >> Link: https://www.st.com/resource/en/datasheet/iis328dq.pdf
> >> Signed-off-by: Stefan Wahren <stefan.wahren@chargebyte.com>  
> > Hi Stefan,
> >
> > Assuming the DT binding is fine with the DT maintainers, I plan to
> > pick the pair of IIO fixes up through my tree.  Is there any strong
> > reason they should go via another route?  
> 
> i'm a little bit confused about consider this as "fixes", but i'm fine 
> with them going your tree.

Me too. No idea why I wrote 'fixes' :)

Both queued up in IIO togreg branch though that's initially pushed out
as testing for 0-day to see if it can find anything we missed.

Jonathan

> 
> Best regards
> 
> >
> > It's common for the dts files to go via ARM soc in cases like this
> > and we tend not to worry that they are 'broken' until the binding docs
> > are visible via other trees. Other than that I can't see an obvious
> > reason not to split these up.
> >
> > Thanks,
> >
> > Jonathan
> >  
> >> ---
> >>   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 +++++
> >>   4 files changed, 12 insertions(+)
> >>
> >> diff --git a/drivers/iio/accel/st_accel.h b/drivers/iio/accel/st_accel.h
> >> index 56ed0c776d4a..e7525615712b 100644
> >> --- a/drivers/iio/accel/st_accel.h
> >> +++ b/drivers/iio/accel/st_accel.h
> >> @@ -39,6 +39,7 @@
> >>   #define LIS302DL_ACCEL_DEV_NAME		"lis302dl"
> >>   #define LSM303C_ACCEL_DEV_NAME		"lsm303c_accel"
> >>   #define SC7A20_ACCEL_DEV_NAME		"sc7a20"
> >> +#define IIS328DQ_ACCEL_DEV_NAME		"iis328dq"
> >>   
> >>   
> >>   #ifdef CONFIG_IIO_BUFFER
> >> diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
> >> index 6b8562f684d5..5f7d81b44b1d 100644
> >> --- a/drivers/iio/accel/st_accel_core.c
> >> +++ b/drivers/iio/accel/st_accel_core.c
> >> @@ -517,6 +517,7 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
> >>   		.wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS,
> >>   		.sensors_supported = {
> >>   			[0] = H3LIS331DL_ACCEL_DEV_NAME,
> >> +			[1] = IIS328DQ_ACCEL_DEV_NAME,
> >>   		},
> >>   		.ch = (struct iio_chan_spec *)st_accel_12bit_channels,
> >>   		.odr = {
> >> diff --git a/drivers/iio/accel/st_accel_i2c.c b/drivers/iio/accel/st_accel_i2c.c
> >> index 3f02fd5d5946..fb9e2d6f4210 100644
> >> --- a/drivers/iio/accel/st_accel_i2c.c
> >> +++ b/drivers/iio/accel/st_accel_i2c.c
> >> @@ -119,6 +119,10 @@ static const struct of_device_id st_accel_of_match[] = {
> >>   		.compatible = "silan,sc7a20",
> >>   		.data = SC7A20_ACCEL_DEV_NAME,
> >>   	},
> >> +	{
> >> +		.compatible = "st,iis328dq",
> >> +		.data = IIS328DQ_ACCEL_DEV_NAME,
> >> +	},
> >>   	{},
> >>   };
> >>   MODULE_DEVICE_TABLE(of, st_accel_of_match);
> >> @@ -157,6 +161,7 @@ static const struct i2c_device_id st_accel_id_table[] = {
> >>   	{ LIS302DL_ACCEL_DEV_NAME },
> >>   	{ LSM303C_ACCEL_DEV_NAME },
> >>   	{ SC7A20_ACCEL_DEV_NAME },
> >> +	{ IIS328DQ_ACCEL_DEV_NAME },
> >>   	{},
> >>   };
> >>   MODULE_DEVICE_TABLE(i2c, st_accel_id_table);
> >> diff --git a/drivers/iio/accel/st_accel_spi.c b/drivers/iio/accel/st_accel_spi.c
> >> index 5740dc1820bd..f72a24f45322 100644
> >> --- a/drivers/iio/accel/st_accel_spi.c
> >> +++ b/drivers/iio/accel/st_accel_spi.c
> >> @@ -100,6 +100,10 @@ static const struct of_device_id st_accel_of_match[] = {
> >>   		.compatible = "st,lsm303c-accel",
> >>   		.data = LSM303C_ACCEL_DEV_NAME,
> >>   	},
> >> +	{
> >> +		.compatible = "st,iis328dq",
> >> +		.data = IIS328DQ_ACCEL_DEV_NAME,
> >> +	},
> >>   	{}
> >>   };
> >>   MODULE_DEVICE_TABLE(of, st_accel_of_match);
> >> @@ -157,6 +161,7 @@ static const struct spi_device_id st_accel_id_table[] = {
> >>   	{ LIS3DE_ACCEL_DEV_NAME },
> >>   	{ LIS302DL_ACCEL_DEV_NAME },
> >>   	{ LSM303C_ACCEL_DEV_NAME },
> >> +	{ IIS328DQ_ACCEL_DEV_NAME },
> >>   	{},
> >>   };
> >>   MODULE_DEVICE_TABLE(spi, st_accel_id_table);  
> >
> > _______________________________________________
> > linux-arm-kernel mailing list
> > linux-arm-kernel@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
diff mbox series

Patch

diff --git a/drivers/iio/accel/st_accel.h b/drivers/iio/accel/st_accel.h
index 56ed0c776d4a..e7525615712b 100644
--- a/drivers/iio/accel/st_accel.h
+++ b/drivers/iio/accel/st_accel.h
@@ -39,6 +39,7 @@ 
 #define LIS302DL_ACCEL_DEV_NAME		"lis302dl"
 #define LSM303C_ACCEL_DEV_NAME		"lsm303c_accel"
 #define SC7A20_ACCEL_DEV_NAME		"sc7a20"
+#define IIS328DQ_ACCEL_DEV_NAME		"iis328dq"
 
 
 #ifdef CONFIG_IIO_BUFFER
diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
index 6b8562f684d5..5f7d81b44b1d 100644
--- a/drivers/iio/accel/st_accel_core.c
+++ b/drivers/iio/accel/st_accel_core.c
@@ -517,6 +517,7 @@  static const struct st_sensor_settings st_accel_sensors_settings[] = {
 		.wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS,
 		.sensors_supported = {
 			[0] = H3LIS331DL_ACCEL_DEV_NAME,
+			[1] = IIS328DQ_ACCEL_DEV_NAME,
 		},
 		.ch = (struct iio_chan_spec *)st_accel_12bit_channels,
 		.odr = {
diff --git a/drivers/iio/accel/st_accel_i2c.c b/drivers/iio/accel/st_accel_i2c.c
index 3f02fd5d5946..fb9e2d6f4210 100644
--- a/drivers/iio/accel/st_accel_i2c.c
+++ b/drivers/iio/accel/st_accel_i2c.c
@@ -119,6 +119,10 @@  static const struct of_device_id st_accel_of_match[] = {
 		.compatible = "silan,sc7a20",
 		.data = SC7A20_ACCEL_DEV_NAME,
 	},
+	{
+		.compatible = "st,iis328dq",
+		.data = IIS328DQ_ACCEL_DEV_NAME,
+	},
 	{},
 };
 MODULE_DEVICE_TABLE(of, st_accel_of_match);
@@ -157,6 +161,7 @@  static const struct i2c_device_id st_accel_id_table[] = {
 	{ LIS302DL_ACCEL_DEV_NAME },
 	{ LSM303C_ACCEL_DEV_NAME },
 	{ SC7A20_ACCEL_DEV_NAME },
+	{ IIS328DQ_ACCEL_DEV_NAME },
 	{},
 };
 MODULE_DEVICE_TABLE(i2c, st_accel_id_table);
diff --git a/drivers/iio/accel/st_accel_spi.c b/drivers/iio/accel/st_accel_spi.c
index 5740dc1820bd..f72a24f45322 100644
--- a/drivers/iio/accel/st_accel_spi.c
+++ b/drivers/iio/accel/st_accel_spi.c
@@ -100,6 +100,10 @@  static const struct of_device_id st_accel_of_match[] = {
 		.compatible = "st,lsm303c-accel",
 		.data = LSM303C_ACCEL_DEV_NAME,
 	},
+	{
+		.compatible = "st,iis328dq",
+		.data = IIS328DQ_ACCEL_DEV_NAME,
+	},
 	{}
 };
 MODULE_DEVICE_TABLE(of, st_accel_of_match);
@@ -157,6 +161,7 @@  static const struct spi_device_id st_accel_id_table[] = {
 	{ LIS3DE_ACCEL_DEV_NAME },
 	{ LIS302DL_ACCEL_DEV_NAME },
 	{ LSM303C_ACCEL_DEV_NAME },
+	{ IIS328DQ_ACCEL_DEV_NAME },
 	{},
 };
 MODULE_DEVICE_TABLE(spi, st_accel_id_table);