* [PATCH] regulator: Convert max8952 to set_voltage_sel
@ 2012-03-26 1:20 Axel Lin
2012-03-26 17:30 ` Mark Brown
0 siblings, 1 reply; 3+ messages in thread
From: Axel Lin @ 2012-03-26 1:20 UTC (permalink / raw)
To: linux-kernel; +Cc: Liam Girdwood, Mark Brown, MyungJoo Ham, Kyungmin Park
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/regulator/max8952.c | 28 +++++++---------------------
1 files changed, 7 insertions(+), 21 deletions(-)
diff --git a/drivers/regulator/max8952.c b/drivers/regulator/max8952.c
index e9c0a0e..c35236a 100644
--- a/drivers/regulator/max8952.c
+++ b/drivers/regulator/max8952.c
@@ -130,11 +130,10 @@ static int max8952_get_voltage(struct regulator_dev *rdev)
return max8952_voltage(max8952, vid);
}
-static int max8952_set_voltage(struct regulator_dev *rdev,
- int min_uV, int max_uV, unsigned *selector)
+static int max8952_set_voltage_sel(struct regulator_dev *rdev,
+ unsigned selector)
{
struct max8952_data *max8952 = rdev_get_drvdata(rdev);
- s8 vid = -1, i;
if (!gpio_is_valid(max8952->pdata->gpio_vid0) ||
!gpio_is_valid(max8952->pdata->gpio_vid1)) {
@@ -142,23 +141,10 @@ static int max8952_set_voltage(struct regulator_dev *rdev,
return -EPERM;
}
- for (i = 0; i < MAX8952_NUM_DVS_MODE; i++) {
- int volt = max8952_voltage(max8952, i);
-
- /* Set the voltage as low as possible within the range */
- if (volt <= max_uV && volt >= min_uV)
- if (vid == -1 || max8952_voltage(max8952, vid) > volt)
- vid = i;
- }
-
- if (vid >= 0 && vid < MAX8952_NUM_DVS_MODE) {
- max8952->vid0 = vid & 0x1;
- max8952->vid1 = (vid >> 1) & 0x1;
- *selector = vid;
- gpio_set_value(max8952->pdata->gpio_vid0, max8952->vid0);
- gpio_set_value(max8952->pdata->gpio_vid1, max8952->vid1);
- } else
- return -EINVAL;
+ max8952->vid0 = selector & 0x1;
+ max8952->vid1 = (selector >> 1) & 0x1;
+ gpio_set_value(max8952->pdata->gpio_vid0, max8952->vid0);
+ gpio_set_value(max8952->pdata->gpio_vid1, max8952->vid1);
return 0;
}
@@ -169,7 +155,7 @@ static struct regulator_ops max8952_ops = {
.enable = max8952_enable,
.disable = max8952_disable,
.get_voltage = max8952_get_voltage,
- .set_voltage = max8952_set_voltage,
+ .set_voltage_sel = max8952_set_voltage_sel,
.set_suspend_disable = max8952_disable,
};
--
1.7.5.4
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] regulator: Convert max8952 to set_voltage_sel
2012-03-26 1:20 [PATCH] regulator: Convert max8952 to set_voltage_sel Axel Lin
@ 2012-03-26 17:30 ` Mark Brown
0 siblings, 0 replies; 3+ messages in thread
From: Mark Brown @ 2012-03-26 17:30 UTC (permalink / raw)
To: Axel Lin; +Cc: linux-kernel, Liam Girdwood, MyungJoo Ham, Kyungmin Park
[-- Attachment #1: Type: text/plain, Size: 123 bytes --]
On Mon, Mar 26, 2012 at 09:20:58AM +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] 3+ messages in thread
* Re: [PATCH] regulator: Convert max8952 to set_voltage_sel
@ 2012-03-26 4:39 함명주
0 siblings, 0 replies; 3+ messages in thread
From: 함명주 @ 2012-03-26 4:39 UTC (permalink / raw)
To: Axel Lin, linux-kernel
Cc: Liam Girdwood, Mark Brown, 박경민
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=euc-kr, Size: 2493 bytes --]
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
> ---
> drivers/regulator/max8952.c | 28 +++++++---------------------
> 1 files changed, 7 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/regulator/max8952.c b/drivers/regulator/max8952.c
> index e9c0a0e..c35236a 100644
> --- a/drivers/regulator/max8952.c
> +++ b/drivers/regulator/max8952.c
> @@ -130,11 +130,10 @@ static int max8952_get_voltage(struct regulator_dev *rdev)
> return max8952_voltage(max8952, vid);
> }
>
> -static int max8952_set_voltage(struct regulator_dev *rdev,
> - int min_uV, int max_uV, unsigned *selector)
> +static int max8952_set_voltage_sel(struct regulator_dev *rdev,
> + unsigned selector)
> {
> struct max8952_data *max8952 = rdev_get_drvdata(rdev);
> - s8 vid = -1, i;
>
> if (!gpio_is_valid(max8952->pdata->gpio_vid0) ||
> !gpio_is_valid(max8952->pdata->gpio_vid1)) {
> @@ -142,23 +141,10 @@ static int max8952_set_voltage(struct regulator_dev *rdev,
> return -EPERM;
> }
>
> - for (i = 0; i < MAX8952_NUM_DVS_MODE; i++) {
> - int volt = max8952_voltage(max8952, i);
> -
> - /* Set the voltage as low as possible within the range */
> - if (volt <= max_uV && volt >= min_uV)
> - if (vid == -1 || max8952_voltage(max8952, vid) > volt)
> - vid = i;
> - }
> -
> - if (vid >= 0 && vid < MAX8952_NUM_DVS_MODE) {
> - max8952->vid0 = vid & 0x1;
> - max8952->vid1 = (vid >> 1) & 0x1;
> - *selector = vid;
> - gpio_set_value(max8952->pdata->gpio_vid0, max8952->vid0);
> - gpio_set_value(max8952->pdata->gpio_vid1, max8952->vid1);
> - } else
> - return -EINVAL;
> + max8952->vid0 = selector & 0x1;
> + max8952->vid1 = (selector >> 1) & 0x1;
> + gpio_set_value(max8952->pdata->gpio_vid0, max8952->vid0);
> + gpio_set_value(max8952->pdata->gpio_vid1, max8952->vid1);
>
> return 0;
> }
> @@ -169,7 +155,7 @@ static struct regulator_ops max8952_ops = {
> .enable = max8952_enable,
> .disable = max8952_disable,
> .get_voltage = max8952_get_voltage,
> - .set_voltage = max8952_set_voltage,
> + .set_voltage_sel = max8952_set_voltage_sel,
> .set_suspend_disable = max8952_disable,
> };
>
> --
> 1.7.5.4
>
--
MyungJoo Ham (ÇÔ¸íÁÖ), PHD
System S/W Lab, S/W Platform Team, Software Center
Samsung Electronics
Cell: +82-10-6714-2858ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-03-26 17:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-26 1:20 [PATCH] regulator: Convert max8952 to set_voltage_sel Axel Lin
2012-03-26 17:30 ` Mark Brown
-- strict thread matches above, loose matches on Subject: below --
2012-03-26 4:39 함명주
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox