Re: [PATCH v4 13/13] video: backlight: mt6370: Add Mediatek MT6370 support

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

 



On Thu, Jul 14, 2022 at 9:13 AM ChiaEn Wu <peterwu.pub@xxxxxxxxx> wrote:
> Andy Shevchenko <andy.shevchenko@xxxxxxxxx> 於 2022年7月13日 週三 晚上8:07寫道:
> > On Wed, Jul 13, 2022 at 12:53 PM ChiaEn Wu <peterwu.pub@xxxxxxxxx> wrote:
> > > Andy Shevchenko <andy.shevchenko@xxxxxxxxx> 於 2022年7月5日 週二 清晨5:14寫道:
> > > > On Mon, Jul 4, 2022 at 7:43 AM ChiaEn Wu <peterwu.pub@xxxxxxxxx> wrote:

Please, once again, remove unneeded context when replying!
^^^^^^^

...

> > > > > +               prop_val = (ilog2(roundup_pow_of_two(prop_val)) + 1) >> 1;
> > > >
> > > > Isn't something closer to get_order() or fls()?
> > >
> > > I will revise it to "(get_order(prop_va * PAGE_SIZE) + 1) / 2" and
> > > this change is meet your expectations??
> >
> > Nope. Try again. What about fls()?
>
> I have tried two methods so far, as follows
> -------------------------------------------------------------
> /*
>  * prop_val =  1      -->  1 steps --> b'00
>  * prop_val =  2 ~  4 -->  4 steps --> b'01
>  * prop_val =  5 ~ 16 --> 16 steps --> b'10
>  * prop_val = 17 ~ 64 --> 64 steps --> b'11
> */

So, for 1 --> 0, for 2 --> 1, for 5 --> 2, and for 17 --> 3.
Now, consider x - 1:
0  ( 0 ) --> 0
1  (2^0) --> 1
4  (2^2) --> 2
16 (2^4) --> 3
64 (2^6) --> ? (but let's consider that the range has been checked already)

Since we take the lower limit, it means ffs():

  y = (ffs(x - 1) + 1) / 2;

Does it work for you?

> // 1. use fls() and ffs() combination
> prop_val = ffs(prop_val) == fls(prop_val) ? fls(prop_val) >> 1 :
> (fls(prop_val) + 1) >> 1;
>
> // 2. use one line for-loop, but without fls()
> for (i = --prop_val, prop_val = 0; i >> 2 * prop_val != 0; prop_val++);
> -------------------------------------------------------------
> Do these changes meet your expectations??

No, this is ugly. Yes, I understand that a bit arithmetics is hard...

-- 
With Best Regards,
Andy Shevchenko




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux