All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] [PATCH] regulator: 88pm8607: Update update_bit for BUCK2 in pm8607_set_voltage_sel
@ 2012-12-24  1:13 Axel Lin
  2012-12-24  1:14 ` [PATCH v2 2/2] regulator: 88pm8607: Use apply_[reg|bit] with regmap based voltage_sel operations Axel Lin
  2012-12-27 17:29 ` [PATCH 1/2] [PATCH] regulator: 88pm8607: Update update_bit for BUCK2 in pm8607_set_voltage_sel Mark Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Axel Lin @ 2012-12-24  1:13 UTC (permalink / raw)
  To: Mark Brown; +Cc: Haojian Zhuang, Liam Girdwood, linux-kernel

BUCK2 has the update_bit setting, but current code does not set update_bit
in pm8607_set_voltage_sel.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
hi Haojian,
I prefer no behavior change during API conversion.
So I send this fix first, next patch is on top of this patch.

Regards,
Axel
 drivers/regulator/88pm8607.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/regulator/88pm8607.c b/drivers/regulator/88pm8607.c
index 2b55711..5c4879a 100644
--- a/drivers/regulator/88pm8607.c
+++ b/drivers/regulator/88pm8607.c
@@ -236,6 +236,7 @@ static int pm8607_set_voltage_sel(struct regulator_dev *rdev, unsigned selector)
 		return ret;
 	switch (info->desc.id) {
 	case PM8607_ID_BUCK1:
+	case PM8607_ID_BUCK2:
 	case PM8607_ID_BUCK3:
 		ret = pm860x_set_bits(info->i2c, info->update_reg,
 				      1 << info->update_bit,
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] regulator: 88pm8607: Use apply_[reg|bit] with regmap based voltage_sel operations
  2012-12-24  1:13 [PATCH 1/2] [PATCH] regulator: 88pm8607: Update update_bit for BUCK2 in pm8607_set_voltage_sel Axel Lin
@ 2012-12-24  1:14 ` Axel Lin
  2012-12-25  0:37   ` Haojian Zhuang
  2012-12-27 17:29 ` [PATCH 1/2] [PATCH] regulator: 88pm8607: Update update_bit for BUCK2 in pm8607_set_voltage_sel Mark Brown
  1 sibling, 1 reply; 4+ messages in thread
From: Axel Lin @ 2012-12-24  1:14 UTC (permalink / raw)
  To: Mark Brown; +Cc: Haojian Zhuang, Liam Girdwood, linux-kernel

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/regulator/88pm8607.c |   38 ++++++--------------------------------
 1 file changed, 6 insertions(+), 32 deletions(-)

diff --git a/drivers/regulator/88pm8607.c b/drivers/regulator/88pm8607.c
index 5c4879a..a957e8c 100644
--- a/drivers/regulator/88pm8607.c
+++ b/drivers/regulator/88pm8607.c
@@ -30,8 +30,6 @@ struct pm8607_regulator_info {
 	unsigned int	*vol_table;
 	unsigned int	*vol_suspend;
 
-	int	update_reg;
-	int	update_bit;
 	int	slope_double;
 };
 
@@ -222,30 +220,6 @@ static int pm8607_list_voltage(struct regulator_dev *rdev, unsigned index)
 	return ret;
 }
 
-static int pm8607_set_voltage_sel(struct regulator_dev *rdev, unsigned selector)
-{
-	struct pm8607_regulator_info *info = rdev_get_drvdata(rdev);
-	uint8_t val;
-	int ret;
-
-	val = (uint8_t)(selector << (ffs(rdev->desc->vsel_mask) - 1));
-
-	ret = pm860x_set_bits(info->i2c, rdev->desc->vsel_reg,
-			      rdev->desc->vsel_mask, val);
-	if (ret)
-		return ret;
-	switch (info->desc.id) {
-	case PM8607_ID_BUCK1:
-	case PM8607_ID_BUCK2:
-	case PM8607_ID_BUCK3:
-		ret = pm860x_set_bits(info->i2c, info->update_reg,
-				      1 << info->update_bit,
-				      1 << info->update_bit);
-		break;
-	}
-	return ret;
-}
-
 static int pm8606_preg_enable(struct regulator_dev *rdev)
 {
 	struct pm8607_regulator_info *info = rdev_get_drvdata(rdev);
@@ -277,7 +251,7 @@ static int pm8606_preg_is_enabled(struct regulator_dev *rdev)
 
 static struct regulator_ops pm8607_regulator_ops = {
 	.list_voltage	= pm8607_list_voltage,
-	.set_voltage_sel = pm8607_set_voltage_sel,
+	.set_voltage_sel = regulator_set_voltage_sel_regmap,
 	.get_voltage_sel = regulator_get_voltage_sel_regmap,
 	.enable = regulator_enable_regmap,
 	.disable = regulator_disable_regmap,
@@ -314,11 +288,11 @@ static struct regulator_ops pm8606_preg_ops = {
 		.n_voltages = ARRAY_SIZE(vreg##_table),			\
 		.vsel_reg = PM8607_##vreg,				\
 		.vsel_mask = ARRAY_SIZE(vreg##_table) - 1,		\
+		.apply_reg = PM8607_##ureg,				\
+		.apply_bit = (ubit),					\
 		.enable_reg = PM8607_##ereg,				\
 		.enable_mask = 1 << (ebit),				\
 	},								\
-	.update_reg	= PM8607_##ureg,				\
-	.update_bit	= (ubit),					\
 	.slope_double	= (0),						\
 	.vol_table	= (unsigned int *)&vreg##_table,		\
 	.vol_suspend	= (unsigned int *)&vreg##_suspend_table,	\
@@ -344,9 +318,9 @@ static struct regulator_ops pm8606_preg_ops = {
 }
 
 static struct pm8607_regulator_info pm8607_regulator_info[] = {
-	PM8607_DVC(BUCK1, GO, 0, SUPPLIES_EN11, 0),
-	PM8607_DVC(BUCK2, GO, 1, SUPPLIES_EN11, 1),
-	PM8607_DVC(BUCK3, GO, 2, SUPPLIES_EN11, 2),
+	PM8607_DVC(BUCK1, GO, BIT(0), SUPPLIES_EN11, 0),
+	PM8607_DVC(BUCK2, GO, BIT(1), SUPPLIES_EN11, 1),
+	PM8607_DVC(BUCK3, GO, BIT(2), SUPPLIES_EN11, 2),
 
 	PM8607_LDO(1,         LDO1, 0, SUPPLIES_EN11, 3),
 	PM8607_LDO(2,         LDO2, 0, SUPPLIES_EN11, 4),
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 2/2] regulator: 88pm8607: Use apply_[reg|bit] with regmap based voltage_sel operations
  2012-12-24  1:14 ` [PATCH v2 2/2] regulator: 88pm8607: Use apply_[reg|bit] with regmap based voltage_sel operations Axel Lin
@ 2012-12-25  0:37   ` Haojian Zhuang
  0 siblings, 0 replies; 4+ messages in thread
From: Haojian Zhuang @ 2012-12-25  0:37 UTC (permalink / raw)
  To: Axel Lin; +Cc: Mark Brown, Liam Girdwood, linux-kernel

On Mon, Dec 24, 2012 at 9:14 AM, Axel Lin <axel.lin@ingics.com> wrote:
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
>  drivers/regulator/88pm8607.c |   38 ++++++--------------------------------
>  1 file changed, 6 insertions(+), 32 deletions(-)
>
> diff --git a/drivers/regulator/88pm8607.c b/drivers/regulator/88pm8607.c
> index 5c4879a..a957e8c 100644
> --- a/drivers/regulator/88pm8607.c
> +++ b/drivers/regulator/88pm8607.c
> @@ -30,8 +30,6 @@ struct pm8607_regulator_info {
>         unsigned int    *vol_table;
>         unsigned int    *vol_suspend;
>
> -       int     update_reg;
> -       int     update_bit;
>         int     slope_double;
>  };
>
> @@ -222,30 +220,6 @@ static int pm8607_list_voltage(struct regulator_dev *rdev, unsigned index)
>         return ret;
>  }
>
> -static int pm8607_set_voltage_sel(struct regulator_dev *rdev, unsigned selector)
> -{
> -       struct pm8607_regulator_info *info = rdev_get_drvdata(rdev);
> -       uint8_t val;
> -       int ret;
> -
> -       val = (uint8_t)(selector << (ffs(rdev->desc->vsel_mask) - 1));
> -
> -       ret = pm860x_set_bits(info->i2c, rdev->desc->vsel_reg,
> -                             rdev->desc->vsel_mask, val);
> -       if (ret)
> -               return ret;
> -       switch (info->desc.id) {
> -       case PM8607_ID_BUCK1:
> -       case PM8607_ID_BUCK2:
> -       case PM8607_ID_BUCK3:
> -               ret = pm860x_set_bits(info->i2c, info->update_reg,
> -                                     1 << info->update_bit,
> -                                     1 << info->update_bit);
> -               break;
> -       }
> -       return ret;
> -}
> -
>  static int pm8606_preg_enable(struct regulator_dev *rdev)
>  {
>         struct pm8607_regulator_info *info = rdev_get_drvdata(rdev);
> @@ -277,7 +251,7 @@ static int pm8606_preg_is_enabled(struct regulator_dev *rdev)
>
>  static struct regulator_ops pm8607_regulator_ops = {
>         .list_voltage   = pm8607_list_voltage,
> -       .set_voltage_sel = pm8607_set_voltage_sel,
> +       .set_voltage_sel = regulator_set_voltage_sel_regmap,
>         .get_voltage_sel = regulator_get_voltage_sel_regmap,
>         .enable = regulator_enable_regmap,
>         .disable = regulator_disable_regmap,
> @@ -314,11 +288,11 @@ static struct regulator_ops pm8606_preg_ops = {
>                 .n_voltages = ARRAY_SIZE(vreg##_table),                 \
>                 .vsel_reg = PM8607_##vreg,                              \
>                 .vsel_mask = ARRAY_SIZE(vreg##_table) - 1,              \
> +               .apply_reg = PM8607_##ureg,                             \
> +               .apply_bit = (ubit),                                    \
>                 .enable_reg = PM8607_##ereg,                            \
>                 .enable_mask = 1 << (ebit),                             \
>         },                                                              \
> -       .update_reg     = PM8607_##ureg,                                \
> -       .update_bit     = (ubit),                                       \
>         .slope_double   = (0),                                          \
>         .vol_table      = (unsigned int *)&vreg##_table,                \
>         .vol_suspend    = (unsigned int *)&vreg##_suspend_table,        \
> @@ -344,9 +318,9 @@ static struct regulator_ops pm8606_preg_ops = {
>  }
>
>  static struct pm8607_regulator_info pm8607_regulator_info[] = {
> -       PM8607_DVC(BUCK1, GO, 0, SUPPLIES_EN11, 0),
> -       PM8607_DVC(BUCK2, GO, 1, SUPPLIES_EN11, 1),
> -       PM8607_DVC(BUCK3, GO, 2, SUPPLIES_EN11, 2),
> +       PM8607_DVC(BUCK1, GO, BIT(0), SUPPLIES_EN11, 0),
> +       PM8607_DVC(BUCK2, GO, BIT(1), SUPPLIES_EN11, 1),
> +       PM8607_DVC(BUCK3, GO, BIT(2), SUPPLIES_EN11, 2),
>
>         PM8607_LDO(1,         LDO1, 0, SUPPLIES_EN11, 3),
>         PM8607_LDO(2,         LDO2, 0, SUPPLIES_EN11, 4),
> --
> 1.7.9.5
>
>
>

Acked-by: Haojian Zhuang <haojian.zhuang@gmail.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] [PATCH] regulator: 88pm8607: Update update_bit for BUCK2 in pm8607_set_voltage_sel
  2012-12-24  1:13 [PATCH 1/2] [PATCH] regulator: 88pm8607: Update update_bit for BUCK2 in pm8607_set_voltage_sel Axel Lin
  2012-12-24  1:14 ` [PATCH v2 2/2] regulator: 88pm8607: Use apply_[reg|bit] with regmap based voltage_sel operations Axel Lin
@ 2012-12-27 17:29 ` Mark Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2012-12-27 17:29 UTC (permalink / raw)
  To: Axel Lin; +Cc: Haojian Zhuang, Liam Girdwood, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 187 bytes --]

On Mon, Dec 24, 2012 at 09:13:38AM +0800, Axel Lin wrote:
> BUCK2 has the update_bit setting, but current code does not set update_bit
> in pm8607_set_voltage_sel.

Applied both, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-12-27 17:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-24  1:13 [PATCH 1/2] [PATCH] regulator: 88pm8607: Update update_bit for BUCK2 in pm8607_set_voltage_sel Axel Lin
2012-12-24  1:14 ` [PATCH v2 2/2] regulator: 88pm8607: Use apply_[reg|bit] with regmap based voltage_sel operations Axel Lin
2012-12-25  0:37   ` Haojian Zhuang
2012-12-27 17:29 ` [PATCH 1/2] [PATCH] regulator: 88pm8607: Update update_bit for BUCK2 in pm8607_set_voltage_sel Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.