* [PATCH 0/2] add support to lng2dm accel sensor @ 2016-10-25 21:09 Lorenzo Bianconi [not found] ` <1477429744-27713-1-git-send-email-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: Lorenzo Bianconi @ 2016-10-25 21:09 UTC (permalink / raw) To: jic23-DgEjT+Ai2ygdnm+yROfE0A Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, lorenzo.bianconi-qxv4g6HH51o Lorenzo Bianconi (2): iio: accel: st_accel: add support to lng2dm Documentation: dt: iio: accel: add lng2dm sensor device binding .../devicetree/bindings/iio/st-sensors.txt | 1 + drivers/iio/accel/Kconfig | 3 +- drivers/iio/accel/st_accel.h | 1 + drivers/iio/accel/st_accel_core.c | 73 ++++++++++++++++++++++ drivers/iio/accel/st_accel_i2c.c | 5 ++ drivers/iio/accel/st_accel_spi.c | 1 + 6 files changed, 83 insertions(+), 1 deletion(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <1477429744-27713-1-git-send-email-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>]
* [PATCH 1/2] iio: accel: st_accel: add support to lng2dm [not found] ` <1477429744-27713-1-git-send-email-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org> @ 2016-10-25 21:09 ` Lorenzo Bianconi [not found] ` <1477429744-27713-2-git-send-email-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org> 2016-10-25 21:09 ` [PATCH 2/2] Documentation: dt: iio: accel: add lng2dm sensor device binding Lorenzo Bianconi 1 sibling, 1 reply; 6+ messages in thread From: Lorenzo Bianconi @ 2016-10-25 21:09 UTC (permalink / raw) To: jic23-DgEjT+Ai2ygdnm+yROfE0A Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, lorenzo.bianconi-qxv4g6HH51o add support to STMicroelectronics LNG2DM accelerometer to st_accel framework Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org> --- drivers/iio/accel/Kconfig | 3 +- drivers/iio/accel/st_accel.h | 1 + drivers/iio/accel/st_accel_core.c | 73 +++++++++++++++++++++++++++++++++++++++ drivers/iio/accel/st_accel_i2c.c | 5 +++ drivers/iio/accel/st_accel_spi.c | 1 + 5 files changed, 82 insertions(+), 1 deletion(-) diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig index c6cc2c0..c68bdb6 100644 --- a/drivers/iio/accel/Kconfig +++ b/drivers/iio/accel/Kconfig @@ -127,7 +127,8 @@ config IIO_ST_ACCEL_3AXIS help Say yes here to build support for STMicroelectronics accelerometers: LSM303DLH, LSM303DLHC, LIS3DH, LSM330D, LSM330DL, LSM330DLC, - LIS331DLH, LSM303DL, LSM303DLM, LSM330, LIS2DH12, H3LIS331DL. + LIS331DLH, LSM303DL, LSM303DLM, LSM330, LIS2DH12, H3LIS331DL, + LNG2DM 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 f8dfdb6..7c23168 100644 --- a/drivers/iio/accel/st_accel.h +++ b/drivers/iio/accel/st_accel.h @@ -30,6 +30,7 @@ #define LSM303AGR_ACCEL_DEV_NAME "lsm303agr_accel" #define LIS2DH12_ACCEL_DEV_NAME "lis2dh12_accel" #define LIS3L02DQ_ACCEL_DEV_NAME "lis3l02dq" +#define LNG2DM_ACCEL_DEV_NAME "lng2dm" /** * 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 ce69048..bdb619a 100644 --- a/drivers/iio/accel/st_accel_core.c +++ b/drivers/iio/accel/st_accel_core.c @@ -231,6 +231,12 @@ #define ST_ACCEL_7_DRDY_IRQ_INT1_MASK 0x04 #define ST_ACCEL_7_MULTIREAD_BIT false +/* CUSTOM VALUES FOR SENSOR 8 */ +#define ST_ACCEL_8_FS_AVL_2_GAIN IIO_G_TO_M_S_2(15600) +#define ST_ACCEL_8_FS_AVL_4_GAIN IIO_G_TO_M_S_2(31200) +#define ST_ACCEL_8_FS_AVL_8_GAIN IIO_G_TO_M_S_2(62500) +#define ST_ACCEL_8_FS_AVL_16_GAIN IIO_G_TO_M_S_2(187500) + static const struct iio_chan_spec st_accel_8bit_channels[] = { ST_SENSORS_LSM_CHANNELS(IIO_ACCEL, BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE), @@ -726,6 +732,73 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = { .multi_read_bit = ST_ACCEL_7_MULTIREAD_BIT, .bootime = 2, }, + { + .wai = ST_ACCEL_1_WAI_EXP, + .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS, + .sensors_supported = { + [0] = LNG2DM_ACCEL_DEV_NAME, + }, + .ch = (struct iio_chan_spec *)st_accel_8bit_channels, + .odr = { + .addr = ST_ACCEL_1_ODR_ADDR, + .mask = ST_ACCEL_1_ODR_MASK, + .odr_avl = { + { 1, ST_ACCEL_1_ODR_AVL_1HZ_VAL, }, + { 10, ST_ACCEL_1_ODR_AVL_10HZ_VAL, }, + { 25, ST_ACCEL_1_ODR_AVL_25HZ_VAL, }, + { 50, ST_ACCEL_1_ODR_AVL_50HZ_VAL, }, + { 100, ST_ACCEL_1_ODR_AVL_100HZ_VAL, }, + { 200, ST_ACCEL_1_ODR_AVL_200HZ_VAL, }, + { 400, ST_ACCEL_1_ODR_AVL_400HZ_VAL, }, + { 1600, ST_ACCEL_1_ODR_AVL_1600HZ_VAL, }, + }, + }, + .pw = { + .addr = ST_ACCEL_1_ODR_ADDR, + .mask = ST_ACCEL_1_ODR_MASK, + .value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE, + }, + .enable_axis = { + .addr = ST_SENSORS_DEFAULT_AXIS_ADDR, + .mask = ST_SENSORS_DEFAULT_AXIS_MASK, + }, + .fs = { + .addr = ST_ACCEL_1_FS_ADDR, + .mask = ST_ACCEL_1_FS_MASK, + .fs_avl = { + [0] = { + .num = ST_ACCEL_FS_AVL_2G, + .value = ST_ACCEL_1_FS_AVL_2_VAL, + .gain = ST_ACCEL_8_FS_AVL_2_GAIN, + }, + [1] = { + .num = ST_ACCEL_FS_AVL_4G, + .value = ST_ACCEL_1_FS_AVL_4_VAL, + .gain = ST_ACCEL_8_FS_AVL_4_GAIN, + }, + [2] = { + .num = ST_ACCEL_FS_AVL_8G, + .value = ST_ACCEL_1_FS_AVL_8_VAL, + .gain = ST_ACCEL_8_FS_AVL_8_GAIN, + }, + [3] = { + .num = ST_ACCEL_FS_AVL_16G, + .value = ST_ACCEL_1_FS_AVL_16_VAL, + .gain = ST_ACCEL_8_FS_AVL_16_GAIN, + }, + }, + }, + .drdy_irq = { + .addr = ST_ACCEL_1_DRDY_IRQ_ADDR, + .mask_int1 = ST_ACCEL_1_DRDY_IRQ_INT1_MASK, + .mask_int2 = ST_ACCEL_1_DRDY_IRQ_INT2_MASK, + .addr_ihl = ST_ACCEL_1_IHL_IRQ_ADDR, + .mask_ihl = ST_ACCEL_1_IHL_IRQ_MASK, + .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR, + }, + .multi_read_bit = ST_ACCEL_1_MULTIREAD_BIT, + .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 e9d427a..c0f8867 100644 --- a/drivers/iio/accel/st_accel_i2c.c +++ b/drivers/iio/accel/st_accel_i2c.c @@ -84,6 +84,10 @@ static const struct of_device_id st_accel_of_match[] = { .compatible = "st,lis3l02dq", .data = LIS3L02DQ_ACCEL_DEV_NAME, }, + { + .compatible = "st,lng2dm-accel", + .data = LNG2DM_ACCEL_DEV_NAME, + }, {}, }; MODULE_DEVICE_TABLE(of, st_accel_of_match); @@ -135,6 +139,7 @@ static const struct i2c_device_id st_accel_id_table[] = { { LSM303AGR_ACCEL_DEV_NAME }, { LIS2DH12_ACCEL_DEV_NAME }, { LIS3L02DQ_ACCEL_DEV_NAME }, + { LNG2DM_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 efd4394..c25ac50 100644 --- a/drivers/iio/accel/st_accel_spi.c +++ b/drivers/iio/accel/st_accel_spi.c @@ -60,6 +60,7 @@ static const struct spi_device_id st_accel_id_table[] = { { LSM303AGR_ACCEL_DEV_NAME }, { LIS2DH12_ACCEL_DEV_NAME }, { LIS3L02DQ_ACCEL_DEV_NAME }, + { LNG2DM_ACCEL_DEV_NAME }, {}, }; MODULE_DEVICE_TABLE(spi, st_accel_id_table); -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 6+ messages in thread
[parent not found: <1477429744-27713-2-git-send-email-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>]
* Re: [PATCH 1/2] iio: accel: st_accel: add support to lng2dm [not found] ` <1477429744-27713-2-git-send-email-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org> @ 2016-10-30 16:52 ` Jonathan Cameron [not found] ` <b28ade0a-204e-0200-48ee-1a6da3fd3b53-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: Jonathan Cameron @ 2016-10-30 16:52 UTC (permalink / raw) To: Lorenzo Bianconi Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, lorenzo.bianconi-qxv4g6HH51o, Denis CIOCCA On 25/10/16 22:09, Lorenzo Bianconi wrote: > add support to STMicroelectronics LNG2DM accelerometer to > st_accel framework > > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org> Looks fine to me. If anyone want to add anything it'll be in a tree I can rebase for at least a few days. Thanks, Jonathan > --- > drivers/iio/accel/Kconfig | 3 +- > drivers/iio/accel/st_accel.h | 1 + > drivers/iio/accel/st_accel_core.c | 73 +++++++++++++++++++++++++++++++++++++++ > drivers/iio/accel/st_accel_i2c.c | 5 +++ > drivers/iio/accel/st_accel_spi.c | 1 + > 5 files changed, 82 insertions(+), 1 deletion(-) > > diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig > index c6cc2c0..c68bdb6 100644 > --- a/drivers/iio/accel/Kconfig > +++ b/drivers/iio/accel/Kconfig > @@ -127,7 +127,8 @@ config IIO_ST_ACCEL_3AXIS > help > Say yes here to build support for STMicroelectronics accelerometers: > LSM303DLH, LSM303DLHC, LIS3DH, LSM330D, LSM330DL, LSM330DLC, > - LIS331DLH, LSM303DL, LSM303DLM, LSM330, LIS2DH12, H3LIS331DL. > + LIS331DLH, LSM303DL, LSM303DLM, LSM330, LIS2DH12, H3LIS331DL, > + LNG2DM > > 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 f8dfdb6..7c23168 100644 > --- a/drivers/iio/accel/st_accel.h > +++ b/drivers/iio/accel/st_accel.h > @@ -30,6 +30,7 @@ > #define LSM303AGR_ACCEL_DEV_NAME "lsm303agr_accel" > #define LIS2DH12_ACCEL_DEV_NAME "lis2dh12_accel" > #define LIS3L02DQ_ACCEL_DEV_NAME "lis3l02dq" > +#define LNG2DM_ACCEL_DEV_NAME "lng2dm" > > /** > * 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 ce69048..bdb619a 100644 > --- a/drivers/iio/accel/st_accel_core.c > +++ b/drivers/iio/accel/st_accel_core.c > @@ -231,6 +231,12 @@ > #define ST_ACCEL_7_DRDY_IRQ_INT1_MASK 0x04 > #define ST_ACCEL_7_MULTIREAD_BIT false > > +/* CUSTOM VALUES FOR SENSOR 8 */ > +#define ST_ACCEL_8_FS_AVL_2_GAIN IIO_G_TO_M_S_2(15600) > +#define ST_ACCEL_8_FS_AVL_4_GAIN IIO_G_TO_M_S_2(31200) > +#define ST_ACCEL_8_FS_AVL_8_GAIN IIO_G_TO_M_S_2(62500) > +#define ST_ACCEL_8_FS_AVL_16_GAIN IIO_G_TO_M_S_2(187500) > + > static const struct iio_chan_spec st_accel_8bit_channels[] = { > ST_SENSORS_LSM_CHANNELS(IIO_ACCEL, > BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE), > @@ -726,6 +732,73 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = { > .multi_read_bit = ST_ACCEL_7_MULTIREAD_BIT, > .bootime = 2, > }, > + { > + .wai = ST_ACCEL_1_WAI_EXP, > + .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS, > + .sensors_supported = { > + [0] = LNG2DM_ACCEL_DEV_NAME, > + }, > + .ch = (struct iio_chan_spec *)st_accel_8bit_channels, > + .odr = { > + .addr = ST_ACCEL_1_ODR_ADDR, > + .mask = ST_ACCEL_1_ODR_MASK, > + .odr_avl = { > + { 1, ST_ACCEL_1_ODR_AVL_1HZ_VAL, }, > + { 10, ST_ACCEL_1_ODR_AVL_10HZ_VAL, }, > + { 25, ST_ACCEL_1_ODR_AVL_25HZ_VAL, }, > + { 50, ST_ACCEL_1_ODR_AVL_50HZ_VAL, }, > + { 100, ST_ACCEL_1_ODR_AVL_100HZ_VAL, }, > + { 200, ST_ACCEL_1_ODR_AVL_200HZ_VAL, }, > + { 400, ST_ACCEL_1_ODR_AVL_400HZ_VAL, }, > + { 1600, ST_ACCEL_1_ODR_AVL_1600HZ_VAL, }, > + }, > + }, > + .pw = { > + .addr = ST_ACCEL_1_ODR_ADDR, > + .mask = ST_ACCEL_1_ODR_MASK, > + .value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE, > + }, > + .enable_axis = { > + .addr = ST_SENSORS_DEFAULT_AXIS_ADDR, > + .mask = ST_SENSORS_DEFAULT_AXIS_MASK, > + }, > + .fs = { > + .addr = ST_ACCEL_1_FS_ADDR, > + .mask = ST_ACCEL_1_FS_MASK, > + .fs_avl = { > + [0] = { > + .num = ST_ACCEL_FS_AVL_2G, > + .value = ST_ACCEL_1_FS_AVL_2_VAL, > + .gain = ST_ACCEL_8_FS_AVL_2_GAIN, > + }, > + [1] = { > + .num = ST_ACCEL_FS_AVL_4G, > + .value = ST_ACCEL_1_FS_AVL_4_VAL, > + .gain = ST_ACCEL_8_FS_AVL_4_GAIN, > + }, > + [2] = { > + .num = ST_ACCEL_FS_AVL_8G, > + .value = ST_ACCEL_1_FS_AVL_8_VAL, > + .gain = ST_ACCEL_8_FS_AVL_8_GAIN, > + }, > + [3] = { > + .num = ST_ACCEL_FS_AVL_16G, > + .value = ST_ACCEL_1_FS_AVL_16_VAL, > + .gain = ST_ACCEL_8_FS_AVL_16_GAIN, > + }, > + }, > + }, > + .drdy_irq = { > + .addr = ST_ACCEL_1_DRDY_IRQ_ADDR, > + .mask_int1 = ST_ACCEL_1_DRDY_IRQ_INT1_MASK, > + .mask_int2 = ST_ACCEL_1_DRDY_IRQ_INT2_MASK, > + .addr_ihl = ST_ACCEL_1_IHL_IRQ_ADDR, > + .mask_ihl = ST_ACCEL_1_IHL_IRQ_MASK, > + .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR, > + }, > + .multi_read_bit = ST_ACCEL_1_MULTIREAD_BIT, > + .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 e9d427a..c0f8867 100644 > --- a/drivers/iio/accel/st_accel_i2c.c > +++ b/drivers/iio/accel/st_accel_i2c.c > @@ -84,6 +84,10 @@ static const struct of_device_id st_accel_of_match[] = { > .compatible = "st,lis3l02dq", > .data = LIS3L02DQ_ACCEL_DEV_NAME, > }, > + { > + .compatible = "st,lng2dm-accel", > + .data = LNG2DM_ACCEL_DEV_NAME, > + }, > {}, > }; > MODULE_DEVICE_TABLE(of, st_accel_of_match); > @@ -135,6 +139,7 @@ static const struct i2c_device_id st_accel_id_table[] = { > { LSM303AGR_ACCEL_DEV_NAME }, > { LIS2DH12_ACCEL_DEV_NAME }, > { LIS3L02DQ_ACCEL_DEV_NAME }, > + { LNG2DM_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 efd4394..c25ac50 100644 > --- a/drivers/iio/accel/st_accel_spi.c > +++ b/drivers/iio/accel/st_accel_spi.c > @@ -60,6 +60,7 @@ static const struct spi_device_id st_accel_id_table[] = { > { LSM303AGR_ACCEL_DEV_NAME }, > { LIS2DH12_ACCEL_DEV_NAME }, > { LIS3L02DQ_ACCEL_DEV_NAME }, > + { LNG2DM_ACCEL_DEV_NAME }, > {}, > }; > MODULE_DEVICE_TABLE(spi, st_accel_id_table); > -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <b28ade0a-204e-0200-48ee-1a6da3fd3b53-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>]
* Re: [PATCH 1/2] iio: accel: st_accel: add support to lng2dm [not found] ` <b28ade0a-204e-0200-48ee-1a6da3fd3b53-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> @ 2016-10-31 3:24 ` Denis Ciocca 0 siblings, 0 replies; 6+ messages in thread From: Denis Ciocca @ 2016-10-31 3:24 UTC (permalink / raw) To: Jonathan Cameron, Lorenzo Bianconi Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Lorenzo BIANCONI Hi, good to me. Denis On 10/31/2016 12:52 AM, Jonathan Cameron wrote: > On 25/10/16 22:09, Lorenzo Bianconi wrote: >> add support to STMicroelectronics LNG2DM accelerometer to >> st_accel framework >> >> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org> > Looks fine to me. If anyone want to add anything it'll be in > a tree I can rebase for at least a few days. > > Thanks, > > Jonathan >> --- >> drivers/iio/accel/Kconfig | 3 +- >> drivers/iio/accel/st_accel.h | 1 + >> drivers/iio/accel/st_accel_core.c | 73 +++++++++++++++++++++++++++++++++++++++ >> drivers/iio/accel/st_accel_i2c.c | 5 +++ >> drivers/iio/accel/st_accel_spi.c | 1 + >> 5 files changed, 82 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig >> index c6cc2c0..c68bdb6 100644 >> --- a/drivers/iio/accel/Kconfig >> +++ b/drivers/iio/accel/Kconfig >> @@ -127,7 +127,8 @@ config IIO_ST_ACCEL_3AXIS >> help >> Say yes here to build support for STMicroelectronics accelerometers: >> LSM303DLH, LSM303DLHC, LIS3DH, LSM330D, LSM330DL, LSM330DLC, >> - LIS331DLH, LSM303DL, LSM303DLM, LSM330, LIS2DH12, H3LIS331DL. >> + LIS331DLH, LSM303DL, LSM303DLM, LSM330, LIS2DH12, H3LIS331DL, >> + LNG2DM >> >> 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 f8dfdb6..7c23168 100644 >> --- a/drivers/iio/accel/st_accel.h >> +++ b/drivers/iio/accel/st_accel.h >> @@ -30,6 +30,7 @@ >> #define LSM303AGR_ACCEL_DEV_NAME "lsm303agr_accel" >> #define LIS2DH12_ACCEL_DEV_NAME "lis2dh12_accel" >> #define LIS3L02DQ_ACCEL_DEV_NAME "lis3l02dq" >> +#define LNG2DM_ACCEL_DEV_NAME "lng2dm" >> >> /** >> * 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 ce69048..bdb619a 100644 >> --- a/drivers/iio/accel/st_accel_core.c >> +++ b/drivers/iio/accel/st_accel_core.c >> @@ -231,6 +231,12 @@ >> #define ST_ACCEL_7_DRDY_IRQ_INT1_MASK 0x04 >> #define ST_ACCEL_7_MULTIREAD_BIT false >> >> +/* CUSTOM VALUES FOR SENSOR 8 */ >> +#define ST_ACCEL_8_FS_AVL_2_GAIN IIO_G_TO_M_S_2(15600) >> +#define ST_ACCEL_8_FS_AVL_4_GAIN IIO_G_TO_M_S_2(31200) >> +#define ST_ACCEL_8_FS_AVL_8_GAIN IIO_G_TO_M_S_2(62500) >> +#define ST_ACCEL_8_FS_AVL_16_GAIN IIO_G_TO_M_S_2(187500) >> + >> static const struct iio_chan_spec st_accel_8bit_channels[] = { >> ST_SENSORS_LSM_CHANNELS(IIO_ACCEL, >> BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE), >> @@ -726,6 +732,73 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = { >> .multi_read_bit = ST_ACCEL_7_MULTIREAD_BIT, >> .bootime = 2, >> }, >> + { >> + .wai = ST_ACCEL_1_WAI_EXP, >> + .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS, >> + .sensors_supported = { >> + [0] = LNG2DM_ACCEL_DEV_NAME, >> + }, >> + .ch = (struct iio_chan_spec *)st_accel_8bit_channels, >> + .odr = { >> + .addr = ST_ACCEL_1_ODR_ADDR, >> + .mask = ST_ACCEL_1_ODR_MASK, >> + .odr_avl = { >> + { 1, ST_ACCEL_1_ODR_AVL_1HZ_VAL, }, >> + { 10, ST_ACCEL_1_ODR_AVL_10HZ_VAL, }, >> + { 25, ST_ACCEL_1_ODR_AVL_25HZ_VAL, }, >> + { 50, ST_ACCEL_1_ODR_AVL_50HZ_VAL, }, >> + { 100, ST_ACCEL_1_ODR_AVL_100HZ_VAL, }, >> + { 200, ST_ACCEL_1_ODR_AVL_200HZ_VAL, }, >> + { 400, ST_ACCEL_1_ODR_AVL_400HZ_VAL, }, >> + { 1600, ST_ACCEL_1_ODR_AVL_1600HZ_VAL, }, >> + }, >> + }, >> + .pw = { >> + .addr = ST_ACCEL_1_ODR_ADDR, >> + .mask = ST_ACCEL_1_ODR_MASK, >> + .value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE, >> + }, >> + .enable_axis = { >> + .addr = ST_SENSORS_DEFAULT_AXIS_ADDR, >> + .mask = ST_SENSORS_DEFAULT_AXIS_MASK, >> + }, >> + .fs = { >> + .addr = ST_ACCEL_1_FS_ADDR, >> + .mask = ST_ACCEL_1_FS_MASK, >> + .fs_avl = { >> + [0] = { >> + .num = ST_ACCEL_FS_AVL_2G, >> + .value = ST_ACCEL_1_FS_AVL_2_VAL, >> + .gain = ST_ACCEL_8_FS_AVL_2_GAIN, >> + }, >> + [1] = { >> + .num = ST_ACCEL_FS_AVL_4G, >> + .value = ST_ACCEL_1_FS_AVL_4_VAL, >> + .gain = ST_ACCEL_8_FS_AVL_4_GAIN, >> + }, >> + [2] = { >> + .num = ST_ACCEL_FS_AVL_8G, >> + .value = ST_ACCEL_1_FS_AVL_8_VAL, >> + .gain = ST_ACCEL_8_FS_AVL_8_GAIN, >> + }, >> + [3] = { >> + .num = ST_ACCEL_FS_AVL_16G, >> + .value = ST_ACCEL_1_FS_AVL_16_VAL, >> + .gain = ST_ACCEL_8_FS_AVL_16_GAIN, >> + }, >> + }, >> + }, >> + .drdy_irq = { >> + .addr = ST_ACCEL_1_DRDY_IRQ_ADDR, >> + .mask_int1 = ST_ACCEL_1_DRDY_IRQ_INT1_MASK, >> + .mask_int2 = ST_ACCEL_1_DRDY_IRQ_INT2_MASK, >> + .addr_ihl = ST_ACCEL_1_IHL_IRQ_ADDR, >> + .mask_ihl = ST_ACCEL_1_IHL_IRQ_MASK, >> + .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR, >> + }, >> + .multi_read_bit = ST_ACCEL_1_MULTIREAD_BIT, >> + .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 e9d427a..c0f8867 100644 >> --- a/drivers/iio/accel/st_accel_i2c.c >> +++ b/drivers/iio/accel/st_accel_i2c.c >> @@ -84,6 +84,10 @@ static const struct of_device_id st_accel_of_match[] = { >> .compatible = "st,lis3l02dq", >> .data = LIS3L02DQ_ACCEL_DEV_NAME, >> }, >> + { >> + .compatible = "st,lng2dm-accel", >> + .data = LNG2DM_ACCEL_DEV_NAME, >> + }, >> {}, >> }; >> MODULE_DEVICE_TABLE(of, st_accel_of_match); >> @@ -135,6 +139,7 @@ static const struct i2c_device_id st_accel_id_table[] = { >> { LSM303AGR_ACCEL_DEV_NAME }, >> { LIS2DH12_ACCEL_DEV_NAME }, >> { LIS3L02DQ_ACCEL_DEV_NAME }, >> + { LNG2DM_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 efd4394..c25ac50 100644 >> --- a/drivers/iio/accel/st_accel_spi.c >> +++ b/drivers/iio/accel/st_accel_spi.c >> @@ -60,6 +60,7 @@ static const struct spi_device_id st_accel_id_table[] = { >> { LSM303AGR_ACCEL_DEV_NAME }, >> { LIS2DH12_ACCEL_DEV_NAME }, >> { LIS3L02DQ_ACCEL_DEV_NAME }, >> + { LNG2DM_ACCEL_DEV_NAME }, >> {}, >> }; >> MODULE_DEVICE_TABLE(spi, st_accel_id_table); >> -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/2] Documentation: dt: iio: accel: add lng2dm sensor device binding [not found] ` <1477429744-27713-1-git-send-email-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org> 2016-10-25 21:09 ` [PATCH 1/2] iio: accel: st_accel: add support to lng2dm Lorenzo Bianconi @ 2016-10-25 21:09 ` Lorenzo Bianconi [not found] ` <1477429744-27713-3-git-send-email-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org> 1 sibling, 1 reply; 6+ messages in thread From: Lorenzo Bianconi @ 2016-10-25 21:09 UTC (permalink / raw) To: jic23-DgEjT+Ai2ygdnm+yROfE0A Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, lorenzo.bianconi-qxv4g6HH51o Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org> --- 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 e41fe34..c040c9a 100644 --- a/Documentation/devicetree/bindings/iio/st-sensors.txt +++ b/Documentation/devicetree/bindings/iio/st-sensors.txt @@ -42,6 +42,7 @@ Accelerometers: - st,lsm303agr-accel - st,lis2dh12-accel - st,h3lis331dl-accel +- st,lng2dm-accel Gyroscopes: - st,l3g4200d-gyro -- 2.7.4 ^ permalink raw reply related [flat|nested] 6+ messages in thread
[parent not found: <1477429744-27713-3-git-send-email-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>]
* Re: [PATCH 2/2] Documentation: dt: iio: accel: add lng2dm sensor device binding [not found] ` <1477429744-27713-3-git-send-email-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org> @ 2016-10-30 16:53 ` Jonathan Cameron 0 siblings, 0 replies; 6+ messages in thread From: Jonathan Cameron @ 2016-10-30 16:53 UTC (permalink / raw) To: Lorenzo Bianconi Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, lorenzo.bianconi-qxv4g6HH51o On 25/10/16 22:09, Lorenzo Bianconi wrote: > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org> Applied. > --- > 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 e41fe34..c040c9a 100644 > --- a/Documentation/devicetree/bindings/iio/st-sensors.txt > +++ b/Documentation/devicetree/bindings/iio/st-sensors.txt > @@ -42,6 +42,7 @@ Accelerometers: > - st,lsm303agr-accel > - st,lis2dh12-accel > - st,h3lis331dl-accel > +- st,lng2dm-accel > > Gyroscopes: > - st,l3g4200d-gyro > ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-10-31 3:24 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-10-25 21:09 [PATCH 0/2] add support to lng2dm accel sensor Lorenzo Bianconi [not found] ` <1477429744-27713-1-git-send-email-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org> 2016-10-25 21:09 ` [PATCH 1/2] iio: accel: st_accel: add support to lng2dm Lorenzo Bianconi [not found] ` <1477429744-27713-2-git-send-email-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org> 2016-10-30 16:52 ` Jonathan Cameron [not found] ` <b28ade0a-204e-0200-48ee-1a6da3fd3b53-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> 2016-10-31 3:24 ` Denis Ciocca 2016-10-25 21:09 ` [PATCH 2/2] Documentation: dt: iio: accel: add lng2dm sensor device binding Lorenzo Bianconi [not found] ` <1477429744-27713-3-git-send-email-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org> 2016-10-30 16:53 ` 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).