]> Git Repo - linux.git/commitdiff
Merge remote-tracking branches 'regulator/topic/s5m8767', 'regulator/topic/st-pwm...
authorMark Brown <[email protected]>
Wed, 26 Mar 2014 16:58:18 +0000 (16:58 +0000)
committerMark Brown <[email protected]>
Wed, 26 Mar 2014 16:58:18 +0000 (16:58 +0000)
1  2  3  4  5  6  7  8  9 
drivers/regulator/Kconfig
drivers/regulator/Makefile
drivers/regulator/s5m8767.c
include/linux/mfd/samsung/core.h

index e5e4017b10112624582d61ef6aac4af608b03a84,77711d4bd3771cae693f89b154c4c8ebaff45f98,a6b29cbe8e2b6d86dc69da76700657c5b6f51e81,6a7932822e373317caba9c5c799c9439f5444927,6a7932822e373317caba9c5c799c9439f5444927,6a7932822e373317caba9c5c799c9439f5444927,6a7932822e373317caba9c5c799c9439f5444927,6a7932822e373317caba9c5c799c9439f5444927,6a7932822e373317caba9c5c799c9439f5444927..8f3866c44a3fd031841cdc90cdee99af58ebb8a7
@@@@@@@@@@ -139,14 -139,6 -139,6 -139,6 -139,6 -139,6 -139,6 -139,6 -139,6 +139,14 @@@@@@@@@@ config REGULATOR_AS372
                  AS3722 PMIC. This will enable support for all the software
                  controllable DCDC/LDO regulators.
         
 ++++++++config REGULATOR_BCM590XX
 ++++++++       tristate "Broadcom BCM590xx PMU Regulators"
 ++++++++       depends on MFD_BCM590XX
 ++++++++       help
 ++++++++         This driver provides support for the voltage regulators on the
 ++++++++         BCM590xx PMUs. This will enable support for the software
 ++++++++         controllable LDO/Switching regulators.
 ++++++++
         config REGULATOR_DA903X
                tristate "Dialog Semiconductor DA9030/DA9034 regulators"
                depends on PMIC_DA903X
@@@@@@@@@@ -366,7 -358,7 -358,7 -358,7 -358,7 -358,7 -358,7 -358,7 -358,7 +366,7 @@@@@@@@@@ config REGULATOR_MC13XXX_COR
         
         config REGULATOR_MC13783
                tristate "Freescale MC13783 regulator driver"
 -              depends on MFD_MC13783
 +              depends on MFD_MC13XXX
                select REGULATOR_MC13XXX_CORE
                help
                  Say y here to support the regulators found on the Freescale MC13783
@@@@@@@@@@ -407,12 -399,12 -399,12 -399,12 -399,12 -399,12 -399,12 -399,12 -399,12 +407,12 @@@@@@@@@@ config REGULATOR_PCF5063
                 on PCF50633
         
         config REGULATOR_PFUZE100
 --------       tristate "Freescale PFUZE100 regulator driver"
 ++++++++       tristate "Freescale PFUZE100/PFUZE200 regulator driver"
                depends on I2C
                select REGMAP_I2C
                help
 --------         Say y here to support the regulators found on the Freescale PFUZE100
 --------         PMIC.
 ++++++++         Say y here to support the regulators found on the Freescale
 ++++++++         PFUZE100/PFUZE200 PMIC.
         
         config REGULATOR_RC5T583
                tristate "RICOH RC5T583 Power regulators"
                  through regulator interface. The device supports multiple DCDC/LDO
                  outputs which can be controlled by i2c communication.
         
 ++++++++config REGULATOR_S2MPA01
 ++++++++       tristate "Samsung S2MPA01 voltage regulator"
 ++++++++       depends on MFD_SEC_CORE
 ++++++++       help
 ++++++++        This driver controls Samsung S2MPA01 voltage output regulator
 ++++++++        via I2C bus. S2MPA01 has 10 Bucks and 26 LDO outputs.
 ++++++++
         config REGULATOR_S2MPS11
 --------       tristate "Samsung S2MPS11 voltage regulator"
 ++++++++       tristate "Samsung S2MPS11/S2MPS14 voltage regulator"
                depends on MFD_SEC_CORE
                help
 --------        This driver supports a Samsung S2MPS11 voltage output regulator
 --------        via I2C bus. S2MPS11 is comprised of high efficient Buck converters
 --------        including Dual-Phase Buck converter, Buck-Boost converter, various LDOs.
 ++++++++        This driver supports a Samsung S2MPS11/S2MPS14 voltage output
 ++++++++        regulator via I2C bus. The chip is comprised of high efficient Buck
 ++++++++        converters including Dual-Phase Buck converter, Buck-Boost converter,
 ++++++++        various LDOs.
         
         config REGULATOR_S5M8767
                tristate "Samsung S5M8767A voltage regulator"
                 via I2C bus. S5M8767A have 9 Bucks and 28 LDOs output and
                 supports DVS mode with 8bits of output voltage control.
         
