From 4bb0e2f4de671fbf727965245515dce236dd418e Mon Sep 17 00:00:00 2001 From: Greg Meiste Date: Fri, 28 May 2010 15:17:21 -0500 Subject: [PATCH] regulator: cpcap: Add support for SW2 and SW4 Will be needed for DVS Change-Id: I56da93ae33c1b9a01b80a703d978f6ca3cc6a0e3 Signed-off-by: Greg Meiste --- drivers/regulator/cpcap-regulator.c | 35 +++++++++++++++++++++++++++++ include/linux/spi/cpcap.h | 10 +++++---- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/drivers/regulator/cpcap-regulator.c b/drivers/regulator/cpcap-regulator.c index d3049ad26f93..b15986949cd0 100644 --- a/drivers/regulator/cpcap-regulator.c +++ b/drivers/regulator/cpcap-regulator.c @@ -41,6 +41,10 @@ } +#define SW2_SW4_VAL_TBL_SIZE 69 +#define SW2_SW4_VAL_TBL_STEP 12500 + +static int sw2_sw4_val_tbl[SW2_SW4_VAL_TBL_SIZE]; static const int sw5_val_tbl[] = {0, 5050000}; static const int vcam_val_tbl[] = {2600000, 2700000, 2800000, 2900000}; static const int vcsi_val_tbl[] = {1200000, 1800000}; @@ -77,6 +81,30 @@ static struct { const unsigned int volt_trans_time; /* in micro seconds */ const unsigned int turn_on_time; /* in micro seconds */ } cpcap_regltr_data[CPCAP_NUM_REGULATORS] = { + [CPCAP_SW2] = {CPCAP_REG_S2C1, + 0x0F00, + 0x007F, + 0, + 0x0000, + 0x0000, + ARRAY_SIZE(sw2_sw4_val_tbl), + sw2_sw4_val_tbl, + 0, + 120, + 1500}, + + [CPCAP_SW4] = {CPCAP_REG_S4C1, + 0x0F00, + 0x007F, + 0, + 0x0000, + 0x0000, + ARRAY_SIZE(sw2_sw4_val_tbl), + sw2_sw4_val_tbl, + 0, + 100, + 1500}, + [CPCAP_SW5] = {CPCAP_REG_S5C, 0x002A, 0x0000, @@ -483,6 +511,8 @@ static struct regulator_ops cpcap_regulator_ops = { }; static struct regulator_desc regulators[] = { + [CPCAP_SW2] = CPCAP_REGULATOR("sw2", CPCAP_SW2), + [CPCAP_SW4] = CPCAP_REGULATOR("sw4", CPCAP_SW4), [CPCAP_SW5] = CPCAP_REGULATOR("sw5", CPCAP_SW5), [CPCAP_VCAM] = CPCAP_REGULATOR("vcam", CPCAP_VCAM), [CPCAP_VCSI] = CPCAP_REGULATOR("vcsi", CPCAP_VCSI), @@ -558,6 +588,11 @@ static struct platform_driver cpcap_regulator_driver = { static int __init cpcap_regulator_init(void) { + int i; + + for (i = 0; i < SW2_SW4_VAL_TBL_SIZE; i++) + sw2_sw4_val_tbl[i] = 600000 + (i * SW2_SW4_VAL_TBL_STEP); + return platform_driver_register(&cpcap_regulator_driver); } subsys_initcall(cpcap_regulator_init); diff --git a/include/linux/spi/cpcap.h b/include/linux/spi/cpcap.h index 5e0d2b9e048d..a89396ff0ad4 100644 --- a/include/linux/spi/cpcap.h +++ b/include/linux/spi/cpcap.h @@ -26,7 +26,7 @@ #include #endif -#ifdef CONFIG_RTC_INTF_SECCLKD +#ifdef CONFIG_RTC_INTF_CPCAP_SECCLKD #include #endif @@ -44,6 +44,8 @@ #define CPCAP_WHISPER_ACCY_SHFT 27 enum cpcap_regulator_id { + CPCAP_SW2, + CPCAP_SW4, CPCAP_SW5, CPCAP_VCAM, CPCAP_VCSI, @@ -309,7 +311,7 @@ enum { CPCAP_IOCTL_NUM_UC_SET_TURBO_MODE, CPCAP_IOCTL_NUM_UC__END, -#ifdef CONFIG_RTC_INTF_SECCLKD +#ifdef CONFIG_RTC_INTF_CPCAP_SECCLKD CPCAP_IOCTL_NUM_RTC__START, CPCAP_IOCTL_NUM_RTC_COUNT, CPCAP_IOCTL_NUM_RTC__END, @@ -563,7 +565,7 @@ struct cpcap_batt_usb_data { enum cpcap_batt_usb_model model; }; -#ifdef CONFIG_RTC_INTF_SECCLKD +#ifdef CONFIG_RTC_INTF_CPCAP_SECCLKD struct cpcap_rtc_time_cnt { struct rtc_time time; unsigned short count; @@ -645,7 +647,7 @@ struct cpcap_regacc { * OUTPUTS: The command writes the register data back to user space at the * location specified, or it may return an error code. */ -#ifdef CONFIG_RTC_INTF_SECCLKD +#ifdef CONFIG_RTC_INTF_CPCAP_SECCLKD #define CPCAP_IOCTL_GET_RTC_TIME_COUNTER \ _IOR(0, CPCAP_IOCTL_NUM_RTC_COUNT, struct cpcap_rtc_time_cnt) #endif -- 2.34.1