From patchwork Tue Dec 12 18:58:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 121625 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4501599qgn; Tue, 12 Dec 2017 10:59:07 -0800 (PST) X-Google-Smtp-Source: ACJfBouXa4922z6WGwlw/P+NcR8i8tZsBeD8JDaPfA4n8F9wrIfnQ3A1pNB2zkZtaTTZbt7Sj2fQ X-Received: by 10.84.128.34 with SMTP id 31mr3256915pla.303.1513105147135; Tue, 12 Dec 2017 10:59:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513105147; cv=none; d=google.com; s=arc-20160816; b=QtcNHEbThhgvYFAtnCTh0NGWH6jJGDHwwNQuojrirBczIzUyEGKnqqO3svBKMh623k 0z8T9UgA60DS2RLcnHO8dkmGVGL9E+zIww72jtaOYgHgUvqBc9f4IkGt17oABttRAub8 O2ePzEyh1UTttXkovhZD1PBGjTw1XoNJUsiW3850IQDbmjAg3IxStZ8kIWR/42m8fLAJ 8Wg6fmgnzPoFHA8tdVEG1oFg5m29PrLfDlBSwGOPQJs0+Wrdggtvl+8dG4O/nI+To7Lk AhhsqTzgCe7Xr7nt3NTys5DgGxjPpI0m8Kf8PF0dOwDyDn+R+hnly9tKEHd6xigVLY9n CmSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=zpwkgla1B/cPE5LtxPF49ju+D3QTBqv71f1e5AR+Xl8=; b=IsjCQCwXTr/RNXVtjs7z5GEes0XqcINrdM4OsyAn6S3Td+TToMbGWRHXH9FhoiknNO qxYUn0YUaFXuR2YPBjVOgj7bMWUsbCk/tVkc32uSszghrZsGSpcQanvG/aQ837jlBhEQ wTfqZ0Kcz6hBf2shyr2NsB1JLIvfbB5H7CJK08QusYUXCg8wy9Lvcvx8/lT1HGc3//Vt qtxpbGJ8ZwFb4dHw46sRy42ovisHiwJjDIQf7bngyOQdAv3jENV52EesyvSYKLETURQg 2amYAqXEZ5MIyn9RtdXejZxE9WSK5+lXOqRDVpQytK4mROD5Plro41MEOiQMLbWCet6p AeMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=f5vIfzhO; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 30si12014786plb.782.2017.12.12.10.59.06; Tue, 12 Dec 2017 10:59:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=f5vIfzhO; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752506AbdLLS7F (ORCPT + 6 others); Tue, 12 Dec 2017 13:59:05 -0500 Received: from fllnx210.ext.ti.com ([198.47.19.17]:18706 "EHLO fllnx210.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752407AbdLLS6c (ORCPT ); Tue, 12 Dec 2017 13:58:32 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id vBCIwFC6019646; Tue, 12 Dec 2017 12:58:15 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1513105095; bh=08ejDM/G5l91VxHoJBp2bdIHtPff4qiBFWcl3nwaf28=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=f5vIfzhOacsIrEK3VxI+551B2cXV0TWXjf1ZNuwMPJwyz5wxcjWi9N29curAlnfsr bA0HjT7H2yP7RnCcO84LccYtu0iCCj7ch/3Ju7hPAS/plv8Sgcp/9ZH7sZtO0/RkXP gRwLiShPUcllfnzpMrqtEze/XgnGmNRsFQC+ifqQ= Received: from DFLE115.ent.ti.com (dfle115.ent.ti.com [10.64.6.36]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id vBCIwFTZ019040; Tue, 12 Dec 2017 12:58:15 -0600 Received: from DFLE101.ent.ti.com (10.64.6.22) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Tue, 12 Dec 2017 12:58:14 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE101.ent.ti.com (10.64.6.22) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Tue, 12 Dec 2017 12:58:14 -0600 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id vBCIwE7u002983; Tue, 12 Dec 2017 12:58:14 -0600 Received: from localhost (a0272616local-lt.dhcp.ti.com [172.22.69.253]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id vBCIwEx25372; Tue, 12 Dec 2017 12:58:14 -0600 (CST) From: Dan Murphy To: , , , , CC: , , , Dan Murphy Subject: [PATCH v3 2/6] dt: bindings: lp8860: Update DT label binding Date: Tue, 12 Dec 2017 12:58:05 -0600 Message-ID: <20171212185809.23880-4-dmurphy@ti.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20171212185809.23880-1-dmurphy@ti.com> References: <20171212185809.23880-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Update the lp8860 label binding to the LED standard as documented in Documentation/devicetree/bindings/leds/common.txt Signed-off-by: Dan Murphy --- v3 - Added address and size cells, updated label with color and inserted spaces around the reg node - https://patchwork.kernel.org/patch/10093749/ v2 - Added reg to child node and made it required Documentation/devicetree/bindings/leds/leds-lp8860.txt | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) -- 2.15.0.124.g7668cbc60 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/Documentation/devicetree/bindings/leds/leds-lp8860.txt b/Documentation/devicetree/bindings/leds/leds-lp8860.txt index b9d09acbaa73..c3d64ade1e26 100644 --- a/Documentation/devicetree/bindings/leds/leds-lp8860.txt +++ b/Documentation/devicetree/bindings/leds/leds-lp8860.txt @@ -9,20 +9,33 @@ Required properties: - compatible : "ti,lp8860" - reg : I2C slave address - - label : Used for naming LEDs + - #address-cells : 1 + - #size-cells : 0 Optional properties: - enable-gpios : gpio pin to enable (active high)/disable the device. - vled-supply : LED supply +Required child properties: + - reg : 0 + +Optional child properties: + - label : see Documentation/devicetree/bindings/leds/common.txt + Example: led-controller@2d { compatible = "ti,lp8860"; + #address-cells = <1>; + #size-cells = <0>; reg = <0x2d>; - label = "display_cluster"; enable-gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>; vled-supply = <&vbatt>; + + led@0 { + reg = <0>; + label = "white:display_cluster"; + }; } For more product information please see the link below: From patchwork Tue Dec 12 18:58:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 121628 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4502127qgn; Tue, 12 Dec 2017 10:59:43 -0800 (PST) X-Google-Smtp-Source: ACJfBovCYff5Nd7MrvM9Y9/j5v/x6NW1Gb30s8rmE5L/viDPiLcuot/i6hnUeBkDQezaXQj96oWT X-Received: by 10.159.242.132 with SMTP id u4mr3228199plr.296.1513105183230; Tue, 12 Dec 2017 10:59:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513105183; cv=none; d=google.com; s=arc-20160816; b=ycjjyOpCfy7A/V4M7lqfTMkn9mKaE7aQo0Kl+WRX4zoVL10enBwsQU6mJ09SGdES61 EMXoYQxnKjofsguHfnSW75B3k9FosY1+ZAOYawaLzkkcnVf1xamAsla7XcbeD3i4RnSt OQ+T+1DI1kF+6DxV4+lYt7Gt6Cb9UL3xBmtlWKxDyRLa0VGhpQKV63DasoIKMLZTOezq h2yrYq70h15mOgnyBvs3d9lw1LyX0fBW3HDeK/3MaIBDIPqxNtfyopgerTiBr77MFKDB 4keZmWs0Au0gc/qcU50wUNBp+o9j/z1jXAIpObPP1OAcNursTbpTZ80GIMRVTthDRqls HQTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=90Af/uM0RKDOuDgLCuov82mdhAoesvnI+rc9qjBlG4w=; b=IlJzEf/xPmmPGjXFS8j4Tugj7GVhjId8P72C+WR39DYky/PALCsl/DSrwMunr48GfQ paGgdXH6/UTcugyBtptO5Gkw4nY9P9fr6xD4JN2bfRt6BRbp+NK8x/OUzt9JrC2WmLy7 IBjwANaFeGxteLwoKt4mHiZHVd8dLUtClIfNxvbpdogQTqey+z50BzSikRSixUzBD+yn Vth79gfkzqcz2VF61Xx1EwQNS5cFQOESoyA13WB4p1ccghaVaE0dsF+D1fQd2zL7VPQn AVjn0ScjwRUYNprmG9K4pTVHKobKxkOAAaAF2XnscrO8NFB9lBpZEdz18lO2DiNS9PbQ UALQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=Btny1NX6; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p124si11902579pga.20.2017.12.12.10.59.43; Tue, 12 Dec 2017 10:59:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=Btny1NX6; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752380AbdLLS7k (ORCPT + 6 others); Tue, 12 Dec 2017 13:59:40 -0500 Received: from fllnx209.ext.ti.com ([198.47.19.16]:50239 "EHLO fllnx209.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751871AbdLLS7f (ORCPT ); Tue, 12 Dec 2017 13:59:35 -0500 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id vBCIwKEY018531; Tue, 12 Dec 2017 12:58:20 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1513105100; bh=k4nlTNMUqP0nxGfT27BOcZT4nGXAYTujN/94nyjs+SA=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Btny1NX6CmPVYw4sHNljV40Xbys3NMHzIgEyFbZoCenmUbXzFmLICFr6kODNojCUX ZpoAyOA7wORNVj6uPtaE0YD9FzkjDzKdwlEgH9FHz4R2YY8TFpEyjhVHsjIMzAzABd mTKNAAZ9fdMvzpV9/NXnpMP+WWQmnD6XzYLkVr88= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id vBCIwFZI002138; Tue, 12 Dec 2017 12:58:15 -0600 Received: from DLEE107.ent.ti.com (157.170.170.37) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Tue, 12 Dec 2017 12:58:15 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Tue, 12 Dec 2017 12:58:15 -0600 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id vBCIwFPk002988; Tue, 12 Dec 2017 12:58:15 -0600 Received: from localhost (a0272616local-lt.dhcp.ti.com [172.22.69.253]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id vBCIwEx25376; Tue, 12 Dec 2017 12:58:14 -0600 (CST) From: Dan Murphy To: , , , , CC: , , , Dan Murphy Subject: [PATCH v3 3/6] leds: lp8860: Update the dt parsing for LED labeling Date: Tue, 12 Dec 2017 12:58:06 -0600 Message-ID: <20171212185809.23880-5-dmurphy@ti.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20171212185809.23880-1-dmurphy@ti.com> References: <20171212185809.23880-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Update the DT parsing for the label node so that the label is retrieved from the device child as opposed to being part of the parent. This will align this driver with the LED binding documentation Documentation/devicetree/bindings/leds/common.txt Signed-off-by: Dan Murphy --- v3 - Changed the label generation to pull the name from the i2c device id as opposed to pulling the id from the parent dt node since that will just be led-controller - https://patchwork.kernel.org/patch/10093753/ v2 - no changes drivers/leds/leds-lp8860.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) -- 2.15.0.124.g7668cbc60 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/leds/leds-lp8860.c b/drivers/leds/leds-lp8860.c index 3e70775a2d54..bc432764c99d 100644 --- a/drivers/leds/leds-lp8860.c +++ b/drivers/leds/leds-lp8860.c @@ -22,6 +22,7 @@ #include #include #include +#include #define LP8860_DISP_CL1_BRT_MSB 0x00 #define LP8860_DISP_CL1_BRT_LSB 0x01 @@ -86,8 +87,6 @@ #define LP8860_CLEAR_FAULTS 0x01 -#define LP8860_DISP_LED_NAME "display_cluster" - /** * struct lp8860_led - * @lock - Lock for reading/writing the device @@ -107,7 +106,7 @@ struct lp8860_led { struct regmap *eeprom_regmap; struct gpio_desc *enable_gpio; struct regulator *regulator; - const char *label; + char label[LED_MAX_NAME_SIZE]; }; struct lp8860_eeprom_reg { @@ -365,19 +364,21 @@ static int lp8860_probe(struct i2c_client *client, int ret; struct lp8860_led *led; struct device_node *np = client->dev.of_node; + struct device_node *child_node; + const char *name; led = devm_kzalloc(&client->dev, sizeof(*led), GFP_KERNEL); if (!led) return -ENOMEM; - led->label = LP8860_DISP_LED_NAME; - - if (client->dev.of_node) { - ret = of_property_read_string(np, "label", &led->label); - if (ret) { - dev_err(&client->dev, "Missing label in dt\n"); - return -EINVAL; - } + for_each_available_child_of_node(np, child_node) { + ret = of_property_read_string(child_node, "label", &name); + if (!ret) + snprintf(led->label, sizeof(led->label), "%s:%s", + id->name, name); + else + snprintf(led->label, sizeof(led->label), + "%s::display_cluster", id->name); } led->enable_gpio = devm_gpiod_get_optional(&client->dev,