[PATCH] arm: omap3: am35x: Set proper powerdomain states

Mark A. Greer mgreer at animalcreek.com
Tue May 15 14:35:27 EDT 2012


On Tue, May 15, 2012 at 09:43:52AM +0200, Jean Pihet wrote:
> Hi Mark,

Hi Jean.

> On Mon, Apr 30, 2012 at 11:26 PM, Mark A. Greer <mgreer at animalcreek.com> wrote:
> > From: "Mark A. Greer" <mgreer at animalcreek.com>
> >
> > The am35x family of SoCs only support the PWRSTS_ON
> > state so create a new set of powerdomain structures
> > that ensure that only the ON state is entered.
> >
> > Signed-off-by: Mark A. Greer <mgreer at animalcreek.com>
> > ---

> >  void __init omap3xxx_powerdomains_init(void)
> >  {
> >        unsigned int rev;
> > @@ -301,21 +403,31 @@ void __init omap3xxx_powerdomains_init(void)
> >                return;
> >
> >        pwrdm_register_platform_funcs(&omap3_pwrdm_operations);
> > -       pwrdm_register_pwrdms(powerdomains_omap3430_common);
> >
> >        rev = omap_rev();
> >
> > -       if (rev == OMAP3430_REV_ES1_0)
> > -               pwrdm_register_pwrdms(powerdomains_omap3430es1);
> > -       else if (rev == OMAP3430_REV_ES2_0 || rev == OMAP3430_REV_ES2_1 ||
> > -                rev == OMAP3430_REV_ES3_0 || rev == OMAP3630_REV_ES1_0)
> > -               pwrdm_register_pwrdms(powerdomains_omap3430es2_es3_0);
> > -       else if (rev == OMAP3430_REV_ES3_1 || rev == OMAP3430_REV_ES3_1_2 ||
> > -                rev == AM35XX_REV_ES1_0 || rev == AM35XX_REV_ES1_1 ||
> > -                rev == OMAP3630_REV_ES1_1 || rev == OMAP3630_REV_ES1_2)
> > -               pwrdm_register_pwrdms(powerdomains_omap3430es3_1plus);
> > -       else
> > -               WARN(1, "OMAP3 powerdomain init: unknown chip type\n");
> > +       if (rev == AM35XX_REV_ES1_0 || rev == AM35XX_REV_ES1_1) {
> > +               pwrdm_register_pwrdms(powerdomains_am35x);
> > +       } else {
> > +               pwrdm_register_pwrdms(powerdomains_omap3430_common);
> Is there a way to avoid the big 'if else' here and have the code
> organized per chipset revision? A mutliple if-else or -even better
> IMO- a switch-case would make the code more readable.

We can't avoid it completely because we have to register
powerdomains_am35x[] [exclusive] OR (powerdomains_omap3430_common[] +
extras).  What I can do is leave the outside 'if' and turn the code
inside the 'else' into a switch stmt which should look nicer.

Good idea, thanks. :)

I will submit v2 in a bit.

Mark



More information about the linux-arm-kernel mailing list