Re: [PATCH 3/9] regulator: 88pm860x: add pre-regulator support for 88pm860x regulator
On Mon, Sep 17, 2012 at 6:40 PM, Mark Brown wrote: > On Mon, Sep 17, 2012 at 06:28:18PM +0800, Haojian Zhuang wrote: > >> Could this patch be merged into MFD tree? Since the fourth patch in this >> patch series is depend on this one. > > Why is there a dependency? > -- This patch is picked from Jett's patch on power device of 88pm860x. His patch addes the support of PREG regulator in 88pm8607 regulator driver. Although this patch was submitted for a long time, it wasn't merged yet. And I have a patch series on updating 88pm860x driver with IORESOURCE_REG. One patch in that series is used to split regulator subdevs into an array of regulator subdevs. It results in 88pm860x regulator driver updated and merged into MFD for-next branch. Since both Jett's patch and my patch updates code in probe() function of 88pm860x regulator driver, some code between these two patches conflicts. So I make the fourth patch in current series to resolve this conflict on MFD for-next branch. If you agree on merging this patch series into MFD tree without your Ack, it would be simple way. Or I could rebase it and split them into two different patch series for MFD and regulator tree. Which way do you like? Best Regards Haojian -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 3/9] regulator: 88pm860x: add pre-regulator support for 88pm860x regulator
On Mon, Sep 17, 2012 at 06:28:18PM +0800, Haojian Zhuang wrote: > Could this patch be merged into MFD tree? Since the fourth patch in this > patch series is depend on this one. Why is there a dependency? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 3/9] regulator: 88pm860x: add pre-regulator support for 88pm860x regulator
On Mon, Sep 17, 2012 at 6:19 PM, Mark Brown wrote: > On Mon, Sep 17, 2012 at 12:19:06PM +0800, Haojian Zhuang wrote: >> From: "Jett.Zhou" >> >> Pre-regulator of 88pm8606 is mainly for support charging based on vbus, >> it needs to be enabled for charging battery, and will be disabled in >> some exception condition like over-temp. >> Add the pre-regulator support for 88pm860x regulator driver. >> >> Signed-off-by: Jett.Zhou >> Acked-by: Haojian Zhuang > > If you can sign this patch off I can apply it. Could this patch be merged into MFD tree? Since the fourth patch in this patch series is depend on this one. Best Regards Haojian From: Haojian Zhuang Since PREG regulator is the only one regulator in 88PM8606, and other regulators are in 88PM8607. Checking resource as identifying regulator is not a good way. We can use NULL resource to indentify PREG regulator. Signed-off-by: Haojian Zhuang --- drivers/mfd/88pm860x-core.c |8 +--- drivers/regulator/88pm8607.c | 32 +++- 2 files changed, 20 insertions(+), 20 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 3/9] regulator: 88pm860x: add pre-regulator support for 88pm860x regulator
On Mon, Sep 17, 2012 at 12:19:06PM +0800, Haojian Zhuang wrote: > From: "Jett.Zhou" > > Pre-regulator of 88pm8606 is mainly for support charging based on vbus, > it needs to be enabled for charging battery, and will be disabled in > some exception condition like over-temp. > Add the pre-regulator support for 88pm860x regulator driver. > > Signed-off-by: Jett.Zhou > Acked-by: Haojian Zhuang If you can sign this patch off I can apply it. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/9] regulator: 88pm860x: add pre-regulator support for 88pm860x regulator
From: "Jett.Zhou" Pre-regulator of 88pm8606 is mainly for support charging based on vbus, it needs to be enabled for charging battery, and will be disabled in some exception condition like over-temp. Add the pre-regulator support for 88pm860x regulator driver. Signed-off-by: Jett.Zhou Acked-by: Haojian Zhuang --- drivers/regulator/88pm8607.c | 66 ++ 1 file changed, 66 insertions(+) diff --git a/drivers/regulator/88pm8607.c b/drivers/regulator/88pm8607.c index 843c89a..d34bd8c 100644 --- a/drivers/regulator/88pm8607.c +++ b/drivers/regulator/88pm8607.c @@ -23,6 +23,7 @@ struct pm8607_regulator_info { struct pm860x_chip *chip; struct regulator_dev*regulator; struct i2c_client *i2c; + struct i2c_client *i2c_8606; unsigned int*vol_table; unsigned int*vol_suspend; @@ -242,6 +243,35 @@ static int pm8607_set_voltage_sel(struct regulator_dev *rdev, unsigned selector) return ret; } +static int pm8606_preg_enable(struct regulator_dev *rdev) +{ + struct pm8607_regulator_info *info = rdev_get_drvdata(rdev); + + return pm860x_set_bits(info->i2c, rdev->desc->enable_reg, + 1 << rdev->desc->enable_mask, 0); +} + +static int pm8606_preg_disable(struct regulator_dev *rdev) +{ + struct pm8607_regulator_info *info = rdev_get_drvdata(rdev); + + return pm860x_set_bits(info->i2c, rdev->desc->enable_reg, + 1 << rdev->desc->enable_mask, + 1 << rdev->desc->enable_mask); +} + +static int pm8606_preg_is_enabled(struct regulator_dev *rdev) +{ + struct pm8607_regulator_info *info = rdev_get_drvdata(rdev); + int ret; + + ret = pm860x_reg_read(info->i2c, rdev->desc->enable_reg); + if (ret < 0) + return ret; + + return !((unsigned char)ret & (1 << rdev->desc->enable_mask)); +} + static struct regulator_ops pm8607_regulator_ops = { .list_voltage = pm8607_list_voltage, .set_voltage_sel = pm8607_set_voltage_sel, @@ -251,6 +281,25 @@ static struct regulator_ops pm8607_regulator_ops = { .is_enabled = regulator_is_enabled_regmap, }; +static struct regulator_ops pm8606_preg_ops = { + .enable = pm8606_preg_enable, + .disable= pm8606_preg_disable, + .is_enabled = pm8606_preg_is_enabled, +}; + +#define PM8606_PREG(ereg, ebit) \ +{ \ + .desc = { \ + .name = "PREG", \ + .ops= &pm8606_preg_ops, \ + .type = REGULATOR_CURRENT,\ + .id = PM8606_ID_PREG, \ + .owner = THIS_MODULE, \ + .enable_reg = PM8606_##ereg,\ + .enable_mask = (ebit), \ + }, \ +} + #define PM8607_DVC(vreg, ureg, ubit, ereg, ebit) \ { \ .desc = { \ @@ -309,6 +358,8 @@ static struct pm8607_regulator_info pm8607_regulator_info[] = { PM8607_LDO(12,LDO12, 0, SUPPLIES_EN12, 5), PM8607_LDO(13, VIBRATOR_SET, 1, VIBRATOR_SET, 0), PM8607_LDO(14,LDO14, 0, SUPPLIES_EN12, 6), + + PM8606_PREG(PREREGULATORB, 5), }; static int __devinit pm8607_regulator_probe(struct platform_device *pdev) @@ -336,6 +387,8 @@ static int __devinit pm8607_regulator_probe(struct platform_device *pdev) return -EINVAL; } info->i2c = (chip->id == CHIP_PM8607) ? chip->client : chip->companion; + info->i2c_8606 = (chip->id == CHIP_PM8607) ? chip->companion : + chip->client; info->chip = chip; /* check DVC ramp slope double */ @@ -371,6 +424,18 @@ static int __devexit pm8607_regulator_remove(struct platform_device *pdev) return 0; } +static struct platform_device_id pm8607_regulator_driver_ids[] = { + { + .name = "88pm860x-regulator", + .driver_data= 0, + }, { + .name = "88pm860x-preg", + .driver_data= 0, + }, + { }, +}; +MODULE_DEVICE_TABLE(platform, pm8607_regulator_driver_ids); + static struct platform_driver pm8607_regulator_driver = { .driver = { .name = "88pm860x-regulator", @@ -378,6 +443,7 @@ static struct platform_driver pm8607_regulator_driver = { }, .probe = pm