From patchwork Tue Dec 12 22:01:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 121660 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4680927qgn; Tue, 12 Dec 2017 14:02:11 -0800 (PST) X-Google-Smtp-Source: ACJfBoubhZ54q9dUFXOIVIjRzBBhVsYkXm9vuDbBA47v8FodUtaxY5Gexfmx0dwRsZhLPRlFm2cq X-Received: by 10.99.157.3 with SMTP id i3mr3255829pgd.165.1513116131544; Tue, 12 Dec 2017 14:02:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513116131; cv=none; d=google.com; s=arc-20160816; b=efltkv8hgnAd1b7fgaD6xHUaPSVc4uJlRu06URCNCcrKgUTbSzbsepG1HKaEdezISJ 1OtLBsIkxoBTOqgbpo1L2iJhYAUbVeae5fvLSYUY2rhNHyBy/iqVMhhWjgRwI5TSXKZQ y4ENwwhba1+4jqkOTmm8oY+92U76sN7vlwchNe2i54QzaUSzMBlRCQvlx0evfbEv3hd/ HrKCvxEVLQxxdhPYNAT/EmsvxaDHsy5XxH77G3f7g2hvTIbH+t7NBD+c7aspuiSky2E7 Vl7kdScJS6tlbp0eUc9Q0sUa+izIZHM3R3NaY1pytmxSPySUt0tbilQaXaznp+wfkz/J whCg== 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=QYSxnAVipgykUvpgdEepP8Ko14emLlYwRbf0Ryk3J40=; b=UhowoUzPOIolqyOxwr2MP+cQA2aYwukvAiIQswcLznMdVd+k+rU1ZHlx4ufB2oFUaF OBHOiLFT2Q1i22uHy/HW9P1R8gETL1kDiTINODHQdFEOpf5PRksbLatfVMBWIjMHBDXo GFjFAkk8TIdyLO9UpMz7HK46MRi/Gyuk8SB9mb4w4HwASKc8RiKVcfqtmyhGP/gOIbjG oJb67ImZQhH3k4T1cxeGk/Be8dvuNjDylYGzPqlWn7+ULXmiatkiVBioIqRdLtGGUHkJ PAHS4It6GpjM29+Bv+3qq0SFx6deUPUKZLzqEpI7t7H1lv51+B568ywCv30pyTcvJYJ2 d6yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=PIr2eLCg; spf=pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-leds-owner@vger.kernel.org; dmarc=pass (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 l1si134480pld.20.2017.12.12.14.02.11 for ; Tue, 12 Dec 2017 14:02:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=PIr2eLCg; spf=pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-leds-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752824AbdLLWCL (ORCPT ); Tue, 12 Dec 2017 17:02:11 -0500 Received: from lelnx194.ext.ti.com ([198.47.27.80]:38457 "EHLO lelnx194.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752679AbdLLWCD (ORCPT ); Tue, 12 Dec 2017 17:02:03 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id vBCM1lMr023408; Tue, 12 Dec 2017 16:01:47 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1513116107; bh=dZ7v4JZVTe68gHTMPb9Lk0PQUHQI+zMLnZJ9mga9kzs=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=PIr2eLCgkKOd1zM/5JmQNdrWCHMC2JzqCF4yEJntRGY8CK66Y6t5R7CZ9SPZTc/Wx lRKG5FRxkFhHlRWbul98Z++HQCMquUrB5Ys2A671cSThrHbovII1Jj1YA12fykuQFB Az/Vc+4OAENfvv/j+QiPEIQ2WqGuJUfhiasCI9dk= Received: from DLEE113.ent.ti.com (dlee113.ent.ti.com [157.170.170.24]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id vBCM1lHS022616; Tue, 12 Dec 2017 16:01:47 -0600 Received: from DLEE107.ent.ti.com (157.170.170.37) by DLEE113.ent.ti.com (157.170.170.24) 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 16:01:47 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) 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 16:01:47 -0600 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id vBCM1lgx009566; Tue, 12 Dec 2017 16:01:47 -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 vBCM1kx11333; Tue, 12 Dec 2017 16:01:46 -0600 (CST) From: Dan Murphy To: , , , , CC: , , , Dan Murphy Subject: [PATCH v4 1/6] dt: bindings: lp8860: Update bindings for lp8860 Date: Tue, 12 Dec 2017 16:01:38 -0600 Message-ID: <20171212220143.31210-2-dmurphy@ti.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20171212220143.31210-1-dmurphy@ti.com> References: <20171212220143.31210-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-leds-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org Update the lp8860 bindings to fix various issues found. Add address-cells and size-cells, rename enable-gpio to enable-gpios, update the node name to the device name and indent the node example. Signed-off-by: Dan Murphy --- v4 - No changes v3 - Indicatd enable-gpios is active high, moved address and size cells to child node patch and updated parent DT node name - https://patchwork.kernel.org/patch/10093745/ v2 - New patch Documentation/devicetree/bindings/leds/leds-lp8860.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 2.15.0.124.g7668cbc60 Reviewed-by: Rob Herring diff --git a/Documentation/devicetree/bindings/leds/leds-lp8860.txt b/Documentation/devicetree/bindings/leds/leds-lp8860.txt index aad38dd94d4b..b9d09acbaa73 100644 --- a/Documentation/devicetree/bindings/leds/leds-lp8860.txt +++ b/Documentation/devicetree/bindings/leds/leds-lp8860.txt @@ -6,22 +6,22 @@ current sinks that can be controlled by a PWM input signal, a SPI/I2C master, or both. Required properties: - - compatible: + - compatible : "ti,lp8860" - - reg - I2C slave address - - label - Used for naming LEDs + - reg : I2C slave address + - label : Used for naming LEDs Optional properties: - - enable-gpio - gpio pin to enable/disable the device. - - supply - "vled" - LED supply + - enable-gpios : gpio pin to enable (active high)/disable the device. + - vled-supply : LED supply Example: -leds: leds@6 { +led-controller@2d { compatible = "ti,lp8860"; reg = <0x2d>; label = "display_cluster"; - enable-gpio = <&gpio1 28 GPIO_ACTIVE_HIGH>; + enable-gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>; vled-supply = <&vbatt>; } From patchwork Tue Dec 12 22:01:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 121657 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4680796qgn; Tue, 12 Dec 2017 14:02:06 -0800 (PST) X-Google-Smtp-Source: ACJfBosfGIREKgFiptonIpzN9lUTQ/DGymJX3PTFpKOLnlJWBxTAsI1TURxkp/zku23GQyDyUwKv X-Received: by 10.84.168.198 with SMTP id f64mr3719500plb.324.1513116126345; Tue, 12 Dec 2017 14:02:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513116126; cv=none; d=google.com; s=arc-20160816; b=ZcqMTz0sC2CZP0qJgVKAVjgZ8teXXDRZNBwuyOvEquVr9JbJ6wS+5ArEvn9CIKr66F 7gX7IN/JYfOMh2A1N4ehpJh+lfPEbw+2/ahZqBcNHSPT4pjpYrrPmegbv5iBycWCB6TF xYHMIOs0mB8OtsmRLeru+OmxrlcNzJHIcplJEPHopwcgr/9mwmpouBEJOBbcBzkiul0E kdW2VAo3iAlViK6kKGCaXIFglFBortNEDqmyQmo4C9eucSDq9AkHk8VZzudnd2cIxFzX OvSNJJIaW5r9lH8y/w2GNfqbNgF1GLRB0p89AT+BGNZjPhoCjpDYCOep770R6W1v9rFv pfYw== 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=G4AJ9ifi6Fdzofzo31VFmTSfA6JetyCrxQ6wRahQ/xc=; b=A7gnwhYkApv0FrMw8gh1IbIC5NxrsAqQMxy9C9SsdMYFLzIJu6RtLIKIP9xrdMUR4j D6D1IHgIEGhjMTVXL1Dlxho9i3v1BEiRiEyK8WKcd5SzUJ7u+lfJyglp9WA7OA3cIZoB U/xGSPLzRISjVSs6P9E05xzqWiozC2T8x7E8YJ7ZoIzl2hYISNZZXoO1DX1WsoX8/oG4 ULpiVCDhWi/7iEYIqPcQW32h6J3nAN1V6FS/60CLwl08FINdUshjFfvq9L4SxPpz0V2t 7A3mqfr/bcZr8ywmsVd3sv8TI2rFApYixAjeRhVYFgxQ2CPrZmZICKvbtW0d6MxnMa4D efwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=EEZNXQaR; spf=pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-leds-owner@vger.kernel.org; dmarc=pass (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 l1si134480pld.20.2017.12.12.14.02.06 for ; Tue, 12 Dec 2017 14:02:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=EEZNXQaR; spf=pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-leds-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752711AbdLLWCF (ORCPT ); Tue, 12 Dec 2017 17:02:05 -0500 Received: from fllnx210.ext.ti.com ([198.47.19.17]:24954 "EHLO fllnx210.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752658AbdLLWCD (ORCPT ); Tue, 12 Dec 2017 17:02:03 -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 vBCM1mPm015505; Tue, 12 Dec 2017 16:01:48 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1513116108; bh=vXHDx7XkhZ4O4Ewglc7Qfyk1b57OaG81tUBr7oxN2HU=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=EEZNXQaRoyoe/N4ha9hTpgpMfkUkPsWMk7AEEBaRh1HcMr+dG4likKZrIERSOrIg2 m2oROM0ghUE3R3tQXaE139BTzXlGMx3wKCnuywRWW4D/m5oWZvNiSoeWP75syJDwC5 gtmLSpkWTtnOUJuXtub6j/ld8b7zqbDXKUE1S5FY= Received: from DFLE110.ent.ti.com (dfle110.ent.ti.com [10.64.6.31]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id vBCM1mBP022642; Tue, 12 Dec 2017 16:01:48 -0600 Received: from DFLE105.ent.ti.com (10.64.6.26) by DFLE110.ent.ti.com (10.64.6.31) 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 16:01:48 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE105.ent.ti.com (10.64.6.26) 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 16:01:48 -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 vBCM1mUo014054; Tue, 12 Dec 2017 16:01:48 -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 vBCM1lx11344; Tue, 12 Dec 2017 16:01:48 -0600 (CST) From: Dan Murphy To: , , , , CC: , , , Dan Murphy Subject: [PATCH v4 3/6] leds: lp8860: Update the dt parsing for LED labeling Date: Tue, 12 Dec 2017 16:01:40 -0600 Message-ID: <20171212220143.31210-4-dmurphy@ti.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20171212220143.31210-1-dmurphy@ti.com> References: <20171212220143.31210-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-leds-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-leds@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 --- v4 - Fix checkpatch warning for code indentation - https://patchwork.kernel.org/patch/10108157/ 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 diff --git a/drivers/leds/leds-lp8860.c b/drivers/leds/leds-lp8860.c index 3e70775a2d54..46578fbc36be 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, From patchwork Tue Dec 12 22:01:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 121661 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4681013qgn; Tue, 12 Dec 2017 14:02:14 -0800 (PST) X-Google-Smtp-Source: ACJfBosrmvcx0SyJhRgalsgbB3dUUs4OTZLccxS4g/Kfb/iKxWDW4//H7p+XQGWdF9LAtfgH8bWv X-Received: by 10.99.113.86 with SMTP id b22mr3355668pgn.309.1513116134875; Tue, 12 Dec 2017 14:02:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513116134; cv=none; d=google.com; s=arc-20160816; b=k7rTfltHUB2swqLr5smvpBUKxnWZMBpQ4cTfDDhFWGlJXdpLyQPDAwGZMknUNGSIyK 5B4w2Ukpq98TQQPOgu3F8CIpopuClKnuT2xtj2zBcfwGFD5DrKe8xoOn7XHhbAtGziiC xYysn5dzUHr88Bz7DM+jatzv8VLm07mSaDTcBUTRqssTgMRi1B/PJn60sF/kr9h29uvi eOuBqPf09k/Lb5JH4b3CSqt6y++7paEsJeQ2fqqebzbvygVgTSEReB2oYLSW6MzTPRGS nK4eTrJ4IYR5JYka7ux1LXxELLR1Km1fggwCzomW6CpYfEnKsYAXQiscQCI+wyGAH16n +B0A== 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=BGeq/EA3UEhljw0M9bygMWOLOtUlM/8knerx30J0YlY=; b=oobzgTl2quYjTmI2P83ESUwW0D5RSVBBAfW4GCjxnTEG9TReZmWPdgdbL0FnBBoT/D GvtrqtB3mtDfRF8+1mJaEAsXHsZtg1n9B44eUU9+/neWMVofjbObFW4viEgxCq5g4gBj Fe7eL0kcL9L9tCW7VjMfmCY1Zdlztlt5RSOlffb9DTf/6Il1TdbZdR6+7WRBrYXkKVYY PK3kNIADXHAXZHuWQGE9IKziUM916p1ifYU/gOmKxY8AiNH4AkEohzcaZ/DOP/mdq/Dg lZ6RkqKVTL0BnD/JJMeOBY17qjheqtrfkwchyjPrD+RIfxfoJeVTOVIfMwFk93z775+l p5VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ujkhebUA; spf=pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-leds-owner@vger.kernel.org; dmarc=pass (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 l1si134480pld.20.2017.12.12.14.02.14 for ; Tue, 12 Dec 2017 14:02:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ujkhebUA; spf=pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-leds-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752708AbdLLWCM (ORCPT ); Tue, 12 Dec 2017 17:02:12 -0500 Received: from fllnx210.ext.ti.com ([198.47.19.17]:24958 "EHLO fllnx210.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752685AbdLLWCF (ORCPT ); Tue, 12 Dec 2017 17:02:05 -0500 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id vBCM1oTx015513; Tue, 12 Dec 2017 16:01:50 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1513116110; bh=kUZ4mrCx3A6YwulQvCA/ef5D1byZp1au+5STVmT6TIw=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ujkhebUASsu34cqm8LtUx8M0ZG16m5fELWervUUFikEZC94Pr/n/6diksIUeN7cGR Bt22YX6gGal2xVdByxh+dRFB0B7QF9iCG0hufwKzVfcSd436XoDAwrshSpULVOjRHe yfZb2EHMjSTucO+762bFBdrjGCftZEPifkaYF/QM= Received: from DLEE114.ent.ti.com (dlee114.ent.ti.com [157.170.170.25]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id vBCM1oTL008732; Tue, 12 Dec 2017 16:01:50 -0600 Received: from DLEE112.ent.ti.com (157.170.170.23) by DLEE114.ent.ti.com (157.170.170.25) 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 16:01:50 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE112.ent.ti.com (157.170.170.23) 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 16:01:50 -0600 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id vBCM1o8l026347; Tue, 12 Dec 2017 16:01:50 -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 vBCM1ox11369; Tue, 12 Dec 2017 16:01:50 -0600 (CST) From: Dan Murphy To: , , , , CC: , , , Dan Murphy Subject: [PATCH v4 6/6] leds: lp8860: Various fixes to align with LED framework Date: Tue, 12 Dec 2017 16:01:43 -0600 Message-ID: <20171212220143.31210-7-dmurphy@ti.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20171212220143.31210-1-dmurphy@ti.com> References: <20171212220143.31210-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-leds-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org Update the driver to conform with the LED framework. Use devm_led_classdev_register Destroy mutex on exit Remove dependency on CONFIG_OF in the driver and move to the Kconfig Update the MODULE_LICENSE to GPL v2 Remove setting of MAX brightness as the LED framework does this. Signed-off-by: Dan Murphy --- v4 - No changes v3 - no changes - https://patchwork.kernel.org/patch/10093747/ v2 - no changes drivers/leds/Kconfig | 2 +- drivers/leds/leds-lp8860.c | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) -- 2.15.0.124.g7668cbc60 diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index 318a28fd58fe..ac4d9d8bf96b 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -347,7 +347,7 @@ config LEDS_LP8788 config LEDS_LP8860 tristate "LED support for the TI LP8860 4 channel LED driver" - depends on LEDS_CLASS && I2C + depends on LEDS_CLASS && I2C && OF select REGMAP_I2C help If you say yes here you get support for the TI LP8860 4 channel diff --git a/drivers/leds/leds-lp8860.c b/drivers/leds/leds-lp8860.c index bb1d7bbc928c..c7716f774431 100644 --- a/drivers/leds/leds-lp8860.c +++ b/drivers/leds/leds-lp8860.c @@ -399,7 +399,6 @@ static int lp8860_probe(struct i2c_client *client, led->client = client; led->led_dev.name = led->label; - led->led_dev.max_brightness = LED_FULL; led->led_dev.brightness_set_blocking = lp8860_brightness_set; mutex_init(&led->lock); @@ -426,7 +425,7 @@ static int lp8860_probe(struct i2c_client *client, if (ret) return ret; - ret = led_classdev_register(&client->dev, &led->led_dev); + ret = devm_led_classdev_register(&client->dev, &led->led_dev); if (ret) { dev_err(&client->dev, "led register err: %d\n", ret); return ret; @@ -440,8 +439,6 @@ static int lp8860_remove(struct i2c_client *client) struct lp8860_led *led = i2c_get_clientdata(client); int ret; - led_classdev_unregister(&led->led_dev); - if (led->enable_gpio) gpiod_direction_output(led->enable_gpio, 0); @@ -452,6 +449,8 @@ static int lp8860_remove(struct i2c_client *client) "Failed to disable regulator\n"); } + mutex_destroy(&led->lock); + return 0; } @@ -461,18 +460,16 @@ static const struct i2c_device_id lp8860_id[] = { }; MODULE_DEVICE_TABLE(i2c, lp8860_id); -#ifdef CONFIG_OF static const struct of_device_id of_lp8860_leds_match[] = { { .compatible = "ti,lp8860", }, {}, }; MODULE_DEVICE_TABLE(of, of_lp8860_leds_match); -#endif static struct i2c_driver lp8860_driver = { .driver = { .name = "lp8860", - .of_match_table = of_match_ptr(of_lp8860_leds_match), + .of_match_table = of_lp8860_leds_match, }, .probe = lp8860_probe, .remove = lp8860_remove, @@ -482,4 +479,4 @@ module_i2c_driver(lp8860_driver); MODULE_DESCRIPTION("Texas Instruments LP8860 LED driver"); MODULE_AUTHOR("Dan Murphy "); -MODULE_LICENSE("GPL"); +MODULE_LICENSE("GPL v2");