diff options
author | Max Krummenacher <max.krummenacher@toradex.com> | 2015-04-10 12:49:24 +0200 |
---|---|---|
committer | Marcel Ziswiler <marcel.ziswiler@toradex.com> | 2018-12-24 01:27:26 +0100 |
commit | 706cd63c0eff58841d1f696b038a48f409be446b (patch) | |
tree | fa3c33b8e7482a5f2d309f113e4f3ba955bf925e /drivers | |
parent | 386a13ce3831d103cb2e135afc732a541a0f9d9a (diff) |
iio:stmpe-adc.c: Switch to new event config interface
Switch the stmpe-adc driver to the new IIO event config interface as the old one
is going to be removed.
Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
(cherry picked from commit 928ac1ed52919ba6f2ec06aa45269bc15913ba87)
(cherry picked from commit e4d913a9dcbae4bc68205d091166dde4bb12357b)
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/iio/adc/stmpe-adc.c | 56 |
1 files changed, 33 insertions, 23 deletions
diff --git a/drivers/staging/iio/adc/stmpe-adc.c b/drivers/staging/iio/adc/stmpe-adc.c index 64d081a0d98a..783297f09e65 100644 --- a/drivers/staging/iio/adc/stmpe-adc.c +++ b/drivers/staging/iio/adc/stmpe-adc.c @@ -166,53 +166,63 @@ static const struct iio_info stmpe_adc_iio_info = { .driver_module = THIS_MODULE, }; -#define STMPE_EV_M \ - (IIO_EV_BIT(IIO_EV_TYPE_THRESH, IIO_EV_DIR_RISING) \ - | IIO_EV_BIT(IIO_EV_TYPE_THRESH, IIO_EV_DIR_FALLING)) -#define STMPE_VOLTAGE_CHAN(_chan) \ +static const struct iio_event_spec stmpe_adc_events[] = { + { + .type = IIO_EV_TYPE_THRESH, + .dir = IIO_EV_DIR_RISING, + .mask_separate = BIT(IIO_EV_INFO_VALUE) | + BIT(IIO_EV_INFO_ENABLE), + }, { + .type = IIO_EV_TYPE_THRESH, + .dir = IIO_EV_DIR_FALLING, + .mask_separate = BIT(IIO_EV_INFO_VALUE) | + BIT(IIO_EV_INFO_ENABLE), + }, +}; + +#define STMPE_VOLTAGE_CHAN(_chan, ev_spec, num_ev_spec) \ { \ .type = IIO_VOLTAGE, \ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \ .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \ .indexed = 1, \ .channel = _chan, \ - .event_mask = STMPE_EV_M, \ + .event_spec = ev_spec, \ + .num_event_specs = num_ev_spec, \ } static const struct iio_chan_spec stmpe_adc_all_iio_channels[] = { - STMPE_VOLTAGE_CHAN(0), - STMPE_VOLTAGE_CHAN(1), - STMPE_VOLTAGE_CHAN(2), - STMPE_VOLTAGE_CHAN(3), - STMPE_VOLTAGE_CHAN(4), - STMPE_VOLTAGE_CHAN(5), - STMPE_VOLTAGE_CHAN(6), - STMPE_VOLTAGE_CHAN(7), + STMPE_VOLTAGE_CHAN(0, stmpe_adc_events, ARRAY_SIZE(stmpe_adc_events)), + STMPE_VOLTAGE_CHAN(1, stmpe_adc_events, ARRAY_SIZE(stmpe_adc_events)), + STMPE_VOLTAGE_CHAN(2, stmpe_adc_events, ARRAY_SIZE(stmpe_adc_events)), + STMPE_VOLTAGE_CHAN(3, stmpe_adc_events, ARRAY_SIZE(stmpe_adc_events)), + STMPE_VOLTAGE_CHAN(4, stmpe_adc_events, ARRAY_SIZE(stmpe_adc_events)), + STMPE_VOLTAGE_CHAN(5, stmpe_adc_events, ARRAY_SIZE(stmpe_adc_events)), + STMPE_VOLTAGE_CHAN(6, stmpe_adc_events, ARRAY_SIZE(stmpe_adc_events)), + STMPE_VOLTAGE_CHAN(7, stmpe_adc_events, ARRAY_SIZE(stmpe_adc_events)), { .type = IIO_TEMP, .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), .indexed = 1, .channel = 8, - .event_mask = - IIO_EV_BIT(IIO_EV_TYPE_THRESH, IIO_EV_DIR_RISING)| - IIO_EV_BIT(IIO_EV_TYPE_THRESH, IIO_EV_DIR_FALLING) + .event_spec = stmpe_adc_events, + .num_event_specs = ARRAY_SIZE(stmpe_adc_events), } }; static const struct iio_chan_spec stmpe_adc_iio_channels[] = { - STMPE_VOLTAGE_CHAN(4), - STMPE_VOLTAGE_CHAN(5), - STMPE_VOLTAGE_CHAN(6), - STMPE_VOLTAGE_CHAN(7), + STMPE_VOLTAGE_CHAN(4, stmpe_adc_events, ARRAY_SIZE(stmpe_adc_events)), + STMPE_VOLTAGE_CHAN(5, stmpe_adc_events, ARRAY_SIZE(stmpe_adc_events)), + STMPE_VOLTAGE_CHAN(6, stmpe_adc_events, ARRAY_SIZE(stmpe_adc_events)), + STMPE_VOLTAGE_CHAN(7, stmpe_adc_events, ARRAY_SIZE(stmpe_adc_events)), { .type = IIO_TEMP, .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), .indexed = 1, .channel = 8, - .event_mask = - IIO_EV_BIT(IIO_EV_TYPE_THRESH, IIO_EV_DIR_RISING)| - IIO_EV_BIT(IIO_EV_TYPE_THRESH, IIO_EV_DIR_FALLING) + .event_spec = stmpe_adc_events, + .num_event_specs = ARRAY_SIZE(stmpe_adc_events), } }; |