From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
To: Alexandre Mergnat <amergnat@baylibre.com>, pavel@ucw.cz
Cc: lee@kernel.org, sean.wang@mediatek.com, robh+dt@kernel.org,
krzysztof.kozlowski+dt@linaro.org, matthias.bgg@gmail.com,
linux-leds@vger.kernel.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org,
kernel@collabora.com
Subject: Re: [PATCH v2 7/7] leds: leds-mt6323: Add support for WLEDs and MT6332
Date: Fri, 14 Apr 2023 12:19:06 +0200 [thread overview]
Message-ID: <d1f54cd7-99c0-3d1c-460b-9f15f33b95c1@collabora.com> (raw)
In-Reply-To: <00c0b699-ba1a-951c-185a-ef8f09abf6f3@baylibre.com>
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@collabora.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
next prev parent reply other threads:[~2023-04-14 10:19 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-12 15:33 [PATCH v2 0/7] Add support for MT6331 and MT6332 LEDs AngeloGioacchino Del Regno
2023-04-12 15:33 ` [PATCH v2 1/7] dt-bindings: leds: leds-mt6323: Document mt6331 compatible AngeloGioacchino Del Regno
2023-04-13 8:35 ` Alexandre Mergnat
2023-04-12 15:33 ` [PATCH v2 2/7] dt-bindings: leds: leds-mt6323: Document mt6332 compatible AngeloGioacchino Del Regno
2023-04-13 8:35 ` Alexandre Mergnat
2023-04-13 10:47 ` Pavel Machek
2023-04-12 15:33 ` [PATCH v2 3/7] leds: leds-mt6323: Specify registers and specs in platform data AngeloGioacchino Del Regno
2023-04-13 10:11 ` Alexandre Mergnat
2023-04-13 10:57 ` Pavel Machek
2023-04-12 15:33 ` [PATCH v2 4/7] leds: leds-mt6323: Open code and drop MT6323_CAL_HW_DUTY macro AngeloGioacchino Del Regno
2023-04-13 13:06 ` Alexandre Mergnat
2023-04-12 15:33 ` [PATCH v2 5/7] leds: leds-mt6323: Drop MT6323_ prefix from macros and defines AngeloGioacchino Del Regno
2023-04-13 10:59 ` Pavel Machek
2023-04-13 13:41 ` Alexandre Mergnat
2023-04-12 15:33 ` [PATCH v2 6/7] leds: leds-mt6323: Add support for MT6331 leds AngeloGioacchino Del Regno
2023-04-13 11:01 ` Pavel Machek
2023-04-13 13:19 ` Alexandre Mergnat
2023-04-12 15:33 ` [PATCH v2 7/7] leds: leds-mt6323: Add support for WLEDs and MT6332 AngeloGioacchino Del Regno
2023-04-13 11:06 ` Pavel Machek
2023-04-13 11:29 ` AngeloGioacchino Del Regno
2023-04-13 11:32 ` AngeloGioacchino Del Regno
2023-04-14 7:07 ` Lee Jones
2023-04-14 7:09 ` AngeloGioacchino Del Regno
2023-04-13 14:15 ` Alexandre Mergnat
2023-04-14 10:19 ` AngeloGioacchino Del Regno [this message]
2023-04-13 10:49 ` [PATCH v2 0/7] Add support for MT6331 and MT6332 LEDs Pavel Machek
2023-04-13 11:31 ` AngeloGioacchino Del Regno
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d1f54cd7-99c0-3d1c-460b-9f15f33b95c1@collabora.com \
--to=angelogioacchino.delregno@collabora.com \
--cc=amergnat@baylibre.com \
--cc=devicetree@vger.kernel.org \
--cc=kernel@collabora.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lee@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=pavel@ucw.cz \
--cc=robh+dt@kernel.org \
--cc=sean.wang@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).