From: Jonathan Cameron <jic23@kernel.org>
To: Gregor Boirie <gregor.boirie@parrot.com>, linux-iio@vger.kernel.org
Cc: Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
Denis Ciocca <denis.ciocca@st.com>,
Linus Walleij <linus.walleij@linaro.org>,
Giuseppe Barba <giuseppe.barba@st.com>
Subject: Re: [RFC PATCH v1 1/9] iio:st_pressure:initial lps22hb sensor support
Date: Sun, 1 May 2016 20:28:39 +0100 [thread overview]
Message-ID: <7670eb99-fdec-f14d-c8ac-35b155398479@kernel.org> (raw)
In-Reply-To: <a4333aa7-5403-3110-5c8f-e7ee977104eb@kernel.org>
On 24/04/16 10:29, Jonathan Cameron wrote:
> On 19/04/16 10:18, Gregor Boirie wrote:
>> Initial support for ST LPS22HB pressure sensor. Datasheet:
>> http://www2.st.com/resource/en/datasheet/lps22hb.pdf
>>
>> Features:
>> * pressure data and timestamping channels
>> * sampling frequency selection
>> * interrupt based trigger
>> * over I2C or SPI
>>
>> Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
> Looks good to me. I would however like an Ack from Denis if possible
> as this is his driver. Same is true for this whole series.
Denis, are you likely to get a chance to look at this series?
No immediate rush if you are busy right now as we've almost certainly
missed the merge window anyway and there are open questions on approach
taken in patch 4.
Jonathan
>
> Jonathan
>> ---
>> .../devicetree/bindings/iio/st-sensors.txt | 1 +
>> drivers/iio/pressure/Kconfig | 2 +-
>> drivers/iio/pressure/st_pressure.h | 1 +
>> drivers/iio/pressure/st_pressure_core.c | 93 +++++++++++++++++++++-
>> drivers/iio/pressure/st_pressure_i2c.c | 4 +
>> drivers/iio/pressure/st_pressure_spi.c | 1 +
>> 6 files changed, 97 insertions(+), 5 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/iio/st-sensors.txt b/Documentation/devicetree/bindings/iio/st-sensors.txt
>> index 637e283..2bb8931 100644
>> --- a/Documentation/devicetree/bindings/iio/st-sensors.txt
>> +++ b/Documentation/devicetree/bindings/iio/st-sensors.txt
>> @@ -63,3 +63,4 @@ Pressure sensors:
>> - st,lps001wp-press
>> - st,lps25h-press
>> - st,lps331ap-press
>> +- st,lps22hb-press
>> diff --git a/drivers/iio/pressure/Kconfig b/drivers/iio/pressure/Kconfig
>> index 8de0192..d63d280 100644
>> --- a/drivers/iio/pressure/Kconfig
>> +++ b/drivers/iio/pressure/Kconfig
>> @@ -118,7 +118,7 @@ config IIO_ST_PRESS
>> select IIO_TRIGGERED_BUFFER if (IIO_BUFFER)
>> help
>> Say yes here to build support for STMicroelectronics pressure
>> - sensors: LPS001WP, LPS25H, LPS331AP.
>> + sensors: LPS001WP, LPS25H, LPS331AP, LPS22HB.
>>
>> This driver can also be built as a module. If so, these modules
>> will be created:
>> diff --git a/drivers/iio/pressure/st_pressure.h b/drivers/iio/pressure/st_pressure.h
>> index f5f4149..903a21e 100644
>> --- a/drivers/iio/pressure/st_pressure.h
>> +++ b/drivers/iio/pressure/st_pressure.h
>> @@ -17,6 +17,7 @@
>> #define LPS001WP_PRESS_DEV_NAME "lps001wp"
>> #define LPS25H_PRESS_DEV_NAME "lps25h"
>> #define LPS331AP_PRESS_DEV_NAME "lps331ap"
>> +#define LPS22HB_PRESS_DEV_NAME "lps22hb"
>>
>> /**
>> * struct st_sensors_platform_data - default press platform data
>> diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
>> index 9e9b72a..c0ff3bf 100644
>> --- a/drivers/iio/pressure/st_pressure_core.c
>> +++ b/drivers/iio/pressure/st_pressure_core.c
>> @@ -113,6 +113,26 @@
>> #define ST_PRESS_LPS25H_OUT_XL_ADDR 0x28
>> #define ST_TEMP_LPS25H_OUT_L_ADDR 0x2b
>>
>> +/* CUSTOM VALUES FOR LPS22HB SENSOR */
>> +#define ST_PRESS_LPS22HB_WAI_EXP 0xb1
>> +#define ST_PRESS_LPS22HB_ODR_ADDR 0x10
>> +#define ST_PRESS_LPS22HB_ODR_MASK 0x70
>> +#define ST_PRESS_LPS22HB_ODR_AVL_1HZ_VAL 0x01
>> +#define ST_PRESS_LPS22HB_ODR_AVL_10HZ_VAL 0x02
>> +#define ST_PRESS_LPS22HB_ODR_AVL_25HZ_VAL 0x03
>> +#define ST_PRESS_LPS22HB_ODR_AVL_50HZ_VAL 0x04
>> +#define ST_PRESS_LPS22HB_ODR_AVL_75HZ_VAL 0x05
>> +#define ST_PRESS_LPS22HB_PW_ADDR 0x10
>> +#define ST_PRESS_LPS22HB_PW_MASK 0x70
>> +#define ST_PRESS_LPS22HB_BDU_ADDR 0x10
>> +#define ST_PRESS_LPS22HB_BDU_MASK 0x02
>> +#define ST_PRESS_LPS22HB_DRDY_IRQ_ADDR 0x12
>> +#define ST_PRESS_LPS22HB_DRDY_IRQ_INT1_MASK 0x04
>> +#define ST_PRESS_LPS22HB_DRDY_IRQ_INT2_MASK 0x08
>> +#define ST_PRESS_LPS22HB_IHL_IRQ_ADDR 0x12
>> +#define ST_PRESS_LPS22HB_IHL_IRQ_MASK 0x80
>> +#define ST_PRESS_LPS22HB_MULTIREAD_BIT true
>> +
>> static const struct iio_chan_spec st_press_1_channels[] = {
>> {
>> .type = IIO_PRESSURE,
>> @@ -183,6 +203,27 @@ static const struct iio_chan_spec st_press_lps001wp_channels[] = {
>> IIO_CHAN_SOFT_TIMESTAMP(1)
>> };
>>
>> +static const struct iio_chan_spec st_press_lps22hb_channels[] = {
>> + {
>> + .type = IIO_PRESSURE,
>> + .channel2 = IIO_NO_MOD,
>> + .address = ST_PRESS_1_OUT_XL_ADDR,
>> + .scan_index = 0,
>> + .scan_type = {
>> + .sign = 'u',
>> + .realbits = 24,
>> + .storagebits = 24,
>> + .endianness = IIO_LE,
>> + },
>> + .info_mask_separate =
>> + BIT(IIO_CHAN_INFO_RAW) |
>> + BIT(IIO_CHAN_INFO_SCALE),
>> + .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ),
>> + .modified = 0,
>> + },
>> + IIO_CHAN_SOFT_TIMESTAMP(1)
>> +};
>> +
>> static const struct st_sensor_settings st_press_sensors_settings[] = {
>> {
>> .wai = ST_PRESS_LPS331AP_WAI_EXP,
>> @@ -326,6 +367,51 @@ static const struct st_sensor_settings st_press_sensors_settings[] = {
>> .multi_read_bit = ST_PRESS_LPS25H_MULTIREAD_BIT,
>> .bootime = 2,
>> },
>> + {
>> + .wai = ST_PRESS_LPS22HB_WAI_EXP,
>> + .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS,
>> + .sensors_supported = {
>> + [0] = LPS22HB_PRESS_DEV_NAME,
>> + },
>> + .ch = (struct iio_chan_spec *)st_press_lps22hb_channels,
>> + .num_ch = ARRAY_SIZE(st_press_lps22hb_channels),
>> + .odr = {
>> + .addr = ST_PRESS_LPS22HB_ODR_ADDR,
>> + .mask = ST_PRESS_LPS22HB_ODR_MASK,
>> + .odr_avl = {
>> + { 1, ST_PRESS_LPS22HB_ODR_AVL_1HZ_VAL, },
>> + { 10, ST_PRESS_LPS22HB_ODR_AVL_10HZ_VAL, },
>> + { 25, ST_PRESS_LPS22HB_ODR_AVL_25HZ_VAL, },
>> + { 50, ST_PRESS_LPS22HB_ODR_AVL_50HZ_VAL, },
>> + { 75, ST_PRESS_LPS22HB_ODR_AVL_75HZ_VAL, },
>> + },
>> + },
>> + .pw = {
>> + .addr = ST_PRESS_LPS22HB_PW_ADDR,
>> + .mask = ST_PRESS_LPS22HB_PW_MASK,
>> + .value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE,
>> + },
>> + .fs = {
>> + .fs_avl = {
>> + [0] = {
>> + .num = ST_PRESS_FS_AVL_1260MB,
>> + .gain = ST_PRESS_KPASCAL_NANO_SCALE,
>> + },
>> + },
>> + },
>> + .bdu = {
>> + .addr = ST_PRESS_LPS22HB_BDU_ADDR,
>> + .mask = ST_PRESS_LPS22HB_BDU_MASK,
>> + },
>> + .drdy_irq = {
>> + .addr = ST_PRESS_LPS22HB_DRDY_IRQ_ADDR,
>> + .mask_int1 = ST_PRESS_LPS22HB_DRDY_IRQ_INT1_MASK,
>> + .mask_int2 = ST_PRESS_LPS22HB_DRDY_IRQ_INT2_MASK,
>> + .addr_ihl = ST_PRESS_LPS22HB_IHL_IRQ_ADDR,
>> + .mask_ihl = ST_PRESS_LPS22HB_IHL_IRQ_MASK,
>> + },
>> + .multi_read_bit = ST_PRESS_LPS22HB_MULTIREAD_BIT,
>> + },
>> };
>>
>> static int st_press_write_raw(struct iio_dev *indio_dev,
>> @@ -454,10 +540,9 @@ int st_press_common_probe(struct iio_dev *indio_dev)
>> indio_dev->channels = press_data->sensor_settings->ch;
>> indio_dev->num_channels = press_data->sensor_settings->num_ch;
>>
>> - if (press_data->sensor_settings->fs.addr != 0)
>> - press_data->current_fullscale =
>> - (struct st_sensor_fullscale_avl *)
>> - &press_data->sensor_settings->fs.fs_avl[0];
>> + press_data->current_fullscale =
>> + (struct st_sensor_fullscale_avl *)
>> + &press_data->sensor_settings->fs.fs_avl[0];
>>
>> press_data->odr = press_data->sensor_settings->odr.odr_avl[0].hz;
>>
>> diff --git a/drivers/iio/pressure/st_pressure_i2c.c b/drivers/iio/pressure/st_pressure_i2c.c
>> index 8fcf976..ed18701 100644
>> --- a/drivers/iio/pressure/st_pressure_i2c.c
>> +++ b/drivers/iio/pressure/st_pressure_i2c.c
>> @@ -32,6 +32,10 @@ static const struct of_device_id st_press_of_match[] = {
>> .compatible = "st,lps331ap-press",
>> .data = LPS331AP_PRESS_DEV_NAME,
>> },
>> + {
>> + .compatible = "st,lps22hb-press",
>> + .data = LPS22HB_PRESS_DEV_NAME,
>> + },
>> {},
>> };
>> MODULE_DEVICE_TABLE(of, st_press_of_match);
>> diff --git a/drivers/iio/pressure/st_pressure_spi.c b/drivers/iio/pressure/st_pressure_spi.c
>> index 40c0692..5505080 100644
>> --- a/drivers/iio/pressure/st_pressure_spi.c
>> +++ b/drivers/iio/pressure/st_pressure_spi.c
>> @@ -50,6 +50,7 @@ static const struct spi_device_id st_press_id_table[] = {
>> { LPS001WP_PRESS_DEV_NAME },
>> { LPS25H_PRESS_DEV_NAME },
>> { LPS331AP_PRESS_DEV_NAME },
>> + { LPS22HB_PRESS_DEV_NAME },
>> {},
>> };
>> MODULE_DEVICE_TABLE(spi, st_press_id_table);
>>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2016-05-01 21:26 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-19 9:18 [RFC PATCH v1 0/9] iio:st_sensors: fixes and lps22hb pressure sensor Gregor Boirie
2016-04-19 9:18 ` [RFC PATCH v1 1/9] iio:st_pressure:initial lps22hb sensor support Gregor Boirie
2016-04-24 9:29 ` Jonathan Cameron
2016-05-01 19:28 ` Jonathan Cameron [this message]
2016-05-29 14:14 ` Jonathan Cameron
2016-04-19 9:18 ` [RFC PATCH v1 2/9] iio:st_pressure: fix sampling gains Gregor Boirie
2016-05-29 15:14 ` Jonathan Cameron
2016-05-30 8:17 ` Linus Walleij
2016-05-30 12:23 ` Jonathan Cameron
2016-04-19 9:18 ` [RFC PATCH v1 3/9] iio:st_pressure: lps22hb temperature support Gregor Boirie
2016-05-29 14:53 ` Jonathan Cameron
2016-04-19 9:18 ` [RFC PATCH v1 4/9] iio:st_sensors: align on storagebits boundaries Gregor Boirie
2016-04-24 9:35 ` Jonathan Cameron
2016-05-01 19:27 ` Jonathan Cameron
2016-05-02 8:19 ` Gregor Boirie
2016-05-14 17:54 ` Jonathan Cameron
2016-05-03 16:20 ` Crestez Dan Leonard
2016-04-19 9:18 ` [RFC PATCH v1 5/9] iio:st_pressure: align storagebits on power of 2 Gregor Boirie
2016-04-19 9:18 ` [RFC PATCH v1 6/9] iio:st_pressure: temperature triggered buffering Gregor Boirie
2016-04-24 10:58 ` Jonathan Cameron
2016-05-29 14:57 ` Jonathan Cameron
2016-04-19 9:18 ` [RFC PATCH v1 7/9] iio:st_sensors: unexport st_sensors_get_buffer_element Gregor Boirie
2016-05-29 14:59 ` Jonathan Cameron
2016-04-19 9:18 ` [RFC PATCH v1 8/9] iio:st_sensors: emulate SMBus block read if needed Gregor Boirie
2016-05-29 15:06 ` Jonathan Cameron
2016-04-19 9:18 ` [RFC PATCH v1 9/9] iio:st_sensors: fix power regulator usage Gregor Boirie
2016-04-24 11:01 ` Jonathan Cameron
2016-04-24 11:02 ` Jonathan Cameron
2016-05-29 15:10 ` Jonathan Cameron
2016-04-27 11:26 ` [RFC PATCH v1 0/9] iio:st_sensors: fixes and lps22hb pressure sensor Linus Walleij
2016-04-27 12:02 ` Linus Walleij
2016-04-27 13:08 ` Gregor Boirie
2016-04-28 7:47 ` Linus Walleij
2016-04-28 14:57 ` Gregor Boirie
2016-04-28 15:02 ` Gregor Boirie
2016-06-11 17:36 ` Jonathan Cameron
2016-06-15 10:58 ` Gregor Boirie
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=7670eb99-fdec-f14d-c8ac-35b155398479@kernel.org \
--to=jic23@kernel.org \
--cc=denis.ciocca@st.com \
--cc=giuseppe.barba@st.com \
--cc=gregor.boirie@parrot.com \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linus.walleij@linaro.org \
--cc=linux-iio@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
/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).