From patchwork Thu May 23 19:08: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: 165065 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp2645892ili; Thu, 23 May 2019 12:51:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqwk7VwwSRQPCnS5R+BMNlFRqvzN4kuyqf2uKtRN1lwhweH8+dd+BPgVTYOQz9QYNE/F32m0 X-Received: by 2002:a63:e706:: with SMTP id b6mr6933214pgi.90.1558641088404; Thu, 23 May 2019 12:51:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558641088; cv=none; d=google.com; s=arc-20160816; b=xnbhzllp4bgQkBr3dsoHxirHozDLnyhORkIL5iAC+QVRS8UJNZ07GO3LjRx4g0VfeJ 645pkRlUKL2MSTSHBGIhFm7EfFnGjdZjHPteE1FaduRifEhqXYppCbckF41FQ7sfXf5n 8qz9+PaeDPWASZwKYaQDMLyjEDYs6tNyE2Lk8jNIKhBRzsNd9XCdfTU/xrOFyxaw6PkI sqAZT+k42KaUBzE9r8X37x/tGHjoaIQm3LqMblXt699m4S6YebAWHftFxcOur3hpepzc lr3xQxFHapcEiShuB06aYO6V49oYIKsw9Uv0NTgafwMZLsQdDqYwAGFWQlfuo9+uSatK bAgw== 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=n5ieitO5auRi1g1b8vCdK13uEPku9s5t3nKY1zvO/Yw=; b=I5ACbmzfLLmj2X7dRbOMX+U0Lp3fWZ50irtJIyj3HFyIkwOqaCFJTUX9PLFVqu7wxL eyKJVXMjPwc1eZ4cgpPhjb96KhG5A+L4rqEoQtM+iQ3BnsMp8oIMqY5Q4q+K/W7WEhtf aL1SmjSDTe8GGalsS4/z50s/HC9sG/ybVpihtGNnGHHHA9kiNTGGcIYfBb7VZ6ibltS7 CnYPashYKm8Pyrfgr39CUwHKssiK75AoObOaR430tsnXRxNf0k78b8kqZZd9MWtwa5Ft IcFtxDHQBnV47sAYbgMoCIlEm8UVzNFGXlB1FBhXE+Iui99zwG8r5ZA9aISfK4HGFIkg eOlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=na7fkr11; spf=pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-leds-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bo1si485857pjb.66.2019.05.23.12.51.28; Thu, 23 May 2019 12:51:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=na7fkr11; spf=pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-leds-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387781AbfEWTv1 (ORCPT + 1 other); Thu, 23 May 2019 15:51:27 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:52944 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731851AbfEWTIn (ORCPT ); Thu, 23 May 2019 15:08:43 -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 x4NJ8bbb065636; Thu, 23 May 2019 14:08:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1558638517; bh=n5ieitO5auRi1g1b8vCdK13uEPku9s5t3nKY1zvO/Yw=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=na7fkr11Rn6UB3EO9U942sFWrZu6vUo0tmOteQUSanT/3EeJ9sOXqyp6rqVf7VzJe Dem44kmCiMlzpetcur+HFkfPn2qjER4BluFP1QCdpq87xLHl3bB9LiYPy4YxgYbx2P YbQMx7Nr2qM1j06IqFxndgjZo6BD3nwZZjFZ5/sE= Received: from DFLE108.ent.ti.com (dfle108.ent.ti.com [10.64.6.29]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x4NJ8bB6043180 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 23 May 2019 14:08:37 -0500 Received: from DFLE111.ent.ti.com (10.64.6.32) by DFLE108.ent.ti.com (10.64.6.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Thu, 23 May 2019 14:08:36 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) 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 via Frontend Transport; Thu, 23 May 2019 14:08:36 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id x4NJ8aNL071426; Thu, 23 May 2019 14:08:36 -0500 From: Dan Murphy To: , , CC: , , , Dan Murphy Subject: [PATCH v3 1/9] leds: multicolor: Add sysfs interface definition Date: Thu, 23 May 2019 14:08:12 -0500 Message-ID: <20190523190820.29375-2-dmurphy@ti.com> X-Mailer: git-send-email 2.21.0.5.gaeb582a983 In-Reply-To: <20190523190820.29375-1-dmurphy@ti.com> References: <20190523190820.29375-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-leds-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org Add a documentation of LED Multicolor LED class specific sysfs attributes. Signed-off-by: Dan Murphy --- .../ABI/testing/sysfs-class-led-multicolor | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-led-multicolor -- 2.21.0.5.gaeb582a983 diff --git a/Documentation/ABI/testing/sysfs-class-led-multicolor b/Documentation/ABI/testing/sysfs-class-led-multicolor new file mode 100644 index 000000000000..2f102ede258b --- /dev/null +++ b/Documentation/ABI/testing/sysfs-class-led-multicolor @@ -0,0 +1,57 @@ +What: /sys/class/leds//colors/sync_enable +Date: April 2019 +KernelVersion: 5.2 +Contact: Dan Murphy +Description: read/write + Writing a 1 to this file will enable the synchronization of all + the defined color LEDs within the LED node. Brightness values + for each LED will be stored and written when sync is set to 1. + Writing a 0 to this file will disable syncing and allow + individual control of the LEDs brightness settings. + +What: /sys/class/leds//colors/sync +Date: April 2019 +KernelVersion: 5.2 +Contact: Dan Murphy +Description: write only + Writing a 1 to this file while sync_enable is set to 1 will + write the current brightness values to all defined LEDs within + the LED node. All LEDs defined will be configured based + on the brightness that has been requested. + + If sync_enable is set to 0 then writing a 1 to sync has no + affect on the LEDs. + +What: /sys/class/leds//colors//brightness +Date: April 2019 +KernelVersion: 5.2 +Contact: Dan Murphy +Description: read/write + The led_color directory is dynamically created based on the + colors defined by the registrar of the class. + The led_color can be but not limited to red, green, blue, + white, amber, yellow and violet. Drivers can also declare a + LED color for presentation. There is one directory per color + presented. The brightness file is created under each + led_color directory and controls the individual LED color + setting. + + If sync is enabled then writing the brightness value of the LED + is deferred until a 1 is written to + /sys/class/leds//color/sync. If syncing is + disabled then the LED brightness value will be written + immediately to the LED driver. + + The value of the color is from 0 to + /sys/class/leds//colors//max_brightness. + +What: /sys/class/leds//colors//max_brightness +Date: April 2019 +KernelVersion: 5.2 +Contact: Dan Murphy +Description: read only + Maximum brightness level for the LED color, default is + 255 (LED_FULL). + + If the LED does not support different brightness levels, this + should be 1. From patchwork Thu May 23 19:08: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: 165070 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp2646396ili; Thu, 23 May 2019 12:52:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqyxfks5iIkRZaFJQUau6X4Wxws9t2iiOnyhOgeo+G7qk4uVHM2x+qFo5l29HTPiFZUnhIFp X-Received: by 2002:a17:90a:9f44:: with SMTP id q4mr3670923pjv.83.1558641121941; Thu, 23 May 2019 12:52:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558641121; cv=none; d=google.com; s=arc-20160816; b=odmuxera6ZNz8E5oXwX9flHy7+POD4foP2Grj7HKRPWLET6A/PKcyx4wwahgy6KWTb cONOAHzTIh83c1FRqAVWNsYrLm0MA/9az2C0cDe+WK7zP8JMQnJwbd92y+ninwGb3f0V 07aH3fa12ZwnSKkzEveZFC31B+3vPhfTT7unteCX/AWB4fMCWtnLIzFpDNvnzsBaAPEB 725ofABGM2JTV7Ipl2lvR2fFuEQmymen8mVbkPyVb7wxmEKmbObsHRX5k/GAN9dkHMAi 5lt+50qtbYN+6kz5AGp1KNbIvmr0iVi0mtxb2Eon3vRGDXkIOOpeio7JLPTyDS7lrykf bdZw== 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=C9GGDpT/HCR8wHHiGobavLLm9veC0TrECKEglvQZZXg=; b=XKAJaNzc+OOZL2saE2Z7Ry5eISbvXN0gTwvaZYwbdnAmhoiRmKWiYWJjAcW0omX1tN iQ804/WPW4JLmr3H+1UcsY5l4dyaFdNlUaRIpyBqYoFabX1p6nwYfNLfAZ/UJOg36WbE j4x5Jti5JszORlR0kkftEuvgDjfBrKd+YV6404bdNrxCuNPmjp9O9VHTld96AnTpwT8S FPOKTEPppnm5EdpOmIdPadFiA7fXq1xHc8kWtLBnrL1T+sUx65reQziUBOJWs8dX6ejx xNL1VK9DrF6jRFHciDJyRgo6r8NSeRc1JROPuASqUgwt1tVDsK9pzOxtKKPNei77q1rI UWhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=pm9unagI; spf=pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-leds-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j7si678842pgp.126.2019.05.23.12.52.01; Thu, 23 May 2019 12:52:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=pm9unagI; spf=pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-leds-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731764AbfEWTwB (ORCPT + 1 other); Thu, 23 May 2019 15:52:01 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:56295 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731842AbfEWTIm (ORCPT ); Thu, 23 May 2019 15:08:42 -0400 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x4NJ8cMl092490; Thu, 23 May 2019 14:08:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1558638518; bh=C9GGDpT/HCR8wHHiGobavLLm9veC0TrECKEglvQZZXg=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=pm9unagI50bQl0hJeSBsiZCrRP7gFr3Vn8A2dg+NN/V0VRcimOEY6HZO6fnr+mrd0 8l0sftm+jQhiv/pFn3xlb9IKaSa+6Pxh2d/HmFrieHNZwCpdJgIvLg63ZXOes8j6yA Gtnd+KF5E6OPL1cIBaW6cJD8mC8xW+JStrE5BggE= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x4NJ8cPC003822 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 23 May 2019 14:08:38 -0500 Received: from DLEE104.ent.ti.com (157.170.170.34) 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; Thu, 23 May 2019 14:08:37 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE104.ent.ti.com (157.170.170.34) 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; Thu, 23 May 2019 14:08:37 -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 x4NJ8bDv022839; Thu, 23 May 2019 14:08:37 -0500 From: Dan Murphy To: , , CC: , , , Dan Murphy Subject: [PATCH v3 4/9] dt-bindings: leds: Add multicolor ID to the color ID list Date: Thu, 23 May 2019 14:08:15 -0500 Message-ID: <20190523190820.29375-5-dmurphy@ti.com> X-Mailer: git-send-email 2.21.0.5.gaeb582a983 In-Reply-To: <20190523190820.29375-1-dmurphy@ti.com> References: <20190523190820.29375-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-leds-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org 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 --- include/dt-bindings/leds/common.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.21.0.5.gaeb582a983 Reviewed-by: Rob Herring diff --git a/include/dt-bindings/leds/common.h b/include/dt-bindings/leds/common.h index d8c8c38700bd..259cea653844 100644 --- a/include/dt-bindings/leds/common.h +++ b/include/dt-bindings/leds/common.h @@ -65,6 +65,7 @@ #define LED_COLOR_ID_VIOLET 5 #define LED_COLOR_ID_YELLOW 6 #define LED_COLOR_ID_IR 7 -#define LED_COLOR_ID_COUNT 8 +#define LED_COLOR_ID_MULTI 8 +#define LED_COLOR_ID_COUNT 9 #endif /* __DT_BINDINGS_LEDS_H */ From patchwork Thu May 23 19:08:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 165066 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp2645918ili; Thu, 23 May 2019 12:51:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqyD2b6jXY08Xz/0U51qa1DZka2mKIMC2nYbI3SH8OJvKwWs6fTXYdqUZ8NRDYji+Z4R8vmC X-Received: by 2002:a17:902:a70f:: with SMTP id w15mr30951624plq.222.1558641089828; Thu, 23 May 2019 12:51:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558641089; cv=none; d=google.com; s=arc-20160816; b=iHl5rzwtg72mWtdK6eq0Z/I5hP1BrvywoxDUB1J5lgxTzd+lo/OENSyhYVqzrhyVBg qVuLfZxXMCeYScPmDHiN8E4jCvC0nBP7xPyjfb4cmKRsHJKk9uFC8N0SaF9iRKhwlEPU DjMBBCSjqnaFqKSE0eRfm51AURvbwOp+LmNL5zJlrKn+h/dg/9zffAsUD7cR+fBWA1bf Reseuan+SXaYnUZ2v0wK9esJMM2nW0TZH0GBF0EYHK973zoUsMEV+KA8jmuKAAsnpeWq 1mJncfP3OTrr+guPC+5Ze2CnPh+aRZYs17nUpkOiGpDMJatZ+7kUG2Rl94m0fEfp/Ijy cMQA== 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=K0QUxADDhzWMhFnBQF79VmvK/sQNpf3Di4j9Sp4aFeI=; b=LM0VmK/iRc9Rm+wrBg7z4kJVWeaGKTPxwyntGCcCHJNmjGcdNtQ7R7T68yV72LqEoV b0chFmKsGpPRcBzWW7frBaf8xDCXWM+DbMJSa84t3vhcuFPspSIGI43gD6TBuepC28lY rytmjgas+WF82sTRKySdLJx0OMGScduyt9XRRBTd8igZxg5iHkp1cQOFcXTJw0eyM59L YWm3ldu5pPlxwDSDHygz0I1CTjyzcb5dIGzKCACWV/cd4+3alT9XkuxePKExfWREwzrG 7GU63ax3anyWpmkCLlxiQKfakikcx/Y06NSF79Fjqxc4T13KgidjyxhU+a8BETdyt0RH ITpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=A0sngGmG; spf=pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-leds-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bo1si485857pjb.66.2019.05.23.12.51.29; Thu, 23 May 2019 12:51:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=A0sngGmG; spf=pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-leds-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388114AbfEWTv2 (ORCPT + 1 other); Thu, 23 May 2019 15:51:28 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:56300 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731843AbfEWTIn (ORCPT ); Thu, 23 May 2019 15:08:43 -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 x4NJ8cHu092494; Thu, 23 May 2019 14:08:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1558638518; bh=K0QUxADDhzWMhFnBQF79VmvK/sQNpf3Di4j9Sp4aFeI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=A0sngGmGOJtfXhCysb9DhMe8dy+DY64nFF9jrkOBdh4VbJUGJrqMNa72HH32LT7/C tfMHZ9PnCC50U9coQ1b99P4+oV9EkqWaugdrofVyLTliEvtc6dTE2W/LziL9qTxvDN 1+p9jQhoAMsLfkhvTBV283EnP4oHatR09+OvQjK0= Received: from DFLE115.ent.ti.com (dfle115.ent.ti.com [10.64.6.36]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x4NJ8cPC079038 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 23 May 2019 14:08:38 -0500 Received: from DFLE104.ent.ti.com (10.64.6.25) 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; Thu, 23 May 2019 14:08:38 -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; Thu, 23 May 2019 14:08:38 -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 x4NJ8bHJ095922; Thu, 23 May 2019 14:08:37 -0500 From: Dan Murphy To: , , CC: , , , Dan Murphy Subject: [PATCH v3 6/9] leds: multicolor: Introduce a multicolor class definition Date: Thu, 23 May 2019 14:08:17 -0500 Message-ID: <20190523190820.29375-7-dmurphy@ti.com> X-Mailer: git-send-email 2.21.0.5.gaeb582a983 In-Reply-To: <20190523190820.29375-1-dmurphy@ti.com> References: <20190523190820.29375-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-leds-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org Introduce a multicolor class that groups colored LEDs within a LED node. The framework allows for dynamically setting individual LEDs or setting brightness levels of LEDs and updating them virtually simultaneously. Signed-off-by: Dan Murphy --- drivers/leds/Kconfig | 10 + drivers/leds/Makefile | 1 + drivers/leds/led-class-multicolor.c | 421 +++++++++++++++++++++++++++ include/linux/led-class-multicolor.h | 95 ++++++ 4 files changed, 527 insertions(+) create mode 100644 drivers/leds/led-class-multicolor.c create mode 100644 include/linux/led-class-multicolor.h -- 2.21.0.5.gaeb582a983 diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index 0414adebb177..0696a13c9527 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -29,6 +29,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 4c1b0054f379..c57c2aec9510 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..3f989e552d09 --- /dev/null +++ b/drivers/leds/led-class-multicolor.c @@ -0,0 +1,421 @@ +// 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 "leds.h" + +struct led_classdev_mc_priv { + struct led_classdev_mc *mcled_cdev; + + struct device_attribute max_brightness_attr; + struct device_attribute brightness_attr; + + enum led_brightness max_brightness; + enum led_brightness brightness; + enum led_brightness new_brightness; + struct list_head list; + + int color_id; +}; + +static ssize_t sync_store(struct device *dev, + struct device_attribute *sync_attr, + const char *buf, size_t size) +{ + struct led_classdev_mc_data *data = container_of(sync_attr, + struct led_classdev_mc_data, + sync_attr); + struct led_classdev_mc *mcled_cdev = data->mcled_cdev; + struct led_classdev *led_cdev = &mcled_cdev->led_cdev; + struct led_classdev_mc_priv *priv; + unsigned long sync_value; + ssize_t ret = -EINVAL; + + mutex_lock(&led_cdev->led_access); + + if (!mcled_cdev->sync_enabled) + goto unlock; + + ret = kstrtoul(buf, 0, &sync_value); + if (ret) + goto unlock; + + if (!sync_value) { + ret = size; + goto unlock; + } + + list_for_each_entry(priv, &data->color_list, list) + priv->brightness = priv->new_brightness; + + ret = size; +unlock: + mutex_unlock(&led_cdev->led_access); + return ret; +} + +static ssize_t sync_enable_store(struct device *dev, + struct device_attribute *sync_enable_attr, + const char *buf, size_t size) +{ + struct led_classdev_mc_data *data = container_of(sync_enable_attr, + struct led_classdev_mc_data, + sync_enable_attr); + struct led_classdev_mc *mcled_cdev = data->mcled_cdev; + struct led_classdev *led_cdev = &mcled_cdev->led_cdev; + unsigned long sync_value; + ssize_t ret; + + mutex_lock(&led_cdev->led_access); + + ret = kstrtoul(buf, 0, &sync_value); + if (ret) + goto unlock; + + mcled_cdev->sync_enabled = sync_value; + + ret = size; +unlock: + mutex_unlock(&led_cdev->led_access); + return ret; +} + +static ssize_t sync_enable_show(struct device *dev, + struct device_attribute *sync_enable_attr, + char *buf) +{ + struct led_classdev_mc_data *data = container_of(sync_enable_attr, + struct led_classdev_mc_data, + sync_enable_attr); + struct led_classdev_mc *mcled_cdev = data->mcled_cdev; + + return sprintf(buf, "%d\n", mcled_cdev->sync_enabled); +} + +static ssize_t brightness_store(struct device *dev, + struct device_attribute *brightness_attr, + const char *buf, size_t size) +{ + struct led_classdev_mc_priv *priv = container_of(brightness_attr, + struct led_classdev_mc_priv, + brightness_attr); + struct led_classdev *led_cdev = &priv->mcled_cdev->led_cdev; + struct led_multicolor_ops *ops = priv->mcled_cdev->ops; + + 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_brightness) { + ret = -EINVAL; + goto unlock; + } + + priv->new_brightness = value; + + if (priv->mcled_cdev->sync_enabled) { + ret = size; + goto unlock; + } + + ret = ops->set_color_brightness(priv->mcled_cdev, + priv->color_id, value); + if (ret < 0) + goto unlock; + + priv->brightness = priv->new_brightness; + + ret = size; +unlock: + mutex_unlock(&led_cdev->led_access); + return ret; +} + +static ssize_t brightness_show(struct device *dev, + struct device_attribute *brightness_attr, + char *buf) +{ + struct led_classdev_mc_priv *priv = container_of(brightness_attr, + struct led_classdev_mc_priv, + brightness_attr); + const struct led_multicolor_ops *ops = priv->mcled_cdev->ops; + int value = 0; + + if (priv->mcled_cdev->sync_enabled) { + value = priv->brightness; + goto sync_enabled; + } + + if (ops->get_color_brightness) { + value = ops->get_color_brightness(priv->mcled_cdev, + priv->color_id); + priv->brightness = value; + } else { + value = priv->brightness; + } + +sync_enabled: + return sprintf(buf, "%d\n", value); +} + +static ssize_t max_brightness_show(struct device *dev, + struct device_attribute *max_brightness_attr, + char *buf) +{ + struct led_classdev_mc_priv *priv = container_of(max_brightness_attr, + struct led_classdev_mc_priv, + max_brightness_attr); + + return sprintf(buf, "%d\n", priv->max_brightness); +} + +static int multicolor_set_brightness(struct led_classdev *led_cdev, + enum led_brightness brightness) +{ + struct led_classdev_mc *mcled_cdev = lcdev_to_mccdev(led_cdev); + struct led_classdev_mc_data *data = mcled_cdev->data; + struct led_multicolor_ops *ops = mcled_cdev->ops; + struct led_classdev_mc_priv *priv; + unsigned long state = brightness; + int adj_value; + ssize_t ret = -EINVAL; + + mutex_lock(&led_cdev->led_access); + + if (ops->set_module_brightness) { + ret = ops->set_module_brightness(mcled_cdev, state); + goto unlock; + } + + list_for_each_entry(priv, &data->color_list, list) { + if (state && priv->brightness && priv->max_brightness) { + adj_value = state * ((priv->brightness * 100) / priv->max_brightness); + adj_value = adj_value / 100; + } else + adj_value = LED_OFF; + + ret = ops->set_color_brightness(priv->mcled_cdev, + priv->color_id, adj_value); + if (ret < 0) + goto unlock; + } + +unlock: + mutex_unlock(&led_cdev->led_access); + return ret; +} + +static int led_multicolor_init_color(struct led_classdev_mc_data *data, + struct led_classdev_mc *mcled_cdev, + int color_id) +{ + struct led_classdev *led_cdev = &mcled_cdev->led_cdev; + struct led_classdev_mc_priv *mc_priv; + int ret; + + mc_priv = devm_kzalloc(led_cdev->dev, sizeof(*mc_priv), GFP_KERNEL); + if (!mc_priv) + return -ENOMEM; + + mc_priv->color_id = color_id; + mc_priv->mcled_cdev = mcled_cdev; + + data->led_kobj = kobject_create_and_add(led_colors[color_id], + data->color_kobj); + if (!data->led_kobj) + return -EINVAL; + + sysfs_attr_init(&mc_priv->brightness_attr.attr); + mc_priv->brightness_attr.attr.name = "brightness"; + mc_priv->brightness_attr.attr.mode = S_IRUGO | S_IWUGO; + mc_priv->brightness_attr.store = brightness_store; + mc_priv->brightness_attr.show = brightness_show; + ret = sysfs_create_file(data->led_kobj, + &mc_priv->brightness_attr.attr); + if (ret) + goto err_out; + + sysfs_attr_init(&mc_priv->max_brightness_attr.attr); + mc_priv->max_brightness_attr.attr.name = "max_brightness"; + mc_priv->max_brightness_attr.attr.mode = S_IRUGO; + mc_priv->max_brightness_attr.show = max_brightness_show; + ret = sysfs_create_file(data->led_kobj, + &mc_priv->max_brightness_attr.attr); + if (ret) + goto err_out; + + mc_priv->max_brightness = LED_FULL; + list_add_tail(&mc_priv->list, &data->color_list); + +err_out: + return ret; +} + +static int led_multicolor_init_color_dir(struct led_classdev_mc_data *data, + struct led_classdev_mc *mcled_cdev) +{ + struct led_classdev *led_cdev = &mcled_cdev->led_cdev; + int ret; + + data->color_kobj = kobject_create_and_add("colors", + &led_cdev->dev->kobj); + if (!data->color_kobj) + return -EINVAL; + + sysfs_attr_init(&data->sync_enable_attr.attr); + data->sync_enable_attr.attr.name = "sync_enable"; + data->sync_enable_attr.attr.mode = S_IRUGO | S_IWUGO; + data->sync_enable_attr.show = sync_enable_show; + data->sync_enable_attr.store = sync_enable_store; + ret = sysfs_create_file(data->color_kobj, + &data->sync_enable_attr.attr); + if (ret) + goto err_out; + + sysfs_attr_init(&data->sync_attr.attr); + data->sync_attr.attr.name = "sync"; + data->sync_attr.attr.mode = S_IWUGO; + data->sync_attr.store = sync_store; + ret = sysfs_create_file(data->color_kobj, + &data->sync_attr.attr); + if (ret) + goto err_out; + + data->mcled_cdev = mcled_cdev; +err_out: + 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; + struct led_multicolor_ops *ops; + struct led_classdev_mc_data *data; + int ret; + int i; + + if (!mcled_cdev) + return -EINVAL; + + ops = mcled_cdev->ops; + if (!ops || !ops->set_color_brightness) + return -EINVAL; + + data = kzalloc(sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + mcled_cdev->data = data; + led_cdev = &mcled_cdev->led_cdev; + + if (led_cdev->brightness_set_blocking) + led_cdev->brightness_set_blocking = multicolor_set_brightness; + + INIT_LIST_HEAD(&data->color_list); + + /* Register led class device */ + ret = led_classdev_register_ext(parent, led_cdev, init_data); + if (ret) + return ret; + + ret = led_multicolor_init_color_dir(data, mcled_cdev); + if (ret) + return ret; + + /* Select the sysfs attributes to be created for the device */ + for (i = 0; i < mcled_cdev->num_leds; i++) { + ret = led_multicolor_init_color(data, mcled_cdev, + mcled_cdev->available_colors[i]); + if (ret) + break; + } + + return ret; +} +EXPORT_SYMBOL_GPL(led_classdev_multicolor_register_ext); + +void led_classdev_multicolor_unregister(struct led_classdev_mc *mcled_cdev) +{ + if (!mcled_cdev) + return; + + led_classdev_unregister(&mcled_cdev->led_cdev); +} +EXPORT_SYMBOL_GPL(led_classdev_multicolor_unregister); + +static void devm_led_classdev_multicolor_release(struct device *dev, void *res) +{ + led_classdev_multicolor_unregister(*(struct led_classdev_mc **)res); +} + +/** + * devm_of_led_classdev_register - resource managed led_classdev_register() + * + * @parent: parent of LED device + * @led_cdev: the led_classdev structure for this device. + */ +int devm_led_classdev_multicolor_register(struct device *parent, + struct led_classdev_mc *mcled_cdev) +{ + struct led_classdev_mc **dr; + int ret; + + dr = devres_alloc(devm_led_classdev_multicolor_release, + sizeof(*dr), GFP_KERNEL); + if (!dr) + return -ENOMEM; + + ret = led_classdev_multicolor_register(parent, mcled_cdev); + if (ret) { + devres_free(dr); + return ret; + } + + *dr = mcled_cdev; + devres_add(parent, dr); + + return 0; +} +EXPORT_SYMBOL_GPL(devm_led_classdev_multicolor_register); + +static int devm_led_classdev_multicolor_match(struct device *dev, + void *res, void *data) +{ + struct mcled_cdev **p = res; + + if (WARN_ON(!p || !*p)) + return 0; + + return *p == data; +} + +/** + * devm_led_classdev_multicolor_unregister() - resource managed + * led_classdev_multicolor_unregister() + * @parent: The device to unregister. + * @mcled_cdev: the led_classdev_mc structure for this device. + */ +void devm_led_classdev_multicolor_unregister(struct device *dev, + struct led_classdev_mc *mcled_cdev) +{ + WARN_ON(devres_release(dev, + devm_led_classdev_multicolor_release, + devm_led_classdev_multicolor_match, mcled_cdev)); +} +EXPORT_SYMBOL_GPL(devm_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..f9e71d984b03 --- /dev/null +++ b/include/linux/led-class-multicolor.h @@ -0,0 +1,95 @@ +// 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_classdev_mc_data { + struct led_classdev_mc *mcled_cdev; + + struct kobject *color_kobj; + struct kobject *led_kobj; + + struct device_attribute sync_attr; + struct device_attribute sync_enable_attr; + + struct list_head color_list; +}; + +struct led_multicolor_ops { + /* Set brightness for a specific color id */ + int (*set_color_brightness)(struct led_classdev_mc *mcled_cdev, + int color_id, int value); + /* Read current color setting */ + int (*get_color_brightness)(struct led_classdev_mc *mcled_cdev, + int color_id); + /* Set brightness for the color module */ + int (*set_module_brightness)(struct led_classdev_mc *mcled_cdev, + int value); + /* Read current module brightness */ + int (*get_module_brightness)(struct led_classdev_mc *mcled_cdev, + int color_id); +}; + +struct led_classdev_mc { + /* led class device */ + struct led_classdev led_cdev; + + /* multicolor led specific ops */ + struct led_multicolor_ops *ops; + + struct led_classdev_mc_data *data; + + u32 available_colors[LED_COLOR_ID_COUNT]; + int num_leds; + + bool sync_enabled; +}; + +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 + */ +extern 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 + */ +extern void led_classdev_multicolor_unregister(struct led_classdev_mc *mcled_cdev); + +extern int devm_led_classdev_multicolor_register(struct device *parent, + struct led_classdev_mc *mcled_cdev); + +extern void devm_led_classdev_multicolor_unregister(struct device *parent, + struct led_classdev_mc *mcled_cdev); + +#endif /* __LINUX_MULTICOLOR_LEDS_H_INCLUDED */ From patchwork Thu May 23 19:08:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 165069 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp2646232ili; Thu, 23 May 2019 12:51:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqxKQgRpknpjFAM0GDYdXKMggCgOKF0Vc8j7BRUuZAr9TCuTV8+aCU72eYy9Fo0rbdpvXMOG X-Received: by 2002:a63:9242:: with SMTP id s2mr83383485pgn.220.1558641111554; Thu, 23 May 2019 12:51:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558641111; cv=none; d=google.com; s=arc-20160816; b=EpCVYU/bfxftaArqPRZ6Rrkc0w4H4u6RA8ZswNjmKtU7YLIRWeOV8yTluVyNxMurB5 mGvLxoW/wPq7fB8SYLVd2Ww/fLLp81n6mM6Can7V5pWA6Np65hYvt/LxebxSF/qk/Mis JtUVL4nOUdCWO72Vss9ayakZc8P3AEOXu96pFHRq+fPEq0ibt6VRSbPlzI3AaVwnjGLZ u0ZpjP37sZktRJkBmXoHLLxzx73smdDEdNI5kMj5T1eJNwkSl0qD6FTBeepGozxVa7jT jUlFUo/0msvOXLzooQ+p2rmkPKaefWBdVc6j4f3dzeb1llGrxGKrAs9rI8VDGyPHDO11 SpYA== 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=Tb89x3pQt7xH9yev0hPe26h47J9PwEX0pauGorVCGTo=; b=XZeZ3x5Y6RNB5thRUUZOwwcgF0ks5kchnfMr9Is7L7s7+F8L9zeP0ii2/Y7oV/86Nv oqPoy61UQg/5Bf1bRFFXkrigmPpUJFqJYu7t2VvYpTy6Rcm3zLTR2VSDGfo1/do/mSFZ tBADW5MnQss35bTW4yX8IekIyI6fxud6ssMXudPWQp1h8ubJHAvlOM6henuaI4CkQh1J PRiZMf8ki4gnGnc/vkI6HOU5wyA5664KhVrfndXmDZVcOiyDh0YNW7i8xrP0VJcIFJbR CHdURNOjCJSA9LVW+ZuZRPcKdZ9useAGdQKGXhXsw/bHvEzDy6XCogO8wJfk6a65gAFr e9XA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=prkSn1R6; spf=pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-leds-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z8si481803pjq.89.2019.05.23.12.51.51; Thu, 23 May 2019 12:51:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=prkSn1R6; spf=pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-leds-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387765AbfEWTvv (ORCPT + 1 other); Thu, 23 May 2019 15:51:51 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:40056 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731846AbfEWTIn (ORCPT ); Thu, 23 May 2019 15:08:43 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x4NJ8cdc027956; Thu, 23 May 2019 14:08:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1558638518; bh=Tb89x3pQt7xH9yev0hPe26h47J9PwEX0pauGorVCGTo=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=prkSn1R68+MnsPZaAaSpoSIwtNN6NCHGArqwIjZUfYH8Ir4H+X0FNHaAzs3RG6ZIV 0tLZsW1ziMxDDElEOBpH13RRGrCvDXIwzvXrkVt57psTaY08kGwKbtjTMnE/J+VIUs vLNF0Y7EyKbZwPU1yOJUFTF1wvc4m3863kXc1Q24= Received: from DFLE109.ent.ti.com (dfle109.ent.ti.com [10.64.6.30]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x4NJ8cuD079041 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 23 May 2019 14:08:38 -0500 Received: from DFLE108.ent.ti.com (10.64.6.29) 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; Thu, 23 May 2019 14:08:38 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE108.ent.ti.com (10.64.6.29) 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; Thu, 23 May 2019 14:08:38 -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 x4NJ8caM022847; Thu, 23 May 2019 14:08:38 -0500 From: Dan Murphy To: , , CC: , , , Dan Murphy Subject: [PATCH v3 7/9] dt: bindings: lp50xx: Introduce the lp50xx family of RGB drivers Date: Thu, 23 May 2019 14:08:18 -0500 Message-ID: <20190523190820.29375-8-dmurphy@ti.com> X-Mailer: git-send-email 2.21.0.5.gaeb582a983 In-Reply-To: <20190523190820.29375-1-dmurphy@ti.com> References: <20190523190820.29375-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-leds-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org Introduce the bindings for the Texas Instruments LP5036, LP5030, LP5024 and LP5018 RGB LED device driver. The LP5036/30/24/18 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/lp5024.pdf http://www.ti.com/lit/ds/symlink/lp5036.pdf Signed-off-by: Dan Murphy --- .../devicetree/bindings/leds/leds-lp50xx.txt | 142 ++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/leds-lp50xx.txt -- 2.21.0.5.gaeb582a983 diff --git a/Documentation/devicetree/bindings/leds/leds-lp50xx.txt b/Documentation/devicetree/bindings/leds/leds-lp50xx.txt new file mode 100644 index 000000000000..531e6a55fac3 --- /dev/null +++ b/Documentation/devicetree/bindings/leds/leds-lp50xx.txt @@ -0,0 +1,142 @@ +* Texas Instruments - LP5018/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,lp5018" + "ti,lp5024" + "ti,lp5030" + "ti,lp5036" + - reg : I2C slave address + lp5018/24 - 0x28 + lp5030/36 - 0x30 + - #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 : see Documentation/devicetree/bindings/leds/common.txt + - 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 module that controls + the RGB cluster. + - color : see Documentation/devicetree/bindings/leds/leds-multicolor.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. + +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@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@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@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/lp5024.pdf +http://www.ti.com/lit/ds/symlink/lp5036.pdf