diff options
author | mokopatches <mokopatches@openmoko.org> | 2008-11-19 17:03:09 +0000 |
---|---|---|
committer | warmcat <andy@warmcat.com> | 2008-11-19 17:03:09 +0000 |
commit | 5027687a92982241ce930ff3c04a38a973f9030e (patch) | |
tree | bb86113f2fdec5554c746ce667a4023f4694ef3c /include | |
parent | 6c6a2b5bb5badea6648bed6bf0dc1033419f5397 (diff) |
gta01-pcf50606.patch
This is a NXP PCF50606 power management unit driver.
The PCF50606 is used in the FIC/OpenMoko Neo1973 GTA01 GSM phone.
Signed-off-by: Harald Welte <laforge@openmoko.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/i2c-id.h | 1 | ||||
-rw-r--r-- | include/linux/pcf50606.h | 108 |
2 files changed, 109 insertions, 0 deletions
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h index 01d67ba9e98..0709642816c 100644 --- a/include/linux/i2c-id.h +++ b/include/linux/i2c-id.h @@ -83,6 +83,7 @@ #define I2C_DRIVERID_CS5345 96 /* cs5345 audio processor */ #define I2C_DRIVERID_OV7670 1048 /* Omnivision 7670 camera */ +#define I2C_DRIVERID_PCF50606 1049 /* * ---- Adapter types ---------------------------------------------------- diff --git a/include/linux/pcf50606.h b/include/linux/pcf50606.h new file mode 100644 index 00000000000..bc98e476128 --- /dev/null +++ b/include/linux/pcf50606.h @@ -0,0 +1,108 @@ +#ifndef _LINUX_PCF50606_H +#define _LINUX_PCF50606_H + +/* public in-kernel pcf50606 api */ +enum pcf50606_regulator_id { + PCF50606_REGULATOR_DCD, + PCF50606_REGULATOR_DCDE, + PCF50606_REGULATOR_DCUD, + PCF50606_REGULATOR_D1REG, + PCF50606_REGULATOR_D2REG, + PCF50606_REGULATOR_D3REG, + PCF50606_REGULATOR_LPREG, + PCF50606_REGULATOR_IOREG, + __NUM_PCF50606_REGULATORS +}; + +struct pcf50606_data; + +/* This is an ugly construct on how to access the (currently single/global) + * pcf50606 handle from other code in the kernel. I didn't really come up with + * a more decent method of dynamically resolving this */ +extern struct pcf50606_data *pcf50606_global; + +extern void +pcf50606_go_standby(void); + +extern void +pcf50606_gpo0_set(struct pcf50606_data *pcf, int on); + +extern int +pcf50606_gpo0_get(struct pcf50606_data *pcf); + +extern int +pcf50606_voltage_set(struct pcf50606_data *pcf, + enum pcf50606_regulator_id reg, + unsigned int millivolts); +extern unsigned int +pcf50606_voltage_get(struct pcf50606_data *pcf, + enum pcf50606_regulator_id reg); +extern int +pcf50606_onoff_get(struct pcf50606_data *pcf, + enum pcf50606_regulator_id reg); + +extern int +pcf50606_onoff_set(struct pcf50606_data *pcf, + enum pcf50606_regulator_id reg, int on); + +extern void +pcf50606_charge_fast(struct pcf50606_data *pcf, int on); + +#define PMU_VRAIL_F_SUSPEND_ON 0x00000001 /* Remains on during suspend */ +#define PMU_VRAIL_F_UNUSED 0x00000002 /* This rail is not used */ +struct pmu_voltage_rail { + char *name; + unsigned int flags; + struct { + unsigned int init; + unsigned int max; + } voltage; +}; + +enum pmu_event { + PMU_EVT_NONE, + PMU_EVT_INSERT, + PMU_EVT_REMOVE, + __NUM_PMU_EVTS +}; + +typedef int pmu_cb(struct device *dev, unsigned int feature, + enum pmu_event event); + +#define PCF50606_FEAT_EXTON 0x00000001 /* not yet supported */ +#define PCF50606_FEAT_MBC 0x00000002 +#define PCF50606_FEAT_BBC 0x00000004 /* not yet supported */ +#define PCF50606_FEAT_TSC 0x00000008 /* not yet supported */ +#define PCF50606_FEAT_WDT 0x00000010 +#define PCF50606_FEAT_ACD 0x00000020 +#define PCF50606_FEAT_RTC 0x00000040 +#define PCF50606_FEAT_PWM 0x00000080 +#define PCF50606_FEAT_CHGCUR 0x00000100 +#define PCF50606_FEAT_BATVOLT 0x00000200 +#define PCF50606_FEAT_BATTEMP 0x00000400 +#define PCF50606_FEAT_PWM_BL 0x00000800 + +struct pcf50606_platform_data { + /* general */ + unsigned int used_features; + unsigned int onkey_seconds_required; + + /* voltage regulator related */ + struct pmu_voltage_rail rails[__NUM_PCF50606_REGULATORS]; + unsigned int used_regulators; + + /* charger related */ + unsigned int r_fix_batt; + unsigned int r_fix_batt_par; + unsigned int r_sense_milli; + + /* backlight related */ + unsigned int init_brightness; + + struct { + u_int8_t mbcc3; /* charger voltage / current */ + } charger; + pmu_cb *cb; +}; + +#endif |