Am Donnerstag, dem 02.05.2024 um 10:10 +0100 schrieb Lee Jones:
> On Wed, 01 May 2024, André Apitzsch wrote:
> 
> > > > +               ret = -EBUSY;
> > > > +               goto unlock;
> > > > +       }
> > > > +
> > > > +       if (level)
> > > > +               curr = chip->fled_torch_used | BIT(led-
> > > > >led_no);
> > > > +       else
> > > > +               curr = chip->fled_torch_used & ~BIT(led-
> > > > >led_no);
> > > > +
> > > > +       if (curr)
> > > > +               val |= SY7802_MODE_TORCH;
> > > > +
> > > > +       /* Torch needs to be disabled first to apply new
> > > > brightness */
> > > 
> > > "Disable touch to apply brightness"
> > > 
> > > > +       ret = regmap_update_bits(chip->regmap,
> > > > SY7802_REG_ENABLE,
> > > > SY7802_MODE_MASK,
> > > > +                                SY7802_MODE_OFF);
> > > > +       if (ret)
> > > > +               goto unlock;
> > > > +
> > > > +       mask = led->led_no == SY7802_LED_JOINT ?
> > > > SY7802_TORCH_CURRENT_MASK_ALL :
> > > 
> > > Why not just use led->led_no in place of mask?
> > 
> > I might be missing something, but I don't know how to use led-
> > >led_no
> > in place of mask, when
> > led->led_no is in {0,1,2} and
> > mask is in {0x07, 0x38, 0x3f}.
> 
> This doesn't make much sense.
> 
> I guess you mean that led_no is a u8 and mask is a u32.
> 
> What happens if you cast led_no to u32 in the call to
> regmap_update_bits()?

Sorry, I'm still confused. Could you elaborate your original question?

> 
> > > Easier to read if you drop SY7802_TORCH_CURRENT_MASK_ALL to its
> > > own
> > > line.
> > > 
> > > > +              SY7802_TORCH_CURRENT_MASK(led->led_no);
> > > > +
> > > > [..]
> > > > 
> 


Reply via email to