lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Fri, 14 Apr 2023 12:19:06 +0200
From:   AngeloGioacchino Del Regno 
        <angelogioacchino.delregno@...labora.com>
To:     Alexandre Mergnat <amergnat@...libre.com>, pavel@....cz
Cc:     lee@...nel.org, sean.wang@...iatek.com, robh+dt@...nel.org,
        krzysztof.kozlowski+dt@...aro.org, matthias.bgg@...il.com,
        linux-leds@...r.kernel.org, devicetree@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org,
        linux-mediatek@...ts.infradead.org, linux-kernel@...r.kernel.org,
        kernel@...labora.com
Subject: Re: [PATCH v2 7/7] leds: leds-mt6323: Add support for WLEDs and
 MT6332

Il 13/04/23 16:15, Alexandre Mergnat ha scritto:
> On 12/04/2023 17:33, AngeloGioacchino Del Regno wrote:
>> Add basic code to turn on and off WLEDs and wire up MT6332 support
>> to take advantage of it.
>> This is a simple approach due to to the aforementioned PMIC supporting
>> only on/off status so, at the time of writing, it is impossible for me
>> to validate more advanced functionality due to lack of hardware.
>>
>> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
>> ---
>>   drivers/leds/leds-mt6323.c | 171 +++++++++++++++++++++++++++++++++++--
>>   1 file changed, 164 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/leds/leds-mt6323.c b/drivers/leds/leds-mt6323.c
>> index 5d95dbd9a761..202b38ac32f6 100644
>> --- a/drivers/leds/leds-mt6323.c
>> +++ b/drivers/leds/leds-mt6323.c

..snip..

>> @@ -418,6 +538,7 @@ static int mt6323_led_probe(struct platform_device *pdev)
>>       int ret;
>>       unsigned int status;
>>       u32 reg;
>> +    u8 max_leds;
>>       leds = devm_kzalloc(dev, sizeof(*leds), GFP_KERNEL);
>>       if (!leds)
>> @@ -428,6 +549,7 @@ static int mt6323_led_probe(struct platform_device *pdev)
>>       leds->pdata = device_get_match_data(dev);
>>       regs = leds->pdata->regs;
>>       spec = leds->pdata->spec;
>> +    max_leds = spec->max_leds + spec->max_wleds;
> 
> I haven't access to the datasheet so I have to ask you:
> Why the max leds value is the addition of max led and wled ?
> 
> IMO, the datasheed give you the max supported led OR wled on its bus function to 
> the maximum supplied current by the PMIC (I assume LED or WLED have different 
> need). Or the PMIC has 2 bus, one for led and another for wled ?
> 

I don't have access to the datasheet for MT6332 as well - but anyway, the only
purpose of the max_leds variable is to validate the maximum number of 'reg'
spaces that we're supposed to read from devicetree, that's all.

The alternative would've been to check if there's any led, then any wled in the
mt6323_hwspec from platform data - then:

if only wleds, max_leds = wleds;
else if only leds, max_leds = leds;
else if leds and wleds, max_leds = leds + wleds;

You see that it doesn't make any sense to do such check, and we can go with
just adding wleds+leds.

Regards,
Angelo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