Skip to contentSkip to conversation

regulator: mt6360: Add OF match table

PATCH Superseded [email protected] 6 participants 13 messages Jan 9, 2021 – Jan 12, 2021

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 regulator: mt6360: Add OF match table

From: Matthias Brugger <[email protected]>

Binding documentation mentions that a compatible is required for the MT6360 device node, but the driver doesn't provide a OF match table.

Fixes d321571d5e4c ("regulator: mt6360: Add support for MT6360 regulator")

---

Changes in v2:
- check for CONFIG_OF
- add Fixes tag

 drivers/regulator/mt6360-regulator.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/regulator/mt6360-regulator.c +9 -0
index 15308ee29c13..f7b2514feabf 100644
@@ -445,9 +445,18 @@ static const struct platform_device_id mt6360_regulator_id_table[] = {
 };
 MODULE_DEVICE_TABLE(platform, mt6360_regulator_id_table);
 
+#ifdef CONFIG_OF
+static const struct of_device_id mt6360_of_match[] = {
+	{ .compatible = "mediatek,mt6360-regulator", },
+	{ /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, mt6360_of_match);
+#endif
+
 static struct platform_driver mt6360_regulator_driver = {
 	.driver = {
 		.name = "mt6360-regulator",
+		.of_match_table = of_match_ptr(mt6360_of_match),
 	},
 	.probe = mt6360_regulator_probe,
 	.id_table = mt6360_regulator_id_table,
Signature · 7 lines
2.29.2


_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
#1 lore raw

PATCH v2 2/3 regulator: mt6358: Add OF match table

From: Matthias Brugger <[email protected]>

The binding documentation mentions that a compatible is required for the MT6358 device node. But the driver does not provide a OF match table. This way auto-loading is broken as the MFD driver that registers the device has a .of_compatible set which makes the platform .uevent callback report a OF modalias, but that's not in the module.

Fixes f67ff1bd58f0 ("regulator: mt6358: Add support for MT6358 regulator")

---

Changes in v2:
- check for CONFIG_OF
- add Fixes tag

 drivers/regulator/mt6358-regulator.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/regulator/mt6358-regulator.c +9 -0
index 13cb6ac9a892..a4ed19a54ec6 100644
@@ -534,9 +534,18 @@ static const struct platform_device_id mt6358_platform_ids[] = {
 };
 MODULE_DEVICE_TABLE(platform, mt6358_platform_ids);
 
+#ifdef CONFIG_OF
+static const struct of_device_id mt6358_of_match[] = {
+	{ .compatible = "mediatek,mt6358-regulator", },
+	{ /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, mt6358_of_match);
+#endif
+
 static struct platform_driver mt6358_regulator_driver = {
 	.driver = {
 		.name = "mt6358-regulator",
+		.of_match_table = of_match_ptr(mt6358_of_match),
 	},
 	.probe = mt6358_regulator_probe,
 	.id_table = mt6358_platform_ids,
Signature · 7 lines
2.29.2


_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
#2 lore raw

PATCH v2 3/3 regulator: mt6323: Add OF match table

In reply to [email protected]

From: Matthias Brugger <[email protected]>

The binding documentation mentions that a compatible is required for the MT6323 device node. But the driver does not provide a OF match table. This way auto-loading is broken as the MFD driver that registers the device has a .of_compatible set which makes the platform .uevent callback report a OF modalias, but that's not in the module.

Fixes 2fdf82923618 ("regulator: mt6323: Add support for MT6323 regulator")

---

Changes in v2:
- check for CONFIG_OF
- add Fixes tag

 drivers/regulator/mt6323-regulator.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/regulator/mt6323-regulator.c +9 -0
index ff9016170db3..646742d4db74 100644
@@ -406,9 +406,18 @@ static const struct platform_device_id mt6323_platform_ids[] = {
 };
 MODULE_DEVICE_TABLE(platform, mt6323_platform_ids);
 
+#ifdef CONFIG_OF
+static const struct of_device_id mt6323_of_match[] = {
+	{ .compatible = "mediatek,mt6323-regulator", },
+	{ /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, mt6323_of_match);
+#endif
+
 static struct platform_driver mt6323_regulator_driver = {
 	.driver = {
 		.name = "mt6323-regulator",
+		.of_match_table = of_match_ptr(mt6323_of_match),
 	},
 	.probe = mt6323_regulator_probe,
 	.id_table = mt6323_platform_ids,
Signature · 7 lines
2.29.2


_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
#3 lore raw

Aw: [PATCH v2 3/3] regulator: mt6323: Add OF match table

Hi

Quoted 15 lines

Gesendet: Samstag, 09. Januar 2021 um 12:26 Uhr
Von: [email protected]

Changes in v2:
- check for CONFIG_OF
- add Fixes tag

drivers/regulator/mt6323-regulator.c +2 -0
@@ -406,9 +406,18 @@ static const struct platform_device_id mt6323_platform_ids[] = {
 };
 MODULE_DEVICE_TABLE(platform, mt6323_platform_ids);
 
+#ifdef CONFIG_OF
+static const struct of_device_id mt6323_of_match[] = {

drivers/regulator/mt6323-regulator.c static const struct platform_device_id mt6323_platform_ids[] = { · line 420

Quoted 10 lines
drivers/regulator/mt6323-regulator.c +7 -0
+	{ .compatible = "mediatek,mt6323-regulator", },
+	{ /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, mt6323_of_match);
+#endif
+
 static struct platform_driver mt6323_regulator_driver = {
 	.driver = {
 		.name = "mt6323-regulator",
+		.of_match_table = of_match_ptr(mt6323_of_match),

imho check for CONFIG_OF is here needed too, else mt6323_of_match is referenced but undefined

drivers/regulator/mt6323-regulator.c static const struct platform_device_id mt6323_platform_ids[] = { · line 423

Quoted 3 lines
drivers/regulator/mt6323-regulator.c +0 -0
 	},
 	.probe = mt6323_regulator_probe,
 	.id_table = mt6323_platform_ids,

regards Frank

_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek

#4 lore raw

Re: Aw: [PATCH v2 3/3] regulator: mt6323: Add OF match table

Quoted 15 lines · Frank Wunderlich

Hi

Quoted 13 lines

Gesendet: Samstag, 09. Januar 2021 um 12:26 Uhr
Von: [email protected]

Changes in v2:
- check for CONFIG_OF
- add Fixes tag

drivers/regulator/mt6323-regulator.c +0 -0
@@ -406,9 +406,18 @@ static const struct platform_device_id mt6323_platform_ids[] = {
 };
 MODULE_DEVICE_TABLE(platform, mt6323_platform_ids);
 
Quoted 15 lines

drivers/regulator/mt6323-regulator.c static const struct platform_device_id mt6323_platform_ids[] = { · line 420

Quoted 12 lines
drivers/regulator/mt6323-regulator.c +9 -0
+#ifdef CONFIG_OF
+static const struct of_device_id mt6323_of_match[] = {
+	{ .compatible = "mediatek,mt6323-regulator", },
+	{ /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, mt6323_of_match);
+#endif
+
 static struct platform_driver mt6323_regulator_driver = {
 	.driver = {
 		.name = "mt6323-regulator",
+		.of_match_table = of_match_ptr(mt6323_of_match),

imho check for CONFIG_OF is here needed too, else mt6323_of_match is referenced but undefined

No, of_match_ptr already takes care of this:
https://elixir.bootlin.com/linux/latest/source/include/linux/of.h#L998

Regards,
Matthias

_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek

#5 lore raw
In reply to [email protected]

[ Internal Use - External ]

Hi Matthias,

I discussed OF match table with Mark in previous mail in our PATCH v3, MFD should just instantiate the platform device.

Quoted 10 lines

Mark Brown <[email protected]> 於 2020年8月20日 週四 下午7:45寫道:

Quoted 4 lines

This device only exists in the context of a single parent device, there should be no need for a compatible string here - this is just a detail of how Linux does things. The MFD should just instntiate the platform device.

Trying to autoload module without of_id_table will cause run-time error:
ueventd: LoadWithAliases was unable to load of:NregulatorT(null)Cmediatek,mt6360-regulator

You shouldn't have this described in the device tree at all, like I say the MFD should just instantiate the platform device.

Quoted 55 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Saturday, January 9, 2021 7:26 PM
To: Liam Girdwood <[email protected]>; Mark Brown <[email protected]>
Cc: Hsin-Hsiung Wang <[email protected]>; Axel Lin <[email protected]>; Chen Zhong <[email protected]>; gene_chen(陳俊宇) <[email protected]>; [email protected]; [email protected]; [email protected]; Matthias Brugger <[email protected]>; Matti Vaittinen <[email protected]>; Matthias Brugger <[email protected]>
Subject: [PATCH v2 1/3] regulator: mt6360: Add OF match table

From: Matthias Brugger <[email protected]>

Binding documentation mentions that a compatible is required for the MT6360 device node, but the driver doesn't provide a OF match table.

Fixes d321571d5e4c ("regulator: mt6360: Add support for MT6360 regulator")

---

Changes in v2:
- check for CONFIG_OF
- add Fixes tag

 drivers/regulator/mt6360-regulator.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/regulator/mt6360-regulator.c +8 -1
index 15308ee29c13..f7b2514feabf 100644
@@ -445,9 +445,18 @@ static const struct platform_device_id
 mt6360_regulator_id_table[] = {  };  MODULE_DEVICE_TABLE(platform,
 mt6360_regulator_id_table);
 
+#ifdef CONFIG_OF
+static const struct of_device_id mt6360_of_match[] = {
+{ .compatible = "mediatek,mt6360-regulator", },
+{ /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, mt6360_of_match); #endif
+
 static struct platform_driver mt6360_regulator_driver = {
 .driver = {
 .name = "mt6360-regulator",
+.of_match_table = of_match_ptr(mt6360_of_match),
 },
 .probe = mt6360_regulator_probe,
 .id_table = mt6360_regulator_id_table,
--
Quoted 1 line

2.29.2

************* Email Confidentiality Notice ********************

The information contained in this e-mail message (including any attachments) may be confidential, proprietary, privileged, or otherwise exempt from disclosure under applicable laws. It is intended to be conveyed only to the designated recipient(s). Any use, dissemination, distribution, printing, retaining or copying of this e-mail (including its attachments) by unintended recipient(s) is strictly prohibited and may be unlawful. If you are not an intended recipient of this e-mail, or believe that you have received this e-mail in error, please notify the sender immediately (by replying to this e-mail), delete any and all copies of this e-mail (including any attachments) from your system, and do not disclose the content of this e-mail to any other person. Thank you!
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek

#6 lore raw
Quoted 2 lines · gene_chen(陳俊宇)

[ Internal Use - External ]

Please don't top-post in the future.

Quoted 4 lines

Hi Matthias,

I discussed OF match table with Mark in previous mail in our PATCH v3, MFD should just instantiate the platform device.

Did you ever test that? Which MFD driver should instantiate the device? I had a look at mt6360-core.c (the obvious one) but I don't see any reference to the regulator [1]. What am I missing?

Quoted 8 lines
Quoted 7 lines

Mark Brown <[email protected]> 於 2020年8月20日 週四 下午7:45寫道:

Quoted 4 lines

This device only exists in the context of a single parent device, there should be no need for a compatible string here - this is just a detail of how Linux does things. The MFD should just instntiate the platform device.

Quoted 7 lines
Quoted 3 lines

Trying to autoload module without of_id_table will cause run-time error:
ueventd: LoadWithAliases was unable to load of:NregulatorT(null)Cmediatek,mt6360-regulator

You shouldn't have this described in the device tree at all, like I say the MFD should just instantiate the platform device.

Well from my understanding the regulator has a device-tree entry [2], so it needs to match against a device-tree node. My understanding is, that you need a the devicetree node to describe the regulators provided by the device. TBH I'm a bit puzzled about the comment from Mark here. How does another DT node be able to reference a regulator if this is not described in DT? I think we need a DT node here and the matching in the regulator and MFD driver to get the regulator loaded via udev.

Regards,
Matthias

[1] https://elixir.bootlin.com/linux/latest/source/drivers/mfd/mt6360-core.c#L294
[2]
https://elixir.bootlin.com/linux/v5.10.6/source/Documentation/devicetree/bindings/regulator/mt6360-regulator.yaml

Quoted 58 lines
Quoted 55 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Saturday, January 9, 2021 7:26 PM
To: Liam Girdwood <[email protected]>; Mark Brown <[email protected]>
Cc: Hsin-Hsiung Wang <[email protected]>; Axel Lin <[email protected]>; Chen Zhong <[email protected]>; gene_chen(陳俊宇) <[email protected]>; [email protected]; [email protected]; [email protected]; Matthias Brugger <[email protected]>; Matti Vaittinen <[email protected]>; Matthias Brugger <[email protected]>
Subject: [PATCH v2 1/3] regulator: mt6360: Add OF match table

From: Matthias Brugger <[email protected]>

Binding documentation mentions that a compatible is required for the MT6360 device node, but the driver doesn't provide a OF match table.

Fixes d321571d5e4c ("regulator: mt6360: Add support for MT6360 regulator")

---

Changes in v2:
- check for CONFIG_OF
- add Fixes tag

 drivers/regulator/mt6360-regulator.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/regulator/mt6360-regulator.c +8 -1
index 15308ee29c13..f7b2514feabf 100644
@@ -445,9 +445,18 @@ static const struct platform_device_id
 mt6360_regulator_id_table[] = {  };  MODULE_DEVICE_TABLE(platform,
 mt6360_regulator_id_table);
 
+#ifdef CONFIG_OF
+static const struct of_device_id mt6360_of_match[] = {
+{ .compatible = "mediatek,mt6360-regulator", },
+{ /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, mt6360_of_match); #endif
+
 static struct platform_driver mt6360_regulator_driver = {
 .driver = {
 .name = "mt6360-regulator",
+.of_match_table = of_match_ptr(mt6360_of_match),
 },
 .probe = mt6360_regulator_probe,
 .id_table = mt6360_regulator_id_table,
--
Quoted 1 line

2.29.2

************* Email Confidentiality Notice ********************

Quoted 2 lines

The information contained in this e-mail message (including any attachments) may be confidential, proprietary, privileged, or otherwise exempt from disclosure under applicable laws. It is intended to be conveyed only to the designated recipient(s). Any use, dissemination, distribution, printing, retaining or copying of this e-mail (including its attachments) by unintended recipient(s) is strictly prohibited and may be unlawful. If you are not an intended recipient of this e-mail, or believe that you have received this e-mail in error, please notify the sender immediately (by replying to this e-mail), delete any and all copies of this e-mail (including any attachments) from your system, and do not disclose the content of this e-mail to any other person. Thank you!

_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek

#7 lore raw

Hello Matthias & All,

Quoted 37 lines · Matthias Brugger
Quoted 2 lines · gene_chen(陳俊宇)

[ Internal Use - External ]

Please don't top-post in the future.

Quoted 5 lines

Hi Matthias,

I discussed OF match table with Mark in previous mail in our PATCH v3,
MFD should just instantiate the platform device.

Did you ever test that? Which MFD driver should instantiate the device?
I had a look at mt6360-core.c (the obvious one) but I don't see any reference to
the regulator [1]. What am I missing?

Quoted 8 lines
Quoted 8 lines

Mark Brown <[email protected]> 於 2020年8月20日 週四 下午7:45寫道:

Quoted 7 lines

This device only exists in the context of a single parent device, there
should be no need for a compatible string here - this is just a detail
of how Linux does things. The MFD should just instntiate the platform
device.

Quoted 9 lines
Quoted 4 lines

Trying to autoload module without of_id_table will cause run-time error:
ueventd: LoadWithAliases was unable to load of:NregulatorT(null)Cmediatek,mt6360-regulator

You shouldn't have this described in the device tree at all, like I say
the MFD should just instantiate the platform device.

Quoted 13 lines

Well from my understanding the regulator has a device-tree entry [2], so it
needs to match against a device-tree node. My understanding is, that you need a
the devicetree node to describe the regulators provided by the device. TBH I'm a
bit puzzled about the comment from Mark here. How does another DT node be able
to reference a regulator if this is not described in DT? I think we need a DT
node here and the matching in the regulator and MFD driver to get the regulator
loaded via udev.

Others are better to answer - but as I spotted this from my inbox I'll give my 2 cents :)

This can be done W/O regulators having own compatible. Please see following:

drivers/mfd/rohm-bd718x7.c drivers/regulator/bd718x7-regulator.c Documentation/devicetree/bindings/mfd/rohm,bd71847-pmic.yaml Documentation/devicetree/bindings/regulator/rohm,bd71847-regulator.yaml

as example.

The device matching can be done via platform_device_id table. I think the MODULE_ALIAS() is needed for module matching - but I don't remember without further code browsing.

Anyways, the BD71837/47/50 DT entry without compatible for clk/regulators do probe and load the sub-devices.

As a "tradeoff" subdevices must retrieve the DT node from the parent device.

For my uneducated eyes the DT binding for regulators should be changed. Compatible should not be required and the example node should be moved to MFD binding document in the MFD node. But that's just my view on this - not willing to push this to any direction!

Best Regards
Matti Vaittinen

--
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland
SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND

~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~

Simon says - in Latin please.
"non cogito me" dixit Rene Descarte, deinde evanescavit

(Thanks for the translation Simon)

_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek

#8 lore raw

Hi Matti,

Quoted 61 lines · Matti

Hello Matthias & All,

Quoted 37 lines · Matthias Brugger
Quoted 2 lines · gene_chen(陳俊宇)

[ Internal Use - External ]

Please don't top-post in the future.

Quoted 5 lines

Hi Matthias,

I discussed OF match table with Mark in previous mail in our PATCH v3,
MFD should just instantiate the platform device.

Did you ever test that? Which MFD driver should instantiate the device?
I had a look at mt6360-core.c (the obvious one) but I don't see any reference to
the regulator [1]. What am I missing?

Quoted 8 lines
Quoted 8 lines

Mark Brown <[email protected]> 於 2020年8月20日 週四 下午7:45寫道:

Quoted 7 lines

This device only exists in the context of a single parent device, there
should be no need for a compatible string here - this is just a detail
of how Linux does things. The MFD should just instntiate the platform
device.

Quoted 9 lines
Quoted 4 lines

Trying to autoload module without of_id_table will cause run-time error:
ueventd: LoadWithAliases was unable to load of:NregulatorT(null)Cmediatek,mt6360-regulator

You shouldn't have this described in the device tree at all, like I say
the MFD should just instantiate the platform device.

Quoted 13 lines

Well from my understanding the regulator has a device-tree entry [2], so it
needs to match against a device-tree node. My understanding is, that you need a
the devicetree node to describe the regulators provided by the device. TBH I'm a
bit puzzled about the comment from Mark here. How does another DT node be able
to reference a regulator if this is not described in DT? I think we need a DT
node here and the matching in the regulator and MFD driver to get the regulator
loaded via udev.

Others are better to answer - but as I spotted this from my inbox I'll give my 2 cents :)

This can be done W/O regulators having own compatible. Please see following:

Quoted 6 lines

drivers/mfd/rohm-bd718x7.c drivers/regulator/bd718x7-regulator.c Documentation/devicetree/bindings/mfd/rohm,bd71847-pmic.yaml Documentation/devicetree/bindings/regulator/rohm,bd71847-regulator.yaml

as example.

Thanks for the links. Yes that's' a way to go, but...

Quoted 8 lines

The device matching can be done via platform_device_id table. I think the MODULE_ALIAS() is needed for module matching - but I don't remember without further code browsing.

Anyways, the BD71837/47/50 DT entry without compatible for clk/regulators do probe and load the sub-devices.

Quoted 8 lines

As a "tradeoff" subdevices must retrieve the DT node from the parent device.

For my uneducated eyes the DT binding for regulators should be changed. Compatible should not be required and the example node should be moved to MFD binding document in the MFD node. But that's just my view on this - not willing to push this to any direction!

Generally speaking, DT bindings are stable and can't be changed in a none-compatible way. We could argue if there is any user of the compatible out there (probably there isn't any, as the code seems to not even be working). Apart from that all other cells in the MFD driver are defined as OF_MFD_CELL [1]. Actually I suspect that mt6360_ldo should represent mt6360-regulator.

Regards,
Matthias

[1] https://elixir.bootlin.com/linux/latest/source/drivers/mfd/mt6360-core.c#L294

Quoted 11 lines

Best Regards
Matti Vaittinen

--
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland
SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND

Quoted 7 lines

~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~

Simon says - in Latin please.
"non cogito me" dixit Rene Descarte, deinde evanescavit

(Thanks for the translation Simon)

_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek

#9 lore raw
Quoted 103 lines · Matthias Brugger

Hi Matti,

Quoted 70 lines · Matti

Hello Matthias & All,

Quoted 51 lines · Matthias Brugger
Quoted 2 lines · gene_chen(陳俊宇)

[ Internal Use - External ]

Please don't top-post in the future.

Quoted 6 lines

Hi Matthias,

I discussed OF match table with Mark in previous mail in our PATCH
v3,
MFD should just instantiate the platform device.

Did you ever test that? Which MFD driver should instantiate the device?
I had a look at mt6360-core.c (the obvious one) but I don't see any
reference to
the regulator [1]. What am I missing?

Quoted 16 lines
Quoted 10 lines

Mark Brown <[email protected]> 於 2020年8月20日 週四 下午7:45寫道:

Quoted 9 lines

This device only exists in the context of a single parent device, there
should be no need for a compatible string here - this is just a
detail
of how Linux does things. The MFD should just instntiate the
platform
device.

Quoted 5 lines

Trying to autoload module without of_id_table will cause run- time
error:
ueventd: LoadWithAliases was unable to load of:NregulatorT(null)Cmediatek,mt6360-regulator

Quoted 5 lines

You shouldn't have this described in the device tree at all, like I
say
the MFD should just instantiate the platform device.

Well from my understanding the regulator has a device-tree entry [2],
so it
needs to match against a device-tree node. My understanding is, that
you need a
the devicetree node to describe the regulators provided by the device. TBH I'm a
bit puzzled about the comment from Mark here. How does another DT

Quoted 8 lines

node be able
to reference a regulator if this is not described in DT? I think we
need a DT
node here and the matching in the regulator and MFD driver to get the
regulator
loaded via udev.

Others are better to answer - but as I spotted this from my inbox I'll
give my 2 cents :)

This can be done W/O regulators having own compatible. Please see following:

Quoted 7 lines

drivers/mfd/rohm-bd718x7.c drivers/regulator/bd718x7-regulator.c Documentation/devicetree/bindings/mfd/rohm,bd71847-pmic.yaml Documentation/devicetree/bindings/regulator/rohm,bd71847- regulator.yaml

as example.

Thanks for the links. Yes that's' a way to go, but...

Quoted 12 lines

The device matching can be done via platform_device_id table. I think the MODULE_ALIAS() is needed for module matching - but I don't
remember without further code browsing.

Anyways, the BD71837/47/50 DT entry without compatible for clk/regulators do probe and load the sub-devices.

As a "tradeoff" subdevices must retrieve the DT node from the parent
device.

Quoted 7 lines

For my uneducated eyes the DT binding for regulators should be changed.
Compatible should not be required and the example node should be moved
to MFD binding document in the MFD node. But that's just my view on this - not willing to push this to any direction!

Quoted 5 lines

Generally speaking, DT bindings are stable and can't be changed in a none-compatible way. We could argue if there is any user of the compatible out
there (probably there isn't any, as the code seems to not even be working).

I think this depends on the device where driver(s) are used. Quite a few devices allow updating the device-tree when SW is updated. But as I said, I don't want to try pushing this one direction or other - I leave it for those who have broader shoulders for pushing XD.

I was merely trying to answer your question :)

Best Regards
Matti
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek

#10 lore raw
In reply to gene_chen(陳俊宇)
Quoted 14 lines · gene_chen(陳俊宇)

[ Internal Use - External ]

Hi Matthias,

I discussed OF match table with Mark in previous mail in our PATCH v3, MFD should just instantiate the platform device.

Quoted 6 lines

Mark Brown <[email protected]> 於 2020年8月20日 週四 下午7:45寫道:

Quoted 4 lines

This device only exists in the context of a single parent device, there should be no need for a compatible string here - this is just a detail of how Linux does things. The MFD should just instntiate the platform device.

Quoted 7 lines
Quoted 3 lines

Trying to autoload module without of_id_table will cause run-time error:
ueventd: LoadWithAliases was unable to load of:NregulatorT(null)Cmediatek,mt6360-regulator

You shouldn't have this described in the device tree at all, like I say the MFD should just instantiate the platform device.

Well with the patch you send to enable regulators [1] you use OF_MFD_CELL. So my understanding is, if you don't provide an of_match_table in the regulator driver, the loading via udev is broken (like you mentioned in the cite from an older email).

Regards,
Matthias

[1]
https://lore.kernel.org/linux-mediatek/[email protected]/

Quoted 58 lines
Quoted 55 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Saturday, January 9, 2021 7:26 PM
To: Liam Girdwood <[email protected]>; Mark Brown <[email protected]>
Cc: Hsin-Hsiung Wang <[email protected]>; Axel Lin <[email protected]>; Chen Zhong <[email protected]>; gene_chen(陳俊宇) <[email protected]>; [email protected]; [email protected]; [email protected]; Matthias Brugger <[email protected]>; Matti Vaittinen <[email protected]>; Matthias Brugger <[email protected]>
Subject: [PATCH v2 1/3] regulator: mt6360: Add OF match table

From: Matthias Brugger <[email protected]>

Binding documentation mentions that a compatible is required for the MT6360 device node, but the driver doesn't provide a OF match table.

Fixes d321571d5e4c ("regulator: mt6360: Add support for MT6360 regulator")

---

Changes in v2:
- check for CONFIG_OF
- add Fixes tag

 drivers/regulator/mt6360-regulator.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/regulator/mt6360-regulator.c +8 -1
index 15308ee29c13..f7b2514feabf 100644
@@ -445,9 +445,18 @@ static const struct platform_device_id
 mt6360_regulator_id_table[] = {  };  MODULE_DEVICE_TABLE(platform,
 mt6360_regulator_id_table);
 
+#ifdef CONFIG_OF
+static const struct of_device_id mt6360_of_match[] = {
+{ .compatible = "mediatek,mt6360-regulator", },
+{ /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, mt6360_of_match); #endif
+
 static struct platform_driver mt6360_regulator_driver = {
 .driver = {
 .name = "mt6360-regulator",
+.of_match_table = of_match_ptr(mt6360_of_match),
 },
 .probe = mt6360_regulator_probe,
 .id_table = mt6360_regulator_id_table,
--
Quoted 1 line

2.29.2

************* Email Confidentiality Notice ********************

Quoted 2 lines

The information contained in this e-mail message (including any attachments) may be confidential, proprietary, privileged, or otherwise exempt from disclosure under applicable laws. It is intended to be conveyed only to the designated recipient(s). Any use, dissemination, distribution, printing, retaining or copying of this e-mail (including its attachments) by unintended recipient(s) is strictly prohibited and may be unlawful. If you are not an intended recipient of this e-mail, or believe that you have received this e-mail in error, please notify the sender immediately (by replying to this e-mail), delete any and all copies of this e-mail (including any attachments) from your system, and do not disclose the content of this e-mail to any other person. Thank you!

_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek

maintainer
#11 lore raw
In reply to [email protected]
Quoted 4 lines · On Sat, Jan 09, 2021 at 12:26:09PM +0100, [email protected] wrote:

From: Matthias Brugger <[email protected]>

Binding documentation mentions that a compatible is required for the MT6360 device node, but the driver doesn't provide a OF match table.

The binding should be fixed to remove the requirement for a compatible here, this is both redundant since we already know we have a mt6380 from the core MFD and encoding details of how Linux implements things into the DT bindings.

_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek

#12 lore raw
Quoted 10 lines · Mark Brown
Quoted 4 lines · On Sat, Jan 09, 2021 at 12:26:09PM +0100, [email protected] wrote:

From: Matthias Brugger <[email protected]>

Binding documentation mentions that a compatible is required for the MT6360 device node, but the driver doesn't provide a OF match table.

The binding should be fixed to remove the requirement for a compatible here, this is both redundant since we already know we have a mt6380 from the core MFD and encoding details of how Linux implements things into the DT bindings.

Ok, I'll leave that to the driver author to fix this. Just be aware that there is series for the MFD part which adds OF_MFD_CELL for the regulator.

Regards,
Matthias

Quoted 4 lines

_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek