diff mbox series

[v7,04/11] mfd: mt6360: Combine mt6360 pmic/ldo resources into mt6360 regulator resources

Message ID 1605177598-23501-5-git-send-email-gene.chen.richtek@gmail.com (mailing list archive)
State New
Headers show
Series mfd: mt6360: Merge different sub-devices I2C read/write | expand

Commit Message

Gene Chen Nov. 12, 2020, 10:39 a.m. UTC
From: Gene Chen <gene_chen@richtek.com>

Combine mt6360 pmic/ldo resources into mt6360 regulator resources
to simplify the similar resources object.

Signed-off-by: Gene Chen <gene_chen@richtek.com>
Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/mfd/mt6360-core.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

Comments

Matthias Brugger Jan. 12, 2021, 12:32 p.m. UTC | #1
On 12/11/2020 11:39, Gene Chen wrote:
> From: Gene Chen <gene_chen@richtek.com>
> 
> Combine mt6360 pmic/ldo resources into mt6360 regulator resources
> to simplify the similar resources object.
> 
> Signed-off-by: Gene Chen <gene_chen@richtek.com>
> Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
> ---
>  drivers/mfd/mt6360-core.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/mfd/mt6360-core.c b/drivers/mfd/mt6360-core.c
> index 692e47b..5119e51 100644
> --- a/drivers/mfd/mt6360-core.c
> +++ b/drivers/mfd/mt6360-core.c
> @@ -265,7 +265,7 @@ static const struct resource mt6360_led_resources[] = {
>  	DEFINE_RES_IRQ_NAMED(MT6360_FLED1_STRB_TO_EVT, "fled1_strb_to_evt"),
>  };
>  
> -static const struct resource mt6360_pmic_resources[] = {
> +static const struct resource mt6360_regulator_resources[] = {
>  	DEFINE_RES_IRQ_NAMED(MT6360_BUCK1_PGB_EVT, "buck1_pgb_evt"),
>  	DEFINE_RES_IRQ_NAMED(MT6360_BUCK1_OC_EVT, "buck1_oc_evt"),
>  	DEFINE_RES_IRQ_NAMED(MT6360_BUCK1_OV_EVT, "buck1_ov_evt"),
> @@ -278,9 +278,6 @@ static const struct resource mt6360_pmic_resources[] = {
>  	DEFINE_RES_IRQ_NAMED(MT6360_LDO7_OC_EVT, "ldo7_oc_evt"),
>  	DEFINE_RES_IRQ_NAMED(MT6360_LDO6_PGB_EVT, "ldo6_pgb_evt"),
>  	DEFINE_RES_IRQ_NAMED(MT6360_LDO7_PGB_EVT, "ldo7_pgb_evt"),
> -};
> -
> -static const struct resource mt6360_ldo_resources[] = {
>  	DEFINE_RES_IRQ_NAMED(MT6360_LDO1_OC_EVT, "ldo1_oc_evt"),
>  	DEFINE_RES_IRQ_NAMED(MT6360_LDO2_OC_EVT, "ldo2_oc_evt"),
>  	DEFINE_RES_IRQ_NAMED(MT6360_LDO3_OC_EVT, "ldo3_oc_evt"),
> @@ -298,10 +295,8 @@ static const struct mfd_cell mt6360_devs[] = {
>  		    NULL, 0, 0, "mediatek,mt6360-chg"),
>  	OF_MFD_CELL("mt6360-led", mt6360_led_resources,
>  		    NULL, 0, 0, "mediatek,mt6360-led"),
> -	OF_MFD_CELL("mt6360-pmic", mt6360_pmic_resources,
> -		    NULL, 0, 0, "mediatek,mt6360-pmic"),
> -	OF_MFD_CELL("mt6360-ldo", mt6360_ldo_resources,
> -		    NULL, 0, 0, "mediatek,mt6360-ldo"),
> +	OF_MFD_CELL("mt6360-regulator", mt6360_regulator_resources,
> +		    NULL, 0, 0, "mediatek,mt6360-regulator"),

As discussed with the MFD maintainer [1], the regulator (and probably all cells)
shouldn't have a DT binding.

So please send a new version which fixes that.

Regards,
Matthias

[1] https://lore.kernel.org/linux-mediatek/20210111164118.GE4728@sirena.org.uk/

>  	OF_MFD_CELL("mt6360-tcpc", NULL,
>  		    NULL, 0, 0, "mediatek,mt6360-tcpc"),
>  };
>
Gene Chen Jan. 15, 2021, 3:55 a.m. UTC | #2
Matthias Brugger <matthias.bgg@gmail.com> 於 2021年1月12日 週二 下午8:32寫道:
>
>
>
> On 12/11/2020 11:39, Gene Chen wrote:
> > From: Gene Chen <gene_chen@richtek.com>
> >
> > Combine mt6360 pmic/ldo resources into mt6360 regulator resources
> > to simplify the similar resources object.
> >
> > Signed-off-by: Gene Chen <gene_chen@richtek.com>
> > Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
> > ---
> >  drivers/mfd/mt6360-core.c | 11 +++--------
> >  1 file changed, 3 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/mfd/mt6360-core.c b/drivers/mfd/mt6360-core.c
> > index 692e47b..5119e51 100644
> > --- a/drivers/mfd/mt6360-core.c
> > +++ b/drivers/mfd/mt6360-core.c
> > @@ -265,7 +265,7 @@ static const struct resource mt6360_led_resources[] = {
> >       DEFINE_RES_IRQ_NAMED(MT6360_FLED1_STRB_TO_EVT, "fled1_strb_to_evt"),
> >  };
> >
> > -static const struct resource mt6360_pmic_resources[] = {
> > +static const struct resource mt6360_regulator_resources[] = {
> >       DEFINE_RES_IRQ_NAMED(MT6360_BUCK1_PGB_EVT, "buck1_pgb_evt"),
> >       DEFINE_RES_IRQ_NAMED(MT6360_BUCK1_OC_EVT, "buck1_oc_evt"),
> >       DEFINE_RES_IRQ_NAMED(MT6360_BUCK1_OV_EVT, "buck1_ov_evt"),
> > @@ -278,9 +278,6 @@ static const struct resource mt6360_pmic_resources[] = {
> >       DEFINE_RES_IRQ_NAMED(MT6360_LDO7_OC_EVT, "ldo7_oc_evt"),
> >       DEFINE_RES_IRQ_NAMED(MT6360_LDO6_PGB_EVT, "ldo6_pgb_evt"),
> >       DEFINE_RES_IRQ_NAMED(MT6360_LDO7_PGB_EVT, "ldo7_pgb_evt"),
> > -};
> > -
> > -static const struct resource mt6360_ldo_resources[] = {
> >       DEFINE_RES_IRQ_NAMED(MT6360_LDO1_OC_EVT, "ldo1_oc_evt"),
> >       DEFINE_RES_IRQ_NAMED(MT6360_LDO2_OC_EVT, "ldo2_oc_evt"),
> >       DEFINE_RES_IRQ_NAMED(MT6360_LDO3_OC_EVT, "ldo3_oc_evt"),
> > @@ -298,10 +295,8 @@ static const struct mfd_cell mt6360_devs[] = {
> >                   NULL, 0, 0, "mediatek,mt6360-chg"),
> >       OF_MFD_CELL("mt6360-led", mt6360_led_resources,
> >                   NULL, 0, 0, "mediatek,mt6360-led"),
> > -     OF_MFD_CELL("mt6360-pmic", mt6360_pmic_resources,
> > -                 NULL, 0, 0, "mediatek,mt6360-pmic"),
> > -     OF_MFD_CELL("mt6360-ldo", mt6360_ldo_resources,
> > -                 NULL, 0, 0, "mediatek,mt6360-ldo"),
> > +     OF_MFD_CELL("mt6360-regulator", mt6360_regulator_resources,
> > +                 NULL, 0, 0, "mediatek,mt6360-regulator"),
>
> As discussed with the MFD maintainer [1], the regulator (and probably all cells)
> shouldn't have a DT binding.
>
> So please send a new version which fixes that.
>
> Regards,
> Matthias
>
> [1] https://lore.kernel.org/linux-mediatek/20210111164118.GE4728@sirena.org.uk/
>

Should I use parent's device to find sub-devices of_node if without
compatible name?
I trace the function mfd_add_device,

if (IS_ENABLED(CONFIG_OF) && parent->of_node && cell->of_compatible) {
    .....
    ret = mfd_match_of_node_to_dev(pdev, np, cell);
    .....
}

which is binding mfd sub-device with compatible. Does it be removed in
the feature?

> >       OF_MFD_CELL("mt6360-tcpc", NULL,
> >                   NULL, 0, 0, "mediatek,mt6360-tcpc"),
> >  };
> >
Lee Jones Jan. 15, 2021, 7:32 a.m. UTC | #3
On Fri, 15 Jan 2021, Gene Chen wrote:

> Matthias Brugger <matthias.bgg@gmail.com> 於 2021年1月12日 週二 下午8:32寫道:
> >
> >
> >
> > On 12/11/2020 11:39, Gene Chen wrote:
> > > From: Gene Chen <gene_chen@richtek.com>
> > >
> > > Combine mt6360 pmic/ldo resources into mt6360 regulator resources
> > > to simplify the similar resources object.
> > >
> > > Signed-off-by: Gene Chen <gene_chen@richtek.com>
> > > Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
> > > ---
> > >  drivers/mfd/mt6360-core.c | 11 +++--------
> > >  1 file changed, 3 insertions(+), 8 deletions(-)
> > >
> > > diff --git a/drivers/mfd/mt6360-core.c b/drivers/mfd/mt6360-core.c
> > > index 692e47b..5119e51 100644
> > > --- a/drivers/mfd/mt6360-core.c
> > > +++ b/drivers/mfd/mt6360-core.c
> > > @@ -265,7 +265,7 @@ static const struct resource mt6360_led_resources[] = {
> > >       DEFINE_RES_IRQ_NAMED(MT6360_FLED1_STRB_TO_EVT, "fled1_strb_to_evt"),
> > >  };
> > >
> > > -static const struct resource mt6360_pmic_resources[] = {
> > > +static const struct resource mt6360_regulator_resources[] = {
> > >       DEFINE_RES_IRQ_NAMED(MT6360_BUCK1_PGB_EVT, "buck1_pgb_evt"),
> > >       DEFINE_RES_IRQ_NAMED(MT6360_BUCK1_OC_EVT, "buck1_oc_evt"),
> > >       DEFINE_RES_IRQ_NAMED(MT6360_BUCK1_OV_EVT, "buck1_ov_evt"),
> > > @@ -278,9 +278,6 @@ static const struct resource mt6360_pmic_resources[] = {
> > >       DEFINE_RES_IRQ_NAMED(MT6360_LDO7_OC_EVT, "ldo7_oc_evt"),
> > >       DEFINE_RES_IRQ_NAMED(MT6360_LDO6_PGB_EVT, "ldo6_pgb_evt"),
> > >       DEFINE_RES_IRQ_NAMED(MT6360_LDO7_PGB_EVT, "ldo7_pgb_evt"),
> > > -};
> > > -
> > > -static const struct resource mt6360_ldo_resources[] = {
> > >       DEFINE_RES_IRQ_NAMED(MT6360_LDO1_OC_EVT, "ldo1_oc_evt"),
> > >       DEFINE_RES_IRQ_NAMED(MT6360_LDO2_OC_EVT, "ldo2_oc_evt"),
> > >       DEFINE_RES_IRQ_NAMED(MT6360_LDO3_OC_EVT, "ldo3_oc_evt"),
> > > @@ -298,10 +295,8 @@ static const struct mfd_cell mt6360_devs[] = {
> > >                   NULL, 0, 0, "mediatek,mt6360-chg"),
> > >       OF_MFD_CELL("mt6360-led", mt6360_led_resources,
> > >                   NULL, 0, 0, "mediatek,mt6360-led"),
> > > -     OF_MFD_CELL("mt6360-pmic", mt6360_pmic_resources,
> > > -                 NULL, 0, 0, "mediatek,mt6360-pmic"),
> > > -     OF_MFD_CELL("mt6360-ldo", mt6360_ldo_resources,
> > > -                 NULL, 0, 0, "mediatek,mt6360-ldo"),
> > > +     OF_MFD_CELL("mt6360-regulator", mt6360_regulator_resources,
> > > +                 NULL, 0, 0, "mediatek,mt6360-regulator"),
> >
> > As discussed with the MFD maintainer [1], the regulator (and probably all cells)
> > shouldn't have a DT binding.
> >
> > So please send a new version which fixes that.
> >
> > Regards,
> > Matthias
> >
> > [1] https://lore.kernel.org/linux-mediatek/20210111164118.GE4728@sirena.org.uk/

I don't think Mark is correct here.

We usually do implement compatible strings for sub-devices and they do
tend to have their own device nodes.

It's a very long time ago since I coded this up myself, but from
memory, you can't have 2 devices share a compatible string.

> Should I use parent's device to find sub-devices of_node if without
> compatible name?
> I trace the function mfd_add_device,
> 
> if (IS_ENABLED(CONFIG_OF) && parent->of_node && cell->of_compatible) {
>     .....
>     ret = mfd_match_of_node_to_dev(pdev, np, cell);
>     .....
> }
> 
> which is binding mfd sub-device with compatible. Does it be removed in
> the feature?
> 
> > >       OF_MFD_CELL("mt6360-tcpc", NULL,
> > >                   NULL, 0, 0, "mediatek,mt6360-tcpc"),
> > >  };
> > >
diff mbox series

Patch

diff --git a/drivers/mfd/mt6360-core.c b/drivers/mfd/mt6360-core.c
index 692e47b..5119e51 100644
--- a/drivers/mfd/mt6360-core.c
+++ b/drivers/mfd/mt6360-core.c
@@ -265,7 +265,7 @@  static const struct resource mt6360_led_resources[] = {
 	DEFINE_RES_IRQ_NAMED(MT6360_FLED1_STRB_TO_EVT, "fled1_strb_to_evt"),
 };
 
-static const struct resource mt6360_pmic_resources[] = {
+static const struct resource mt6360_regulator_resources[] = {
 	DEFINE_RES_IRQ_NAMED(MT6360_BUCK1_PGB_EVT, "buck1_pgb_evt"),
 	DEFINE_RES_IRQ_NAMED(MT6360_BUCK1_OC_EVT, "buck1_oc_evt"),
 	DEFINE_RES_IRQ_NAMED(MT6360_BUCK1_OV_EVT, "buck1_ov_evt"),
@@ -278,9 +278,6 @@  static const struct resource mt6360_pmic_resources[] = {
 	DEFINE_RES_IRQ_NAMED(MT6360_LDO7_OC_EVT, "ldo7_oc_evt"),
 	DEFINE_RES_IRQ_NAMED(MT6360_LDO6_PGB_EVT, "ldo6_pgb_evt"),
 	DEFINE_RES_IRQ_NAMED(MT6360_LDO7_PGB_EVT, "ldo7_pgb_evt"),
-};
-
-static const struct resource mt6360_ldo_resources[] = {
 	DEFINE_RES_IRQ_NAMED(MT6360_LDO1_OC_EVT, "ldo1_oc_evt"),
 	DEFINE_RES_IRQ_NAMED(MT6360_LDO2_OC_EVT, "ldo2_oc_evt"),
 	DEFINE_RES_IRQ_NAMED(MT6360_LDO3_OC_EVT, "ldo3_oc_evt"),
@@ -298,10 +295,8 @@  static const struct mfd_cell mt6360_devs[] = {
 		    NULL, 0, 0, "mediatek,mt6360-chg"),
 	OF_MFD_CELL("mt6360-led", mt6360_led_resources,
 		    NULL, 0, 0, "mediatek,mt6360-led"),
-	OF_MFD_CELL("mt6360-pmic", mt6360_pmic_resources,
-		    NULL, 0, 0, "mediatek,mt6360-pmic"),
-	OF_MFD_CELL("mt6360-ldo", mt6360_ldo_resources,
-		    NULL, 0, 0, "mediatek,mt6360-ldo"),
+	OF_MFD_CELL("mt6360-regulator", mt6360_regulator_resources,
+		    NULL, 0, 0, "mediatek,mt6360-regulator"),
 	OF_MFD_CELL("mt6360-tcpc", NULL,
 		    NULL, 0, 0, "mediatek,mt6360-tcpc"),
 };