From patchwork Mon Apr 6 08:30:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 458342 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 671461401DC for ; Mon, 6 Apr 2015 18:30:49 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 479731A0736 for ; Mon, 6 Apr 2015 18:30:49 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from e28smtp02.in.ibm.com (e28smtp02.in.ibm.com [122.248.162.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id D71051A072A for ; Mon, 6 Apr 2015 18:30:42 +1000 (AEST) Received: from /spool/local by e28smtp02.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 6 Apr 2015 14:00:41 +0530 Received: from d28dlp01.in.ibm.com (9.184.220.126) by e28smtp02.in.ibm.com (192.168.1.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 6 Apr 2015 14:00:39 +0530 Received: from d28relay01.in.ibm.com (d28relay01.in.ibm.com [9.184.220.58]) by d28dlp01.in.ibm.com (Postfix) with ESMTP id B087DE005A for ; Mon, 6 Apr 2015 14:03:03 +0530 (IST) Received: from d28av04.in.ibm.com (d28av04.in.ibm.com [9.184.220.66]) by d28relay01.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t368UKAg27721786 for ; Mon, 6 Apr 2015 14:00:21 +0530 Received: from d28av04.in.ibm.com (localhost [127.0.0.1]) by d28av04.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t368UK2g005064 for ; Mon, 6 Apr 2015 14:00:20 +0530 Received: from localhost.localdomain ([9.124.35.90]) by d28av04.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t368UKu5005041 for ; Mon, 6 Apr 2015 14:00:20 +0530 From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Mon, 06 Apr 2015 14:00:20 +0530 Message-ID: <20150406082942.24643.53134.stgit@localhost.localdomain> In-Reply-To: <20150406082641.24643.57570.stgit@localhost.localdomain> References: <20150406082641.24643.57570.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15040608-0005-0000-0000-0000049C2662 Subject: [Skiboot] [PATCH v2 02/12] FSP/LED: Define macro instead of hardcoding led type X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Define macors for LED related device tree property and its values. Signed-off-by: Vasant Hegde --- 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