From: Lorenzo Bianconi <lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> To: jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org, lorenzo.bianconi-qxv4g6HH51o@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Subject: [PATCH v2 2/5] iio: st_sensors: do not always write enable_axis register Date: Thu, 17 Aug 2017 19:37:26 +0200 [thread overview] Message-ID: <20170817173729.10899-3-lorenzo.bianconi@st.com> (raw) In-Reply-To: <20170817173729.10899-1-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org> New devices (e.g. LIS2DW12) enable all axis by default and do not export that capability in register map. Check if the enable_axis register address has been declared in st_sensor_settings map in order to verify if the driver needs to enable all sensor axis Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org> --- drivers/iio/common/st_sensors/st_sensors_core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c index a26217b0604f..6331cc91e02d 100644 --- a/drivers/iio/common/st_sensors/st_sensors_core.c +++ b/drivers/iio/common/st_sensors/st_sensors_core.c @@ -221,11 +221,14 @@ EXPORT_SYMBOL(st_sensors_set_enable); int st_sensors_set_axis_enable(struct iio_dev *indio_dev, u8 axis_enable) { struct st_sensor_data *sdata = iio_priv(indio_dev); + int err = 0; - return st_sensors_write_data_with_mask(indio_dev, + if (sdata->sensor_settings->enable_axis.addr) + err = st_sensors_write_data_with_mask(indio_dev, sdata->sensor_settings->enable_axis.addr, sdata->sensor_settings->enable_axis.mask, axis_enable); + return err; } EXPORT_SYMBOL(st_sensors_set_axis_enable); -- 2.14.0
WARNING: multiple messages have this Message-ID (diff)
From: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> To: jic23@kernel.org Cc: linux-iio@vger.kernel.org, linus.walleij@linaro.org, lorenzo.bianconi@st.com, devicetree@vger.kernel.org Subject: [PATCH v2 2/5] iio: st_sensors: do not always write enable_axis register Date: Thu, 17 Aug 2017 19:37:26 +0200 [thread overview] Message-ID: <20170817173729.10899-3-lorenzo.bianconi@st.com> (raw) In-Reply-To: <20170817173729.10899-1-lorenzo.bianconi@st.com> New devices (e.g. LIS2DW12) enable all axis by default and do not export that capability in register map. Check if the enable_axis register address has been declared in st_sensor_settings map in order to verify if the driver needs to enable all sensor axis Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com> --- drivers/iio/common/st_sensors/st_sensors_core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c index a26217b0604f..6331cc91e02d 100644 --- a/drivers/iio/common/st_sensors/st_sensors_core.c +++ b/drivers/iio/common/st_sensors/st_sensors_core.c @@ -221,11 +221,14 @@ EXPORT_SYMBOL(st_sensors_set_enable); int st_sensors_set_axis_enable(struct iio_dev *indio_dev, u8 axis_enable) { struct st_sensor_data *sdata = iio_priv(indio_dev); + int err = 0; - return st_sensors_write_data_with_mask(indio_dev, + if (sdata->sensor_settings->enable_axis.addr) + err = st_sensors_write_data_with_mask(indio_dev, sdata->sensor_settings->enable_axis.addr, sdata->sensor_settings->enable_axis.mask, axis_enable); + return err; } EXPORT_SYMBOL(st_sensors_set_axis_enable); -- 2.14.0
next prev parent reply other threads:[~2017-08-17 17:37 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-08-17 17:37 [PATCH v2 0/5] Add support to LIS2DW12 accel sensor Lorenzo Bianconi 2017-08-17 17:37 ` Lorenzo Bianconi [not found] ` <20170817173729.10899-1-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org> 2017-08-17 17:37 ` [PATCH v2 1/5] iio: st_sensors: decouple irq1 configuration parameters from the irq2 ones Lorenzo Bianconi 2017-08-17 17:37 ` Lorenzo Bianconi [not found] ` <20170817173729.10899-2-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org> 2017-08-20 9:41 ` Jonathan Cameron 2017-08-20 9:41 ` Jonathan Cameron 2017-08-20 10:08 ` Lorenzo Bianconi 2017-08-20 10:08 ` Lorenzo Bianconi 2017-08-17 17:37 ` Lorenzo Bianconi [this message] 2017-08-17 17:37 ` [PATCH v2 2/5] iio: st_sensors: do not always write enable_axis register Lorenzo Bianconi 2017-08-17 17:37 ` [PATCH v2 3/5] iio: st_sensors: add register mask for status register Lorenzo Bianconi 2017-08-17 17:37 ` Lorenzo Bianconi 2017-08-17 17:37 ` [PATCH v2 4/5] iio: accel: add support to LIS2DW12 Lorenzo Bianconi 2017-08-17 17:37 ` Lorenzo Bianconi 2017-08-17 17:37 ` [PATCH v2 5/5] dt-bindings: iio: accel: add LIS2DW12 sensor device binding Lorenzo Bianconi 2017-08-17 17:37 ` Lorenzo Bianconi [not found] ` <20170817173729.10899-6-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org> 2017-08-22 2:25 ` Rob Herring 2017-08-22 2:25 ` Rob Herring 2017-08-28 13:41 ` [PATCH v2 0/5] Add support to LIS2DW12 accel sensor Lorenzo Bianconi 2017-08-28 13:41 ` Lorenzo Bianconi
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=20170817173729.10899-3-lorenzo.bianconi@st.com \ --to=lorenzo.bianconi83-re5jqeeqqe8avxtiumwx3w@public.gmane.org \ --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \ --cc=jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \ --cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \ --cc=linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \ --cc=lorenzo.bianconi-qxv4g6HH51o@public.gmane.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: linkBe 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.