Reload the current playlist after reboot even if it has ended. (FS#11644)
[kugel-rb.git] / firmware / export / synaptics-rmi.h
blob38a9955dccb3669ac3bafe71cc5dd0cf47806689
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2011 by Amaury Pouly
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
21 #ifndef SYNAPTICS_RMI_H
22 #define SYNAPTICS_RMI_H
24 #define RMI_PAGE_SELECT 0xff /* $xxff */
25 #define RMI_MAKE_REG(fn, reg) (((fn) << 8) | (reg))
26 #define RMI_DEVICE_CONTROL 0x0 /* $0000 */
27 #define RMI_INTERRUPT_ENABLE 0x1 /* $0001 */
28 #define RMI_INTERRUPT_REQUEST 0x3 /* $0003 */
29 #define RMI_PRODUCT_ID 0x210 /* $0210 */
30 #define RMI_PRODUCT_ID_LEN 16
31 #define RMI_2D_TOUCHPAD_FUNCTION 0x10
32 #define RMI_FUNCTION_PRESENCE(fn) RMI_MAKE_REG(0x03, fn) /* $03xx */
33 #define RMI_FUNCTION_VERSION(fn) RMI_MAKE_REG(fn, 0) /* $xx00 */
34 #define RMI_DATA_REGISTER(data_src) RMI_MAKE_REG(0x4, data_src) /* $04xx */
35 /* 2D TouchPad/ClearPad */
36 #define RMI_2D_REG(reg) RMI_MAKE_REG(RMI_2D_TOUCHPAD_FUNCTION, reg)
37 #define RMI_2D_SENSOR_PROP1(sens) RMI_2D_REG(8 * (sens) + 0x2)
38 #define RMI_2D_SENSOR_PROP2(sens) RMI_2D_REG(8 * (sens) + 0x3)
39 #define RMI_2D_SENSOR_XMAX_MSB(s) RMI_2D_REG(8 * (s) + 0x4)
40 #define RMI_2D_SENSOR_XMAX_LSB(s) RMI_2D_REG(8 * (s) + 0x5)
41 #define RMI_2D_SENSOR_YMAX_MSB(s) RMI_2D_REG(8 * (s) + 0x6)
42 #define RMI_2D_SENSOR_YMAX_LSB(s) RMI_2D_REG(8 * (s) + 0x7)
43 #define RMI_2D_SENSOR_RESOLUTION(s) RMI_2D_REG(8 * (s) + 0x8)
44 #define RMI_2D_GLOBAL_SETTINGS RMI_2D_REG(0x41)
45 #define RMI_2D_GESTURE_SETTINGS RMI_2D_REG(0x42)
46 #define RMI_2D_GESTURE_PRESS_TIME_BM 0x7
47 #define RMI_2D_GESTURE_PRESS_TIME_300MS 0
48 #define RMI_2D_GESTURE_PRESS_TIME_400MS 1
49 #define RMI_2D_GESTURE_PRESS_TIME_500MS 2
50 #define RMI_2D_GESTURE_PRESS_TIME_600MS 3
51 #define RMI_2D_GESTURE_PRESS_TIME_700MS 4
52 #define RMI_2D_GESTURE_PRESS_TIME_800MS 5
53 #define RMI_2D_GESTURE_PRESS_TIME_900MS 6
54 #define RMI_2D_GESTURE_PRESS_TIME_1S 7
55 #define RMI_2D_GESTURE_FLICK_DIST_BM (0x7 << 3)
56 #define RMI_2D_GESTURE_FLICK_DIST_BP 3
57 #define RMI_2D_GESTURE_FLICK_DIST_4MM 0
58 #define RMI_2D_GESTURE_FLICK_DIST_5MM 1
59 #define RMI_2D_GESTURE_FLICK_DIST_6MM 2
60 #define RMI_2D_GESTURE_FLICK_DIST_7MM 3
61 #define RMI_2D_GESTURE_FLICK_DIST_8MM 4
62 #define RMI_2D_GESTURE_FLICK_DIST_9MM 5
63 #define RMI_2D_GESTURE_FLICK_DIST_10MM 6
64 #define RMI_2D_GESTURE_FLICK_DIST_11MM 7
65 #define RMI_2D_GESTURE_FLICK_TIME_BM (2 << 6)
66 #define RMI_2D_GESTURE_FLICK_TIME_BP 6
67 #define RMI_2D_GESTURE_FLICK_TIME_250MS 0
68 #define RMI_2D_GESTURE_FLICK_TIME_400MS 1
69 #define RMI_2D_GESTURE_FLICK_TIME_550MS 2
70 #define RMI_2D_GESTURE_FLICK_TIME_700MS 3
71 #define RMI_2D_SENSITIVITY_ADJ RMI_2D_REG(0x44)
72 #define RMI_2D_MIN_DIST RMI_2D_REG(0x45)
73 /* 2D TouchPad/ClearPad data registers */
74 struct rmi_2d_absolute_data_t
76 unsigned char misc;
77 unsigned char z;
78 unsigned char x_msb;
79 unsigned char x_lsb;
80 unsigned char y_msb;
81 unsigned char y_lsb;
82 } __attribute__((packed));
84 #define RMI_2D_ABS_MISC_NR_FINGERS_BM 7
85 #define RMI_2D_ABS_MISC_GESTURE (1 << 3)
86 #define RMI_2D_ABS_MISC_WIDTH_BM 0xf0
87 #define RMI_2D_ABS_MISC_WIDTH_BP 4
88 #define RMI_2D_GEST_MISC_TAP_CODE_BM 7
89 #define RMI_2D_GEST_MISC_NO_TAP 0
90 #define RMI_2D_GEST_MISC_SINGLE_TAP 1
91 #define RMI_2D_GEST_MISC_TAP_AND_HOLD 2
92 #define RMI_2D_GEST_MISC_DOUBLE_TAP 3
93 #define RMI_2D_GEST_MISC_PRESS (1 << 3)
94 #define RMI_2D_GEST_MISC_FLICK (1 << 4)
95 #define RMI_2D_GEST_MISC_PINCH (1 << 5)
96 #define RMI_2D_GEST_MISC_CONFIRMED (1 << 7)
97 #define RMI_2D_GEST_FLICK_X_BM 0x0f
98 #define RMI_2D_GEST_FLICK_Y_BM 0xf0
99 #define RMI_2D_GEST_FLICK_Y_BP 4
101 struct rmi_2d_relative_data_t
103 signed char x; /* signed */
104 signed char y; /* signed */
105 } __attribute__((packed));
107 struct rmi_2d_gesture_data_t
109 unsigned char misc;
110 unsigned char flick;
111 } __attribute__((packed));
113 /* Initialize the RMI driver, the i2c_bus_index is the bus index returned by
114 * the generic_i2c driver; the i2c_dev_addr is the i2c address of the device.
115 * NOTE: the driver automatically handles the page select mechanism used for
116 * RMI over i2c and assumes a standard page select register at 0xff. */
117 int rmi_init(int i2c_dev_addr);
118 /* Read one or more registers.
119 * WARNING: don't cross a page boundary ! */
120 int rmi_read(int address, int byte_count, unsigned char *buffer);
121 /* Read a single register (return -1 on error)
122 * WARNING: beware of register consistency (N x read 1 byte != reads N bytes) */
123 int rmi_read_single(int address); /* return byte value or <0 in case of error */
124 /* Write one of more register
125 * WARNING: don't cross a page boundary ! */
126 int rmi_write(int address, int byte_count, const unsigned char *buffer);
127 /* Write one register
128 * WARNING: don't cross a page boundary ! */
129 int rmi_write_single(int address, unsigned char byte);
131 #endif