1
2
3
4
5
6
7
8#ifndef _IIO_SIMPLE_DUMMY_H_
9#define _IIO_SIMPLE_DUMMY_H_
10#include <linux/kernel.h>
11
12struct iio_dummy_accel_calibscale;
13struct iio_dummy_regs;
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28struct iio_dummy_state {
29 int dac_val;
30 int single_ended_adc_val;
31 int differential_adc_val[2];
32 int accel_val;
33 int accel_calibbias;
34 int activity_running;
35 int activity_walking;
36 const struct iio_dummy_accel_calibscale *accel_calibscale;
37 struct mutex lock;
38 struct iio_dummy_regs *regs;
39 int steps_enabled;
40 int steps;
41 int height;
42#ifdef CONFIG_IIO_SIMPLE_DUMMY_EVENTS
43 int event_irq;
44 int event_val;
45 bool event_en;
46 s64 event_timestamp;
47#endif
48};
49
50#ifdef CONFIG_IIO_SIMPLE_DUMMY_EVENTS
51
52struct iio_dev;
53
54int iio_simple_dummy_read_event_config(struct iio_dev *indio_dev,
55 const struct iio_chan_spec *chan,
56 enum iio_event_type type,
57 enum iio_event_direction dir);
58
59int iio_simple_dummy_write_event_config(struct iio_dev *indio_dev,
60 const struct iio_chan_spec *chan,
61 enum iio_event_type type,
62 enum iio_event_direction dir,
63 int state);
64
65int iio_simple_dummy_read_event_value(struct iio_dev *indio_dev,
66 const struct iio_chan_spec *chan,
67 enum iio_event_type type,
68 enum iio_event_direction dir,
69 enum iio_event_info info, int *val,
70 int *val2);
71
72int iio_simple_dummy_write_event_value(struct iio_dev *indio_dev,
73 const struct iio_chan_spec *chan,
74 enum iio_event_type type,
75 enum iio_event_direction dir,
76 enum iio_event_info info, int val,
77 int val2);
78
79int iio_simple_dummy_events_register(struct iio_dev *indio_dev);
80void iio_simple_dummy_events_unregister(struct iio_dev *indio_dev);
81
82#else
83
84static inline int
85iio_simple_dummy_events_register(struct iio_dev *indio_dev)
86{
87 return 0;
88}
89
90static inline void
91iio_simple_dummy_events_unregister(struct iio_dev *indio_dev)
92{}
93
94#endif
95
96
97
98
99
100
101
102
103
104
105enum iio_simple_dummy_scan_elements {
106 DUMMY_INDEX_VOLTAGE_0,
107 DUMMY_INDEX_DIFFVOLTAGE_1M2,
108 DUMMY_INDEX_DIFFVOLTAGE_3M4,
109 DUMMY_INDEX_ACCELX,
110};
111
112#ifdef CONFIG_IIO_SIMPLE_DUMMY_BUFFER
113int iio_simple_dummy_configure_buffer(struct iio_dev *indio_dev);
114void iio_simple_dummy_unconfigure_buffer(struct iio_dev *indio_dev);
115#else
116static inline int iio_simple_dummy_configure_buffer(struct iio_dev *indio_dev)
117{
118 return 0;
119}
120
121static inline
122void iio_simple_dummy_unconfigure_buffer(struct iio_dev *indio_dev)
123{}
124
125#endif
126#endif
127