++ ++++++config REGULATOR_ST_PWM
++ ++++++       tristate "STMicroelectronics PWM voltage regulator"
++ ++++++       depends on ARCH_STI
++ ++++++       help
++ ++++++        This driver supports ST's PWM controlled voltage regulators.
++ ++++++
         config REGULATOR_TI_ABB
                tristate "TI Adaptive Body Bias on-chip LDO"
                depends on ARCH_OMAP
index c3416728c14d505685a6daeae905741bdb31b95e,979f9ddcf259bd5a82b6b5d91f81981902e6185c,d0c2bb85b8cbfa68a8c9a819753f21a4f0cb6ed8,979f9ddcf259bd5a82b6b5d91f81981902e6185c,979f9ddcf259bd5a82b6b5d91f81981902e6185c,979f9ddcf259bd5a82b6b5d91f81981902e6185c,979f9ddcf259bd5a82b6b5d91f81981902e6185c,979f9ddcf259bd5a82b6b5d91f81981902e6185c,979f9ddcf259bd5a82b6b5d91f81981902e6185c..0cfca37941ec4aa6d97ff77a531ac202550893e3
@@@@@@@@@@ -20,7 -20,6 -20,6 -20,6 -20,6 -20,6 -20,6 -20,6 -20,6 +20,7 @@@@@@@@@@ obj-$(CONFIG_REGULATOR_ANATOP) += anato
         obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o
         obj-$(CONFIG_REGULATOR_AS3711) += as3711-regulator.o
         obj-$(CONFIG_REGULATOR_AS3722) += as3722-regulator.o
 ++++++++obj-$(CONFIG_REGULATOR_BCM590XX) += bcm590xx-regulator.o
         obj-$(CONFIG_REGULATOR_DA903X) += da903x.o
         obj-$(CONFIG_REGULATOR_DA9052) += da9052-regulator.o
         obj-$(CONFIG_REGULATOR_DA9055) += da9055-regulator.o
@@@@@@@@@@ -58,9 -57,8 -57,9 -57,8 -57,8 -57,8 -57,8 -57,8 -57,8 +58,10 @@@@@@@@@@ obj-$(CONFIG_REGULATOR_TPS51632) += tps
         obj-$(CONFIG_REGULATOR_PCAP) += pcap-regulator.o
         obj-$(CONFIG_REGULATOR_PCF50633) += pcf50633-regulator.o
         obj-$(CONFIG_REGULATOR_RC5T583)  += rc5t583-regulator.o
 ++++++++obj-$(CONFIG_REGULATOR_S2MPA01) += s2mpa01.o
         obj-$(CONFIG_REGULATOR_S2MPS11) += s2mps11.o
         obj-$(CONFIG_REGULATOR_S5M8767) += s5m8767.o
++ ++++++obj-$(CONFIG_REGULATOR_ST_PWM) += st-pwm.o
         obj-$(CONFIG_REGULATOR_STW481X_VMMC) += stw481x-vmmc.o
         obj-$(CONFIG_REGULATOR_TI_ABB) += ti-abb-regulator.o
         obj-$(CONFIG_REGULATOR_TPS6105X) += tps6105x-regulator.o
