aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/i2c
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/i2c')
-rw-r--r--include/linux/i2c/adp5588.h92
-rw-r--r--include/linux/i2c/mcs5000_ts.h24
-rw-r--r--include/linux/i2c/twl4030.h113
3 files changed, 213 insertions, 16 deletions
diff --git a/include/linux/i2c/adp5588.h b/include/linux/i2c/adp5588.h
new file mode 100644
index 000000000000..fc5db826b48e
--- /dev/null
+++ b/include/linux/i2c/adp5588.h
@@ -0,0 +1,92 @@
1/*
2 * Analog Devices ADP5588 I/O Expander and QWERTY Keypad Controller
3 *
4 * Copyright 2009 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#ifndef _ADP5588_H
10#define _ADP5588_H
11
12#define DEV_ID 0x00 /* Device ID */
13#define CFG 0x01 /* Configuration Register1 */
14#define INT_STAT 0x02 /* Interrupt Status Register */
15#define KEY_LCK_EC_STAT 0x03 /* Key Lock and Event Counter Register */
16#define Key_EVENTA 0x04 /* Key Event Register A */
17#define Key_EVENTB 0x05 /* Key Event Register B */
18#define Key_EVENTC 0x06 /* Key Event Register C */
19#define Key_EVENTD 0x07 /* Key Event Register D */
20#define Key_EVENTE 0x08 /* Key Event Register E */
21#define Key_EVENTF 0x09 /* Key Event Register F */
22#define Key_EVENTG 0x0A /* Key Event Register G */
23#define Key_EVENTH 0x0B /* Key Event Register H */
24#define Key_EVENTI 0x0C /* Key Event Register I */
25#define Key_EVENTJ 0x0D /* Key Event Register J */
26#define KP_LCK_TMR 0x0E /* Keypad Lock1 to Lock2 Timer */
27#define UNLOCK1 0x0F /* Unlock Key1 */
28#define UNLOCK2 0x10 /* Unlock Key2 */
29#define GPIO_INT_STAT1 0x11 /* GPIO Interrupt Status */
30#define GPIO_INT_STAT2 0x12 /* GPIO Interrupt Status */
31#define GPIO_INT_STAT3 0x13 /* GPIO Interrupt Status */
32#define GPIO_DAT_STAT1 0x14 /* GPIO Data Status, Read twice to clear */
33#define GPIO_DAT_STAT2 0x15 /* GPIO Data Status, Read twice to clear */
34#define GPIO_DAT_STAT3 0x16 /* GPIO Data Status, Read twice to clear */
35#define GPIO_DAT_OUT1 0x17 /* GPIO DATA OUT */
36#define GPIO_DAT_OUT2 0x18 /* GPIO DATA OUT */
37#define GPIO_DAT_OUT3 0x19 /* GPIO DATA OUT */
38#define GPIO_INT_EN1 0x1A /* GPIO Interrupt Enable */
39#define GPIO_INT_EN2 0x1B /* GPIO Interrupt Enable */
40#define GPIO_INT_EN3 0x1C /* GPIO Interrupt Enable */
41#define KP_GPIO1 0x1D /* Keypad or GPIO Selection */
42#define KP_GPIO2 0x1E /* Keypad or GPIO Selection */
43#define KP_GPIO3 0x1F /* Keypad or GPIO Selection */
44#define GPI_EM1 0x20 /* GPI Event Mode 1 */
45#define GPI_EM2 0x21 /* GPI Event Mode 2 */
46#define GPI_EM3 0x22 /* GPI Event Mode 3 */
47#define GPIO_DIR1 0x23 /* GPIO Data Direction */
48#define GPIO_DIR2 0x24 /* GPIO Data Direction */
49#define GPIO_DIR3 0x25 /* GPIO Data Direction */
50#define GPIO_INT_LVL1 0x26 /* GPIO Edge/Level Detect */
51#define GPIO_INT_LVL2 0x27 /* GPIO Edge/Level Detect */
52#define GPIO_INT_LVL3 0x28 /* GPIO Edge/Level Detect */
53#define Debounce_DIS1 0x29 /* Debounce Disable */
54#define Debounce_DIS2 0x2A /* Debounce Disable */
55#define Debounce_DIS3 0x2B /* Debounce Disable */
56#define GPIO_PULL1 0x2C /* GPIO Pull Disable */
57#define GPIO_PULL2 0x2D /* GPIO Pull Disable */
58#define GPIO_PULL3 0x2E /* GPIO Pull Disable */
59#define CMP_CFG_STAT 0x30 /* Comparator Configuration and Status Register */
60#define CMP_CONFG_SENS1 0x31 /* Sensor1 Comparator Configuration Register */
61#define CMP_CONFG_SENS2 0x32 /* L2 Light Sensor Reference Level, Output Falling for Sensor 1 */
62#define CMP1_LVL2_TRIP 0x33 /* L2 Light Sensor Hysteresis (Active when Output Rising) for Sensor 1 */
63#define CMP1_LVL2_HYS 0x34 /* L3 Light Sensor Reference Level, Output Falling For Sensor 1 */
64#define CMP1_LVL3_TRIP 0x35 /* L3 Light Sensor Hysteresis (Active when Output Rising) For Sensor 1 */
65#define CMP1_LVL3_HYS 0x36 /* Sensor 2 Comparator Configuration Register */
66#define CMP2_LVL2_TRIP 0x37 /* L2 Light Sensor Reference Level, Output Falling for Sensor 2 */
67#define CMP2_LVL2_HYS 0x38 /* L2 Light Sensor Hysteresis (Active when Output Rising) for Sensor 2 */
68#define CMP2_LVL3_TRIP 0x39 /* L3 Light Sensor Reference Level, Output Falling For Sensor 2 */
69#define CMP2_LVL3_HYS 0x3A /* L3 Light Sensor Hysteresis (Active when Output Rising) For Sensor 2 */
70#define CMP1_ADC_DAT_R1 0x3B /* Comparator 1 ADC data Register1 */
71#define CMP1_ADC_DAT_R2 0x3C /* Comparator 1 ADC data Register2 */
72#define CMP2_ADC_DAT_R1 0x3D /* Comparator 2 ADC data Register1 */
73#define CMP2_ADC_DAT_R2 0x3E /* Comparator 2 ADC data Register2 */
74
75#define ADP5588_DEVICE_ID_MASK 0xF
76
77/* Put one of these structures in i2c_board_info platform_data */
78
79#define ADP5588_KEYMAPSIZE 80
80
81struct adp5588_kpad_platform_data {
82 int rows; /* Number of rows */
83 int cols; /* Number of columns */
84 const unsigned short *keymap; /* Pointer to keymap */
85 unsigned short keymapsize; /* Keymap size */
86 unsigned repeat:1; /* Enable key repeat */
87 unsigned en_keylock:1; /* Enable Key Lock feature */
88 unsigned short unlock_key1; /* Unlock Key 1 */
89 unsigned short unlock_key2; /* Unlock Key 2 */
90};
91
92#endif
diff --git a/include/linux/i2c/mcs5000_ts.h b/include/linux/i2c/mcs5000_ts.h
new file mode 100644
index 000000000000..5a117b5ca15e
--- /dev/null
+++ b/include/linux/i2c/mcs5000_ts.h
@@ -0,0 +1,24 @@
1/*
2 * mcs5000_ts.h
3 *
4 * Copyright (C) 2009 Samsung Electronics Co.Ltd
5 * Author: Joonyoung Shim <jy0922.shim@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 */
13
14#ifndef __LINUX_MCS5000_TS_H
15#define __LINUX_MCS5000_TS_H
16
17/* platform data for the MELFAS MCS-5000 touchscreen driver */
18struct mcs5000_ts_platform_data {
19 void (*cfg_pin)(void);
20 int x_size;
21 int y_size;
22};
23
24#endif /* __LINUX_MCS5000_TS_H */
diff --git a/include/linux/i2c/twl4030.h b/include/linux/i2c/twl4030.h
index 0dc80ef24975..508824ee35e6 100644
--- a/include/linux/i2c/twl4030.h
+++ b/include/linux/i2c/twl4030.h
@@ -25,6 +25,9 @@
25#ifndef __TWL4030_H_ 25#ifndef __TWL4030_H_
26#define __TWL4030_H_ 26#define __TWL4030_H_
27 27
28#include <linux/types.h>
29#include <linux/input/matrix_keypad.h>
30
28/* 31/*
29 * Using the twl4030 core we address registers using a pair 32 * Using the twl4030 core we address registers using a pair
30 * { module id, relative register offset } 33 * { module id, relative register offset }
@@ -220,19 +223,28 @@ int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
220 223
221/* Power bus message definitions */ 224/* Power bus message definitions */
222 225
223#define DEV_GRP_NULL 0x0 226/* The TWL4030/5030 splits its power-management resources (the various
224#define DEV_GRP_P1 0x1 227 * regulators, clock and reset lines) into 3 processor groups - P1, P2 and
225#define DEV_GRP_P2 0x2 228 * P3. These groups can then be configured to transition between sleep, wait-on
226#define DEV_GRP_P3 0x4 229 * and active states by sending messages to the power bus. See Section 5.4.2
230 * Power Resources of TWL4030 TRM
231 */
227 232
228#define RES_GRP_RES 0x0 233/* Processor groups */
229#define RES_GRP_PP 0x1 234#define DEV_GRP_NULL 0x0
230#define RES_GRP_RC 0x2 235#define DEV_GRP_P1 0x1 /* P1: all OMAP devices */
236#define DEV_GRP_P2 0x2 /* P2: all Modem devices */
237#define DEV_GRP_P3 0x4 /* P3: all peripheral devices */
238
239/* Resource groups */
240#define RES_GRP_RES 0x0 /* Reserved */
241#define RES_GRP_PP 0x1 /* Power providers */
242#define RES_GRP_RC 0x2 /* Reset and control */
231#define RES_GRP_PP_RC 0x3 243#define RES_GRP_PP_RC 0x3
232#define RES_GRP_PR 0x4 244#define RES_GRP_PR 0x4 /* Power references */
233#define RES_GRP_PP_PR 0x5 245#define RES_GRP_PP_PR 0x5
234#define RES_GRP_RC_PR 0x6 246#define RES_GRP_RC_PR 0x6
235#define RES_GRP_ALL 0x7 247#define RES_GRP_ALL 0x7 /* All resource groups */
236 248
237#define RES_TYPE2_R0 0x0 249#define RES_TYPE2_R0 0x0
238 250
@@ -243,6 +255,41 @@ int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
243#define RES_STATE_SLEEP 0x8 255#define RES_STATE_SLEEP 0x8
244#define RES_STATE_OFF 0x0 256#define RES_STATE_OFF 0x0
245 257
258/* Power resources */
259
260/* Power providers */
261#define RES_VAUX1 1
262#define RES_VAUX2 2
263#define RES_VAUX3 3
264#define RES_VAUX4 4
265#define RES_VMMC1 5
266#define RES_VMMC2 6
267#define RES_VPLL1 7
268#define RES_VPLL2 8
269#define RES_VSIM 9
270#define RES_VDAC 10
271#define RES_VINTANA1 11
272#define RES_VINTANA2 12
273#define RES_VINTDIG 13
274#define RES_VIO 14
275#define RES_VDD1 15
276#define RES_VDD2 16
277#define RES_VUSB_1V5 17
278#define RES_VUSB_1V8 18
279#define RES_VUSB_3V1 19
280#define RES_VUSBCP 20
281#define RES_REGEN 21
282/* Reset and control */
283#define RES_NRES_PWRON 22
284#define RES_CLKEN 23
285#define RES_SYSEN 24
286#define RES_HFCLKOUT 25
287#define RES_32KCLKOUT 26
288#define RES_RESET 27
289/* Power Reference */
290#define RES_Main_Ref 28
291
292#define TOTAL_RESOURCES 28
246/* 293/*
247 * Power Bus Message Format ... these can be sent individually by Linux, 294 * Power Bus Message Format ... these can be sent individually by Linux,
248 * but are usually part of downloaded scripts that are run when various 295 * but are usually part of downloaded scripts that are run when various
@@ -302,13 +349,17 @@ struct twl4030_madc_platform_data {
302 int irq_line; 349 int irq_line;
303}; 350};
304 351
352/* Boards have uniqe mappings of {row, col} --> keycode.
353 * Column and row are 8 bits each, but range only from 0..7.
354 * a PERSISTENT_KEY is "always on" and never reported.
355 */
356#define PERSISTENT_KEY(r, c) KEY((r), (c), KEY_RESERVED)
357
305struct twl4030_keypad_data { 358struct twl4030_keypad_data {
306 int rows; 359 const struct matrix_keymap_data *keymap_data;
307 int cols; 360 unsigned rows;
308 int *keymap; 361 unsigned cols;
309 int irq; 362 bool rep;
310 unsigned int keymapsize;
311 unsigned int rep:1;
312}; 363};
313 364
314enum twl4030_usb_mode { 365enum twl4030_usb_mode {
@@ -320,6 +371,36 @@ struct twl4030_usb_data {
320 enum twl4030_usb_mode usb_mode; 371 enum twl4030_usb_mode usb_mode;
321}; 372};
322 373
374struct twl4030_ins {
375 u16 pmb_message;
376 u8 delay;
377};
378
379struct twl4030_script {
380 struct twl4030_ins *script;
381 unsigned size;
382 u8 flags;
383#define TWL4030_WRST_SCRIPT (1<<0)
384#define TWL4030_WAKEUP12_SCRIPT (1<<1)
385#define TWL4030_WAKEUP3_SCRIPT (1<<2)
386#define TWL4030_SLEEP_SCRIPT (1<<3)
387};
388
389struct twl4030_resconfig {
390 u8 resource;
391 u8 devgroup; /* Processor group that Power resource belongs to */
392 u8 type; /* Power resource addressed, 6 / broadcast message */
393 u8 type2; /* Power resource addressed, 3 / broadcast message */
394};
395
396struct twl4030_power_data {
397 struct twl4030_script **scripts;
398 unsigned num;
399 struct twl4030_resconfig *resource_config;
400};
401
402extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts);
403
323struct twl4030_platform_data { 404struct twl4030_platform_data {
324 unsigned irq_base, irq_end; 405 unsigned irq_base, irq_end;
325 struct twl4030_bci_platform_data *bci; 406 struct twl4030_bci_platform_data *bci;
@@ -327,6 +408,7 @@ struct twl4030_platform_data {
327 struct twl4030_madc_platform_data *madc; 408 struct twl4030_madc_platform_data *madc;
328 struct twl4030_keypad_data *keypad; 409 struct twl4030_keypad_data *keypad;
329 struct twl4030_usb_data *usb; 410 struct twl4030_usb_data *usb;
411 struct twl4030_power_data *power;
330 412
331 /* LDO regulators */ 413 /* LDO regulators */
332 struct regulator_init_data *vdac; 414 struct regulator_init_data *vdac;
@@ -357,7 +439,6 @@ int twl4030_sih_setup(int module);
357#define TWL4030_VAUX3_DEV_GRP 0x1F 439#define TWL4030_VAUX3_DEV_GRP 0x1F
358#define TWL4030_VAUX3_DEDICATED 0x22 440#define TWL4030_VAUX3_DEDICATED 0x22
359 441
360
361#if defined(CONFIG_TWL4030_BCI_BATTERY) || \ 442#if defined(CONFIG_TWL4030_BCI_BATTERY) || \
362 defined(CONFIG_TWL4030_BCI_BATTERY_MODULE) 443 defined(CONFIG_TWL4030_BCI_BATTERY_MODULE)
363 extern int twl4030charger_usb_en(int enable); 444 extern int twl4030charger_usb_en(int enable);