<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>[PATCH] regulator: tps62360: Simplify tps62360_set_voltage_time_sel implementation</title>
        <description> For linear mappings, we can use below equation to get the voltage difference
between new_selector and old_selector:

abs(new_selector - old_selector) * rdev-&amp;gt;desc-&amp;gt;uV_step

Signed-off-by: Axel Lin &amp;lt;axel.lin@gmail.com&amp;gt;
---
 drivers/regulator/tps62360-regulator.c |   13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/regulator/tps62360-regulator.c b/drivers/regulator/tps62360-regulator.c
index e534269..d044a58 100644
--- a/drivers/regulator/tps62360-regulator.c
+++ b/drivers/regulator/tps62360-regulator.c
@@ -179,17 +179,10 @@ static int tps62360_set_voltage_time_sel(struct regulator_dev *rdev,
 		unsigned int old_selector, unsigned int new_selector)
 {
 	struct tps62360_chip *tps = rdev_get_drvdata(rdev);
-	int old_uV, new_uV;
 
-	old_uV = regulator_list_voltage_linear(rdev, old_selector);
-	if (old_uV &amp;lt; 0)
-		return old_uV;
-
-	new_uV = regulator_list_voltage_linear(rdev, new_selector);
-	if (new_uV &amp;lt; 0)
-		return new_uV;
-
-	return DIV_ROUND_UP(abs(old_uV - new_uV), tps-&amp;gt;change_uv_per_us);
+	return DIV_ROUND_UP(abs(new_selector - old_selector) *
+			    rdev-&amp;gt;desc-&amp;gt;uV_step,
+			    tps-&amp;gt;change_uv_per_us);
 }
 
 static int tps62360_set_mode(struct regulator_dev *rdev, unsigned int mode)
-- 
1.7.9.5