index d958dfa051254866808fe6c36cf9db7184627b94,b6ddb03ee76230347d5302d96f7c2923eea3de51,d7164bb75d3e0bf2a88a61c1a82e6c79072cd8b5,d7164bb75d3e0bf2a88a61c1a82e6c79072cd8b5,d7164bb75d3e0bf2a88a61c1a82e6c79072cd8b5,d7164bb75d3e0bf2a88a61c1a82e6c79072cd8b5,d7164bb75d3e0bf2a88a61c1a82e6c79072cd8b5,d7164bb75d3e0bf2a88a61c1a82e6c79072cd8b5,d7164bb75d3e0bf2a88a61c1a82e6c79072cd8b5..f05badabd69e99169a0adcb9f4d4d335891cafb8
          *
          */
         
- -------#include <linux/bug.h>
         #include <linux/err.h>
- -------#include <linux/gpio.h>
         #include <linux/of_gpio.h>
- -------#include <linux/slab.h>
         #include <linux/module.h>
         #include <linux/platform_device.h>
         #include <linux/regulator/driver.h>
@@@@@@@@@@ -170,12 -167,11 -170,12 -170,12 -170,12 -170,12 -170,12 -170,12 -170,12 +167,11 @@@@@@@@@@ static unsigned int s5m8767_opmode_reg[
                {0x0, 0x3, 0x1, 0x1}, /* BUCK9 */
         };
         
- -------static int s5m8767_get_register(struct regulator_dev *rdev, int *reg,
- -------                               int *enable_ctrl)
+ +++++++static int s5m8767_get_register(struct s5m8767_info *s5m8767, int reg_id,
+ +++++++                               int *reg, int *enable_ctrl)
         {
- -------       int i, reg_id = rdev_get_id(rdev);
+ +++++++       int i;
                unsigned int mode;
- -------       struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev);
         
                switch (reg_id) {
                case S5M8767_LDO1 ... S5M8767_LDO2:
                return 0;
         }
         
