public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] regulator: palmas: use correct device node for DT parsing
@ 2013-02-27 14:10 Laxman Dewangan
  2013-02-27 14:23 ` Graeme Gregory
  0 siblings, 1 reply; 6+ messages in thread
From: Laxman Dewangan @ 2013-02-27 14:10 UTC (permalink / raw)
  To: broonie; +Cc: gg, linux-kernel, swarren, ian, lrg, Laxman Dewangan

When device is registered through the DT then regulators node
exist in the parent device node of regulator driver. Hence passing
parent device node for parsing DT in place of self-device node
which is typically NULL.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
---
 drivers/regulator/palmas-regulator.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c
index e915629..f07501d 100644
--- a/drivers/regulator/palmas-regulator.c
+++ b/drivers/regulator/palmas-regulator.c
@@ -591,7 +591,7 @@ static int palmas_probe(struct platform_device *pdev)
 {
 	struct palmas *palmas = dev_get_drvdata(pdev->dev.parent);
 	struct palmas_pmic_platform_data *pdata = pdev->dev.platform_data;
-	struct device_node *node = pdev->dev.of_node;
+	struct device_node *node = pdev->dev.parent->of_node;
 	struct regulator_dev *rdev;
 	struct regulator_config config = { };
 	struct palmas_pmic *pmic;
-- 
1.7.1.1


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

* Re: [PATCH] regulator: palmas: use correct device node for DT parsing
  2013-02-27 14:10 [PATCH] regulator: palmas: use correct device node for DT parsing Laxman Dewangan
@ 2013-02-27 14:23 ` Graeme Gregory
  2013-02-27 14:28   ` Laxman Dewangan
  2013-03-01  6:39   ` Mark Brown
  0 siblings, 2 replies; 6+ messages in thread
From: Graeme Gregory @ 2013-02-27 14:23 UTC (permalink / raw)
  To: Laxman Dewangan; +Cc: broonie, linux-kernel, swarren, ian, lrg

