regulator: palmas: add input supply names
PATCH 2/2 regulator: palmas: add input supply names
Palmas regulator support the different input supply pins for each of the rails. Fill the regulator info data with their input supply pin names.
The pin supply names is passed to regulator_register() only when there is valid regulator_init_data. If regulator_init_data is not present for the rail then it is assumed that given rail's input pin is left unconnected.
--- drivers/regulator/palmas-regulator.c | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-)
drivers/regulator/palmas-regulator.c +28 -0
@@ -29,6 +29,7 @@struct regs_info {char *name; +char *sname;u8 vsel_addr;u8 ctrl_addr;u8 tstep_addr;
@@ -37,110 +38,131 @@ struct regs_info {static const struct regs_info palmas_regs_info[] = { { .name ="SMPS12" , + .sname ="smps1-in" , .vsel_addr =PALMAS_SMPS12_VOLTAGE , .ctrl_addr =PALMAS_SMPS12_CTRL , .tstep_addr =PALMAS_SMPS12_TSTEP , }, { .name ="SMPS123" , + .sname ="smps1-in" , .vsel_addr =PALMAS_SMPS12_VOLTAGE , .ctrl_addr =PALMAS_SMPS12_CTRL , .tstep_addr =PALMAS_SMPS12_TSTEP , }, { .name ="SMPS3" , + .sname ="smps3-in" , .vsel_addr =PALMAS_SMPS3_VOLTAGE , .ctrl_addr =PALMAS_SMPS3_CTRL , }, { .name ="SMPS45" , + .sname ="smps4-in" , .vsel_addr =PALMAS_SMPS45_VOLTAGE , .ctrl_addr =PALMAS_SMPS45_CTRL , .tstep_addr =PALMAS_SMPS45_TSTEP , }, { .name ="SMPS457" , + .sname ="smps4-in" , .vsel_addr =PALMAS_SMPS45_VOLTAGE , .ctrl_addr =PALMAS_SMPS45_CTRL , .tstep_addr =PALMAS_SMPS45_TSTEP , }, { .name ="SMPS6" , + .sname ="smps6-in" , .vsel_addr =PALMAS_SMPS6_VOLTAGE , .ctrl_addr =PALMAS_SMPS6_CTRL , .tstep_addr =PALMAS_SMPS6_TSTEP , }, { .name ="SMPS7" , + .sname ="smps7-in" , .vsel_addr =PALMAS_SMPS7_VOLTAGE , .ctrl_addr =PALMAS_SMPS7_CTRL , }, { .name ="SMPS8" , + .sname ="smps8-in" , .vsel_addr =PALMAS_SMPS8_VOLTAGE , .ctrl_addr =PALMAS_SMPS8_CTRL , .tstep_addr =PALMAS_SMPS8_TSTEP , }, { .name ="SMPS9" , + .sname ="smps9-in" , .vsel_addr =PALMAS_SMPS9_VOLTAGE , .ctrl_addr =PALMAS_SMPS9_CTRL , }, { .name ="SMPS10" , + .sname ="smps10-in" , }, { .name ="LDO1" , + .sname ="ldo1-in" , .vsel_addr =PALMAS_LDO1_VOLTAGE , .ctrl_addr =PALMAS_LDO1_CTRL , }, { .name ="LDO2" , + .sname ="ldo2-in" , .vsel_addr =PALMAS_LDO2_VOLTAGE , .ctrl_addr =PALMAS_LDO2_CTRL , }, { .name ="LDO3" , + .sname ="ldo3-in" , .vsel_addr =PALMAS_LDO3_VOLTAGE , .ctrl_addr =PALMAS_LDO3_CTRL , }, { .name ="LDO4" , + .sname ="ldo4-in" , .vsel_addr =PALMAS_LDO4_VOLTAGE , .ctrl_addr =PALMAS_LDO4_CTRL , }, { .name ="LDO5" , + .sname ="ldo5-in" , .vsel_addr =PALMAS_LDO5_VOLTAGE , .ctrl_addr =PALMAS_LDO5_CTRL , }, { .name ="LDO6" , + .sname ="ldo6-in" , .vsel_addr =PALMAS_LDO6_VOLTAGE , .ctrl_addr =PALMAS_LDO6_CTRL , }, { .name ="LDO7" , + .sname ="ldo7-in" , .vsel_addr =PALMAS_LDO7_VOLTAGE , .ctrl_addr =PALMAS_LDO7_CTRL , }, { .name ="LDO8" , + .sname ="ldo8-in" , .vsel_addr =PALMAS_LDO8_VOLTAGE , .ctrl_addr =PALMAS_LDO8_CTRL , }, { .name ="LDO9" , + .sname ="ldo9-in" , .vsel_addr =PALMAS_LDO9_VOLTAGE , .ctrl_addr =PALMAS_LDO9_CTRL , }, { .name ="LDOLN" , + .sname ="ldoln-in" , .vsel_addr =PALMAS_LDOLN_VOLTAGE , .ctrl_addr =PALMAS_LDOLN_CTRL , }, { .name ="LDOUSB" , + .sname ="ldousb-in" , .vsel_addr =PALMAS_LDOUSB_VOLTAGE , .ctrl_addr =PALMAS_LDOUSB_CTRL , },
@@ -710,6 +732,9 @@ static int palmas_regulators_probe(struct platform_device *pdev)else config.init_data =NULL ; +if (config.init_data) + pmic->desc[id].supply_name = palmas_regs_info[id].sname; + config.of_node = palmas_matches[id].of_node; rdev =regulator_register (&pmic->desc[id], &config);
@@ -756,6 +781,9 @@ static int palmas_regulators_probe(struct platform_device *pdev)else config.init_data =NULL ; +if (config.init_data) + pmic->desc[id].supply_name = palmas_regs_info[id].sname; + config.of_node = palmas_matches[id].of_node; rdev =regulator_register (&pmic->desc[id], &config);
Signature · 1 line
1.7.1.1
PATCH 1/2 regulator: palmas: rename probe/remove callback functions
When palmas regulator probe creates stack dump during initialization due to some crash, it prints the call trace as follows:
[3.166321] [<c028fa20>] (_regmap_read+0x5c/0xa8) from [<c028fab0>] (regmap_read+0x44/0x5c) [3.174669] [<c028fab0>] (regmap_read+0x44/0x5c) from [<c023062c>] (palmas_probe+0x240/0x7d0) [3.183193] [<c023062c>] (palmas_probe+0x240/0x7d0) from [<c0284064>] (platform_drv_probe+0x14/0x18) [3.192322] [<c0284064>] (platform_drv_probe+0x14/0x18) from [<c0282ee4>] (driver_probe_device+0x104/0x214) [3.202055] [<c0282ee4>] (driver_probe_device+0x104/0x214) from [<c028167c>] (bus_for_each_drv+0x5c/0x88)
The palmas_probe is current name but it helps on debugging if the function name is more appropriate to the sub-module name.
Renaming the palmas_probe() to palmas_regulator_probe() and palmas_remove() to palams_regulator_remove().
--- drivers/regulator/palmas-regulator.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/regulator/palmas-regulator.c +4 -4
@@ -582,7 +582,7 @@ static void palmas_dt_to_pdata(struct device *dev, } -static int palmas_probe (struct platform_device *pdev) +static int palmas_regulators_probe (struct platform_device *pdev) {struct palmas *palmas =dev_get_drvdata (pdev->dev.parent);struct palmas_pmic_platform_data *pdata = pdev->dev.platform_data;
@@ -791,7 +791,7 @@ err_unregister_regulator:return ret; } -static int palmas_remove (struct platform_device *pdev) +static int palmas_regulators_remove (struct platform_device *pdev) {struct palmas_pmic *pmic =platform_get_drvdata (pdev);int id;
@@ -819,8 +819,8 @@ static struct platform_driver palmas_driver = { .of_match_table = of_palmas_match_tbl, .owner = THIS_MODULE, }, - .probe = palmas_probe, - .remove = palmas_remove, + .probe = palmas_regulators_probe, + .remove = palmas_regulators_remove, };static int __init palmas_init (void )
Signature · 1 line
1.7.1.1
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 6 lines · Mark Brown
* PGP Signed by an unknown key
On Mon, Mar 18, 2013 at 02:59:48PM +0530, Laxman Dewangan wrote:
There's something odd about several recent patch serieses you've posted, they end up with patch 2 before instead of after patch 1. Anyway...
I generally send a patches on single git-send command
git send-emal [email protected] 0000.patch 0001.patch
So file names are in seq but not sure why it is not on seq. Something mail exchange resuffle. Probably I need to send one by one...
Quoted 5 lines
drivers/regulator/palmas-regulator.c static int palmas_regulators_probe(struct platform_device *pdev) · line 737
Quoted 4 lines
drivers/regulator/palmas-regulator.c +3
-0+if (config.init_data) + pmic->desc[id].supply_name = palmas_regs_info[id].sname; +This looks wrong... why is it conditional on
init_data?
Some of the rails are not used in board and hence their inputs are also left floating (unconnected). In this case, during DT population, I did not put entry i.e. if ldo1 is not used then ldo1-in is not connected on board and hence
entry on DT
ldo1-in-supply=<&xyzreg>;
is not there.
The regulator core register the regulator even if there is NULL init_data and in this case, it tries to findout the input-supply (provided through desc->supply_name) and it fails to find out the supply handle and so regulator register fails cause all regulator registration to fail.
So providing the dec->supply_name only in case of valid init_data.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 10 lines · Mark Brown
* PGP Signed by an unknown key
Quoted 6 lines · Laxman Dewangan
The regulator core register the regulator even if there is NULL
init_dataand in this case, it tries to findout the input-supply (provided throughdesc->supply_name) and it fails to find out the supply handle and so regulator register fails cause all regulator registration to fail.
So providing thedec->supply_nameonly in case of validinit_data.
Quoted 4 lines
This works fine if you have a device per regulator instead of a device for all the regulators on the chip... I would be inclined to address this by providing a "floating" supply and connecting everythinng to that.
I am fine with adding floating supply similar to below and connect all non-connected supply pins to this.
floating: regulator@1 {
compatible = "regulator-fixed";
reg = <1>;
regulator-name = "floating";
};If this is fine then I will respin the patch to remove condition.
Quoted 10 lines · Laxman Dewangan
Quoted 6 lines · Mark Brown
* PGP Signed by an unknown key
On Mon, Mar 18, 2013 at 02:59:48PM +0530, Laxman Dewangan wrote:
There's something odd about several recent patch serieses you've posted, they end up with patch 2 before instead of after patch 1. Anyway...
I generally send a patches on single git-send command
git send-emal [email protected] 0000.patch 0001.patch
Don't do that; send *.patch. If you don't, then patches 2..n don't end up being "in-reply-to" patch 1, so they won't show up as a single email thread.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 6 lines · Mark Brown
Quoted 4 lines · Stephen Warren
Quoted 2 lines · Laxman Dewangan
I generally send a patches on single git-send command git
send-emal [email protected] 0000.patch 0001.patch
Quoted 7 lines
Quoted 3 lines
Don't do that; send *.patch. If you don't, then patches 2..n don't end up being "in-reply-to" patch 1, so they won't show up as a single email thread.
The two should be equivalent (though the glob is much easier to type)? The result of the globbing ought to be what Laxman is typing by hand assuming that he's getting the order correct.
If you send *.patch at once, git send-email adds an in-reply-to header to the email which sets up the threading. If you send the patches 1-by-1, this header isn't added, since git send-email doesn't have a clue what message ID it chose for patch 1. Unless you pass the --in-reply-to command-line option, that is.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 23 lines · Mark Brown
Quoted 16 lines · Stephen Warren
Quoted 7 lines · Mark Brown
Quoted 4 lines · Stephen Warren
Quoted 2 lines · Laxman Dewangan
I generally send a patches on single git-send command git
send-emal [email protected] 0000.patch 0001.patchQuoted 7 lines
Quoted 3 lines
Don't do that; send *.patch. If you don't, then patches 2..n don't end up being "in-reply-to" patch 1, so they won't show up as a single email thread.
The two should be equivalent (though the glob is much easier to type)? The result of the globbing ought to be what Laxman is typing by hand assuming that he's getting the order correct.
Quoted 5 lines
If you send *.patch at once, git send-email adds an in-reply-to header to the email which sets up the threading. If you send the patches 1-by-1, this header isn't added, since git send-email doesn't have a clue what message ID it chose for patch 1. Unless you pass the --in-reply-to command-line option, that is.
Quoted 4 lines
Indeed - I think you may have quoted the wrong bit of Laxman's mail there? The bit you're replying to is doing it as a single command, though he did talk about doing this in multiple commands elsewhere in his mail.
Oh right yes. I'd seen 0000.patch and not that there were multiple entries in the command-line that listed (I assume) all the files. Sorry for the noise.