diff options
author | Andrew McRae <amcrae@google.com> | 2022-04-04 04:01:05 +0000 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-04-06 01:16:33 +0000 |
commit | 233741c09241c54feb2e1d601d5a39cccd5145e9 (patch) | |
tree | c3068f2252965ec7d5182e4217292037e90da8fb /zephyr/drivers | |
parent | 0555a50cbeea53458962a790c22dc5a048553a29 (diff) | |
download | chrome-ec-233741c09241c54feb2e1d601d5a39cccd5145e9.tar.gz |
Revert "leds: Add tests for LED GPIO handling."
This reverts commit 1ea4f38e820a1034a9870c4f3062dcaefd0ff5ef.
Reason for revert: Part of LED implementation revert
BUG=none
TEST=zmake testall
BRANCH=none
Original change's description:
> leds: Add tests for LED GPIO handling.
>
> Add tests for LED GPIO processing.
>
> BUG=none
> TEST=zmake test test-drivers
> BRANCH=none
>
> Signed-off-by: Andrew McRae <amcrae@google.com>
> Change-Id: Ibecc3a3cf61b1bb5cb3b35b53485b4d36605d0d3
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3559691
> Reviewed-by: Peter Marheine <pmarheine@chromium.org>
Bug: none
Change-Id: If21e459365f0958cfea7f8b9ec1e558d45780196
Signed-off-by: Andrew McRae <amcrae@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3563455
Reviewed-by: Peter Marheine <pmarheine@chromium.org>
Reviewed-by: Wai-Hong Tam <waihong@google.com>
Diffstat (limited to 'zephyr/drivers')
-rw-r--r-- | zephyr/drivers/cros_led/led_policy.c | 68 |
1 files changed, 31 insertions, 37 deletions
diff --git a/zephyr/drivers/cros_led/led_policy.c b/zephyr/drivers/cros_led/led_policy.c index 5c4176178e..ebac6a623b 100644 --- a/zephyr/drivers/cros_led/led_policy.c +++ b/zephyr/drivers/cros_led/led_policy.c @@ -260,22 +260,22 @@ static void get_led_brightness_max(const struct led_policy *lp, uint8_t *br) /* * Set the brightness range. Turn on the selected color. */ -static int set_led_brightness(const struct led_policy *lp, const uint8_t *br) +static void set_led_brightness(const struct led_policy *lp, const uint8_t *br) { switch (lp->driver) { default: __ASSERT(false, "Unknown driver type %d", lp->driver); - return -1; + break; #if DT_HAS_COMPAT_STATUS_OKAY(COMPAT_GPIO) case LED_DRIVER_GPIO: gpio_set_led_brightness(lp->index, br); - return 0; + break; #endif #if DT_HAS_COMPAT_STATUS_OKAY(COMPAT_PWM) case LED_DRIVER_PWM: pwm_set_led_brightness(lp->index, br); - return 0; + break; #endif } } @@ -409,6 +409,32 @@ static void update_leds(void) } } +/* + * Callback for detecting changes to the AP state. + * Update the cpu state and update the LEDs. + */ +static void cpu_update(struct ap_power_ev_callback *cb, + struct ap_power_ev_data data) +{ + switch (data.event) { + default: + break; + + case AP_POWER_RESUME: + cpu_state = LED_AP_RUNNING; + break; + + case AP_POWER_SUSPEND: + cpu_state = LED_AP_SUSPENDED; + break; + + case AP_POWER_SHUTDOWN: + cpu_state = LED_AP_POWER_OFF; + break; + } + update_leds(); +} + #if defined(CONFIG_CHARGER) || defined(CONFIG_BATTERY) /* * Poll the battery and charger every second and update @@ -447,37 +473,6 @@ DECLARE_HOOK(HOOK_SECOND, led_poll_inputs, HOOK_PRIO_DEFAULT); #endif /* CONFIG_CHARGER || CONFIG_BATTERY */ /* - * Callback for detecting changes to the AP state. - * Update the cpu state and update the LEDs. - */ -static void cpu_update(struct ap_power_ev_callback *cb, - struct ap_power_ev_data data) -{ - switch (data.event) { - default: - break; - - case AP_POWER_RESUME: - cpu_state = LED_AP_RUNNING; - break; - - case AP_POWER_SUSPEND: - cpu_state = LED_AP_SUSPENDED; - break; - - case AP_POWER_SHUTDOWN: - cpu_state = LED_AP_POWER_OFF; - break; - } - /* - * Poll charger and battery so that they are - * up to date. led_poll_inputs() then calls - * update_leds(). - */ - led_poll_inputs(); -} - -/* * Initialise the LED policy processing. */ static int init_led(const struct device *unused) @@ -556,7 +551,6 @@ int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness) if (lp != NULL) { set_led_brightness(lp, brightness); - return 0; } - return -1; + return 0; } |