All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] regulator: core.c Pass voltage to notifier when setting voltage
@ 2012-06-14 22:06 Philip Rakity
       [not found] ` <CADTbHxq5rmHJtFTp53sYhFSYWVrSqyo_Jq+0aWNOF2HQR+nhGA@mail.gmail.com>
  0 siblings, 1 reply; 9+ messages in thread
From: Philip Rakity @ 2012-06-14 22:06 UTC (permalink / raw)
  To: linux-kernel, broonie; +Cc: linux-mmc, Philip Rakity

V2
--

Incorporate performance suggestions made by Mark Brown
Use linux-next as base code rather than mmc-next

The voltage being set should be passed to the handler requesting
the callback.  Currently this is not done.

The callback cannot call regulator_get_voltage() to get the
information since the mutex is held by the regulator and
deadlock occurs.

Without this change the receiver of the notify cannot now what
action to take.  This is used, for example, to set PAD voltages
when doing SD vccq voltage changes.

Signed-off-by: Philip Rakity <prakity@marvell.com>
---
 drivers/regulator/core.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 63507a5..5b04916 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2153,7 +2153,7 @@ static int _regulator_do_set_voltage(struct regulator_dev *rdev,
 	if (rdev->desc->ops->list_voltage)
 		best_val = rdev->desc->ops->list_voltage(rdev, selector);
 	else
-		best_val = -1;
+		best_val = _regulator_get_voltage(rdev);
 
 	/* Call set_voltage_time_sel if successfully obtained old_selector */
 	if (_regulator_is_enabled(rdev) && ret == 0 && old_selector >= 0 &&
@@ -2176,9 +2176,9 @@ static int _regulator_do_set_voltage(struct regulator_dev *rdev,
 		udelay(delay);
 	}
 
-	if (ret == 0)
+	if (ret == 0 && best_val >= 0)
 		_notifier_call_chain(rdev, REGULATOR_EVENT_VOLTAGE_CHANGE,
-				     NULL);
+				     (void *)best_val);
 
 	trace_regulator_set_voltage_complete(rdev_get_name(rdev), best_val);
 
-- 
1.7.0.4

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

* Re: [PATCH 1/2] regulator: core.c Pass voltage to notifier when setting voltage
       [not found] ` <CADTbHxq5rmHJtFTp53sYhFSYWVrSqyo_Jq+0aWNOF2HQR+nhGA@mail.gmail.com>
@ 2012-06-15 18:08   ` Mark Brown
  2012-06-15 18:29   ` Philip Rakity
  1 sibling, 0 replies; 9+ messages in thread
From: Mark Brown @ 2012-06-15 18:08 UTC (permalink / raw)
  To: Pankaj Jangra; +Cc: Philip Rakity, linux-kernel, linux-mmc, Philip Rakity

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

On Fri, Jun 15, 2012 at 11:28:38PM +0530, Pankaj Jangra wrote:

> I am also curious to know if you pass the  voltage here to notifier call
> how does it make any difference, since in
> blocking_notifier_call_chain() again passes the NULL. So does your patch
> should  modify the arguments to this function also?
> Please let me know if i am missing something in understanding.

Your mail would have been rather more comprehensible if you'd mentioned
that you were talking about the call in _blocking_notifier_call_chain()
(which is obviously buggy).

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

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

* [PATCH 1/2] regulator: core.c Pass voltage to notifier when setting voltage
@ 2012-06-15 18:27 Philip Rakity
  2012-06-15 18:50 ` Pankaj Jangra
  2012-06-17 18:12 ` Mark Brown
  0 siblings, 2 replies; 9+ messages in thread
From: Philip Rakity @ 2012-06-15 18:27 UTC (permalink / raw)
  To: linux-kernel, broonie; +Cc: linux-mmc, Philip Rakity

V3
--

Fix type where data argument was not passed in
blocking_notifier_call_chain.

edits to check in comments (below)

V2
--

Incorporate performance suggestions made by Mark Brown
Use linux-next as base code rather than mmc-next

The voltage being set should be passed to the call in handler
requesting the callback.  Currently this is not done.

The callin handler cannot call regulator_get_voltage() to get the
information since the mutex is held by the regulator and
deadlock occurs.

Without this change the receiver of the call in cannot know what
action to take.  This is used, for example, to set PAD voltages
when doing SD vccq voltage changes.

