devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Stephan Gerhold <stephan@gerhold.net>
Cc: "Gaëtan André" <rvlander@gaetanandre.eu>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	~postmarketos/upstreaming@lists.sr.ht
Subject: Re: [PATCH 2/2] iio: accel: st_sensors:  add support for LIS2HH12
Date: Sat, 4 Apr 2020 16:42:34 +0100	[thread overview]
Message-ID: <20200404164234.2e8a80d5@archlinux> (raw)
In-Reply-To: <20200330171031.GA41042@gerhold.net>

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  


  reply	other threads:[~2020-04-04 15:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2020-04-04 15:41 ` [PATCH 1/2] dt-bindings: st_sensors: add st,lis2hh12 compatible entry Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200404164234.2e8a80d5@archlinux \
    --to=jic23@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=rvlander@gaetanandre.eu \
    --cc=stephan@gerhold.net \
    --cc=~postmarketos/upstreaming@lists.sr.ht \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).