From 92a2f46484bc20c7c0070f6f6222811f67e6f2f7 Mon Sep 17 00:00:00 2001
From: hauntingEcho <1661988+hauntingEcho@users.noreply.github.com>
Date: Sun, 6 Mar 2022 22:44:31 -0600
Subject: [PATCH] add 'Off' setting for power LED

resolves #11
---
 board/hx20/host_command_customization.h | 3 ++-
 board/hx20/led.c                        | 9 +++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/board/hx20/host_command_customization.h b/board/hx20/host_command_customization.h
index 002f3a88f2..5e6374f972 100644
--- a/board/hx20/host_command_customization.h
+++ b/board/hx20/host_command_customization.h
@@ -185,6 +185,7 @@ enum fp_led_brightness_level {
 	FP_LED_BRIGHTNESS_HIGH = 0,
 	FP_LED_BRIGHTNESS_MEDIUM = 1,
 	FP_LED_BRIGHTNESS_LOW = 2,
+	FP_LED_BRIGHTNESS_OFF = 3,
 };
 
 struct ec_response_fp_led_level {
@@ -197,4 +198,4 @@ struct ec_response_chassis_open_check {
 	uint8_t status;
 } __ec_align1;
 
-#endif /* __HOST_COMMAND_CUSTOMIZATION_H */
\ No newline at end of file
+#endif /* __HOST_COMMAND_CUSTOMIZATION_H */
diff --git a/board/hx20/led.c b/board/hx20/led.c
index a989027786..4373cc7175 100644
--- a/board/hx20/led.c
+++ b/board/hx20/led.c
@@ -36,8 +36,10 @@
 #define FP_LED_HIGH 55
 #define FP_LED_MEDIUM 40
 #define FP_LED_LOW 15
+#define FP_LED_OFF 0
 
 #define FP_BREATH_LOW 20
+#define FP_BREATH_OFF 0
 
 const enum ec_led_id supported_led_ids[] = {
 	EC_LED_ID_LEFT_LED,
@@ -343,6 +345,9 @@ static void led_configure(void)
 			breath_led_level = FP_BREATH_LOW;
 			breath_led_length = BREATH_ON_LENGTH_LOW;
 			break;
+		case FP_LED_BRIGHTNESS_OFF:
+			breath_led_level = FP_BREATH_OFF;
+			break;
 		default:
 			break;
 		}
@@ -392,6 +397,10 @@ static enum ec_status fp_led_level_control(struct host_cmd_handler_args *args)
 		breath_led_level = FP_BREATH_LOW;
 		breath_led_length = BREATH_ON_LENGTH_LOW;
 		break;
+	case FP_LED_BRIGHTNESS_OFF:
+		led_level = FP_LED_OFF;
+		breath_led_level = FP_BREATH_OFF;
+		break;
 	default:
 		return EC_RES_INVALID_PARAM;
 		break;