[Skiboot] [PATCH 02/12] FSP/LED: Define macro instead of hardcoding led type
Vasant Hegde
hegdevasant at linux.vnet.ibm.com
Mon Apr 6 17:03:49 AEST 2015
Define macors for LED related device tree property and
its values.
Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
Changes in v2:
- Moved all macros to fsp-leds.h file.
---
hw/fsp/fsp-leds.c | 13 ++++++++-----
include/fsp-leds.h | 20 ++++++++++++++++++++
2 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/hw/fsp/fsp-leds.c b/hw/fsp/fsp-leds.c
index 6ac0122..d25376d 100644
--- a/hw/fsp/fsp-leds.c
+++ b/hw/fsp/fsp-leds.c
@@ -1307,13 +1307,13 @@ void create_led_device_nodes(void)
}
/* LED parent node */
- pled = dt_new(opal_node, "led");
+ pled = dt_new(opal_node, DT_PROPERTY_LED_NODE);
if (!pled) {
prlog(PR_WARNING, PREFIX
"Parent device node creation failed\n");
return;
}
- dt_add_property_strings(pled, "compatible", "ibm,opal-v3-led");
+ dt_add_property_strings(pled, "compatible", DT_PROPERTY_LED_COMPATIBLE);
/* LED child nodes */
list_for_each_safe(&cec_ledq, led, next, link) {
@@ -1331,11 +1331,14 @@ void create_led_device_nodes(void)
continue;
}
- dt_add_property_strings(cled, "led-types", "identify", "fault");
+ dt_add_property_strings(cled, DT_PROPERTY_LED_TYPES,
+ LED_TYPE_IDENTIFY, LED_TYPE_FAULT);
if (is_enclosure_led(led->loc_code))
- dt_add_property_strings(cled, "led-loc", "enclosure");
+ dt_add_property_strings(cled, DT_PROPERTY_LED_LOCATION,
+ LED_LOC_ENCLOSURE);
else
- dt_add_property_strings(cled, "led-loc", "descendent");
+ dt_add_property_strings(cled, DT_PROPERTY_LED_LOCATION,
+ LED_LOC_DESCENDENT);
}
}
diff --git a/include/fsp-leds.h b/include/fsp-leds.h
index a411636..2b8ed98 100644
--- a/include/fsp-leds.h
+++ b/include/fsp-leds.h
@@ -150,4 +150,24 @@ struct led_set_cmd {
#define LED_CONTROL_LEN 2
#define FSP_LC_STRUCT_FIXED_SZ 0x0a
+/* LED Device tree property names */
+#define DT_PROPERTY_LED_COMPATIBLE "ibm,opal-v3-led"
+#define DT_PROPERTY_LED_NODE "led"
+#define DT_PROPERTY_LED_MODE "led-mode"
+#define DT_PROPERTY_LED_TYPES "led-types"
+#define DT_PROPERTY_LED_LOCATION "led-loc"
+
+/* LED Mode */
+#define LED_MODE_LIGHT_PATH "lightpath"
+#define LED_MODE_GUIDING_LIGHT "guidinglight"
+
+/* LED type */
+#define LED_TYPE_IDENTIFY "identify"
+#define LED_TYPE_FAULT "fault"
+#define LED_TYPE_ATTENTION "attention"
+
+/* LED location */
+#define LED_LOC_ENCLOSURE "enclosure"
+#define LED_LOC_DESCENDENT "descendent"
+
#endif
More information about the Skiboot
mailing list