2 * Copyright (c) 2011 Jonathan Cameron
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 as published by
6 * the Free Software Foundation.
8 * Join together the various functionality of iio_simple_dummy driver
11 #include <linux/kernel.h>
13 struct iio_dummy_accel_calibscale;
16 * struct iio_dummy_state - device instance specific state.
17 * @dac_val: cache for dac value
18 * @single_ended_adc_val: cache for single ended adc value
19 * @differential_adc_val: cache for differential adc value
20 * @accel_val: cache for acceleration value
21 * @accel_calibbias: cache for acceleration calibbias
22 * @accel_calibscale: cache for acceleration calibscale
23 * @lock: lock to ensure state is consistent
24 * @event_irq: irq number for event line (faked)
25 * @event_val: cache for event theshold value
26 * @event_en: cache of whether event is enabled
28 struct iio_dummy_state {
30 int single_ended_adc_val;
31 int differential_adc_val[2];
34 const struct iio_dummy_accel_calibscale *accel_calibscale;
36 #ifdef CONFIG_IIO_SIMPLE_DUMMY_EVENTS
40 #endif /* CONFIG_IIO_SIMPLE_DUMMY_EVENTS */
43 #ifdef CONFIG_IIO_SIMPLE_DUMMY_EVENTS
47 int iio_simple_dummy_read_event_config(struct iio_dev *indio_dev,
50 int iio_simple_dummy_write_event_config(struct iio_dev *indio_dev,
54 int iio_simple_dummy_read_event_value(struct iio_dev *indio_dev,
58 int iio_simple_dummy_write_event_value(struct iio_dev *indio_dev,
62 int iio_simple_dummy_events_register(struct iio_dev *indio_dev);
63 int iio_simple_dummy_events_unregister(struct iio_dev *indio_dev);
65 #else /* Stubs for when events are disabled at compile time */
68 iio_simple_dummy_events_register(struct iio_dev *indio_dev)
74 iio_simple_dummy_events_unregister(struct iio_dev *indio_dev)
79 #endif /* CONFIG_IIO_SIMPLE_DUMMY_EVENTS*/