regulator: cpcap: Add support for SW2 and SW4
authorGreg Meiste <w30289@motorola.com>
Fri, 28 May 2010 20:17:21 +0000 (15:17 -0500)
committerColin Cross <ccross@android.com>
Wed, 6 Oct 2010 23:33:01 +0000 (16:33 -0700)
Will be needed for DVS

Change-Id: I56da93ae33c1b9a01b80a703d978f6ca3cc6a0e3
Signed-off-by: Greg Meiste <w30289@motorola.com>
drivers/regulator/cpcap-regulator.c
include/linux/spi/cpcap.h

index d3049ad26f93057a91f67898a521293b8f36dace..b15986949cd0b347e5f03202700c2957c60b713e 100644 (file)
        }
 
 
+#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);
index 5e0d2b9e048db6f849b5cda71ff8b4f7430208d4..a89396ff0ad47b8ed6ed9cf599df20428412d1dc 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/platform_device.h>
 #endif
 
-#ifdef CONFIG_RTC_INTF_SECCLKD
+#ifdef CONFIG_RTC_INTF_CPCAP_SECCLKD
 #include <linux/rtc.h>
 #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