iio: imu: st_lsm6dsx: only set available_scan_masks if using device fifo
Subsystems (2)
PATCH 1/2 iio: imu: st_lsm6dsx: only set available_scan_masks if using device fifo
We only need available scan_masks set if we are going to use the onboard fifo. Unfortunately it requires the IRQ pins to be connected to the SoC.
The next patch in this series add support for iio triggered buffer for use with iio triggers.
--- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +3 -1
@@ -1007,7 +1007,6 @@ static struct iio_dev *st_lsm6dsx_alloc_iiodev(struct st_lsm6dsx_hw *hw, iio_dev->modes =INDIO_DIRECT_MODE ; iio_dev->dev.parent = hw->dev; - iio_dev->available_scan_masks = st_lsm6dsx_available_scan_masks; sensor =iio_priv (iio_dev); sensor->id = id;
@@ -1074,6 +1073,9 @@ int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id, const char *name, hw->iio_devs[i] =st_lsm6dsx_alloc_iiodev (hw, i, name);if (!hw->iio_devs[i])return -ENOMEM ; + + hw->iio_devs[i]->available_scan_masks = + st_lsm6dsx_available_scan_masks; } err =st_lsm6dsx_init_device (hw);
Signature · 1 line
2.21.0
PATCH 2/2 iio: imu: st_lsm6dsx: add iio trigger and buffer support
This adds support for using iio triggers, this is needed because our hardware guys forgot to connect the irq pins from imu device to the SoC.
--- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 37 ++++++++++++++++++++ 1 file changed, 37 insertions(+)
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +37 -0
@@ -40,8 +40,11 @@#include <linux/kernel.h> #include <linux/module.h> #include <linux/delay.h> +#include <linux/iio/buffer.h> #include <linux/iio/iio.h> #include <linux/iio/sysfs.h> +#include <linux/iio/trigger_consumer.h> +#include <linux/iio/triggered_buffer.h> #include <linux/pm.h> #include <linux/regmap.h> #include <linux/bitfield.h>
@@ -945,6 +948,30 @@ static int st_lsm6dsx_init_hw_timer(struct st_lsm6dsx_hw *hw)return 0 ; } +static irqreturn_t st_lsm6dsx_trigger_handler (int irq,void *p) +{ +struct iio_poll_func *pf = p; +struct iio_dev *indio_dev = pf->indio_dev; +struct st_lsm6dsx_sensor *sensor =iio_priv (indio_dev); +u16 buffer[4 *sizeof (s64)/sizeof (u16)]; +int tmp, bit; + +memset (buffer,0 ,sizeof (buffer)); + +for_each_set_bit (bit, indio_dev->active_scan_mask, indio_dev->masklength) { +st_lsm6dsx_read_oneshot (sensor, + indio_dev->channels[bit].address, &tmp); + buffer[bit] = tmp; + } + +iio_push_to_buffers_with_timestamp (indio_dev, buffer, +iio_get_time_ns (indio_dev)); + +iio_trigger_notify_done (indio_dev->trig); + +return IRQ_HANDLED ; +} +static int st_lsm6dsx_init_device (struct st_lsm6dsx_hw *hw) {u8 drdy_int_reg;
@@ -1093,6 +1120,16 @@ int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id, const char *name, err =st_lsm6dsx_fifo_setup (hw);if (err <0 )return err; + }else { +for (i =0 ; i <ST_LSM6DSX_ID_MAX ; i++) { + err =devm_iio_triggered_buffer_setup (hw->dev, + hw->iio_devs[i],NULL , + st_lsm6dsx_trigger_handler,NULL ); +if (err <0 ) { +dev_err (hw->dev,"iio triggered buffer setup failed\n" ); +return err; + } + } }for (i =0 ; i <ST_LSM6DSX_ID_MAX ; i++) {
Signature · 1 line
2.21.0
Jonathan Cameron
maintainerRe: [PATCH 2/2] iio: imu: st_lsm6dsx: add iio trigger and buffer support
Quoted 5 lines · On Tue, 7 May 2019 10:02:25 +0200 Sean Nyekjaer <[email protected]> wrote:
This adds support for using iio triggers, this is needed because our hardware guys forgot to connect the irq pins from imu device to the SoC.
Signed-off-by Sean Nyekjaer <[email protected]>
Hi Sean
A small question on the size of the buffer needed inline. Otherwise looks good to me.
Quoted 21 lines
--- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 37 ++++++++++++++++++++ 1 file changed, 37 insertions(+)drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +3
-0@@ -40,8 +40,11 @@#include <linux/kernel.h> #include <linux/module.h> #include <linux/delay.h> +#include <linux/iio/buffer.h> #include <linux/iio/iio.h> #include <linux/iio/sysfs.h> +#include <linux/iio/trigger_consumer.h> +#include <linux/iio/triggered_buffer.h> #include <linux/pm.h> #include <linux/regmap.h> #include <linux/bitfield.h>
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c static int st_lsm6dsx_init_hw_timer(struct st_lsm6dsx_hw *hw) · line 956
Quoted 9 lines
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +6
-0@@ -945,6 +948,30 @@ static int st_lsm6dsx_init_hw_timer(struct st_lsm6dsx_hw *hw)return 0 ; } +static irqreturn_t st_lsm6dsx_trigger_handler (int irq,void *p) +{ +struct iio_poll_func *pf = p; +struct iio_dev *indio_dev = pf->indio_dev; +struct st_lsm6dsx_sensor *sensor =iio_priv (indio_dev); +u16 buffer[4 *sizeof (s64)/sizeof (u16)];
The size may well be correct, but that particular way of expressing it doesn't make it terribly clear.
It seems a bit large... You need the space for the timestamp, so it needs to be padded to a u64, but that would still require your other channels to need more than 2*sizeof(s64)/sizeof(u16) u16s which is 9 or more of them.
Quoted 38 lines
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +28
-0+int tmp, bit; + +memset (buffer,0 ,sizeof (buffer)); + +for_each_set_bit (bit, indio_dev->active_scan_mask, indio_dev->masklength) { +st_lsm6dsx_read_oneshot (sensor, + indio_dev->channels[bit].address, &tmp); + buffer[bit] = tmp; + } + +iio_push_to_buffers_with_timestamp (indio_dev, buffer, +iio_get_time_ns (indio_dev)); + +iio_trigger_notify_done (indio_dev->trig); + +return IRQ_HANDLED ; +} +static int st_lsm6dsx_init_device (struct st_lsm6dsx_hw *hw) {u8 drdy_int_reg;@@ -1093,6 +1120,16 @@ int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id, const char *name, err =st_lsm6dsx_fifo_setup (hw);if (err <0 )return err; + }else { +for (i =0 ; i <ST_LSM6DSX_ID_MAX ; i++) { + err =devm_iio_triggered_buffer_setup (hw->dev, + hw->iio_devs[i],NULL , + st_lsm6dsx_trigger_handler,NULL ); +if (err <0 ) { +dev_err (hw->dev,"iio triggered buffer setup failed\n" ); +return err; + } + } }for (i =0 ; i <ST_LSM6DSX_ID_MAX ; i++) {
Lorenzo Bianconi
maintainerRe: [PATCH 2/2] iio: imu: st_lsm6dsx: add iio trigger and buffer support
Quoted 7 lines
Quoted 4 lines · On Tue, 7 May 2019 10:02:25 +0200 Sean Nyekjaer <[email protected]> wrote:
This adds support for using iio triggers, this is needed because our hardware guys forgot to connect the irq pins from imu device to the SoC.
Quoted 5 lines
Quoted 1 line
Signed-off-by Sean Nyekjaer <[email protected]>Hi Sean
A small question on the size of the buffer needed inline. Otherwise looks good to me.
Hi Sean,
this patch does not make sense to me since running st_lsm6dsx_read_oneshot you need to wait to power up the device (and you will power it down at the end). I guess you will not be able to read at a given ODR (e.g. 416Hz). Moreover you can't read from the hw fifo without the irq line since you need to read a full pattern from it in order to maintain the alignment. From my point of view you have 2 possibility:
- poll the output registers from userspace (this is what you are actually doing from inside the kernel, what is the advantage of doing so?)
- fix the hw bug
Moreover if I read the patch correctly it has a NULL pointer dereference bug since hw->iio_devs[i] can be NULL (e.g. if sensor hub is disabled)
Regards,
Lorenzo
Quoted 59 lines
Quoted 21 lines
--- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 37 ++++++++++++++++++++ 1 file changed, 37 insertions(+)drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +3
-0@@ -40,8 +40,11 @@#include <linux/kernel.h> #include <linux/module.h> #include <linux/delay.h> +#include <linux/iio/buffer.h> #include <linux/iio/iio.h> #include <linux/iio/sysfs.h> +#include <linux/iio/trigger_consumer.h> +#include <linux/iio/triggered_buffer.h> #include <linux/pm.h> #include <linux/regmap.h> #include <linux/bitfield.h> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c static int st_lsm6dsx_init_hw_timer(struct st_lsm6dsx_hw *hw) · line 956
Quoted 9 lines
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +6
-0@@ -945,6 +948,30 @@ static int st_lsm6dsx_init_hw_timer(struct st_lsm6dsx_hw *hw)return 0 ; } +static irqreturn_t st_lsm6dsx_trigger_handler (int irq,void *p) +{ +struct iio_poll_func *pf = p; +struct iio_dev *indio_dev = pf->indio_dev; +struct st_lsm6dsx_sensor *sensor =iio_priv (indio_dev); +u16 buffer[4 *sizeof (s64)/sizeof (u16)];The size may well be correct, but that particular way of expressing it doesn't make it terribly clear.
It seems a bit large... You need the space for the timestamp, so it needs to be padded to a u64, but that would still require your other channels to need more than 2*sizeof(s64)/sizeof(u16) u16s which is 9 or more of them.
Quoted 22 lines
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +18
-0+int tmp, bit; + +memset (buffer,0 ,sizeof (buffer)); + +for_each_set_bit (bit, indio_dev->active_scan_mask, indio_dev->masklength) { +st_lsm6dsx_read_oneshot (sensor, + indio_dev->channels[bit].address, &tmp); + buffer[bit] = tmp; + } + +iio_push_to_buffers_with_timestamp (indio_dev, buffer, +iio_get_time_ns (indio_dev)); + +iio_trigger_notify_done (indio_dev->trig); + +return IRQ_HANDLED ; +} +static int st_lsm6dsx_init_device (struct st_lsm6dsx_hw *hw) {u8 drdy_int_reg;@@ -1093,6 +1120,16 @@ int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id, const char *name,
Quoted 8 lines
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id, const char *name, · line 1127
Quoted 8 lines
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +5
-0err =st_lsm6dsx_fifo_setup (hw);if (err <0 )return err; + }else { +for (i =0 ; i <ST_LSM6DSX_ID_MAX ; i++) { + err =devm_iio_triggered_buffer_setup (hw->dev, + hw->iio_devs[i],NULL , + st_lsm6dsx_trigger_handler,NULL );
I guess hw->iio_devs[i] can be NULL here
Quoted 9 lines
Quoted 8 lines
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +5
-0+if (err <0 ) { +dev_err (hw->dev,"iio triggered buffer setup failed\n" ); +return err; + } + } }for (i =0 ; i <ST_LSM6DSX_ID_MAX ; i++) {
Re: [PATCH 2/2] iio: imu: st_lsm6dsx: add iio trigger and buffer support
Quoted 13 lines · Lorenzo Bianconi
Quoted 7 lines
Quoted 4 lines · On Tue, 7 May 2019 10:02:25 +0200 Sean Nyekjaer <[email protected]> wrote:
This adds support for using iio triggers, this is needed because our hardware guys forgot to connect the irq pins from imu device to the SoC.
Quoted 5 lines
Quoted 1 line
Signed-off-by Sean Nyekjaer <[email protected]>Hi Sean
A small question on the size of the buffer needed inline. Otherwise looks good to me.
Quoted 7 lines
Hi Sean,
this patch does not make sense to me since running
st_lsm6dsx_read_oneshotyou need to wait to power up the device (and you will power it down at the end). I guess you will not be able to read at a given ODR (e.g. 416Hz). Moreover you can't read from the hw fifo without the irq line since you need to read a full pattern from it in order to maintain the alignment.
We are not using the hw fifo if the hw irq isn't present...
So if I understand correctly we could speed things up a bit, with leaving the sensor powered by implementing a new reading function and calling st_lsm6dsx_sensor_set_enable when we enable the trigger?
Quoted 3 lines
From my point of view you have 2 possibility:
- poll the output registers from userspace (this is what you are actually doing from inside the kernel, what is the advantage of doing so?)
Yes this is exactly what I'm trying to accomplish here.
It would be nice for us to have the same hrtimer/trigger to sample this and our adc.
Quoted 1 line
- fix the hw bug
Not possible on +20K devices. ;-)
Quoted 3 lines
Moreover if I read the patch correctly it has a NULL pointer dereference bug since hw->iio_devs[i] can be NULL (e.g. if sensor hub is disabled)
Right above, there is:
if (!hw->iio_devs[i])
return -ENOMEM;
Should be enough...
Quoted 4 lines
Regards,
Lorenzo
BR
/Sean
Lorenzo Bianconi
maintainerRe: [PATCH 2/2] iio: imu: st_lsm6dsx: add iio trigger and buffer support
Quoted 21 lines · Lorenzo Bianconi
Quoted 13 lines
Quoted 7 lines
Quoted 4 lines · On Tue, 7 May 2019 10:02:25 +0200 Sean Nyekjaer <[email protected]> wrote:
This adds support for using iio triggers, this is needed because our hardware guys forgot to connect the irq pins from imu device to the SoC.
Quoted 5 lines
Quoted 1 line
Signed-off-by Sean Nyekjaer <[email protected]>Hi Sean
A small question on the size of the buffer needed inline. Otherwise looks good to me.
Quoted 7 lines
Hi Sean,
this patch does not make sense to me since running
st_lsm6dsx_read_oneshotyou need to wait to power up the device (and you will power it down at the end). I guess you will not be able to read at a given ODR (e.g. 416Hz). Moreover you can't read from the hw fifo without the irq line since you need to read a full pattern from it in order to maintain the alignment.
Quoted 4 lines
We are not using the hw fifo if the hw irq isn't present... So if I understand correctly we could speed things up a bit, with leaving the sensor powered by implementing a new reading function and calling
st_lsm6dsx_sensor_set_enablewhen we enable the trigger?
I do not think so since in this way you will not know when the hw has updated the output registers
Quoted 7 lines
Quoted 4 lines
From my point of view you have 2 possibility:
- poll the output registers from userspace (this is what you are actually doing from inside the kernel, what is the advantage of doing so?)Yes this is exactly what I'm trying to accomplish here.
It would be nice for us to have the same hrtimer/trigger to sample this and our adc.
Since we need to wait the data to be ready there is no difference between reading them polling the output registers in the sysfs and doing so
Quoted 5 lines
Quoted 2 lines
- fix the hw bug
Not possible on +20K devices. ;-)
Quoted 1 line
Quoted 7 lines
Quoted 2 lines
Moreover if I read the patch correctly it has a NULL pointer dereference bug since hw->iio_devs[i] can be NULL (e.g. if sensor hub is disabled)
Right above, there is:
if (!hw->iio_devs[i])return -ENOMEM;Should be enough...
Do you mean when we alloc hw->iio_devs[]? If so the for loop stops at ST_LSM6DSX_ID_EXT0 while you are going through the complete list here (ST_LSM6DSX_ID_MAX)...
Quoted 4 lines
Quoted 4 lines
Regards,
Lorenzo
What I think can be doable is to read data trough the hw fifo but use the iio hr timer as trigger. We need to set the hr timer timeout according to the pattern len and read the complete pattern. I am not 100% sure it will work since read accesses and data generation are asynchronous (so there will be a drift).
@Jonathan, Denis: can it work?
Regards,
Lorenzo
Quoted 3 lines
BR
/Sean
Re: [PATCH 2/2] iio: imu: st_lsm6dsx: add iio trigger and buffer support
Please ignore this patchset.
The IRQ is indeed connected to our SoC
/Sean
Jonathan Cameron
maintainerRe: [PATCH 2/2] iio: imu: st_lsm6dsx: add iio trigger and buffer support
In reply to Lorenzo BianconiQuoted 62 lines · On Sat, 11 May 2019 19:00:41 +0200 Lorenzo Bianconi <[email protected]> wrote:
Quoted 21 lines · Lorenzo Bianconi
Quoted 13 lines
Quoted 7 lines
Quoted 4 lines · On Tue, 7 May 2019 10:02:25 +0200 Sean Nyekjaer <[email protected]> wrote:
This adds support for using iio triggers, this is needed because our hardware guys forgot to connect the irq pins from imu device to the SoC.
Quoted 5 lines
Quoted 1 line
Signed-off-by Sean Nyekjaer <[email protected]>Hi Sean
A small question on the size of the buffer needed inline. Otherwise looks good to me.
Quoted 7 lines
Hi Sean,
this patch does not make sense to me since running
st_lsm6dsx_read_oneshotyou need to wait to power up the device (and you will power it down at the end). I guess you will not be able to read at a given ODR (e.g. 416Hz). Moreover you can't read from the hw fifo without the irq line since you need to read a full pattern from it in order to maintain the alignment.Quoted 4 lines
We are not using the hw fifo if the hw irq isn't present... So if I understand correctly we could speed things up a bit, with leaving the sensor powered by implementing a new reading function and calling
st_lsm6dsx_sensor_set_enablewhen we enable the trigger?I do not think so since in this way you will not know when the hw has updated the output registers
Quoted 7 lines
Quoted 4 lines
From my point of view you have 2 possibility:
- poll the output registers from userspace (this is what you are actually doing from inside the kernel, what is the advantage of doing so?)Yes this is exactly what I'm trying to accomplish here.
It would be nice for us to have the same hrtimer/trigger to sample this and our adc.Since we need to wait the data to be ready there is no difference between reading them polling the output registers in the sysfs and doing so
Quoted 5 lines
Quoted 2 lines
- fix the hw bug
Not possible on +20K devices. ;-)
Quoted 1 line
Quoted 7 lines
Quoted 2 lines
Moreover if I read the patch correctly it has a NULL pointer dereference bug since hw->iio_devs[i] can be NULL (e.g. if sensor hub is disabled)
Right above, there is:
if (!hw->iio_devs[i])return -ENOMEM;Should be enough...
Do you mean when we alloc hw->iio_devs[]? If so the for loop stops at
ST_LSM6DSX_ID_EXT0while you are going through the complete list here (ST_LSM6DSX_ID_MAX)...Quoted 4 lines
Quoted 4 lines
Regards,
Lorenzo
Quoted 6 lines
What I think can be doable is to read data trough the hw fifo but use the iio hr timer as trigger. We need to set the hr timer timeout according to the pattern len and read the complete pattern. I am not 100% sure it will work since read accesses and data generation are asynchronous (so there will be a drift).
@Jonathan, Denis: can it work?
Usual nasty trick to this is you read the fifo faster than you
in theory need to. I wouldn't use the hr timer trigger for this though as it adds apparent semantics that aren't true. So spin a timer up inside the driver.
If you aren't using the fifo you can also do a higher efficiency check by polling the status registers at twice the rate of of expected data generation. When they are all set you read. So basically you poll in the interrupt line by reading the registers it reflects. There are device variants out there where there is an interrupt pin on the die but it doesn't reach the edge of the package. In those cases we always have to use hacks like this.
Anyhow, seems no actual need for this. I just wanted to put some comments in here for the future!
Jonathan
Quoted 9 lines
Regards,
LorenzoQuoted 3 lines
BR
/Sean
Re: [PATCH 2/2] iio: imu: st_lsm6dsx: add iio trigger and buffer support
In reply to Jonathan CameronQuoted 45 lines · Jonathan Cameron
Quoted 5 lines · On Tue, 7 May 2019 10:02:25 +0200 Sean Nyekjaer <[email protected]> wrote:
This adds support for using iio triggers, this is needed because our hardware guys forgot to connect the irq pins from imu device to the SoC.
Signed-off-by Sean Nyekjaer <[email protected]>Hi Sean
A small question on the size of the buffer needed inline. Otherwise looks good to me.
Quoted 21 lines
--- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 37 ++++++++++++++++++++ 1 file changed, 37 insertions(+)drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +3
-0@@ -40,8 +40,11 @@#include <linux/kernel.h> #include <linux/module.h> #include <linux/delay.h> +#include <linux/iio/buffer.h> #include <linux/iio/iio.h> #include <linux/iio/sysfs.h> +#include <linux/iio/trigger_consumer.h> +#include <linux/iio/triggered_buffer.h> #include <linux/pm.h> #include <linux/regmap.h> #include <linux/bitfield.h> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c static int st_lsm6dsx_init_hw_timer(struct st_lsm6dsx_hw *hw) · line 956
Quoted 9 lines
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +6
-0@@ -945,6 +948,30 @@ static int st_lsm6dsx_init_hw_timer(struct st_lsm6dsx_hw *hw)return 0 ; } +static irqreturn_t st_lsm6dsx_trigger_handler (int irq,void *p) +{ +struct iio_poll_func *pf = p; +struct iio_dev *indio_dev = pf->indio_dev; +struct st_lsm6dsx_sensor *sensor =iio_priv (indio_dev); +u16 buffer[4 *sizeof (s64)/sizeof (u16)];The size may well be correct, but that particular way of expressing it doesn't make it terribly clear.
Quoted 3 lines
It seems a bit large... You need the space for the timestamp, so it needs to be padded to a u64, but that would still require your other channels to need more than 2*sizeof(s64)/sizeof(u16) u16s which is 9 or more of them.
Right now we have u16[16], so that quite at bit large :-)
So maybe something like:
/* 3x s16 + 1x s16(padding) + 1x s64 timestamp */
u16 buffer[2 * sizeof(s64)/sizeof(u16)];
Would do it?
Quoted 10 lines
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c static int st_lsm6dsx_init_hw_timer(struct st_lsm6dsx_hw *hw) · line 965
Quoted 10 lines
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +9
-0+int tmp, bit; + +memset (buffer,0 ,sizeof (buffer)); + +for_each_set_bit (bit, indio_dev->active_scan_mask, indio_dev->masklength) { +st_lsm6dsx_read_oneshot (sensor, + indio_dev->channels[bit].address, &tmp); + buffer[bit] = tmp; + }
As you pointed out in the
"[PATCH 1/2] iio: adc: ti-ads8688: save values correct in buffer" When taking this approach it will not shift down.
Quoted 30 lines
Quoted 29 lines
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +19
-0+ +iio_push_to_buffers_with_timestamp (indio_dev, buffer, +iio_get_time_ns (indio_dev)); + +iio_trigger_notify_done (indio_dev->trig); + +return IRQ_HANDLED ; +} +static int st_lsm6dsx_init_device (struct st_lsm6dsx_hw *hw) {u8 drdy_int_reg;@@ -1093,6 +1120,16 @@ int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id, const char *name, err =st_lsm6dsx_fifo_setup (hw);if (err <0 )return err; + }else { +for (i =0 ; i <ST_LSM6DSX_ID_MAX ; i++) { + err =devm_iio_triggered_buffer_setup (hw->dev, + hw->iio_devs[i],NULL , + st_lsm6dsx_trigger_handler,NULL ); +if (err <0 ) { +dev_err (hw->dev,"iio triggered buffer setup failed\n" ); +return err; + } + } }for (i =0 ; i <ST_LSM6DSX_ID_MAX ; i++) {