From patchwork Wed Sep 25 17:46:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 174392 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp944463ill; Wed, 25 Sep 2019 10:41:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqwf/ATBz9zFoRl9DlJsIyiUo0J6hZktKQrvXIhQn9oWLpSK/C8uaNURCxhlnSESEoa4wi0f X-Received: by 2002:a17:906:5a96:: with SMTP id l22mr382349ejq.310.1569433303952; Wed, 25 Sep 2019 10:41:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569433303; cv=none; d=google.com; s=arc-20160816; b=pEAN+4dm3HwbwgLsTtMZbd4Pw2UA3pcsnG1x7g9S8/PX+uSS7Ncz0Y96Glg+07ENaj 5g5BY2+oB6V1PsqTA/77RXD1sIAByqMeZoj/Mgfy4J6WDqrj1AMo0EzFUT+NPJuUZKjM Mh4TKT4e62Yf6TZHl+5Q8Vs64UQRH4onIaNDRuYwcwW4yEbv+rWuCjj+2kUSvR3TIYKW UKy18R7YSm1LKNI5+FP+wixTYgc2SkLn7dEH3kUZQrGxvgSlcq3PNENUaa8rIVFLoPbT qDKufByiTI550mOfvAD0AV1WZ0h4hYtQf5VB5FM+TeUWs0ivRjukc4XP6S2NwuU2ej/Y VY2A== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LB2/mEfQyYVK6iE8q9uOLAkmUrKRQZdWqraPFhfOHBg=; b=0Qx0okm5w2KHeytdKpvKF6bbfc05X+5CbFqn3osybxgWTZLNHpAl9Zxj+Aft1zmW+s q7U084W0CwZobOSM9tfGw0twvyV6mAQBl9wNT+9p4WE6bN81h3FYca30LjpdRpQ9HAB1 6VuBa0DWzEJbLim3gGszETaybbFsOuACE0QZXb2MnR5Jlc/PTCl4XRDlZ/v2/icFAxQ6 j2t91i9gGH4ziNwRDTNhU8CCH8wObNmHkEN4Uqe1jR2sOO3jduHwo7EwFxTAHWGIpPBE aPmedfpEJu5IIGp0HShrzq78X9RA6NklLu4XPYgP26NRqt4sDidlD21mCc5iyiliOrx3 UPCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=P1eOPFC+; 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=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 ci22si126548ejb.162.2019.09.25.10.41.43; Wed, 25 Sep 2019 10:41:43 -0700 (PDT) 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=@ti.com header.s=ti-com-17Q1 header.b=P1eOPFC+; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2443153AbfIYRlk (ORCPT + 26 others); Wed, 25 Sep 2019 13:41:40 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:50782 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2443113AbfIYRlb (ORCPT ); Wed, 25 Sep 2019 13:41:31 -0400 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x8PHfFM4029456; Wed, 25 Sep 2019 12:41:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1569433275; bh=LB2/mEfQyYVK6iE8q9uOLAkmUrKRQZdWqraPFhfOHBg=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=P1eOPFC+8HuzwBAlhiJe8s4P22vlSR3kdfobl3h6K8T5Nr7GTsUYy7pUCxORW0LsX t+n8AAT+EUYs7LT0ibOBXUqsy3WkUDqk/09MnOO6S6okP3wTtxWbITimFUQqU6/BNq hRNF7AwY+oMIYFB3ZxF0Q+3yPNk1bDtuylGrJfGc= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x8PHfE5p048301 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 25 Sep 2019 12:41:15 -0500 Received: from DLEE106.ent.ti.com (157.170.170.36) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Wed, 25 Sep 2019 12:41:07 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE106.ent.ti.com (157.170.170.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Wed, 25 Sep 2019 12:41:14 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id x8PHfEqf031148; Wed, 25 Sep 2019 12:41:14 -0500 From: Dan Murphy To: , CC: , , Dan Murphy , , , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Tony Lindgren , =?utf-8?q?Beno=C3=AEt_Cousso?= =?utf-8?q?n?= Subject: [PATCH v9 01/15] leds: multicolor: Add sysfs interface definition Date: Wed, 25 Sep 2019 12:46:02 -0500 Message-ID: <20190925174616.3714-2-dmurphy@ti.com> X-Mailer: git-send-email 2.22.0.214.g8dca754b1e In-Reply-To: <20190925174616.3714-1-dmurphy@ti.com> References: <20190925174616.3714-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a documentation of LED Multicolor LED class specific sysfs attributes. Add multicolor framework class documentation describing the usage of the files created. Signed-off-by: Dan Murphy --- .../ABI/testing/sysfs-class-led-multicolor | 35 +++++++ Documentation/leds/index.rst | 1 + Documentation/leds/leds-class-multicolor.rst | 96 +++++++++++++++++++ 3 files changed, 132 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-led-multicolor create mode 100644 Documentation/leds/leds-class-multicolor.rst -- 2.22.0.214.g8dca754b1e diff --git a/Documentation/ABI/testing/sysfs-class-led-multicolor b/Documentation/ABI/testing/sysfs-class-led-multicolor new file mode 100644 index 000000000000..65cb43de26e6 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-class-led-multicolor @@ -0,0 +1,35 @@ +What: /sys/class/leds//brightness +Date: Sept 2019 +KernelVersion: 5.5 +Contact: Dan Murphy +Description: read/write + Writing to this file will update all LEDs within the group to a + calculated percentage of what each color LED intensity is set + to. The percentage is calculated via the equation below: + + led_brightness = brightness * _intensity/_max_intensity + + For additional details please refer to + Documentation/leds/leds-class-multicolor.rst. + + The value of the color is from 0 to + /sys/class/leds//max_brightness. + +What: /sys/class/leds//colors/_intensity +Date: Sept 2019 +KernelVersion: 5.5 +Contact: Dan Murphy +Description: read/write + The _intensity file is created based on the color + defined by the registrar of the class. + There is one file per color presented. + + The value of the color is from 0 to + /sys/class/leds//colors/_max_intensity. + +What: /sys/class/leds//colors/_max_intensity +Date: Sept 2019 +KernelVersion: 5.5 +Contact: Dan Murphy +Description: read only + Maximum intensity level for the LED color. diff --git a/Documentation/leds/index.rst b/Documentation/leds/index.rst index 060f4e485897..bc70c6aa7138 100644 --- a/Documentation/leds/index.rst +++ b/Documentation/leds/index.rst @@ -9,6 +9,7 @@ LEDs leds-class leds-class-flash + leds-class-multicolor ledtrig-oneshot ledtrig-transient ledtrig-usbport diff --git a/Documentation/leds/leds-class-multicolor.rst b/Documentation/leds/leds-class-multicolor.rst new file mode 100644 index 000000000000..87a1588d7619 --- /dev/null +++ b/Documentation/leds/leds-class-multicolor.rst @@ -0,0 +1,96 @@ +==================================== +Multi Color LED handling under Linux +==================================== + +Description +=========== +The multi color class groups monochrome LEDs and allows controlling two +aspects of the final combined color: hue and lightness. The former is +controlled via _intensity files and the latter is controlled +via brightness file. + +For more details on hue and lightness notions please refer to +https://en.wikipedia.org/wiki/CIECAM02. + +Note that intensity files only cache the written value and the actual +change of hardware state occurs upon writing brightness file. This +allows for changing many factors of the perceived color in a virtually +unnoticeable way for the human observer. + +Multicolor Class Control +======================== +The multicolor class presents the LED groups under a directory called "colors". +This directory is a child under the LED parent node created by the led_class +framework. The led_class framework is documented in led-class.rst within this +documentation directory. + +Each colored LED will have two files created under the colors directory +_intensity and _max_intensity. These files will contain +one of LED_COLOR_ID_* definitions from the header +include/dt-bindings/leds/common.h. + +Directory Layout Example +======================== +root:/sys/class/leds/rgb:grouped_leds# ls -lR colors/ +-rw-rwxr-- 1 root root 4096 Jul 7 03:10 red_max_intensity +--w--wx-w- 1 root root 4096 Jul 7 03:10 red_intensity +-rw-rwxr-- 1 root root 4096 Jul 7 03:10 green_max_intensity +--w--wx-w- 1 root root 4096 Jul 7 03:10 green_intensity +-rw-rwxr-- 1 root root 4096 Jul 7 03:10 blue_max_intensity +--w--wx-w- 1 root root 4096 Jul 7 03:10 blue_intensity + +Multicolor Class Brightness Control +=================================== +The multiclor class framework will calculate each monochrome LEDs intensity. + +The brightness level for each LED is calculated based on the color LED +intensity setting divided by the color LED max intensity setting multiplied by +the requested brightness. + +led_brightness = brightness * _intensity/_max_intensity + +Example: +Three LEDs are present in the group as defined in "Directory Layout Example" +within this document. + +A user first writes the color LED brightness file with the brightness level that +is necessary to achieve a blueish violet output from the RGB LED group. + +echo 138 > /sys/class/leds/rgb:grouped_leds/red_intensity +echo 43 > /sys/class/leds/rgb:grouped_leds/green_intensity +echo 226 > /sys/class/leds/rgb:grouped_leds/blue_intensity + +red - + intensity = 138 + max_intensity = 255 +green - + intensity = 43 + max_intensity = 255 +blue - + intensity = 226 + max_intensity = 255 + +The user can control the brightness of that RGB group by writing the parent +'brightness' control. Assuming a parent max_brightness of 255 the user may want +to dim the LED color group to half. The user would write a value of 128 to the +parent brightness file then the values written to each LED will be adjusted +base on this value + +cat /sys/class/leds/rgb:grouped_leds/max_brightness +255 +echo 128 > /sys/class/leds/rgb:grouped_leds/brightness + +adjusted_red_value = 128 * 138/255 = 69 +adjusted_green_value = 128 * 43/255 = 21 +adjusted_blue_value = 128 * 226/255 = 113 + +Reading the parent brightness file will return the current brightness value of +the color LED group. + +cat /sys/class/leds/rgb:grouped_leds/max_brightness +255 + +echo 128 > /sys/class/leds/rgb:grouped_leds/brightness + +cat /sys/class/leds/rgb:grouped_leds/brightness +128 From patchwork Wed Sep 25 17:46:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 174398 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp945126ill; Wed, 25 Sep 2019 10:42:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqx41WpjTSZpEyZogfgZ8fheJ4JKwHNMraC1o8D96Fpj+Xhtc29/3svQQRS5cul3uu/18X/B X-Received: by 2002:a17:906:b84c:: with SMTP id ga12mr445324ejb.0.1569433343230; Wed, 25 Sep 2019 10:42:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569433343; cv=none; d=google.com; s=arc-20160816; b=BPc7OUTbRFeCZj1OZyxOSrY0eKBfvHL53rjl+aGHodgXv0KM9FGuW5FYqSfHnWrmPJ 4K8SB2u01TNFkv9prQ2Yt1gZpzHbT0crT3n+ABfb94MgDPX5dbopPY2En1gIlwu4J44q wzOh8VtTL9k+DWOLmVEpdWTqfgR5eOwdd2QrG0/E/DrnDXpAuxeXixg8eoyBv1YjjNWO GF0Cfwbl8CwVmftbY9n0vmnhOd/YfD74LRUwxFAgKiJSY3mChkKEews09hrh5cz1jD1k iHQvWTOlGAJfY/vFyhlQKsYQ01X4VSOpjlLyWuUAo+DGDyb1F64sHfYkKR4AnNodA1eX Omaw== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=U/CdL3ky1UgHUUHC2UlJw+Bp+HRLVkYO6pdXvDYGyfg=; b=M4GYNdNm1hPp72kTyEgJgW6R7cqoXKeHyuHQLjxKPmWLWCauN5OdYOAEms7fgch0pN HLIJrSrZYfA5s+JJZYq1936NVTL/ma/6O+LS9uxzXKJyHpnfYYgG3h0pzPcPHL0TV6wh zC46Pew5snJa5gBABVMgRHbbBc2GCll81MeaE118VQyrhnuVV2CLF9Nfh2xH5gKm50Mx I8vPKpGTSCK6z4DgumJMCzofUEIqSemZFRqDiw7Tdn78pP6TrFmexwAVjpQDWRjaRhdo HvYIUXmEyjtq/n7+eqN857zU+mWwRpWTS4FeSgCewJu/FoHhhTzSBMcuc47XZNAYSYg3 ADZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="jFW/yT5k"; 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=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 i10si113541ejz.394.2019.09.25.10.42.22; Wed, 25 Sep 2019 10:42:23 -0700 (PDT) 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=@ti.com header.s=ti-com-17Q1 header.b="jFW/yT5k"; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2408437AbfIYRmN (ORCPT + 26 others); Wed, 25 Sep 2019 13:42:13 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:50746 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732494AbfIYRlU (ORCPT ); Wed, 25 Sep 2019 13:41:20 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x8PHfFCB029460; Wed, 25 Sep 2019 12:41:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1569433275; bh=U/CdL3ky1UgHUUHC2UlJw+Bp+HRLVkYO6pdXvDYGyfg=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=jFW/yT5kRpg1s7L0TQBskRcJRmbUhKVFY5avsu4QhQc0AmYzjuAPkXOGqH74qZ1Lp uZ1d+yeHHC7lPkuf/lo33rm3gkZ0FoWN1ubxRcfeRxvvywklAqvj0gU96i2HXcy8yC VuywUNLmLkqybK+mOq+X6kl5bpOC/jrF/X+vKhTM= Received: from DLEE114.ent.ti.com (dlee114.ent.ti.com [157.170.170.25]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id x8PHfFUv018190; Wed, 25 Sep 2019 12:41:15 -0500 Received: from DLEE105.ent.ti.com (157.170.170.35) by DLEE114.ent.ti.com (157.170.170.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Wed, 25 Sep 2019 12:41:07 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Wed, 25 Sep 2019 12:41:07 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x8PHfEJv045630; Wed, 25 Sep 2019 12:41:14 -0500 From: Dan Murphy To: , CC: , , Dan Murphy Subject: [PATCH v9 02/15] dt: bindings: Add multicolor class dt bindings documention Date: Wed, 25 Sep 2019 12:46:03 -0500 Message-ID: <20190925174616.3714-3-dmurphy@ti.com> X-Mailer: git-send-email 2.22.0.214.g8dca754b1e In-Reply-To: <20190925174616.3714-1-dmurphy@ti.com> References: <20190925174616.3714-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add DT bindings for the LEDs multicolor class framework. Signed-off-by: Dan Murphy --- .../bindings/leds/leds-class-multicolor.txt | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/leds-class-multicolor.txt -- 2.22.0.214.g8dca754b1e diff --git a/Documentation/devicetree/bindings/leds/leds-class-multicolor.txt b/Documentation/devicetree/bindings/leds/leds-class-multicolor.txt new file mode 100644 index 000000000000..8619c9bf1811 --- /dev/null +++ b/Documentation/devicetree/bindings/leds/leds-class-multicolor.txt @@ -0,0 +1,98 @@ +* Multicolor LED properties + +Bindings for multi color LEDs show how to describe current outputs of +either integrated multi-color LED elements (like RGB, RGBW, RGBWA-UV +etc.) or standalone LEDs, to achieve logically grouped multi-color LED +modules. This is achieved by adding multi-led nodes layer to the +monochrome LED bindings. + +The nodes and properties defined in this document are unique to the multicolor +LED class. Common LED nodes and properties are inherited from the common.txt +within this documentation directory. + +Required LED Child properties: + - color : For multicolor LED support this property should be defined as + LED_COLOR_ID_MULTI and further definition can be found in + include/linux/leds/common.h. + +led-controller@30 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "ti,lp5024"; + reg = <0x29>; + + multi-led@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + color = ; + function = LED_FUNCTION_STATUS; + + + led@3 { + reg = <3>; + color = ; + }; + + led@4 { + reg = <4>; + color = ; + }; + + led@5 { + reg = <5>; + color = ; + }; + }; + + multi-led@2 { + #address-cells = <1>; + #size-cells = <0>; + color = ; + function = LED_FUNCTION_ACTIVITY; + reg = <2>; + ti,led-bank = <2 3 5>; + + led@6 { + reg = <0x6>; + color = ; + led-sources = <6 9 15>; + }; + + led@7 { + reg = <0x7>; + color = ; + led-sources = <7 10 16>; + }; + + led@8 { + reg = <0x8>; + color = ; + led-sources = <8 11 17>; + }; + }; + + multi-led@4 { + #address-cells = <1>; + #size-cells = <0>; + reg = <4>; + color = ; + function = LED_FUNCTION_ACTIVITY; + + led@12 { + reg = <12>; + color = ; + }; + + led@13 { + reg = <13>; + color = ; + }; + + led@14 { + reg = <14>; + color = ; + }; + }; + +}; From patchwork Wed Sep 25 17:46:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 174387 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp944221ill; Wed, 25 Sep 2019 10:41:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqw2a1Fx2MZ0HXdKQxU8Jy6ygjevIFSK+UNHduxbQ9WWS+Z6W6y5KSopMd3SjJoHREt1Q6wd X-Received: by 2002:a17:907:20f1:: with SMTP id rh17mr420254ejb.110.1569433289291; Wed, 25 Sep 2019 10:41:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569433289; cv=none; d=google.com; s=arc-20160816; b=MJkjZ0aBdS7wjha/2K/9qN4KvLbQ10chgT82q9k+GpgMXPGnNMCeQmMcBbpEJkbj3v MVFKlSLdysePY5jrhgsKC15A8VzQwNo/mSx8VFyYv+qRYgdYOnMu4JJPNWWDwQ5B/qxz 36WMoiRYVswg22JC2g/6piqi5ceB7lTeP4qxYlVY1zuAhKiffWBjpqmYFu7nIP2cNPYr m5HGVoXZrX+9adVplddyw8MmOPwicKkKgHOp/O4BXp2RHU+L/hgcZRz4IGlCQ4qKzI0/ QmmPTwXDBbAgBC0bZ2wbAhiEg2+mu20SuhsgQhfvwqFgAnay3/eurInVNjw/el1Fz5+o ak/Q== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vNLixCA7rV3r89geVpDyZT2afzJln66pkNhtKdigswM=; b=wMyzbwDNu1/BO1BizvOBNzbjWjj2sNBRnUFqoULZCeuNp4EtgsN3WO/R9+neyrPV5J 0KXsl4Opo2kQ/ioNOP2V6i9Jgi1vGpjI5be6pn3rQHHl6qNwHrDJY18z8ltkbcnLmwpm 1z/zsprFb1GXCbq9SCz3zTdesjvyCMopQK0WRr0BYko9BHMJ6uAqvD8EF4ZNYw7RNFVA 5sevQPCBVuVj+6F2ssfC6klqxN91kOaDXzp7tmpfiPs3eeQJG3DcZnYf/5q/0J7ootO8 JBrAuGzxi+OOijJC6JsamjDHILRA4NXIBU4wX1UBGRFToYSo0uChfJBrZguHbQwysxd/ 4Grw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=aqmrx4Rf; 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=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 d1si3572241edr.446.2019.09.25.10.41.29; Wed, 25 Sep 2019 10:41:29 -0700 (PDT) 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=@ti.com header.s=ti-com-17Q1 header.b=aqmrx4Rf; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2443084AbfIYRlZ (ORCPT + 26 others); Wed, 25 Sep 2019 13:41:25 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:36226 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2443058AbfIYRlV (ORCPT ); Wed, 25 Sep 2019 13:41:21 -0400 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x8PHfFfo037344; Wed, 25 Sep 2019 12:41:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1569433275; bh=vNLixCA7rV3r89geVpDyZT2afzJln66pkNhtKdigswM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=aqmrx4RfqJbdfsqaMuxR1H2DBQ/kCkiaTv5RLio6Yz/ncb26K2mAJe3uUJzGW7J5n 2I7aVOoF6dTZOTsDL/+fg3xox9UzCSDd22oVUkkV3eFbXL0Oash8p5bp4fmMBVn/Di 7wAPLhyQL//qBpXPAp85TUYd7kgOcsxs8mXN1wvQ= Received: from DFLE109.ent.ti.com (dfle109.ent.ti.com [10.64.6.30]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x8PHfFK3048317 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 25 Sep 2019 12:41:15 -0500 Received: from DFLE104.ent.ti.com (10.64.6.25) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Wed, 25 Sep 2019 12:41:08 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Wed, 25 Sep 2019 12:41:15 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id x8PHfFYW031164; Wed, 25 Sep 2019 12:41:15 -0500 From: Dan Murphy To: , CC: , , Dan Murphy Subject: [PATCH v9 04/15] leds: Add multicolor ID to the color ID list Date: Wed, 25 Sep 2019 12:46:05 -0500 Message-ID: <20190925174616.3714-5-dmurphy@ti.com> X-Mailer: git-send-email 2.22.0.214.g8dca754b1e In-Reply-To: <20190925174616.3714-1-dmurphy@ti.com> References: <20190925174616.3714-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a new color ID that is declared as MULTICOLOR as with the multicolor framework declaring a definitive color is not accurate as the node can contain multiple colors. Signed-off-by: Dan Murphy --- drivers/leds/led-core.c | 1 + 1 file changed, 1 insertion(+) -- 2.22.0.214.g8dca754b1e diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c index f1f718dbe0f8..846248a0693d 100644 --- a/drivers/leds/led-core.c +++ b/drivers/leds/led-core.c @@ -34,6 +34,7 @@ const char * const led_colors[LED_COLOR_ID_MAX] = { [LED_COLOR_ID_VIOLET] = "violet", [LED_COLOR_ID_YELLOW] = "yellow", [LED_COLOR_ID_IR] = "ir", + [LED_COLOR_ID_MULTI] = "multicolor", }; EXPORT_SYMBOL_GPL(led_colors); From patchwork Wed Sep 25 17:46:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 174388 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp944233ill; Wed, 25 Sep 2019 10:41:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqzwYlmfqc+S3FnogT3Uvj6LTKzWqaFzjJQyXdOhfWRfwxCj4BHLWjRNJHEfWLYjZRcaL+qy X-Received: by 2002:a17:906:7d10:: with SMTP id u16mr396639ejo.194.1569433289871; Wed, 25 Sep 2019 10:41:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569433289; cv=none; d=google.com; s=arc-20160816; b=kExplSp7MldjBkuFG8omBq+EXT/SSZw45DqErW1JupkDmVb8Jvn6Yf/b2UbUw5um5I XQzYIFjBGLFBuu1atGACbyNVYiObbRO+dwVdFH+W8r+hzBLaJfQGcfJuumCmisUmcLck W6dRM8Yy1t6ROw0wago9ar5RKhMTuBsnyMUfZucoItm4k8qAbI6QLJuUISfBSR6LSVhK s4In5C61TGRYZJRzm6pepKNK+Lq6/4i4YwMtw+1zC1YBkMyfviuFl0UPZaIb7caLDbl5 5Ngm4XFJghsMPxLXyK7kB8Sk/j/akPppUwKDtoYLAXo5Cti6JJ1xY9m7HckO7T4k91/u edsw== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3CRW4/oWlwp3JjqAPxkZgPKauor0K0iSNyWJ1Hgv8mo=; b=bnqNoTrg5Vxe4DTrBFgixh9SD373AmVeGYrI0bbNkh3w4DaMW1mSSGDVkIfC79TYwK JkI2oea4eZi+DZxT8FO9WwCP++KF8MwdnstWOAOBb/mUcPP3VgfparAK6Jlo5kT7yEXf yYuCUPOdRtxjQ2C3CeD7F/1zHOUzWLFEDZJyYL2d63yc6CLyU/qm+BqT4bPMZwNwwV2b ifU28SgNgV6l+uNo1dAGuqtS9tuC6ZdriNUb+ldyMetfNqMUkirJLUqt3zGax9UEcX+m iMxL9G5pz/lJ/udva2MbXry+aNiNewrnjHqX9iq8MejGxeIuezrwS8a6MUOzuJb5xI20 G5Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=yQtL0DfC; 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=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 d1si3572241edr.446.2019.09.25.10.41.29; Wed, 25 Sep 2019 10:41:29 -0700 (PDT) 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=@ti.com header.s=ti-com-17Q1 header.b=yQtL0DfC; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2443102AbfIYRl1 (ORCPT + 26 others); Wed, 25 Sep 2019 13:41:27 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:36230 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2443059AbfIYRlW (ORCPT ); Wed, 25 Sep 2019 13:41:22 -0400 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x8PHfFAi037349; Wed, 25 Sep 2019 12:41:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1569433275; bh=3CRW4/oWlwp3JjqAPxkZgPKauor0K0iSNyWJ1Hgv8mo=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=yQtL0DfCHVUMMX6qMiRx5pCfdU1LYOG5el91tPsHIuaf+Ovg+bEW6QZh79siBXs+z qyCpc4/Uw07qCsgRtcfAMQItrrEFXNIQtkuaC3QQlniyt1IStzseAhKOPTnuhlzQXY +m6LE6Mnc0xM4sUhWyTv5hUYVAMVWbdhdc9degpo= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x8PHfFt4048326 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 25 Sep 2019 12:41:15 -0500 Received: from DFLE102.ent.ti.com (10.64.6.23) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Wed, 25 Sep 2019 12:41:08 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Wed, 25 Sep 2019 12:41:15 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id x8PHfFfc129591; Wed, 25 Sep 2019 12:41:15 -0500 From: Dan Murphy To: , CC: , , Dan Murphy Subject: [PATCH v9 05/15] leds: multicolor: Introduce a multicolor class definition Date: Wed, 25 Sep 2019 12:46:06 -0500 Message-ID: <20190925174616.3714-6-dmurphy@ti.com> X-Mailer: git-send-email 2.22.0.214.g8dca754b1e In-Reply-To: <20190925174616.3714-1-dmurphy@ti.com> References: <20190925174616.3714-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce a multicolor class that groups colored LEDs within a LED node. The multi color class groups monochrome LEDs and allows controlling two aspects of the final combined color: hue and lightness. The former is controlled via _intensity files and the latter is controlled via brightness file. Signed-off-by: Dan Murphy --- drivers/leds/Kconfig | 10 ++ drivers/leds/Makefile | 1 + drivers/leds/led-class-multicolor.c | 220 +++++++++++++++++++++++++++ include/linux/led-class-multicolor.h | 74 +++++++++ 4 files changed, 305 insertions(+) create mode 100644 drivers/leds/led-class-multicolor.c create mode 100644 include/linux/led-class-multicolor.h -- 2.22.0.214.g8dca754b1e diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index 6e7703fd03d0..cfb1ebb6517f 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -30,6 +30,16 @@ config LEDS_CLASS_FLASH for the flash related features of a LED device. It can be built as a module. +config LEDS_CLASS_MULTI_COLOR + tristate "LED Mulit Color LED Class Support" + depends on LEDS_CLASS + help + This option enables the multicolor LED sysfs class in /sys/class/leds. + It wraps LED class and adds multicolor LED specific sysfs attributes + and kernel internal API to it. You'll need this to provide support + for multicolor LEDs that are grouped together. This class is not + intended for single color LEDs. It can be built as a module. + config LEDS_BRIGHTNESS_HW_CHANGED bool "LED Class brightness_hw_changed attribute support" depends on LEDS_CLASS diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile index 2da39e896ce8..841038cfe35b 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile @@ -4,6 +4,7 @@ obj-$(CONFIG_NEW_LEDS) += led-core.o obj-$(CONFIG_LEDS_CLASS) += led-class.o obj-$(CONFIG_LEDS_CLASS_FLASH) += led-class-flash.o +obj-$(CONFIG_LEDS_CLASS_MULTI_COLOR) += led-class-multicolor.o obj-$(CONFIG_LEDS_TRIGGERS) += led-triggers.o # LED Platform Drivers diff --git a/drivers/leds/led-class-multicolor.c b/drivers/leds/led-class-multicolor.c new file mode 100644 index 000000000000..25371bd9a860 --- /dev/null +++ b/drivers/leds/led-class-multicolor.c @@ -0,0 +1,220 @@ +// SPDX-License-Identifier: GPL-2.0 +// LED Multi Color class interface +// Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ + +#include +#include +#include +#include +#include +#include + +#include "leds.h" + +#define INTENSITY_NAME "_intensity" +#define MAX_INTENSITY_NAME "_max_intensity" + +void led_mc_calc_brightness(struct led_classdev_mc *mcled_cdev, + enum led_brightness brightness, + int brightness_val[]) +{ + struct led_mc_color_entry *priv; + int i = 0; + + list_for_each_entry(priv, &mcled_cdev->color_list, list) { + brightness_val[i] = brightness * + priv->intensity / priv->max_intensity; + i++; + } +} +EXPORT_SYMBOL_GPL(led_mc_calc_brightness); + +static ssize_t intensity_store(struct device *dev, + struct device_attribute *intensity_attr, + const char *buf, size_t size) +{ + struct led_mc_color_entry *priv = container_of(intensity_attr, + struct led_mc_color_entry, + intensity_attr); + struct led_classdev *led_cdev = priv->mcled_cdev->led_cdev; + unsigned long value; + ssize_t ret; + + mutex_lock(&led_cdev->led_access); + + ret = kstrtoul(buf, 10, &value); + if (ret) + goto unlock; + + if (value > priv->max_intensity) { + ret = -EINVAL; + goto unlock; + } + + priv->intensity = value; + ret = size; + +unlock: + mutex_unlock(&led_cdev->led_access); + return ret; +} + +static ssize_t intensity_show(struct device *dev, + struct device_attribute *intensity_attr, + char *buf) +{ + struct led_mc_color_entry *priv = container_of(intensity_attr, + struct led_mc_color_entry, + intensity_attr); + + return sprintf(buf, "%d\n", priv->intensity); +} + +static ssize_t max_intensity_show(struct device *dev, + struct device_attribute *max_intensity_attr, + char *buf) +{ + struct led_mc_color_entry *priv = container_of(max_intensity_attr, + struct led_mc_color_entry, + max_intensity_attr); + + return sprintf(buf, "%d\n", priv->max_intensity); +} + +static struct attribute *led_color_attrs[] = { + NULL, +}; + +static struct attribute_group led_color_group = { + .name = "colors", + .attrs = led_color_attrs, +}; + +static int led_multicolor_init_color(struct led_classdev_mc *mcled_cdev, + int color_id, int color_index) +{ + struct led_classdev *led_cdev = mcled_cdev->led_cdev; + struct led_mc_color_entry *mc_priv; + char *intensity_file_name; + char *max_intensity_file_name; + size_t len; + int ret; + + mc_priv = devm_kzalloc(led_cdev->dev, sizeof(*mc_priv), GFP_KERNEL); + if (!mc_priv) + return -ENOMEM; + + mc_priv->led_color_id = color_id; + mc_priv->mcled_cdev = mcled_cdev; + + sysfs_attr_init(&mc_priv->intensity_attr.attr); + len = strlen(led_colors[color_id]) + strlen(INTENSITY_NAME) + 1; + intensity_file_name = kzalloc(len, GFP_KERNEL); + if (!intensity_file_name) + return -ENOMEM; + + snprintf(intensity_file_name, len, "%s%s", + led_colors[color_id], INTENSITY_NAME); + mc_priv->intensity_attr.attr.name = intensity_file_name; + mc_priv->intensity_attr.attr.mode = 644; + mc_priv->intensity_attr.store = intensity_store; + mc_priv->intensity_attr.show = intensity_show; + ret = sysfs_add_file_to_group(&led_cdev->dev->kobj, + &mc_priv->intensity_attr.attr, + led_color_group.name); + if (ret) + goto intensity_err_out; + + sysfs_attr_init(&mc_priv->max_intensity_attr.attr); + len = strlen(led_colors[color_id]) + strlen(MAX_INTENSITY_NAME) + 1; + max_intensity_file_name = kzalloc(len, GFP_KERNEL); + if (!max_intensity_file_name) { + ret = -ENOMEM; + goto intensity_err_out; + } + + snprintf(max_intensity_file_name, len, "%s%s", + led_colors[color_id], MAX_INTENSITY_NAME); + mc_priv->max_intensity_attr.attr.name = max_intensity_file_name; + mc_priv->max_intensity_attr.attr.mode = 444; + mc_priv->max_intensity_attr.show = max_intensity_show; + ret = sysfs_add_file_to_group(&led_cdev->dev->kobj, + &mc_priv->max_intensity_attr.attr, + led_color_group.name); + if (ret) + goto max_intensity_err_out; + + mc_priv->max_intensity = LED_FULL; + list_add_tail(&mc_priv->list, &mcled_cdev->color_list); + +max_intensity_err_out: + kfree(max_intensity_file_name); +intensity_err_out: + kfree(intensity_file_name); + return ret; +} + +static int led_multicolor_init_color_dir(struct led_classdev_mc *mcled_cdev) +{ + struct led_classdev *led_cdev = mcled_cdev->led_cdev; + int ret; + int i, color_index = 0; + + ret = sysfs_create_group(&led_cdev->dev->kobj, &led_color_group); + if (ret) + return ret; + + for (i = 0; i < LED_COLOR_ID_MAX; i++) { + if (test_bit(i, &mcled_cdev->available_colors)) { + ret = led_multicolor_init_color(mcled_cdev, i, + color_index); + if (ret) + break; + + color_index++; + } + } + + return ret; +} + +int led_classdev_multicolor_register_ext(struct device *parent, + struct led_classdev_mc *mcled_cdev, + struct led_init_data *init_data) +{ + struct led_classdev *led_cdev; + int ret; + + if (!mcled_cdev) + return -EINVAL; + + led_cdev = mcled_cdev->led_cdev; + INIT_LIST_HEAD(&mcled_cdev->color_list); + + /* Register led class device */ + ret = led_classdev_register_ext(parent, led_cdev, init_data); + if (ret) + return ret; + + return led_multicolor_init_color_dir(mcled_cdev); +} +EXPORT_SYMBOL_GPL(led_classdev_multicolor_register_ext); + +void led_classdev_multicolor_unregister(struct led_classdev_mc *mcled_cdev) +{ + struct led_mc_color_entry *priv, *next; + + if (!mcled_cdev) + return; + + list_for_each_entry_safe(priv, next, &mcled_cdev->color_list, list) + list_del(&priv->list); + + sysfs_remove_group(&mcled_cdev->led_cdev->dev->kobj, &led_color_group); + led_classdev_unregister(mcled_cdev->led_cdev); +} +EXPORT_SYMBOL_GPL(led_classdev_multicolor_unregister); + +MODULE_AUTHOR("Dan Murphy "); +MODULE_DESCRIPTION("Multi Color LED class interface"); +MODULE_LICENSE("GPL v2"); diff --git a/include/linux/led-class-multicolor.h b/include/linux/led-class-multicolor.h new file mode 100644 index 000000000000..280ba5a614b4 --- /dev/null +++ b/include/linux/led-class-multicolor.h @@ -0,0 +1,74 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* LED Multicolor class interface + * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ + */ + +#ifndef __LINUX_MULTICOLOR_LEDS_H_INCLUDED +#define __LINUX_MULTICOLOR_LEDS_H_INCLUDED + +#include +#include + +struct led_classdev_mc; + +struct led_mc_color_entry { + struct led_classdev_mc *mcled_cdev; + + struct device_attribute max_intensity_attr; + struct device_attribute intensity_attr; + + enum led_brightness max_intensity; + enum led_brightness intensity; + + struct list_head list; + + int led_color_id; +}; + +struct led_classdev_mc { + /* led class device */ + struct led_classdev *led_cdev; + struct list_head color_list; + + unsigned long available_colors; + int num_leds; +}; + +static inline struct led_classdev_mc *lcdev_to_mccdev( + struct led_classdev *lcdev) +{ + return container_of(lcdev, struct led_classdev_mc, led_cdev); +} + +/** + * led_classdev_multicolor_register_ext - register a new object of led_classdev + * class with support for multicolor LEDs + * @parent: the multicolor LED to register + * @mcled_cdev: the led_classdev_mc structure for this device + * @init_data: the LED class Multi color device initialization data + * + * Returns: 0 on success or negative error value on failure + */ +int led_classdev_multicolor_register_ext(struct device *parent, + struct led_classdev_mc *mcled_cdev, + struct led_init_data *init_data); + +#define led_classdev_multicolor_register(parent, mcled_cdev) \ + led_classdev_multicolor_register_ext(parent, mcled_cdev, NULL) + +/** + * led_classdev_multicolor_unregister - unregisters an object of led_classdev + * class with support for multicolor LEDs + * @mcled_cdev: the multicolor LED to unregister + * + * Unregister a previously registered via led_classdev_multicolor_register + * object + */ +void led_classdev_multicolor_unregister(struct led_classdev_mc *mcled_cdev); + +/* Calculate brightness for the monochrome LED cluster */ +void led_mc_calc_brightness(struct led_classdev_mc *mcled_cdev, + enum led_brightness brightness, + int brightness_val[]); + +#endif /* __LINUX_MULTICOLOR_LEDS_H_INCLUDED */ From patchwork Wed Sep 25 17:46:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 174384 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp944110ill; Wed, 25 Sep 2019 10:41:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqy0izqytVUwbBNEDouQc4Aq4aGZQvEc85lgrYj1uZT4Mf8i/eQD6zgIqgew3UXet3FAQF9u X-Received: by 2002:a50:e616:: with SMTP id y22mr4238459edm.253.1569433284711; Wed, 25 Sep 2019 10:41:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569433284; cv=none; d=google.com; s=arc-20160816; b=zHLVOK0Is0oHp2jEZk0s2yXAARjwgEA68V7cSp2pSa0fjP+RC1b18G9gI4df8ZHZ4Y FZTwEdHoDErzEyYSx4isiihjKeYTj2tPjeT8+piNRzE4e1Aew4UlP0OcTCQ1qCIIGUJP I4kPYJ7Zz0wYS3aQ+BLsb0+HMq7rSfCfii6DLEYrbUAxOVE5lj1cLhOscxSony6t1sau WwDE6DkXk2/h3nR2tH5j+hmiGKpdkcZ6IoZM5lHw7kSY4bERifPrPHZSTkGfO/pCq/WM LgnHFfcvjom+kbI6YUJoFLKwnBKIOpOlqAB29uNn5Xhg/tgCICqpwPVfRkHbKYTZGVPX quHA== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LFJY/sk3vbxhRSCXMQMK8Y5qMhwQ/+YV7Aj17cmTfjg=; b=q6MQdJtpP1qCvEVkJ6xbd9DnYfRUfOBAzbzuveXvuzwhXJ9r7w38pt2FjK2PtF6zed 9wxvETeVc2j+eQRvy67bAXJxrPvVVlSzofXhtfPr+AcO+9CFftai1ZmP+HeYlmWMnKrL 1kM6/AcwjtIp+ZMLftvgeZurjRSpyPjU2jSOP9M/bUS9wcfAH3KGI/GcmMzMicSFYdwb pZcWlYLD/jzBFFG2YtRe2ztFV39qhffT43wgNQ2BXq347YvRGHx2I7M54aqrrp9d0BUG 1stygm8wayZjCV2hkFK4PKDIKPmBbsuKPdPFHEk9J/a1EGXYuWVFqsu75UQWjUnrl1W5 iQSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=eggHqGQu; 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=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 f14si3587319edt.92.2019.09.25.10.41.24; Wed, 25 Sep 2019 10:41:24 -0700 (PDT) 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=@ti.com header.s=ti-com-17Q1 header.b=eggHqGQu; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2443062AbfIYRlV (ORCPT + 26 others); Wed, 25 Sep 2019 13:41:21 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:58564 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730618AbfIYRlU (ORCPT ); Wed, 25 Sep 2019 13:41:20 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x8PHfGbG055222; Wed, 25 Sep 2019 12:41:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1569433276; bh=LFJY/sk3vbxhRSCXMQMK8Y5qMhwQ/+YV7Aj17cmTfjg=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=eggHqGQuxdC1P2pQmILdBAFd8i2XY/Mej/sNkL4uh3zeY/hVYO4xpkXE7cy8/lqw5 u3Y4y3K0vL508WCCklNElEe3FcZE5nK5sd1qILUdCzV0mvTlQTXIhWTgLluq2jbn// 9C5DjKZQmpGB+CMqllPl4dM0d4PbsPYUhDEM9k7A= Received: from DFLE111.ent.ti.com (dfle111.ent.ti.com [10.64.6.32]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x8PHfFIZ013929 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 25 Sep 2019 12:41:16 -0500 Received: from DFLE100.ent.ti.com (10.64.6.21) by DFLE111.ent.ti.com (10.64.6.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Wed, 25 Sep 2019 12:41:08 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Wed, 25 Sep 2019 12:41:08 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x8PHfF7T045646; Wed, 25 Sep 2019 12:41:15 -0500 From: Dan Murphy To: , CC: , , Dan Murphy Subject: [PATCH v9 06/15] dt: bindings: lp50xx: Introduce the lp50xx family of RGB drivers Date: Wed, 25 Sep 2019 12:46:07 -0500 Message-ID: <20190925174616.3714-7-dmurphy@ti.com> X-Mailer: git-send-email 2.22.0.214.g8dca754b1e In-Reply-To: <20190925174616.3714-1-dmurphy@ti.com> References: <20190925174616.3714-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce the bindings for the Texas Instruments LP5036, LP5030, LP5024, LP5018, LP5012 and LP5009 RGB LED device driver. The LP5036/30/24/18/12/9 can control RGB LEDs individually or as part of a control bank group. These devices have the ability to adjust the mixing control for the RGB LEDs to obtain different colors independent of the overall brightness of the LED grouping. Datasheet: http://www.ti.com/lit/ds/symlink/lp5012.pdf http://www.ti.com/lit/ds/symlink/lp5024.pdf http://www.ti.com/lit/ds/symlink/lp5036.pdf Signed-off-by: Dan Murphy --- .../devicetree/bindings/leds/leds-lp50xx.txt | 148 ++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/leds-lp50xx.txt -- 2.22.0.214.g8dca754b1e diff --git a/Documentation/devicetree/bindings/leds/leds-lp50xx.txt b/Documentation/devicetree/bindings/leds/leds-lp50xx.txt new file mode 100644 index 000000000000..8a0a21f1056c --- /dev/null +++ b/Documentation/devicetree/bindings/leds/leds-lp50xx.txt @@ -0,0 +1,148 @@ +* Texas Instruments - LP5009/12/18/24/30/36 RGB LED driver + +The LP50XX is multi-channel, I2C RGB LED Drivers that can group RGB LEDs into +a LED group or control them individually. + +The difference in these RGB LED drivers is the number of supported RGB modules. + +Required parent properties: + - compatible: + "ti,lp5009" + "ti,lp5012" + "ti,lp5018" + "ti,lp5024" + "ti,lp5030" + "ti,lp5036" + - reg : I2C slave address + lp5009/12 - 0x14, 0x15, 0x16, 0x17 + lp5018/24 - 0x28, 0x29, 0x2a, 0x2b + lp5030/36 - 0x30, 0x31, 0x32, 0x33 + - #address-cells : 1 + - #size-cells : 0 + +Optional parent properties: + - enable-gpios : gpio pin to enable/disable the device. + - vled-supply : LED supply + +Required child properties: + - #address-cells : 1 + - #size-cells : 0 + - reg : This is the LED module number. + - color : Must be LED_COLOR_ID_MULTI + - function : see Documentation/devicetree/bindings/leds/common.txt + +Required child properties only is LED modules will be banked: + - ti,led-bank : This property denotes the LED module numbers that will + be controlled as a single RGB cluster. Each LED module + number will be controlled by a single LED class instance. + There can only be one instance of the ti,led-bank + property for each device node. + +Required grandchildren properties: + - reg : A single entry denoting the LED output that controls + the monochrome LED. + - color : see Documentation/devicetree/bindings/leds/common.txt + - led-sources : see Documentation/devicetree/bindings/leds/common.txt + +The LED outputs associated with the LED modules are defined in Table 1 of the +corresponding data sheets. + +LP5009 - 3 Total RGB cluster LED outputs 0-2 +LP5012 - 4 Total RGB cluster LED outputs 0-3 +LP5018 - 6 Total RGB cluster LED outputs 0-5 +LP5024 - 8 Total RGB cluster LED outputs 0-7 +LP5030 - 10 Total RGB cluster LED outputs 0-9 +LP5036 - 12 Total RGB cluster LED outputs 0-11 + +Optional child properties: + - label : see Documentation/devicetree/bindings/leds/common.txt + - linux,default-trigger : + see Documentation/devicetree/bindings/leds/common.txt + +Examples: +led-controller@29 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "ti,lp5024"; + reg = <0x29>; + enable-gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>; + vled-supply = <&vmmcsd_fixed>; + + multi-led@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + color = ; + function = LED_FUNCTION_STATUS; + + led@3 { + reg = <3>; + color = ; + }; + + led@4 { + reg = <4>; + color = ; + }; + + led@5 { + reg = <5>; + color = ; + }; + }; + + multi-led@2 { + #address-cells = <1>; + #size-cells = <0>; + reg = <2>; + color = ; + function = LED_FUNCTION_STANDBY; + ti,led-bank = <2 3 5>; + + led@6 { + reg = <0x6>; + color = ; + led-sources = <6 9 15>; + }; + + led@7 { + reg = <0x7>; + color = ; + led-sources = <7 10 16>; + }; + + led@8 { + reg = <0x8>; + color = ; + led-sources = <8 11 17>; + }; + }; + + multi-led@4 { + #address-cells = <1>; + #size-cells = <0>; + reg = <4>; + color = ; + function = LED_FUNCTION_ACTIVITY; + + led@12 { + reg = <12>; + color = ; + }; + + led@13 { + reg = <13>; + color = ; + }; + + led@14 { + reg = <14>; + color = ; + }; + }; +}; + +For more product information please see the link below: +http://www.ti.com/lit/ds/symlink/lp5012.pdf +http://www.ti.com/lit/ds/symlink/lp5024.pdf +http://www.ti.com/lit/ds/symlink/lp5036.pdf From patchwork Wed Sep 25 17:46:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 174391 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp944452ill; Wed, 25 Sep 2019 10:41:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqzwKe2UD2NjHGJA7khKg5Obwu+Dr7CB8qnW3t52iHaTtBrTHDbBoAAnwVNH9DfwZta/I1yW X-Received: by 2002:a50:f045:: with SMTP id u5mr4258511edl.297.1569433303303; Wed, 25 Sep 2019 10:41:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569433303; cv=none; d=google.com; s=arc-20160816; b=QUWU8T1MG2tzv5vGQxgiXHTlrtHUxbDivBMbY9j80oVZ2Qg1/2TtkUYC2rlJ5m0ePx FKhK88J/G598SPDq7agOqZP0QGpEO+GPwJh1qAoUrZSunC/D8uLHxHMII0Q8LD3579aQ bzUVzA+2pXMP5RHnnjdItIRYK12ndKJ9WlYM1QY262jjLAqAqnMvDZW0DkeLpgZmbeOV vIAig3hzdUZLHTK6cakfU5xhsrJFnITNmvC8p0fkmCjNpErUB/c9lNiXKNLd2Nuutnms sWAf/ThkswZdv8TgMji6y6Ut7C8OJqP7wqMUcr8fo1+FHPNIw231j9mPXv4ZSz/tZEr5 S2Fg== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=R64xqHNgQJwb3jlD5hJeJlTBPxK6GDqOAkPcBtuFvx4=; b=xgU11gsom0x34fMvGOle492q+o1LDv3yDP9W6+AAm7H5iXSkS7xUjJ6FUixmRa6SRT je/9r4c9CGWP+kMUReWWdtrZBDnG7FFKEglinOTjwWUyo1zNcAPgQ3ktpo9bT6TC60et BL60c8sjdkurkXgyikrB5lgvNrBoeImU6SkPD2m8Eu+4aIFxBKSaXEK7tzyiqGiHXjbN eaplhZei30tXHKwDTlfOQC6rviRgGf0UrwvLgdJH0LaZJ3vGwop3Fu4p1c1Houciay58 GYzcUM7Et1ByxgC1NvIfjfJl+SsUDNvgmWd5cZ0MnjBCDA+wysdlPUaHDI8yDy53sTVc 9Y1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=nofsXCvU; 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=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 ci22si126548ejb.162.2019.09.25.10.41.42; Wed, 25 Sep 2019 10:41:43 -0700 (PDT) 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=@ti.com header.s=ti-com-17Q1 header.b=nofsXCvU; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2443143AbfIYRlj (ORCPT + 26 others); Wed, 25 Sep 2019 13:41:39 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:33130 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2443114AbfIYRlb (ORCPT ); Wed, 25 Sep 2019 13:41:31 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x8PHfGmw029155; Wed, 25 Sep 2019 12:41:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1569433276; bh=R64xqHNgQJwb3jlD5hJeJlTBPxK6GDqOAkPcBtuFvx4=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=nofsXCvUOp9u/9kI6Bw0aTaPhJIUNwM9UqgMFdnip0SFYag2tAgCc66Fe394D1DBh T1cC+IUkTNZI5jNx/hhNsUtt59Wl2HpskvfMBB76NboMoqUZWgyzfcz/EA/YF8OscS KVlUYJFApPHpEBDwe5d5UgvzuOo6ai0uu74sASNw= Received: from DFLE112.ent.ti.com (dfle112.ent.ti.com [10.64.6.33]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id x8PHfGao018226; Wed, 25 Sep 2019 12:41:16 -0500 Received: from DFLE109.ent.ti.com (10.64.6.30) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Wed, 25 Sep 2019 12:41:09 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Wed, 25 Sep 2019 12:41:09 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x8PHfGXW045660; Wed, 25 Sep 2019 12:41:16 -0500 From: Dan Murphy To: , CC: , , Dan Murphy , Tony Lindgren , =?utf-8?q?Beno?= =?utf-8?q?=C3=AEt_Cousson?= , Linus Walleij , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team Subject: [PATCH v9 09/15] dt: bindings: lp55xx: Update binding for Multicolor Framework Date: Wed, 25 Sep 2019 12:46:10 -0500 Message-ID: <20190925174616.3714-10-dmurphy@ti.com> X-Mailer: git-send-email 2.22.0.214.g8dca754b1e In-Reply-To: <20190925174616.3714-1-dmurphy@ti.com> References: <20190925174616.3714-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Update the DT binding to include the properties to use the multicolor framework for the devices that use the LP55xx framework. Signed-off-by: Dan Murphy CC: Tony Lindgren CC: "Benoît Cousson" CC: Linus Walleij CC: Shawn Guo CC: Sascha Hauer CC: Pengutronix Kernel Team CC: Fabio Estevam CC: NXP Linux Team --- .../devicetree/bindings/leds/leds-lp55xx.txt | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) -- 2.22.0.214.g8dca754b1e diff --git a/Documentation/devicetree/bindings/leds/leds-lp55xx.txt b/Documentation/devicetree/bindings/leds/leds-lp55xx.txt index bfe2805c5534..c120d2bde3bd 100644 --- a/Documentation/devicetree/bindings/leds/leds-lp55xx.txt +++ b/Documentation/devicetree/bindings/leds/leds-lp55xx.txt @@ -1,6 +1,8 @@ Binding for TI/National Semiconductor LP55xx LED Drivers Required properties: +- #address-cells: 1 +- #size-cells: 0 - compatible: one of national,lp5521 national,lp5523 @@ -14,6 +16,18 @@ Required properties: Each child has own specific current settings - led-cur: Current setting at each LED channel (mA x10, 0 if LED is not connected) - max-cur: Maximun current at each LED channel. +- reg: Output channel for the LED. This is zero based channel identifier and + the data sheet is a one based channel identifier. + reg value to output to LED output number + D1 = reg value is 0 + D2 = reg value is 1 + D3 = reg value is 2 + D4 = reg value is 3 + D5 = reg value is 4 + D6 = reg value is 5 + D7 = reg value is 6 + D8 = reg value is 7 + D9 = reg value is 8 Optional properties: - enable-gpio: GPIO attached to the chip's enable pin @@ -35,23 +49,28 @@ example 1) LP5521 on channel 0. lp5521@32 { + #address-cells = <1>; + #size-cells = <0>; compatible = "national,lp5521"; reg = <0x32>; label = "lp5521_pri"; clock-mode = /bits/ 8 <2>; chan0 { + reg = <0>; led-cur = /bits/ 8 <0x2f>; max-cur = /bits/ 8 <0x5f>; linux,default-trigger = "heartbeat"; }; chan1 { + reg = <1>; led-cur = /bits/ 8 <0x2f>; max-cur = /bits/ 8 <0x5f>; }; chan2 { + reg = <2>; led-cur = /bits/ 8 <0x2f>; max-cur = /bits/ 8 <0x5f>; }; @@ -70,59 +89,70 @@ ASEL1 ASEL0 Address VEN VEN 35h lp5523@32 { + #address-cells = <1>; + #size-cells = <0>; compatible = "national,lp5523"; reg = <0x32>; clock-mode = /bits/ 8 <1>; chan0 { + reg = <0>; chan-name = "d1"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; chan1 { + reg = <1>; chan-name = "d2"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; chan2 { + reg = <2>; chan-name = "d3"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; chan3 { + reg = <3>; chan-name = "d4"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; chan4 { + reg = <4>; chan-name = "d5"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; chan5 { + reg = <5>; chan-name = "d6"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; chan6 { + reg = <6>; chan-name = "d7"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; chan7 { + reg = <7>; chan-name = "d8"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; chan8 { + reg = <8>; chan-name = "d9"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; @@ -133,29 +163,35 @@ example 3) LP5562 4 channels are defined. lp5562@30 { + #address-cells = <1>; + #size-cells = <0>; compatible = "ti,lp5562"; reg = <0x30>; clock-mode = /bits/8 <2>; chan0 { + reg = <0>; chan-name = "R"; led-cur = /bits/ 8 <0x20>; max-cur = /bits/ 8 <0x60>; }; chan1 { + reg = <1>; chan-name = "G"; led-cur = /bits/ 8 <0x20>; max-cur = /bits/ 8 <0x60>; }; chan2 { + reg = <2>; chan-name = "B"; led-cur = /bits/ 8 <0x20>; max-cur = /bits/ 8 <0x60>; }; chan3 { + reg = <3>; chan-name = "W"; led-cur = /bits/ 8 <0x20>; max-cur = /bits/ 8 <0x60>; @@ -167,62 +203,125 @@ example 4) LP8501 Others are same as LP5523. lp8501@32 { + #address-cells = <1>; + #size-cells = <0>; compatible = "ti,lp8501"; reg = <0x32>; clock-mode = /bits/ 8 <2>; pwr-sel = /bits/ 8 <3>; /* D1~9 connected to VOUT */ chan0 { + reg = <0>; chan-name = "d1"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; chan1 { + reg = <1>; chan-name = "d2"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; chan2 { + reg = <2>; chan-name = "d3"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; chan3 { + reg = <3>; chan-name = "d4"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; chan4 { + reg = <4>; chan-name = "d5"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; chan5 { + reg = <5>; chan-name = "d6"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; chan6 { + reg = <6>; chan-name = "d7"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; chan7 { + reg = <7>; chan-name = "d8"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; chan8 { + reg = <8>; chan-name = "d9"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; }; + +Multicolor Framework Support +In addition to the nodes and properties defined above for device support the +properties below are needed for multicolor framework support as defined in +Documentation/devicetree/bindings/leds/leds-class-multicolor.txt + +Required child properties for multicolor framework + - color : Must be LED_COLOR_ID_MULTI + - function : see Documentation/devicetree/bindings/leds/common.txt + +Required grandchildren properties + - reg : This is the LED output of the device + - color : see Documentation/devicetree/bindings/leds/common.txt + +Multicolor LED example: +lp5523: lp5523@32 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "national,lp5523"; + reg = <0x32>; + clock-mode = /bits/ 8 <0>; /* LP55XX_CLOCK_AUTO */ + + multi-led@2 { + #address-cells = <1>; + #size-cells = <0>; + reg = <2>; + color = ; + function = LED_FUNCTION_STANDBY; + linux,default-trigger = "heartbeat"; + + led@0 { + led-cur = /bits/ 8 <50>; + max-cur = /bits/ 8 <100>; + reg = <0x0>; + color = ; + }; + + led@1 { + led-cur = /bits/ 8 <50>; + max-cur = /bits/ 8 <100>; + reg = <0x1>; + color = ; + }; + + led@6 { + led-cur = /bits/ 8 <50>; + max-cur = /bits/ 8 <100>; + reg = <0x6>; + color = ; + }; + }; +}; From patchwork Wed Sep 25 17:46:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 174395 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp944834ill; Wed, 25 Sep 2019 10:42:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqzZTxuyY+pWIup78uC7k9BCgkUIeL2F21P2EqGHDBN83S6J9tnp8NeT9TzuDoQ+ysTVtLcz X-Received: by 2002:a05:6402:74c:: with SMTP id p12mr4227400edy.135.1569433324925; Wed, 25 Sep 2019 10:42:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569433324; cv=none; d=google.com; s=arc-20160816; b=AQkmbq4WFawgyDDr3xnID+ckHGp4EA73EDfR3S3nMJBC/NB3TVSmvS4Hyqdv6mh5MX D6Mv34f1hF1tEtn469wfst5PBnSQf3eIEoAVQytJolvuKlgvsR/slhb0VTzUZWlQhcl2 hKndbhZ4paNHDAVskjwp8r2G6ajCi5/nqfhahVHAFxd97p/wgGOElyhnW+a9tgEKJ/c3 0s4qM6zkfwCgMAY5sFcuRPEAsGvPgyfgqtMBU/0lOLpf8HTjSKExJYarxjFkyi48iS86 rI2son+FGeoMJxSirI82QdSFG+PH0BcT72U5+1VdiwJqVt2Wn+mkFbST8Fu2JpWHuLHJ 8sMA== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xD4HBPY4/QT8zDoKonALegdDM8O79lB7Al2/k2EdrEs=; b=nlfK+sUg2kClgMldk1is9fl6AuDatI0rs1Pcrf1Fbp5NCt04CFtr1NziFjzkik4+w2 f5+P0DJ+BOw+FzVdvkcbHU0WfYeDiIYXZDBxY7G72Qu72ynGy8sec2mrVz/zTJeQxe7K FDHQ0L0rIq76k3DPBxD6E6mWkjZB6xDUlgDh3sol7veMhIO5Qc8geg+w0QZE/0o66j6F AYDZHfW4A9LQUPf4vyVGo8VZCf7FVhns0fv6pEcUdf9GIPmAuURI2Rsotc71mrgtUlX4 Hd/Ymddg1wN2JAwG9V4DrYeYhIUuvZA9KVEC4oao2VAWNn2cA4qe4Z9mjxRgtNGM01yM ke4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=CY1cmmg7; 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=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 r16si3496623edo.307.2019.09.25.10.42.04; Wed, 25 Sep 2019 10:42:04 -0700 (PDT) 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=@ti.com header.s=ti-com-17Q1 header.b=CY1cmmg7; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407860AbfIYRmD (ORCPT + 26 others); Wed, 25 Sep 2019 13:42:03 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:50760 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2443055AbfIYRlV (ORCPT ); Wed, 25 Sep 2019 13:41:21 -0400 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x8PHfGP5029466; Wed, 25 Sep 2019 12:41:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1569433277; bh=xD4HBPY4/QT8zDoKonALegdDM8O79lB7Al2/k2EdrEs=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=CY1cmmg7cp2esnLvQbngIa9rdFsYLs69Tak+NXRe516nvFbzvMPmg2KuJeEazSc+W ZMoRScwL6q+xlZza9Sshg0xfcL+GM45z85qn7JRRgLiKFD2UmInE4NplOkG30x525k d8g7JweohWISOOTvIOy25FQU06ov0SZNYSP00IpI= Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x8PHfGkf048343 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 25 Sep 2019 12:41:16 -0500 Received: from DFLE103.ent.ti.com (10.64.6.24) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Wed, 25 Sep 2019 12:41:09 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Wed, 25 Sep 2019 12:41:16 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id x8PHfGM9031177; Wed, 25 Sep 2019 12:41:16 -0500 From: Dan Murphy To: , CC: , , Dan Murphy , Tony Lindgren , =?utf-8?q?Beno?= =?utf-8?q?=C3=AEt_Cousson?= Subject: [PATCH v9 10/15] ARM: dts: n900: Add reg property to the LP5523 channel node Date: Wed, 25 Sep 2019 12:46:11 -0500 Message-ID: <20190925174616.3714-11-dmurphy@ti.com> X-Mailer: git-send-email 2.22.0.214.g8dca754b1e In-Reply-To: <20190925174616.3714-1-dmurphy@ti.com> References: <20190925174616.3714-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add the reg property to each channel node. This update is to accomodate the multicolor framework. In addition to the accomodation this allows the LEDs to be placed on any channel and allow designs to skip channels as opposed to requiring sequential order. Signed-off-by: Dan Murphy CC: Tony Lindgren CC: "Benoît Cousson" k# interactive rebase in progress; onto ae89cc6d4a8c --- arch/arm/boot/dts/omap3-n900.dts | 11 +++++++++++ 1 file changed, 11 insertions(+) -- 2.22.0.214.g8dca754b1e diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts index 84a5ade1e865..e6d0a7c52c5d 100644 --- a/arch/arm/boot/dts/omap3-n900.dts +++ b/arch/arm/boot/dts/omap3-n900.dts @@ -607,6 +607,8 @@ }; lp5523: lp5523@32 { + #address-cells = <1>; + #size-cells = <0>; compatible = "national,lp5523"; reg = <0x32>; clock-mode = /bits/ 8 <0>; /* LP55XX_CLOCK_AUTO */ @@ -616,54 +618,63 @@ chan-name = "lp5523:kb1"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; + reg = <0>; }; chan1 { chan-name = "lp5523:kb2"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; + reg = <1>; }; chan2 { chan-name = "lp5523:kb3"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; + reg = <2>; }; chan3 { chan-name = "lp5523:kb4"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; + reg = <3>; }; chan4 { chan-name = "lp5523:b"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; + reg = <4>; }; chan5 { chan-name = "lp5523:g"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; + reg = <5>; }; chan6 { chan-name = "lp5523:r"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; + reg = <6>; }; chan7 { chan-name = "lp5523:kb5"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; + reg = <7>; }; chan8 { chan-name = "lp5523:kb6"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; + reg = <8>; }; }; From patchwork Wed Sep 25 17:46:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 174390 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp944297ill; Wed, 25 Sep 2019 10:41:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqx948YJJ6BciDI4Ya5pHKSyIFH28dlmDJP8uoJEFJJJJbH3a7j1YEfFPvcW/zekwxi+D0SQ X-Received: by 2002:a50:fb16:: with SMTP id d22mr4311806edq.30.1569433293590; Wed, 25 Sep 2019 10:41:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569433293; cv=none; d=google.com; s=arc-20160816; b=sj3Y9ao0neQCxaLQF7eyZJl1JWibHwOJkV1WWtYMUBVWQkali8SN21PCarQLTAOah5 mYdcdS6ZkIvmQ4OBoitLQ4rsQSwKwhPJ5ke74+YD8lUYmMZ5HJp49MwT8ppt5Bab06Z+ DkKVf32a6vtFCrLV6q6e7ex9Qbub3X0XcRabLwar0q+OrW4SznQg94rL0VK6r4T/Y2XB DTECoclviU7lAAE8KjQYK5yQ5anaIM0IZj5DuOyia9Cr8T60I1vAP3kicgShOm0+l/EQ udfxgIG5CyrPAhIsg1vl9F4KWHCaV/Z5KblMCyODngACJSBUTdRLoC4q51byWMd8jffh /s7g== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=rE1raxC4CYcOMBpyDcOR0IFq0FY0PvxtcY0Jb3Au5oc=; b=ZOGOXnWcm5gpkY/Os22YqF4OPUy8dcTleOR1LO2U2DyNAR5RqwZOOWliapcx4Yqnfh +REQVEimqs/KaCNowTZOTNE+dnIQQufvSt8zG9VI/1gtYMpFD6IDFiik9aD+4D8tIOm/ UMjQ5FFdVFrIgpKLbBi92IwCJxOCZOa6P+hQgQc/uGRqOvVbTY+BPcOi77mWcOE9ZP74 OhyXbwJ4lM7jH12sxmISmo6cNwFDoYiUGJLW2/5P81+vf59LJ9rp3EDy/2OjV3RpYR1y yCmbi+OMq5Bt35cn8i/wMWYuXcb4kumwmlbAhTB6BqNHQPey0yAxPLxbhr7OnrxrXK6U xpzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=pwS9sX18; 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=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 d1si3572241edr.446.2019.09.25.10.41.33; Wed, 25 Sep 2019 10:41:33 -0700 (PDT) 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=@ti.com header.s=ti-com-17Q1 header.b=pwS9sX18; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2443127AbfIYRlc (ORCPT + 26 others); Wed, 25 Sep 2019 13:41:32 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:58586 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2443057AbfIYRla (ORCPT ); Wed, 25 Sep 2019 13:41:30 -0400 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x8PHfHkm055232; Wed, 25 Sep 2019 12:41:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1569433277; bh=rE1raxC4CYcOMBpyDcOR0IFq0FY0PvxtcY0Jb3Au5oc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=pwS9sX18bOWcE+7+tfpICmUYcGy/BGbBD6V2iaOnd/ffcrzzYEkgrvGcMU3zCc9sp sleN9lp67S7y381PR7LtvphYdF5OA6lXEsbRhYgpWpPs0g5GaXhWgMlfKaRVcVmrKK LwnMPlMGDhH6tLPjGla59pA7CmwBMOUAdjb8AtbE= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x8PHfHwR048357 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 25 Sep 2019 12:41:17 -0500 Received: from DLEE101.ent.ti.com (157.170.170.31) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Wed, 25 Sep 2019 12:41:17 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Wed, 25 Sep 2019 12:41:10 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id x8PHfGrg129626; Wed, 25 Sep 2019 12:41:17 -0500 From: Dan Murphy To: , CC: , , Dan Murphy , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team Subject: [PATCH v9 11/15] ARM: dts: imx6dl-yapp4: Add reg property to the lp5562 channel node Date: Wed, 25 Sep 2019 12:46:12 -0500 Message-ID: <20190925174616.3714-12-dmurphy@ti.com> X-Mailer: git-send-email 2.22.0.214.g8dca754b1e In-Reply-To: <20190925174616.3714-1-dmurphy@ti.com> References: <20190925174616.3714-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add the reg property to each channel node. This update is to accomodate the multicolor framework. In addition to the accomodation this allows the LEDs to be placed on any channel and allow designs to skip channels as opposed to requiring sequential order. Signed-off-by: Dan Murphy CC: Shawn Guo CC: Sascha Hauer CC: Pengutronix Kernel Team CC: Fabio Estevam CC: NXP Linux Team --- arch/arm/boot/dts/imx6dl-yapp4-common.dtsi | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.22.0.214.g8dca754b1e diff --git a/arch/arm/boot/dts/imx6dl-yapp4-common.dtsi b/arch/arm/boot/dts/imx6dl-yapp4-common.dtsi index e8d800fec637..cafc99fce1ba 100644 --- a/arch/arm/boot/dts/imx6dl-yapp4-common.dtsi +++ b/arch/arm/boot/dts/imx6dl-yapp4-common.dtsi @@ -257,29 +257,35 @@ reg = <0x30>; clock-mode = /bits/ 8 <1>; status = "disabled"; + #address-cells = <1>; + #size-cells = <0>; chan0 { chan-name = "R"; led-cur = /bits/ 8 <0x20>; max-cur = /bits/ 8 <0x60>; + reg = <0>; }; chan1 { chan-name = "G"; led-cur = /bits/ 8 <0x20>; max-cur = /bits/ 8 <0x60>; + reg = <1>; }; chan2 { chan-name = "B"; led-cur = /bits/ 8 <0x20>; max-cur = /bits/ 8 <0x60>; + reg = <2>; }; chan3 { chan-name = "W"; led-cur = /bits/ 8 <0x0>; max-cur = /bits/ 8 <0x0>; + reg = <3>; }; }; From patchwork Wed Sep 25 17:46:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 174393 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp944700ill; Wed, 25 Sep 2019 10:41:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqzsEdFxTS3e7CwDG62fHUmiDqotLcISVE2/VqltG9dv+6Qld/Ukjf22uWb5MuDgbqr3lxR5 X-Received: by 2002:aa7:d2c4:: with SMTP id k4mr4153967edr.169.1569433316598; Wed, 25 Sep 2019 10:41:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569433316; cv=none; d=google.com; s=arc-20160816; b=m+F+Ju41QQF52soD/DcXStodeu3w3jzOZnYLZPS9ppKZds4ySYugBOTwqQB+zmz8kl ycvoSwTqFugT9TQzeQcpvF0NZAUOv9SNJL0rhg/0uKsQ027DFlM4r5MInI8oBycAUPeC gEgOTLDshiMNOcFfGo4XQTS4dDqlx606abE7gO1f9udO70GoIzIe9xTFZtvcP4onkxsI pgsmmIM7sMgu5+JvtujW0fg/utgZMk9+dF6TZLOFMa2nHK4qPrkAYZlgL5Kr49xEs7wN T2FMtahw699HfS7lDyJaQhQqw+3AeTFPrp5/GEFOy1yzqQ18oFYrqyWldXC0mICJrI57 fkrQ== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4LhcgeUfJAn2h75rby25zkuWdixhqLyxVWqBzwl6Yac=; b=ByCos1LFLjhvYS3FwGHBxUnzf8EfpCyxWK8vuWkjTdW5tvbSmGoBgpmO5nH+j4me/h +oM2Jb8IjTsCtDOXe8Lkvdw5FvL7xKADvK+VqxsMa58zO0A6dbflc+UoWNY+cMPUdR14 5ybZRVTtciN9fwD/ikoO5Xe8pM7foJsXn1/dnhPyg18vDyFvZeizRDY67TdefB2Z7li1 YH+jXOHOGBlYIw4riVkjcEg7juIWeaGYzPfyyWEg0IGb+49nBDjCUtSwfzknTwXzlQtk mLoiwjhMyAbBeA0haEqXJfJCrWLNd48cWEcrT5u5oRNFrgzW64UCd0KLCP/6JvzB7kd2 odmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Cr143Wua; 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=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 r16si3496623edo.307.2019.09.25.10.41.56; Wed, 25 Sep 2019 10:41:56 -0700 (PDT) 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=@ti.com header.s=ti-com-17Q1 header.b=Cr143Wua; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2443074AbfIYRlX (ORCPT + 26 others); Wed, 25 Sep 2019 13:41:23 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:50758 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2440145AbfIYRlV (ORCPT ); Wed, 25 Sep 2019 13:41:21 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x8PHfIJO029470; Wed, 25 Sep 2019 12:41:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1569433278; bh=4LhcgeUfJAn2h75rby25zkuWdixhqLyxVWqBzwl6Yac=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Cr143WuaWrc2kNw6OxBGZvxVrI/z+rwptCvn6snPHcOXU8RQox5mYpi5WI4SPZxof hQEXXMRm79ffjhXoo3oV9maxKDqTZcPV9YkVtulaP9qXOM2p2XkNFbY+QFRV3JsKzM 60QEh3Z1X3ffi3voROajlUoDD0qn9lysHLj23y/w= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x8PHfIr6013961 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 25 Sep 2019 12:41:18 -0500 Received: from DLEE110.ent.ti.com (157.170.170.21) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Wed, 25 Sep 2019 12:41:10 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Wed, 25 Sep 2019 12:41:17 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id x8PHfH1F129637; Wed, 25 Sep 2019 12:41:17 -0500 From: Dan Murphy To: , CC: , , Dan Murphy Subject: [PATCH v9 14/15] leds: lp55xx: Fix checkpatch file permissions issues Date: Wed, 25 Sep 2019 12:46:15 -0500 Message-ID: <20190925174616.3714-15-dmurphy@ti.com> X-Mailer: git-send-email 2.22.0.214.g8dca754b1e In-Reply-To: <20190925174616.3714-1-dmurphy@ti.com> References: <20190925174616.3714-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix the checkpatch warnings for the use of the file permission macros. In converting the file permissions to the DEVICE_ATTR_XX macros the call back function names needed to be updated within the code. This means that the lp55xx_ needed to be dropped in the name to keep in harmony with the ABI documentation. Signed-off-by: Dan Murphy --- drivers/leds/leds-lp55xx-common.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) -- 2.22.0.214.g8dca754b1e diff --git a/drivers/leds/leds-lp55xx-common.c b/drivers/leds/leds-lp55xx-common.c index 0e4b3a9d3047..6f220050fa9d 100644 --- a/drivers/leds/leds-lp55xx-common.c +++ b/drivers/leds/leds-lp55xx-common.c @@ -78,7 +78,7 @@ static int lp55xx_post_init_device(struct lp55xx_chip *chip) return cfg->post_init_device(chip); } -static ssize_t lp55xx_show_current(struct device *dev, +static ssize_t led_current_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -87,7 +87,7 @@ static ssize_t lp55xx_show_current(struct device *dev, return scnprintf(buf, PAGE_SIZE, "%d\n", led->led_current); } -static ssize_t lp55xx_store_current(struct device *dev, +static ssize_t led_current_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t len) { @@ -111,7 +111,7 @@ static ssize_t lp55xx_store_current(struct device *dev, return len; } -static ssize_t lp55xx_show_max_current(struct device *dev, +static ssize_t max_current_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -120,9 +120,8 @@ static ssize_t lp55xx_show_max_current(struct device *dev, return scnprintf(buf, PAGE_SIZE, "%d\n", led->max_current); } -static DEVICE_ATTR(led_current, S_IRUGO | S_IWUSR, lp55xx_show_current, - lp55xx_store_current); -static DEVICE_ATTR(max_current, S_IRUGO , lp55xx_show_max_current, NULL); +static DEVICE_ATTR_RW(led_current); +static DEVICE_ATTR_RO(max_current); static struct attribute *lp55xx_led_attrs[] = { &dev_attr_led_current.attr, @@ -262,7 +261,7 @@ static int lp55xx_request_firmware(struct lp55xx_chip *chip) GFP_KERNEL, chip, lp55xx_firmware_loaded); } -static ssize_t lp55xx_show_engine_select(struct device *dev, +static ssize_t select_engine_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -272,7 +271,7 @@ static ssize_t lp55xx_show_engine_select(struct device *dev, return sprintf(buf, "%d\n", chip->engine_idx); } -static ssize_t lp55xx_store_engine_select(struct device *dev, +static ssize_t select_engine_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t len) { @@ -314,7 +313,7 @@ static inline void lp55xx_run_engine(struct lp55xx_chip *chip, bool start) chip->cfg->run_engine(chip, start); } -static ssize_t lp55xx_store_engine_run(struct device *dev, +static ssize_t run_engine_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t len) { @@ -339,9 +338,8 @@ static ssize_t lp55xx_store_engine_run(struct device *dev, return len; } -static DEVICE_ATTR(select_engine, S_IRUGO | S_IWUSR, - lp55xx_show_engine_select, lp55xx_store_engine_select); -static DEVICE_ATTR(run_engine, S_IWUSR, NULL, lp55xx_store_engine_run); +static DEVICE_ATTR_RW(select_engine); +static DEVICE_ATTR_WO(run_engine); static struct attribute *lp55xx_engine_attributes[] = { &dev_attr_select_engine.attr, From patchwork Wed Sep 25 17:46:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 174396 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp944900ill; Wed, 25 Sep 2019 10:42:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqywelwm2fjAEAhDBACE9dxkxAOOCfqFqIlqbBaGZKgqdSSk4BwqczicHeLWB56vFPr535yY X-Received: by 2002:a50:918d:: with SMTP id g13mr4259205eda.64.1569433329011; Wed, 25 Sep 2019 10:42:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569433329; cv=none; d=google.com; s=arc-20160816; b=GYigL1/0Bb5GCUfogL6dTlzVhzekLrIAqdgRh0HnC5ePCGwl1HOCSqhWLonDAKLtKA LOH601aezub6Lzd0XuNhQjIZb6QPZtoYM822eKAlMjs5Juce2ge27TA5YQ16sLxQNCWL lH5mMPnffZ73ctLPmPOToyVOrOpmSmH052hdkLQX77FxnQZH/wFKYxheh39tZT7FBm/S 8bg5r6xVG9ukUK55sVUj+xYHlHyOYZjBJPsxouyl+Xb7n1EIToBFQ7367FDvk6/oDE2C kNBdbvkqFzjIiPHAtw+g7uNh/rXmq9CiFfcqiXTe+fc/lFiZ37vnsd5kEmAD0/gW4/HR p9Uw== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qZXobCQEdxdBf8db4ptHqKRRbgiuP+MZ7ubiK/z5XQY=; b=pql0ZuQmMKiKRpsyk6qflbKcsWmUcFfVLTYBq3aWPRRkkVJrFSPtTi52WRbWIETUXc FADhgzAZjKp5T/YsoARXvTFydzGb/3LSS027Eudr0jbX2x3uPIYoNnE8ZsG0Z++nA4jI 4lhBZ3trUhdLTRfxz3s0yt/MhGoi6UIjU0eM4yBa6kn6AuHb0BBnY67+wgO/7E0YxSG+ gsUp6UxFbx05rsUlEQRQGuempiYoHDHz70xbiD231HTu5VU/jX2cfv8O6dzpdYwMeVe+ H2p3gXVGMHieAW5WKO4AY+3CTk9eCB0LkLlE41wFZpSMJvEjtc7WIiBxIsvJvlc0VQ9T MONw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ZaN1oH2b; 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=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 x15si3838732eda.53.2019.09.25.10.42.08; Wed, 25 Sep 2019 10:42:08 -0700 (PDT) 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=@ti.com header.s=ti-com-17Q1 header.b=ZaN1oH2b; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2408379AbfIYRmH (ORCPT + 26 others); Wed, 25 Sep 2019 13:42:07 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:50752 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2437639AbfIYRlV (ORCPT ); Wed, 25 Sep 2019 13:41:21 -0400 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x8PHfI39029475; Wed, 25 Sep 2019 12:41:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1569433278; bh=qZXobCQEdxdBf8db4ptHqKRRbgiuP+MZ7ubiK/z5XQY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ZaN1oH2bQ2F4YwUSmH6sYGXLP/CBdmiwbyucge/XV0QFyUIrcyGOm/2NN7xQpxumz /eiC2cNnBNavJDyB9U4U1ZybT2891kKEFeXBrMuKyCwonEYRHETMeyG6nhaRbQxgyD Vo3em8WkXqFnAB6hguz2kuyDgNBQsCDyi368KDsE= Received: from DFLE115.ent.ti.com (dfle115.ent.ti.com [10.64.6.36]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x8PHfIGR000378 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 25 Sep 2019 12:41:18 -0500 Received: from DFLE107.ent.ti.com (10.64.6.28) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Wed, 25 Sep 2019 12:41:11 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE107.ent.ti.com (10.64.6.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Wed, 25 Sep 2019 12:41:10 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x8PHfHr3045690; Wed, 25 Sep 2019 12:41:17 -0500 From: Dan Murphy To: , CC: , , Dan Murphy Subject: [PATCH v9 15/15] leds: lp5523: Fix checkpatch issues in the code Date: Wed, 25 Sep 2019 12:46:16 -0500 Message-ID: <20190925174616.3714-16-dmurphy@ti.com> X-Mailer: git-send-email 2.22.0.214.g8dca754b1e In-Reply-To: <20190925174616.3714-1-dmurphy@ti.com> References: <20190925174616.3714-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix checkpatch errors and warnings for the LP5523.c device driver. Signed-off-by: Dan Murphy --- drivers/leds/leds-lp5523.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) -- 2.22.0.214.g8dca754b1e diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c index 8b2cdb98fed6..c4a94903f8c4 100644 --- a/drivers/leds/leds-lp5523.c +++ b/drivers/leds/leds-lp5523.c @@ -23,13 +23,13 @@ #define LP5523_PROGRAM_LENGTH 32 /* bytes */ /* Memory is used like this: - 0x00 engine 1 program - 0x10 engine 2 program - 0x20 engine 3 program - 0x30 engine 1 muxing info - 0x40 engine 2 muxing info - 0x50 engine 3 muxing info -*/ + * 0x00 engine 1 program + * 0x10 engine 2 program + * 0x20 engine 3 program + * 0x30 engine 1 muxing info + * 0x40 engine 2 muxing info + * 0x50 engine 3 muxing info + */ #define LP5523_MAX_LEDS 9 /* Registers */ @@ -326,7 +326,7 @@ static int lp5523_update_program_memory(struct lp55xx_chip *chip, const u8 *data, size_t size) { u8 pattern[LP5523_PROGRAM_LENGTH] = {0}; - unsigned cmd; + unsigned int cmd; char c[3]; int nrchars; int ret; @@ -468,6 +468,7 @@ static int lp5523_mux_parse(const char *buf, u16 *mux, size_t len) static void lp5523_mux_to_array(u16 led_mux, char *array) { int i, pos = 0; + for (i = 0; i < LP5523_MAX_LEDS; i++) pos += sprintf(array + pos, "%x", LED_ACTIVE(led_mux, i)); @@ -506,7 +507,7 @@ static int lp5523_load_mux(struct lp55xx_chip *chip, u16 mux, int nr) if (ret) return ret; - ret = lp55xx_write(chip, LP5523_REG_PROG_MEM , (u8)(mux >> 8)); + ret = lp55xx_write(chip, LP5523_REG_PROG_MEM, (u8)(mux >> 8)); if (ret) return ret;