Re: [PATCH v1 09/11] leds: aw200xx: improve autodim calculation method

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

 



On Mon, Oct 09, 2023 at 04:18:08PM +0300, Dmitry Rokosov wrote:
> On Fri, Oct 06, 2023 at 09:03:47PM +0300, Andy Shevchenko wrote:
> > On Fri, Oct 6, 2023 at 7:05 PM Dmitry Rokosov
> > <ddrokosov@xxxxxxxxxxxxxxxxx> wrote:
> > >
> > > From: George Stark <gnstark@xxxxxxxxxxxxxxxxx>
> > >
> > > use DIV_ROUND_UP instead of coarse div
> > 
> > Please, respect English grammar and punctuation.
> > Refer to macros and functions as func() (note the parentheses).
> > 
> > ...
> > 
> > >  #define AW200XX_REG_DIM2FADE(x) ((x) + 1)
> > > +#define AW200XX_REG_FADE2DIM(fade) \
> > > +       DIV_ROUND_UP((fade) * AW200XX_DIM_MAX, AW200XX_FADE_MAX)
> > 
> > Have you checked if the overflow is _now_ possible (compiling on
> > 32-bit platforms as well)?
> 
> I suppose we shouldn't carry on about overflow here because the value of
> fade cannot exceed 255, and DIM_MAX is set at 63
> 
> You can find maximum values of fade and dim in the aw200xx driver
> header:
> 
> #define AW200XX_DIM_MAX                  (BIT(6) - 1)
> #define AW200XX_FADE_MAX                 (BIT(8) - 1)

I agree that checking if the fade is not greater than FADE_MAX will not
be excessive. The LED subsystem is capable of sending brightness levels
higher than 255

-- 
Thank you,
Dmitry



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux