summaryrefslogtreecommitdiff
path: root/zephyr/shim/src/led_driver/led.h
diff options
context:
space:
mode:
Diffstat (limited to 'zephyr/shim/src/led_driver/led.h')
-rw-r--r--zephyr/shim/src/led_driver/led.h40
1 files changed, 19 insertions, 21 deletions
diff --git a/zephyr/shim/src/led_driver/led.h b/zephyr/shim/src/led_driver/led.h
index 8c4e7654d5..b8cedf5af7 100644
--- a/zephyr/shim/src/led_driver/led.h
+++ b/zephyr/shim/src/led_driver/led.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,34 +11,32 @@
#include <zephyr/drivers/pwm.h>
#define COMPAT_GPIO_LED cros_ec_gpio_led_pins
-#define COMPAT_PWM_LED cros_ec_pwm_led_pins
+#define COMPAT_PWM_LED cros_ec_pwm_led_pins
-#define PINS_NODE(id) DT_CAT(PIN_NODE_, id)
-#define PINS_ARRAY(id) DT_CAT(PINS_ARRAY_, id)
+#define PINS_NODE(id) DT_CAT(PIN_NODE_, id)
+#define PINS_ARRAY(id) DT_CAT(PINS_ARRAY_, id)
/*
* Return string-token if the property exists, otherwise return 0
*/
-#define GET_PROP(id, prop) \
- COND_CODE_1(DT_NODE_HAS_PROP(id, prop), \
- (DT_STRING_UPPER_TOKEN(id, prop)), \
- (0))
+#define GET_PROP(id, prop) \
+ COND_CODE_1(DT_NODE_HAS_PROP(id, prop), \
+ (DT_STRING_UPPER_TOKEN(id, prop)), (0))
/*
* Return string-token if the property exists, otherwise return -1
*/
-#define GET_PROP_NVE(id, prop) \
- COND_CODE_1(DT_NODE_HAS_PROP(id, prop), \
- (DT_STRING_UPPER_TOKEN(id, prop)), \
- (-1))
+#define GET_PROP_NVE(id, prop) \
+ COND_CODE_1(DT_NODE_HAS_PROP(id, prop), \
+ (DT_STRING_UPPER_TOKEN(id, prop)), (-1))
-#define LED_ENUM(id, enum_name) DT_STRING_TOKEN(id, enum_name)
-#define LED_ENUM_WITH_COMMA(id, enum_name) \
- COND_CODE_1(DT_NODE_HAS_PROP(id, enum_name), \
- (LED_ENUM(id, enum_name),), ())
+#define LED_ENUM(id, enum_name) DT_STRING_TOKEN(id, enum_name)
+#define LED_ENUM_WITH_COMMA(id, enum_name) \
+ COND_CODE_1(DT_NODE_HAS_PROP(id, enum_name), \
+ (LED_ENUM(id, enum_name), ), ())
#define GPIO_LED_PINS_NODE DT_PATH(gpio_led_pins)
-#define PWM_LED_PINS_NODE DT_PATH(pwm_led_pins)
+#define PWM_LED_PINS_NODE DT_PATH(pwm_led_pins)
enum led_color {
LED_OFF,
@@ -48,7 +46,7 @@ enum led_color {
LED_YELLOW,
LED_WHITE,
LED_AMBER,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
/*
@@ -63,9 +61,7 @@ struct gpio_pin_t {
* Struct defining LED PWM pin and duty cycle to set.
*/
struct pwm_pin_t {
- const struct device *pwm;
- uint8_t channel;
- pwm_flags_t flags;
+ struct pwm_dt_spec pwm;
uint32_t pulse_ns; /* PWM Duty cycle ns */
};
@@ -122,6 +118,8 @@ void led_set_color_with_node(const struct led_pins_node_t *pins_node);
#ifdef TEST_BUILD
const struct led_pins_node_t *led_get_node(enum led_color color,
enum ec_led_id led_id);
+
+enum power_state get_chipset_state(void);
#endif /* TEST_BUILD */
#endif /* __CROS_EC_LED_H__ */