On 27/02/13 14:10, Laxman Dewangan wrote:
> When device is registered through the DT then regulators node
> exist in the parent device node of regulator driver. Hence passing
> parent device node for parsing DT in place of self-device node
> which is typically NULL.
>
> Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
> ---
>  drivers/regulator/palmas-regulator.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c
> index e915629..f07501d 100644
> --- a/drivers/regulator/palmas-regulator.c
> +++ b/drivers/regulator/palmas-regulator.c
> @@ -591,7 +591,7 @@ static int palmas_probe(struct platform_device *pdev)
>  {
>  	struct palmas *palmas = dev_get_drvdata(pdev->dev.parent);
>  	struct palmas_pmic_platform_data *pdata = pdev->dev.platform_data;
> -	struct device_node *node = pdev->dev.of_node;
> +	struct device_node *node = pdev->dev.parent->of_node;
>  	struct regulator_dev *rdev;
>  	struct regulator_config config = { };
>  	struct palmas_pmic *pmic;
This is not correct, nor is the reasoning.

I suspect your previous patch broke DT probing so your not getting nodes
filled in.

Graeme


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

* Re: [PATCH] regulator: palmas: use correct device node for DT parsing
  2013-02-27 14:23 ` Graeme Gregory
@ 2013-02-27 14:28   ` Laxman Dewangan
  2013-03-01  6:39   ` Mark Brown
  1 sibling, 0 replies; 6+ messages in thread
From: Laxman Dewangan @ 2013-02-27 14:28 UTC (permalink / raw)
  To: Graeme Gregory
  Cc: broonie@opensource.wolfsonmicro.com, linux-kernel@vger.kernel.org,
	Stephen Warren, ian@slimlogic.co.uk, lrg@ti.com

On Wednesday 27 February 2013 07:53 PM, Graeme Gregory wrote:
> On 27/02/13 14:10, Laxman Dewangan wrote:
>> When device is registered through the DT then regulators node
>> exist in the parent device node of regulator driver. Hence passing
>> parent device node for parsing DT in place of self-device node
>> which is typically NULL.
>>
>> Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
>> ---
>>   drivers/regulator/palmas-regulator.c |    2 +-
>>   1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c
>> index e915629..f07501d 100644
>> --- a/drivers/regulator/palmas-regulator.c
>> +++ b/drivers/regulator/palmas-regulator.c
>> @@ -591,7 +591,7 @@ static int palmas_probe(struct platform_device *pdev)
>>   {
>>   	struct palmas *palmas = dev_get_drvdata(pdev->dev.parent);
>>   	struct palmas_pmic_platform_data *pdata = pdev->dev.platform_data;
>> -	struct device_node *node = pdev->dev.of_node;
>> +	struct device_node *node = pdev->dev.parent->of_node;
>>   	struct regulator_dev *rdev;
>>   	struct regulator_config config = { };
>>   	struct palmas_pmic *pmic;
> This is not correct, nor is the reasoning.
>
> I suspect your previous patch broke DT probing so your not getting nodes
> filled in.
>

I pasted my DT files in other patch for discussion. This is the way we 
are following for other device and DT file population.
Probably, I need to see your test DT file for more discussion.

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

* Re: [PATCH] regulator: palmas: use correct device node for DT parsing
  2013-02-27 14:23 ` Graeme Gregory
  2013-02-27 14:28   ` Laxman Dewangan
@ 2013-03-01  6:39   ` Mark Brown
  2013-03-01 12:45     ` Laxman Dewangan
  1 sibling, 1 reply; 6+ messages in thread
From: Mark Brown @ 2013-03-01  6:39 UTC (permalink / raw)
  To: Graeme Gregory; +Cc: Laxman Dewangan, linux-kernel, swarren, ian, lrg

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

On Wed, Feb 27, 2013 at 02:23:42PM +0000, Graeme Gregory wrote:
> On 27/02/13 14:10, Laxman Dewangan wrote:

> > When device is registered through the DT then regulators node
> > exist in the parent device node of regulator driver. Hence passing
> > parent device node for parsing DT in place of self-device node
> > which is typically NULL.

> > -	struct device_node *node = pdev->dev.of_node;
> > +	struct device_node *node = pdev->dev.parent->of_node;

> This is not correct, nor is the reasoning.

> I suspect your previous patch broke DT probing so your not getting nodes
> filled in.

So, the reason that this pattern has generally been followed is so that
the regulator core can do the equivalent of regulator_get(dev, supply)
to find the supplies.  Using the parent device there is particularly
important in non-DT systems so that we can map the child regulator
supply in by using the dev_name() of the parent rather than the MFD
internal subdevice name but for pure DT systems where it's all just
direct links it's less of an issue.

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

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

* Re: [PATCH] regulator: palmas: use correct device node for DT parsing
  2013-03-01  6:39   ` Mark Brown
@ 2013-03-01 12:45     ` Laxman Dewangan
  2013-03-01 12:50       ` Ian Lartey
  0 siblings, 1 reply; 6+ messages in thread
From: Laxman Dewangan @ 2013-03-01 12:45 UTC (permalink / raw)
  To: Mark Brown
  Cc: Graeme Gregory, linux-kernel@vger.kernel.org, Stephen Warren,
	ian@slimlogic.co.uk, lrg@ti.com

On Friday 01 March 2013 12:09 PM, Mark Brown wrote:
> * PGP Signed by an unknown key
>
> On Wed, Feb 27, 2013 at 02:23:42PM +0000, Graeme Gregory wrote:
>> On 27/02/13 14:10, Laxman Dewangan wrote:
>>> When device is registered through the DT then regulators node
>>> exist in the parent device node of regulator driver. Hence passing
>>> parent device node for parsing DT in place of self-device node
>>> which is typically NULL.
>>> -	struct device_node *node = pdev->dev.of_node;
>>> +	struct device_node *node = pdev->dev.parent->of_node;
>> This is not correct, nor is the reasoning.
>> I suspect your previous patch broke DT probing so your not getting nodes
>> filled in.
> So, the reason that this pattern has generally been followed is so that
> the regulator core can do the equivalent of regulator_get(dev, supply)
> to find the supplies.  Using the parent device there is particularly
> important in non-DT systems so that we can map the child regulator
> supply in by using the dev_name() of the parent rather than the MFD
> internal subdevice name but for pure DT systems where it's all just
> direct links it's less of an issue.
>
>

If I make the dts file as
                         #gpio-cells = <2>;
                         gpio-controller;

                        palmas_pmic {
                                compatible = "ti,palmas-pmic";
                                ti,ldo6_vibrator = <0>;

                                regulators {
                                     :::::::::::::
                                 }
                         }


then regulator get registered properly.
And hence this patch is not require here.


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

* Re: [PATCH] regulator: palmas: use correct device node for DT parsing
  2013-03-01 12:45     ` Laxman Dewangan
@ 2013-03-01 12:50       ` Ian Lartey
  0 siblings, 0 replies; 6+ messages in thread
From: Ian Lartey @ 2013-03-01 12:50 UTC (permalink / raw)
  To: Laxman Dewangan
  Cc: Mark Brown, Graeme Gregory, linux-kernel@vger.kernel.org,
	Stephen Warren, lrg@ti.com

On 01/03/13 12:45, Laxman Dewangan wrote:
> On Friday 01 March 2013 12:09 PM, Mark Brown wrote:
>> * PGP Signed by an unknown key
>>
>> On Wed, Feb 27, 2013 at 02:23:42PM +0000, Graeme Gregory wrote:
>>> On 27/02/13 14:10, Laxman Dewangan wrote:
>>>> When device is registered through the DT then regulators node
>>>> exist in the parent device node of regulator driver. Hence passing
>>>> parent device node for parsing DT in place of self-device node
>>>> which is typically NULL.
>>>> -    struct device_node *node = pdev->dev.of_node;
>>>> +    struct device_node *node = pdev->dev.parent->of_node;
>>> This is not correct, nor is the reasoning.
>>> I suspect your previous patch broke DT probing so your not getting nodes
>>> filled in.
>> So, the reason that this pattern has generally been followed is so that
>> the regulator core can do the equivalent of regulator_get(dev, supply)
>> to find the supplies.  Using the parent device there is particularly
>> important in non-DT systems so that we can map the child regulator
>> supply in by using the dev_name() of the parent rather than the MFD
>> internal subdevice name but for pure DT systems where it's all just
>> direct links it's less of an issue.
>>
>>
>
> If I make the dts file as
>                          #gpio-cells = <2>;
>                          gpio-controller;
>
>                         palmas_pmic {
>                                 compatible = "ti,palmas-pmic";
>                                 ti,ldo6_vibrator = <0>;
>
>                                 regulators {
>                                      :::::::::::::
>                                  }
>                          }
>
>
> then regulator get registered properly.
> And hence this patch is not require here.
>

Yes that would do it.

> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/


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

end of thread, other threads:[~2013-03-01 12:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-27 14:10 [PATCH] regulator: palmas: use correct device node for DT parsing Laxman Dewangan
2013-02-27 14:23 ` Graeme Gregory
2013-02-27 14:28   ` Laxman Dewangan
2013-03-01  6:39   ` Mark Brown
2013-03-01 12:45     ` Laxman Dewangan
2013-03-01 12:50       ` Ian Lartey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox