Re: [PATCH v2 07/14] ARM: MXS: refactor mx2*_power_init source configuration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 10, 2018 at 12:29:07PM -0700, Andrey Smirnov wrote:
> On Fri, Aug 10, 2018 at 9:36 AM Roland Hieber <r.hieber@xxxxxxxxxxxxxx> wrote:
> > diff --git a/arch/arm/mach-mxs/power-init.c b/arch/arm/mach-mxs/power-init.c
> > index 595b51c5ba..a07ff9d676 100644
> > --- a/arch/arm/mach-mxs/power-init.c
> > +++ b/arch/arm/mach-mxs/power-init.c
> > @@ -24,21 +24,7 @@
> >  #include <mach/regs-rtc.h>
> >  #include <mach/regs-lradc.h>
> >
> > -/*
> > - * has_battery - true when this board has a battery.
> > - */
> > -static int has_battery;
> > -
> > -/*
> > - * use_battery_input - true when this board is supplied from the
> > - * battery input, but has a DC source instead of a real battery
> > - */
> > -static int use_battery_input;
> > -
> > -/*
> > - * use_5v_input - true when this board can use the 5V input
> > - */
> > -static int use_5v_input;
> > +static int power_config;
> 
> I might be missing something, so take this with a grain of salt. It
> seems like if you change this variable to be "power_use" and
> initialize it accordingly (maybe using a new helper function
> mxs_power_use() that does the bitmasking) you should be able to cut
> down on amount of (power_config & __POWER_USE_MASK) statements you
> have further in the code.

Indeed, that's a good idea! Will send v3 shortly.

> >  static void mxs_power_status(void)
> >  {
> > @@ -514,7 +500,8 @@ static void mxs_power_enable_4p2(void)
> >                 POWER_5VCTRL_HEADROOM_ADJ_MASK,
> >                 0x4 << POWER_5VCTRL_HEADROOM_ADJ_OFFSET);
> >
> > -       if (has_battery || use_battery_input)
> > +       if ((power_config & __POWER_USE_MASK) == POWER_USE_BATTERY ||
> > +           (power_config & __POWER_USE_MASK) == POWER_USE_BATTERY_INPUT)
> >                 dropout_ctrl = POWER_DCDC4P2_DROPOUT_CTRL_SRC_SEL;
> >         else
> >                 dropout_ctrl = POWER_DCDC4P2_DROPOUT_CTRL_SRC_4P2;
> > @@ -1182,16 +1169,15 @@ static void mx23_ungate_power(void)
[...]

 - Roland

-- 
Roland Hieber                     | r.hieber@xxxxxxxxxxxxxx     |
Pengutronix e.K.                  | https://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim | Phone: +49-5121-206917-5086 |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux