aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/i2c
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /include/linux/i2c
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'include/linux/i2c')
-rw-r--r--include/linux/i2c/adp5588.h1
-rw-r--r--include/linux/i2c/at24.h35
-rw-r--r--include/linux/i2c/atmel_mxt_ts.h16
-rw-r--r--include/linux/i2c/i2c-hid.h35
-rw-r--r--include/linux/i2c/i2c-rcar.h10
-rw-r--r--include/linux/i2c/i2c-sh_mobile.h1
-rw-r--r--include/linux/i2c/mms114.h24
-rw-r--r--include/linux/i2c/pca953x.h2
-rw-r--r--include/linux/i2c/pca954x.h1
-rw-r--r--include/linux/i2c/tc35876x.h11
-rw-r--r--include/linux/i2c/tsc2007.h2
-rw-r--r--include/linux/i2c/twl.h183
12 files changed, 140 insertions, 181 deletions
diff --git a/include/linux/i2c/adp5588.h b/include/linux/i2c/adp5588.h
index d8341cb47b6..cec17cf6cac 100644
--- a/include/linux/i2c/adp5588.h
+++ b/include/linux/i2c/adp5588.h
@@ -157,7 +157,6 @@ struct i2c_client; /* forward declaration */
157 157
158struct adp5588_gpio_platform_data { 158struct adp5588_gpio_platform_data {
159 int gpio_start; /* GPIO Chip base # */ 159 int gpio_start; /* GPIO Chip base # */
160 const char *const *names;
161 unsigned irq_base; /* interrupt base # */ 160 unsigned irq_base; /* interrupt base # */
162 unsigned pullup_dis_mask; /* Pull-Up Disable Mask */ 161 unsigned pullup_dis_mask; /* Pull-Up Disable Mask */
163 int (*setup)(struct i2c_client *client, 162 int (*setup)(struct i2c_client *client,
diff --git a/include/linux/i2c/at24.h b/include/linux/i2c/at24.h
index 285025a9cdc..8ace93024d6 100644
--- a/include/linux/i2c/at24.h
+++ b/include/linux/i2c/at24.h
@@ -1,42 +1,19 @@
1/*
2 * at24.h - platform_data for the at24 (generic eeprom) driver
3 * (C) Copyright 2008 by Pengutronix
4 * (C) Copyright 2012 by Wolfram Sang
5 * same license as the driver
6 */
7
8#ifndef _LINUX_AT24_H 1#ifndef _LINUX_AT24_H
9#define _LINUX_AT24_H 2#define _LINUX_AT24_H
10 3
11#include <linux/types.h> 4#include <linux/types.h>
12#include <linux/memory.h> 5#include <linux/memory.h>
13 6
14/** 7/*
15 * struct at24_platform_data - data to set up at24 (generic eeprom) driver 8 * As seen through Linux I2C, differences between the most common types of I2C
16 * @byte_len: size of eeprom in byte 9 * memory include:
17 * @page_size: number of byte which can be written in one go 10 * - How much memory is available (usually specified in bit)?
18 * @flags: tunable options, check AT24_FLAG_* defines 11 * - What write page size does it support?
19 * @setup: an optional callback invoked after eeprom is probed; enables kernel 12 * - Special flags (16 bit addresses, read_only, world readable...)?
20 code to access eeprom via memory_accessor, see example
21 * @context: optional parameter passed to setup()
22 * 13 *
23 * If you set up a custom eeprom type, please double-check the parameters. 14 * If you set up a custom eeprom type, please double-check the parameters.
24 * Especially page_size needs extra care, as you risk data loss if your value 15 * Especially page_size needs extra care, as you risk data loss if your value
25 * is bigger than what the chip actually supports! 16 * is bigger than what the chip actually supports!
26 *
27 * An example in pseudo code for a setup() callback:
28 *
29 * void get_mac_addr(struct memory_accessor *mem_acc, void *context)
30 * {
31 * u8 *mac_addr = ethernet_pdata->mac_addr;
32 * off_t offset = context;
33 *
34 * // Read MAC addr from EEPROM
35 * if (mem_acc->read(mem_acc, mac_addr, offset, ETH_ALEN) == ETH_ALEN)
36 * pr_info("Read MAC addr from EEPROM: %pM\n", mac_addr);
37 * }
38 *
39 * This function pointer and context can now be set up in at24_platform_data.
40 */ 17 */
41 18
42struct at24_platform_data { 19struct at24_platform_data {
diff --git a/include/linux/i2c/atmel_mxt_ts.h b/include/linux/i2c/atmel_mxt_ts.h
index f027f7a6351..29550c11f6d 100644
--- a/include/linux/i2c/atmel_mxt_ts.h
+++ b/include/linux/i2c/atmel_mxt_ts.h
@@ -2,6 +2,8 @@
2 * Atmel maXTouch Touchscreen driver 2 * Atmel maXTouch Touchscreen driver
3 * 3 *
4 * Copyright (C) 2010 Samsung Electronics Co.Ltd 4 * Copyright (C) 2010 Samsung Electronics Co.Ltd
5 * Copyright (C) 2011 Atmel Corporation
6 * Copyright (C) 2011 NVIDIA Corporation
5 * Author: Joonyoung Shim <jy0922.shim@samsung.com> 7 * Author: Joonyoung Shim <jy0922.shim@samsung.com>
6 * 8 *
7 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
@@ -15,6 +17,16 @@
15 17
16#include <linux/types.h> 18#include <linux/types.h>
17 19
20/*
21 * Atmel I2C addresses
22 */
23#define MXT224_I2C_ADDR1 0x4A
24#define MXT224_I2C_ADDR2 0x4B
25#define MXT1386_I2C_ADDR1 0x4C
26#define MXT1386_I2C_ADDR2 0x4D
27#define MXT1386_I2C_ADDR3 0x5A
28#define MXT1386_I2C_ADDR4 0x5B
29
18/* Orient */ 30/* Orient */
19#define MXT_NORMAL 0x0 31#define MXT_NORMAL 0x0
20#define MXT_DIAGONAL 0x1 32#define MXT_DIAGONAL 0x1
@@ -39,6 +51,10 @@ struct mxt_platform_data {
39 unsigned int voltage; 51 unsigned int voltage;
40 unsigned char orient; 52 unsigned char orient;
41 unsigned long irqflags; 53 unsigned long irqflags;
54 u8(*read_chg) (void);
55 unsigned long config_crc;
56 unsigned int actv_cycle_time;
57 unsigned int idle_cycle_time;
42}; 58};
43 59
44#endif /* __LINUX_ATMEL_MXT_TS_H */ 60#endif /* __LINUX_ATMEL_MXT_TS_H */
diff --git a/include/linux/i2c/i2c-hid.h b/include/linux/i2c/i2c-hid.h
deleted file mode 100644
index 60e411d764d..00000000000
--- a/include/linux/i2c/i2c-hid.h
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * HID over I2C protocol implementation
3 *
4 * Copyright (c) 2012 Benjamin Tissoires <benjamin.tissoires@gmail.com>
5 * Copyright (c) 2012 Ecole Nationale de l'Aviation Civile, France
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file COPYING in the main directory of this archive for
9 * more details.
10 */
11
12#ifndef __LINUX_I2C_HID_H
13#define __LINUX_I2C_HID_H
14
15#include <linux/types.h>
16
17/**
18 * struct i2chid_platform_data - used by hid over i2c implementation.
19 * @hid_descriptor_address: i2c register where the HID descriptor is stored.
20 *
21 * Note that it is the responsibility of the platform driver (or the acpi 5.0
22 * driver) to setup the irq related to the gpio in the struct i2c_board_info.
23 * The platform driver should also setup the gpio according to the device:
24 *
25 * A typical example is the following:
26 * irq = gpio_to_irq(intr_gpio);
27 * hkdk4412_i2c_devs5[0].irq = irq; // store the irq in i2c_board_info
28 * gpio_request(intr_gpio, "elan-irq");
29 * s3c_gpio_setpull(intr_gpio, S3C_GPIO_PULL_UP);
30 */
31struct i2c_hid_platform_data {
32 u16 hid_descriptor_address;
33};
34
35#endif /* __LINUX_I2C_HID_H */
diff --git a/include/linux/i2c/i2c-rcar.h b/include/linux/i2c/i2c-rcar.h
deleted file mode 100644
index 496f5c2b23c..00000000000
--- a/include/linux/i2c/i2c-rcar.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef __I2C_R_CAR_H__
2#define __I2C_R_CAR_H__
3
4#include <linux/platform_device.h>
5
6struct i2c_rcar_platform_data {
7 u32 bus_speed;
8};
9
10#endif /* __I2C_R_CAR_H__ */
diff --git a/include/linux/i2c/i2c-sh_mobile.h b/include/linux/i2c/i2c-sh_mobile.h
index 06e3089795f..beda7081aea 100644
--- a/include/linux/i2c/i2c-sh_mobile.h
+++ b/include/linux/i2c/i2c-sh_mobile.h
@@ -5,7 +5,6 @@
5 5
6struct i2c_sh_mobile_platform_data { 6struct i2c_sh_mobile_platform_data {
7 unsigned long bus_speed; 7 unsigned long bus_speed;
8 unsigned int clks_per_count;
9}; 8};
10 9
11#endif /* __I2C_SH_MOBILE_H__ */ 10#endif /* __I2C_SH_MOBILE_H__ */
diff --git a/include/linux/i2c/mms114.h b/include/linux/i2c/mms114.h
deleted file mode 100644
index 5722ebfb273..00000000000
--- a/include/linux/i2c/mms114.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * Copyright (C) 2012 Samsung Electronics Co.Ltd
3 * Author: Joonyoung Shim <jy0922.shim@samsung.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundationr
8 */
9
10#ifndef __LINUX_MMS114_H
11#define __LINUX_MMS114_H
12
13struct mms114_platform_data {
14 unsigned int x_size;
15 unsigned int y_size;
16 unsigned int contact_threshold;
17 unsigned int moving_threshold;
18 bool x_invert;
19 bool y_invert;
20
21 void (*cfg_pin)(bool);
22};
23
24#endif /* __LINUX_MMS114_H */
diff --git a/include/linux/i2c/pca953x.h b/include/linux/i2c/pca953x.h
index 3c98dd4f901..139ba52667c 100644
--- a/include/linux/i2c/pca953x.h
+++ b/include/linux/i2c/pca953x.h
@@ -11,7 +11,7 @@ struct pca953x_platform_data {
11 unsigned gpio_base; 11 unsigned gpio_base;
12 12
13 /* initial polarity inversion setting */ 13 /* initial polarity inversion setting */
14 u32 invert; 14 uint16_t invert;
15 15
16 /* interrupt base */ 16 /* interrupt base */
17 int irq_base; 17 int irq_base;
diff --git a/include/linux/i2c/pca954x.h b/include/linux/i2c/pca954x.h
index 1712677d590..28f1f8d5ab1 100644
--- a/include/linux/i2c/pca954x.h
+++ b/include/linux/i2c/pca954x.h
@@ -36,7 +36,6 @@
36struct pca954x_platform_mode { 36struct pca954x_platform_mode {
37 int adap_id; 37 int adap_id;
38 unsigned int deselect_on_exit:1; 38 unsigned int deselect_on_exit:1;
39 unsigned int class;
40}; 39};
41 40
42/* Per mux/switch data, used with i2c_register_board_info */ 41/* Per mux/switch data, used with i2c_register_board_info */
diff --git a/include/linux/i2c/tc35876x.h b/include/linux/i2c/tc35876x.h
deleted file mode 100644
index cd6a51c71e7..00000000000
--- a/include/linux/i2c/tc35876x.h
+++ /dev/null
@@ -1,11 +0,0 @@
1
2#ifndef _TC35876X_H
3#define _TC35876X_H
4
5struct tc35876x_platform_data {
6 int gpio_bridge_reset;
7 int gpio_panel_bl_en;
8 int gpio_panel_vadd;
9};
10
11#endif /* _TC35876X_H */
diff --git a/include/linux/i2c/tsc2007.h b/include/linux/i2c/tsc2007.h
index 506a9f7af51..591427a63b0 100644
--- a/include/linux/i2c/tsc2007.h
+++ b/include/linux/i2c/tsc2007.h
@@ -5,7 +5,7 @@
5 5
6struct tsc2007_platform_data { 6struct tsc2007_platform_data {
7 u16 model; /* 2007. */ 7 u16 model; /* 2007. */
8 u16 x_plate_ohms; /* must be non-zero value */ 8 u16 x_plate_ohms;
9 u16 max_rt; /* max. resistance above which samples are ignored */ 9 u16 max_rt; /* max. resistance above which samples are ignored */
10 unsigned long poll_delay; /* delay (in ms) after pen-down event 10 unsigned long poll_delay; /* delay (in ms) after pen-down event
11 before polling starts */ 11 before polling starts */
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 1ff54b114ef..bb92f0b1328 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -39,51 +39,56 @@
39 * address each module uses within a given i2c slave. 39 * address each module uses within a given i2c slave.
40 */ 40 */
41 41
42enum twl4030_module_ids { 42/* Slave 0 (i2c address 0x48) */
43 TWL4030_MODULE_USB = 0, /* Slave 0 (i2c address 0x48) */ 43#define TWL4030_MODULE_USB 0x00
44 TWL4030_MODULE_AUDIO_VOICE, /* Slave 1 (i2c address 0x49) */ 44
45 TWL4030_MODULE_GPIO, 45/* Slave 1 (i2c address 0x49) */
46 TWL4030_MODULE_INTBR, 46#define TWL4030_MODULE_AUDIO_VOICE 0x01
47 TWL4030_MODULE_PIH, 47#define TWL4030_MODULE_GPIO 0x02
48 48#define TWL4030_MODULE_INTBR 0x03
49 TWL4030_MODULE_TEST, 49#define TWL4030_MODULE_PIH 0x04
50 TWL4030_MODULE_KEYPAD, /* Slave 2 (i2c address 0x4a) */ 50#define TWL4030_MODULE_TEST 0x05
51 TWL4030_MODULE_MADC, 51
52 TWL4030_MODULE_INTERRUPTS, 52/* Slave 2 (i2c address 0x4a) */
53 TWL4030_MODULE_LED, 53#define TWL4030_MODULE_KEYPAD 0x06
54 54#define TWL4030_MODULE_MADC 0x07
55 TWL4030_MODULE_MAIN_CHARGE, 55#define TWL4030_MODULE_INTERRUPTS 0x08
56 TWL4030_MODULE_PRECHARGE, 56#define TWL4030_MODULE_LED 0x09
57 TWL4030_MODULE_PWM0, 57#define TWL4030_MODULE_MAIN_CHARGE 0x0A
58 TWL4030_MODULE_PWM1, 58#define TWL4030_MODULE_PRECHARGE 0x0B
59 TWL4030_MODULE_PWMA, 59#define TWL4030_MODULE_PWM0 0x0C
60 60#define TWL4030_MODULE_PWM1 0x0D
61 TWL4030_MODULE_PWMB, 61#define TWL4030_MODULE_PWMA 0x0E
62 TWL5031_MODULE_ACCESSORY, 62#define TWL4030_MODULE_PWMB 0x0F
63 TWL5031_MODULE_INTERRUPTS, 63
64 TWL4030_MODULE_BACKUP, /* Slave 3 (i2c address 0x4b) */ 64#define TWL5031_MODULE_ACCESSORY 0x10
65 TWL4030_MODULE_INT, 65#define TWL5031_MODULE_INTERRUPTS 0x11
66 66
67 TWL4030_MODULE_PM_MASTER, 67/* Slave 3 (i2c address 0x4b) */
68 TWL4030_MODULE_PM_RECEIVER, 68#define TWL4030_MODULE_BACKUP 0x12
69 TWL4030_MODULE_RTC, 69#define TWL4030_MODULE_INT 0x13
70 TWL4030_MODULE_SECURED_REG, 70#define TWL4030_MODULE_PM_MASTER 0x14
71 TWL4030_MODULE_LAST, 71#define TWL4030_MODULE_PM_RECEIVER 0x15
72}; 72#define TWL4030_MODULE_RTC 0x16
73#define TWL4030_MODULE_SECURED_REG 0x17
73 74
74/* Similar functionalities implemented in TWL4030/6030 */
75#define TWL_MODULE_USB TWL4030_MODULE_USB 75#define TWL_MODULE_USB TWL4030_MODULE_USB
76#define TWL_MODULE_AUDIO_VOICE TWL4030_MODULE_AUDIO_VOICE
76#define TWL_MODULE_PIH TWL4030_MODULE_PIH 77#define TWL_MODULE_PIH TWL4030_MODULE_PIH
78#define TWL_MODULE_MADC TWL4030_MODULE_MADC
77#define TWL_MODULE_MAIN_CHARGE TWL4030_MODULE_MAIN_CHARGE 79#define TWL_MODULE_MAIN_CHARGE TWL4030_MODULE_MAIN_CHARGE
78#define TWL_MODULE_PM_MASTER TWL4030_MODULE_PM_MASTER 80#define TWL_MODULE_PM_MASTER TWL4030_MODULE_PM_MASTER
79#define TWL_MODULE_PM_RECEIVER TWL4030_MODULE_PM_RECEIVER 81#define TWL_MODULE_PM_RECEIVER TWL4030_MODULE_PM_RECEIVER
80#define TWL_MODULE_RTC TWL4030_MODULE_RTC 82#define TWL_MODULE_RTC TWL4030_MODULE_RTC
81#define TWL_MODULE_PWM TWL4030_MODULE_PWM0 83#define TWL_MODULE_PWM TWL4030_MODULE_PWM0
82#define TWL_MODULE_LED TWL4030_MODULE_LED
83 84
84#define TWL6030_MODULE_ID0 13 85#define TWL6030_MODULE_CHARGER TWL4030_MODULE_MAIN_CHARGE
85#define TWL6030_MODULE_ID1 14 86#define TWL6025_MODULE_CHARGER 0x18
86#define TWL6030_MODULE_ID2 15 87
88#define TWL6030_MODULE_GASGAUGE 0x0B
89#define TWL6030_MODULE_ID0 0x0D
90#define TWL6030_MODULE_ID1 0x0E
91#define TWL6030_MODULE_ID2 0x0F
87 92
88#define GPIO_INTR_OFFSET 0 93#define GPIO_INTR_OFFSET 0
89#define KEYPAD_INTR_OFFSET 1 94#define KEYPAD_INTR_OFFSET 1
@@ -107,6 +112,7 @@ enum twl4030_module_ids {
107#define GASGAUGE_INTR_OFFSET 17 112#define GASGAUGE_INTR_OFFSET 17
108#define USBOTG_INTR_OFFSET 4 113#define USBOTG_INTR_OFFSET 4
109#define CHARGER_INTR_OFFSET 2 114#define CHARGER_INTR_OFFSET 2
115#define GPADCSW_INTR_OFFSET 1
110#define RSV_INTR_OFFSET 0 116#define RSV_INTR_OFFSET 0
111 117
112/* INT register offsets */ 118/* INT register offsets */
@@ -170,12 +176,24 @@ static inline int twl_class_is_ ##class(void) \
170TWL_CLASS_IS(4030, TWL4030_CLASS_ID) 176TWL_CLASS_IS(4030, TWL4030_CLASS_ID)
171TWL_CLASS_IS(6030, TWL6030_CLASS_ID) 177TWL_CLASS_IS(6030, TWL6030_CLASS_ID)
172 178
179#define TWL6025_SUBCLASS BIT(4) /* TWL6025 has changed registers */
180#define MPU80031_SUBCLASS BIT(5) /* MPU80031 has changed registers */
181
182/* So we can recover the features in other parts of twl stack */
183unsigned int twl_features(void);
184
185/* so we can get at the EPROM SMPS OFFSET/MULT stuff */
186u8 twl_get_smps_offset(void);
187u8 twl_get_smps_mult(void);
188
173/* 189/*
174 * Read and write single 8-bit registers 190 * Read and write single 8-bit registers
175 */ 191 */
176int twl_i2c_write_u8(u8 mod_no, u8 val, u8 reg); 192int twl_i2c_write_u8(u8 mod_no, u8 val, u8 reg);
177int twl_i2c_read_u8(u8 mod_no, u8 *val, u8 reg); 193int twl_i2c_read_u8(u8 mod_no, u8 *val, u8 reg);
178 194
195void twl_reg_dump(int module, int start, int end);
196
179/* 197/*
180 * Read and write several 8-bit registers at once. 198 * Read and write several 8-bit registers at once.
181 * 199 *
@@ -187,7 +205,6 @@ int twl_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
187 205
188int twl_get_type(void); 206int twl_get_type(void);
189int twl_get_version(void); 207int twl_get_version(void);
190int twl_get_hfclk_rate(void);
191 208
192int twl6030_interrupt_unmask(u8 bit_mask, u8 offset); 209int twl6030_interrupt_unmask(u8 bit_mask, u8 offset);
193int twl6030_interrupt_mask(u8 bit_mask, u8 offset); 210int twl6030_interrupt_mask(u8 bit_mask, u8 offset);
@@ -213,6 +230,10 @@ static inline int twl6030_mmc_card_detect(struct device *dev, int slot)
213 return -EIO; 230 return -EIO;
214} 231}
215#endif 232#endif
233
234int twl6030_set_usb_charge_enable(int enable);
235int twl6030_set_usb_in_current(int currentmA);
236
216/*----------------------------------------------------------------------*/ 237/*----------------------------------------------------------------------*/
217 238
218/* 239/*
@@ -550,17 +571,34 @@ static inline int twl6030_mmc_card_detect(struct device *dev, int slot)
550 571
551struct twl4030_clock_init_data { 572struct twl4030_clock_init_data {
552 bool ck32k_lowpwr_enable; 573 bool ck32k_lowpwr_enable;
574 bool clk32_active_state_on;
553}; 575};
554 576
555struct twl4030_bci_platform_data { 577struct twl4030_bci_platform_data {
556 int *battery_tmp_tbl; 578 int *battery_tmp_tbl;
557 unsigned int tblsize; 579 unsigned int battery_tmp_tblsize;
558 int bb_uvolt; /* voltage to charge backup battery */ 580 int *battery_volt_tbl;
559 int bb_uamp; /* current for backup battery charging */ 581 unsigned int battery_volt_tblsize;
582 unsigned int monitoring_interval;
583
584 unsigned int max_charger_currentmA;
585 unsigned int max_charger_voltagemV;
586 unsigned int termination_currentmA;
587
588 unsigned int max_bat_voltagemV;
589 unsigned int low_bat_voltagemV;
590
591 /* twl6025 */
592 unsigned int use_hw_charger;
593 unsigned int use_eeprom_config;
594 unsigned int power_path;
560}; 595};
561 596
562/* TWL4030_GPIO_MAX (18) GPIOs, with interrupts */ 597/* TWL4030_GPIO_MAX (18) GPIOs, with interrupts */
563struct twl4030_gpio_platform_data { 598struct twl4030_gpio_platform_data {
599 int gpio_base;
600 unsigned irq_base, irq_end;
601
564 /* package the two LED signals as output-only GPIOs? */ 602 /* package the two LED signals as output-only GPIOs? */
565 bool use_leds; 603 bool use_leds;
566 604
@@ -618,6 +656,7 @@ struct twl4030_usb_data {
618 int (*phy_set_clock)(struct device *dev, int on); 656 int (*phy_set_clock)(struct device *dev, int on);
619 /* suspend/resume of phy */ 657 /* suspend/resume of phy */
620 int (*phy_suspend)(struct device *dev, int suspend); 658 int (*phy_suspend)(struct device *dev, int suspend);
659 int (*board_control_power)(struct device *dev, int on);
621}; 660};
622 661
623struct twl4030_ins { 662struct twl4030_ins {
@@ -649,12 +688,10 @@ struct twl4030_power_data {
649 unsigned num; 688 unsigned num;
650 struct twl4030_resconfig *resource_config; 689 struct twl4030_resconfig *resource_config;
651#define TWL4030_RESCONFIG_UNDEF ((u8)-1) 690#define TWL4030_RESCONFIG_UNDEF ((u8)-1)
652 bool use_poweroff; /* Board is wired for TWL poweroff */
653}; 691};
654 692
655extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts); 693extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts);
656extern int twl4030_remove_script(u8 flags); 694extern int twl4030_remove_script(u8 flags);
657extern void twl4030_power_off(void);
658 695
659struct twl4030_codec_data { 696struct twl4030_codec_data {
660 unsigned int digimic_delay; /* in ms */ 697 unsigned int digimic_delay; /* in ms */
@@ -663,11 +700,23 @@ struct twl4030_codec_data {
663 unsigned int check_defaults:1; 700 unsigned int check_defaults:1;
664 unsigned int reset_registers:1; 701 unsigned int reset_registers:1;
665 unsigned int hs_extmute:1; 702 unsigned int hs_extmute:1;
666 int hs_extmute_gpio; 703 u16 hs_left_step;
704 u16 hs_right_step;
705 u16 hf_left_step;
706 u16 hf_right_step;
707 void (*set_hs_extmute)(int mute);
667}; 708};
668 709
669struct twl4030_vibra_data { 710struct twl4030_vibra_data {
670 unsigned int coexist; 711 unsigned int coexist;
712
713 /* twl6040 */
714 unsigned int vibldrv_res; /* left driver resistance */
715 unsigned int vibrdrv_res; /* right driver resistance */
716 unsigned int viblmotor_res; /* left motor resistance */
717 unsigned int vibrmotor_res; /* right motor resistance */
718 int vddvibl_uV; /* VDDVIBL volt, set 0 for fixed reg */
719 int vddvibr_uV; /* VDDVIBR volt, set 0 for fixed reg */
671}; 720};
672 721
673struct twl4030_audio_data { 722struct twl4030_audio_data {
@@ -682,6 +731,11 @@ struct twl4030_audio_data {
682}; 731};
683 732
684struct twl4030_platform_data { 733struct twl4030_platform_data {
734 unsigned irq_base, irq_end;
735
736 /* Callback for boar regulator initialisation */
737 int (*init)(void);
738
685 struct twl4030_clock_init_data *clock; 739 struct twl4030_clock_init_data *clock;
686 struct twl4030_bci_platform_data *bci; 740 struct twl4030_bci_platform_data *bci;
687 struct twl4030_gpio_platform_data *gpio; 741 struct twl4030_gpio_platform_data *gpio;
@@ -696,9 +750,6 @@ struct twl4030_platform_data {
696 struct regulator_init_data *vaux1; 750 struct regulator_init_data *vaux1;
697 struct regulator_init_data *vaux2; 751 struct regulator_init_data *vaux2;
698 struct regulator_init_data *vaux3; 752 struct regulator_init_data *vaux3;
699 struct regulator_init_data *vdd1;
700 struct regulator_init_data *vdd2;
701 struct regulator_init_data *vdd3;
702 /* TWL4030 LDO regulators */ 753 /* TWL4030 LDO regulators */
703 struct regulator_init_data *vpll1; 754 struct regulator_init_data *vpll1;
704 struct regulator_init_data *vpll2; 755 struct regulator_init_data *vpll2;
@@ -707,6 +758,8 @@ struct twl4030_platform_data {
707 struct regulator_init_data *vsim; 758 struct regulator_init_data *vsim;
708 struct regulator_init_data *vaux4; 759 struct regulator_init_data *vaux4;
709 struct regulator_init_data *vio; 760 struct regulator_init_data *vio;
761 struct regulator_init_data *vdd1;
762 struct regulator_init_data *vdd2;
710 struct regulator_init_data *vintana1; 763 struct regulator_init_data *vintana1;
711 struct regulator_init_data *vintana2; 764 struct regulator_init_data *vintana2;
712 struct regulator_init_data *vintdig; 765 struct regulator_init_data *vintdig;
@@ -718,8 +771,6 @@ struct twl4030_platform_data {
718 struct regulator_init_data *vcxio; 771 struct regulator_init_data *vcxio;
719 struct regulator_init_data *vusb; 772 struct regulator_init_data *vusb;
720 struct regulator_init_data *clk32kg; 773 struct regulator_init_data *clk32kg;
721 struct regulator_init_data *v1v8;
722 struct regulator_init_data *v2v1;
723 /* TWL6025 LDO regulators */ 774 /* TWL6025 LDO regulators */
724 struct regulator_init_data *ldo1; 775 struct regulator_init_data *ldo1;
725 struct regulator_init_data *ldo2; 776 struct regulator_init_data *ldo2;
@@ -736,27 +787,9 @@ struct twl4030_platform_data {
736 struct regulator_init_data *vio6025; 787 struct regulator_init_data *vio6025;
737}; 788};
738 789
739struct twl_regulator_driver_data {
740 int (*set_voltage)(void *data, int target_uV);
741 int (*get_voltage)(void *data);
742 void *data;
743 unsigned long features;
744};
745/* chip-specific feature flags, for twl_regulator_driver_data.features */
746#define TWL4030_VAUX2 BIT(0) /* pre-5030 voltage ranges */
747#define TPS_SUBSET BIT(1) /* tps659[23]0 have fewer LDOs */
748#define TWL5031 BIT(2) /* twl5031 has different registers */
749#define TWL6030_CLASS BIT(3) /* TWL6030 class */
750#define TWL6025_SUBCLASS BIT(4) /* TWL6025 has changed registers */
751#define TWL4030_ALLOW_UNSUPPORTED BIT(5) /* Some voltages are possible
752 * but not officially supported.
753 * This flag is necessary to
754 * enable them.
755 */
756
757/*----------------------------------------------------------------------*/ 790/*----------------------------------------------------------------------*/
758 791
759int twl4030_sih_setup(struct device *dev, int module, int irq_base); 792int twl4030_sih_setup(int module);
760 793
761/* Offsets to Power Registers */ 794/* Offsets to Power Registers */
762#define TWL4030_VDAC_DEV_GRP 0x3B 795#define TWL4030_VDAC_DEV_GRP 0x3B
@@ -829,6 +862,22 @@ static inline int twl4030charger_usb_en(int enable) { return 0; }
829#define TWL6030_REG_VDAC 45 862#define TWL6030_REG_VDAC 45
830#define TWL6030_REG_VUSB 46 863#define TWL6030_REG_VUSB 46
831 864
865/* These are renamed in 6025 but same registers */
866#define TWL6025_REG_LDO2 48
867#define TWL6025_REG_LDO4 49
868#define TWL6025_REG_LDO3 50
869#define TWL6025_REG_LDO5 51
870#define TWL6025_REG_LDO1 52
871#define TWL6025_REG_LDO7 53
872#define TWL6025_REG_LDO6 54
873#define TWL6025_REG_LDOLN 55
874#define TWL6025_REG_LDOUSB 56
875
876/* 6025 DCDC supplies */
877#define TWL6025_REG_SMPS3 57
878#define TWL6025_REG_SMPS4 58
879#define TWL6025_REG_VIO 59
880
832/* INTERNAL LDOs */ 881/* INTERNAL LDOs */
833#define TWL6030_REG_VRTC 47 882#define TWL6030_REG_VRTC 47
834#define TWL6030_REG_CLK32KG 48 883#define TWL6030_REG_CLK32KG 48