mirror of
https://github.com/AetherDroid/android_kernel_samsung_on5xelte.git
synced 2025-09-09 17:02:46 -04:00
Fixed MTP to work with TWRP
This commit is contained in:
commit
f6dfaef42e
50820 changed files with 20846062 additions and 0 deletions
479
include/linux/mfd/abx500/ab8500-bm.h
Normal file
479
include/linux/mfd/abx500/ab8500-bm.h
Normal file
|
@ -0,0 +1,479 @@
|
|||
/*
|
||||
* Copyright ST-Ericsson 2012.
|
||||
*
|
||||
* Author: Arun Murthy <arun.murthy@stericsson.com>
|
||||
* Licensed under GPLv2.
|
||||
*/
|
||||
|
||||
#ifndef _AB8500_BM_H
|
||||
#define _AB8500_BM_H
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/mfd/abx500.h>
|
||||
|
||||
/*
|
||||
* System control 2 register offsets.
|
||||
* bank = 0x02
|
||||
*/
|
||||
#define AB8500_MAIN_WDOG_CTRL_REG 0x01
|
||||
#define AB8500_LOW_BAT_REG 0x03
|
||||
#define AB8500_BATT_OK_REG 0x04
|
||||
/*
|
||||
* USB/ULPI register offsets
|
||||
* Bank : 0x5
|
||||
*/
|
||||
#define AB8500_USB_LINE_STAT_REG 0x80
|
||||
#define AB8500_USB_LINE_CTRL2_REG 0x82
|
||||
#define AB8500_USB_LINK1_STAT_REG 0x94
|
||||
|
||||
/*
|
||||
* Charger / status register offfsets
|
||||
* Bank : 0x0B
|
||||
*/
|
||||
#define AB8500_CH_STATUS1_REG 0x00
|
||||
#define AB8500_CH_STATUS2_REG 0x01
|
||||
#define AB8500_CH_USBCH_STAT1_REG 0x02
|
||||
#define AB8500_CH_USBCH_STAT2_REG 0x03
|
||||
#define AB8540_CH_USBCH_STAT3_REG 0x04
|
||||
#define AB8500_CH_STAT_REG 0x05
|
||||
|
||||
/*
|
||||
* Charger / control register offfsets
|
||||
* Bank : 0x0B
|
||||
*/
|
||||
#define AB8500_CH_VOLT_LVL_REG 0x40
|
||||
#define AB8500_CH_VOLT_LVL_MAX_REG 0x41 /*Only in Cut2.0*/
|
||||
#define AB8500_CH_OPT_CRNTLVL_REG 0x42
|
||||
#define AB8500_CH_OPT_CRNTLVL_MAX_REG 0x43 /*Only in Cut2.0*/
|
||||
#define AB8500_CH_WD_TIMER_REG 0x50
|
||||
#define AB8500_CHARG_WD_CTRL 0x51
|
||||
#define AB8500_BTEMP_HIGH_TH 0x52
|
||||
#define AB8500_LED_INDICATOR_PWM_CTRL 0x53
|
||||
#define AB8500_LED_INDICATOR_PWM_DUTY 0x54
|
||||
#define AB8500_BATT_OVV 0x55
|
||||
#define AB8500_CHARGER_CTRL 0x56
|
||||
#define AB8500_BAT_CTRL_CURRENT_SOURCE 0x60 /*Only in Cut2.0*/
|
||||
|
||||
/*
|
||||
* Charger / main control register offsets
|
||||
* Bank : 0x0B
|
||||
*/
|
||||
#define AB8500_MCH_CTRL1 0x80
|
||||
#define AB8500_MCH_CTRL2 0x81
|
||||
#define AB8500_MCH_IPT_CURLVL_REG 0x82
|
||||
#define AB8500_CH_WD_REG 0x83
|
||||
|
||||
/*
|
||||
* Charger / USB control register offsets
|
||||
* Bank : 0x0B
|
||||
*/
|
||||
#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
|
||||
* Bank : 0x0C
|
||||
*/
|
||||
#define AB8500_GASG_CC_CTRL_REG 0x00
|
||||
#define AB8500_GASG_CC_ACCU1_REG 0x01
|
||||
#define AB8500_GASG_CC_ACCU2_REG 0x02
|
||||
#define AB8500_GASG_CC_ACCU3_REG 0x03
|
||||
#define AB8500_GASG_CC_ACCU4_REG 0x04
|
||||
#define AB8500_GASG_CC_SMPL_CNTRL_REG 0x05
|
||||
#define AB8500_GASG_CC_SMPL_CNTRH_REG 0x06
|
||||
#define AB8500_GASG_CC_SMPL_CNVL_REG 0x07
|
||||
#define AB8500_GASG_CC_SMPL_CNVH_REG 0x08
|
||||
#define AB8500_GASG_CC_CNTR_AVGOFF_REG 0x09
|
||||
#define AB8500_GASG_CC_OFFSET_REG 0x0A
|
||||
#define AB8500_GASG_CC_NCOV_ACCU 0x10
|
||||
#define AB8500_GASG_CC_NCOV_ACCU_CTRL 0x11
|
||||
#define AB8500_GASG_CC_NCOV_ACCU_LOW 0x12
|
||||
#define AB8500_GASG_CC_NCOV_ACCU_MED 0x13
|
||||
#define AB8500_GASG_CC_NCOV_ACCU_HIGH 0x14
|
||||
|
||||
/*
|
||||
* Interrupt register offsets
|
||||
* Bank : 0x0E
|
||||
*/
|
||||
#define AB8500_IT_SOURCE2_REG 0x01
|
||||
#define AB8500_IT_SOURCE21_REG 0x14
|
||||
|
||||
/*
|
||||
* RTC register offsets
|
||||
* Bank: 0x0F
|
||||
*/
|
||||
#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
|
||||
* Bank : 0x15
|
||||
*/
|
||||
#define AB8500_OTP_CONF_15 0x0E
|
||||
|
||||
/* GPADC constants from AB8500 spec, UM0836 */
|
||||
#define ADC_RESOLUTION 1024
|
||||
#define ADC_CH_MAIN_MIN 0
|
||||
#define ADC_CH_MAIN_MAX 20030
|
||||
#define ADC_CH_VBUS_MIN 0
|
||||
#define ADC_CH_VBUS_MAX 20030
|
||||
#define ADC_CH_VBAT_MIN 2300
|
||||
#define ADC_CH_VBAT_MAX 4800
|
||||
#define ADC_CH_BKBAT_MIN 0
|
||||
#define ADC_CH_BKBAT_MAX 3200
|
||||
|
||||
/* Main charge i/p current */
|
||||
#define MAIN_CH_IP_CUR_0P9A 0x80
|
||||
#define MAIN_CH_IP_CUR_1P0A 0x90
|
||||
#define MAIN_CH_IP_CUR_1P1A 0xA0
|
||||
#define MAIN_CH_IP_CUR_1P2A 0xB0
|
||||
#define MAIN_CH_IP_CUR_1P3A 0xC0
|
||||
#define MAIN_CH_IP_CUR_1P4A 0xD0
|
||||
#define MAIN_CH_IP_CUR_1P5A 0xE0
|
||||
|
||||
/* ChVoltLevel */
|
||||
#define CH_VOL_LVL_3P5 0x00
|
||||
#define CH_VOL_LVL_4P0 0x14
|
||||
#define CH_VOL_LVL_4P05 0x16
|
||||
#define CH_VOL_LVL_4P1 0x1B
|
||||
#define CH_VOL_LVL_4P15 0x20
|
||||
#define CH_VOL_LVL_4P2 0x25
|
||||
#define CH_VOL_LVL_4P6 0x4D
|
||||
|
||||
/* ChOutputCurrentLevel */
|
||||
#define CH_OP_CUR_LVL_0P1 0x00
|
||||
#define CH_OP_CUR_LVL_0P2 0x01
|
||||
#define CH_OP_CUR_LVL_0P3 0x02
|
||||
#define CH_OP_CUR_LVL_0P4 0x03
|
||||
#define CH_OP_CUR_LVL_0P5 0x04
|
||||
#define CH_OP_CUR_LVL_0P6 0x05
|
||||
#define CH_OP_CUR_LVL_0P7 0x06
|
||||
#define CH_OP_CUR_LVL_0P8 0x07
|
||||
#define CH_OP_CUR_LVL_0P9 0x08
|
||||
#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
|
||||
#define BTEMP_HIGH_TH_52 0x01
|
||||
#define BTEMP_HIGH_TH_57_1 0x02
|
||||
#define BTEMP_HIGH_TH_62 0x03
|
||||
|
||||
/* current is mA */
|
||||
#define USB_0P1A 100
|
||||
#define USB_0P2A 200
|
||||
#define USB_0P3A 300
|
||||
#define USB_0P4A 400
|
||||
#define USB_0P5A 500
|
||||
|
||||
#define LOW_BAT_3P1V 0x20
|
||||
#define LOW_BAT_2P3V 0x00
|
||||
#define LOW_BAT_RESET 0x01
|
||||
#define LOW_BAT_ENABLE 0x01
|
||||
|
||||
/* Backup battery constants */
|
||||
#define BUP_ICH_SEL_50UA 0x00
|
||||
#define BUP_ICH_SEL_150UA 0x04
|
||||
#define BUP_ICH_SEL_300UA 0x08
|
||||
#define BUP_ICH_SEL_700UA 0x0C
|
||||
|
||||
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
|
||||
#define BATT_OVV_TH_3P7 0x00
|
||||
#define BATT_OVV_TH_4P75 0x01
|
||||
|
||||
/* A value to indicate over voltage */
|
||||
#define BATT_OVV_VALUE 4750
|
||||
|
||||
/* VBUS OVV constants */
|
||||
#define VBUS_OVV_SELECT_MASK 0x78
|
||||
#define VBUS_OVV_SELECT_5P6V 0x00
|
||||
#define VBUS_OVV_SELECT_5P7V 0x08
|
||||
#define VBUS_OVV_SELECT_5P8V 0x10
|
||||
#define VBUS_OVV_SELECT_5P9V 0x18
|
||||
#define VBUS_OVV_SELECT_6P0V 0x20
|
||||
#define VBUS_OVV_SELECT_6P1V 0x28
|
||||
#define VBUS_OVV_SELECT_6P2V 0x30
|
||||
#define VBUS_OVV_SELECT_6P3V 0x38
|
||||
|
||||
#define VBUS_AUTO_IN_CURR_LIM_ENA 0x04
|
||||
|
||||
/* Fuel Gauge constants */
|
||||
#define RESET_ACCU 0x02
|
||||
#define READ_REQ 0x01
|
||||
#define CC_DEEP_SLEEP_ENA 0x02
|
||||
#define CC_PWR_UP_ENA 0x01
|
||||
#define CC_SAMPLES_40 0x28
|
||||
#define RD_NCONV_ACCU_REQ 0x01
|
||||
#define CC_CALIB 0x08
|
||||
#define CC_INTAVGOFFSET_ENA 0x10
|
||||
#define CC_MUXOFFSET 0x80
|
||||
#define CC_INT_CAL_N_AVG_MASK 0x60
|
||||
#define CC_INT_CAL_SAMPLES_16 0x40
|
||||
#define CC_INT_CAL_SAMPLES_8 0x20
|
||||
#define CC_INT_CAL_SAMPLES_4 0x00
|
||||
|
||||
/* RTC constants */
|
||||
#define RTC_BUP_CH_ENA 0x10
|
||||
|
||||
/* BatCtrl Current Source Constants */
|
||||
#define BAT_CTRL_7U_ENA 0x01
|
||||
#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
|
||||
|
||||
/* 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
|
||||
* NTC resistor.
|
||||
* @temp: battery pack temperature in Celcius
|
||||
* @resist: NTC resistor net total resistance
|
||||
*/
|
||||
struct res_to_temp {
|
||||
int temp;
|
||||
int resist;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct batres_vs_temp - defines one point in a temp vs battery internal
|
||||
* resistance curve.
|
||||
* @temp: battery pack temperature in Celcius
|
||||
* @resist: battery internal reistance in mOhm
|
||||
*/
|
||||
struct batres_vs_temp {
|
||||
int temp;
|
||||
int resist;
|
||||
};
|
||||
|
||||
/* Forward declaration */
|
||||
struct ab8500_fg;
|
||||
|
||||
/**
|
||||
* struct ab8500_fg_parameters - Fuel gauge algorithm parameters, in seconds
|
||||
* if not specified
|
||||
* @recovery_sleep_timer: Time between measurements while recovering
|
||||
* @recovery_total_time: Total recovery time
|
||||
* @init_timer: Measurement interval during startup
|
||||
* @init_discard_time: Time we discard voltage measurement at startup
|
||||
* @init_total_time: Total init time during startup
|
||||
* @high_curr_time: Time current has to be high to go to recovery
|
||||
* @accu_charging: FG accumulation time while charging
|
||||
* @accu_high_curr: FG accumulation time in high current mode
|
||||
* @high_curr_threshold: High current threshold, in mA
|
||||
* @lowbat_threshold: Low battery threshold, in mV
|
||||
* @battok_falling_th_sel0 Threshold in mV for battOk signal sel0
|
||||
* Resolution in 50 mV step.
|
||||
* @battok_raising_th_sel1 Threshold in mV for battOk signal sel1
|
||||
* Resolution in 50 mV step.
|
||||
* @user_cap_limit Capacity reported from user must be within this
|
||||
* limit to be considered as sane, in percentage
|
||||
* 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;
|
||||
int recovery_total_time;
|
||||
int init_timer;
|
||||
int init_discard_time;
|
||||
int init_total_time;
|
||||
int high_curr_time;
|
||||
int accu_charging;
|
||||
int accu_high_curr;
|
||||
int high_curr_threshold;
|
||||
int lowbat_threshold;
|
||||
int battok_falling_th_sel0;
|
||||
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;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ab8500_charger_maximization - struct used by the board config.
|
||||
* @use_maxi: Enable maximization for this battery type
|
||||
* @maxi_chg_curr: Maximum charger current allowed
|
||||
* @maxi_wait_cycles: cycles to wait before setting charger current
|
||||
* @charger_curr_step delta between two charger current settings (mA)
|
||||
*/
|
||||
struct ab8500_maxim_parameters {
|
||||
bool ena_maxi;
|
||||
int chg_curr;
|
||||
int wait_cycles;
|
||||
int charger_curr_step;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ab8500_bm_capacity_levels - ab8500 capacity level data
|
||||
* @critical: critical capacity level in percent
|
||||
* @low: low capacity level in percent
|
||||
* @normal: normal capacity level in percent
|
||||
* @high: high capacity level in percent
|
||||
* @full: full capacity level in percent
|
||||
*/
|
||||
struct ab8500_bm_capacity_levels {
|
||||
int critical;
|
||||
int low;
|
||||
int normal;
|
||||
int high;
|
||||
int full;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ab8500_bm_charger_parameters - Charger specific parameters
|
||||
* @usb_volt_max: maximum allowed USB charger voltage in mV
|
||||
* @usb_curr_max: maximum allowed USB charger current in mA
|
||||
* @ac_volt_max: maximum allowed AC charger voltage in mV
|
||||
* @ac_curr_max: maximum allowed AC charger current in mA
|
||||
*/
|
||||
struct ab8500_bm_charger_parameters {
|
||||
int usb_volt_max;
|
||||
int usb_curr_max;
|
||||
int ac_volt_max;
|
||||
int ac_curr_max;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ab8500_bm_data - ab8500 battery management data
|
||||
* @temp_under under this temp, charging is stopped
|
||||
* @temp_low between this temp and temp_under charging is reduced
|
||||
* @temp_high between this temp and temp_over charging is reduced
|
||||
* @temp_over over this temp, charging is stopped
|
||||
* @temp_interval_chg temperature measurement interval in s when charging
|
||||
* @temp_interval_nochg temperature measurement interval in s when not charging
|
||||
* @main_safety_tmr_h safety timer for main charger
|
||||
* @usb_safety_tmr_h safety timer for usb charger
|
||||
* @bkup_bat_v voltage which we charge the backup battery with
|
||||
* @bkup_bat_i current which we charge the backup battery with
|
||||
* @no_maintenance indicates that maintenance charging is disabled
|
||||
* @capacity_scaling indicates whether capacity scaling is to be used
|
||||
* @adc_therm placement of thermistor, batctrl or battemp adc
|
||||
* @chg_unknown_bat flag to enable charging of unknown batteries
|
||||
* @enable_overshoot flag to enable VBAT overshoot control
|
||||
* @fg_res resistance of FG resistor in 0.1mOhm
|
||||
* @n_btypes number of elements in array bat_type
|
||||
* @batt_id index of the identified battery in array bat_type
|
||||
* @interval_charging charge alg cycle period time when charging (sec)
|
||||
* @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
|
||||
* @cap_levels capacity in percent for the different capacity levels
|
||||
* @bat_type table of supported battery types
|
||||
* @chg_params charger parameters
|
||||
* @fg_params fuel gauge parameters
|
||||
*/
|
||||
struct ab8500_bm_data {
|
||||
int temp_under;
|
||||
int temp_low;
|
||||
int temp_high;
|
||||
int temp_over;
|
||||
int temp_interval_chg;
|
||||
int temp_interval_nochg;
|
||||
int main_safety_tmr_h;
|
||||
int usb_safety_tmr_h;
|
||||
int bkup_bat_v;
|
||||
int bkup_bat_i;
|
||||
bool no_maintenance;
|
||||
bool capacity_scaling;
|
||||
bool chg_unknown_bat;
|
||||
bool enable_overshoot;
|
||||
enum abx500_adc_therm adc_therm;
|
||||
int fg_res;
|
||||
int n_btypes;
|
||||
int batt_id;
|
||||
int interval_charging;
|
||||
int interval_not_charging;
|
||||
int temp_hysteresis;
|
||||
int gnd_lift_resistance;
|
||||
const struct ab8500_maxim_parameters *maxi;
|
||||
const struct ab8500_bm_capacity_levels *cap_levels;
|
||||
const struct ab8500_bm_charger_parameters *chg_params;
|
||||
const struct ab8500_fg_parameters *fg_params;
|
||||
};
|
||||
|
||||
struct ab8500_btemp;
|
||||
struct ab8500_gpadc;
|
||||
struct ab8500_fg;
|
||||
|
||||
#ifdef CONFIG_AB8500_BM
|
||||
extern struct abx500_bm_data ab8500_bm_data;
|
||||
|
||||
void ab8500_fg_reinit(void);
|
||||
void ab8500_charger_usb_state_changed(u8 bm_usb_state, u16 mA);
|
||||
struct ab8500_btemp *ab8500_btemp_get(void);
|
||||
int ab8500_btemp_get_batctrl_temp(struct ab8500_btemp *btemp);
|
||||
int ab8500_btemp_get_temp(struct ab8500_btemp *btemp);
|
||||
struct ab8500_fg *ab8500_fg_get(void);
|
||||
int ab8500_fg_inst_curr_blocking(struct ab8500_fg *dev);
|
||||
int ab8500_fg_inst_curr_start(struct ab8500_fg *di);
|
||||
int ab8500_fg_inst_curr_finalize(struct ab8500_fg *di, int *res);
|
||||
int ab8500_fg_inst_curr_started(struct ab8500_fg *di);
|
||||
int ab8500_fg_inst_curr_done(struct ab8500_fg *di);
|
||||
|
||||
#else
|
||||
static struct abx500_bm_data ab8500_bm_data;
|
||||
#endif
|
||||
#endif /* _AB8500_BM_H */
|
54
include/linux/mfd/abx500/ab8500-codec.h
Normal file
54
include/linux/mfd/abx500/ab8500-codec.h
Normal file
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Copyright (C) ST-Ericsson SA 2012
|
||||
*
|
||||
* Author: Ola Lilja <ola.o.lilja@stericsson.com>
|
||||
* for ST-Ericsson.
|
||||
*
|
||||
* License terms:
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef AB8500_CORE_CODEC_H
|
||||
#define AB8500_CORE_CODEC_H
|
||||
|
||||
/* Mic-types */
|
||||
enum amic_type {
|
||||
AMIC_TYPE_SINGLE_ENDED,
|
||||
AMIC_TYPE_DIFFERENTIAL
|
||||
};
|
||||
|
||||
/* Mic-biases */
|
||||
enum amic_micbias {
|
||||
AMIC_MICBIAS_VAMIC1,
|
||||
AMIC_MICBIAS_VAMIC2,
|
||||
AMIC_MICBIAS_UNKNOWN
|
||||
};
|
||||
|
||||
/* Bias-voltage */
|
||||
enum ear_cm_voltage {
|
||||
EAR_CMV_0_95V,
|
||||
EAR_CMV_1_10V,
|
||||
EAR_CMV_1_27V,
|
||||
EAR_CMV_1_58V,
|
||||
EAR_CMV_UNKNOWN
|
||||
};
|
||||
|
||||
/* Analog microphone settings */
|
||||
struct amic_settings {
|
||||
enum amic_type mic1_type;
|
||||
enum amic_type mic2_type;
|
||||
enum amic_micbias mic1a_micbias;
|
||||
enum amic_micbias mic1b_micbias;
|
||||
enum amic_micbias mic2_micbias;
|
||||
};
|
||||
|
||||
/* Platform data structure for the audio-parts of the AB8500 */
|
||||
struct ab8500_codec_platform_data {
|
||||
struct amic_settings amics;
|
||||
enum ear_cm_voltage ear_cmv;
|
||||
};
|
||||
|
||||
#endif
|
75
include/linux/mfd/abx500/ab8500-gpadc.h
Normal file
75
include/linux/mfd/abx500/ab8500-gpadc.h
Normal file
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* Copyright (C) 2010 ST-Ericsson SA
|
||||
* Licensed under GPLv2.
|
||||
*
|
||||
* 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
|
||||
* 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_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);
|
||||
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 */
|
308
include/linux/mfd/abx500/ab8500-sysctrl.h
Normal file
308
include/linux/mfd/abx500/ab8500-sysctrl.h
Normal file
|
@ -0,0 +1,308 @@
|
|||
/*
|
||||
* Copyright (C) ST-Ericsson SA 2010
|
||||
* Author: Mattias Nilsson <mattias.i.nilsson@stericsson.com> for ST Ericsson.
|
||||
* License terms: GNU General Public License (GPL) version 2
|
||||
*/
|
||||
#ifndef __AB8500_SYSCTRL_H
|
||||
#define __AB8500_SYSCTRL_H
|
||||
|
||||
#include <linux/bitops.h>
|
||||
|
||||
#ifdef CONFIG_AB8500_CORE
|
||||
|
||||
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
|
||||
|
||||
static inline int ab8500_sysctrl_read(u16 reg, u8 *value)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int ab8500_sysctrl_write(u16 reg, u8 mask, u8 value)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_AB8500_CORE */
|
||||
|
||||
static inline int ab8500_sysctrl_set(u16 reg, u8 bits)
|
||||
{
|
||||
return ab8500_sysctrl_write(reg, bits, bits);
|
||||
}
|
||||
|
||||
static inline int ab8500_sysctrl_clear(u16 reg, u8 bits)
|
||||
{
|
||||
return ab8500_sysctrl_write(reg, bits, 0);
|
||||
}
|
||||
|
||||
/* Configuration data for SysClkReq1RfClkBuf - SysClkReq8RfClkBuf */
|
||||
struct ab8500_sysctrl_platform_data {
|
||||
u8 initial_req_buf_config[8];
|
||||
u16 (*reboot_reason_code)(const char *cmd);
|
||||
};
|
||||
|
||||
/* Registers */
|
||||
#define AB8500_TURNONSTATUS 0x100
|
||||
#define AB8500_RESETSTATUS 0x101
|
||||
#define AB8500_PONKEY1PRESSSTATUS 0x102
|
||||
#define AB8500_SYSCLKREQSTATUS 0x142
|
||||
#define AB8500_STW4500CTRL1 0x180
|
||||
#define AB8500_STW4500CTRL2 0x181
|
||||
#define AB8500_STW4500CTRL3 0x200
|
||||
#define AB8500_MAINWDOGCTRL 0x201
|
||||
#define AB8500_MAINWDOGTIMER 0x202
|
||||
#define AB8500_LOWBAT 0x203
|
||||
#define AB8500_BATTOK 0x204
|
||||
#define AB8500_SYSCLKTIMER 0x205
|
||||
#define AB8500_SMPSCLKCTRL 0x206
|
||||
#define AB8500_SMPSCLKSEL1 0x207
|
||||
#define AB8500_SMPSCLKSEL2 0x208
|
||||
#define AB8500_SMPSCLKSEL3 0x209
|
||||
#define AB8500_SYSULPCLKCONF 0x20A
|
||||
#define AB8500_SYSULPCLKCTRL1 0x20B
|
||||
#define AB8500_SYSCLKCTRL 0x20C
|
||||
#define AB8500_SYSCLKREQ1VALID 0x20D
|
||||
#define AB8500_SYSTEMCTRLSUP 0x20F
|
||||
#define AB8500_SYSCLKREQ1RFCLKBUF 0x210
|
||||
#define AB8500_SYSCLKREQ2RFCLKBUF 0x211
|
||||
#define AB8500_SYSCLKREQ3RFCLKBUF 0x212
|
||||
#define AB8500_SYSCLKREQ4RFCLKBUF 0x213
|
||||
#define AB8500_SYSCLKREQ5RFCLKBUF 0x214
|
||||
#define AB8500_SYSCLKREQ6RFCLKBUF 0x215
|
||||
#define AB8500_SYSCLKREQ7RFCLKBUF 0x216
|
||||
#define AB8500_SYSCLKREQ8RFCLKBUF 0x217
|
||||
#define AB8500_DITHERCLKCTRL 0x220
|
||||
#define AB8500_SWATCTRL 0x230
|
||||
#define AB8500_HIQCLKCTRL 0x232
|
||||
#define AB8500_VSIMSYSCLKCTRL 0x233
|
||||
#define AB9540_SYSCLK12BUFCTRL 0x234
|
||||
#define AB9540_SYSCLK12CONFCTRL 0x235
|
||||
#define AB9540_SYSCLK12BUFCTRL2 0x236
|
||||
#define AB9540_SYSCLK12BUF1VALID 0x237
|
||||
#define AB9540_SYSCLK12BUF2VALID 0x238
|
||||
#define AB9540_SYSCLK12BUF3VALID 0x239
|
||||
#define AB9540_SYSCLK12BUF4VALID 0x23A
|
||||
|
||||
/* Bits */
|
||||
#define AB8500_TURNONSTATUS_PORNVBAT BIT(0)
|
||||
#define AB8500_TURNONSTATUS_PONKEY1DBF BIT(1)
|
||||
#define AB8500_TURNONSTATUS_PONKEY2DBF BIT(2)
|
||||
#define AB8500_TURNONSTATUS_RTCALARM BIT(3)
|
||||
#define AB8500_TURNONSTATUS_MAINCHDET BIT(4)
|
||||
#define AB8500_TURNONSTATUS_VBUSDET BIT(5)
|
||||
#define AB8500_TURNONSTATUS_USBIDDETECT BIT(6)
|
||||
|
||||
#define AB8500_RESETSTATUS_RESETN4500NSTATUS BIT(0)
|
||||
#define AB8500_RESETSTATUS_SWRESETN4500NSTATUS BIT(2)
|
||||
|
||||
#define AB8500_PONKEY1PRESSSTATUS_PONKEY1PRESSTIME_MASK 0x7F
|
||||
#define AB8500_PONKEY1PRESSSTATUS_PONKEY1PRESSTIME_SHIFT 0
|
||||
|
||||
#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ1STATUS BIT(0)
|
||||
#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ2STATUS BIT(1)
|
||||
#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ3STATUS BIT(2)
|
||||
#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ4STATUS BIT(3)
|
||||
#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ5STATUS BIT(4)
|
||||
#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ6STATUS BIT(5)
|
||||
#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ7STATUS BIT(6)
|
||||
#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ8STATUS BIT(7)
|
||||
|
||||
#define AB8500_STW4500CTRL1_SWOFF BIT(0)
|
||||
#define AB8500_STW4500CTRL1_SWRESET4500N BIT(1)
|
||||
#define AB8500_STW4500CTRL1_THDB8500SWOFF BIT(2)
|
||||
|
||||
#define AB8500_STW4500CTRL2_RESETNVAUX1VALID BIT(0)
|
||||
#define AB8500_STW4500CTRL2_RESETNVAUX2VALID BIT(1)
|
||||
#define AB8500_STW4500CTRL2_RESETNVAUX3VALID BIT(2)
|
||||
#define AB8500_STW4500CTRL2_RESETNVMODVALID BIT(3)
|
||||
#define AB8500_STW4500CTRL2_RESETNVEXTSUPPLY1VALID BIT(4)
|
||||
#define AB8500_STW4500CTRL2_RESETNVEXTSUPPLY2VALID BIT(5)
|
||||
#define AB8500_STW4500CTRL2_RESETNVEXTSUPPLY3VALID BIT(6)
|
||||
#define AB8500_STW4500CTRL2_RESETNVSMPS1VALID BIT(7)
|
||||
|
||||
#define AB8500_STW4500CTRL3_CLK32KOUT2DIS BIT(0)
|
||||
#define AB8500_STW4500CTRL3_RESETAUDN BIT(1)
|
||||
#define AB8500_STW4500CTRL3_RESETDENCN BIT(2)
|
||||
#define AB8500_STW4500CTRL3_THSDENA BIT(3)
|
||||
|
||||
#define AB8500_MAINWDOGCTRL_MAINWDOGENA BIT(0)
|
||||
#define AB8500_MAINWDOGCTRL_MAINWDOGKICK BIT(1)
|
||||
#define AB8500_MAINWDOGCTRL_WDEXPTURNONVALID BIT(4)
|
||||
|
||||
#define AB8500_MAINWDOGTIMER_MAINWDOGTIMER_MASK 0x7F
|
||||
#define AB8500_MAINWDOGTIMER_MAINWDOGTIMER_SHIFT 0
|
||||
|
||||
#define AB8500_LOWBAT_LOWBATENA BIT(0)
|
||||
#define AB8500_LOWBAT_LOWBAT_MASK 0x7E
|
||||
#define AB8500_LOWBAT_LOWBAT_SHIFT 1
|
||||
|
||||
#define AB8500_BATTOK_BATTOKSEL0THF_MASK 0x0F
|
||||
#define AB8500_BATTOK_BATTOKSEL0THF_SHIFT 0
|
||||
#define AB8500_BATTOK_BATTOKSEL1THF_MASK 0xF0
|
||||
#define AB8500_BATTOK_BATTOKSEL1THF_SHIFT 4
|
||||
|
||||
#define AB8500_SYSCLKTIMER_SYSCLKTIMER_MASK 0x0F
|
||||
#define AB8500_SYSCLKTIMER_SYSCLKTIMER_SHIFT 0
|
||||
#define AB8500_SYSCLKTIMER_SYSCLKTIMERADJ_MASK 0xF0
|
||||
#define AB8500_SYSCLKTIMER_SYSCLKTIMERADJ_SHIFT 4
|
||||
|
||||
#define AB8500_SMPSCLKCTRL_SMPSCLKINTSEL_MASK 0x03
|
||||
#define AB8500_SMPSCLKCTRL_SMPSCLKINTSEL_SHIFT 0
|
||||
#define AB8500_SMPSCLKCTRL_3M2CLKINTENA BIT(2)
|
||||
|
||||
#define AB8500_SMPSCLKSEL1_VARMCLKSEL_MASK 0x07
|
||||
#define AB8500_SMPSCLKSEL1_VARMCLKSEL_SHIFT 0
|
||||
#define AB8500_SMPSCLKSEL1_VAPECLKSEL_MASK 0x38
|
||||
#define AB8500_SMPSCLKSEL1_VAPECLKSEL_SHIFT 3
|
||||
|
||||
#define AB8500_SMPSCLKSEL2_VMODCLKSEL_MASK 0x07
|
||||
#define AB8500_SMPSCLKSEL2_VMODCLKSEL_SHIFT 0
|
||||
#define AB8500_SMPSCLKSEL2_VSMPS1CLKSEL_MASK 0x38
|
||||
#define AB8500_SMPSCLKSEL2_VSMPS1CLKSEL_SHIFT 3
|
||||
|
||||
#define AB8500_SMPSCLKSEL3_VSMPS2CLKSEL_MASK 0x07
|
||||
#define AB8500_SMPSCLKSEL3_VSMPS2CLKSEL_SHIFT 0
|
||||
#define AB8500_SMPSCLKSEL3_VSMPS3CLKSEL_MASK 0x38
|
||||
#define AB8500_SMPSCLKSEL3_VSMPS3CLKSEL_SHIFT 3
|
||||
|
||||
#define AB8500_SYSULPCLKCONF_ULPCLKCONF_MASK 0x03
|
||||
#define AB8500_SYSULPCLKCONF_ULPCLKCONF_SHIFT 0
|
||||
#define AB8500_SYSULPCLKCONF_CLK27MHZSTRE BIT(2)
|
||||
#define AB8500_SYSULPCLKCONF_TVOUTCLKDELN BIT(3)
|
||||
#define AB8500_SYSULPCLKCONF_TVOUTCLKINV BIT(4)
|
||||
#define AB8500_SYSULPCLKCONF_ULPCLKSTRE BIT(5)
|
||||
#define AB8500_SYSULPCLKCONF_CLK27MHZBUFENA BIT(6)
|
||||
#define AB8500_SYSULPCLKCONF_CLK27MHZPDENA BIT(7)
|
||||
|
||||
#define AB8500_SYSULPCLKCTRL1_SYSULPCLKINTSEL_MASK 0x03
|
||||
#define AB8500_SYSULPCLKCTRL1_SYSULPCLKINTSEL_SHIFT 0
|
||||
#define AB8500_SYSULPCLKCTRL1_ULPCLKREQ BIT(2)
|
||||
#define AB8500_SYSULPCLKCTRL1_4500SYSCLKREQ BIT(3)
|
||||
#define AB8500_SYSULPCLKCTRL1_AUDIOCLKENA BIT(4)
|
||||
#define AB8500_SYSULPCLKCTRL1_SYSCLKBUF2REQ BIT(5)
|
||||
#define AB8500_SYSULPCLKCTRL1_SYSCLKBUF3REQ BIT(6)
|
||||
#define AB8500_SYSULPCLKCTRL1_SYSCLKBUF4REQ BIT(7)
|
||||
|
||||
#define AB8500_SYSCLKCTRL_TVOUTPLLENA BIT(0)
|
||||
#define AB8500_SYSCLKCTRL_TVOUTCLKENA BIT(1)
|
||||
#define AB8500_SYSCLKCTRL_USBCLKENA BIT(2)
|
||||
|
||||
#define AB8500_SYSCLKREQ1VALID_SYSCLKREQ1VALID BIT(0)
|
||||
#define AB8500_SYSCLKREQ1VALID_ULPCLKREQ1VALID BIT(1)
|
||||
#define AB8500_SYSCLKREQ1VALID_USBSYSCLKREQ1VALID BIT(2)
|
||||
|
||||
#define AB8500_SYSTEMCTRLSUP_EXTSUP12LPNCLKSEL_MASK 0x03
|
||||
#define AB8500_SYSTEMCTRLSUP_EXTSUP12LPNCLKSEL_SHIFT 0
|
||||
#define AB8500_SYSTEMCTRLSUP_EXTSUP3LPNCLKSEL_MASK 0x0C
|
||||
#define AB8500_SYSTEMCTRLSUP_EXTSUP3LPNCLKSEL_SHIFT 2
|
||||
#define AB8500_SYSTEMCTRLSUP_INTDB8500NOD BIT(4)
|
||||
|
||||
#define AB8500_SYSCLKREQ1RFCLKBUF_SYSCLKREQ1RFCLKBUF2 BIT(2)
|
||||
#define AB8500_SYSCLKREQ1RFCLKBUF_SYSCLKREQ1RFCLKBUF3 BIT(3)
|
||||
#define AB8500_SYSCLKREQ1RFCLKBUF_SYSCLKREQ1RFCLKBUF4 BIT(4)
|
||||
|
||||
#define AB8500_SYSCLKREQ2RFCLKBUF_SYSCLKREQ2RFCLKBUF2 BIT(2)
|
||||
#define AB8500_SYSCLKREQ2RFCLKBUF_SYSCLKREQ2RFCLKBUF3 BIT(3)
|
||||
#define AB8500_SYSCLKREQ2RFCLKBUF_SYSCLKREQ2RFCLKBUF4 BIT(4)
|
||||
|
||||
#define AB8500_SYSCLKREQ3RFCLKBUF_SYSCLKREQ3RFCLKBUF2 BIT(2)
|
||||
#define AB8500_SYSCLKREQ3RFCLKBUF_SYSCLKREQ3RFCLKBUF3 BIT(3)
|
||||
#define AB8500_SYSCLKREQ3RFCLKBUF_SYSCLKREQ3RFCLKBUF4 BIT(4)
|
||||
|
||||
#define AB8500_SYSCLKREQ4RFCLKBUF_SYSCLKREQ4RFCLKBUF2 BIT(2)
|
||||
#define AB8500_SYSCLKREQ4RFCLKBUF_SYSCLKREQ4RFCLKBUF3 BIT(3)
|
||||
#define AB8500_SYSCLKREQ4RFCLKBUF_SYSCLKREQ4RFCLKBUF4 BIT(4)
|
||||
|
||||
#define AB8500_SYSCLKREQ5RFCLKBUF_SYSCLKREQ5RFCLKBUF2 BIT(2)
|
||||
#define AB8500_SYSCLKREQ5RFCLKBUF_SYSCLKREQ5RFCLKBUF3 BIT(3)
|
||||
#define AB8500_SYSCLKREQ5RFCLKBUF_SYSCLKREQ5RFCLKBUF4 BIT(4)
|
||||
|
||||
#define AB8500_SYSCLKREQ6RFCLKBUF_SYSCLKREQ6RFCLKBUF2 BIT(2)
|
||||
#define AB8500_SYSCLKREQ6RFCLKBUF_SYSCLKREQ6RFCLKBUF3 BIT(3)
|
||||
#define AB8500_SYSCLKREQ6RFCLKBUF_SYSCLKREQ6RFCLKBUF4 BIT(4)
|
||||
|
||||
#define AB8500_SYSCLKREQ7RFCLKBUF_SYSCLKREQ7RFCLKBUF2 BIT(2)
|
||||
#define AB8500_SYSCLKREQ7RFCLKBUF_SYSCLKREQ7RFCLKBUF3 BIT(3)
|
||||
#define AB8500_SYSCLKREQ7RFCLKBUF_SYSCLKREQ7RFCLKBUF4 BIT(4)
|
||||
|
||||
#define AB8500_SYSCLKREQ8RFCLKBUF_SYSCLKREQ8RFCLKBUF2 BIT(2)
|
||||
#define AB8500_SYSCLKREQ8RFCLKBUF_SYSCLKREQ8RFCLKBUF3 BIT(3)
|
||||
#define AB8500_SYSCLKREQ8RFCLKBUF_SYSCLKREQ8RFCLKBUF4 BIT(4)
|
||||
|
||||
#define AB8500_DITHERCLKCTRL_VARMDITHERENA BIT(0)
|
||||
#define AB8500_DITHERCLKCTRL_VSMPS3DITHERENA BIT(1)
|
||||
#define AB8500_DITHERCLKCTRL_VSMPS1DITHERENA BIT(2)
|
||||
#define AB8500_DITHERCLKCTRL_VSMPS2DITHERENA BIT(3)
|
||||
#define AB8500_DITHERCLKCTRL_VMODDITHERENA BIT(4)
|
||||
#define AB8500_DITHERCLKCTRL_VAPEDITHERENA BIT(5)
|
||||
#define AB8500_DITHERCLKCTRL_DITHERDEL_MASK 0xC0
|
||||
#define AB8500_DITHERCLKCTRL_DITHERDEL_SHIFT 6
|
||||
|
||||
#define AB8500_SWATCTRL_UPDATERF BIT(0)
|
||||
#define AB8500_SWATCTRL_SWATENABLE BIT(1)
|
||||
#define AB8500_SWATCTRL_RFOFFTIMER_MASK 0x1C
|
||||
#define AB8500_SWATCTRL_RFOFFTIMER_SHIFT 2
|
||||
#define AB8500_SWATCTRL_SWATBIT5 BIT(6)
|
||||
|
||||
#define AB8500_HIQCLKCTRL_SYSCLKREQ1HIQENAVALID BIT(0)
|
||||
#define AB8500_HIQCLKCTRL_SYSCLKREQ2HIQENAVALID BIT(1)
|
||||
#define AB8500_HIQCLKCTRL_SYSCLKREQ3HIQENAVALID BIT(2)
|
||||
#define AB8500_HIQCLKCTRL_SYSCLKREQ4HIQENAVALID BIT(3)
|
||||
#define AB8500_HIQCLKCTRL_SYSCLKREQ5HIQENAVALID BIT(4)
|
||||
#define AB8500_HIQCLKCTRL_SYSCLKREQ6HIQENAVALID BIT(5)
|
||||
#define AB8500_HIQCLKCTRL_SYSCLKREQ7HIQENAVALID BIT(6)
|
||||
#define AB8500_HIQCLKCTRL_SYSCLKREQ8HIQENAVALID BIT(7)
|
||||
|
||||
#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ1VALID BIT(0)
|
||||
#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ2VALID BIT(1)
|
||||
#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ3VALID BIT(2)
|
||||
#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ4VALID BIT(3)
|
||||
#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ5VALID BIT(4)
|
||||
#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ6VALID BIT(5)
|
||||
#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ7VALID BIT(6)
|
||||
#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ8VALID BIT(7)
|
||||
|
||||
#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF1ENA BIT(0)
|
||||
#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF2ENA BIT(1)
|
||||
#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF3ENA BIT(2)
|
||||
#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF4ENA BIT(3)
|
||||
#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUFENA_MASK 0x0F
|
||||
#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF1STRE BIT(4)
|
||||
#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF2STRE BIT(5)
|
||||
#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF3STRE BIT(6)
|
||||
#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF4STRE BIT(7)
|
||||
#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUFSTRE_MASK 0xF0
|
||||
|
||||
#define AB9540_SYSCLK12CONFCTRL_PLL26TO38ENA BIT(0)
|
||||
#define AB9540_SYSCLK12CONFCTRL_SYSCLK12USBMUXSEL BIT(1)
|
||||
#define AB9540_SYSCLK12CONFCTRL_INT384MHZMUXSEL0 BIT(2)
|
||||
#define AB9540_SYSCLK12CONFCTRL_INT384MHZMUXSEL1 BIT(3)
|
||||
#define AB9540_SYSCLK12CONFCTRL_SYSCLK12BUFMUX BIT(4)
|
||||
#define AB9540_SYSCLK12CONFCTRL_SYSCLK12PLLMUX BIT(5)
|
||||
#define AB9540_SYSCLK12CONFCTRL_SYSCLK2MUXVALID BIT(6)
|
||||
|
||||
#define AB9540_SYSCLK12BUFCTRL2_SYSCLK12BUF1PDENA BIT(0)
|
||||
#define AB9540_SYSCLK12BUFCTRL2_SYSCLK12BUF2PDENA BIT(1)
|
||||
#define AB9540_SYSCLK12BUFCTRL2_SYSCLK12BUF3PDENA BIT(2)
|
||||
#define AB9540_SYSCLK12BUFCTRL2_SYSCLK12BUF4PDENA BIT(3)
|
||||
|
||||
#define AB9540_SYSCLK12BUF1VALID_SYSCLK12BUF1VALID_MASK 0xFF
|
||||
#define AB9540_SYSCLK12BUF1VALID_SYSCLK12BUF1VALID_SHIFT 0
|
||||
|
||||
#define AB9540_SYSCLK12BUF2VALID_SYSCLK12BUF2VALID_MASK 0xFF
|
||||
#define AB9540_SYSCLK12BUF2VALID_SYSCLK12BUF2VALID_SHIFT 0
|
||||
|
||||
#define AB9540_SYSCLK12BUF3VALID_SYSCLK12BUF3VALID_MASK 0xFF
|
||||
#define AB9540_SYSCLK12BUF3VALID_SYSCLK12BUF3VALID_SHIFT 0
|
||||
|
||||
#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 */
|
516
include/linux/mfd/abx500/ab8500.h
Normal file
516
include/linux/mfd/abx500/ab8500.h
Normal file
|
@ -0,0 +1,516 @@
|
|||
/*
|
||||
* Copyright (C) ST-Ericsson SA 2010
|
||||
*
|
||||
* License Terms: GNU General Public License v2
|
||||
* Author: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
|
||||
*/
|
||||
#ifndef MFD_AB8500_H
|
||||
#define MFD_AB8500_H
|
||||
|
||||
#include <linux/atomic.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/irqdomain.h>
|
||||
|
||||
struct device;
|
||||
|
||||
/*
|
||||
* AB IC versions
|
||||
*
|
||||
* AB8500_VERSION_AB8500 should be 0xFF but will never be read as need a
|
||||
* non-supported multi-byte I2C access via PRCMU. Set to 0x00 to ease the
|
||||
* print of version string.
|
||||
*/
|
||||
enum ab8500_version {
|
||||
AB8500_VERSION_AB8500 = 0x0,
|
||||
AB8500_VERSION_AB8505 = 0x1,
|
||||
AB8500_VERSION_AB9540 = 0x2,
|
||||
AB8500_VERSION_AB8540 = 0x4,
|
||||
AB8500_VERSION_UNDEFINED,
|
||||
};
|
||||
|
||||
/* AB8500 CIDs*/
|
||||
#define AB8500_CUTEARLY 0x00
|
||||
#define AB8500_CUT1P0 0x10
|
||||
#define AB8500_CUT1P1 0x11
|
||||
#define AB8500_CUT1P2 0x12 /* Only valid for AB8540 */
|
||||
#define AB8500_CUT2P0 0x20
|
||||
#define AB8500_CUT3P0 0x30
|
||||
#define AB8500_CUT3P3 0x33
|
||||
|
||||
/*
|
||||
* AB8500 bank addresses
|
||||
*/
|
||||
#define AB8500_M_FSM_RANK 0x0
|
||||
#define AB8500_SYS_CTRL1_BLOCK 0x1
|
||||
#define AB8500_SYS_CTRL2_BLOCK 0x2
|
||||
#define AB8500_REGU_CTRL1 0x3
|
||||
#define AB8500_REGU_CTRL2 0x4
|
||||
#define AB8500_USB 0x5
|
||||
#define AB8500_TVOUT 0x6
|
||||
#define AB8500_DBI 0x7
|
||||
#define AB8500_ECI_AV_ACC 0x8
|
||||
#define AB8500_RESERVED 0x9
|
||||
#define AB8500_GPADC 0xA
|
||||
#define AB8500_CHARGER 0xB
|
||||
#define AB8500_GAS_GAUGE 0xC
|
||||
#define AB8500_AUDIO 0xD
|
||||
#define AB8500_INTERRUPT 0xE
|
||||
#define AB8500_RTC 0xF
|
||||
#define AB8500_MISC 0x10
|
||||
#define AB8500_DEVELOPMENT 0x11
|
||||
#define AB8500_DEBUG 0x12
|
||||
#define AB8500_PROD_TEST 0x13
|
||||
#define AB8500_STE_TEST 0x14
|
||||
#define AB8500_OTP_EMUL 0x15
|
||||
|
||||
/*
|
||||
* Interrupts
|
||||
* Values used to index into array ab8500_irq_regoffset[] defined in
|
||||
* drivers/mdf/ab8500-core.c
|
||||
*/
|
||||
/* Definitions for AB8500, AB9540 and AB8540 */
|
||||
/* ab8500_irq_regoffset[0] -> IT[Source|Latch|Mask]1 */
|
||||
#define AB8500_INT_MAIN_EXT_CH_NOT_OK 0 /* not 8505/9540 */
|
||||
#define AB8500_INT_UN_PLUG_TV_DET 1 /* not 8505/9540/8540 */
|
||||
#define AB8500_INT_PLUG_TV_DET 2 /* not 8505/9540/8540 */
|
||||
#define AB8500_INT_TEMP_WARM 3
|
||||
#define AB8500_INT_PON_KEY2DB_F 4
|
||||
#define AB8500_INT_PON_KEY2DB_R 5
|
||||
#define AB8500_INT_PON_KEY1DB_F 6
|
||||
#define AB8500_INT_PON_KEY1DB_R 7
|
||||
/* ab8500_irq_regoffset[1] -> IT[Source|Latch|Mask]2 */
|
||||
#define AB8500_INT_BATT_OVV 8
|
||||
#define AB8500_INT_MAIN_CH_UNPLUG_DET 10 /* not 8505/8540 */
|
||||
#define AB8500_INT_MAIN_CH_PLUG_DET 11 /* not 8505/8540 */
|
||||
#define AB8500_INT_VBUS_DET_F 14
|
||||
#define AB8500_INT_VBUS_DET_R 15
|
||||
/* ab8500_irq_regoffset[2] -> IT[Source|Latch|Mask]3 */
|
||||
#define AB8500_INT_VBUS_CH_DROP_END 16
|
||||
#define AB8500_INT_RTC_60S 17
|
||||
#define AB8500_INT_RTC_ALARM 18
|
||||
#define AB8540_INT_BIF_INT 19
|
||||
#define AB8500_INT_BAT_CTRL_INDB 20
|
||||
#define AB8500_INT_CH_WD_EXP 21
|
||||
#define AB8500_INT_VBUS_OVV 22
|
||||
#define AB8500_INT_MAIN_CH_DROP_END 23 /* not 8505/9540/8540 */
|
||||
/* ab8500_irq_regoffset[3] -> IT[Source|Latch|Mask]4 */
|
||||
#define AB8500_INT_CCN_CONV_ACC 24
|
||||
#define AB8500_INT_INT_AUD 25
|
||||
#define AB8500_INT_CCEOC 26
|
||||
#define AB8500_INT_CC_INT_CALIB 27
|
||||
#define AB8500_INT_LOW_BAT_F 28
|
||||
#define AB8500_INT_LOW_BAT_R 29
|
||||
#define AB8500_INT_BUP_CHG_NOT_OK 30
|
||||
#define AB8500_INT_BUP_CHG_OK 31
|
||||
/* ab8500_irq_regoffset[4] -> IT[Source|Latch|Mask]5 */
|
||||
#define AB8500_INT_GP_HW_ADC_CONV_END 32 /* not 8505/8540 */
|
||||
#define AB8500_INT_ACC_DETECT_1DB_F 33
|
||||
#define AB8500_INT_ACC_DETECT_1DB_R 34
|
||||
#define AB8500_INT_ACC_DETECT_22DB_F 35
|
||||
#define AB8500_INT_ACC_DETECT_22DB_R 36
|
||||
#define AB8500_INT_ACC_DETECT_21DB_F 37
|
||||
#define AB8500_INT_ACC_DETECT_21DB_R 38
|
||||
#define AB8500_INT_GP_SW_ADC_CONV_END 39
|
||||
/* ab8500_irq_regoffset[5] -> IT[Source|Latch|Mask]7 */
|
||||
#define AB8500_INT_GPIO6R 40 /* not 8505/9540/8540 */
|
||||
#define AB8500_INT_GPIO7R 41 /* not 8505/9540/8540 */
|
||||
#define AB8500_INT_GPIO8R 42 /* not 8505/9540/8540 */
|
||||
#define AB8500_INT_GPIO9R 43 /* not 8505/9540/8540 */
|
||||
#define AB8500_INT_GPIO10R 44 /* not 8540 */
|
||||
#define AB8500_INT_GPIO11R 45 /* not 8540 */
|
||||
#define AB8500_INT_GPIO12R 46 /* not 8505/8540 */
|
||||
#define AB8500_INT_GPIO13R 47 /* not 8540 */
|
||||
/* ab8500_irq_regoffset[6] -> IT[Source|Latch|Mask]8 */
|
||||
#define AB8500_INT_GPIO24R 48 /* not 8505/8540 */
|
||||
#define AB8500_INT_GPIO25R 49 /* not 8505/8540 */
|
||||
#define AB8500_INT_GPIO36R 50 /* not 8505/9540/8540 */
|
||||
#define AB8500_INT_GPIO37R 51 /* not 8505/9540/8540 */
|
||||
#define AB8500_INT_GPIO38R 52 /* not 8505/9540/8540 */
|
||||
#define AB8500_INT_GPIO39R 53 /* not 8505/9540/8540 */
|
||||
#define AB8500_INT_GPIO40R 54 /* not 8540 */
|
||||
#define AB8500_INT_GPIO41R 55 /* not 8540 */
|
||||
/* ab8500_irq_regoffset[7] -> IT[Source|Latch|Mask]9 */
|
||||
#define AB8500_INT_GPIO6F 56 /* not 8505/9540 */
|
||||
#define AB8500_INT_GPIO7F 57 /* not 8505/9540 */
|
||||
#define AB8500_INT_GPIO8F 58 /* not 8505/9540 */
|
||||
#define AB8500_INT_GPIO9F 59 /* not 8505/9540 */
|
||||
#define AB8500_INT_GPIO10F 60
|
||||
#define AB8500_INT_GPIO11F 61
|
||||
#define AB8500_INT_GPIO12F 62 /* not 8505 */
|
||||
#define AB8500_INT_GPIO13F 63
|
||||
/* ab8500_irq_regoffset[8] -> IT[Source|Latch|Mask]10 */
|
||||
#define AB8500_INT_GPIO24F 64 /* not 8505/8540 */
|
||||
#define AB8500_INT_GPIO25F 65 /* not 8505/8540 */
|
||||
#define AB8500_INT_GPIO36F 66 /* not 8505/9540/8540 */
|
||||
#define AB8500_INT_GPIO37F 67 /* not 8505/9540/8540 */
|
||||
#define AB8500_INT_GPIO38F 68 /* not 8505/9540/8540 */
|
||||
#define AB8500_INT_GPIO39F 69 /* not 8505/9540/8540 */
|
||||
#define AB8500_INT_GPIO40F 70 /* not 8540 */
|
||||
#define AB8500_INT_GPIO41F 71 /* not 8540 */
|
||||
/* ab8500_irq_regoffset[9] -> IT[Source|Latch|Mask]12 */
|
||||
#define AB8500_INT_ADP_SOURCE_ERROR 72
|
||||
#define AB8500_INT_ADP_SINK_ERROR 73
|
||||
#define AB8500_INT_ADP_PROBE_PLUG 74
|
||||
#define AB8500_INT_ADP_PROBE_UNPLUG 75
|
||||
#define AB8500_INT_ADP_SENSE_OFF 76
|
||||
#define AB8500_INT_USB_PHY_POWER_ERR 78
|
||||
#define AB8500_INT_USB_LINK_STATUS 79
|
||||
/* ab8500_irq_regoffset[10] -> IT[Source|Latch|Mask]19 */
|
||||
#define AB8500_INT_BTEMP_LOW 80
|
||||
#define AB8500_INT_BTEMP_LOW_MEDIUM 81
|
||||
#define AB8500_INT_BTEMP_MEDIUM_HIGH 82
|
||||
#define AB8500_INT_BTEMP_HIGH 83
|
||||
/* ab8500_irq_regoffset[11] -> IT[Source|Latch|Mask]20 */
|
||||
#define AB8500_INT_SRP_DETECT 88
|
||||
#define AB8500_INT_USB_CHARGER_NOT_OKR 89
|
||||
#define AB8500_INT_ID_WAKEUP_R 90
|
||||
#define AB8500_INT_ID_DET_PLUGR 91 /* 8505/9540 cut2.0 */
|
||||
#define AB8500_INT_ID_DET_R1R 92
|
||||
#define AB8500_INT_ID_DET_R2R 93
|
||||
#define AB8500_INT_ID_DET_R3R 94
|
||||
#define AB8500_INT_ID_DET_R4R 95
|
||||
/* ab8500_irq_regoffset[12] -> IT[Source|Latch|Mask]21 */
|
||||
#define AB8500_INT_ID_WAKEUP_F 96 /* not 8505/9540 */
|
||||
#define AB8500_INT_ID_DET_PLUGF 97 /* 8505/9540 cut2.0 */
|
||||
#define AB8500_INT_ID_DET_R1F 98 /* not 8505/9540 */
|
||||
#define AB8500_INT_ID_DET_R2F 99 /* not 8505/9540 */
|
||||
#define AB8500_INT_ID_DET_R3F 100 /* not 8505/9540 */
|
||||
#define AB8500_INT_ID_DET_R4F 101 /* not 8505/9540 */
|
||||
#define AB8500_INT_CHAUTORESTARTAFTSEC 102 /* not 8505/9540 */
|
||||
#define AB8500_INT_CHSTOPBYSEC 103
|
||||
/* ab8500_irq_regoffset[13] -> IT[Source|Latch|Mask]22 */
|
||||
#define AB8500_INT_USB_CH_TH_PROT_F 104
|
||||
#define AB8500_INT_USB_CH_TH_PROT_R 105
|
||||
#define AB8500_INT_MAIN_CH_TH_PROT_F 106 /* not 8505/9540 */
|
||||
#define AB8500_INT_MAIN_CH_TH_PROT_R 107 /* not 8505/9540 */
|
||||
#define AB8500_INT_CHCURLIMNOHSCHIRP 109
|
||||
#define AB8500_INT_CHCURLIMHSCHIRP 110
|
||||
#define AB8500_INT_XTAL32K_KO 111
|
||||
|
||||
/* Definitions for AB9540 / AB8505 */
|
||||
/* ab8500_irq_regoffset[14] -> IT[Source|Latch|Mask]13 */
|
||||
#define AB9540_INT_GPIO50R 113 /* not 8540 */
|
||||
#define AB9540_INT_GPIO51R 114 /* not 8505/8540 */
|
||||
#define AB9540_INT_GPIO52R 115 /* not 8540 */
|
||||
#define AB9540_INT_GPIO53R 116 /* not 8540 */
|
||||
#define AB9540_INT_GPIO54R 117 /* not 8505/8540 */
|
||||
#define AB9540_INT_IEXT_CH_RF_BFN_R 118
|
||||
/* ab8500_irq_regoffset[15] -> IT[Source|Latch|Mask]14 */
|
||||
#define AB9540_INT_GPIO50F 121 /* not 8540 */
|
||||
#define AB9540_INT_GPIO51F 122 /* not 8505/8540 */
|
||||
#define AB9540_INT_GPIO52F 123 /* not 8540 */
|
||||
#define AB9540_INT_GPIO53F 124 /* not 8540 */
|
||||
#define AB9540_INT_GPIO54F 125 /* not 8505/8540 */
|
||||
#define AB9540_INT_IEXT_CH_RF_BFN_F 126
|
||||
/* ab8500_irq_regoffset[16] -> IT[Source|Latch|Mask]25 */
|
||||
#define AB8505_INT_KEYSTUCK 128
|
||||
#define AB8505_INT_IKR 129
|
||||
#define AB8505_INT_IKP 130
|
||||
#define AB8505_INT_KP 131
|
||||
#define AB8505_INT_KEYDEGLITCH 132
|
||||
#define AB8505_INT_MODPWRSTATUSF 134
|
||||
#define AB8505_INT_MODPWRSTATUSR 135
|
||||
/* ab8500_irq_regoffset[17] -> IT[Source|Latch|Mask]6 */
|
||||
#define AB8500_INT_HOOK_DET_NEG_F 138
|
||||
#define AB8500_INT_HOOK_DET_NEG_R 139
|
||||
#define AB8500_INT_HOOK_DET_POS_F 140
|
||||
#define AB8500_INT_HOOK_DET_POS_R 141
|
||||
#define AB8500_INT_PLUG_DET_COMP_F 142
|
||||
#define AB8500_INT_PLUG_DET_COMP_R 143
|
||||
/* ab8500_irq_regoffset[18] -> IT[Source|Latch|Mask]23 */
|
||||
#define AB8505_INT_COLL 144
|
||||
#define AB8505_INT_RESERR 145
|
||||
#define AB8505_INT_FRAERR 146
|
||||
#define AB8505_INT_COMERR 147
|
||||
#define AB8505_INT_SPDSET 148
|
||||
#define AB8505_INT_DSENT 149
|
||||
#define AB8505_INT_DREC 150
|
||||
#define AB8505_INT_ACC_INT 151
|
||||
/* ab8500_irq_regoffset[19] -> IT[Source|Latch|Mask]24 */
|
||||
#define AB8505_INT_NOPINT 152
|
||||
/* ab8540_irq_regoffset[20] -> IT[Source|Latch|Mask]26 */
|
||||
#define AB8540_INT_IDPLUGDETCOMPF 160
|
||||
#define AB8540_INT_IDPLUGDETCOMPR 161
|
||||
#define AB8540_INT_FMDETCOMPLOF 162
|
||||
#define AB8540_INT_FMDETCOMPLOR 163
|
||||
#define AB8540_INT_FMDETCOMPHIF 164
|
||||
#define AB8540_INT_FMDETCOMPHIR 165
|
||||
#define AB8540_INT_ID5VDETCOMPF 166
|
||||
#define AB8540_INT_ID5VDETCOMPR 167
|
||||
/* ab8540_irq_regoffset[21] -> IT[Source|Latch|Mask]27 */
|
||||
#define AB8540_INT_GPIO43F 168
|
||||
#define AB8540_INT_GPIO43R 169
|
||||
#define AB8540_INT_GPIO44F 170
|
||||
#define AB8540_INT_GPIO44R 171
|
||||
#define AB8540_INT_KEYPOSDETCOMPF 172
|
||||
#define AB8540_INT_KEYPOSDETCOMPR 173
|
||||
#define AB8540_INT_KEYNEGDETCOMPF 174
|
||||
#define AB8540_INT_KEYNEGDETCOMPR 175
|
||||
/* ab8540_irq_regoffset[22] -> IT[Source|Latch|Mask]28 */
|
||||
#define AB8540_INT_GPIO1VBATF 176
|
||||
#define AB8540_INT_GPIO1VBATR 177
|
||||
#define AB8540_INT_GPIO2VBATF 178
|
||||
#define AB8540_INT_GPIO2VBATR 179
|
||||
#define AB8540_INT_GPIO3VBATF 180
|
||||
#define AB8540_INT_GPIO3VBATR 181
|
||||
#define AB8540_INT_GPIO4VBATF 182
|
||||
#define AB8540_INT_GPIO4VBATR 183
|
||||
/* ab8540_irq_regoffset[23] -> IT[Source|Latch|Mask]29 */
|
||||
#define AB8540_INT_SYSCLKREQ2F 184
|
||||
#define AB8540_INT_SYSCLKREQ2R 185
|
||||
#define AB8540_INT_SYSCLKREQ3F 186
|
||||
#define AB8540_INT_SYSCLKREQ3R 187
|
||||
#define AB8540_INT_SYSCLKREQ4F 188
|
||||
#define AB8540_INT_SYSCLKREQ4R 189
|
||||
#define AB8540_INT_SYSCLKREQ5F 190
|
||||
#define AB8540_INT_SYSCLKREQ5R 191
|
||||
/* ab8540_irq_regoffset[24] -> IT[Source|Latch|Mask]30 */
|
||||
#define AB8540_INT_PWMOUT1F 192
|
||||
#define AB8540_INT_PWMOUT1R 193
|
||||
#define AB8540_INT_PWMCTRL0F 194
|
||||
#define AB8540_INT_PWMCTRL0R 195
|
||||
#define AB8540_INT_PWMCTRL1F 196
|
||||
#define AB8540_INT_PWMCTRL1R 197
|
||||
#define AB8540_INT_SYSCLKREQ6F 198
|
||||
#define AB8540_INT_SYSCLKREQ6R 199
|
||||
/* ab8540_irq_regoffset[25] -> IT[Source|Latch|Mask]31 */
|
||||
#define AB8540_INT_PWMEXTVIBRA1F 200
|
||||
#define AB8540_INT_PWMEXTVIBRA1R 201
|
||||
#define AB8540_INT_PWMEXTVIBRA2F 202
|
||||
#define AB8540_INT_PWMEXTVIBRA2R 203
|
||||
#define AB8540_INT_PWMOUT2F 204
|
||||
#define AB8540_INT_PWMOUT2R 205
|
||||
#define AB8540_INT_PWMOUT3F 206
|
||||
#define AB8540_INT_PWMOUT3R 207
|
||||
/* ab8540_irq_regoffset[26] -> IT[Source|Latch|Mask]32 */
|
||||
#define AB8540_INT_ADDATA2F 208
|
||||
#define AB8540_INT_ADDATA2R 209
|
||||
#define AB8540_INT_DADATA2F 210
|
||||
#define AB8540_INT_DADATA2R 211
|
||||
#define AB8540_INT_FSYNC2F 212
|
||||
#define AB8540_INT_FSYNC2R 213
|
||||
#define AB8540_INT_BITCLK2F 214
|
||||
#define AB8540_INT_BITCLK2R 215
|
||||
/* ab8540_irq_regoffset[27] -> IT[Source|Latch|Mask]33 */
|
||||
#define AB8540_INT_RTC_1S 216
|
||||
|
||||
/*
|
||||
* AB8500_AB9540_NR_IRQS is used when configuring the IRQ numbers for the
|
||||
* entire platform. This is a "compile time" constant so this must be set to
|
||||
* the largest possible value that may be encountered with different AB SOCs.
|
||||
* Of the currently supported AB devices, AB8500 and AB9540, it is the AB9540
|
||||
* which is larger.
|
||||
*/
|
||||
#define AB8500_NR_IRQS 112
|
||||
#define AB8505_NR_IRQS 153
|
||||
#define AB9540_NR_IRQS 153
|
||||
#define AB8540_NR_IRQS 216
|
||||
/* This is set to the roof of any AB8500 chip variant IRQ counts */
|
||||
#define AB8500_MAX_NR_IRQS AB8540_NR_IRQS
|
||||
|
||||
#define AB8500_NUM_IRQ_REGS 14
|
||||
#define AB9540_NUM_IRQ_REGS 20
|
||||
#define AB8540_NUM_IRQ_REGS 27
|
||||
|
||||
/* Turn On Status Event */
|
||||
#define AB8500_POR_ON_VBAT 0x01
|
||||
#define AB8500_POW_KEY_1_ON 0x02
|
||||
#define AB8500_POW_KEY_2_ON 0x04
|
||||
#define AB8500_RTC_ALARM 0x08
|
||||
#define AB8500_MAIN_CH_DET 0x10
|
||||
#define AB8500_VBUS_DET 0x20
|
||||
#define AB8500_USB_ID_DET 0x40
|
||||
|
||||
/**
|
||||
* struct ab8500 - ab8500 internal structure
|
||||
* @dev: parent device
|
||||
* @lock: read/write operations lock
|
||||
* @irq_lock: genirq bus lock
|
||||
* @transfer_ongoing: 0 if no transfer ongoing
|
||||
* @irq: irq line
|
||||
* @irq_domain: irq domain
|
||||
* @version: chip version id (e.g. ab8500 or ab9540)
|
||||
* @chip_id: chip revision id
|
||||
* @write: register write
|
||||
* @write_masked: masked register write
|
||||
* @read: register read
|
||||
* @rx_buf: rx buf for SPI
|
||||
* @tx_buf: tx buf for SPI
|
||||
* @mask: cache of IRQ regs for bus lock
|
||||
* @oldmask: cache of previous IRQ regs for bus lock
|
||||
* @mask_size: Actual number of valid entries in mask[], oldmask[] and
|
||||
* irq_reg_offset
|
||||
* @irq_reg_offset: Array of offsets into IRQ registers
|
||||
*/
|
||||
struct ab8500 {
|
||||
struct device *dev;
|
||||
struct mutex lock;
|
||||
struct mutex irq_lock;
|
||||
atomic_t transfer_ongoing;
|
||||
int irq;
|
||||
struct irq_domain *domain;
|
||||
enum ab8500_version version;
|
||||
u8 chip_id;
|
||||
|
||||
int (*write)(struct ab8500 *ab8500, u16 addr, u8 data);
|
||||
int (*write_masked)(struct ab8500 *ab8500, u16 addr, u8 mask, u8 data);
|
||||
int (*read)(struct ab8500 *ab8500, u16 addr);
|
||||
|
||||
unsigned long tx_buf[4];
|
||||
unsigned long rx_buf[4];
|
||||
|
||||
u8 *mask;
|
||||
u8 *oldmask;
|
||||
int mask_size;
|
||||
const int *irq_reg_offset;
|
||||
int it_latchhier_num;
|
||||
};
|
||||
|
||||
struct ab8500_regulator_platform_data;
|
||||
struct ab8500_codec_platform_data;
|
||||
struct ab8500_sysctrl_platform_data;
|
||||
|
||||
/**
|
||||
* struct ab8500_platform_data - AB8500 platform data
|
||||
* @irq_base: start of AB8500 IRQs, AB8500_NR_IRQS will be used
|
||||
* @init: board-specific initialization after detection of ab8500
|
||||
* @regulator: machine-specific constraints for regulators
|
||||
*/
|
||||
struct ab8500_platform_data {
|
||||
void (*init) (struct ab8500 *);
|
||||
struct ab8500_regulator_platform_data *regulator;
|
||||
struct ab8500_codec_platform_data *codec;
|
||||
struct ab8500_sysctrl_platform_data *sysctrl;
|
||||
};
|
||||
|
||||
extern int ab8500_init(struct ab8500 *ab8500,
|
||||
enum ab8500_version version);
|
||||
extern int ab8500_exit(struct ab8500 *ab8500);
|
||||
|
||||
extern int ab8500_suspend(struct ab8500 *ab8500);
|
||||
|
||||
static inline int is_ab8500(struct ab8500 *ab)
|
||||
{
|
||||
return ab->version == AB8500_VERSION_AB8500;
|
||||
}
|
||||
|
||||
static inline int is_ab8505(struct ab8500 *ab)
|
||||
{
|
||||
return ab->version == AB8500_VERSION_AB8505;
|
||||
}
|
||||
|
||||
static inline int is_ab9540(struct ab8500 *ab)
|
||||
{
|
||||
return ab->version == AB8500_VERSION_AB9540;
|
||||
}
|
||||
|
||||
static inline int is_ab8540(struct ab8500 *ab)
|
||||
{
|
||||
return ab->version == AB8500_VERSION_AB8540;
|
||||
}
|
||||
|
||||
/* exclude also ab8505, ab9540... */
|
||||
static inline int is_ab8500_1p0_or_earlier(struct ab8500 *ab)
|
||||
{
|
||||
return (is_ab8500(ab) && (ab->chip_id <= AB8500_CUT1P0));
|
||||
}
|
||||
|
||||
/* exclude also ab8505, ab9540... */
|
||||
static inline int is_ab8500_1p1_or_earlier(struct ab8500 *ab)
|
||||
{
|
||||
return (is_ab8500(ab) && (ab->chip_id <= AB8500_CUT1P1));
|
||||
}
|
||||
|
||||
/* exclude also ab8505, ab9540... */
|
||||
static inline int is_ab8500_2p0_or_earlier(struct ab8500 *ab)
|
||||
{
|
||||
return (is_ab8500(ab) && (ab->chip_id <= AB8500_CUT2P0));
|
||||
}
|
||||
|
||||
static inline int is_ab8500_3p3_or_earlier(struct ab8500 *ab)
|
||||
{
|
||||
return (is_ab8500(ab) && (ab->chip_id <= AB8500_CUT3P3));
|
||||
}
|
||||
|
||||
/* exclude also ab8505, ab9540... */
|
||||
static inline int is_ab8500_2p0(struct ab8500 *ab)
|
||||
{
|
||||
return (is_ab8500(ab) && (ab->chip_id == AB8500_CUT2P0));
|
||||
}
|
||||
|
||||
static inline int is_ab8505_1p0_or_earlier(struct ab8500 *ab)
|
||||
{
|
||||
return (is_ab8505(ab) && (ab->chip_id <= AB8500_CUT1P0));
|
||||
}
|
||||
|
||||
static inline int is_ab8505_2p0(struct ab8500 *ab)
|
||||
{
|
||||
return (is_ab8505(ab) && (ab->chip_id == AB8500_CUT2P0));
|
||||
}
|
||||
|
||||
static inline int is_ab9540_1p0_or_earlier(struct ab8500 *ab)
|
||||
{
|
||||
return (is_ab9540(ab) && (ab->chip_id <= AB8500_CUT1P0));
|
||||
}
|
||||
|
||||
static inline int is_ab9540_2p0(struct ab8500 *ab)
|
||||
{
|
||||
return (is_ab9540(ab) && (ab->chip_id == AB8500_CUT2P0));
|
||||
}
|
||||
|
||||
/*
|
||||
* Be careful, the marketing name for this chip is 2.1
|
||||
* but the value read from the chip is 3.0 (0x30)
|
||||
*/
|
||||
static inline int is_ab9540_3p0(struct ab8500 *ab)
|
||||
{
|
||||
return (is_ab9540(ab) && (ab->chip_id == AB8500_CUT3P0));
|
||||
}
|
||||
|
||||
static inline int is_ab8540_1p0_or_earlier(struct ab8500 *ab)
|
||||
{
|
||||
return is_ab8540(ab) && (ab->chip_id <= AB8500_CUT1P0);
|
||||
}
|
||||
|
||||
static inline int is_ab8540_1p1_or_earlier(struct ab8500 *ab)
|
||||
{
|
||||
return is_ab8540(ab) && (ab->chip_id <= AB8500_CUT1P1);
|
||||
}
|
||||
|
||||
static inline int is_ab8540_1p2_or_earlier(struct ab8500 *ab)
|
||||
{
|
||||
return is_ab8540(ab) && (ab->chip_id <= AB8500_CUT1P2);
|
||||
}
|
||||
|
||||
static inline int is_ab8540_2p0_or_earlier(struct ab8500 *ab)
|
||||
{
|
||||
return is_ab8540(ab) && (ab->chip_id <= AB8500_CUT2P0);
|
||||
}
|
||||
|
||||
static inline int is_ab8540_2p0(struct ab8500 *ab)
|
||||
{
|
||||
return is_ab8540(ab) && (ab->chip_id == AB8500_CUT2P0);
|
||||
}
|
||||
|
||||
static inline int is_ab8505_2p0_earlier(struct ab8500 *ab)
|
||||
{
|
||||
return (is_ab8505(ab) && (ab->chip_id < AB8500_CUT2P0));
|
||||
}
|
||||
|
||||
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
|
||||
extern int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
|
||||
void ab8500_dump_all_banks(struct device *dev);
|
||||
void ab8500_debug_register_interrupt(int line);
|
||||
#else
|
||||
static inline void ab8500_dump_all_banks(struct device *dev) {}
|
||||
static inline void ab8500_debug_register_interrupt(int line) {}
|
||||
#endif
|
||||
|
||||
#endif /* MFD_AB8500_H */
|
50
include/linux/mfd/abx500/ux500_chargalg.h
Normal file
50
include/linux/mfd/abx500/ux500_chargalg.h
Normal file
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright (C) ST-Ericsson SA 2012
|
||||
* Author: Johan Gardsmark <johan.gardsmark@stericsson.com> for ST-Ericsson.
|
||||
* License terms: GNU General Public License (GPL), version 2
|
||||
*/
|
||||
|
||||
#ifndef _UX500_CHARGALG_H
|
||||
#define _UX500_CHARGALG_H
|
||||
|
||||
#include <linux/power_supply.h>
|
||||
|
||||
#define psy_to_ux500_charger(x) container_of((x), \
|
||||
struct ux500_charger, psy)
|
||||
|
||||
/* Forward declaration */
|
||||
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);
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ux500_charger - power supply ux500 charger sub class
|
||||
* @psy power supply base class
|
||||
* @ops ux500 charger operations
|
||||
* @max_out_volt maximum output charger voltage in mV
|
||||
* @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;
|
||||
struct ux500_charger_ops ops;
|
||||
int max_out_volt;
|
||||
int max_out_curr;
|
||||
int wdt_refresh;
|
||||
bool enabled;
|
||||
bool external;
|
||||
bool power_path;
|
||||
};
|
||||
|
||||
extern struct blocking_notifier_head charger_notifier_list;
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue