Merge branch 'for-mfd-and-power' of git://git.linaro.org/people/ljones/linux-3.0-ux500
Conflicts: drivers/mfd/ab8500-gpadc.c Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
@@ -89,6 +89,11 @@ struct abx500_fg;
|
||||
* points.
|
||||
* @maint_thres This is the threshold where we stop reporting
|
||||
* battery full while in maintenance, in per cent
|
||||
* @pcut_enable: Enable power cut feature in ab8505
|
||||
* @pcut_max_time: Max time threshold
|
||||
* @pcut_flag_time: Flagtime threshold
|
||||
* @pcut_max_restart: Max number of restarts
|
||||
* @pcut_debounce_time: Sets battery debounce time
|
||||
*/
|
||||
struct abx500_fg_parameters {
|
||||
int recovery_sleep_timer;
|
||||
@@ -106,6 +111,11 @@ struct abx500_fg_parameters {
|
||||
int battok_raising_th_sel1;
|
||||
int user_cap_limit;
|
||||
int maint_thres;
|
||||
bool pcut_enable;
|
||||
u8 pcut_max_time;
|
||||
u8 pcut_flag_time;
|
||||
u8 pcut_max_restart;
|
||||
u8 pcut_debounce_time;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -236,7 +246,11 @@ struct abx500_bm_charger_parameters {
|
||||
* @interval_not_charging charge alg cycle period time when not charging (sec)
|
||||
* @temp_hysteresis temperature hysteresis
|
||||
* @gnd_lift_resistance Battery ground to phone ground resistance (mOhm)
|
||||
* @maxi: maximization parameters
|
||||
* @n_chg_out_curr number of elements in array chg_output_curr
|
||||
* @n_chg_in_curr number of elements in array chg_input_curr
|
||||
* @chg_output_curr charger output current level map
|
||||
* @chg_input_curr charger input current level map
|
||||
* @maxi maximization parameters
|
||||
* @cap_levels capacity in percent for the different capacity levels
|
||||
* @bat_type table of supported battery types
|
||||
* @chg_params charger parameters
|
||||
@@ -257,6 +271,7 @@ struct abx500_bm_data {
|
||||
bool autopower_cfg;
|
||||
bool ac_enabled;
|
||||
bool usb_enabled;
|
||||
bool usb_power_path;
|
||||
bool no_maintenance;
|
||||
bool capacity_scaling;
|
||||
bool chg_unknown_bat;
|
||||
@@ -270,6 +285,10 @@ struct abx500_bm_data {
|
||||
int interval_not_charging;
|
||||
int temp_hysteresis;
|
||||
int gnd_lift_resistance;
|
||||
int n_chg_out_curr;
|
||||
int n_chg_in_curr;
|
||||
int *chg_output_curr;
|
||||
int *chg_input_curr;
|
||||
const struct abx500_maxim_parameters *maxi;
|
||||
const struct abx500_bm_capacity_levels *cap_levels;
|
||||
struct abx500_battery_type *bat_type;
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
* Bank : 0x5
|
||||
*/
|
||||
#define AB8500_USB_LINE_STAT_REG 0x80
|
||||
#define AB8500_USB_LINE_CTRL2_REG 0x82
|
||||
#define AB8500_USB_LINK1_STAT_REG 0x94
|
||||
|
||||
/*
|
||||
@@ -33,7 +34,7 @@
|
||||
#define AB8500_CH_STATUS2_REG 0x01
|
||||
#define AB8500_CH_USBCH_STAT1_REG 0x02
|
||||
#define AB8500_CH_USBCH_STAT2_REG 0x03
|
||||
#define AB8500_CH_FSM_STAT_REG 0x04
|
||||
#define AB8540_CH_USBCH_STAT3_REG 0x04
|
||||
#define AB8500_CH_STAT_REG 0x05
|
||||
|
||||
/*
|
||||
@@ -69,6 +70,8 @@
|
||||
#define AB8500_USBCH_CTRL1_REG 0xC0
|
||||
#define AB8500_USBCH_CTRL2_REG 0xC1
|
||||
#define AB8500_USBCH_IPT_CRNTLVL_REG 0xC2
|
||||
#define AB8540_USB_PP_MODE_REG 0xC5
|
||||
#define AB8540_USB_PP_CHR_REG 0xC6
|
||||
|
||||
/*
|
||||
* Gas Gauge register offsets
|
||||
@@ -105,6 +108,7 @@
|
||||
#define AB8500_RTC_BACKUP_CHG_REG 0x0C
|
||||
#define AB8500_RTC_CC_CONF_REG 0x01
|
||||
#define AB8500_RTC_CTRL_REG 0x0B
|
||||
#define AB8500_RTC_CTRL1_REG 0x11
|
||||
|
||||
/*
|
||||
* OTP register offsets
|
||||
@@ -154,6 +158,7 @@
|
||||
#define CH_OP_CUR_LVL_1P4 0x0D
|
||||
#define CH_OP_CUR_LVL_1P5 0x0E
|
||||
#define CH_OP_CUR_LVL_1P6 0x0F
|
||||
#define CH_OP_CUR_LVL_2P 0x3F
|
||||
|
||||
/* BTEMP High thermal limits */
|
||||
#define BTEMP_HIGH_TH_57_0 0x00
|
||||
@@ -179,10 +184,25 @@
|
||||
#define BUP_ICH_SEL_300UA 0x08
|
||||
#define BUP_ICH_SEL_700UA 0x0C
|
||||
|
||||
#define BUP_VCH_SEL_2P5V 0x00
|
||||
#define BUP_VCH_SEL_2P6V 0x01
|
||||
#define BUP_VCH_SEL_2P8V 0x02
|
||||
#define BUP_VCH_SEL_3P1V 0x03
|
||||
enum bup_vch_sel {
|
||||
BUP_VCH_SEL_2P5V,
|
||||
BUP_VCH_SEL_2P6V,
|
||||
BUP_VCH_SEL_2P8V,
|
||||
BUP_VCH_SEL_3P1V,
|
||||
/*
|
||||
* Note that the following 5 values 2.7v, 2.9v, 3.0v, 3.2v, 3.3v
|
||||
* are only available on ab8540. You can't choose these 5
|
||||
* voltage on ab8500/ab8505/ab9540.
|
||||
*/
|
||||
BUP_VCH_SEL_2P7V,
|
||||
BUP_VCH_SEL_2P9V,
|
||||
BUP_VCH_SEL_3P0V,
|
||||
BUP_VCH_SEL_3P2V,
|
||||
BUP_VCH_SEL_3P3V,
|
||||
};
|
||||
|
||||
#define BUP_VCH_RANGE 0x02
|
||||
#define VBUP33_VRTCN 0x01
|
||||
|
||||
/* Battery OVV constants */
|
||||
#define BATT_OVV_ENA 0x02
|
||||
@@ -228,6 +248,8 @@
|
||||
#define BAT_CTRL_20U_ENA 0x02
|
||||
#define BAT_CTRL_18U_ENA 0x01
|
||||
#define BAT_CTRL_16U_ENA 0x02
|
||||
#define BAT_CTRL_60U_ENA 0x01
|
||||
#define BAT_CTRL_120U_ENA 0x02
|
||||
#define BAT_CTRL_CMP_ENA 0x04
|
||||
#define FORCE_BAT_CTRL_CMP_HIGH 0x08
|
||||
#define BAT_CTRL_PULL_UP_ENA 0x10
|
||||
@@ -235,6 +257,24 @@
|
||||
/* Battery type */
|
||||
#define BATTERY_UNKNOWN 00
|
||||
|
||||
/* Registers for pcut feature in ab8505 and ab9540 */
|
||||
#define AB8505_RTC_PCUT_CTL_STATUS_REG 0x12
|
||||
#define AB8505_RTC_PCUT_TIME_REG 0x13
|
||||
#define AB8505_RTC_PCUT_MAX_TIME_REG 0x14
|
||||
#define AB8505_RTC_PCUT_FLAG_TIME_REG 0x15
|
||||
#define AB8505_RTC_PCUT_RESTART_REG 0x16
|
||||
#define AB8505_RTC_PCUT_DEBOUNCE_REG 0x17
|
||||
|
||||
/* USB Power Path constants for ab8540 */
|
||||
#define BUS_VSYS_VOL_SELECT_MASK 0x06
|
||||
#define BUS_VSYS_VOL_SELECT_3P6V 0x00
|
||||
#define BUS_VSYS_VOL_SELECT_3P325V 0x02
|
||||
#define BUS_VSYS_VOL_SELECT_3P9V 0x04
|
||||
#define BUS_VSYS_VOL_SELECT_4P3V 0x06
|
||||
#define BUS_POWER_PATH_MODE_ENA 0x01
|
||||
#define BUS_PP_PRECHG_CURRENT_MASK 0x0E
|
||||
#define BUS_POWER_PATH_PRECHG_ENA 0x01
|
||||
|
||||
/**
|
||||
* struct res_to_temp - defines one point in a temp to res curve. To
|
||||
* be used in battery packs that combines the identification resistor with a
|
||||
@@ -283,6 +323,11 @@ struct ab8500_fg;
|
||||
* points.
|
||||
* @maint_thres This is the threshold where we stop reporting
|
||||
* battery full while in maintenance, in per cent
|
||||
* @pcut_enable: Enable power cut feature in ab8505
|
||||
* @pcut_max_time: Max time threshold
|
||||
* @pcut_flag_time: Flagtime threshold
|
||||
* @pcut_max_restart: Max number of restarts
|
||||
* @pcut_debunce_time: Sets battery debounce time
|
||||
*/
|
||||
struct ab8500_fg_parameters {
|
||||
int recovery_sleep_timer;
|
||||
@@ -299,6 +344,11 @@ struct ab8500_fg_parameters {
|
||||
int battok_raising_th_sel1;
|
||||
int user_cap_limit;
|
||||
int maint_thres;
|
||||
bool pcut_enable;
|
||||
u8 pcut_max_time;
|
||||
u8 pcut_flag_time;
|
||||
u8 pcut_max_restart;
|
||||
u8 pcut_debunce_time;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,32 +4,72 @@
|
||||
*
|
||||
* Author: Arun R Murthy <arun.murthy@stericsson.com>
|
||||
* Author: Daniel Willerud <daniel.willerud@stericsson.com>
|
||||
* Author: M'boumba Cedric Madianga <cedric.madianga@stericsson.com>
|
||||
*/
|
||||
|
||||
#ifndef _AB8500_GPADC_H
|
||||
#define _AB8500_GPADC_H
|
||||
|
||||
/* GPADC source: From datasheet(ADCSwSel[4:0] in GPADCCtrl2) */
|
||||
#define BAT_CTRL 0x01
|
||||
#define BTEMP_BALL 0x02
|
||||
#define MAIN_CHARGER_V 0x03
|
||||
#define ACC_DETECT1 0x04
|
||||
#define ACC_DETECT2 0x05
|
||||
#define ADC_AUX1 0x06
|
||||
#define ADC_AUX2 0x07
|
||||
#define MAIN_BAT_V 0x08
|
||||
#define VBUS_V 0x09
|
||||
#define MAIN_CHARGER_C 0x0A
|
||||
#define USB_CHARGER_C 0x0B
|
||||
#define BK_BAT_V 0x0C
|
||||
#define DIE_TEMP 0x0D
|
||||
/* GPADC source: From datasheet(ADCSwSel[4:0] in GPADCCtrl2
|
||||
* and ADCHwSel[4:0] in GPADCCtrl3 ) */
|
||||
#define BAT_CTRL 0x01
|
||||
#define BTEMP_BALL 0x02
|
||||
#define MAIN_CHARGER_V 0x03
|
||||
#define ACC_DETECT1 0x04
|
||||
#define ACC_DETECT2 0x05
|
||||
#define ADC_AUX1 0x06
|
||||
#define ADC_AUX2 0x07
|
||||
#define MAIN_BAT_V 0x08
|
||||
#define VBUS_V 0x09
|
||||
#define MAIN_CHARGER_C 0x0A
|
||||
#define USB_CHARGER_C 0x0B
|
||||
#define BK_BAT_V 0x0C
|
||||
#define DIE_TEMP 0x0D
|
||||
#define USB_ID 0x0E
|
||||
#define XTAL_TEMP 0x12
|
||||
#define VBAT_TRUE_MEAS 0x13
|
||||
#define BAT_CTRL_AND_IBAT 0x1C
|
||||
#define VBAT_MEAS_AND_IBAT 0x1D
|
||||
#define VBAT_TRUE_MEAS_AND_IBAT 0x1E
|
||||
#define BAT_TEMP_AND_IBAT 0x1F
|
||||
|
||||
/* Virtual channel used only for ibat convertion to ampere
|
||||
* Battery current conversion (ibat) cannot be requested as a single conversion
|
||||
* but it is always in combination with other input requests
|
||||
*/
|
||||
#define IBAT_VIRTUAL_CHANNEL 0xFF
|
||||
|
||||
#define SAMPLE_1 1
|
||||
#define SAMPLE_4 4
|
||||
#define SAMPLE_8 8
|
||||
#define SAMPLE_16 16
|
||||
#define RISING_EDGE 0
|
||||
#define FALLING_EDGE 1
|
||||
|
||||
/* Arbitrary ADC conversion type constants */
|
||||
#define ADC_SW 0
|
||||
#define ADC_HW 1
|
||||
|
||||
struct ab8500_gpadc;
|
||||
|
||||
struct ab8500_gpadc *ab8500_gpadc_get(char *name);
|
||||
int ab8500_gpadc_convert(struct ab8500_gpadc *gpadc, u8 channel);
|
||||
int ab8500_gpadc_read_raw(struct ab8500_gpadc *gpadc, u8 channel);
|
||||
int ab8500_gpadc_sw_hw_convert(struct ab8500_gpadc *gpadc, u8 channel,
|
||||
u8 avg_sample, u8 trig_edge, u8 trig_timer, u8 conv_type);
|
||||
static inline int ab8500_gpadc_convert(struct ab8500_gpadc *gpadc, u8 channel)
|
||||
{
|
||||
return ab8500_gpadc_sw_hw_convert(gpadc, channel,
|
||||
SAMPLE_16, 0, 0, ADC_SW);
|
||||
}
|
||||
|
||||
int ab8500_gpadc_read_raw(struct ab8500_gpadc *gpadc, u8 channel,
|
||||
u8 avg_sample, u8 trig_edge, u8 trig_timer, u8 conv_type);
|
||||
int ab8500_gpadc_double_read_raw(struct ab8500_gpadc *gpadc, u8 channel,
|
||||
u8 avg_sample, u8 trig_edge, u8 trig_timer, u8 conv_type,
|
||||
int *ibat);
|
||||
int ab8500_gpadc_ad_to_voltage(struct ab8500_gpadc *gpadc,
|
||||
u8 channel, int ad_value);
|
||||
u8 channel, int ad_value);
|
||||
void ab8540_gpadc_get_otp(struct ab8500_gpadc *gpadc,
|
||||
u16 *vmain_l, u16 *vmain_h, u16 *btemp_l, u16 *btemp_h,
|
||||
u16 *vbat_l, u16 *vbat_h, u16 *ibat_l, u16 *ibat_h);
|
||||
|
||||
#endif /* _AB8500_GPADC_H */
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
int ab8500_sysctrl_read(u16 reg, u8 *value);
|
||||
int ab8500_sysctrl_write(u16 reg, u8 mask, u8 value);
|
||||
void ab8500_restart(char mode, const char *cmd);
|
||||
|
||||
#else
|
||||
|
||||
@@ -40,6 +41,7 @@ static inline int ab8500_sysctrl_clear(u16 reg, u8 bits)
|
||||
/* Configuration data for SysClkReq1RfClkBuf - SysClkReq8RfClkBuf */
|
||||
struct ab8500_sysctrl_platform_data {
|
||||
u8 initial_req_buf_config[8];
|
||||
u16 (*reboot_reason_code)(const char *cmd);
|
||||
};
|
||||
|
||||
/* Registers */
|
||||
@@ -299,4 +301,8 @@ struct ab8500_sysctrl_platform_data {
|
||||
#define AB9540_SYSCLK12BUF4VALID_SYSCLK12BUF4VALID_MASK 0xFF
|
||||
#define AB9540_SYSCLK12BUF4VALID_SYSCLK12BUF4VALID_SHIFT 0
|
||||
|
||||
#define AB8500_ENABLE_WD 0x1
|
||||
#define AB8500_KICK_WD 0x2
|
||||
#define AB8500_WD_RESTART_ON_EXPIRE 0x10
|
||||
|
||||
#endif /* __AB8500_SYSCTRL_H */
|
||||
|
||||
@@ -362,6 +362,7 @@ struct ab8500 {
|
||||
u8 *oldmask;
|
||||
int mask_size;
|
||||
const int *irq_reg_offset;
|
||||
int it_latchhier_num;
|
||||
};
|
||||
|
||||
struct regulator_reg_init;
|
||||
@@ -512,6 +513,8 @@ static inline int is_ab9540_2p0_or_earlier(struct ab8500 *ab)
|
||||
return (is_ab9540(ab) && (ab->chip_id < AB8500_CUT2P0));
|
||||
}
|
||||
|
||||
void ab8500_override_turn_on_stat(u8 mask, u8 set);
|
||||
|
||||
#ifdef CONFIG_AB8500_DEBUG
|
||||
void ab8500_dump_all_banks(struct device *dev);
|
||||
void ab8500_debug_register_interrupt(int line);
|
||||
|
||||
@@ -17,8 +17,11 @@ struct ux500_charger;
|
||||
|
||||
struct ux500_charger_ops {
|
||||
int (*enable) (struct ux500_charger *, int, int, int);
|
||||
int (*check_enable) (struct ux500_charger *, int, int);
|
||||
int (*kick_wd) (struct ux500_charger *);
|
||||
int (*update_curr) (struct ux500_charger *, int);
|
||||
int (*pp_enable) (struct ux500_charger *, bool);
|
||||
int (*pre_chg_enable) (struct ux500_charger *, bool);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -29,6 +32,7 @@ struct ux500_charger_ops {
|
||||
* @max_out_curr maximum output charger current in mA
|
||||
* @enabled indicates if this charger is used or not
|
||||
* @external external charger unit (pm2xxx)
|
||||
* @power_path USB power path support
|
||||
*/
|
||||
struct ux500_charger {
|
||||
struct power_supply psy;
|
||||
@@ -38,6 +42,9 @@ struct ux500_charger {
|
||||
int wdt_refresh;
|
||||
bool enabled;
|
||||
bool external;
|
||||
bool power_path;
|
||||
};
|
||||
|
||||
extern struct blocking_notifier_head charger_notifier_list;
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user