All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND 1/3] regulator: wm831x-dcdc: Convert wm831x_buckp_ops to regulator_list_voltage_linear
@ 2012-06-13 12:27 Axel Lin
  2012-06-13 12:27 ` [PATCH RESEND 2/3] regulator: wm831x-dcdc: Convert wm831x_buckp_ops to regulator_set_voltage_sel_regmap Axel Lin
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Axel Lin @ 2012-06-13 12:27 UTC (permalink / raw)
  To: linux-kernel; +Cc: Liam Girdwood, Mark Brown

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/regulator/wm831x-dcdc.c |   15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c
index 099da11..fbcff56 100644
--- a/drivers/regulator/wm831x-dcdc.c
+++ b/drivers/regulator/wm831x-dcdc.c
@@ -599,15 +599,6 @@ static struct platform_driver wm831x_buckv_driver = {
  * BUCKP specifics
  */
 
-static int wm831x_buckp_list_voltage(struct regulator_dev *rdev,
-				      unsigned selector)
-{
-	if (selector <= WM831X_BUCKP_MAX_SELECTOR)
-		return 850000 + (selector * 25000);
-	else
-		return -EINVAL;
-}
-
 static int wm831x_buckp_set_voltage_int(struct regulator_dev *rdev, int reg,
 					int min_uV, int max_uV, int *selector)
 {
@@ -620,7 +611,7 @@ static int wm831x_buckp_set_voltage_int(struct regulator_dev *rdev, int reg,
 	else
 		return -EINVAL;
 
-	if (wm831x_buckp_list_voltage(rdev, vsel) > max_uV)
+	if (regulator_list_voltage_linear(rdev, vsel) > max_uV)
 		return -EINVAL;
 
 	*selector = vsel;
@@ -652,7 +643,7 @@ static int wm831x_buckp_set_suspend_voltage(struct regulator_dev *rdev,
 static struct regulator_ops wm831x_buckp_ops = {
 	.set_voltage = wm831x_buckp_set_voltage,
 	.get_voltage_sel = regulator_get_voltage_sel_regmap,
-	.list_voltage = wm831x_buckp_list_voltage,
+	.list_voltage = regulator_list_voltage_linear,
 	.set_suspend_voltage = wm831x_buckp_set_suspend_voltage,
 
 	.is_enabled = regulator_is_enabled_regmap,
@@ -715,6 +706,8 @@ static __devinit int wm831x_buckp_probe(struct platform_device *pdev)
 	dcdc->desc.vsel_mask = WM831X_DC3_ON_VSEL_MASK;
 	dcdc->desc.enable_reg = WM831X_DCDC_ENABLE;
 	dcdc->desc.enable_mask = 1 << id;
+	dcdc->desc.min_uV = 850000;
+	dcdc->desc.uV_step = 25000;
 
 	config.dev = pdev->dev.parent;
 	if (pdata)
-- 
1.7.9.5




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

* [PATCH RESEND 2/3] regulator: wm831x-dcdc: Convert wm831x_buckp_ops to regulator_set_voltage_sel_regmap
  2012-06-13 12:27 [PATCH RESEND 1/3] regulator: wm831x-dcdc: Convert wm831x_buckp_ops to regulator_list_voltage_linear Axel Lin
@ 2012-06-13 12:27 ` Axel Lin
  2012-06-17 20:07   ` Mark Brown
  2012-06-13 12:29 ` [PATCH v2 3/3] regulator: wm831x-dcdc: Convert wm831x_buckv_ops to set_voltage_sel and map_voltage Axel Lin
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Axel Lin @ 2012-06-13 12:27 UTC (permalink / raw)
  To: linux-kernel; +Cc: Liam Girdwood, Mark Brown

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/regulator/wm831x-dcdc.c |   44 ++++++++-------------------------------
 1 file changed, 9 insertions(+), 35 deletions(-)

diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c
index fbcff56..91b5b0a 100644
--- a/drivers/regulator/wm831x-dcdc.c
+++ b/drivers/regulator/wm831x-dcdc.c
@@ -599,51 +599,25 @@ static struct platform_driver wm831x_buckv_driver = {
  * BUCKP specifics
  */
 
-static int wm831x_buckp_set_voltage_int(struct regulator_dev *rdev, int reg,
-					int min_uV, int max_uV, int *selector)
+static int wm831x_buckp_set_suspend_voltage(struct regulator_dev *rdev, int uV)
 {
 	struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
 	struct wm831x *wm831x = dcdc->wm831x;
-	u16 vsel;
-
-	if (min_uV <= 34000000)
-		vsel = (min_uV - 850000) / 25000;
-	else
-		return -EINVAL;
-
-	if (regulator_list_voltage_linear(rdev, vsel) > max_uV)
-		return -EINVAL;
-
-	*selector = vsel;
-
-	return wm831x_set_bits(wm831x, reg, WM831X_DC3_ON_VSEL_MASK, vsel);
-}
-
-static int wm831x_buckp_set_voltage(struct regulator_dev *rdev,
-				    int min_uV, int max_uV,
-				    unsigned *selector)
-{
-	struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
-	u16 reg = dcdc->base + WM831X_DCDC_ON_CONFIG;
-
-	return wm831x_buckp_set_voltage_int(rdev, reg, min_uV, max_uV,
-					    selector);
-}
-
-static int wm831x_buckp_set_suspend_voltage(struct regulator_dev *rdev,
-					    int uV)
-{
-	struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
 	u16 reg = dcdc->base + WM831X_DCDC_SLEEP_CONTROL;
-	unsigned selector;
+	int sel;
+
+	sel = regulator_map_voltage_linear(rdev, uV, uV);
+	if (sel < 0)
+		return sel;
 
-	return wm831x_buckp_set_voltage_int(rdev, reg, uV, uV, &selector);
+	return wm831x_set_bits(wm831x, reg, WM831X_DC3_ON_VSEL_MASK, sel);
 }
 
 static struct regulator_ops wm831x_buckp_ops = {
-	.set_voltage = wm831x_buckp_set_voltage,
+	.set_voltage_sel = regulator_set_voltage_sel_regmap,
 	.get_voltage_sel = regulator_get_voltage_sel_regmap,
 	.list_voltage = regulator_list_voltage_linear,
+	.map_voltage = regulator_map_voltage_linear,
 	.set_suspend_voltage = wm831x_buckp_set_suspend_voltage,
 
 	.is_enabled = regulator_is_enabled_regmap,
-- 
1.7.9.5




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

* [PATCH v2 3/3] regulator: wm831x-dcdc: Convert wm831x_buckv_ops to set_voltage_sel and map_voltage
  2012-06-13 12:27 [PATCH RESEND 1/3] regulator: wm831x-dcdc: Convert wm831x_buckp_ops to regulator_list_voltage_linear Axel Lin
  2012-06-13 12:27 ` [PATCH RESEND 2/3] regulator: wm831x-dcdc: Convert wm831x_buckp_ops to regulator_set_voltage_sel_regmap Axel Lin
@ 2012-06-13 12:29 ` Axel Lin
  2012-06-13 15:24 ` [PATCH RESEND 1/3] regulator: wm831x-dcdc: Convert wm831x_buckp_ops to regulator_list_voltage_linear Mark Brown
  2012-06-17 20:00 ` Mark Brown
  3 siblings, 0 replies; 6+ messages in thread
From: Axel Lin @ 2012-06-13 12:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Liam Girdwood, Mark Brown

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/regulator/wm831x-dcdc.c |   21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c
index 91b5b0a..7413885 100644
--- a/drivers/regulator/wm831x-dcdc.c
+++ b/drivers/regulator/wm831x-dcdc.c
@@ -215,8 +215,8 @@ static int wm831x_buckv_list_voltage(struct regulator_dev *rdev,
 	return -EINVAL;
 }
 
-static int wm831x_buckv_select_min_voltage(struct regulator_dev *rdev,
-					   int min_uV, int max_uV)
+static int wm831x_buckv_map_voltage(struct regulator_dev *rdev,
+				   int min_uV, int max_uV)
 {
 	u16 vsel;
 
@@ -251,20 +251,14 @@ static int wm831x_buckv_set_dvs(struct regulator_dev *rdev, int state)
 	return 0;
 }
 
-static int wm831x_buckv_set_voltage(struct regulator_dev *rdev,
-				    int min_uV, int max_uV, unsigned *selector)
+static int wm831x_buckv_set_voltage_sel(struct regulator_dev *rdev,
+					unsigned vsel)
 {
 	struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
 	struct wm831x *wm831x = dcdc->wm831x;
 	int on_reg = dcdc->base + WM831X_DCDC_ON_CONFIG;
 	int dvs_reg = dcdc->base + WM831X_DCDC_DVS_CONTROL;
-	int vsel, ret;
-
-	vsel = wm831x_buckv_select_min_voltage(rdev, min_uV, max_uV);
-	if (vsel < 0)
-		return vsel;
-
-	*selector = vsel;
+	int ret;
 
 	/* If this value is already set then do a GPIO update if we can */
 	if (dcdc->dvs_gpio && dcdc->on_vsel == vsel)
@@ -315,7 +309,7 @@ static int wm831x_buckv_set_suspend_voltage(struct regulator_dev *rdev,
 	u16 reg = dcdc->base + WM831X_DCDC_SLEEP_CONTROL;
 	int vsel;
 
-	vsel = wm831x_buckv_select_min_voltage(rdev, uV, uV);
+	vsel = wm831x_buckv_map_voltage(rdev, uV, uV);
 	if (vsel < 0)
 		return vsel;
 
@@ -373,9 +367,10 @@ static int wm831x_buckv_get_current_limit(struct regulator_dev *rdev)
 }
 
 static struct regulator_ops wm831x_buckv_ops = {
-	.set_voltage = wm831x_buckv_set_voltage,
+	.set_voltage_sel = wm831x_buckv_set_voltage_sel,
 	.get_voltage_sel = wm831x_buckv_get_voltage_sel,
 	.list_voltage = wm831x_buckv_list_voltage,
+	.map_voltage = wm831x_buckv_map_voltage,
 	.set_suspend_voltage = wm831x_buckv_set_suspend_voltage,
 	.set_current_limit = wm831x_buckv_set_current_limit,
 	.get_current_limit = wm831x_buckv_get_current_limit,
-- 
1.7.9.5




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

* Re: [PATCH RESEND 1/3] regulator: wm831x-dcdc: Convert wm831x_buckp_ops to regulator_list_voltage_linear
  2012-06-13 12:27 [PATCH RESEND 1/3] regulator: wm831x-dcdc: Convert wm831x_buckp_ops to regulator_list_voltage_linear Axel Lin
  2012-06-13 12:27 ` [PATCH RESEND 2/3] regulator: wm831x-dcdc: Convert wm831x_buckp_ops to regulator_set_voltage_sel_regmap Axel Lin
  2012-06-13 12:29 ` [PATCH v2 3/3] regulator: wm831x-dcdc: Convert wm831x_buckv_ops to set_voltage_sel and map_voltage Axel Lin
@ 2012-06-13 15:24 ` Mark Brown
  2012-06-17 20:00 ` Mark Brown
  3 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2012-06-13 15:24 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Liam Girdwood

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

On Wed, Jun 13, 2012 at 08:27:14PM +0800, Axel Lin wrote:
> Signed-off-by: Axel Lin <axel.lin@gmail.com>

Please don't resend stuff so quickly, give me time to get through my
inbox...

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

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

* Re: [PATCH RESEND 1/3] regulator: wm831x-dcdc: Convert wm831x_buckp_ops to regulator_list_voltage_linear
  2012-06-13 12:27 [PATCH RESEND 1/3] regulator: wm831x-dcdc: Convert wm831x_buckp_ops to regulator_list_voltage_linear Axel Lin
                   ` (2 preceding siblings ...)
  2012-06-13 15:24 ` [PATCH RESEND 1/3] regulator: wm831x-dcdc: Convert wm831x_buckp_ops to regulator_list_voltage_linear Mark Brown
@ 2012-06-17 20:00 ` Mark Brown
  3 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2012-06-17 20:00 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Liam Girdwood

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

On Wed, Jun 13, 2012 at 08:27:14PM +0800, Axel Lin wrote:
> Signed-off-by: Axel Lin <axel.lin@gmail.com>

Applied, thanks.

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

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

* Re: [PATCH RESEND 2/3] regulator: wm831x-dcdc: Convert wm831x_buckp_ops to regulator_set_voltage_sel_regmap
  2012-06-13 12:27 ` [PATCH RESEND 2/3] regulator: wm831x-dcdc: Convert wm831x_buckp_ops to regulator_set_voltage_sel_regmap Axel Lin
@ 2012-06-17 20:07   ` Mark Brown
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2012-06-17 20:07 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Liam Girdwood

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

On Wed, Jun 13, 2012 at 08:27:58PM +0800, Axel Lin wrote:
> Signed-off-by: Axel Lin <axel.lin@gmail.com>

Applied this and patch 3, thanks.

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

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

end of thread, other threads:[~2012-06-17 20:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-13 12:27 [PATCH RESEND 1/3] regulator: wm831x-dcdc: Convert wm831x_buckp_ops to regulator_list_voltage_linear Axel Lin
2012-06-13 12:27 ` [PATCH RESEND 2/3] regulator: wm831x-dcdc: Convert wm831x_buckp_ops to regulator_set_voltage_sel_regmap Axel Lin
2012-06-17 20:07   ` Mark Brown
2012-06-13 12:29 ` [PATCH v2 3/3] regulator: wm831x-dcdc: Convert wm831x_buckv_ops to set_voltage_sel and map_voltage Axel Lin
2012-06-13 15:24 ` [PATCH RESEND 1/3] regulator: wm831x-dcdc: Convert wm831x_buckp_ops to regulator_list_voltage_linear Mark Brown
2012-06-17 20:00 ` 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.