GNU Linux-libre 4.14.257-gnu1
[releases.git] / include / linux / input / gpio_tilt.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _INPUT_GPIO_TILT_H
3 #define _INPUT_GPIO_TILT_H
4
5 /**
6  * struct gpio_tilt_axis - Axis used by the tilt switch
7  * @axis:               Constant describing the axis, e.g. ABS_X
8  * @min:                minimum value for abs_param
9  * @max:                maximum value for abs_param
10  * @fuzz:               fuzz value for abs_param
11  * @flat:               flat value for abs_param
12  */
13 struct gpio_tilt_axis {
14         int axis;
15         int min;
16         int max;
17         int fuzz;
18         int flat;
19 };
20
21 /**
22  * struct gpio_tilt_state - state description
23  * @gpios:              bitfield of gpio target-states for the value
24  * @axes:               array containing the axes settings for the gpio state
25  *                      The array indizes must correspond to the axes defined
26  *                      in platform_data
27  *
28  * This structure describes a supported axis settings
29  * and the necessary gpio-state which represent it.
30  *
31  * The n-th bit in the bitfield describes the state of the n-th GPIO
32  * from the gpios-array defined in gpio_regulator_config below.
33  */
34 struct gpio_tilt_state {
35         int gpios;
36         int *axes;
37 };
38
39 /**
40  * struct gpio_tilt_platform_data
41  * @gpios:              Array containing the gpios determining the tilt state
42  * @nr_gpios:           Number of gpios
43  * @axes:               Array of gpio_tilt_axis descriptions
44  * @nr_axes:            Number of axes
45  * @states:             Array of gpio_tilt_state entries describing
46  *                      the gpio state for specific tilts
47  * @nr_states:          Number of states available
48  * @debounce_interval:  debounce ticks interval in msecs
49  * @poll_interval:      polling interval in msecs - for polling driver only
50  * @enable:             callback to enable the tilt switch
51  * @disable:            callback to disable the tilt switch
52  *
53  * This structure contains gpio-tilt-switch configuration
54  * information that must be passed by platform code to the
55  * gpio-tilt input driver.
56  */
57 struct gpio_tilt_platform_data {
58         struct gpio *gpios;
59         int nr_gpios;
60
61         struct gpio_tilt_axis *axes;
62         int nr_axes;
63
64         struct gpio_tilt_state *states;
65         int nr_states;
66
67         int debounce_interval;
68
69         unsigned int poll_interval;
70         int (*enable)(struct device *dev);
71         void (*disable)(struct device *dev);
72 };
73
74 #endif