diff options
author | Balaji Rao <balajirrao@openmoko.org> | 2008-11-20 19:46:51 +0000 |
---|---|---|
committer | Andy Green <agreen@pads.home.warmcat.com> | 2008-11-20 19:46:51 +0000 |
commit | 1df2598dfebdd1df5bb81c5c8d52fb311c49a7bb (patch) | |
tree | edc6e7a329ac854555216a310851a03328dbee51 | |
parent | 003285f5a73979c5909d829e50465b582ee6ccf5 (diff) |
remove_pcf50633_voltage_rails_and_friends.patch
1. Removes pmu_voltage_rails stuff and replaces it with regulator_init_data[]
2. Removes voltage_ldoX and other /sys attributes.
3. Introduces s3c2410_pm_begin method to call regulator_suspend_prepare()
-rw-r--r-- | arch/arm/mach-s3c2440/mach-gta02.c | 219 | ||||
-rw-r--r-- | arch/arm/plat-s3c24xx/pm.c | 12 | ||||
-rw-r--r-- | drivers/i2c/chips/pcf50633.c | 322 | ||||
-rw-r--r-- | drivers/regulator/pcf50633-regulator.c | 4 | ||||
-rw-r--r-- | include/linux/pcf50633.h | 20 |
5 files changed, 109 insertions, 468 deletions
diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c index d0d7476602b..340f45753e6 100644 --- a/arch/arm/mach-s3c2440/mach-gta02.c +++ b/arch/arm/mach-s3c2440/mach-gta02.c @@ -616,98 +616,76 @@ struct pcf50633_platform_data gta02_pcf_pdata = { /* warning: these get rewritten during machine init below * depending on pcb variant */ - .rails = { + .reg_init_data = { [PCF50633_REGULATOR_AUTO] = { - .name = "io_3v3", - .flags = PMU_VRAIL_F_SUSPEND_ON, - .voltage = { - .init = 3300, - .max = 3300, + .constraints = { + .min_uV = 3300000, + .max_uV = 3300000, + .valid_modes_mask = REGULATOR_MODE_NORMAL, + .apply_uV = 1, + .state_mem = { + .enabled = 1, + }, }, + .num_consumer_supplies = 0, }, [PCF50633_REGULATOR_DOWN1] = { - .name = "core_1v3", - /* Wow, when we are going into suspend, after pcf50633 - * runs its suspend (which happens real early since it - * is an i2c device) we are running out of the 22uF cap - * on core_1v3 rail !!!! - */ - .voltage = { - .init = 1300, - .max = 1600, + .constraints = { + .min_uV = 1300000, + .max_uV = 1600000, + .valid_modes_mask = REGULATOR_MODE_NORMAL, + .apply_uV = 1, }, + .num_consumer_supplies = 0, }, [PCF50633_REGULATOR_DOWN2] = { - .name = "core_1v8", - .flags = PMU_VRAIL_F_SUSPEND_ON, - .voltage = { - .init = 1800, - .max = 1800, + .constraints = { + .min_uV = 1800000, + .max_uV = 1800000, + .valid_modes_mask = REGULATOR_MODE_NORMAL, + .apply_uV = 1, + .state_mem = { + .enabled = 1, + }, }, + .num_consumer_supplies = 0, }, [PCF50633_REGULATOR_HCLDO] = { - .name = "sd_3v3", - .voltage = { - .init = 2000, - .max = 3300, + .constraints = { + .min_uV = 2000000, + .max_uV = 3300000, + .valid_modes_mask = REGULATOR_MODE_NORMAL, }, + .num_consumer_supplies = 1, + .consumer_supplies = hcldo_consumers, }, [PCF50633_REGULATOR_LDO1] = { - .name = "gsensor_3v3", - .voltage = { - .init = 1300, - .max = 1330, + .constraints = { + .min_uV = 1300000, + .max_uV = 1300000, + .valid_modes_mask = REGULATOR_MODE_NORMAL, + .apply_uV = 1, }, + .num_consumer_supplies = 0, }, [PCF50633_REGULATOR_LDO2] = { - .name = "codec_3v3", - .voltage = { - .init = 3300, - .max = 3300, + .constraints = { + .min_uV = 3300000, + .max_uV = 3300000, + .valid_modes_mask = REGULATOR_MODE_NORMAL, + .apply_uV = 1, }, + .num_consumer_supplies = 0, }, [PCF50633_REGULATOR_LDO3] = { - .name = "unused3", - .voltage = { - .init = 3000, - .max = 3000, - }, - }, - [PCF50633_REGULATOR_LDO4] = { - .name = "bt_3v2", - .voltage = { - .init = 2500, - .max = 3300, - }, - }, - [PCF50633_REGULATOR_LDO5] = { - .name = "rf3v", - .voltage = { - .init = 1500, - .max = 1500, - }, - }, - [PCF50633_REGULATOR_LDO6] = { - .name = "lcm_3v", - .flags = PMU_VRAIL_F_SUSPEND_ON, - .voltage = { - .init = 0, - .max = 3300, - }, - }, - [PCF50633_REGULATOR_MEMLDO] = { - .name = "memldo", - .flags = PMU_VRAIL_F_SUSPEND_ON, - .voltage = { - .init = 1800, - .max = 1800, + .constraints = { + .min_uV = 3000000, + .max_uV = 3000000, + .valid_modes_mask = REGULATOR_MODE_NORMAL, + .apply_uV = 1, }, + .num_consumer_supplies = 0, }, - }, - .attach_child_devices = gta02_pcf50633_attach_child_devices, - .regulator_registered = gta02_pcf50633_regulator_registered, - - .reg_init_data = { [PCF50633_REGULATOR_LDO4] = { .constraints = { .min_uV = 3200000, @@ -720,92 +698,83 @@ struct pcf50633_platform_data gta02_pcf_pdata = { }, [PCF50633_REGULATOR_LDO5] = { .constraints = { - .min_uV = 3000000, - .max_uV = 3000000, + .min_uV = 1500000, + .max_uV = 1500000, .valid_modes_mask = REGULATOR_MODE_NORMAL, .apply_uV = 1, }, .num_consumer_supplies = 1, .consumer_supplies = ldo5_consumers, }, - [PCF50633_REGULATOR_HCLDO] = { + [PCF50633_REGULATOR_LDO6] = { .constraints = { - .min_uV = 2000000, + .min_uV = 0, .max_uV = 3300000, .valid_modes_mask = REGULATOR_MODE_NORMAL, + .state_mem = { + .enabled = 1, + }, }, - .num_consumer_supplies = 1, - .consumer_supplies = hcldo_consumers, + .num_consumer_supplies = 0, + }, + [PCF50633_REGULATOR_MEMLDO] = { + .constraints = { + .min_uV = 1800000, + .max_uV = 1800000, + .valid_modes_mask = REGULATOR_MODE_NORMAL, + .state_mem = { + .enabled = 1, + }, + }, + .num_consumer_supplies = 0, }, }, - + .attach_child_devices = gta02_pcf50633_attach_child_devices, + .regulator_registered = gta02_pcf50633_regulator_registered, }; -#if 0 /* currently unused */ -static void cfg_pmu_vrail(struct pmu_voltage_rail *vrail, char *name, - unsigned int flags, unsigned int init, - unsigned int max) -{ - vrail->name = name; - vrail->flags = flags; - vrail->voltage.init = init; - vrail->voltage.max = max; -} -#endif - static void mangle_pmu_pdata_by_system_rev(void) { + struct regulator_init_data *reg_init_data; + + reg_init_data = gta02_pcf_pdata.reg_init_data; + switch (system_rev) { case GTA02v1_SYSTEM_REV: /* FIXME: this is only in v1 due to wrong PMU variant */ - gta02_pcf_pdata.rails[PCF50633_REGULATOR_DOWN2].flags = - PMU_VRAIL_F_SUSPEND_ON; + reg_init_data[PCF50633_REGULATOR_DOWN2] + .constraints.state_mem.enabled = 1; break; case GTA02v2_SYSTEM_REV: case GTA02v3_SYSTEM_REV: case GTA02v4_SYSTEM_REV: case GTA02v5_SYSTEM_REV: case GTA02v6_SYSTEM_REV: - /* we need to keep the 1.8V going since this is the SDRAM - * self-refresh voltage */ - gta02_pcf_pdata.rails[PCF50633_REGULATOR_DOWN2].flags = - PMU_VRAIL_F_SUSPEND_ON; - gta02_pcf_pdata.rails[PCF50633_REGULATOR_DOWN2].name = - "io_1v8", - gta02_pcf_pdata.rails[PCF50633_REGULATOR_LDO1].name = - "gsensor_3v3", - gta02_pcf_pdata.rails[PCF50633_REGULATOR_LDO1].voltage.init = - 3300; - gta02_pcf_pdata.rails[PCF50633_REGULATOR_LDO1].voltage.max = - 3300; - gta02_pcf_pdata.rails[PCF50633_REGULATOR_LDO1].flags &= - ~PMU_VRAIL_F_SUSPEND_ON; - gta02_pcf_pdata.rails[PCF50633_REGULATOR_LDO3].flags = - PMU_VRAIL_F_UNUSED; - gta02_pcf_pdata.rails[PCF50633_REGULATOR_LDO5] = ((struct pmu_voltage_rail) { - .name = "rf_3v", - .voltage = { - .init = 0, - .max = 3000, - } - }); - gta02_pcf_pdata.rails[PCF50633_REGULATOR_LDO6] = - ((struct pmu_voltage_rail) { - .name = "lcm_3v", - .flags = PMU_VRAIL_F_SUSPEND_ON, - .voltage = { - .init = 3000, - .max = 3000, - } - }); + reg_init_data[PCF50633_REGULATOR_LDO1] + .constraints.min_uV = 3300000; + reg_init_data[PCF50633_REGULATOR_LDO1] + .constraints.min_uV = 3300000; + reg_init_data[PCF50633_REGULATOR_LDO1] + .constraints.state_mem.enabled = 0; + + reg_init_data[PCF50633_REGULATOR_LDO5] + .constraints.min_uV = 3000000; + reg_init_data[PCF50633_REGULATOR_LDO5] + .constraints.max_uV = 3000000; + + reg_init_data[PCF50633_REGULATOR_LDO6] + .constraints.min_uV = 3000000; + reg_init_data[PCF50633_REGULATOR_LDO6] + .constraints.max_uV = 3000000; + reg_init_data[PCF50633_REGULATOR_LDO6] + .constraints.apply_uV = 1; break; default: break; } } - #ifdef CONFIG_GTA02_HDQ /* HDQ */ diff --git a/arch/arm/plat-s3c24xx/pm.c b/arch/arm/plat-s3c24xx/pm.c index bc37cf49f97..325631e2aed 100644 --- a/arch/arm/plat-s3c24xx/pm.c +++ b/arch/arm/plat-s3c24xx/pm.c @@ -36,6 +36,7 @@ #include <linux/delay.h> #include <linux/serial_core.h> #include <linux/io.h> +#include <linux/regulator/machine.h> #include <asm/cacheflush.h> #include <mach/hardware.h> @@ -795,9 +796,20 @@ static int s3c2410_pm_enter(suspend_state_t state) return 0; } +static int s3c2410_pm_begin(suspend_state_t state) +{ + int ret = 0; + +#ifdef CONFIG_REGULATOR + ret = regulator_suspend_prepare(state); +#endif + return ret; +} + static struct platform_suspend_ops s3c2410_pm_ops = { .enter = s3c2410_pm_enter, .valid = suspend_valid_only_mem, + .begin = s3c2410_pm_begin, }; /* s3c2410_pm_init diff --git a/drivers/i2c/chips/pcf50633.c b/drivers/i2c/chips/pcf50633.c index 87f7a844ee4..60b8b1d2764 100644 --- a/drivers/i2c/chips/pcf50633.c +++ b/drivers/i2c/chips/pcf50633.c @@ -215,200 +215,6 @@ static u_int16_t adc_read_result(struct pcf50633_data *pcf) return ret; } - - - -/*********************************************************************** - * Voltage / ADC - ***********************************************************************/ - -static u_int8_t auto_voltage(unsigned int millivolts) -{ - if (millivolts < 1800) - return 0; - if (millivolts > 3800) - return 0xff; - - millivolts -= 625; - return millivolts/25; -} - -static unsigned int auto_2voltage(u_int8_t bits) -{ - if (bits < 0x2f) - return 0; - return 625 + (bits * 25); -} - -static u_int8_t down_voltage(unsigned int millivolts) -{ - if (millivolts < 625) - return 0; - else if (millivolts > 3000) - return 0xff; - - millivolts -= 625; - return millivolts/25; -} - -static unsigned int down_2voltage(u_int8_t bits) -{ - return 625 + (bits*25); -} - -static u_int8_t ldo_voltage(unsigned int millivolts) -{ - if (millivolts < 900) - return 0; - else if (millivolts > 3600) - return 0x1f; - - millivolts -= 900; - return millivolts/100; -} - -static unsigned int ldo_2voltage(u_int8_t bits) -{ - bits &= 0x1f; - return 900 + (bits * 100); -} - -static const u_int8_t regulator_registers[__NUM_PCF50633_REGULATORS] = { - [PCF50633_REGULATOR_AUTO] = PCF50633_REG_AUTOOUT, - [PCF50633_REGULATOR_DOWN1] = PCF50633_REG_DOWN1OUT, - [PCF50633_REGULATOR_DOWN2] = PCF50633_REG_DOWN2OUT, - [PCF50633_REGULATOR_MEMLDO] = PCF50633_REG_MEMLDOOUT, - [PCF50633_REGULATOR_LDO1] = PCF50633_REG_LDO1OUT, - [PCF50633_REGULATOR_LDO2] = PCF50633_REG_LDO2OUT, - [PCF50633_REGULATOR_LDO3] = PCF50633_REG_LDO3OUT, - [PCF50633_REGULATOR_LDO4] = PCF50633_REG_LDO4OUT, - [PCF50633_REGULATOR_LDO5] = PCF50633_REG_LDO5OUT, - [PCF50633_REGULATOR_LDO6] = PCF50633_REG_LDO6OUT, - [PCF50633_REGULATOR_HCLDO] = PCF50633_REG_HCLDOOUT, -}; - -int pcf50633_onoff_set(struct pcf50633_data *pcf, - enum pcf50633_regulator_id reg, int on) -{ - u_int8_t addr; - - if (reg >= __NUM_PCF50633_REGULATORS) - return -EINVAL; - - /* the *ENA register is always one after the *OUT register */ - addr = regulator_registers[reg] + 1; - - if (on == 0) - pcf50633_reg_set_bit_mask(pcf, addr, PCF50633_REGULATOR_ON, 0); - else - pcf50633_reg_set_bit_mask(pcf, addr, PCF50633_REGULATOR_ON, - PCF50633_REGULATOR_ON); - - return 0; -} -EXPORT_SYMBOL_GPL(pcf50633_onoff_set); - -int pcf50633_onoff_get(struct pcf50633_data *pcf, - enum pcf50633_regulator_id reg) -{ - u_int8_t val, addr; - - if (reg >= __NUM_PCF50633_REGULATORS) - return -EINVAL; - - /* the *ENA register is always one after the *OUT register */ - addr = regulator_registers[reg] + 1; - val = pcf50633_reg_read(pcf, addr) & PCF50633_REGULATOR_ON; - - return val; -} -EXPORT_SYMBOL_GPL(pcf50633_onoff_get); - -int pcf50633_voltage_set(struct pcf50633_data *pcf, - enum pcf50633_regulator_id reg, - unsigned int millivolts) -{ - u_int8_t volt_bits; - u_int8_t regnr; - - DEBUGP("pcf=%p, reg=%d, mvolts=%d\n", pcf, reg, millivolts); - - if (reg >= __NUM_PCF50633_REGULATORS) - return -EINVAL; - - regnr = regulator_registers[reg]; - - if (millivolts > pcf->pdata->rails[reg].voltage.max) - return -EINVAL; - - switch (reg) { - case PCF50633_REGULATOR_AUTO: - volt_bits = auto_voltage(millivolts); - break; - case PCF50633_REGULATOR_DOWN1: - volt_bits = down_voltage(millivolts); - break; - case PCF50633_REGULATOR_DOWN2: - volt_bits = down_voltage(millivolts); - break; - case PCF50633_REGULATOR_LDO1: - case PCF50633_REGULATOR_LDO2: - case PCF50633_REGULATOR_LDO3: - case PCF50633_REGULATOR_LDO4: - case PCF50633_REGULATOR_LDO5: - case PCF50633_REGULATOR_LDO6: - case PCF50633_REGULATOR_HCLDO: - volt_bits = ldo_voltage(millivolts); - DEBUGP("ldo_voltage(0x%x)=%u\n", millivolts, volt_bits); - break; - default: - return -EINVAL; - } - - return pcf50633_reg_write(pcf, regnr, volt_bits); -} -EXPORT_SYMBOL_GPL(pcf50633_voltage_set); - -unsigned int pcf50633_voltage_get(struct pcf50633_data *pcf, - enum pcf50633_regulator_id reg) -{ - u_int8_t volt_bits; - u_int8_t regnr; - unsigned int rc = 0; - - if (reg >= __NUM_PCF50633_REGULATORS) - return -EINVAL; - - regnr = regulator_registers[reg]; - volt_bits = pcf50633_reg_read(pcf, regnr); - - switch (reg) { - case PCF50633_REGULATOR_AUTO: - rc = auto_2voltage(volt_bits); - break; - case PCF50633_REGULATOR_DOWN1: - rc = down_2voltage(volt_bits); - break; - case PCF50633_REGULATOR_DOWN2: - rc = down_2voltage(volt_bits); - break; - case PCF50633_REGULATOR_LDO1: - case PCF50633_REGULATOR_LDO2: - case PCF50633_REGULATOR_LDO3: - case PCF50633_REGULATOR_LDO4: - case PCF50633_REGULATOR_LDO5: - case PCF50633_REGULATOR_LDO6: - case PCF50633_REGULATOR_HCLDO: - rc = ldo_2voltage(volt_bits); - break; - default: - return -EINVAL; - } - - return rc; -} -EXPORT_SYMBOL_GPL(pcf50633_voltage_get); - /* go into 'STANDBY' mode, i.e. power off the main CPU and peripherals */ void pcf50633_go_standby(struct pcf50633_data *pcf) { @@ -1278,97 +1084,6 @@ static ssize_t show_battvolt(struct device *dev, struct device_attribute *attr, } static DEVICE_ATTR(battvolt, S_IRUGO | S_IWUSR, show_battvolt, NULL); -static int reg_id_by_name(const char *name) -{ - int reg_id; - - if (!strcmp(name, "voltage_auto")) - reg_id = PCF50633_REGULATOR_AUTO; - else if (!strcmp(name, "voltage_down1")) - reg_id = PCF50633_REGULATOR_DOWN1; - else if (!strcmp(name, "voltage_down2")) - reg_id = PCF50633_REGULATOR_DOWN2; - else if (!strcmp(name, "voltage_memldo")) - reg_id = PCF50633_REGULATOR_MEMLDO; - else if (!strcmp(name, "voltage_ldo1")) - reg_id = PCF50633_REGULATOR_LDO1; - else if (!strcmp(name, "voltage_ldo2")) - reg_id = PCF50633_REGULATOR_LDO2; - else if (!strcmp(name, "voltage_ldo3")) - reg_id = PCF50633_REGULATOR_LDO3; - else if (!strcmp(name, "voltage_ldo4")) - reg_id = PCF50633_REGULATOR_LDO4; - else if (!strcmp(name, "voltage_ldo5")) - reg_id = PCF50633_REGULATOR_LDO5; - else if (!strcmp(name, "voltage_ldo6")) - reg_id = PCF50633_REGULATOR_LDO6; - else if (!strcmp(name, "voltage_hcldo")) - reg_id = PCF50633_REGULATOR_HCLDO; - else - reg_id = -1; - - return reg_id; -} - -static ssize_t show_vreg(struct device *dev, struct device_attribute *attr, - char *buf) -{ - struct i2c_client *client = to_i2c_client(dev); - struct pcf50633_data *pcf = i2c_get_clientdata(client); - unsigned int reg_id; - - reg_id = reg_id_by_name(attr->attr.name); - if (reg_id < 0) - return 0; - - if (pcf50633_onoff_get(pcf, reg_id) > 0) - return sprintf(buf, "%u\n", pcf50633_voltage_get(pcf, reg_id)); - else - return strlcpy(buf, "0\n", PAGE_SIZE); -} - -static ssize_t set_vreg(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count) -{ - struct i2c_client *client = to_i2c_client(dev); - struct pcf50633_data *pcf = i2c_get_clientdata(client); - unsigned long mvolts = simple_strtoul(buf, NULL, 10); - unsigned int reg_id; - - reg_id = reg_id_by_name(attr->attr.name); - if (reg_id < 0) - return -EIO; - - DEBUGP("attempting to set %s(%d) to %lu mvolts\n", attr->attr.name, - reg_id, mvolts); - - if (mvolts == 0) { - pcf50633_onoff_set(pcf, reg_id, 0); - } else { - if (pcf50633_voltage_set(pcf, reg_id, mvolts) < 0) { - dev_warn(dev, "refusing to set %s(%d) to %lu mvolts " - "(max=%u)\n", attr->attr.name, reg_id, mvolts, - pcf->pdata->rails[reg_id].voltage.max); - return -EINVAL; - } - pcf50633_onoff_set(pcf, reg_id, 1); - } - - return count; -} - -static DEVICE_ATTR(voltage_auto, S_IRUGO | S_IWUSR, show_vreg, set_vreg); -static DEVICE_ATTR(voltage_down1, S_IRUGO | S_IWUSR, show_vreg, set_vreg); -static DEVICE_ATTR(voltage_down2, S_IRUGO | S_IWUSR, show_vreg, set_vreg); -static DEVICE_ATTR(voltage_memldo, S_IRUGO | S_IWUSR, show_vreg, set_vreg); -static DEVICE_ATTR(voltage_ldo1, S_IRUGO | S_IWUSR, show_vreg, set_vreg); -static DEVICE_ATTR(voltage_ldo2, S_IRUGO | S_IWUSR, show_vreg, set_vreg); -static DEVICE_ATTR(voltage_ldo3, S_IRUGO | S_IWUSR, show_vreg, set_vreg); -static DEVICE_ATTR(voltage_ldo4, S_IRUGO | S_IWUSR, show_vreg, set_vreg); -static DEVICE_ATTR(voltage_ldo5, S_IRUGO | S_IWUSR, show_vreg, set_vreg); -static DEVICE_ATTR(voltage_ldo6, S_IRUGO | S_IWUSR, show_vreg, set_vreg); -static DEVICE_ATTR(voltage_hcldo, S_IRUGO | S_IWUSR, show_vreg, set_vreg); - /*********************************************************************** * Charger Control ***********************************************************************/ @@ -1929,17 +1644,6 @@ static DEVICE_ATTR(dump_regs, 0400, show_dump_regs, NULL); * CARE! This table is modified at runtime! */ static struct attribute *pcf_sysfs_entries[] = { - &dev_attr_voltage_auto.attr, - &dev_attr_voltage_down1.attr, - &dev_attr_voltage_down2.attr, - &dev_attr_voltage_memldo.attr, - &dev_attr_voltage_ldo1.attr, - &dev_attr_voltage_ldo2.attr, - &dev_attr_voltage_ldo3.attr, - &dev_attr_voltage_ldo4.attr, - &dev_attr_voltage_ldo5.attr, - &dev_attr_voltage_ldo6.attr, - &dev_attr_voltage_hcldo.attr, &dev_attr_charger_type.attr, &dev_attr_force_usb_limit_dangerous.attr, &dev_attr_charger_adc.attr, @@ -2099,10 +1803,6 @@ static int pcf50633_probe(struct i2c_client *client, const struct i2c_device_id for (i = 0; i < __NUM_PCF50633_REGULATORS; i++) { struct platform_device *pdev; - /* Reject regulators not used by anyone */ - if (pdata->reg_init_data[i].num_consumer_supplies == 0) - continue; - pdev = kzalloc(sizeof(*pdev), GFP_KERNEL); /* FIXME : Handle failure */ @@ -2283,28 +1983,6 @@ static int pcf50633_suspend(struct device *dev, pm_message_t state) &pcf->standby_regs.ldo[0]); if (ret != sizeof(pcf->standby_regs.ldo)) dev_err(dev, "Failed to save LDO levels and enables :-(\n"); - - /* switch off power supplies that are not needed during suspend */ - for (i = 0; i < __NUM_PCF50633_REGULATORS; i++) { - if ((pcf->pdata->rails[i].flags & PMU_VRAIL_F_SUSPEND_ON)) - continue; - - /* we can save ourselves the read part of a read-modify-write - * here because we captured all these already - */ - if (i < 4) - tmp = pcf->standby_regs.misc[i * 4 + 1]; - else - tmp = pcf->standby_regs.ldo[(i - 4) * 2 + 1]; - - dev_dbg(dev, "disabling reg %s by setting ENA %d to 0x%02X\n", - pcf->pdata->rails[i].name, - regulator_registers[i] + 1, tmp & 0xfe); - - /* associated enable is always +1 from OUT reg */ - __reg_write(pcf, regulator_registers[i] + 1, tmp & 0xfe); - } - /* set interrupt masks so only those sources we want to wake * us are able to */ diff --git a/drivers/regulator/pcf50633-regulator.c b/drivers/regulator/pcf50633-regulator.c index e34e344965c..c7082d857d0 100644 --- a/drivers/regulator/pcf50633-regulator.c +++ b/drivers/regulator/pcf50633-regulator.c @@ -209,7 +209,7 @@ static int pcf50633_regulator_is_enabled(struct regulator_dev *rdev) { uint8_t val, regnr; int regulator_id = rdev_get_id(rdev); - struct pcf50633_data *pcf = rdev_get_drvdata(rdev);; + struct pcf50633_data *pcf = rdev_get_drvdata(rdev); if (regulator_id >= __NUM_PCF50633_REGULATORS) return -EINVAL; @@ -227,6 +227,8 @@ struct regulator_ops pcf50633_regulator_ops = { .enable = pcf50633_regulator_enable, .disable = pcf50633_regulator_disable, .is_enabled = pcf50633_regulator_is_enabled, + .set_suspend_enable = pcf50633_regulator_enable, + .set_suspend_disable = pcf50633_regulator_disable, }; struct regulator_desc regulators[] = { diff --git a/include/linux/pcf50633.h b/include/linux/pcf50633.h index fbfb2601106..ed14350116d 100644 --- a/include/linux/pcf50633.h +++ b/include/linux/pcf50633.h @@ -94,22 +94,6 @@ extern int pcf50633_gpio_get(struct pcf50633_data *pcf, enum pcf50633_gpio gpio); extern int -pcf50633_voltage_set(struct pcf50633_data *pcf, - enum pcf50633_regulator_id reg, - unsigned int millivolts); -extern unsigned int -pcf50633_voltage_get(struct pcf50633_data *pcf, - enum pcf50633_regulator_id reg); - -extern int -pcf50633_onoff_get(struct pcf50633_data *pcf, - enum pcf50633_regulator_id reg); - -extern int -pcf50633_onoff_set(struct pcf50633_data *pcf, - enum pcf50633_regulator_id reg, int on); - -extern int pcf50633_adc_async_read(struct pcf50633_data *pcf, int mux, int avg, void (*callback)(struct pcf50633_data *, void *, int), void *callback_param); @@ -184,10 +168,6 @@ struct pcf50633_platform_data { * ordering */ void (*attach_child_devices)(struct device *parent_device); - /* voltage regulator related */ - struct pmu_voltage_rail rails[__NUM_PCF50633_REGULATORS]; - unsigned int used_regulators; - /* charger related */ unsigned int r_fix_batt; unsigned int r_fix_batt_par; |