From: Hans de Goede <hdegoede@redhat.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: Lee Jones <lee@kernel.org>, Yauhen Kharuzhy <jekhor@gmail.com>,
linux-leds@vger.kernel.org
Subject: Re: [PATCH 1/5] leds: Add Intel Cherry Trail Whiskey Cove PMIC LED driver
Date: Wed, 19 Apr 2023 15:04:13 +0200 [thread overview]
Message-ID: <1a189e3a-523d-8a5d-c686-07bf3b924c75@redhat.com> (raw)
In-Reply-To: <ZDlKyq0tLAbFGS8P@duo.ucw.cz>
Hi Pavel,
Thank you for reviewing this.
On 4/14/23 14:44, Pavel Machek wrote:
> On Thu 2023-04-13 17:18:04, Hans de Goede wrote:
>> From: Yauhen Kharuzhy <jekhor@gmail.com>
>>
>> Add support for LEDs connected to the Intel Cherry Trail Whiskey Cove
>> PMIC. Charger and general-purpose leds are supported. Hardware blinking
>> is implemented, breathing is not.
>
> leds->LEDs.
>
>> diff --git a/drivers/leds/leds-cht-wcove.c b/drivers/leds/leds-cht-wcove.c
>> new file mode 100644
>> index 000000000000..06447804d050
>> --- /dev/null
>> +++ b/drivers/leds/leds-cht-wcove.c
>> @@ -0,0 +1,368 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +/*
>> + * Driver for LEDs connected to the Intel Cherry Trail Whiskey Cove PMIC
>> + *
>> + * Copyright 2019 Yauhen Kharuzhy <jekhor@gmail.com>
>> + * Copyright 2023 Hans de Goede <hansg@kernel.org>
>> + *
>> + * Based on Lenovo Yoga Book Android kernel sources
>> + */
>
> "sources." Should copyrights from Android be copied here?
>
>> +static const char * const cht_wc_leds_names[CHT_WC_LED_COUNT] = {
>> + "cht-wc::" LED_FUNCTION_CHARGING,
>> + "cht-wc::" LED_FUNCTION_INDICATOR,
>> +};
>
> No need for "cht-wc".
I should put something there right, iow not just
"::" LED_FUNCTION_CHARGING" if it should not be
cht-wc should I put "platform::" there then, or
maybe "pmic::" ?
> Mention color.
This PMIC is used in multiple designs at
least both white and red LEDs are used in
2 designs I know about. AFAIK the norm is
to leave out the color if it is different
per design?
> At least charging LED is
> going to be common - document in Documentation/leds/well-known-leds.txt.
That already has:
* Power management
Good: "platform:*:charging" (allwinner sun50i)
So you want me to extend the (allwinner sun50i) bit with ", cht-wc" ?
Ack to all the other comments, will fix for v2.
Regards,
Hans
>
>> +static int cht_wc_leds_brightness_set(struct led_classdev *cdev,
>> + enum led_brightness value)
>> +{
>> + struct cht_wc_led *led = container_of(cdev, struct cht_wc_led, cdev);
>> + int ret;
>> +
>> + mutex_lock(&led->mutex);
>> +
>> + if (!value) {
>> + ret = regmap_update_bits(led->regmap, led->regs->ctrl,
>> + led->regs->on_off_mask, led->regs->off_val);
>> + if (ret)
>> + dev_err(cdev->dev, "Failed to turn off: %d\n", ret);
>> +
>> + /* Disable HW blinking */
>> + ret = regmap_update_bits(led->regmap, led->regs->fsm,
>> + CHT_WC_LED_EFF_MASK, CHT_WC_LED_EFF_ON);
>> + if (ret < 0)
>> + dev_err(cdev->dev, "Failed to update LED FSM reg: %d\n", ret);
>
> This overwrites previous error. Not sure if it is big deal.
>
>> +static int cht_wc_leds_blink_set(struct led_classdev *cdev,
>> + unsigned long *delay_on,
>> + unsigned long *delay_off)
>> +{
>> + struct cht_wc_led *led = container_of(cdev, struct cht_wc_led, cdev);
>> + unsigned int ctrl;
>> + int ret;
>> +
>> + mutex_lock(&led->mutex);
>> +
>> + if (!*delay_on && !*delay_off)
>> + *delay_on = *delay_off = 1000;
>
> That's really slow blink; I'd do something faster by default.
>
>> + /*
>> + * LED1 might be in hw-controlled mode when this driver gets loaded; and
>> + * since the PMIC is always powered by the battery any changes made are
>> + * permanent. Save LED1 regs to restore them on remove() or shutdown().
>> + */
>
> Fun :-).
>
> Thank you.
>
> Best regards,
> Pavel
next prev parent reply other threads:[~2023-04-19 13:05 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-13 15:18 [PATCH 0/5] leds: Add Intel Cherry Trail Whiskey Cove PMIC LED driver Hans de Goede
2023-04-13 15:18 ` [PATCH 1/5] " Hans de Goede
2023-04-14 12:44 ` Pavel Machek
2023-04-19 13:04 ` Hans de Goede [this message]
2023-04-20 12:17 ` Hans de Goede
2023-04-13 15:18 ` [PATCH 2/5] leds: cht-wcove: Add suspend/resume handling Hans de Goede
2023-04-14 12:46 ` Pavel Machek
2023-04-13 15:18 ` [PATCH 3/5] leds: cht-wcove: Add support for breathing mode use hw_pattern sysfs API Hans de Goede
2023-04-16 15:17 ` Jacek Anaszewski
2023-04-16 20:31 ` Hans de Goede
2023-04-17 20:00 ` Jacek Anaszewski
2023-04-19 13:05 ` Hans de Goede
2023-04-13 15:18 ` [PATCH 4/5] leds: cht-wcove: Set default trigger for charging LED Hans de Goede
2023-04-13 15:18 ` [PATCH 5/5] leds: cht-wcove: Use breathing when LED_INIT_DEFAULT_TRIGGER is set Hans de Goede
2023-04-15 20:32 ` [PATCH 0/5] leds: Add Intel Cherry Trail Whiskey Cove PMIC LED driver Yauhen Kharuzhy
2023-04-16 13:04 ` Hans de Goede
2023-04-25 13:37 ` Hans de Goede
2023-04-26 11:12 ` Yauhen Kharuzhy
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=1a189e3a-523d-8a5d-c686-07bf3b924c75@redhat.com \
--to=hdegoede@redhat.com \
--cc=jekhor@gmail.com \
--cc=lee@kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=pavel@ucw.cz \
/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).