]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - include/linux/spi/tsc2046.h
omap2_mcspi fixes + cleanups
[linux-2.6-omap-h63xx.git] / include / linux / spi / tsc2046.h
1 #ifndef _LINUX_SPI_TSC2046_H
2 #define _LINUX_SPI_TSC2046_H
3
4 #include <linux/types.h>
5 #include <linux/timer.h>
6
7 struct tsc2046_platform_data {
8         s16     dav_gpio;
9         s16     gpio_debounce;
10         u16     ts_x_plate_ohm;
11         u32     ts_max_pressure;  /* Samples with bigger pressure value will
12                                      be ignored, since the corresponding X, Y
13                                      values are unreliable */
14         u32     ts_touch_pressure;/* Pressure limit until we report a
15                                      touch event. After that we switch
16                                      to ts_max_pressure. */
17         unsigned ts_ignore_last : 1;
18
19 };
20
21 struct tsc2046_ts;
22
23 struct tsc2046 {
24         struct spi_device       *spi;
25         int                     gpio;
26
27         struct tsc2046_ts       *ts;
28 };
29
30 /* The TSC2046 operates at a maximum speed of 2MHz */
31 #define TSC2046_HZ      2000000
32
33 #define TSC2046_DECL_MOD(module)                                        \
34 extern int  tsc2046_##module##_init(struct tsc2046 *tsc,                \
35                            struct tsc2046_platform_data *pdata);        \
36 extern void tsc2046_##module##_exit(struct tsc2046 *tsc);               \
37 extern int  tsc2046_##module##_suspend(struct tsc2046 *tsc);            \
38 extern void tsc2046_##module##_resume(struct tsc2046 *tsc);
39
40 #define TSC2046_DECL_EMPTY_MOD(module)                                  \
41 static inline int tsc2046_##module##_init(struct tsc2046 *tsc,          \
42                            struct tsc2046_platform_data *pdata)         \
43 {                                                                       \
44         return 0;                                                       \
45 }                                                                       \
46 static inline void tsc2046_##module##_exit(struct tsc2046 *tsc) {}      \
47 static inline int  tsc2046_##module##_suspend(struct tsc2046 *tsc)      \
48 {                                                                       \
49         return 0;                                                       \
50 }                                                                       \
51 static inline void tsc2046_##module##_resume(struct tsc2046 *tsc) {}
52
53 #if defined(CONFIG_TOUCHSCREEN_TSC2046) || \
54     defined(CONFIG_TOUCHSCREEN_TSC2046_MODULE)
55 TSC2046_DECL_MOD(ts)
56 #else
57 TSC2046_DECL_EMPTY_MOD(ts)
58 #endif
59
60 #endif