Skip to contentSkip to conversation

fujitsu-laptop: Rework brightness of eco led

PATCH Applied Matej Groma 3 participants 3 messages Jul 4, 2016 – Jul 6, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fujitsu-laptop: Rework brightness of eco led

For the sake of internal consistency, unset maximum brightness of eco led and make it activatable only on values >= LED_FULL.

---
Here is a small statistics covering max brightness of platform-x86 leds:
1 other unset
8 6 7
3/7 leds that have unset max_brightness are activated on nonzero value. The other 4 are fujitsu-laptop leds. Maybe someone from led subsystem would be willing to look at this and standardise guidelines on how and when to use different brightness levels. Hopefully, this could then be reverted.

 drivers/platform/x86/fujitsu-laptop.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/platform/x86/fujitsu-laptop.c +2 -3
index 6ce8e78..61f39ab 100644
@@ -212,7 +212,6 @@ static void eco_led_set(struct led_classdev *cdev,
 
 static struct led_classdev eco_led = {
  .name = "fujitsu::eco_led",
- .max_brightness = 1,
  .brightness_get = eco_led_get,
  .brightness_set = eco_led_set
 };
@@ -306,7 +305,7 @@ static void eco_led_set(struct led_classdev *cdev,
 	int curr;
 
 	curr = call_fext_func(FUNC_LEDS, 0x2, ECO_LED, 0x0);
-	if (brightness)
+	if (brightness >= LED_FULL)
 		call_fext_func(FUNC_LEDS, 0x1, ECO_LED, curr | ECO_LED_ON);
 	else
 		call_fext_func(FUNC_LEDS, 0x1, ECO_LED, curr & ~ECO_LED_ON);
@@ -352,7 +351,7 @@ static enum led_brightness eco_led_get(struct led_classdev *cdev)
 	enum led_brightness brightness = LED_OFF;
 
 	if (call_fext_func(FUNC_LEDS, 0x2, ECO_LED, 0x0) & ECO_LED_ON)
-		brightness = cdev->max_brightness;
+		brightness = LED_FULL;
 
 	return brightness;
 }
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Matej Groma

For the sake of internal consistency, unset maximum brightness of eco led and make it activatable only on values >= LED_FULL.

Quoted 43 lines

---
Here is a small statistics covering max brightness of platform-x86 leds:
1 other unset
8 6 7
3/7 leds that have unset max_brightness are activated on nonzero value. The other 4 are fujitsu-laptop leds. Maybe someone from led subsystem would be willing to look at this and standardise guidelines on how and when to use different brightness levels. Hopefully, this could then be reverted.

 drivers/platform/x86/fujitsu-laptop.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/platform/x86/fujitsu-laptop.c +2 -3
index 6ce8e78..61f39ab 100644
@@ -212,7 +212,6 @@ static void eco_led_set(struct led_classdev *cdev,
 
 static struct led_classdev eco_led = {
  .name = "fujitsu::eco_led",
- .max_brightness = 1,
  .brightness_get = eco_led_get,
  .brightness_set = eco_led_set
 };
@@ -306,7 +305,7 @@ static void eco_led_set(struct led_classdev *cdev,
 	int curr;
 
 	curr = call_fext_func(FUNC_LEDS, 0x2, ECO_LED, 0x0);
-	if (brightness)
+	if (brightness >= LED_FULL)
 		call_fext_func(FUNC_LEDS, 0x1, ECO_LED, curr | ECO_LED_ON);
 	else
 		call_fext_func(FUNC_LEDS, 0x1, ECO_LED, curr & ~ECO_LED_ON);
@@ -352,7 +351,7 @@ static enum led_brightness eco_led_get(struct led_classdev *cdev)
 	enum led_brightness brightness = LED_OFF;
 
 	if (call_fext_func(FUNC_LEDS, 0x2, ECO_LED, 0x0) & ECO_LED_ON)
-		brightness = cdev->max_brightness;
+		brightness = LED_FULL;
 
 	return brightness;
 }
Applied
#2 lore raw
Quoted 7 lines · Jonathan Woithe
Quoted 4 lines · Matej Groma

For the sake of internal consistency, unset maximum brightness of eco led and make it activatable only on values >= LED_FULL.

Queued, thank you.

Quoted 45 lines
Quoted 44 lines

---
Here is a small statistics covering max brightness of platform-x86 leds:
1 other unset
8 6 7
3/7 leds that have unset max_brightness are activated on nonzero value. The other 4 are fujitsu-laptop leds. Maybe someone from led subsystem would be willing to look at this and standardise guidelines on how and when to use different brightness levels. Hopefully, this could then be reverted.

 drivers/platform/x86/fujitsu-laptop.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/platform/x86/fujitsu-laptop.c +2 -3
index 6ce8e78..61f39ab 100644
@@ -212,7 +212,6 @@ static void eco_led_set(struct led_classdev *cdev,
 
 static struct led_classdev eco_led = {
  .name = "fujitsu::eco_led",
- .max_brightness = 1,
  .brightness_get = eco_led_get,
  .brightness_set = eco_led_set
 };
@@ -306,7 +305,7 @@ static void eco_led_set(struct led_classdev *cdev,
 	int curr;
 
 	curr = call_fext_func(FUNC_LEDS, 0x2, ECO_LED, 0x0);
-	if (brightness)
+	if (brightness >= LED_FULL)
 		call_fext_func(FUNC_LEDS, 0x1, ECO_LED, curr | ECO_LED_ON);
 	else
 		call_fext_func(FUNC_LEDS, 0x1, ECO_LED, curr & ~ECO_LED_ON);
@@ -352,7 +351,7 @@ static enum led_brightness eco_led_get(struct led_classdev *cdev)
 	enum led_brightness brightness = LED_OFF;
 
 	if (call_fext_func(FUNC_LEDS, 0x2, ECO_LED, 0x0) & ECO_LED_ON)
-		brightness = cdev->max_brightness;
+		brightness = LED_FULL;
 
 	return brightness;
 }
Signature · 2 lines
Darren Hart
Intel Open Source Technology Center