- -------static int s5m8767_reg_is_enabled(struct regulator_dev *rdev)
- -------{
- -------       struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev);
- -------       int ret, reg;
- -------       int enable_ctrl;
- -------       unsigned int val;
- -------
- -------       ret = s5m8767_get_register(rdev, &reg, &enable_ctrl);
- -------       if (ret == -EINVAL)
- -------               return 1;
- -------       else if (ret)
- -------               return ret;
- -------
- -------       ret = regmap_read(s5m8767->iodev->regmap_pmic, reg, &val);
- -------       if (ret)
- -------               return ret;
- -------
- -------       return (val & S5M8767_ENCTRL_MASK) == enable_ctrl;
- -------}
- -------
- -------static int s5m8767_reg_enable(struct regulator_dev *rdev)
- -------{
- -------       struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev);
- -------       int ret, reg;
- -------       int enable_ctrl;
- -------
- -------       ret = s5m8767_get_register(rdev, &reg, &enable_ctrl);
- -------       if (ret)
- -------               return ret;
- -------
- -------       return regmap_update_bits(s5m8767->iodev->regmap_pmic, reg,
- -------                       S5M8767_ENCTRL_MASK, enable_ctrl);
- -------}
- -------
- -------static int s5m8767_reg_disable(struct regulator_dev *rdev)
- -------{
- -------       struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev);
- -------       int ret, reg, enable_ctrl;
- -------
- -------       ret = s5m8767_get_register(rdev, &reg, &enable_ctrl);
- -------       if (ret)
- -------               return ret;
- -------
- -------       return regmap_update_bits(s5m8767->iodev->regmap_pmic, reg,
- -------                       S5M8767_ENCTRL_MASK, ~S5M8767_ENCTRL_MASK);
- -------}
- -------
         static int s5m8767_get_vsel_reg(int reg_id, struct s5m8767_info *s5m8767)
         {
                int reg;
@@@@@@@@@@ -410,9 -359,9 -410,9 -410,9 -410,9 -410,9 -410,9 -410,9 -410,9 +359,9 @@@@@@@@@@ static int s5m8767_set_voltage_time_sel
         
         static struct regulator_ops s5m8767_ops = {
                .list_voltage           = regulator_list_voltage_linear,
- -------       .is_enabled             = s5m8767_reg_is_enabled,
- -------       .enable                 = s5m8767_reg_enable,
- -------       .disable                = s5m8767_reg_disable,
+ +++++++       .is_enabled             = regulator_is_enabled_regmap,
+ +++++++       .enable                 = regulator_enable_regmap,
+ +++++++       .disable                = regulator_disable_regmap,
                .get_voltage_sel        = regulator_get_voltage_sel_regmap,
                .set_voltage_sel        = s5m8767_set_voltage_sel,
                .set_voltage_time_sel   = s5m8767_set_voltage_time_sel,
         
         static struct regulator_ops s5m8767_buck78_ops = {
                .list_voltage           = regulator_list_voltage_linear,
- -------       .is_enabled             = s5m8767_reg_is_enabled,
- -------       .enable                 = s5m8767_reg_enable,
- -------       .disable                = s5m8767_reg_disable,
+ +++++++       .is_enabled             = regulator_is_enabled_regmap,
+ +++++++       .enable                 = regulator_enable_regmap,
+ +++++++       .disable                = regulator_disable_regmap,
                .get_voltage_sel        = regulator_get_voltage_sel_regmap,
                .set_voltage_sel        = regulator_set_voltage_sel_regmap,
         };
@@@@@@@@@@ -483,6 -432,66 -483,6 -483,6 -483,6 -483,6 -483,6 -483,6 -483,6 +432,66 @@@@@@@@@@ static struct regulator_desc regulators
                s5m8767_regulator_desc(BUCK9),
         };
         
+ +++++++/*
+ +++++++ * Enable GPIO control over BUCK9 in regulator_config for that regulator.
+ +++++++ */
+ +++++++static void s5m8767_regulator_config_ext_control(struct s5m8767_info *s5m8767,
+ +++++++               struct sec_regulator_data *rdata,
+ +++++++               struct regulator_config *config)
+ +++++++{
+ +++++++       int i, mode = 0;
+ +++++++
+ +++++++       if (rdata->id != S5M8767_BUCK9)
+ +++++++               return;
+ +++++++
+ +++++++       /* Check if opmode for regulator matches S5M8767_ENCTRL_USE_GPIO */
+ +++++++       for (i = 0; i < s5m8767->num_regulators; i++) {
+ +++++++               const struct sec_opmode_data *opmode = &s5m8767->opmode[i];
+ +++++++               if (opmode->id == rdata->id) {
+ +++++++                       mode = s5m8767_opmode_reg[rdata->id][opmode->mode];
+ +++++++                       break;
+ +++++++               }
+ +++++++       }
+ +++++++       if (mode != S5M8767_ENCTRL_USE_GPIO) {
+ +++++++               dev_warn(s5m8767->dev,
+ +++++++                               "ext-control for %s: mismatched op_mode (%x), ignoring\n",
+ +++++++                               rdata->reg_node->name, mode);
+ +++++++               return;
+ +++++++       }
+ +++++++
+ +++++++       if (!gpio_is_valid(rdata->ext_control_gpio)) {
+ +++++++               dev_warn(s5m8767->dev,
+ +++++++                               "ext-control for %s: GPIO not valid, ignoring\n",
+ +++++++                               rdata->reg_node->name);
+ +++++++               return;
+ +++++++       }
+ +++++++
+ +++++++       config->ena_gpio = rdata->ext_control_gpio;
+ +++++++       config->ena_gpio_flags = GPIOF_OUT_INIT_HIGH;
+ +++++++}
+ +++++++
+ +++++++/*
+ +++++++ * Turn on GPIO control over BUCK9.
+ +++++++ */
+ +++++++static int s5m8767_enable_ext_control(struct s5m8767_info *s5m8767,
+ +++++++               struct regulator_dev *rdev)
+ +++++++{
+ +++++++       int id = rdev_get_id(rdev);
+ +++++++       int ret, reg, enable_ctrl;
+ +++++++
+ +++++++       if (id != S5M8767_BUCK9)
+ +++++++               return -EINVAL;
+ +++++++
+ +++++++       ret = s5m8767_get_register(s5m8767, id, &reg, &enable_ctrl);
+ +++++++       if (ret)
+ +++++++               return ret;
+ +++++++
+ +++++++       return regmap_update_bits(s5m8767->iodev->regmap_pmic,
+ +++++++                       reg, S5M8767_ENCTRL_MASK,
+ +++++++                       S5M8767_ENCTRL_USE_GPIO << S5M8767_ENCTRL_SHIFT);
+ +++++++}
+ +++++++
+ +++++++
         #ifdef CONFIG_OF
         static int s5m8767_pmic_dt_parse_dvs_gpio(struct sec_pmic_dev *iodev,
                                struct sec_platform_data *pdata,
@@@@@@@@@@ -520,6 -529,16 -520,6 -520,6 -520,6 -520,6 -520,6 -520,6 -520,6 +529,16 @@@@@@@@@@ static int s5m8767_pmic_dt_parse_ds_gpi
                return 0;
         }
         
+ +++++++static void s5m8767_pmic_dt_parse_ext_control_gpio(struct sec_pmic_dev *iodev,
+ +++++++               struct sec_regulator_data *rdata,
+ +++++++               struct device_node *reg_np)
+ +++++++{
+ +++++++       rdata->ext_control_gpio = of_get_named_gpio(reg_np,
+ +++++++                       "s5m8767,pmic-ext-control-gpios", 0);
+ +++++++       if (!gpio_is_valid(rdata->ext_control_gpio))
+ +++++++               rdata->ext_control_gpio = 0;
+ +++++++}
+ +++++++
         static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev,
                                                struct sec_platform_data *pdata)
         {
                        return -ENODEV;
                }
         
 --------       regulators_np = of_find_node_by_name(pmic_np, "regulators");
 ++++++++       regulators_np = of_get_child_by_name(pmic_np, "regulators");
                if (!regulators_np) {
                        dev_err(iodev->dev, "could not find regulators sub-node\n");
                        return -EINVAL;
         
                rdata = devm_kzalloc(&pdev->dev, sizeof(*rdata) *
                                        pdata->num_regulators, GFP_KERNEL);
- -------       if (!rdata) {
- -------               dev_err(iodev->dev,
- -------                       "could not allocate memory for regulator data\n");
+ +++++++       if (!rdata)
                        return -ENOMEM;
- -------       }
         
                rmode = devm_kzalloc(&pdev->dev, sizeof(*rmode) *
                                        pdata->num_regulators, GFP_KERNEL);
- -------       if (!rmode) {
- -------               dev_err(iodev->dev,
- -------                       "could not allocate memory for regulator mode\n");
+ +++++++       if (!rmode)
                        return -ENOMEM;
- -------       }
         
                pdata->regulators = rdata;
                pdata->opmode = rmode;
                                continue;
                        }
         
+ +++++++               s5m8767_pmic_dt_parse_ext_control_gpio(iodev, rdata, reg_np);
+ +++++++
                        rdata->id = i;
                        rdata->initdata = of_get_regulator_init_data(
                                                        &pdev->dev, reg_np);
                        rmode++;
                }
         
 ++++++++       of_node_put(regulators_np);
 ++++++++
                if (of_get_property(pmic_np, "s5m8767,pmic-buck2-uses-gpio-dvs", NULL)) {
                        pdata->buck2_gpiodvs = true;
         
@@@@@@@@@@ -922,6 -935,7 -920,6 -920,6 -920,6 -920,6 -920,6 -920,6 -920,6 +937,7 @@@@@@@@@@ static int s5m8767_pmic_probe(struct pl
                for (i = 0; i < pdata->num_regulators; i++) {
                        const struct sec_voltage_desc *desc;
                        int id = pdata->regulators[i].id;
+ +++++++               int enable_reg, enable_val;
         
                        desc = reg_voltage_map[id];
                        if (desc) {
                                        regulators[id].vsel_mask = 0x3f;
                                else
                                        regulators[id].vsel_mask = 0xff;
+ +++++++
+ +++++++                       s5m8767_get_register(s5m8767, id, &enable_reg,
+ +++++++                                            &enable_val);
+ +++++++                       regulators[id].enable_reg = enable_reg;
+ +++++++                       regulators[id].enable_mask = S5M8767_ENCTRL_MASK;
+ +++++++                       regulators[id].enable_val = enable_val;
                        }
         
                        config.dev = s5m8767->dev;
                        config.driver_data = s5m8767;
                        config.regmap = iodev->regmap_pmic;
                        config.of_node = pdata->regulators[i].reg_node;
+ +++++++               if (pdata->regulators[i].ext_control_gpio)
+ +++++++                       s5m8767_regulator_config_ext_control(s5m8767,
+ +++++++                                       &pdata->regulators[i], &config);
         
                        rdev[i] = devm_regulator_register(&pdev->dev, &regulators[id],
                                                          &config);
                                                id);
                                return ret;
                        }
+ +++++++
+ +++++++               if (pdata->regulators[i].ext_control_gpio) {
+ +++++++                       ret = s5m8767_enable_ext_control(s5m8767, rdev[i]);
+ +++++++                       if (ret < 0) {
+ +++++++                               dev_err(s5m8767->dev,
+ +++++++                                               "failed to enable gpio control over %s: %d\n",
+ +++++++                                               rdev[i]->desc->name, ret);
+ +++++++                               return ret;
+ +++++++                       }
+ +++++++               }
                }
         
                return 0;
