rk30:phone:modify the config file and add battery function

This commit is contained in:
张晴
2012-05-07 16:17:52 +08:00
parent d2face3ace
commit 7fdb181c23
8 changed files with 3279 additions and 2 deletions

View File

@@ -39,8 +39,8 @@ obj-$(CONFIG_TPS6507X) += tps6507x.o
obj-$(CONFIG_MENELAUS) += menelaus.o
obj-$(CONFIG_TWL4030_CORE) += twl-core.o twl4030-irq.o twl6030-irq.o
#obj-$(CONFIG_TWL4030_MADC) += twl4030-madc.o
obj-$(CONFIG_TWL4030_MADC) += twl6030-madc.o
obj-$(CONFIG_TWL4030_MADC) += twl4030-madc.o
obj-$(CONFIG_TWL6030_MADC) += twl6030-madc.o
obj-$(CONFIG_TWL4030_POWER) += twl4030-power.o
obj-$(CONFIG_TWL4030_CODEC) += twl4030-codec.o
obj-$(CONFIG_TWL6030_PWM) += twl6030-pwm.o

View File

@@ -282,6 +282,13 @@ config CHARGER_TWL4030
help
Say Y here to enable support for TWL4030 Battery Charge Interface.
config TWL6030_BCI_BATTERY
tristate "OMAP TWL6030 BCI Battery driver"
depends on TWL4030_CORE && TWL6030_GPADC
help
Support for OMAP TWL6030 BCI Battery driver.
This driver can give support for TWL6030 Battery Charge Interface.
config CHARGER_GPIO
tristate "GPIO charger"
depends on GPIOLIB

View File

@@ -41,6 +41,7 @@ obj-$(CONFIG_CHARGER_ISP1704) += isp1704_charger.o
obj-$(CONFIG_CHARGER_MAX8903) += max8903_charger.o
obj-$(CONFIG_CHARGER_TWL4030) += twl4030_charger.o
obj-$(CONFIG_CHARGER_GPIO) += gpio-charger.o
obj-$(CONFIG_TWL6030_BCI_BATTERY) += twl6030_bci_battery.o
obj-$(CONFIG_BATTERY_RK29_ADC) += rk29_adc_battery.o
obj-$(CONFIG_BATTERY_RK30_ADC) += rk30_adc_battery.o
obj-$(CONFIG_POWER_ON_CHARGER_DISPLAY) += rk29_charger_display.o

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,81 @@
/*
* 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
/* not a bq generated event,we use this to reset the
* the timer from the twl driver.
*/
#define BQ2415x_RESET_TIMER 0x38
/* BQ24153 / BQ24156 / BQ24158 */
/* Status/Control Register */
#define REG_STATUS_CONTROL 0x00
#define TIMER_RST (1 << 7)
#define ENABLE_STAT_PIN (1 << 6)
/* Control Register */
#define REG_CONTROL_REGISTER 0x01
#define INPUT_CURRENT_LIMIT_SHIFT 6
#define ENABLE_ITERM_SHIFT 3
/* Control/Battery Voltage Register */
#define REG_BATTERY_VOLTAGE 0x02
#define VOLTAGE_SHIFT 2
/* Vender/Part/Revision Register */
#define REG_PART_REVISION 0x03
/* Battery Termination/Fast Charge Current Register */
#define REG_BATTERY_CURRENT 0x04
#define BQ24156_CURRENT_SHIFT 3
#define BQ24153_CURRENT_SHIFT 4
/* Special Charger Voltage/Enable Pin Status Register */
#define REG_SPECIAL_CHARGER_VOLTAGE 0x05
/* Safety Limit Register */
#define REG_SAFETY_LIMIT 0x06
#define MAX_CURRENT_SHIFT 4
#define BQ24153 (1 << 3)
#define BQ24156 (1 << 6)
#define BQ24158 (1 << 8)
#define BQ2415x_WATCHDOG_TIMEOUT 20000
struct bq2415x_platform_data {
int max_charger_currentmA;
int max_charger_voltagemV;
int termination_currentmA;
};
#endif

