regulator: max77650: add of_match table
PATCH 1/1 regulator: max77650: add of_match table
From: Bartosz Golaszewski <[email protected]>
We need the of_match table if we want to use the compatible string in the pmic's child node and get the regulator driver loaded automatically.
--- drivers/regulator/max77650-regulator.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/regulator/max77650-regulator.c +7 -0
@@ -386,9 +386,16 @@ static int max77650_regulator_probe(struct platform_device *pdev)return 0 ; } +static const struct of_device_id max77650_regulator_of_match[] = { + { .compatible ="maxim,max77650-regulator" }, + { } +}; +MODULE_DEVICE_TABLE (of, max77650_regulator_of_match); +static struct platform_driver max77650_regulator_driver = { .driver = { .name ="max77650-regulator" , + .of_match_table = max77650_regulator_of_match, }, .probe = max77650_regulator_probe, };
Signature · 1 line
2.23.0
Mark Brown
maintainerQuoted 4 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
We need the
of_matchtable if we want to use the compatible string in the pmic's child node and get the regulator driver loaded automatically.
Why would we need to use a compatible string in a child node to load the regulator driver, surely we can just register a platform device in the MFD?
wt., 10 gru 2019 o 13:12 Mark Brown <[email protected]> napisał(a):
Quoted 10 lines · Bartosz Golaszewski
Quoted 4 lines
From: Bartosz Golaszewski <[email protected]>
We need the
of_matchtable if we want to use the compatible string in the pmic's child node and get the regulator driver loaded automatically.Why would we need to use a compatible string in a child node to load the regulator driver, surely we can just register a platform device in the MFD?
The device is registered all right from MFD code, but the module won't be loaded automatically from user-space even with the right MODULE_ALIAS() for sub-nodes unless we define the MODULE_DEVICE_TABLE().
Besides: the DT bindings define the compatible for sub-nodes already. We should probably conform to that.
Bart
Mark Brown
maintainerQuoted 10 lines · Bartosz Golaszewski
wt., 10 gru 2019 o 13:12 Mark Brown <[email protected]> napisał(a):
Quoted 3 lines
Why would we need to use a compatible string in a child node to load the regulator driver, surely we can just register a platform device in the MFD?
The device is registered all right from MFD code, but the module won't be loaded automatically from user-space even with the right
MODULE_ALIAS()for sub-nodes unless we define theMODULE_DEVICE_TABLE().
This seems to work fine for other drivers and the platform bus has to be usable on systems that don't use DT so that doesn't sound right. Which MODULE_ALIAS() are you using exactly?
Quoted 2 lines
Besides: the DT bindings define the compatible for sub-nodes already. We should probably conform to that.
I would say that's a mistake and should be fixed, this particular way of loading the regulators is a Linux implementation detail.
wt., 10 gru 2019 o 14:02 Mark Brown <[email protected]> napisał(a):
Quoted 8 lines · Bartosz Golaszewski
Quoted 5 lines
wt., 10 gru 2019 o 13:12 Mark Brown <[email protected]> napisał(a):
Quoted 3 lines
Why would we need to use a compatible string in a child node to load the regulator driver, surely we can just register a platform device in the MFD?
Quoted 9 lines
Quoted 4 lines
The device is registered all right from MFD code, but the module won't be loaded automatically from user-space even with the right
MODULE_ALIAS()for sub-nodes unless we define theMODULE_DEVICE_TABLE().This seems to work fine for other drivers and the platform bus has to be usable on systems that don't use DT so that doesn't sound right. Which
MODULE_ALIAS()are you using exactly?
MODULE_ALIAS("platform:max77650-regulator");
Quoted 5 lines
Quoted 2 lines
Besides: the DT bindings define the compatible for sub-nodes already. We should probably conform to that.
I would say that's a mistake and should be fixed, this particular way of loading the regulators is a Linux implementation detail.
Fixed by removing this from the bindings?
Bartosz
Mark Brown
maintainerQuoted 7 lines · Bartosz Golaszewski
wt., 10 gru 2019 o 14:02 Mark Brown <[email protected]> napisał(a):
Quoted 3 lines
This seems to work fine for other drivers and the platform bus has to be usable on systems that don't use DT so that doesn't sound right. Which
MODULE_ALIAS()are you using exactly?
MODULE_ALIAS("platform:max77650-regulator");
Huh, that should work... I wonder if adding a compatible to the DT has messed it up, does it work without the compatible in the .dts (and with the of_compatible removed from the MFD driver I guess)?
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Besides: the DT bindings define the compatible for sub-nodes already. We should probably conform to that.
I would say that's a mistake and should be fixed, this particular way of loading the regulators is a Linux implementation detail.
Fixed by removing this from the bindings?
Yeah. Though it may be too late, shame I didn't catch this when it was merged :(
wt., 10 gru 2019 o 14:21 Mark Brown <[email protected]> napisał(a):
Quoted 8 lines · Bartosz Golaszewski
Quoted 5 lines
wt., 10 gru 2019 o 14:02 Mark Brown <[email protected]> napisał(a):
Quoted 3 lines
This seems to work fine for other drivers and the platform bus has to be usable on systems that don't use DT so that doesn't sound right. Which
MODULE_ALIAS()are you using exactly?
Quoted 6 lines
Quoted 1 line
MODULE_ALIAS("platform:max77650-regulator");Huh, that should work... I wonder if adding a compatible to the DT has messed it up, does it work without the compatible in the .dts (and with the
of_compatibleremoved from the MFD driver I guess)?
It does work when removing the compatible strings.
Quoted 10 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Besides: the DT bindings define the compatible for sub-nodes already. We should probably conform to that.
I would say that's a mistake and should be fixed, this particular way of loading the regulators is a Linux implementation detail.
Fixed by removing this from the bindings?
Yeah. Though it may be too late, shame I didn't catch this when it was merged :(
Yeah, I didn't know any better too.
Rob: the bindings for this were released some time ago and they define compatible strings for MFD sub-nodes, but using compatible strings for sub-nodes is apparently incorrect and the drivers don't support it either. Can we remove them from the bindings?
Best regards,
Bartosz Golaszewski
Mark Brown
maintainerQuoted 11 lines · Bartosz Golaszewski
wt., 10 gru 2019 o 14:21 Mark Brown <[email protected]> napisał(a):
Quoted 8 lines · Bartosz Golaszewski
Quoted 3 lines
wt., 10 gru 2019 o 14:02 Mark Brown <[email protected]> napisał(a):
MODULE_ALIAS("platform:max77650-regulator");Huh, that should work... I wonder if adding a compatible to the DT has messed it up, does it work without the compatible in the .dts (and with the
of_compatibleremoved from the MFD driver I guess)?It does work when removing the compatible strings.
Ah, that explains it.
Quoted 9 lines
Quoted 2 lines
Yeah. Though it may be too late, shame I didn't catch this when it was merged :(
Yeah, I didn't know any better too.
Rob: the bindings for this were released some time ago and they define compatible strings for MFD sub-nodes, but using compatible strings for sub-nodes is apparently incorrect and the drivers don't support it either. Can we remove them from the bindings?
I think at this point it's better to just keep compatibility rather than disrupt anything, I'll go ahead and apply your patch.
Mark Brown
maintainerApplied "regulator: max77650: add of_match table" to the regulator tree
In reply to Bartosz GolaszewskiThe patch
regulator: max77650: add of_match table
has been applied to the regulator tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-5.5
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
From 100a21100bbb2bbc82fc4273e152c96e5c6c5d12 Mon Sep 17 00:00:00 2001
From: Bartosz Golaszewski <[email protected]>
Date: Tue, 10 Dec 2019 11:07:25 +0100
Subject: [PATCH] regulator: max77650: add of_match table
We need the of_match table if we want to use the compatible string in the pmic's child node and get the regulator driver loaded automatically.
--- drivers/regulator/max77650-regulator.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/regulator/max77650-regulator.c +7 -0
@@ -386,9 +386,16 @@ static int max77650_regulator_probe(struct platform_device *pdev)return 0 ; } +static const struct of_device_id max77650_regulator_of_match[] = { + { .compatible ="maxim,max77650-regulator" }, + { } +}; +MODULE_DEVICE_TABLE (of, max77650_regulator_of_match); +static struct platform_driver max77650_regulator_driver = { .driver = { .name ="max77650-regulator" , + .of_match_table = max77650_regulator_of_match, }, .probe = max77650_regulator_probe, };
Signature · 1 line
2.20.1