From: Jonathan Cameron <jic23@kernel.org>
To: Lee Jones <lee.jones@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, jic23@cam.ac.uk, arnd@arndb.de,
linus.walleij@linaro.org, denis.ciocca@st.com,
linux-iio@vger.kernel.org
Subject: Re: [PATCH 11/20] iio: sensors-core: st: Support sensors which don't have a Data Ready pin
Date: Sat, 21 Sep 2013 13:51:21 +0100 [thread overview]
Message-ID: <523D9649.4080409@kernel.org> (raw)
In-Reply-To: <1379347346-823-12-git-send-email-lee.jones@linaro.org>
On 09/16/13 17:02, Lee Jones wrote:
> Not all ST's sensors support data ready, so let's make the declaration
> of one conditional.
>
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Applied to the togreg branch of iio.git
Thanks Lee
> ---
> drivers/iio/common/st_sensors/st_sensors_core.c | 33 ++++++++++++++++---------
> drivers/iio/pressure/st_pressure_core.c | 3 ++-
> 2 files changed, 24 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
> index 793136a..2672630 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_core.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_core.c
> @@ -198,21 +198,17 @@ int st_sensors_set_axis_enable(struct iio_dev *indio_dev, u8 axis_enable)
> }
> EXPORT_SYMBOL(st_sensors_set_axis_enable);
>
> -int st_sensors_init_sensor(struct iio_dev *indio_dev,
> - struct st_sensors_platform_data *pdata)
> +int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev,
> + struct st_sensors_platform_data *pdata)
> {
> - int err;
> struct st_sensor_data *sdata = iio_priv(indio_dev);
>
> - mutex_init(&sdata->tb.buf_lock);
> -
> switch (pdata->drdy_int_pin) {
> case 1:
> if (sdata->sensor->drdy_irq.mask_int1 == 0) {
> dev_err(&indio_dev->dev,
> "DRDY on INT1 not available.\n");
> - err = -EINVAL;
> - goto init_error;
> + return -EINVAL;
> }
> sdata->drdy_int_pin = 1;
> break;
> @@ -220,17 +216,29 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,
> if (sdata->sensor->drdy_irq.mask_int2 == 0) {
> dev_err(&indio_dev->dev,
> "DRDY on INT2 not available.\n");
> - err = -EINVAL;
> - goto init_error;
> + return -EINVAL;
> }
> sdata->drdy_int_pin = 2;
> break;
> default:
> dev_err(&indio_dev->dev, "DRDY on pdata not valid.\n");
> - err = -EINVAL;
> - goto init_error;
> + return -EINVAL;
> }
>
> + return 0;
> +}
> +
> +int st_sensors_init_sensor(struct iio_dev *indio_dev,
> + struct st_sensors_platform_data *pdata)
> +{
> + struct st_sensor_data *sdata = iio_priv(indio_dev);
> + int err = 0;
> +
> + mutex_init(&sdata->tb.buf_lock);
> +
> + if (pdata)
> + err = st_sensors_set_drdy_int_pin(indio_dev, pdata);
> +
> err = st_sensors_set_enable(indio_dev, false);
> if (err < 0)
> goto init_error;
> @@ -266,6 +274,9 @@ int st_sensors_set_dataready_irq(struct iio_dev *indio_dev, bool enable)
> u8 drdy_mask;
> struct st_sensor_data *sdata = iio_priv(indio_dev);
>
> + if (!sdata->sensor->drdy_irq.addr)
> + return 0;
> +
> /* Enable/Disable the interrupt generator 1. */
> if (sdata->sensor->drdy_irq.ig1.en_addr > 0) {
> err = st_sensors_write_data_with_mask(indio_dev,
> diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
> index 93bff9b..3abada2 100644
> --- a/drivers/iio/pressure/st_pressure_core.c
> +++ b/drivers/iio/pressure/st_pressure_core.c
> @@ -254,7 +254,8 @@ int st_press_common_probe(struct iio_dev *indio_dev,
>
> pdata->odr = pdata->sensor->odr.odr_avl[0].hz;
>
> - if (!plat_data)
> + /* Some devices don't support a data ready pin. */
> + if (!plat_data && pdata->sensor->drdy_irq.addr)
> plat_data =
> (struct st_sensors_platform_data *)&default_press_pdata;
>
>
WARNING: multiple messages have this Message-ID (diff)
From: jic23@kernel.org (Jonathan Cameron)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 11/20] iio: sensors-core: st: Support sensors which don't have a Data Ready pin
Date: Sat, 21 Sep 2013 13:51:21 +0100 [thread overview]
Message-ID: <523D9649.4080409@kernel.org> (raw)
In-Reply-To: <1379347346-823-12-git-send-email-lee.jones@linaro.org>
On 09/16/13 17:02, Lee Jones wrote:
> Not all ST's sensors support data ready, so let's make the declaration
> of one conditional.
>
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Applied to the togreg branch of iio.git
Thanks Lee
> ---
> drivers/iio/common/st_sensors/st_sensors_core.c | 33 ++++++++++++++++---------
> drivers/iio/pressure/st_pressure_core.c | 3 ++-
> 2 files changed, 24 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
> index 793136a..2672630 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_core.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_core.c
> @@ -198,21 +198,17 @@ int st_sensors_set_axis_enable(struct iio_dev *indio_dev, u8 axis_enable)
> }
> EXPORT_SYMBOL(st_sensors_set_axis_enable);
>
> -int st_sensors_init_sensor(struct iio_dev *indio_dev,
> - struct st_sensors_platform_data *pdata)
> +int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev,
> + struct st_sensors_platform_data *pdata)
> {
> - int err;
> struct st_sensor_data *sdata = iio_priv(indio_dev);
>
> - mutex_init(&sdata->tb.buf_lock);
> -
> switch (pdata->drdy_int_pin) {
> case 1:
> if (sdata->sensor->drdy_irq.mask_int1 == 0) {
> dev_err(&indio_dev->dev,
> "DRDY on INT1 not available.\n");
> - err = -EINVAL;
> - goto init_error;
> + return -EINVAL;
> }
> sdata->drdy_int_pin = 1;
> break;
> @@ -220,17 +216,29 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,
> if (sdata->sensor->drdy_irq.mask_int2 == 0) {
> dev_err(&indio_dev->dev,
> "DRDY on INT2 not available.\n");
> - err = -EINVAL;
> - goto init_error;
> + return -EINVAL;
> }
> sdata->drdy_int_pin = 2;
> break;
> default:
> dev_err(&indio_dev->dev, "DRDY on pdata not valid.\n");
> - err = -EINVAL;
> - goto init_error;
> + return -EINVAL;
> }
>
> + return 0;
> +}
> +
> +int st_sensors_init_sensor(struct iio_dev *indio_dev,
> + struct st_sensors_platform_data *pdata)
> +{
> + struct st_sensor_data *sdata = iio_priv(indio_dev);
> + int err = 0;
> +
> + mutex_init(&sdata->tb.buf_lock);
> +
> + if (pdata)
> + err = st_sensors_set_drdy_int_pin(indio_dev, pdata);
> +
> err = st_sensors_set_enable(indio_dev, false);
> if (err < 0)
> goto init_error;
> @@ -266,6 +274,9 @@ int st_sensors_set_dataready_irq(struct iio_dev *indio_dev, bool enable)
> u8 drdy_mask;
> struct st_sensor_data *sdata = iio_priv(indio_dev);
>
> + if (!sdata->sensor->drdy_irq.addr)
> + return 0;
> +
> /* Enable/Disable the interrupt generator 1. */
> if (sdata->sensor->drdy_irq.ig1.en_addr > 0) {
> err = st_sensors_write_data_with_mask(indio_dev,
> diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
> index 93bff9b..3abada2 100644
> --- a/drivers/iio/pressure/st_pressure_core.c
> +++ b/drivers/iio/pressure/st_pressure_core.c
> @@ -254,7 +254,8 @@ int st_press_common_probe(struct iio_dev *indio_dev,
>
> pdata->odr = pdata->sensor->odr.odr_avl[0].hz;
>
> - if (!plat_data)
> + /* Some devices don't support a data ready pin. */
> + if (!plat_data && pdata->sensor->drdy_irq.addr)
> plat_data =
> (struct st_sensors_platform_data *)&default_press_pdata;
>
>
next prev parent reply other threads:[~2013-09-21 11:51 UTC|newest]
Thread overview: 75+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-16 16:02 [PATCH v4 00/20] iio: ST clean-ups and new sensor support Lee Jones
2013-09-16 16:02 ` Lee Jones
2013-09-16 16:02 ` [PATCH 01/20] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes Lee Jones
2013-09-16 16:02 ` Lee Jones
2013-09-16 16:02 ` [PATCH 02/20] ARM: ux500: Enable the LPS001WP Pressure & Temperature sensor from DT Lee Jones
2013-09-16 16:02 ` Lee Jones
2013-09-16 16:02 ` [PATCH 03/20] ARM: ux500: Enable the LSM303DLH Accelerator " Lee Jones
2013-09-16 16:02 ` Lee Jones
2013-09-16 16:02 ` [PATCH 04/20] ARM: ux500: Enable the LSM303DLH Magnetometer " Lee Jones
2013-09-16 16:02 ` Lee Jones
2013-09-16 16:02 ` [PATCH 05/20] ARM: ux500: Enable the L3G4200D Gyroscope " Lee Jones
2013-09-16 16:02 ` Lee Jones
2013-09-16 16:02 ` [PATCH 06/20] ARM: ux500: CONFIG: Enable ST's IIO Sensors by default Lee Jones
2013-09-16 16:02 ` Lee Jones
2013-09-16 16:02 ` [PATCH 07/20] Documentation: dt: iio: Add binding for LPS001WP Lee Jones
2013-09-16 16:02 ` Lee Jones
2013-09-16 16:02 ` Lee Jones
2013-10-01 21:09 ` Jonathan Cameron
2013-10-01 21:09 ` Jonathan Cameron
2013-10-01 21:09 ` Jonathan Cameron
2013-10-01 21:13 ` Jonathan Cameron
2013-10-01 21:13 ` Jonathan Cameron
2013-10-01 21:13 ` Jonathan Cameron
2013-09-16 16:02 ` [PATCH 08/20] Documentation: dt: iio: Add binding for LSM303DLH - Accel Lee Jones
2013-09-16 16:02 ` Lee Jones
2013-09-16 16:02 ` Lee Jones
2013-09-16 16:02 ` [PATCH 09/20] Documentation: dt: iio: Add binding for L3G4200D Lee Jones
2013-09-16 16:02 ` Lee Jones
2013-09-16 16:02 ` [PATCH 10/20] Documentation: dt: iio: Add binding for LSM303DLH - Magn Lee Jones
2013-09-16 16:02 ` Lee Jones
2013-09-16 16:02 ` Lee Jones
2013-09-16 16:02 ` [PATCH 11/20] iio: sensors-core: st: Support sensors which don't have a Data Ready pin Lee Jones
2013-09-16 16:02 ` Lee Jones
2013-09-21 12:51 ` Jonathan Cameron [this message]
2013-09-21 12:51 ` Jonathan Cameron
2013-09-21 13:07 ` Jonathan Cameron
2013-09-21 13:07 ` Jonathan Cameron
2013-09-16 16:02 ` [PATCH 12/20] iio: sensors-core: st: Clean-up error handling in st_sensors_init_sensor() Lee Jones
2013-09-16 16:02 ` Lee Jones
2013-09-21 12:51 ` Jonathan Cameron
2013-09-21 12:51 ` Jonathan Cameron
2013-09-16 16:02 ` [PATCH 13/20] iio: sensors-core: st: Clean-up error handling in st_sensors_read_axis_data() Lee Jones
2013-09-16 16:02 ` Lee Jones
2013-09-21 12:52 ` Jonathan Cameron
2013-09-21 12:52 ` Jonathan Cameron
2013-09-16 16:02 ` [PATCH 14/20] iio: pressure-core: st: Clean-up probe() function Lee Jones
2013-09-16 16:02 ` Lee Jones
2013-09-21 12:52 ` Jonathan Cameron
2013-09-21 12:52 ` Jonathan Cameron
2013-09-16 16:02 ` [PATCH 15/20] iio: pressure: st: Add support for new LPS001WP pressure sensor Lee Jones
2013-09-16 16:02 ` Lee Jones
2013-09-21 12:53 ` Jonathan Cameron
2013-09-21 12:53 ` Jonathan Cameron
2013-09-16 16:02 ` [PATCH 16/20] iio: pressure-core: st: Provide support for the Vdd power supply Lee Jones
2013-09-16 16:02 ` Lee Jones
2013-09-21 13:03 ` Jonathan Cameron
2013-09-21 13:03 ` Jonathan Cameron
2013-09-23 19:18 ` Jonathan Cameron
2013-09-23 19:18 ` Jonathan Cameron
2013-09-16 16:02 ` [PATCH 17/20] iio: pressure-core: st: Provide support for the Vdd_IO " Lee Jones
2013-09-16 16:02 ` Lee Jones
2013-09-23 19:19 ` Jonathan Cameron
2013-09-23 19:19 ` Jonathan Cameron
2013-09-16 16:02 ` [PATCH 18/20] iio: accel-core: st: Clean up error handling in probe() Lee Jones
2013-09-16 16:02 ` Lee Jones
2013-09-21 12:56 ` Jonathan Cameron
2013-09-21 12:56 ` Jonathan Cameron
2013-09-16 16:02 ` [PATCH 19/20] iio: gyro-core: " Lee Jones
2013-09-16 16:02 ` Lee Jones
2013-09-21 12:57 ` Jonathan Cameron
2013-09-21 12:57 ` Jonathan Cameron
2013-09-16 16:02 ` [PATCH 20/20] iio: magn-core: " Lee Jones
2013-09-16 16:02 ` Lee Jones
2013-09-21 12:57 ` Jonathan Cameron
2013-09-21 12:57 ` 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=523D9649.4080409@kernel.org \
--to=jic23@kernel.org \
--cc=arnd@arndb.de \
--cc=denis.ciocca@st.com \
--cc=jic23@cam.ac.uk \
--cc=lee.jones@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.