View File

@@ -0,0 +1,152 @@
/*
* 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;
u8 mask;
};
#define TWL6030_GPADC_MAX_CHANNELS 17
#define TWL6032_GPADC_MAX_CHANNELS 19
/* Define this as the biggest of all chips using this driver */
#define GPADC_MAX_CHANNELS TWL6032_GPADC_MAX_CHANNELS
/*
* raw_code - raw adc value
* raw_channel_value - adc * channel gain
* code - calibrated adc value
*/
struct twl6030_value {
int raw_code;
int raw_channel_value;
int code;
};
struct twl6030_gpadc_request {
u32 channels;
u16 do_avg;
u16 method;
u16 type;
int active;
int result_pending;
int rbuf[TWL6032_GPADC_MAX_CHANNELS];
void (*func_cb)(struct twl6030_gpadc_request *req);
struct twl6030_value buf[TWL6032_GPADC_MAX_CHANNELS];
};
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_CTRL2 0x01 /* 0x2f */
#define TWL6030_GPADC_RTSELECT_LSB 0x02 /* 0x30 */
#define TWL6030_GPADC_RTSELECT_ISB 0x03
#define TWL6030_GPADC_RTSELECT_MSB 0x04
#define TWL6032_GPADC_RTSELECT_LSB 0x04 /* 0x32 */
#define TWL6032_GPADC_RTSELECT_ISB 0x05
#define TWL6032_GPADC_RTSELECT_MSB 0x06
#define TWL6030_GPADC_CTRL_P1 0x05
#define TWL6030_GPADC_CTRL_P2 0x06
#define TWL6032_GPADC_GPSELECT_ISB 0x07
#define TWL6032_GPADC_CTRL_P1 0x08
#define TWL6032_RTCH0_LSB 0x09
#define TWL6032_RTCH0_MSB 0x0a
#define TWL6032_RTCH1_LSB 0x0b
#define TWL6032_RTCH1_MSB 0x0c
#define TWL6032_GPCH0_LSB 0x0d
#define TWL6032_GPCH0_MSB 0x0e
#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_CTRL2_REMSENSE_0 (1 << 0)
#define TWL6030_GPADC_CTRL2_REMSENSE_1 (1 << 1)
#define TWL6030_GPADC_CTRL2_SCALER_EN_CH18 (1 << 2)
#define TWL6030_GPADC_CTRL2_VBAT_SCALER_DIV4 (1 << 3)
#define TWL6030_GPADC_RT_SW1_EOC_MASK (1 << 5)
#define TWL6030_GPADC_SW2_EOC_MASK (1 << 6)
#define TWL6032_GPADC_RT_EOC_MASK (1 << 4)
#define TWL6032_GPADC_SW_EOC_MASK (1 << 5)
#define TWL6030_GPADC_IOC_MAGIC '`'
#define TWL6030_GPADC_IOCX_ADC_RAW_READ _IO(TWL6030_GPADC_IOC_MAGIC, 0)
#define TWL6030_GPADC_IOCX_ADC_READ _IO(TWL6030_GPADC_IOC_MAGIC+1, 0)
struct twl6030_gpadc_user_parms {
int channel;
int status;
u16 result;
};
int twl6030_gpadc_conversion(struct twl6030_gpadc_request *conv);
#endif

View File

