diff options
author | Giuseppe Barba <giuseppe.barba@st.com> | 2015-07-21 10:35:43 +0200 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2015-07-23 20:43:13 +0100 |
commit | 74f5683f35fe6feae33b96815c1d40f13468d614 (patch) | |
tree | c61d0e3f3e7455cf5542bcb7cb14b7f667ac5457 /drivers/iio/magnetometer/st_magn_core.c | |
parent | bb602f8c61e289389e7c2af1b577303a841f6d34 (diff) | |
download | op-kernel-dev-74f5683f35fe6feae33b96815c1d40f13468d614.zip op-kernel-dev-74f5683f35fe6feae33b96815c1d40f13468d614.tar.gz |
iio: st_magn: Add irq trigger handling
Add irq trigger handling for magnetometer also
Signed-off-by: Giuseppe Barba <giuseppe.barba@st.com>
Acked-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/magnetometer/st_magn_core.c')
-rw-r--r-- | drivers/iio/magnetometer/st_magn_core.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c index 8d7d3a1..4c0cef8 100644 --- a/drivers/iio/magnetometer/st_magn_core.c +++ b/drivers/iio/magnetometer/st_magn_core.c @@ -480,6 +480,16 @@ static const struct iio_info magn_info = { .write_raw = &st_magn_write_raw, }; +#ifdef CONFIG_IIO_TRIGGER +static const struct iio_trigger_ops st_magn_trigger_ops = { + .owner = THIS_MODULE, + .set_trigger_state = ST_MAGN_TRIGGER_SET_STATE, +}; +#define ST_MAGN_TRIGGER_OPS (&st_magn_trigger_ops) +#else +#define ST_MAGN_TRIGGER_OPS NULL +#endif + int st_magn_common_probe(struct iio_dev *indio_dev) { struct st_sensor_data *mdata = iio_priv(indio_dev); @@ -516,7 +526,8 @@ int st_magn_common_probe(struct iio_dev *indio_dev) return err; if (irq > 0) { - err = st_sensors_allocate_trigger(indio_dev, NULL); + err = st_sensors_allocate_trigger(indio_dev, + ST_MAGN_TRIGGER_OPS); if (err < 0) goto st_magn_probe_trigger_error; } |