index 900bc9e1888b1d369c3caff0d5c05bbd8c9f14c1,55510444b9fddb08e42a7e2725cc20f025d241d9,41c9bde410c5b31f0bcdfb61de557ca0fe5353ce,41c9bde410c5b31f0bcdfb61de557ca0fe5353ce,41c9bde410c5b31f0bcdfb61de557ca0fe5353ce,41c9bde410c5b31f0bcdfb61de557ca0fe5353ce,41c9bde410c5b31f0bcdfb61de557ca0fe5353ce,41c9bde410c5b31f0bcdfb61de557ca0fe5353ce,41c9bde410c5b31f0bcdfb61de557ca0fe5353ce..157e32b6ca28790fccbc2a3d47d30c9b210d6ec4
@@@@@@@@@@ -18,9 -18,7 -18,7 -18,7 -18,7 -18,7 -18,7 -18,7 -18,7 +18,9 @@@@@@@@@@ enum sec_device_type 
                S5M8751X,
                S5M8763X,
                S5M8767X,
 ++++++++       S2MPA01,
                S2MPS11X,
 ++++++++       S2MPS14X,
         };
         
         /**
@@@@@@@@@@ -52,7 -50,7 -50,7 -50,7 -50,7 -50,7 -50,7 -50,7 -50,7 +52,7 @@@@@@@@@@ struct sec_pmic_dev 
                struct regmap_irq_chip_data *irq_data;
         
                int ono;
 --------       int type;
 ++++++++       unsigned long type;
                bool wakeup;
                bool wtsr_smpl;
         };
@@@@@@@@@@ -94,7 -92,7 -92,7 -92,7 -92,7 -92,7 -92,7 -92,7 -92,7 +94,7 @@@@@@@@@@ struct sec_platform_data 
                int                             buck3_default_idx;
                int                             buck4_default_idx;
         
 --------       int                             buck_ramp_delay;
 ++++++++       int                             buck_ramp_delay;
         
                int                             buck2_ramp_delay;
                int                             buck34_ramp_delay;
                int                             buck16_ramp_delay;
                int                             buck7810_ramp_delay;
                int                             buck9_ramp_delay;
 --------
 --------       bool                            buck2_ramp_enable;
 --------       bool                            buck3_ramp_enable;
 --------       bool                            buck4_ramp_enable;
 ++++++++       int                             buck24_ramp_delay;
 ++++++++       int                             buck3_ramp_delay;
 ++++++++       int                             buck7_ramp_delay;
 ++++++++       int                             buck8910_ramp_delay;
 ++++++++
 ++++++++       bool                            buck1_ramp_enable;
 ++++++++       bool                            buck2_ramp_enable;
 ++++++++       bool                            buck3_ramp_enable;
 ++++++++       bool                            buck4_ramp_enable;
                bool                            buck6_ramp_enable;
         
                int                             buck2_init;
         struct sec_regulator_data {
                int                             id;
                struct regulator_init_data      *initdata;
- -------       struct device_node *reg_node;
+ +++++++       struct device_node              *reg_node;
+ +++++++       int                             ext_control_gpio;
         };
         
         /*
This page took 0.149189 seconds and 4 git commands to generate.