diff mbox series

[v2,5/7] HID: lenovo: Set LEDs max_brightness value

Message ID 20210220122438.21857-6-hdegoede@redhat.com (mailing list archive)
State Superseded
Delegated to: Jiri Kosina
Headers show
Series HID: lenovo: Mute LED handling fixes and improvements | expand

Commit Message

Hans de Goede Feb. 20, 2021, 12:24 p.m. UTC
The LEDs can only by turned on/off, so max_brightness should be set to 1
(aka LED_ON). Without this the max_brightness sysfs-attribute will report
255 which is wrong.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Changes in v2:
- New patch in v2 of this patch-set
---
 drivers/hid/hid-lenovo.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Marek BehĂșn Feb. 20, 2021, 3:16 p.m. UTC | #1
On Sat, 20 Feb 2021 13:24:36 +0100
Hans de Goede <hdegoede@redhat.com> wrote:

> +	data->led_mute.max_brightness = LED_ON;

These constants are obsolete since we now support variable maximum
brightness. Just put 1 there.

Marek
Hans de Goede Feb. 20, 2021, 4:34 p.m. UTC | #2
Hi,

On 2/20/21 4:16 PM, Marek Behun wrote:
> On Sat, 20 Feb 2021 13:24:36 +0100
> Hans de Goede <hdegoede@redhat.com> wrote:
> 
>> +	data->led_mute.max_brightness = LED_ON;
> 
> These constants are obsolete since we now support variable maximum
> brightness. Just put 1 there.

Ok, any other remarks wrt the LED bits before I send out a v3 ?

Regards,

Hans
Marek BehĂșn Feb. 20, 2021, 4:47 p.m. UTC | #3
On Sat, 20 Feb 2021 17:34:12 +0100
Hans de Goede <hdegoede@redhat.com> wrote:

> Hi,
> 
> On 2/20/21 4:16 PM, Marek Behun wrote:
> > On Sat, 20 Feb 2021 13:24:36 +0100
> > Hans de Goede <hdegoede@redhat.com> wrote:
> >   
> >> +	data->led_mute.max_brightness = LED_ON;  
> > 
> > These constants are obsolete since we now support variable maximum
> > brightness. Just put 1 there.  
> 
> Ok, any other remarks wrt the LED bits before I send out a v3 ?

I will review the remaining patches tonight.
diff mbox series

Patch

diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c
index bb8e5ebdaabe..d936edb88f07 100644
--- a/drivers/hid/hid-lenovo.c
+++ b/drivers/hid/hid-lenovo.c
@@ -816,6 +816,7 @@  static int lenovo_register_leds(struct hid_device *hdev)
 
 	data->led_mute.name = name_mute;
 	data->led_mute.brightness_set_blocking = lenovo_led_brightness_set;
+	data->led_mute.max_brightness = LED_ON;
 	data->led_mute.flags = LED_HW_PLUGGABLE;
 	data->led_mute.dev = &hdev->dev;
 	ret = led_classdev_register(&hdev->dev, &data->led_mute);
@@ -824,6 +825,7 @@  static int lenovo_register_leds(struct hid_device *hdev)
 
 	data->led_micmute.name = name_micm;
 	data->led_micmute.brightness_set_blocking = lenovo_led_brightness_set;
+	data->led_micmute.max_brightness = LED_ON;
 	data->led_micmute.flags = LED_HW_PLUGGABLE;
 	data->led_micmute.dev = &hdev->dev;
 	ret = led_classdev_register(&hdev->dev, &data->led_micmute);