Signed-off-by: Philip Rakity <prakity@marvell.com>
---
 drivers/regulator/core.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 63507a5..cdf6905 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2153,7 +2153,7 @@ static int _regulator_do_set_voltage(struct regulator_dev *rdev,
 	if (rdev->desc->ops->list_voltage)
 		best_val = rdev->desc->ops->list_voltage(rdev, selector);
 	else
-		best_val = -1;
+		best_val = _regulator_get_voltage(rdev);
 
 	/* Call set_voltage_time_sel if successfully obtained old_selector */
 	if (_regulator_is_enabled(rdev) && ret == 0 && old_selector >= 0 &&
@@ -2176,9 +2176,9 @@ static int _regulator_do_set_voltage(struct regulator_dev *rdev,
 		udelay(delay);
 	}
 
-	if (ret == 0)
+	if (ret == 0 && best_val >= 0)
 		_notifier_call_chain(rdev, REGULATOR_EVENT_VOLTAGE_CHANGE,
-				     NULL);
+				     (void *)best_val);
 
 	trace_regulator_set_voltage_complete(rdev_get_name(rdev), best_val);
 
@@ -2692,7 +2692,7 @@ static void _notifier_call_chain(struct regulator_dev *rdev,
 				  unsigned long event, void *data)
 {
 	/* call rdev chain first */
-	blocking_notifier_call_chain(&rdev->notifier, event, NULL);
+	blocking_notifier_call_chain(&rdev->notifier, event, data);
 }
 
 /**
-- 
1.7.0.4

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

* Re: [PATCH 1/2] regulator: core.c Pass voltage to notifier when setting voltage
       [not found] ` <CADTbHxq5rmHJtFTp53sYhFSYWVrSqyo_Jq+0aWNOF2HQR+nhGA@mail.gmail.com>
  2012-06-15 18:08   ` Mark Brown
@ 2012-06-15 18:29   ` Philip Rakity
  2012-06-15 18:37     ` Pankaj Jangra
  1 sibling, 1 reply; 9+ messages in thread
From: Philip Rakity @ 2012-06-15 18:29 UTC (permalink / raw)
  To: Pankaj Jangra
  Cc: Philip Rakity, linux-kernel@vger.kernel.org,
	broonie@opensource.wolfsonmicro.com, linux-mmc@vger.kernel.org


On Jun 15, 2012, at 10:58 AM, Pankaj Jangra wrote:

> Hi Philip,
> 
> Just a cosmetic comments.
> 
> On Fri, Jun 15, 2012 at 3:36 AM, Philip Rakity <philipspatches@gmail.com> wrote:
> V2
> --
> 
> Incorporate performance suggestions made by Mark Brown
> Use linux-next as base code rather than mmc-next
> 
> The voltage being set should be passed to the handler requesting
> the callback.  Currently this is not done.

thanks -- my typo when redoing the patch -- V3 has this fixed.

> 
> The callback cannot call regulator_get_voltage() to get the
> information since the mutex is held by the regulator and
> deadlock occurs.
> 
> Without this change the receiver of the notify cannot now what
>  
> You mean to say "cannot know what" ?   
> 
> action to take.  This is used, for example, to set PAD voltages
> when doing SD vccq voltage changes.


if you call in that receives the notify does not know the new voltage
then in our case we do not know if we should switch the pad from
3.3v to 1.8v for example.  vccq signaling in SD is normally 3.3V
but in UHS mode it is lowered to 1.8V

> 
> Signed-off-by: Philip Rakity <prakity@marvell.com>
> ---
>  drivers/regulator/core.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
> index 63507a5..5b04916 100644
> --- a/drivers/regulator/core.c
> +++ b/drivers/regulator/core.c
> @@ -2153,7 +2153,7 @@ static int _regulator_do_set_voltage(struct regulator_dev *rdev,
>        if (rdev->desc->ops->list_voltage)
>                best_val = rdev->desc->ops->list_voltage(rdev, selector);
>        else
> -               best_val = -1;
> +               best_val = _regulator_get_voltage(rdev);
> 
>        /* Call set_voltage_time_sel if successfully obtained old_selector */
>        if (_regulator_is_enabled(rdev) && ret == 0 && old_selector >= 0 &&
> @@ -2176,9 +2176,9 @@ static int _regulator_do_set_voltage(struct regulator_dev *rdev,
>                udelay(delay);
>        }
> 
> -       if (ret == 0)
> +       if (ret == 0 && best_val >= 0)
>                _notifier_call_chain(rdev, REGULATOR_EVENT_VOLTAGE_CHANGE,
> -                                    NULL);
> +                                    (void *)best_val);
> 
> 
> I am also curious to know if you pass the  voltage here to notifier call how does it make any difference, since in 
> blocking_notifier_call_chain() again passes the NULL. So does your patch should  modify the arguments to this function also?
> Please let me know if i am missing something in understanding.
> 
> Regards,
> Pankaj Jangra
> 
>        trace_regulator_set_voltage_complete(rdev_get_name(rdev), best_val);
> 
> --
> 1.7.0.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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

* Re: [PATCH 1/2] regulator: core.c Pass voltage to notifier when setting voltage
  2012-06-15 18:29   ` Philip Rakity
@ 2012-06-15 18:37     ` Pankaj Jangra
  0 siblings, 0 replies; 9+ messages in thread
From: Pankaj Jangra @ 2012-06-15 18:37 UTC (permalink / raw)
  To: Philip Rakity
  Cc: Philip Rakity, linux-kernel@vger.kernel.org,
	broonie@opensource.wolfsonmicro.com, linux-mmc@vger.kernel.org

Hi,

On Fri, Jun 15, 2012 at 11:59 PM, Philip Rakity <prakity@marvell.com> wrote:
>
> On Jun 15, 2012, at 10:58 AM, Pankaj Jangra wrote:
>
>> Hi Philip,
>>
>> Just a cosmetic comments.
>>
>> On Fri, Jun 15, 2012 at 3:36 AM, Philip Rakity <philipspatches@gmail.com> wrote:
>> V2
>> --
>>
>> Incorporate performance suggestions made by Mark Brown
>> Use linux-next as base code rather than mmc-next
>>
>> The voltage being set should be passed to the handler requesting
>> the callback.  Currently this is not done.
>
> thanks -- my typo when redoing the patch -- V3 has this fixed.
>
>>
>> The callback cannot call regulator_get_voltage() to get the
>> information since the mutex is held by the regulator and
>> deadlock occurs.
>>
>> Without this change the receiver of the notify cannot now what
>>
>> You mean to say "cannot know what" ?
>>
>> action to take.  This is used, for example, to set PAD voltages
>> when doing SD vccq voltage changes.
>
>
> if you call in that receives the notify does not know the new voltage
> then in our case we do not know if we should switch the pad from
> 3.3v to 1.8v for example.  vccq signaling in SD is normally 3.3V
> but in UHS mode it is lowered to 1.8V
>

Yes right. So that means we need to make change in
blocking_notifier_call_chain() too in order to send the voltage back?

Regards,
Pankaj Jangra

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

* Re: [PATCH 1/2] regulator: core.c Pass voltage to notifier when setting voltage
  2012-06-15 18:27 [PATCH 1/2] regulator: core.c Pass voltage to notifier when setting voltage Philip Rakity
@ 2012-06-15 18:50 ` Pankaj Jangra
  2012-06-15 19:18   ` Philip Rakity
  2012-06-17 18:12 ` Mark Brown
  1 sibling, 1 reply; 9+ messages in thread
From: Pankaj Jangra @ 2012-06-15 18:50 UTC (permalink / raw)
  To: Philip Rakity; +Cc: linux-kernel, broonie, linux-mmc, Philip Rakity

Hi,

On Fri, Jun 15, 2012 at 11:57 PM, Philip Rakity
<philipspatches@gmail.com> wrote:
> V3
> --
>
> Fix type where data argument was not passed in
> blocking_notifier_call_chain.
>
> edits to check in comments (below)
>
> V2
> --
>
> Incorporate performance suggestions made by Mark Brown
> Use linux-next as base code rather than mmc-next
>
> The voltage being set should be passed to the call in handler
> requesting the callback.  Currently this is not done.
>
> The callin handler cannot call regulator_get_voltage() to get the

"The calling"

> information since the mutex is held by the regulator and
> deadlock occurs.
>
> Without this change the receiver of the call in cannot know what
> action to take.  This is used, for example, to set PAD voltages
> when doing SD vccq voltage changes.
>
> Signed-off-by: Philip Rakity <prakity@marvell.com>
> ---

Since you are submitting your patch from the different email than your
Singed-off email. So you should put in first line of message
From: <your real email>.

Regards,
Pankaj Jangra

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

* Re: [PATCH 1/2] regulator: core.c Pass voltage to notifier when setting voltage
  2012-06-15 18:50 ` Pankaj Jangra
@ 2012-06-15 19:18   ` Philip Rakity
  2012-06-16  6:33     ` Pankaj Jangra
  0 siblings, 1 reply; 9+ messages in thread
From: Philip Rakity @ 2012-06-15 19:18 UTC (permalink / raw)
  To: Pankaj Jangra
  Cc: Philip Rakity, linux-kernel@vger.kernel.org,
	broonie@opensource.wolfsonmicro.com, linux-mmc@vger.kernel.org


On Jun 15, 2012, at 11:50 AM, Pankaj Jangra wrote:

> Hi,
> 
> On Fri, Jun 15, 2012 at 11:57 PM, Philip Rakity
> <philipspatches@gmail.com> wrote:
>> V3
>> --
>> 
>> Fix type where data argument was not passed in
>> blocking_notifier_call_chain.
>> 
>> edits to check in comments (below)
>> 
>> V2
>> --
>> 
>> Incorporate performance suggestions made by Mark Brown
>> Use linux-next as base code rather than mmc-next
>> 
>> The voltage being set should be passed to the call in handler
>> requesting the callback.  Currently this is not done.
>> 
>> The callin handler cannot call regulator_get_voltage() to get the
> 
> "The calling"

I am not sure what the correct term for this.  The blocking_notifier_call_chain calls 
what ?   calling might imply blocking_notifier_call_chain() since it is doing the calling.
What is the receiver of the call named ?

> 
>> information since the mutex is held by the regulator and
>> deadlock occurs.
>> 
>> Without this change the receiver of the call in cannot know what
>> action to take.  This is used, for example, to set PAD voltages
>> when doing SD vccq voltage changes.
>> 
>> Signed-off-by: Philip Rakity <prakity@marvell.com>
>> ---
> 
> Since you are submitting your patch from the different email than your
> Singed-off email. So you should put in first line of message
> From: <your real email>.
> 
> Regards,
> Pankaj Jangra


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

* Re: [PATCH 1/2] regulator: core.c Pass voltage to notifier when setting voltage
  2012-06-15 19:18   ` Philip Rakity
@ 2012-06-16  6:33     ` Pankaj Jangra
  0 siblings, 0 replies; 9+ messages in thread
From: Pankaj Jangra @ 2012-06-16  6:33 UTC (permalink / raw)
  To: Philip Rakity
  Cc: Philip Rakity, linux-kernel@vger.kernel.org,
	broonie@opensource.wolfsonmicro.com, linux-mmc@vger.kernel.org

Hi,

On Sat, Jun 16, 2012 at 12:48 AM, Philip Rakity <prakity@marvell.com> wrote:
>
> On Jun 15, 2012, at 11:50 AM, Pankaj Jangra wrote:
>
>> Hi,
>>
>> On Fri, Jun 15, 2012 at 11:57 PM, Philip Rakity
>> <philipspatches@gmail.com> wrote:
>>> V3
>>> --
>>>
>>>
>>> The callin handler cannot call regulator_get_voltage() to get the
>>
>> "The calling"
>
> I am not sure what the correct term for this.  The blocking_notifier_call_chain calls
> what ?   calling might imply blocking_notifier_call_chain() since it is doing the calling.
> What is the receiver of the call named ?
>

I was trying to bring up the spelling typo s/callin/calling though

Regards,
Pankaj Jangra

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

* Re: [PATCH 1/2] regulator: core.c Pass voltage to notifier when setting voltage
  2012-06-15 18:27 [PATCH 1/2] regulator: core.c Pass voltage to notifier when setting voltage Philip Rakity
  2012-06-15 18:50 ` Pankaj Jangra
@ 2012-06-17 18:12 ` Mark Brown
  1 sibling, 0 replies; 9+ messages in thread
From: Mark Brown @ 2012-06-17 18:12 UTC (permalink / raw)
  To: Philip Rakity; +Cc: linux-kernel, linux-mmc, Philip Rakity, Pankaj Jangra

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

On Fri, Jun 15, 2012 at 11:27:36AM -0700, Philip Rakity wrote:

> V3
> --

Applied, thanks (though this changelog should've come in the --- after
the main changelog rather than before so it didn't appear in the
changelog).  I made the spelling fix Pankaj pointed out as well.

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

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

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

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-15 18:27 [PATCH 1/2] regulator: core.c Pass voltage to notifier when setting voltage Philip Rakity
2012-06-15 18:50 ` Pankaj Jangra
2012-06-15 19:18   ` Philip Rakity
2012-06-16  6:33     ` Pankaj Jangra
2012-06-17 18:12 ` Mark Brown
  -- strict thread matches above, loose matches on Subject: below --
2012-06-14 22:06 Philip Rakity
     [not found] ` <CADTbHxq5rmHJtFTp53sYhFSYWVrSqyo_Jq+0aWNOF2HQR+nhGA@mail.gmail.com>
2012-06-15 18:08   ` Mark Brown
2012-06-15 18:29   ` Philip Rakity
2012-06-15 18:37     ` Pankaj Jangra

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.