linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] dt-bindings: st_sensors: add st,lis2hh12 compatible entry
@ 2020-03-30 14:19 Gaëtan André
  2020-03-30 14:19 ` [PATCH 2/2] iio: accel: st_sensors: add support for LIS2HH12 Gaëtan André
  2020-04-04 15:41 ` [PATCH 1/2] dt-bindings: st_sensors: add st,lis2hh12 compatible entry Jonathan Cameron
  0 siblings, 2 replies; 5+ messages in thread
From: Gaëtan André @ 2020-03-30 14:19 UTC (permalink / raw)
  To: jic23
  Cc: linux-iio, devicetree, ~postmarketos/upstreaming, Gaëtan André

Add LIS2HH12 compatible entry.

Signed-off-by: Gaëtan André <rvlander@gaetanandre.eu>
---
 Documentation/devicetree/bindings/iio/st-sensors.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/iio/st-sensors.txt b/Documentation/devicetree/bindings/iio/st-sensors.txt
index 0ef64a444479..3213599c5071 100644
--- a/Documentation/devicetree/bindings/iio/st-sensors.txt
+++ b/Documentation/devicetree/bindings/iio/st-sensors.txt
@@ -50,6 +50,7 @@ Accelerometers:
 - st,lis3dhh
 - st,lis3de
 - st,lis2de12
+- st,lis2hh12
 
 Gyroscopes:
 - st,l3g4200d-gyro

base-commit: b723e9431b77976b83efb90178dfcada3405321c
-- 
2.26.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] iio: accel: st_sensors:  add support for LIS2HH12
  2020-03-30 14:19 [PATCH 1/2] dt-bindings: st_sensors: add st,lis2hh12 compatible entry Gaëtan André
