diff mbox series

[2/6] regulator: lochnagar: Move driver to binding from DT

Message ID 20181108101405.14062-3-ckeepax@opensource.cirrus.com
State New
Headers show
Series Lochnagar Driver | expand

Commit Message

Charles Keepax Nov. 8, 2018, 10:14 a.m. UTC
Based on review comments on the MFD driver, move the child drivers for
the Lochnagar MFD over to binding through device tree.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

Mark, I would maybe hold on merging this one until discussions
on this version of the patch chain are done, just incase we
decide to go back to the single DT entry.

Thanks,
Charles

 drivers/regulator/lochnagar-regulator.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Mark Brown Nov. 8, 2018, 12:16 p.m. UTC | #1
On Thu, Nov 08, 2018 at 10:14:01AM +0000, Charles Keepax wrote:

> +static const struct of_device_id lochnagar_of_match[] = {
> +	{ .compatible = "cirrus,lochnagar-regulator" },
> +	{},
> +};

This is obviously just dumping the Linux driver model into the DT, the
regulators are clearly different.  If you want to explicitly list the
regulators in DT it'd be better to reflect the hardware and enumerate
the regulators individually - you can use one driver for all the MICVDDs
and a separate one for VDDCORE for example.
Charles Keepax Nov. 8, 2018, 9:59 p.m. UTC | #2
On Thu, Nov 08, 2018 at 12:16:29PM +0000, Mark Brown wrote:
> On Thu, Nov 08, 2018 at 10:14:01AM +0000, Charles Keepax wrote:
> 
> > +static const struct of_device_id lochnagar_of_match[] = {
> > +	{ .compatible = "cirrus,lochnagar-regulator" },
> > +	{},
> > +};
> 
> This is obviously just dumping the Linux driver model into the DT, the
> regulators are clearly different.  If you want to explicitly list the
> regulators in DT it'd be better to reflect the hardware and enumerate
> the regulators individually - you can use one driver for all the MICVDDs
> and a separate one for VDDCORE for example.

Agreed, would be relatively doable for regulators, might be a bit
verbose for the clock, but I really don't see how to handle
pinctrl.

I guess I will wait and see what the other maintainers think but
personally I would really be inclined to keep the binding the
same as the last version if we can.

Thanks,
Charles
diff mbox series

Patch

diff --git a/drivers/regulator/lochnagar-regulator.c b/drivers/regulator/lochnagar-regulator.c
index 182198246479f..d08fe830b39c1 100644
--- a/drivers/regulator/lochnagar-regulator.c
+++ b/drivers/regulator/lochnagar-regulator.c
@@ -222,7 +222,7 @@  static int lochnagar_regulator_probe(struct platform_device *pdev)
 	struct regulator_dev *rdev;
 	int ret, i;
 
-	config.dev = lochnagar->dev;
+	config.dev = dev;
 	config.regmap = lochnagar->regmap;
 	config.driver_data = lochnagar;
 
@@ -241,9 +241,15 @@  static int lochnagar_regulator_probe(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct of_device_id lochnagar_of_match[] = {
+	{ .compatible = "cirrus,lochnagar-regulator" },
+	{},
+};
+
 static struct platform_driver lochnagar_regulator_driver = {
 	.driver = {
 		.name = "lochnagar-regulator",
+		.of_match_table = of_match_ptr(lochnagar_of_match),
 	},
 
 	.probe = lochnagar_regulator_probe,