regulator: palmas: use correct device node for DT parsing
Subsystems (2)
PATCH 1/1 regulator: palmas: use correct device node for DT parsing
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.
--- drivers/regulator/palmas-regulator.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/regulator/palmas-regulator.c +1 -1
@@ -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;
Signature · 1 line
1.7.1.1
Quoted 15 lines · 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 <[email protected]>--- drivers/regulator/palmas-regulator.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/regulator/palmas-regulator.c +0
-0
drivers/regulator/palmas-regulator.c static int palmas_probe(struct platform_device *pdev) · line 597
Quoted 8 lines
drivers/regulator/palmas-regulator.c +1
-1@@ -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
Quoted 26 lines · Graeme Gregory
Quoted 15 lines · 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 <[email protected]>--- drivers/regulator/palmas-regulator.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/regulator/palmas-regulator.c +0
-0drivers/regulator/palmas-regulator.c static int palmas_probe(struct platform_device *pdev) · line 597
Quoted 8 lines
drivers/regulator/palmas-regulator.c +1
-1@@ -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.
Quoted 3 lines
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.
Quoted 7 lines · Graeme Gregory
Quoted 4 lines · 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.
Quoted 7 lines
drivers/regulator/palmas-regulator.c static int palmas_probe(struct platform_device *pdev) · line 594
Quoted 2 lines
drivers/regulator/palmas-regulator.c +1
-1-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.
Quoted 13 lines · Mark Brown
* PGP Signed by an unknown key
Quoted 10 lines · Graeme Gregory
drivers/regulator/palmas-regulator.c static int palmas_probe(struct platform_device *pdev) · line 594
Quoted 6 lines · 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.
drivers/regulator/palmas-regulator.c +1
-1-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.
Quoted 9 lines
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 thedev_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.
Quoted 38 lines · Laxman Dewangan
Quoted 13 lines · Mark Brown
* PGP Signed by an unknown key
Quoted 10 lines · Graeme Gregory
drivers/regulator/palmas-regulator.c static int palmas_probe(struct platform_device *pdev) · line 594
Quoted 6 lines · 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.
drivers/regulator/palmas-regulator.c +1
-1-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.Quoted 9 lines
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 thedev_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 { ::::::::::::: } }
Quoted 3 lines
then regulator get registered properly.
And hence this patch is not require here.
Yes that would do it.
Quoted 5 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/