@@ -0,0 +1,86 @@
/*
* twl6030_madc.h - Header for TWL6030 MADC
*
* Copyright (C) 2011 Samsung Telecommunications of America
*
* Based on twl4030-madc.h
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* J Keerthy <j-keerthy@ti.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_MADC_H
#define _TWL6030_MADC_H
#define TWL6030_MADC_MAX_CHANNELS 17
/*
* twl6030 madc occupies the same offset in the twl6030 map that
* twl4030 madc does in the twl4030 map.
* likewise the charger
*/
#define TWL6030_MODULE_MADC TWL4030_MODULE_MADC
#define TWL6030_MODULE_MAIN_CHARGE TWL4030_MODULE_MAIN_CHARGE
#define TWL6030_MADC_CTRL 0x00
#define TWL6030_MADC_TEMP1_EN (1 << 0)
#define TWL6030_MADC_TEMP2_EN (1 << 1)
#define TWL6030_MADC_SCALER_EN_CH2 (1 << 2)
#define TWL6030_MADC_VBAT_SCALER_DIV (1 << 3)
#define TWL6030_MADC_SCALER_EN_CH11 (1 << 4)
#define TWL6030_MADC_TMP1_EN_MONITOR (1 << 5)
#define TWL6030_MADC_TMP2_EN_MONITOR (1 << 6)
#define TWL6030_MADC_ISOURCE_EN (1 << 7)
#define TWL6030_MADC_RTSELECT_LSB 0x02
#define TWL6030_MADC_ADCIN0 (1 << 0)
#define TWL6030_MADC_ADCIN1 (1 << 1)
#define TWL6030_MADC_ADCIN2 (1 << 2)
#define TWL6030_MADC_ADCIN3 (1 << 3)
#define TWL6030_MADC_ADCIN4 (1 << 4)
#define TWL6030_MADC_ADCIN5 (1 << 5)
#define TWL6030_MADC_ADCIN6 (1 << 6)
#define TWL6030_MADC_ADCIN7 (1 << 7)
#define TWL6030_MADC_RTSELECT_ISB 0x03
#define TWL6030_MADC_ADCIN8 (1 << 0)
#define TWL6030_MADC_ADCIN9 (1 << 1)
#define TWL6030_MADC_ADCIN10 (1 << 2)
#define TWL6030_MADC_ADCIN11 (1 << 3)
#define TWL6030_MADC_ADCIN12 (1 << 4)
#define TWL6030_MADC_ADCIN13 (1 << 5)
#define TWL6030_MADC_ADCIN14 (1 << 6)
#define TWL6030_MADC_ADCIN15 (1 << 7)
#define TWL6030_MADC_RTSELECT_MSB 0x04
#define TWL6030_MADC_ADCIN16 (1 << 0)
#define TWL6030_MADC_CTRL_P1 0x05
#define TWL6030_MADC_BUSY (1 << 0)
#define TWL6030_MADC_EOCP1 (1 << 1)
#define TWL6030_MADC_EOCRT (1 << 2)
#define TWL6030_MADC_SP1 (1 << 3)
#define TWL6030_MADC_CTRL_P2 0x06
#define TWL6030_MADC_BUSYB (1 << 0)
#define TWL6030_MADC_EOCP2 (1 << 1)
#define TWL6030_MADC_SP2 (1 << 2)
#define TWL6030_MADC_RTCH0_LSB 0x07
#define TWL6030_MADC_GPCH0_LSB 0x29
int twl6030_get_madc_conversion(int channel_no);
#endif

14
include/linux/usb/otg.h Normal file → Executable file
View File

@@ -97,6 +97,10 @@ struct otg_transceiver {
int (*set_power)(struct otg_transceiver *otg,
unsigned mA);
/* set/reset USB charger in High impedence mode on VBUS */
int (*set_hz_mode)(struct otg_transceiver *otg,
bool enabled);
/* effective for A-peripheral, ignored for B devices */
int (*set_vbus)(struct otg_transceiver *otg,
bool enabled);
@@ -192,6 +196,16 @@ otg_start_hnp(struct otg_transceiver *otg)
return otg->start_hnp(otg);
}
/* Context: can sleep */
static inline int
otg_set_hz_mode(struct otg_transceiver *otg, bool enabled)
{
if (otg->set_hz_mode)
return otg->set_hz_mode(otg, enabled);
return -EINVAL;
}
/* Context: can sleep */
static inline int
otg_set_vbus(struct otg_transceiver *otg, bool enabled)