@ 2020-03-30 14:19 ` Gaëtan André
  2020-03-30 17:10   ` Stephan Gerhold
  2020-04-04 15:41 ` [PATCH 1/2] dt-bindings: st_sensors: add st,lis2hh12 compatible entry Jonathan Cameron
  1 sibling, 1 reply; 5+ messages in thread
From: Gaëtan André @ 2020-03-30 14:19 UTC (permalink / raw)
  To: jic23
  Cc: linux-iio, devicetree, ~postmarketos/upstreaming, Gaëtan André

Add support for STMicroelectronics LISHH12 accelerometer in st_accel
framework.

https://www.st.com/resource/en/datasheet/lis2hh12.pdf

Signed-off-by: Gaëtan André <rvlander@gaetanandre.eu>
---
 drivers/iio/accel/Kconfig         |  2 +-
 drivers/iio/accel/st_accel.h      |  2 +
 drivers/iio/accel/st_accel_core.c | 77 +++++++++++++++++++++++++++++++
 drivers/iio/accel/st_accel_i2c.c  |  5 ++
 4 files changed, 85 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig
index 5d91a6dda894..24ebe9e76915 100644
--- a/drivers/iio/accel/Kconfig
+++ b/drivers/iio/accel/Kconfig
@@ -238,7 +238,7 @@ config IIO_ST_ACCEL_3AXIS
 	  Say yes here to build support for STMicroelectronics accelerometers:
 	  LSM303DLH, LSM303DLHC, LIS3DH, LSM330D, LSM330DL, LSM330DLC,
 	  LIS331DLH, LSM303DL, LSM303DLM, LSM330, LIS2DH12, H3LIS331DL,
-	  LNG2DM, LIS3DE, LIS2DE12
+	  LNG2DM, LIS3DE, LIS2DE12, LIS2HH12
 
 	  This driver can also be built as a module. If so, these modules
 	  will be created:
diff --git a/drivers/iio/accel/st_accel.h b/drivers/iio/accel/st_accel.h
index 5b13e293cade..5d356288e001 100644
--- a/drivers/iio/accel/st_accel.h
+++ b/drivers/iio/accel/st_accel.h
@@ -35,6 +35,7 @@ enum st_accel_type {
 	LIS2DW12,
 	LIS3DHH,
 	LIS2DE12,
+	LIS2HH12,
 	ST_ACCEL_MAX,
 };
 
@@ -59,6 +60,7 @@ enum st_accel_type {
 #define LIS3DHH_ACCEL_DEV_NAME		"lis3dhh"
 #define LIS3DE_ACCEL_DEV_NAME		"lis3de"
 #define LIS2DE12_ACCEL_DEV_NAME		"lis2de12"
+#define LIS2HH12_ACCEL_DEV_NAME		"lis2hh12"
 
 /**
 * struct st_sensors_platform_data - default accel platform data
diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
index e2ec5d127495..43c50167d220 100644
--- a/drivers/iio/accel/st_accel_core.c
+++ b/drivers/iio/accel/st_accel_core.c
@@ -904,6 +904,83 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 		.multi_read_bit = true,
 		.bootime = 2,
 	},
+	{
+		.wai = 0x41,
+		.wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS,
+		.sensors_supported = {
+			[0] = LIS2HH12_ACCEL_DEV_NAME,
+		},
+		.ch = (struct iio_chan_spec *)st_accel_16bit_channels,
+		.odr = {
+			.addr = 0x20,
+			.mask = 0x70,
+			.odr_avl = {
+				{ .hz = 10, .value = 0x01, },
+				{ .hz = 50, .value = 0x02, },
+				{ .hz = 100, .value = 0x03, },
+				{ .hz = 200, .value = 0x04, },
+				{ .hz = 400, .value = 0x05, },
+				{ .hz = 800, .value = 0x06, },
+			},
+		},
+		.pw = {
+			.addr = 0x20,
+			.mask = 0x70,
+			.value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE,
+		},
+		.enable_axis = {
+			.addr = ST_SENSORS_DEFAULT_AXIS_ADDR,
+			.mask = ST_SENSORS_DEFAULT_AXIS_MASK,
+		},
+		.fs = {
+			.addr = 0x23,
+			.mask = 0x30,
+			.fs_avl = {
+				[0] = {
+					.num = ST_ACCEL_FS_AVL_2G,
+					.value = 0x00,
+					.gain = IIO_G_TO_M_S_2(61),
+				},
+				[1] = {
+					.num = ST_ACCEL_FS_AVL_4G,
+					.value = 0x02,
+					.gain = IIO_G_TO_M_S_2(122),
+				},
+				[2] = {
+					.num = ST_ACCEL_FS_AVL_8G,
+					.value = 0x03,
+					.gain = IIO_G_TO_M_S_2(244),
+				},
+			},
+		},
+		.bdu = {
+			.addr = 0x20,
+			.mask = 0x08,
+		},
+		.drdy_irq = {
+			.int1 = {
+				.addr = 0x22,
+				.mask = 0x01,
+			},
+			.int2 = {
+				.addr = 0x25,
+				.mask = 0x01,
+			},
+			.addr_ihl = 0x24,
+			.mask_ihl = 0x02,
+			.stat_drdy = {
+				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
+				.mask = 0x07,
+			},
+		},
+		.sim = {
+			.addr = 0x23,
+			.value = BIT(0),
+		},
+		.multi_read_bit = true,
+		.bootime = 2,
+	},
+
 };
 
 static int st_accel_read_raw(struct iio_dev *indio_dev,
diff --git a/drivers/iio/accel/st_accel_i2c.c b/drivers/iio/accel/st_accel_i2c.c
index 8c489312f668..821854251a7b 100644
--- a/drivers/iio/accel/st_accel_i2c.c
+++ b/drivers/iio/accel/st_accel_i2c.c
@@ -104,6 +104,10 @@ static const struct of_device_id st_accel_of_match[] = {
 		.compatible = "st,lis2de12",
 		.data = LIS2DE12_ACCEL_DEV_NAME,
 	},
+	{
+		.compatible = "st,lis2hh12",
+		.data = LIS2HH12_ACCEL_DEV_NAME,
+	},
 	{},
 };
 MODULE_DEVICE_TABLE(of, st_accel_of_match);
@@ -138,6 +142,7 @@ static const struct i2c_device_id st_accel_id_table[] = {
 	{ LIS2DW12_ACCEL_DEV_NAME },
 	{ LIS3DE_ACCEL_DEV_NAME },
 	{ LIS2DE12_ACCEL_DEV_NAME },
+	{ LIS2HH12_ACCEL_DEV_NAME },
 	{},
 };
 MODULE_DEVICE_TABLE(i2c, st_accel_id_table);
-- 
2.26.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] iio: accel: st_sensors:  add support for LIS2HH12
  2020-03-30 14:19 ` [PATCH 2/2] iio: accel: st_sensors: add support for LIS2HH12 Gaëtan André
@ 2020-03-30 17:10   ` Stephan Gerhold
  2020-04-04 15:42     ` Jonathan Cameron
  0 siblings, 1 reply; 5+ messages in thread
From: Stephan Gerhold @ 2020-03-30 17:10 UTC (permalink / raw)
  To: Gaëtan André
  Cc: jic23, linux-iio, devicetree, ~postmarketos/upstreaming

Hi,

On Mon, Mar 30, 2020 at 04:19:23PM +0200, Gaëtan André wrote:
> Add support for STMicroelectronics LISHH12 accelerometer in st_accel
> framework.
> 
> https://www.st.com/resource/en/datasheet/lis2hh12.pdf
> 
> Signed-off-by: Gaëtan André <rvlander@gaetanandre.eu>

Thanks a lot for sending this patch upstream!

> ---
>  drivers/iio/accel/Kconfig         |  2 +-
>  drivers/iio/accel/st_accel.h      |  2 +
>  drivers/iio/accel/st_accel_core.c | 77 +++++++++++++++++++++++++++++++
>  drivers/iio/accel/st_accel_i2c.c  |  5 ++
>  4 files changed, 85 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig
> index 5d91a6dda894..24ebe9e76915 100644
> --- a/drivers/iio/accel/Kconfig
> +++ b/drivers/iio/accel/Kconfig
> @@ -238,7 +238,7 @@ config IIO_ST_ACCEL_3AXIS
>  	  Say yes here to build support for STMicroelectronics accelerometers:
>  	  LSM303DLH, LSM303DLHC, LIS3DH, LSM330D, LSM330DL, LSM330DLC,
>  	  LIS331DLH, LSM303DL, LSM303DLM, LSM330, LIS2DH12, H3LIS331DL,
> -	  LNG2DM, LIS3DE, LIS2DE12
> +	  LNG2DM, LIS3DE, LIS2DE12, LIS2HH12
>  
>  	  This driver can also be built as a module. If so, these modules
>  	  will be created:
> diff --git a/drivers/iio/accel/st_accel.h b/drivers/iio/accel/st_accel.h
> index 5b13e293cade..5d356288e001 100644
> --- a/drivers/iio/accel/st_accel.h
> +++ b/drivers/iio/accel/st_accel.h
> @@ -35,6 +35,7 @@ enum st_accel_type {
>  	LIS2DW12,
>  	LIS3DHH,
>  	LIS2DE12,
> +	LIS2HH12,
>  	ST_ACCEL_MAX,
>  };
>  
> @@ -59,6 +60,7 @@ enum st_accel_type {
>  #define LIS3DHH_ACCEL_DEV_NAME		"lis3dhh"
>  #define LIS3DE_ACCEL_DEV_NAME		"lis3de"
>  #define LIS2DE12_ACCEL_DEV_NAME		"lis2de12"
> +#define LIS2HH12_ACCEL_DEV_NAME		"lis2hh12"
>  
>  /**
>  * struct st_sensors_platform_data - default accel platform data
> diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
> index e2ec5d127495..43c50167d220 100644
> --- a/drivers/iio/accel/st_accel_core.c
> +++ b/drivers/iio/accel/st_accel_core.c
> @@ -904,6 +904,83 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
>  		.multi_read_bit = true,
>  		.bootime = 2,
>  	},
> +	{
> +		.wai = 0x41,
> +		.wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS,
> +		.sensors_supported = {
> +			[0] = LIS2HH12_ACCEL_DEV_NAME,
> +		},
> +		.ch = (struct iio_chan_spec *)st_accel_16bit_channels,
> +		.odr = {
> +			.addr = 0x20,
> +			.mask = 0x70,
> +			.odr_avl = {
> +				{ .hz = 10, .value = 0x01, },
> +				{ .hz = 50, .value = 0x02, },
> +				{ .hz = 100, .value = 0x03, },
> +				{ .hz = 200, .value = 0x04, },
> +				{ .hz = 400, .value = 0x05, },
> +				{ .hz = 800, .value = 0x06, },
> +			},
> +		},
> +		.pw = {
> +			.addr = 0x20,
> +			.mask = 0x70,
> +			.value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE,
> +		},
> +		.enable_axis = {
> +			.addr = ST_SENSORS_DEFAULT_AXIS_ADDR,
> +			.mask = ST_SENSORS_DEFAULT_AXIS_MASK,
> +		},
> +		.fs = {
> +			.addr = 0x23,
> +			.mask = 0x30,
> +			.fs_avl = {
> +				[0] = {
> +					.num = ST_ACCEL_FS_AVL_2G,
> +					.value = 0x00,
> +					.gain = IIO_G_TO_M_S_2(61),
> +				},
> +				[1] = {
> +					.num = ST_ACCEL_FS_AVL_4G,
> +					.value = 0x02,
> +					.gain = IIO_G_TO_M_S_2(122),
> +				},
> +				[2] = {
> +					.num = ST_ACCEL_FS_AVL_8G,
> +					.value = 0x03,
> +					.gain = IIO_G_TO_M_S_2(244),
> +				},
> +			},
> +		},
> +		.bdu = {
> +			.addr = 0x20,
> +			.mask = 0x08,
> +		},
> +		.drdy_irq = {
> +			.int1 = {
> +				.addr = 0x22,
> +				.mask = 0x01,
> +			},
> +			.int2 = {
> +				.addr = 0x25,
> +				.mask = 0x01,
> +			},
> +			.addr_ihl = 0x24,
> +			.mask_ihl = 0x02,
> +			.stat_drdy = {
> +				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
> +				.mask = 0x07,
> +			},
> +		},
> +		.sim = {
> +			.addr = 0x23,
> +			.value = BIT(0),
> +		},
> +		.multi_read_bit = true,
> +		.bootime = 2,
> +	},
> +
>  };

I checked that this conforms to the information in the linked datasheet:

Reviewed-by: Stephan Gerhold <stephan@gerhold.net>

>  
>  static int st_accel_read_raw(struct iio_dev *indio_dev,
> diff --git a/drivers/iio/accel/st_accel_i2c.c b/drivers/iio/accel/st_accel_i2c.c
> index 8c489312f668..821854251a7b 100644
> --- a/drivers/iio/accel/st_accel_i2c.c
> +++ b/drivers/iio/accel/st_accel_i2c.c
> @@ -104,6 +104,10 @@ static const struct of_device_id st_accel_of_match[] = {
>  		.compatible = "st,lis2de12",
>  		.data = LIS2DE12_ACCEL_DEV_NAME,
>  	},
> +	{
> +		.compatible = "st,lis2hh12",
> +		.data = LIS2HH12_ACCEL_DEV_NAME,
> +	},
>  	{},
>  };
>  MODULE_DEVICE_TABLE(of, st_accel_of_match);
> @@ -138,6 +142,7 @@ static const struct i2c_device_id st_accel_id_table[] = {
>  	{ LIS2DW12_ACCEL_DEV_NAME },
>  	{ LIS3DE_ACCEL_DEV_NAME },
>  	{ LIS2DE12_ACCEL_DEV_NAME },
> +	{ LIS2HH12_ACCEL_DEV_NAME },
>  	{},
>  };
>  MODULE_DEVICE_TABLE(i2c, st_accel_id_table);
> -- 
> 2.26.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] dt-bindings: st_sensors: add st,lis2hh12 compatible entry
  2020-03-30 14:19 [PATCH 1/2] dt-bindings: st_sensors: add st,lis2hh12 compatible entry Gaëtan André
  2020-03-30 14:19 ` [PATCH 2/2] iio: accel: st_sensors: add support for LIS2HH12 Gaëtan André
@ 2020-04-04 15:41 ` Jonathan Cameron
  1 sibling, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2020-04-04 15:41 UTC (permalink / raw)
  To: Gaëtan André; +Cc: linux-iio, devicetree, ~postmarketos/upstreaming

On Mon, 30 Mar 2020 16:19:22 +0200
Gaëtan André <rvlander@gaetanandre.eu> wrote:

> Add LIS2HH12 compatible entry.
> 
> Signed-off-by: Gaëtan André <rvlander@gaetanandre.eu>
Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to ignore this patch (and build the next one!)

At somepoint we should look to convert this binding over to yaml.

Thanks,

Jonathan

> ---
>  Documentation/devicetree/bindings/iio/st-sensors.txt | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/devicetree/bindings/iio/st-sensors.txt b/Documentation/devicetree/bindings/iio/st-sensors.txt
> index 0ef64a444479..3213599c5071 100644
> --- a/Documentation/devicetree/bindings/iio/st-sensors.txt
> +++ b/Documentation/devicetree/bindings/iio/st-sensors.txt
> @@ -50,6 +50,7 @@ Accelerometers:
>  - st,lis3dhh
>  - st,lis3de
>  - st,lis2de12
> +- st,lis2hh12
>  
>  Gyroscopes:
>  - st,l3g4200d-gyro
> 
> base-commit: b723e9431b77976b83efb90178dfcada3405321c


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] iio: accel: st_sensors:  add support for LIS2HH12
  2020-03-30 17:10   ` Stephan Gerhold
@ 2020-04-04 15:42     ` Jonathan Cameron
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2020-04-04 15:42 UTC (permalink / raw)
  To: Stephan Gerhold
  Cc: Gaëtan André, linux-iio, devicetree, ~postmarketos/upstreaming

On Mon, 30 Mar 2020 19:10:31 +0200
Stephan Gerhold <stephan@gerhold.net> wrote:

> Hi,
> 
> On Mon, Mar 30, 2020 at 04:19:23PM +0200, Gaëtan André wrote:
> > Add support for STMicroelectronics LISHH12 accelerometer in st_accel
> > framework.
> > 
> > https://www.st.com/resource/en/datasheet/lis2hh12.pdf
> > 
> > Signed-off-by: Gaëtan André <rvlander@gaetanandre.eu>  
> 
> Thanks a lot for sending this patch upstream!

Thanks. Applied to the togreg branch of iio.git and pushed out as testing
for the various autobuilders to poke at it.

Thanks,

Jonathan

> 
> > ---
> >  drivers/iio/accel/Kconfig         |  2 +-
> >  drivers/iio/accel/st_accel.h      |  2 +
> >  drivers/iio/accel/st_accel_core.c | 77 +++++++++++++++++++++++++++++++
> >  drivers/iio/accel/st_accel_i2c.c  |  5 ++
> >  4 files changed, 85 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig
> > index 5d91a6dda894..24ebe9e76915 100644
> > --- a/drivers/iio/accel/Kconfig
> > +++ b/drivers/iio/accel/Kconfig
> > @@ -238,7 +238,7 @@ config IIO_ST_ACCEL_3AXIS
> >  	  Say yes here to build support for STMicroelectronics accelerometers:
> >  	  LSM303DLH, LSM303DLHC, LIS3DH, LSM330D, LSM330DL, LSM330DLC,
> >  	  LIS331DLH, LSM303DL, LSM303DLM, LSM330, LIS2DH12, H3LIS331DL,
> > -	  LNG2DM, LIS3DE, LIS2DE12
> > +	  LNG2DM, LIS3DE, LIS2DE12, LIS2HH12
> >  
> >  	  This driver can also be built as a module. If so, these modules
> >  	  will be created:
> > diff --git a/drivers/iio/accel/st_accel.h b/drivers/iio/accel/st_accel.h
> > index 5b13e293cade..5d356288e001 100644
> > --- a/drivers/iio/accel/st_accel.h
> > +++ b/drivers/iio/accel/st_accel.h
> > @@ -35,6 +35,7 @@ enum st_accel_type {
> >  	LIS2DW12,
> >  	LIS3DHH,
> >  	LIS2DE12,
> > +	LIS2HH12,
> >  	ST_ACCEL_MAX,
> >  };
> >  
> > @@ -59,6 +60,7 @@ enum st_accel_type {
> >  #define LIS3DHH_ACCEL_DEV_NAME		"lis3dhh"
> >  #define LIS3DE_ACCEL_DEV_NAME		"lis3de"
> >  #define LIS2DE12_ACCEL_DEV_NAME		"lis2de12"
> > +#define LIS2HH12_ACCEL_DEV_NAME		"lis2hh12"
> >  
> >  /**
> >  * struct st_sensors_platform_data - default accel platform data
> > diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
> > index e2ec5d127495..43c50167d220 100644
> > --- a/drivers/iio/accel/st_accel_core.c
> > +++ b/drivers/iio/accel/st_accel_core.c
> > @@ -904,6 +904,83 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
> >  		.multi_read_bit = true,
> >  		.bootime = 2,
> >  	},
> > +	{
> > +		.wai = 0x41,
> > +		.wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS,
> > +		.sensors_supported = {
> > +			[0] = LIS2HH12_ACCEL_DEV_NAME,
> > +		},
> > +		.ch = (struct iio_chan_spec *)st_accel_16bit_channels,
> > +		.odr = {
> > +			.addr = 0x20,
> > +			.mask = 0x70,
> > +			.odr_avl = {
> > +				{ .hz = 10, .value = 0x01, },
> > +				{ .hz = 50, .value = 0x02, },
> > +				{ .hz = 100, .value = 0x03, },
> > +				{ .hz = 200, .value = 0x04, },
> > +				{ .hz = 400, .value = 0x05, },
> > +				{ .hz = 800, .value = 0x06, },
> > +			},
> > +		},
> > +		.pw = {
> > +			.addr = 0x20,
> > +			.mask = 0x70,
> > +			.value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE,
> > +		},
> > +		.enable_axis = {
> > +			.addr = ST_SENSORS_DEFAULT_AXIS_ADDR,
> > +			.mask = ST_SENSORS_DEFAULT_AXIS_MASK,
> > +		},
> > +		.fs = {
> > +			.addr = 0x23,
> > +			.mask = 0x30,
> > +			.fs_avl = {
> > +				[0] = {
> > +					.num = ST_ACCEL_FS_AVL_2G,
> > +					.value = 0x00,
> > +					.gain = IIO_G_TO_M_S_2(61),
> > +				},
> > +				[1] = {
> > +					.num = ST_ACCEL_FS_AVL_4G,
> > +					.value = 0x02,
> > +					.gain = IIO_G_TO_M_S_2(122),
> > +				},
> > +				[2] = {
> > +					.num = ST_ACCEL_FS_AVL_8G,
> > +					.value = 0x03,
> > +					.gain = IIO_G_TO_M_S_2(244),
> > +				},
> > +			},
> > +		},
> > +		.bdu = {
> > +			.addr = 0x20,
> > +			.mask = 0x08,
> > +		},
> > +		.drdy_irq = {
> > +			.int1 = {
> > +				.addr = 0x22,
> > +				.mask = 0x01,
> > +			},
> > +			.int2 = {
> > +				.addr = 0x25,
> > +				.mask = 0x01,
> > +			},
> > +			.addr_ihl = 0x24,
> > +			.mask_ihl = 0x02,
> > +			.stat_drdy = {
> > +				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
> > +				.mask = 0x07,
> > +			},
> > +		},
> > +		.sim = {
> > +			.addr = 0x23,
> > +			.value = BIT(0),
> > +		},
> > +		.multi_read_bit = true,
> > +		.bootime = 2,
> > +	},
> > +
> >  };  
> 
> I checked that this conforms to the information in the linked datasheet:
> 
> Reviewed-by: Stephan Gerhold <stephan@gerhold.net>
> 
> >  
> >  static int st_accel_read_raw(struct iio_dev *indio_dev,
> > diff --git a/drivers/iio/accel/st_accel_i2c.c b/drivers/iio/accel/st_accel_i2c.c
> > index 8c489312f668..821854251a7b 100644
> > --- a/drivers/iio/accel/st_accel_i2c.c
> > +++ b/drivers/iio/accel/st_accel_i2c.c
> > @@ -104,6 +104,10 @@ static const struct of_device_id st_accel_of_match[] = {
> >  		.compatible = "st,lis2de12",
> >  		.data = LIS2DE12_ACCEL_DEV_NAME,
> >  	},
> > +	{
> > +		.compatible = "st,lis2hh12",
> > +		.data = LIS2HH12_ACCEL_DEV_NAME,
> > +	},
> >  	{},
> >  };
> >  MODULE_DEVICE_TABLE(of, st_accel_of_match);
> > @@ -138,6 +142,7 @@ static const struct i2c_device_id st_accel_id_table[] = {
> >  	{ LIS2DW12_ACCEL_DEV_NAME },
> >  	{ LIS3DE_ACCEL_DEV_NAME },
> >  	{ LIS2DE12_ACCEL_DEV_NAME },
> > +	{ LIS2HH12_ACCEL_DEV_NAME },
> >  	{},
> >  };
> >  MODULE_DEVICE_TABLE(i2c, st_accel_id_table);
> > -- 
> > 2.26.0  


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-04-04 15:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-30 14:19 [PATCH 1/2] dt-bindings: st_sensors: add st,lis2hh12 compatible entry Gaëtan André
2020-03-30 14:19 ` [PATCH 2/2] iio: accel: st_sensors: add support for LIS2HH12 Gaëtan André
2020-03-30 17:10   ` Stephan Gerhold
2020-04-04 15:42     ` Jonathan Cameron
2020-04-04 15:41 ` [PATCH 1/2] dt-bindings: st_sensors: add st,lis2hh12 compatible entry Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).