* [PATCH 1/2] regulator: da9052: Convert to regulator core's simplified DT parsing code @ 2019-03-12 15:47 Axel Lin 2019-03-12 15:47 ` [PATCH 2/2] regulator: da9055: " Axel Lin 0 siblings, 1 reply; 4+ messages in thread From: Axel Lin @ 2019-03-12 15:47 UTC (permalink / raw) To: Mark Brown Cc: Steve Twiss, Support Opensource, Liam Girdwood, linux-kernel, Axel Lin Use regulator core's simplified DT parsing code to simply the driver implementation. Signed-off-by: Axel Lin <axel.lin@ingics.com> --- Hi, I don't have this h/w, so please help testing it. Thanks, Axel drivers/regulator/da9052-regulator.c | 33 +++++----------------------- 1 file changed, 6 insertions(+), 27 deletions(-) diff --git a/drivers/regulator/da9052-regulator.c b/drivers/regulator/da9052-regulator.c index cefa3558236d..98d486372b8c 100644 --- a/drivers/regulator/da9052-regulator.c +++ b/drivers/regulator/da9052-regulator.c @@ -294,6 +294,8 @@ static const struct regulator_ops da9052_ldo_ops = { {\ .reg_desc = {\ .name = #_name,\ + .of_match = of_match_ptr(#_name),\ + .regulators_node = of_match_ptr("regulators"),\ .ops = &da9052_ldo_ops,\ .type = REGULATOR_VOLTAGE,\ .id = DA9052_ID_##_id,\ @@ -314,6 +316,8 @@ static const struct regulator_ops da9052_ldo_ops = { {\ .reg_desc = {\ .name = #_name,\ + .of_match = of_match_ptr(#_name),\ + .regulators_node = of_match_ptr("regulators"),\ .ops = &da9052_dcdc_ops,\ .type = REGULATOR_VOLTAGE,\ .id = DA9052_ID_##_id,\ @@ -417,36 +421,11 @@ static int da9052_regulator_probe(struct platform_device *pdev) return -EINVAL; } - config.dev = &pdev->dev; + config.dev = da9052->dev; config.driver_data = regulator; config.regmap = da9052->regmap; - if (pdata) { + if (pdata) config.init_data = pdata->regulators[cell->id]; - } else { -#ifdef CONFIG_OF - struct device_node *nproot = da9052->dev->of_node; - struct device_node *np; - - if (!nproot) - return -ENODEV; - - nproot = of_get_child_by_name(nproot, "regulators"); - if (!nproot) - return -ENODEV; - - for_each_child_of_node(nproot, np) { - if (of_node_name_eq(np, - regulator->info->reg_desc.name)) { - config.init_data = of_get_regulator_init_data( - &pdev->dev, np, - ®ulator->info->reg_desc); - config.of_node = np; - break; - } - } - of_node_put(nproot); -#endif - } regulator->rdev = devm_regulator_register(&pdev->dev, ®ulator->info->reg_desc, -- 2.17.1 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] regulator: da9055: Convert to regulator core's simplified DT parsing code 2019-03-12 15:47 [PATCH 1/2] regulator: da9052: Convert to regulator core's simplified DT parsing code Axel Lin @ 2019-03-12 15:47 ` Axel Lin 2019-03-18 13:56 ` Steve Twiss 0 siblings, 1 reply; 4+ messages in thread From: Axel Lin @ 2019-03-12 15:47 UTC (permalink / raw) To: Mark Brown Cc: Steve Twiss, Support Opensource, Liam Girdwood, linux-kernel, Axel Lin Use regulator core's simplified DT parsing code to simply the driver implementation. Signed-off-by: Axel Lin <axel.lin@ingics.com> --- drivers/regulator/da9055-regulator.c | 67 +++------------------------- 1 file changed, 6 insertions(+), 61 deletions(-) diff --git a/drivers/regulator/da9055-regulator.c b/drivers/regulator/da9055-regulator.c index 3c6fac793658..b7b4dddf5509 100644 --- a/drivers/regulator/da9055-regulator.c +++ b/drivers/regulator/da9055-regulator.c @@ -338,6 +338,8 @@ static const struct regulator_ops da9055_ldo_ops = { {\ .reg_desc = {\ .name = #_id,\ + .of_match = of_match_ptr(#_id),\ + .regulators_node = of_match_ptr("regulators"),\ .ops = &da9055_ldo_ops,\ .type = REGULATOR_VOLTAGE,\ .id = DA9055_ID_##_id,\ @@ -366,6 +368,8 @@ static const struct regulator_ops da9055_ldo_ops = { {\ .reg_desc = {\ .name = #_id,\ + .of_match = of_match_ptr(#_id),\ + .regulators_node = of_match_ptr("regulators"),\ .ops = &da9055_buck_ops,\ .type = REGULATOR_VOLTAGE,\ .id = DA9055_ID_##_id,\ @@ -507,59 +511,6 @@ static inline struct da9055_regulator_info *find_regulator_info(int id) return NULL; } -#ifdef CONFIG_OF -static struct of_regulator_match da9055_reg_matches[] = { - { .name = "BUCK1", }, - { .name = "BUCK2", }, - { .name = "LDO1", }, - { .name = "LDO2", }, - { .name = "LDO3", }, - { .name = "LDO4", }, - { .name = "LDO5", }, - { .name = "LDO6", }, -}; - -static int da9055_regulator_dt_init(struct platform_device *pdev, - struct da9055_regulator *regulator, - struct regulator_config *config, - int regid) -{ - struct device_node *nproot, *np; - int ret; - - nproot = of_node_get(pdev->dev.parent->of_node); - if (!nproot) - return -ENODEV; - - np = of_get_child_by_name(nproot, "regulators"); - if (!np) - return -ENODEV; - - ret = of_regulator_match(&pdev->dev, np, &da9055_reg_matches[regid], 1); - of_node_put(nproot); - if (ret < 0) { - dev_err(&pdev->dev, "Error matching regulator: %d\n", ret); - return ret; - } - - config->init_data = da9055_reg_matches[regid].init_data; - config->of_node = da9055_reg_matches[regid].of_node; - - if (!config->of_node) - return -ENODEV; - - return 0; -} -#else -static inline int da9055_regulator_dt_init(struct platform_device *pdev, - struct da9055_regulator *regulator, - struct regulator_config *config, - int regid) -{ - return -ENODEV; -} -#endif /* CONFIG_OF */ - static int da9055_regulator_probe(struct platform_device *pdev) { struct regulator_config config = { }; @@ -580,18 +531,12 @@ static int da9055_regulator_probe(struct platform_device *pdev) } regulator->da9055 = da9055; - config.dev = &pdev->dev; + config.dev = da9055->dev; config.driver_data = regulator; config.regmap = da9055->regmap; - if (pdata) { + if (pdata) config.init_data = pdata->regulators[pdev->id]; - } else { - ret = da9055_regulator_dt_init(pdev, regulator, &config, - pdev->id); - if (ret < 0) - return ret; - } ret = da9055_gpio_init(regulator, &config, pdata, pdev->id); if (ret < 0) -- 2.17.1 ^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH 2/2] regulator: da9055: Convert to regulator core's simplified DT parsing code 2019-03-12 15:47 ` [PATCH 2/2] regulator: da9055: " Axel Lin @ 2019-03-18 13:56 ` Steve Twiss 2019-03-18 14:25 ` Mark Brown 0 siblings, 1 reply; 4+ messages in thread From: Steve Twiss @ 2019-03-18 13:56 UTC (permalink / raw) To: Mark Brown; +Cc: Axel Lin, Support Opensource, Liam Girdwood, linux-kernel Hi Mark, For the DA9055, I have spoken with the management here. Dialog Semiconductor are "no longer building the DA9055"; the device doesn't appear on the support portal or website and; I have been told, "you can remove [it] from your list of supported products". But, as always: I realise that the Linux community will have different aims and I would like to support those as much as I can. There are many reasons to keep supporting the drivers, and not least because of your comments from way-back, in 2014: On Fri, 14 Feb 2014 14:56:43, Mark Brown wrote: > We do fairly often see problems with people still using old boards for various > reasons [and it] does not mean that the old silicon has been retired by users > (even if [it is] just [used] for comparison purposes [...] - "that worked on > the rev A boards, did we break the software?"). But it does seem that around 97% of this driver has not has not changed since 2014, so we are happy here at Dialog to remove our support from this DA9055 device. Is there a Linux device driver retirement plan for obsoleted products? :) Regards, Steve On 12 March 2019 15:48, Axel Lin wrote: > To: Mark Brown <broonie@kernel.org> > Subject: [PATCH 2/2] regulator: da9055: Convert to regulator core's simplified DT > parsing code > > Use regulator core's simplified DT parsing code to simply the driver > implementation. > > Signed-off-by: Axel Lin <axel.lin@ingics.com> > --- > drivers/regulator/da9055-regulator.c | 67 +++------------------------- > 1 file changed, 6 insertions(+), 61 deletions(-) > > diff --git a/drivers/regulator/da9055-regulator.c b/drivers/regulator/da9055- > regulator.c > index 3c6fac793658..b7b4dddf5509 100644 > --- a/drivers/regulator/da9055-regulator.c > +++ b/drivers/regulator/da9055-regulator.c > @@ -338,6 +338,8 @@ static const struct regulator_ops da9055_ldo_ops = { > {\ > .reg_desc = {\ > .name = #_id,\ > + .of_match = of_match_ptr(#_id),\ > + .regulators_node = of_match_ptr("regulators"),\ > .ops = &da9055_ldo_ops,\ > .type = REGULATOR_VOLTAGE,\ > .id = DA9055_ID_##_id,\ > @@ -366,6 +368,8 @@ static const struct regulator_ops da9055_ldo_ops = { > {\ > .reg_desc = {\ > .name = #_id,\ > + .of_match = of_match_ptr(#_id),\ > + .regulators_node = of_match_ptr("regulators"),\ > .ops = &da9055_buck_ops,\ > .type = REGULATOR_VOLTAGE,\ > .id = DA9055_ID_##_id,\ > @@ -507,59 +511,6 @@ static inline struct da9055_regulator_info > *find_regulator_info(int id) > return NULL; > } > > -#ifdef CONFIG_OF > -static struct of_regulator_match da9055_reg_matches[] = { > - { .name = "BUCK1", }, > - { .name = "BUCK2", }, > - { .name = "LDO1", }, > - { .name = "LDO2", }, > - { .name = "LDO3", }, > - { .name = "LDO4", }, > - { .name = "LDO5", }, > - { .name = "LDO6", }, > -}; > - > -static int da9055_regulator_dt_init(struct platform_device *pdev, > - struct da9055_regulator *regulator, > - struct regulator_config *config, > - int regid) > -{ > - struct device_node *nproot, *np; > - int ret; > - > - nproot = of_node_get(pdev->dev.parent->of_node); > - if (!nproot) > - return -ENODEV; > - > - np = of_get_child_by_name(nproot, "regulators"); > - if (!np) > - return -ENODEV; > - > - ret = of_regulator_match(&pdev->dev, np, > &da9055_reg_matches[regid], 1); > - of_node_put(nproot); > - if (ret < 0) { > - dev_err(&pdev->dev, "Error matching regulator: %d\n", ret); > - return ret; > - } > - > - config->init_data = da9055_reg_matches[regid].init_data; > - config->of_node = da9055_reg_matches[regid].of_node; > - > - if (!config->of_node) > - return -ENODEV; > - > - return 0; > -} > -#else > -static inline int da9055_regulator_dt_init(struct platform_device *pdev, > - struct da9055_regulator *regulator, > - struct regulator_config *config, > - int regid) > -{ > - return -ENODEV; > -} > -#endif /* CONFIG_OF */ > - > static int da9055_regulator_probe(struct platform_device *pdev) > { > struct regulator_config config = { }; > @@ -580,18 +531,12 @@ static int da9055_regulator_probe(struct > platform_device *pdev) > } > > regulator->da9055 = da9055; > - config.dev = &pdev->dev; > + config.dev = da9055->dev; > config.driver_data = regulator; > config.regmap = da9055->regmap; > > - if (pdata) { > + if (pdata) > config.init_data = pdata->regulators[pdev->id]; > - } else { > - ret = da9055_regulator_dt_init(pdev, regulator, &config, > - pdev->id); > - if (ret < 0) > - return ret; > - } > > ret = da9055_gpio_init(regulator, &config, pdata, pdev->id); > if (ret < 0) > -- > 2.17.1 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] regulator: da9055: Convert to regulator core's simplified DT parsing code 2019-03-18 13:56 ` Steve Twiss @ 2019-03-18 14:25 ` Mark Brown 0 siblings, 0 replies; 4+ messages in thread From: Mark Brown @ 2019-03-18 14:25 UTC (permalink / raw) To: Steve Twiss; +Cc: Axel Lin, Support Opensource, Liam Girdwood, linux-kernel [-- Attachment #1: Type: text/plain, Size: 722 bytes --] On Mon, Mar 18, 2019 at 01:56:21PM +0000, Steve Twiss wrote: > But it does seem that around 97% of this driver has not has not changed since > 2014, so we are happy here at Dialog to remove our support from this DA9055 > device. > Is there a Linux device driver retirement plan for obsoleted products? :) Well, we can delete stuff but personally I don't see a big concern with leaving things sitting there so long as they're not getting in anyone's way - it's more effort to figure out if there's any users (like with this if there's people with old boards somewhere even if the product isn't being sold yet) than it is just to leave things sitting there. If you don't want to do any support on it that's fine though. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-03-18 14:26 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-03-12 15:47 [PATCH 1/2] regulator: da9052: Convert to regulator core's simplified DT parsing code Axel Lin 2019-03-12 15:47 ` [PATCH 2/2] regulator: da9055: " Axel Lin 2019-03-18 13:56 ` Steve Twiss 2019-03-18 14:25 ` Mark Brown
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®