summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Hill <ecgh@chromium.org>2018-11-20 14:57:58 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-11-21 01:25:11 -0800
commit0c28fa95119487b51be5aa189060333f8da0c817 (patch)
treee379dcf30c3ed7896f40bf5e46c8b7bf5ce7aaa2
parentb48cc28be9186d022013c9b997a13c2c93e2ec14 (diff)
downloadchrome-ec-0c28fa95119487b51be5aa189060333f8da0c817.tar.gz
led_pwm: Add CONFIG_LED_PWM_CHARGE_STATE_ONLY
Add an option for devices that want to show only the charging state, but on all LEDs. BUG=b:119746227 BRANCH=grunt TEST=Liara LED is on when charging from either side. Change-Id: I819eaf27d3700748e47886855765c2da6f3d9eb8 Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1344795 Tested-by: Josh Tsai <josh_tsai@compal.corp-partner.google.com> Reviewed-by: Diana Z <dzigterman@chromium.org>
-rw-r--r--common/led_pwm.c14
-rw-r--r--include/config.h18
2 files changed, 21 insertions, 11 deletions
diff --git a/common/led_pwm.c b/common/led_pwm.c
index b9d13a3d6c..87ec59a127 100644
--- a/common/led_pwm.c
+++ b/common/led_pwm.c
@@ -160,20 +160,20 @@ static int show_charge_state(void)
pulse_leds(CONFIG_LED_PWM_CHARGE_ERROR_COLOR, 1, 2);
} else {
/* Discharging or not charging. */
-#ifdef CONFIG_LED_PWM_ACTIVE_CHARGE_PORT_ONLY
+#ifdef CONFIG_LED_PWM_CHARGE_STATE_ONLY
/*
- * If we only show the active charge port, the only reason we
+ * If we only show the charge state, the only reason we
* would pulse the LEDs is if we had an error. If it no longer
* exists, stop pulsing the LEDs.
*/
led_is_pulsing = 0;
-#endif /* CONFIG_LED_PWM_ACTIVE_CHARGE_PORT_ONLY */
+#endif /* CONFIG_LED_PWM_CHARGE_STATE_ONLY */
return 0;
}
return 1;
}
-#ifndef CONFIG_LED_PWM_ACTIVE_CHARGE_PORT_ONLY
+#ifndef CONFIG_LED_PWM_CHARGE_STATE_ONLY
static int show_battery_state(void)
{
int batt_percentage = charge_get_percent();
@@ -213,7 +213,7 @@ static int show_chipset_state(void)
}
return 1;
}
-#endif /* CONFIG_LED_PWM_ACTIVE_CHARGE_PORT_ONLY */
+#endif /* CONFIG_LED_PWM_CHARGE_STATE_ONLY */
static void update_leds(void)
{
@@ -221,13 +221,13 @@ static void update_leds(void)
if (show_charge_state())
return;
-#ifndef CONFIG_LED_PWM_ACTIVE_CHARGE_PORT_ONLY
+#ifndef CONFIG_LED_PWM_CHARGE_STATE_ONLY
if (show_battery_state())
return;
if (show_chipset_state())
return;
-#endif /* CONFIG_LED_PWM_ACTIVE_CHARGE_PORT_ONLY */
+#endif /* CONFIG_LED_PWM_CHARGE_STATE_ONLY */
set_led_color(-1);
}
diff --git a/include/config.h b/include/config.h
index 2ff47b6972..4df4b61217 100644
--- a/include/config.h
+++ b/include/config.h
@@ -2220,10 +2220,16 @@
/*
* By default the PWM LED behaviour is reflected on both LEDs and includes the
- * chipset state, battery state, as well as the charging state. However, enable
- * this CONFIG_* option to only allow the charging state to be reflected on the
- * LEDs. Additionally, only the active charge port will indicate the charge
- * state.
+ * chipset state, battery state, as well as the charging state. Enable
+ * this CONFIG_* option to show only the charging state on the LEDs.
+ */
+#undef CONFIG_LED_PWM_CHARGE_STATE_ONLY
+
+/*
+ * By default the PWM LED behaviour is reflected on both LEDs and includes the
+ * chipset state, battery state, as well as the charging state. Enable
+ * this CONFIG_* option to show only the charging state, and only on the LED of
+ * the active charge port.
*/
#undef CONFIG_LED_PWM_ACTIVE_CHARGE_PORT_ONLY
@@ -3935,6 +3941,10 @@
#define CONFIG_LED_PWM
#endif /* defined(CONFIG_LED_PWM_COUNT) */
+#ifdef CONFIG_LED_PWM_ACTIVE_CHARGE_PORT_ONLY
+#define CONFIG_LED_PWM_CHARGE_STATE_ONLY
+#endif
+
/*****************************************************************************/
/*
* Define derived configuration options for EC-EC communication