diff options
author | Ricardo Perez Olivares <x0081762@ti.com> | 2010-05-31 15:26:50 -0500 |
---|---|---|
committer | Ricardo Perez Olivares <x0081762@ti.com> | 2010-05-31 15:26:50 -0500 |
commit | e65243e725a5c3e87e651cd733ff349f0cc8e498 (patch) | |
tree | 1e3d62e9dc0fcc129d9b344af85e4e02859c9b98 /include | |
parent | 86f15a417f3ebb5ba48ed95a48fe99900d1d6154 (diff) | |
parent | 082c58f7f82ef5e64522875c0f5e08f27429e5af (diff) |
Merge branch 'omap4_next' of git://dev.omapzoom.org/pub/scm/santosh/kernel-omap4-base into L24x7
Conflicts:
arch/arm/mach-omap2/board-4430sdp.c
Signed-off-by: Ricardo Perez Olivares <x0081762@ti.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/i2c/bq2415x.h | 40 | ||||
-rw-r--r-- | include/linux/i2c/twl.h | 18 | ||||
-rw-r--r-- | include/linux/i2c/twl6030-gpadc.h | 109 |
3 files changed, 167 insertions, 0 deletions
diff --git a/include/linux/i2c/bq2415x.h b/include/linux/i2c/bq2415x.h new file mode 100644 index 000000000000..55b1b4217925 --- /dev/null +++ b/include/linux/i2c/bq2415x.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2010 Texas Instruments + * Author: Balaji T K + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _LINUX_BQ2415X_I2C_H +#define _LINUX_BQ2415X_I2C_H + +#define BQ2415x_START_CHARGING (1 << 0) +#define BQ2415x_STOP_CHARGING (1 << 1) +#define BQ2415x_CHARGER_FAULT (1 << 2) + +#define BQ2415x_CHARGE_DONE 0x20 +#define BQ2415x_FAULT_VBUS_OVP 0x31 +#define BQ2415x_FAULT_SLEEP 0x32 +#define BQ2415x_FAULT_BAD_ADAPTOR 0x33 +#define BQ2415x_FAULT_BAT_OVP 0x34 +#define BQ2415x_FAULT_THERMAL_SHUTDOWN 0x35 +#define BQ2415x_FAULT_TIMER 0x36 +#define BQ2415x_FAULT_NO_BATTERY 0x37 + +struct bq2415x_platform_data { + int max_charger_currentmA; + int max_charger_voltagemA; + int termination_currentmA; +}; + +#endif diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h index 7722428b3155..e687b302c890 100644 --- a/include/linux/i2c/twl.h +++ b/include/linux/i2c/twl.h @@ -81,7 +81,9 @@ #define TWL_MODULE_PM_RECEIVER TWL4030_MODULE_PM_RECEIVER #define TWL_MODULE_RTC TWL4030_MODULE_RTC #define TWL_MODULE_PWM TWL4030_MODULE_PWM0 +#define TWL6030_MODULE_CHARGER TWL4030_MODULE_MAIN_CHARGE +#define TWL6030_MODULE_GASGAUGE 0x0B #define TWL6030_MODULE_ID0 0x0D #define TWL6030_MODULE_ID1 0x0E #define TWL6030_MODULE_ID2 0x0F @@ -91,6 +93,7 @@ #define BCI_INTR_OFFSET 2 #define MADC_INTR_OFFSET 3 #define USB_INTR_OFFSET 4 +#define CHARGERFAULT_INTR_OFFSET 5 #define BCI_PRES_INTR_OFFSET 9 #define USB_PRES_INTR_OFFSET 10 #define RTC_INTR_OFFSET 11 @@ -107,6 +110,7 @@ #define GASGAUGE_INTR_OFFSET 17 #define USBOTG_INTR_OFFSET 4 #define CHARGER_INTR_OFFSET 2 +#define GPADCSW_INTR_OFFSET 1 #define RSV_INTR_OFFSET 0 /* INT register offsets */ @@ -182,6 +186,11 @@ int twl_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes); int twl6030_interrupt_unmask(u8 bit_mask, u8 offset); int twl6030_interrupt_mask(u8 bit_mask, u8 offset); +int twl6030_register_notifier(struct notifier_block *nb, + unsigned int events); +int twl6030_unregister_notifier(struct notifier_block *nb, + unsigned int events); + /* MMC1 Controller on OMAP4 uses Phoenix Irq for Card detect */ int twl6030_mmc_card_detect(int host_id, int slot); @@ -509,6 +518,15 @@ struct twl4030_clock_init_data { struct twl4030_bci_platform_data { int *battery_tmp_tbl; unsigned int tblsize; + + unsigned int monitoring_interval; + + unsigned int max_charger_currentmA; + unsigned int max_charger_voltagemV; + unsigned int termination_currentmA; + + unsigned int max_bat_voltagemV; + unsigned int low_bat_voltagemV; }; /* TWL4030_GPIO_MAX (18) GPIOs, with interrupts */ diff --git a/include/linux/i2c/twl6030-gpadc.h b/include/linux/i2c/twl6030-gpadc.h new file mode 100644 index 000000000000..0f94d476666f --- /dev/null +++ b/include/linux/i2c/twl6030-gpadc.h @@ -0,0 +1,109 @@ +/* + * include/linux/i2c/twl6030-gpadc.h + * + * TWL6030 GPADC module driver header + * + * Copyright (C) 2009 Texas Instruments Inc. + * Nishant Kamat <nskamat@ti.com> + * + * Based on twl4030-madc.h + * Copyright (C) 2008 Nokia Corporation + * Mikko Ylinen <mikko.k.ylinen@nokia.com> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#ifndef _TWL6030_GPADC_H +#define _TWL6030_GPADC_H + +struct twl6030_gpadc_conversion_method { + u8 sel; + u8 rbase; + u8 ctrl; + u8 enable; +}; + +#define TWL6030_GPADC_MAX_CHANNELS 17 + +struct twl6030_gpadc_request { + u16 channels; + u16 do_avg; + u16 method; + u16 type; + int active; + int result_pending; + int rbuf[TWL6030_GPADC_MAX_CHANNELS]; + void (*func_cb)(int len, int channels, int *buf); +}; + +enum conversion_methods { + TWL6030_GPADC_RT, + TWL6030_GPADC_SW2, + TWL6030_GPADC_NUM_METHODS +}; + +enum sample_type { + TWL6030_GPADC_WAIT, + TWL6030_GPADC_IRQ_ONESHOT, + TWL6030_GPADC_IRQ_REARM +}; + +#define TWL6030_GPADC_CTRL 0x00 /* 0x2e */ + +#define TWL6030_GPADC_RTSELECT_LSB 0x02 /* 0x30 */ +#define TWL6030_GPADC_RTSELECT_ISB 0x03 +#define TWL6030_GPADC_RTSELECT_MSB 0x04 + +#define TWL6030_GPADC_CTRL_P1 0x05 +#define TWL6030_GPADC_CTRL_P2 0x06 +#define TWL6030_GPADC_CTRL_P1_SP1 (1 << 3) +#define TWL6030_GPADC_CTRL_P1_EOCRT (1 << 2) +#define TWL6030_GPADC_CTRL_P1_EOCP1 (1 << 1) +#define TWL6030_GPADC_CTRL_P1_BUSY (1 << 0) + +#define TWL6030_GPADC_CTRL_P2_SP2 (1 << 2) +#define TWL6030_GPADC_CTRL_P2_EOCP2 (1 << 1) +#define TWL6030_GPADC_CTRL_P1_BUSY (1 << 0) + +#define TWL6030_GPADC_EOC_SW (1 << 1) +#define TWL6030_GPADC_BUSY (1 << 0) + +#define TWL6030_GPADC_RTCH0_LSB (0x07) +#define TWL6030_GPADC_GPCH0_LSB (0x29) + +/* Fixed channels */ +#define TWL6030_GPADC_CTRL_TEMP1_EN (1 << 0) /* input ch 1 */ +#define TWL6030_GPADC_CTRL_TEMP2_EN (1 << 1) /* input ch 4 */ +#define TWL6030_GPADC_CTRL_SCALER_EN (1 << 2) /* input ch 2 */ +#define TWL6030_GPADC_CTRL_SCALER_DIV4 (1 << 3) +#define TWL6030_GPADC_CTRL_SCALER_EN_CH11 (1 << 4) /* input ch 11 */ +#define TWL6030_GPADC_CTRL_TEMP1_EN_MONITOR (1 << 5) +#define TWL6030_GPADC_CTRL_TEMP2_EN_MONITOR (1 << 6) +#define TWL6030_GPADC_CTRL_ISOURCE_EN (1 << 7) + + +#define TWL6030_GPADC_IOC_MAGIC '`' +#define TWL6030_GPADC_IOCX_ADC_RAW_READ _IO(TWL6030_GPADC_IOC_MAGIC, 0) + +struct twl6030_gpadc_user_parms { + int channel; + int status; + u16 result; +}; + +int twl6030_gpadc_conversion(struct twl6030_gpadc_request *conv); + +#endif |