Received: by 10.223.185.116 with SMTP id b49csp2797074wrg; Sun, 25 Feb 2018 06:33:51 -0800 (PST) X-Google-Smtp-Source: AH8x2260u+n9DUDW045nPcZMiVyLgItFxnwTY1WcUc9QlC4BxGpmXCIeM97eJK0XtacCjpa0Kr7d X-Received: by 10.99.95.142 with SMTP id t136mr6014874pgb.94.1519569230941; Sun, 25 Feb 2018 06:33:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519569230; cv=none; d=google.com; s=arc-20160816; b=YODbpaRh89YnLsUovYtWU+p1x4P099IYI2LDJroZzSMgTGDFjX5dRf4fzp6YBbZ9Br BUJ0eLqAElzaUorcbEyh8zoFkXSQ2NgPytXGykKIMK4Eo1hCeIe2WDhd3RlwsLiM+u7J O81X16Ht5zbMmwYf+slkp2/hyKSk5AulPnLn/ckpkMdYjHQ+kaEIGP0J97Sbk9Twkorm VxdDVd0lxv5ahukBcwyUXX/PAPuauP0Fr7sBlCuLrVMLvA9KaeBISFxTzAPLsEZuRzT5 u4cgWileaAguWFoZCsOTN308onA0EPB0ZQ4VLXwDHavbAjOirNbHGJlMvusljC/5q5A8 2EtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:dkim-signature:arc-authentication-results; bh=ELlFcSafBqvkjQz+PlW7hdSOK59FZdTWLW4byEtYszc=; b=JwXs3k+YYRohTZUvwHMTverRRnMlEbLo0fx7g/hvmU8zhNDOpw+VVg5CfBggocMJu/ zqlCM471HhJ35V1p1RzW1fVi9PuZMDFTkRgRHp6kM3K/w60I7BSQO0ojlS5njV1q+Puw Y6GGMuzq2LpNW1BRiwdVPpsIwZXYboGgboQlVwsILLbkD9dfn/CeMkUdCzm+V/45VAO9 qlKT9wU3vsUSw9iZ82cXIWfDbPbIHVC7cF2DHXqGOBBEl8ds7j0G3JQVodnTIWxOpyoE nEIAIR8jpqNG9i1HTuS//Ffq6uDOqhnfxc1XCV9ar2tqAxrXTzEizRJLXVslNiAuAq1f 0+1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nCxAqRIc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f9-v6si4676727pln.542.2018.02.25.06.33.34; Sun, 25 Feb 2018 06:33:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=@gmail.com header.s=20161025 header.b=nCxAqRIc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751768AbeBYOcP (ORCPT + 99 others); Sun, 25 Feb 2018 09:32:15 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:37149 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751638AbeBYOcK (ORCPT ); Sun, 25 Feb 2018 09:32:10 -0500 Received: by mail-wm0-f68.google.com with SMTP id m207so12551568wma.2; Sun, 25 Feb 2018 06:32:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=ELlFcSafBqvkjQz+PlW7hdSOK59FZdTWLW4byEtYszc=; b=nCxAqRIczV52obEiUs5enTIvwYFhPmwzW5WaGKMQP7SqO6cybVqfxukHd7f4cyXBdU bqk51WcqHRUaYS49+eBQEXY/lLkD1ULBBH1C4sNVwwOQUrypQOaot7Ikex0qsGl3SjBr rOFQHN36F9KWz4NQAAX0fUCdHLIjInMc1crVdHZAfFLpZJ/Qm5FtbgxtWQxIV5f6dUZF I4/fPwvKRJA3R0HuDtqYs4PYGBJAeBcUqnwr7liPQtvlqE0jJ/ZPeuwsN1/MrbGufTk2 LeeRVSNDFYVOIL9Ae93APr5PEk/JrHAKqAZ3rBHrUE3+l/AqNuu4aRdbzAFqUlg9OHjG dfHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=ELlFcSafBqvkjQz+PlW7hdSOK59FZdTWLW4byEtYszc=; b=FoDRtC6hGNYeCg9Wme7CEr6lOas4ZCwuVpqI5n0KJcKOFbgFfPej3lPM7jQwOoNHx5 EDXLR/cJfGKXjD8U7nJmk60ZoMhi4EpeWlzfoOvqfgHYdb/JqQW1CC9jzhLO39oNWRP3 Cmv5QlWLH19VoBP5OffTxFodBlnVF6GuPFRXcmuSb/uqqcBReVI82EbULJBQABw0T5M4 kTM9QdSQu6ftomhIObHqxumpbDDVG1DoRZ+QVbpg2cMIpBBqOsVIgd0pg71uK9ICX/Rd PljjDBUFgghl+mlpAw6YWoppaWGBucrSvF6ELoR6bwE0fV6PQed7r1rRanuKypkQz/h6 Sz/A== X-Gm-Message-State: APf1xPC8w5EXwwtplOdIMfZYwm5pu3IQv6dAddTyqIIkAwHY+SkTpPoA PBSZhA7foMedJ3Mc430OvO0XJNu8 X-Received: by 10.28.12.14 with SMTP id 14mr6870237wmm.160.1519569129194; Sun, 25 Feb 2018 06:32:09 -0800 (PST) Received: from [192.168.1.18] (cjz8.neoplus.adsl.tpnet.pl. [83.31.75.8]) by smtp.gmail.com with ESMTPSA id p104sm11483486wrb.47.2018.02.25.06.32.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Feb 2018 06:32:08 -0800 (PST) Subject: Re: [PATCH v4 1/2] leds: ncp5623: Add device tree binding documentation To: Florian Vaussard , Pavel Machek References: <20180221214654.3306-1-florian.vaussard@gmail.com> <20180221214654.3306-2-florian.vaussard@gmail.com> Cc: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org From: Jacek Anaszewski X-Enigmail-Draft-Status: N1110 Message-ID: <9ed5c785-c40b-6e6e-a727-ba8b58517fa1@gmail.com> Date: Sun, 25 Feb 2018 15:30:55 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20180221214654.3306-2-florian.vaussard@gmail.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Florian, Thanks for the v4. On 02/21/2018 10:46 PM, Florian Vaussard wrote: > Add device tree binding documentation for On Semiconductor NCP5623 I2C > LED driver. The driver can independently control the PWM of the 3 > channels with 32 levels of intensity. > > The current delivered by the current source can also be controlled. To > do so, the led-max-microamp property is used by each LED sub-node. The > maximum value is then found and used as a limit to compute the final > intensity of the current source. If a LED happens to have a lower limit, > the PWM is then used to limit the current to the requested value. > > In order to control the current source, it is also necessary to know > the current on the Iref pin, hence the onnn,led-iref-microamp property. > It is usually set using an external bias resistor, following > Iref = Vref/Rbias with Vref=0.6V. > > Signed-off-by: Florian Vaussard > Acked-by: Rob Herring > --- > .../devicetree/bindings/leds/leds-ncp5623.txt | 60 ++++++++++++++++++++++ > 1 file changed, 60 insertions(+) > create mode 100644 Documentation/devicetree/bindings/leds/leds-ncp5623.txt > > diff --git a/Documentation/devicetree/bindings/leds/leds-ncp5623.txt b/Documentation/devicetree/bindings/leds/leds-ncp5623.txt > new file mode 100644 > index 000000000000..d83e5094343e > --- /dev/null > +++ b/Documentation/devicetree/bindings/leds/leds-ncp5623.txt > @@ -0,0 +1,60 @@ > +* ON Semiconductor - NCP5623 3-Channel LED Driver > + > +The NCP5623 is a 3-channel I2C LED driver. The brightness of each > +channel can be independently set using 32 levels. Each LED is represented > +as a sub-node of the device. > + > +Required properties: > + - compatible: Should be "onnn,ncp5623" > + - reg: I2C slave address (fixed to 0x38) > + - #address-cells: must be 1 > + - #size-cells: must be 0 > + - onnn,led-iref-microamp: Current on the Iref pin in microampere. It depends > + on the value of the external bias resistor Rbias, following > + Iref = Vref / Rbias with Vref = 0.6V. This is used to set the intensity of > + the current that can be provided by the internal current source, based on > + the maximum current permitted by LED sub-nodes (see below), but no more than > + Imax = 2400 * Iref. > + > +LED sub-nodes > +============= > + > +Required properties: > + - reg : LED channel number (0..2) > + - led-max-microamp: Maximum allowable current inside the LED in microampere. > + This property is used to limit the PWM ratio, based on the intensity of the > + internal current source (see above). > + > +Optional properties: > + - label: see Documentation/devicetree/bindings/leds/common.txt > + - linux,default-trigger: see Documentation/devicetree/bindings/leds/common.txt > + > +Example > +======= > + > +led1: ncp5623@38 { > + #address-cells = <1>; > + #size-cells = <0>; > + compatible = "onnn,ncp5623"; > + reg = <0x38>; > + onnn,led-iref-microamp = <10>; > + > + led1r@0 { > + label = "ncp:power:red"; > + linux,default-trigger = "default-on"; > + reg = <0>; > + led-max-microamp = <20000>; > + }; > + > + led1b@1 { > + label = "ncp:power:blue"; > + reg = <1>; > + led-max-microamp = <20000>; > + }; > + > + led1g@2 { > + label = "ncp:power:green"; > + reg = <2>; > + led-max-microamp = <20000>; > + }; > +}; > Some time ago we was instructed how our DT bindings should look like. See [0]. In view of that, the above should be changed as below. Please note dropped "ncp:" segment from label. Also LED class device name pattern is "devicename:colour:function", so you will have to reverse the order of segments in your labels. Last but not least - couldn't the LED functions be better distinguishable - now we have "power" for all three LEDs? led-controller@38 { #address-cells = <1>; #size-cells = <0>; compatible = "onnn,ncp5623"; reg = <0x38>; onnn,led-iref-microamp = <10>; led@0 { label = "red:power"; linux,default-trigger = "default-on"; reg = <0>; led-max-microamp = <20000>; }; led@1 { label = "blue:power"; reg = <1>; led-max-microamp = <20000>; }; led@2 { label = "green:power"; reg = <2>; led-max-microamp = <20000>; }; You can refer to drivers/leds/leds-lp8860.c on how to construct the label. Generally from the discussions with DT maintainer it turned out that we shouldn't have controller name in the LED class device name at all, but it will have to be addressed globally for all LED class drivers at once at some point. [0] https://patchwork.kernel.org/patch/10093757/ -- Best regards, Jacek Anaszewski