--
To unsubscribe from this list: send the line &amp;quot;unsubscribe linux-kernel&amp;quot; in
the body of a message to &amp;#109;&amp;#97;&amp;#106;&amp;#111;&amp;#114;&amp;#100;&amp;#111;&amp;#109;&amp;#111;&amp;#64;&amp;#118;&amp;#103;&amp;#101;&amp;#114;&amp;#46;&amp;#107;&amp;#101;&amp;#114;&amp;#110;&amp;#101;&amp;#108;&amp;#46;&amp;#111;&amp;#114;&amp;#103;
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/</description>
        <link>http://www.serverphorums.com/read.php?12,510006,510006#msg-510006</link>
        <lastBuildDate>Mon, 20 May 2013 08:37:07 +0200</lastBuildDate>
        <generator>Phorum 5.2.18</generator>
        <item>
            <guid>http://www.serverphorums.com/read.php?12,510006,514993#msg-514993</guid>
            <title>Re: [PATCH] regulator: tps62360: Simplify tps62360_set_voltage_time_sel implementation</title>
            <link>http://www.serverphorums.com/read.php?12,510006,514993#msg-514993</link>
            <description><![CDATA[ On Monday 18 June 2012 10:49 AM, Axel Lin wrote:<br />
&gt; 2012/6/18 Mark Brown&lt;broonie@opensource.wolfsonmicro.com&gt;:<br />
&gt;&gt; On Fri, Jun 08, 2012 at 02:35:32PM +0800, Axel Lin wrote:<br />
&gt;&gt;<br />
&gt; This make me think if we should change the unit of ramp_delay<br />
&gt; to uV/uS rather than mV/uS. So we can avoid truncate issue.<br />
&gt;<br />
Yes, we should have the ramp delay in uV/uS. many times, the ramp delay <br />
come as 0.025mV/uS  which will not be possible if we do mv/us.<br />
<br />
--<br />
To unsubscribe from this list: send the line &quot;unsubscribe linux-kernel&quot; in<br />
the body of a message to <a href="mailto:&#109;&#97;&#106;&#111;&#114;&#100;&#111;&#109;&#111;&#64;&#118;&#103;&#101;&#114;&#46;&#107;&#101;&#114;&#110;&#101;&#108;&#46;&#111;&#114;&#103;">&#109;&#97;&#106;&#111;&#114;&#100;&#111;&#109;&#111;&#64;&#118;&#103;&#101;&#114;&#46;&#107;&#101;&#114;&#110;&#101;&#108;&#46;&#111;&#114;&#103;</a><br />
More majordomo info at  <a href="http://vger.kernel.org/majordomo-info.html" target="_blank"  rel="nofollow">http://vger.kernel.org/majordomo-info.html</a><br />
Please read the FAQ at  <a href="http://www.tux.org/lkml/" target="_blank"  rel="nofollow">http://www.tux.org/lkml/</a>]]></description>
            <dc:creator>Laxman Dewangan</dc:creator>
            <category>Linux Kernel</category>
            <pubDate>Mon, 18 Jun 2012 07:30:03 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?12,510006,514992#msg-514992</guid>
            <title>Re: [PATCH] regulator: tps62360: Simplify tps62360_set_voltage_time_sel implementation</title>
            <link>http://www.serverphorums.com/read.php?12,510006,514992#msg-514992</link>
            <description><![CDATA[ 2012/6/18 Mark Brown &lt;broonie@opensource.wolfsonmicro.com&gt;:<br />
&gt; On Fri, Jun 08, 2012 at 02:35:32PM +0800, Axel Lin wrote:<br />
&gt;&gt; For linear mappings, we can use below equation to get the voltage difference<br />
&gt;&gt; between new_selector and old_selector:<br />
&gt;<br />
&gt; Applied, thanks.  There's a new framework feature that Yadwinder Singh<br />
&gt; has contributed which should allow this to be moved to the regulator<br />
&gt; desc.<br />
<br />
In this case, tps-&gt;change_uv_per_us is is calculated by :<br />
tps-&gt;change_uv_per_us = DIV_ROUND_UP(32000, BIT(ramp_ctrl));<br />
<br />
Which means tps-&gt;change_uv_per_us may be not alignment to mV.<br />
<br />
This make me think if we should change the unit of ramp_delay<br />
to uV/uS rather than mV/uS. So we can avoid truncate issue.<br />
<br />
Regards,<br />
Axel<br />
--<br />
To unsubscribe from this list: send the line &quot;unsubscribe linux-kernel&quot; in<br />
the body of a message to <a href="mailto:&#109;&#97;&#106;&#111;&#114;&#100;&#111;&#109;&#111;&#64;&#118;&#103;&#101;&#114;&#46;&#107;&#101;&#114;&#110;&#101;&#108;&#46;&#111;&#114;&#103;">&#109;&#97;&#106;&#111;&#114;&#100;&#111;&#109;&#111;&#64;&#118;&#103;&#101;&#114;&#46;&#107;&#101;&#114;&#110;&#101;&#108;&#46;&#111;&#114;&#103;</a><br />
More majordomo info at  <a href="http://vger.kernel.org/majordomo-info.html" target="_blank"  rel="nofollow">http://vger.kernel.org/majordomo-info.html</a><br />
Please read the FAQ at  <a href="http://www.tux.org/lkml/" target="_blank"  rel="nofollow">http://www.tux.org/lkml/</a>]]></description>
            <dc:creator>Axel Lin</dc:creator>
            <category>Linux Kernel</category>
            <pubDate>Mon, 18 Jun 2012 07:30:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?12,510006,514863#msg-514863</guid>
            <title>Re: [PATCH] regulator: tps62360: Simplify tps62360_set_voltage_time_sel implementation</title>
            <link>http://www.serverphorums.com/read.php?12,510006,514863#msg-514863</link>
            <description><![CDATA[ On Fri, Jun 08, 2012 at 02:35:32PM +0800, Axel Lin wrote:<br />
&gt; For linear mappings, we can use below equation to get the voltage difference<br />
&gt; between new_selector and old_selector:<br />
<br />
Applied, thanks.  There's a new framework feature that Yadwinder Singh<br />
has contributed which should allow this to be moved to the regulator<br />
desc.]]></description>
            <dc:creator>Mark Brown</dc:creator>
            <category>Linux Kernel</category>
            <pubDate>Sun, 17 Jun 2012 22:10:01 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?12,510006,510006#msg-510006</guid>
            <title>[PATCH] regulator: tps62360: Simplify tps62360_set_voltage_time_sel implementation</title>
            <link>http://www.serverphorums.com/read.php?12,510006,510006#msg-510006</link>
            <description><![CDATA[ For linear mappings, we can use below equation to get the voltage difference<br />
between new_selector and old_selector:<br />
<br />
abs(new_selector - old_selector) * rdev-&gt;desc-&gt;uV_step<br />
<br />
Signed-off-by: Axel Lin &lt;axel.lin@gmail.com&gt;<br />
---<br />
 drivers/regulator/tps62360-regulator.c |   13 +++----------<br />
 1 file changed, 3 insertions(+), 10 deletions(-)<br />
<br />
diff --git a/drivers/regulator/tps62360-regulator.c b/drivers/regulator/tps62360-regulator.c<br />
index e534269..d044a58 100644<br />
--- a/drivers/regulator/tps62360-regulator.c<br />
+++ b/drivers/regulator/tps62360-regulator.c<br />
@@ -179,17 +179,10 @@ static int tps62360_set_voltage_time_sel(struct regulator_dev *rdev,<br />
 		unsigned int old_selector, unsigned int new_selector)<br />
 {<br />
 	struct tps62360_chip *tps = rdev_get_drvdata(rdev);<br />
-	int old_uV, new_uV;<br />
 <br />
-	old_uV = regulator_list_voltage_linear(rdev, old_selector);<br />
-	if (old_uV &lt; 0)<br />
-		return old_uV;<br />
-<br />
-	new_uV = regulator_list_voltage_linear(rdev, new_selector);<br />
-	if (new_uV &lt; 0)<br />
-		return new_uV;<br />
-<br />
-	return DIV_ROUND_UP(abs(old_uV - new_uV), tps-&gt;change_uv_per_us);<br />
+	return DIV_ROUND_UP(abs(new_selector - old_selector) *<br />
+			    rdev-&gt;desc-&gt;uV_step,<br />
+			    tps-&gt;change_uv_per_us);<br />
 }<br />
 <br />
 static int tps62360_set_mode(struct regulator_dev *rdev, unsigned int mode)<br />
-- <br />
1.7.9.5<br />
<br />
<br />
<br />
--<br />
To unsubscribe from this list: send the line &quot;unsubscribe linux-kernel&quot; in<br />
the body of a message to <a href="mailto:&#109;&#97;&#106;&#111;&#114;&#100;&#111;&#109;&#111;&#64;&#118;&#103;&#101;&#114;&#46;&#107;&#101;&#114;&#110;&#101;&#108;&#46;&#111;&#114;&#103;">&#109;&#97;&#106;&#111;&#114;&#100;&#111;&#109;&#111;&#64;&#118;&#103;&#101;&#114;&#46;&#107;&#101;&#114;&#110;&#101;&#108;&#46;&#111;&#114;&#103;</a><br />
More majordomo info at  <a href="http://vger.kernel.org/majordomo-info.html" target="_blank"  rel="nofollow">http://vger.kernel.org/majordomo-info.html</a><br />
Please read the FAQ at  <a href="http://www.tux.org/lkml/" target="_blank"  rel="nofollow">http://www.tux.org/lkml/</a>]]></description>
            <dc:creator>Axel Lin</dc:creator>
            <category>Linux Kernel</category>
            <pubDate>Fri, 08 Jun 2012 08:40:01 +0200</pubDate>
        </item>
    </channel>
</rss>
