Message ID | 1594983811-25908-5-git-send-email-gene.chen.richtek@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | mfd: mt6360: Merge different sub-devices i2c read/write | expand |
On Fri, 17 Jul 2020, Gene Chen wrote: > From: Gene Chen <gene_chen@richtek.com> > > Combine mt6360 pmic/ldo resouces into mt6360 regulator resources > to simplify the similar resources object. Do the sub-devices actually share these resources, or are you doing this just to make the code simpler? > Signed-off-by: Gene Chen <gene_chen@richtek.com> > --- > 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 7cc1b59..665e26f 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"), > };
Lee Jones <lee.jones@linaro.org> 於 2020年7月27日 週一 下午7:29寫道: > > On Fri, 17 Jul 2020, Gene Chen wrote: > > > From: Gene Chen <gene_chen@richtek.com> > > > > Combine mt6360 pmic/ldo resouces into mt6360 regulator resources > > to simplify the similar resources object. > > Do the sub-devices actually share these resources, or are you doing > this just to make the code simpler? > They are different resources used by different bucks and ldos without sharing relations. I just to make the code simpler. > > Signed-off-by: Gene Chen <gene_chen@richtek.com> > > --- > > 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 7cc1b59..665e26f 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"), > > }; > > -- > Lee Jones [李琼斯] > Senior Technical Lead - Developer Services > Linaro.org │ Open source software for Arm SoCs > Follow Linaro: Facebook | Twitter | Blog
On Tue, 28 Jul 2020, Gene Chen wrote: > Lee Jones <lee.jones@linaro.org> 於 2020年7月27日 週一 下午7:29寫道: > > > > On Fri, 17 Jul 2020, Gene Chen wrote: > > > > > From: Gene Chen <gene_chen@richtek.com> > > > > > > Combine mt6360 pmic/ldo resouces into mt6360 regulator resources > > > to simplify the similar resources object. > > > > Do the sub-devices actually share these resources, or are you doing > > this just to make the code simpler? > > > > They are different resources used by different bucks and ldos without > sharing relations. > I just to make the code simpler. I don't think that's sensible. You should only share resources with child devices that consume them. > > > Signed-off-by: Gene Chen <gene_chen@richtek.com> > > > --- > > > 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 7cc1b59..665e26f 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"), > > > }; > >
Lee Jones <lee.jones@linaro.org> 於 2020年7月28日 週二 下午2:54寫道: > > On Tue, 28 Jul 2020, Gene Chen wrote: > > > Lee Jones <lee.jones@linaro.org> 於 2020年7月27日 週一 下午7:29寫道: > > > > > > On Fri, 17 Jul 2020, Gene Chen wrote: > > > > > > > From: Gene Chen <gene_chen@richtek.com> > > > > > > > > Combine mt6360 pmic/ldo resouces into mt6360 regulator resources > > > > to simplify the similar resources object. > > > > > > Do the sub-devices actually share these resources, or are you doing > > > this just to make the code simpler? > > > > > > > They are different resources used by different bucks and ldos without > > sharing relations. > > I just to make the code simpler. > > I don't think that's sensible. > > You should only share resources with child devices that consume them. > At first, I separated regulators into two drivers, mt6360-pmic.c and mt6360-ldo.c, according to default-on power or not. Then, I merged two drivers into mt6360-regulator.c and merged their resources as well. Therefore, for every device of BUCK/LDO, I'll find resources according to their name and request IRQs. > > > > Signed-off-by: Gene Chen <gene_chen@richtek.com> > > > > --- > > > > 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 7cc1b59..665e26f 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"), > > > > }; > > > > > -- > Lee Jones [李琼斯] > Senior Technical Lead - Developer Services > Linaro.org │ Open source software for Arm SoCs > Follow Linaro: Facebook | Twitter | Blog
On Fri, 31 Jul 2020, Gene Chen wrote: > Lee Jones <lee.jones@linaro.org> 於 2020年7月28日 週二 下午2:54寫道: > > > > On Tue, 28 Jul 2020, Gene Chen wrote: > > > > > Lee Jones <lee.jones@linaro.org> 於 2020年7月27日 週一 下午7:29寫道: > > > > > > > > On Fri, 17 Jul 2020, Gene Chen wrote: > > > > > > > > > From: Gene Chen <gene_chen@richtek.com> > > > > > > > > > > Combine mt6360 pmic/ldo resouces into mt6360 regulator resources > > > > > to simplify the similar resources object. > > > > > > > > Do the sub-devices actually share these resources, or are you doing > > > > this just to make the code simpler? > > > > > > > > > > They are different resources used by different bucks and ldos without > > > sharing relations. > > > I just to make the code simpler. > > > > I don't think that's sensible. > > > > You should only share resources with child devices that consume them. > > > > At first, I separated regulators into two drivers, mt6360-pmic.c and > mt6360-ldo.c, according to default-on power or not. > Then, I merged two drivers into mt6360-regulator.c and merged their > resources as well. > Therefore, for every device of BUCK/LDO, I'll find resources according > to their name and request IRQs. Okay, so all of the resources are consumed by a single driver? That is fine then.
diff --git a/drivers/mfd/mt6360-core.c b/drivers/mfd/mt6360-core.c index 7cc1b59..665e26f 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"), };