* [RESEND PATCH 1/4] iio: st_accel: set up available scan masks
@ 2015-09-15 7:49 Linus Walleij
2015-09-15 21:12 ` Jonathan Cameron
0 siblings, 1 reply; 3+ messages in thread
From: Linus Walleij @ 2015-09-15 7:49 UTC (permalink / raw)
To: Jonathan Cameron, linux-iio; +Cc: Linus Walleij, Denis Ciocca
In order to enable triggered buffered input, IIO needs to
know what channels can be enabled for buffered input.
Set up a scan mask for X/Y/Z.
Cc: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/iio/accel/st_accel_core.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
index ff30f8806880..b9a7b5c7c5e7 100644
--- a/drivers/iio/accel/st_accel_core.c
+++ b/drivers/iio/accel/st_accel_core.c
@@ -630,6 +630,12 @@ static const struct iio_trigger_ops st_accel_trigger_ops = {
#define ST_ACCEL_TRIGGER_OPS NULL
#endif
+/* Bits 0,1,2, = channels 0,1,2 = x,y,z */
+static const unsigned long st_sensors_scan_masks[] = {
+ ST_SENSORS_ENABLE_ALL_AXIS,
+ 0, /* Sentinel */
+};
+
int st_accel_common_probe(struct iio_dev *indio_dev)
{
struct st_sensor_data *adata = iio_priv(indio_dev);
@@ -652,6 +658,7 @@ int st_accel_common_probe(struct iio_dev *indio_dev)
adata->multiread_bit = adata->sensor_settings->multi_read_bit;
indio_dev->channels = adata->sensor_settings->ch;
indio_dev->num_channels = ST_SENSORS_NUMBER_ALL_CHANNELS;
+ indio_dev->available_scan_masks = st_sensors_scan_masks;
adata->current_fullscale = (struct st_sensor_fullscale_avl *)
&adata->sensor_settings->fs.fs_avl[0];
--
2.4.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [RESEND PATCH 1/4] iio: st_accel: set up available scan masks
2015-09-15 7:49 [RESEND PATCH 1/4] iio: st_accel: set up available scan masks Linus Walleij
@ 2015-09-15 21:12 ` Jonathan Cameron
2015-09-16 7:00 ` Linus Walleij
0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Cameron @ 2015-09-15 21:12 UTC (permalink / raw)
To: Linus Walleij, linux-iio; +Cc: Denis Ciocca
On 15/09/15 08:49, Linus Walleij wrote:
> In order to enable triggered buffered input, IIO needs to
> know what channels can be enabled for buffered input.
> Set up a scan mask for X/Y/Z.
This is only necessary if the device isn't capable of reading
any subset of channels (i.e. there are restrictions).
In this case reads seem to be accomplished on a channel by
channel basis with no significant additional cost so I would
not expect available_scan_masks to be specified.
Doing this restricts the driver to having to read all 3 channels
even if only one is desired.
Jonathan
>
> Cc: Denis Ciocca <denis.ciocca@st.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> drivers/iio/accel/st_accel_core.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
> index ff30f8806880..b9a7b5c7c5e7 100644
> --- a/drivers/iio/accel/st_accel_core.c
> +++ b/drivers/iio/accel/st_accel_core.c
> @@ -630,6 +630,12 @@ static const struct iio_trigger_ops st_accel_trigger_ops = {
> #define ST_ACCEL_TRIGGER_OPS NULL
> #endif
>
> +/* Bits 0,1,2, = channels 0,1,2 = x,y,z */
> +static const unsigned long st_sensors_scan_masks[] = {
> + ST_SENSORS_ENABLE_ALL_AXIS,
> + 0, /* Sentinel */
> +};
> +
> int st_accel_common_probe(struct iio_dev *indio_dev)
> {
> struct st_sensor_data *adata = iio_priv(indio_dev);
> @@ -652,6 +658,7 @@ int st_accel_common_probe(struct iio_dev *indio_dev)
> adata->multiread_bit = adata->sensor_settings->multi_read_bit;
> indio_dev->channels = adata->sensor_settings->ch;
> indio_dev->num_channels = ST_SENSORS_NUMBER_ALL_CHANNELS;
> + indio_dev->available_scan_masks = st_sensors_scan_masks;
>
> adata->current_fullscale = (struct st_sensor_fullscale_avl *)
> &adata->sensor_settings->fs.fs_avl[0];
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RESEND PATCH 1/4] iio: st_accel: set up available scan masks
2015-09-15 21:12 ` Jonathan Cameron
@ 2015-09-16 7:00 ` Linus Walleij
0 siblings, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2015-09-16 7:00 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: linux-iio@vger.kernel.org, Denis Ciocca
On Tue, Sep 15, 2015 at 11:12 PM, Jonathan Cameron <jic23@kernel.org> wrote:
> On 15/09/15 08:49, Linus Walleij wrote:
>> In order to enable triggered buffered input, IIO needs to
>> know what channels can be enabled for buffered input.
>> Set up a scan mask for X/Y/Z.
> This is only necessary if the device isn't capable of reading
> any subset of channels (i.e. there are restrictions).
> In this case reads seem to be accomplished on a channel by
> channel basis with no significant additional cost so I would
> not expect available_scan_masks to be specified.
>
> Doing this restricts the driver to having to read all 3 channels
> even if only one is desired.
You're right, this patch should be dropped. I actually figured that
out but forgot about it :/
Sorry for the fuzz .. let's focus on the other patches.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-09-16 7:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-15 7:49 [RESEND PATCH 1/4] iio: st_accel: set up available scan masks Linus Walleij
2015-09-15 21:12 ` Jonathan Cameron
2015-09-16 7:00 ` Linus Walleij
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.