[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9bb6ef63e19bf079fd881a3b78b71d7a00e4a3bb.camel@apitzsch.eu>
Date: Thu, 02 May 2024 21:19:13 +0200
From: André Apitzsch <git@...tzsch.eu>
To: Lee Jones <lee@...nel.org>
Cc: Pavel Machek <pavel@....cz>, Rob Herring <robh@...nel.org>, Krzysztof
Kozlowski <krzysztof.kozlowski+dt@...aro.org>, Conor Dooley
<conor+dt@...nel.org>, Kees Cook <keescook@...omium.org>, "Gustavo A. R.
Silva" <gustavoars@...nel.org>, Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konrad.dybcio@...aro.org>, linux-leds@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org, linux-arm-msm@...r.kernel.org,
~postmarketos/upstreaming@...ts.sr.ht, phone-devel@...r.kernel.org
Subject: Re: [PATCH v2 2/3] leds: sy7802: Add support for Silergy SY7802
flash LED controller
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);
> > > > +
> > > > [..]
> > > >
>
Powered by blists - more mailing lists