From patchwork Wed Jun 17 15:09:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 190864 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp538051ilo; Wed, 17 Jun 2020 08:09:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+EzYb8s/9F0+m7Pi8+xhP058X/9lQYzQABPmjaL0l3BBuz03woPMq/aVWqqbWix/HB07P X-Received: by 2002:a17:906:7f94:: with SMTP id f20mr8215043ejr.394.1592406580750; Wed, 17 Jun 2020 08:09:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592406580; cv=none; d=google.com; s=arc-20160816; b=uTbba+X7d2Gm69B5pw17kx15Gf/3pIvWhApkkpdZbZU3QCuGE+NQc2v2VvvNwRL3vj Df5tMNnpXpqQLPz3s1/5gld8RkINY81eq5uIw7ydMwVAL7Ga/l+ULboa2lMYmtpoArCv 0V0jhvd9d7MQrgMKCJWvx+MqcWcM5CD+sJjb17nLOdTCvWWiIO84QWAH17+GbgfcnpKq v2m3PzYX5Uhaqd1x9z48n7hMOFmAkUXeZobe1TF/ST0CGqqfl3wkyvqkZA+oWyv977sD 0uHiU4eVenOMMLJa3SlRAR9HdOln5Gd2PhIqCse2WOin11XiGMYAl4ULJcEyQRr1cWzQ s1gw== 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=Ris2/4w6GDy898Yv1LyxocRRHlnY97ZT12syvx8SG/4=; b=A2Un2Hs4M7GaOQa+/Tdq9wtfufpdSi8IqKOZLWkGUA0u8+S4QKNr6RhYn9W1deIeOi O9GwdtWykPWqLodTEnerv53PnZJbEyj4sSMlcLI9eqpEsaNuyk4ltmYRfcuPXop96xCa lN+oNYx+ros2RULxEkHGURvJq+Qa8s9B51ZgSuFNx8v2QzI7wAP1+ibIDr1Lc1xujbr6 MlZzfRHjfjEY1Fj3hPm1TcOB924IR5QB+5SFT6JMbZX1DwEaWtJC3P/eKfVrgGtNdO9/ 9GEa6I51Wsfroh2Rsp/3rPINL2/3Kehbue6iKD999KS6swLNOum5tyYO9K5699gX9fke R2yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="yG/UGFgS"; spf=pass (google.com: domain of linux-leds-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id n16si168780edo.74.2020.06.17.08.09.40; Wed, 17 Jun 2020 08:09:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-leds-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="yG/UGFgS"; spf=pass (google.com: domain of linux-leds-owner@vger.kernel.org designates 23.128.96.18 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 S1726909AbgFQPJj (ORCPT + 1 other); Wed, 17 Jun 2020 11:09:39 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:32774 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726879AbgFQPJi (ORCPT ); Wed, 17 Jun 2020 11:09:38 -0400 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 05HF9VIh116869; Wed, 17 Jun 2020 10:09:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1592406571; bh=Ris2/4w6GDy898Yv1LyxocRRHlnY97ZT12syvx8SG/4=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=yG/UGFgSXbMAc8GnVTd1ztLFNJwB9YdkXeGZmIFvzkR6CHFPcOX3u+oCk/Hx83tWk 7Cw6rLo4viz8q2ZNauE/+dywoPDQqjjl+oMepKYP4D/Zp+v4p+oQcHK4ROZR6r8De3 vO/m3vH7CSNiqhgYCj5UJw+cJwy4nfkPZ1yLFa/U= Received: from DLEE111.ent.ti.com (dlee111.ent.ti.com [157.170.170.22]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 05HF9VUm088186 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 17 Jun 2020 10:09:31 -0500 Received: from DLEE109.ent.ti.com (157.170.170.41) by DLEE111.ent.ti.com (157.170.170.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 17 Jun 2020 10:09:31 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) 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.1979.3 via Frontend Transport; Wed, 17 Jun 2020 10:09:31 -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 05HF9Vjk106931; Wed, 17 Jun 2020 10:09:31 -0500 From: Dan Murphy To: , , CC: , , , Dan Murphy Subject: [PATCH v28 01/15] dt: bindings: Add multicolor class dt bindings documention Date: Wed, 17 Jun 2020 10:09:10 -0500 Message-ID: <20200617150924.12665-2-dmurphy@ti.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200617150924.12665-1-dmurphy@ti.com> References: <20200617150924.12665-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 DT bindings for the LEDs multicolor class framework. Add multicolor ID to the color ID list for device tree bindings. CC: Rob Herring Acked-by: Pavel Machek Acked-by: Jacek Anaszewski Signed-off-by: Dan Murphy --- .../bindings/leds/leds-class-multicolor.yaml | 37 +++++++++++++++++++ include/dt-bindings/leds/common.h | 3 +- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml -- 2.26.2 diff --git a/Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml b/Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml new file mode 100644 index 000000000000..b55e1f1308a4 --- /dev/null +++ b/Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml @@ -0,0 +1,37 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/leds/leds-class-multicolor.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Common properties for the multicolor LED class. + +maintainers: + - Dan Murphy + +description: | + 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. + +patternProperties: + "^multi-led@([0-9a-f])$": + type: object + description: Represents the LEDs that are to be grouped. + properties: + color: + const: 8 # LED_COLOR_ID_MULTI + description: | + For multicolor LED support this property should be defined as + LED_COLOR_ID_MULTI which can be found in include/linux/leds/common.h. + + $ref: "common.yaml#" + + required: + - color +... diff --git a/include/dt-bindings/leds/common.h b/include/dt-bindings/leds/common.h index 0ce7dfc00dcb..a463ce6a8794 100644 --- a/include/dt-bindings/leds/common.h +++ b/include/dt-bindings/leds/common.h @@ -30,7 +30,8 @@ #define LED_COLOR_ID_VIOLET 5 #define LED_COLOR_ID_YELLOW 6 #define LED_COLOR_ID_IR 7 -#define LED_COLOR_ID_MAX 8 +#define LED_COLOR_ID_MULTI 8 +#define LED_COLOR_ID_MAX 9 /* Standard LED functions */ /* Keyboard LEDs, usually it would be input4::capslock etc. */ From patchwork Wed Jun 17 15:09:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 190870 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp538516ilo; Wed, 17 Jun 2020 08:10:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTn1HKiFyX3fkgaLWV8NBI4aEC89ppbu7IABtDLomsXTPWnQAfLb9GNfx1Ej3g1UASD0Qb X-Received: by 2002:a17:906:b88c:: with SMTP id hb12mr7796311ejb.483.1592406610398; Wed, 17 Jun 2020 08:10:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592406610; cv=none; d=google.com; s=arc-20160816; b=e9wEYsP4xh4WaVspni84PVOWb1RJii2oXV/8XjSoRsa59YoDx6Fk4Aop9LrKgi3dAm 6CH5jJpIPwgt0hexyun8kEITersds7R/WfMchYx37CSi54Z+wQQItl/zCTh7FNQNzm68 Z4pp+3RyAiRQSONsQh1FgxXZvkmVBrvXjEjCrk672J9tgxQGGiIEYBOxd9tbiaBznD48 vRAqGrgZ4KPHXmos0X9j8TKCsJzRnJRyvcZ79aA2qBGtF56NFDRLOhNyiNykaWzaAREW 2qH53LH1qPC8InO2ZQcFFtAXOpEJfLwPtNK1zMrxKdCC1o//POs8RVVxNW8QbzlDC97C 2Xyg== 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=V2VikCqHW+vjr+5pGiSTht8WRqjdCKy+EM301kkEwzI=; b=CUHlQjh4h0WQATslsM2uUsOwgedK20XxHKqpI1tqJL2HuCdgrxwAaAasF4iG08nOi7 pf4g1g406IELEQzeyP/+++ifDFOGbapjBY1qvOrFA65EtoAZB/DqaFh5gcN/8IB9vxTF sLevByc0bVBoALSuTblzo9eDAX6ogWX73ZXzA7OyTS+RPuNyaUXfX48KQPHYwH46XQ59 MApg/NvZvfxjVsYlf8bUUTQP0ie3S5BTyn44BhbMNxlXTfeKhuXy4LjgkClHax8QuJXh fuhOa7vzZ3HgOgM/fSxDt3Jfk7codECfKc3mTkl3zL29ynqijowWeav1uw0ztYXQ7pE6 yNMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=YyfgOoWR; spf=pass (google.com: domain of linux-leds-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id dj24si166723edb.266.2020.06.17.08.10.10; Wed, 17 Jun 2020 08:10:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-leds-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=YyfgOoWR; spf=pass (google.com: domain of linux-leds-owner@vger.kernel.org designates 23.128.96.18 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 S1727050AbgFQPKJ (ORCPT + 1 other); Wed, 17 Jun 2020 11:10:09 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:40472 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726945AbgFQPJk (ORCPT ); Wed, 17 Jun 2020 11:09:40 -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 05HF9alY004978; Wed, 17 Jun 2020 10:09:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1592406576; bh=V2VikCqHW+vjr+5pGiSTht8WRqjdCKy+EM301kkEwzI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=YyfgOoWR8bj3W/vR5LdggcTUPPyVu6ogdb6lgGgX3rpEm/M7yKGyct2UooF3BI5SJ 7h8jqmevjpZaihYQEq14tlx2fJzVd/1iR42sR0XJqFP0r81KdQyoVRZrDKLe8dyczg l3Jb6mGEIcz6KexlCFro1Z/N4OIGjq79klgmObSA= Received: from DFLE111.ent.ti.com (dfle111.ent.ti.com [10.64.6.32]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 05HF9aGt088302 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 17 Jun 2020 10:09:36 -0500 Received: from DFLE107.ent.ti.com (10.64.6.28) 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.1979.3; Wed, 17 Jun 2020 10:09:36 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) 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.1979.3 via Frontend Transport; Wed, 17 Jun 2020 10:09:36 -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 05HF9aNm106978; Wed, 17 Jun 2020 10:09:36 -0500 From: Dan Murphy To: , , CC: , , , Dan Murphy Subject: [PATCH v28 02/15] leds: Add multicolor ID to the color ID list Date: Wed, 17 Jun 2020 10:09:11 -0500 Message-ID: <20200617150924.12665-3-dmurphy@ti.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200617150924.12665-1-dmurphy@ti.com> References: <20200617150924.12665-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 --- drivers/leds/led-core.c | 1 + 1 file changed, 1 insertion(+) -- 2.26.2 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 Jun 17 15:09:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 190866 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp538222ilo; Wed, 17 Jun 2020 08:09:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwlRQTx4VZlPEs+EYaKILJrZ0DeSPdNYpWmz6n5Zw5quya2zqMk2p3bGf9zC+vu3Ye3WBOl X-Received: by 2002:a17:906:9402:: with SMTP id q2mr7866065ejx.216.1592406591875; Wed, 17 Jun 2020 08:09:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592406591; cv=none; d=google.com; s=arc-20160816; b=wU6h7pfQp2EkT5/e43o+66sM9CbKRTnuJoR+a4qgI+JZlSiqs4jcy5sJpkC4IbT0zx 7B0SKyNDUtou71BvpsFAoEddlkuIfsp91kM099P0oAa+Vq/CmAatr7FoFKaNMLujyTzI 1WYNFqqKPbdp9Zb4tuxH0TFLI0LftFIH0vaEEVFCsLPhuHaT6QoVARYJ7uuypkzuWyoL YcxDDi6q3j5Wko3ZIpEK31e1IiZBbtbn6r25BfMO0i0kO6Uyc+bUVBi+Sb6Y+dSPLOcn 6yvDQWv36VEznyFw/75Zx1pcpBKnd285oCFWNtuN+GgEavegc1eC8Gbw2c1gELQfJXfH /9Sg== 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=mBqFEUfuopdHZJQ9w3LLmKTJkooJn2E5KD6FCH6odOc=; b=NdO5kDScKKMlAtsiJH3kfRxnyTdTP6H/Gxbcr8igBdIHP/V107Z/dhcXXOvsNDE30L xWEcrxFHJYARGqI5XeENw8j6VqsnEDXzIAr7L31cht1p0aKHTjotxg8gaeiq8rERxjD7 Hvw8CPU9NKb2Smr9Uu0u5ufnDYYeItxt+C3d0n7z3LxknyqKJ52dMz/9BVejBhCOMhxb GaKWw829BrvFK+Q7CPj7o2rFBlmFJbdAOrJJIo4pHsio5dtyYus1M8C9BALxWt9geOc3 lACR8cf3E8kdTBoGN/a9hx6lgWEVHGHIBkt3L0MIzt7JhTtXWU7nFPeH7G+78lMp7w0h UhPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="JS+O/Vmb"; spf=pass (google.com: domain of linux-leds-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id f17si161843edr.515.2020.06.17.08.09.51; Wed, 17 Jun 2020 08:09:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-leds-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="JS+O/Vmb"; spf=pass (google.com: domain of linux-leds-owner@vger.kernel.org designates 23.128.96.18 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 S1727001AbgFQPJu (ORCPT + 1 other); Wed, 17 Jun 2020 11:09:50 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:54460 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726840AbgFQPJs (ORCPT ); Wed, 17 Jun 2020 11:09:48 -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 05HF9gXU004326; Wed, 17 Jun 2020 10:09:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1592406582; bh=mBqFEUfuopdHZJQ9w3LLmKTJkooJn2E5KD6FCH6odOc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=JS+O/VmbYt+bpkmNwwKzwjnoXPjCU1rCBVJEMFvrsqM9vROWKPaQVgVkEFbFcel4k wrlsXlluRtIhu5CNSVgfsPOB2Lf3fjJc34HN23hxHKbJjJWjMRLgb8ovvf+sONX9+n mRwD9OGZpWqOH2kq4aMT5PMvacZLm7TGlPeTagIw= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 05HF9gGK088365 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 17 Jun 2020 10:09:42 -0500 Received: from DLEE112.ent.ti.com (157.170.170.23) 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.1979.3; Wed, 17 Jun 2020 10:09:41 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Wed, 17 Jun 2020 10:09:41 -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 05HF9fEw040424; Wed, 17 Jun 2020 10:09:41 -0500 From: Dan Murphy To: , , CC: , , , Dan Murphy Subject: [PATCH v28 03/15] leds: multicolor: Introduce a multicolor class definition Date: Wed, 17 Jun 2020 10:09:12 -0500 Message-ID: <20200617150924.12665-4-dmurphy@ti.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200617150924.12665-1-dmurphy@ti.com> References: <20200617150924.12665-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 multi color class groups monochrome LEDs and allows controlling two aspects of the final combined color: hue and lightness. The former is controlled via the intensity file and the latter is controlled via brightness file. Acked-by: Jacek Anaszewski Signed-off-by: Dan Murphy --- .../ABI/testing/sysfs-class-led-multicolor | 36 +++ Documentation/leds/index.rst | 1 + Documentation/leds/leds-class-multicolor.rst | 88 ++++++++ drivers/leds/Kconfig | 10 + drivers/leds/Makefile | 1 + drivers/leds/led-class-multicolor.c | 208 ++++++++++++++++++ include/linux/led-class-multicolor.h | 121 ++++++++++ 7 files changed, 465 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-led-multicolor create mode 100644 Documentation/leds/leds-class-multicolor.rst create mode 100644 drivers/leds/led-class-multicolor.c create mode 100644 include/linux/led-class-multicolor.h -- 2.26.2 diff --git a/Documentation/ABI/testing/sysfs-class-led-multicolor b/Documentation/ABI/testing/sysfs-class-led-multicolor new file mode 100644 index 000000000000..cd96cfb4093b --- /dev/null +++ b/Documentation/ABI/testing/sysfs-class-led-multicolor @@ -0,0 +1,36 @@ +What: /sys/class/leds//brightness +Date: March 2020 +KernelVersion: 5.8 +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 for each grouped LED via the + equation below: + + led_brightness = brightness * multi_intensity/max_brightness + + For additional details please refer to + Documentation/leds/leds-class-multicolor.rst. + + The value of the LED is from 0 to + /sys/class/leds//max_brightness. + +What: /sys/class/leds//multi_index +Date: March 2020 +KernelVersion: 5.8 +Contact: Dan Murphy +Description: read + The multi_index array, when read, will output the LED colors + as an array of strings as they are indexed in the + multi_intensity file. + +What: /sys/class/leds//multi_intensity +Date: March 2020 +KernelVersion: 5.8 +Contact: Dan Murphy +Description: read/write + Intensity level for the LED color within an array of integers. + The intensities for each color must be entered based on the + multi_index array. The max_intensity should not exceed + /sys/class/leds//max_brightness. 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..2dcde711c51c --- /dev/null +++ b/Documentation/leds/leds-class-multicolor.rst @@ -0,0 +1,88 @@ +.. SPDX-License-Identifier: GPL-2.0 + +==================================== +MultiColor LED handling under Linux +==================================== + +Description +=========== +The multicolor class groups monochrome LEDs and allows controlling two +aspects of the final combined color: hue and lightness. The former is +controlled via the multi_intensity array file and the latter is controlled +via brightness file. + +Multicolor Class Control +======================== +The multicolor class presents files that groups the colors as indexes in an +array. These files are children 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 be indexed under the multi_* files. The order of the +colors will be arbitrary. The multi_index file can be read to determine the +color name to indexed value. + +The multi_index file is an array that contains the string list of the colors as +they are defined in each multi_* array file. + +The multi_intensity is an array that can be read or written to for the +individual color intensities. All elements within this array must be written in +order for the color LED intensities to be updated. + +Directory Layout Example +======================== +root:/sys/class/leds/multicolor:status# ls -lR +-rw-r--r-- 1 root root 4096 Oct 19 16:16 brightness +-r--r--r-- 1 root root 4096 Oct 19 16:16 max_brightness +-r--r--r-- 1 root root 4096 Oct 19 16:16 multi_index +-rw-r--r-- 1 root root 4096 Oct 19 16:16 multi_intensity + +Multicolor Class Brightness Control +=================================== +The multicolor 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 global max_brightness setting multiplied by +the requested brightness. + +led_brightness = brightness * multi_intensity/max_brightness + +Example: +A user first writes the multi_intensity file with the brightness levels +for each LED that are necessary to achieve a certain color output from a +multicolor LED group. + +cat /sys/class/leds/multicolor:status/multi_index +green blue red + +echo 43 226 138 > /sys/class/leds/multicolor:status/multi_intensity + +red - + intensity = 138 + max_brightness = 255 +green - + intensity = 43 + max_brightness = 255 +blue - + intensity = 226 + max_brightness = 255 + +The user can control the brightness of that multicolor LED group by writing the +global 'brightness' control. Assuming a 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 global brightness file then the values written to each LED will be +adjusted base on this value. + +cat /sys/class/leds/multicolor:status/max_brightness +255 +echo 128 > /sys/class/leds/multicolor:status/brightness + +adjusted_red_value = 128 * 138/255 = 69 +adjusted_green_value = 128 * 43/255 = 21 +adjusted_blue_value = 128 * 226/255 = 113 + +Reading the global brightness file will return the current brightness value of +the color LED group. + +cat /sys/class/leds/multicolor:status/brightness +128 diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index ed943140e1fd..0d034453eeb9 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 MultiColor 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 d6b8a792c936..53a752c32e67 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 (keep this sorted, M-| sort) diff --git a/drivers/leds/led-class-multicolor.c b/drivers/leds/led-class-multicolor.c new file mode 100644 index 000000000000..ae4f9c63db8d --- /dev/null +++ b/drivers/leds/led-class-multicolor.c @@ -0,0 +1,208 @@ +// SPDX-License-Identifier: GPL-2.0 +// LED Multi Color class interface +// Copyright (C) 2019-20 Texas Instruments Incorporated - http://www.ti.com/ +// Author: Dan Murphy + +#include +#include +#include +#include +#include +#include + +#include "leds.h" + +int led_mc_calc_color_components(struct led_classdev_mc *mcled_cdev, + enum led_brightness brightness) +{ + struct led_classdev *led_cdev = &mcled_cdev->led_cdev; + int i; + + for (i = 0; i < mcled_cdev->num_colors; i++) + mcled_cdev->subled_info[i].brightness = brightness * + mcled_cdev->subled_info[i].intensity / + led_cdev->max_brightness; + + return 0; +} +EXPORT_SYMBOL_GPL(led_mc_calc_color_components); + +static ssize_t multi_intensity_store(struct device *dev, + struct device_attribute *intensity_attr, + const char *buf, size_t size) +{ + struct led_classdev *led_cdev = dev_get_drvdata(dev); + struct led_classdev_mc *mcled_cdev = lcdev_to_mccdev(led_cdev); + int nrchars, offset = 0; + int intensity_value[LED_COLOR_ID_MAX]; + int i; + ssize_t ret; + + mutex_lock(&led_cdev->led_access); + + for (i = 0; i < mcled_cdev->num_colors; i++) { + ret = sscanf(buf + offset, "%i%n", + &intensity_value[i], &nrchars); + if (ret != 1) { + dev_dbg(led_cdev->dev, + "Incorrect number of LEDs expected %i values intensity was not applied\n", + mcled_cdev->num_colors); + ret = -EINVAL; + goto err_out; + } + offset += nrchars; + } + + /* account for the space at the end of the buffer */ + offset++; + if (offset < size) { + dev_dbg(led_cdev->dev, + "Incorrect number of LEDs expected %i values intensity was not applied\n", + mcled_cdev->num_colors); + ret = -EINVAL; + goto err_out; + } + + for (i = 0; i < mcled_cdev->num_colors; i++) + mcled_cdev->subled_info[i].intensity = intensity_value[i]; + + led_set_brightness(led_cdev, led_cdev->brightness); + ret = size; +err_out: + mutex_unlock(&led_cdev->led_access); + return ret; +} + +static ssize_t multi_intensity_show(struct device *dev, + struct device_attribute *intensity_attr, + char *buf) +{ + struct led_classdev *led_cdev = dev_get_drvdata(dev); + struct led_classdev_mc *mcled_cdev = lcdev_to_mccdev(led_cdev); + int len = 0; + int i; + + for (i = 0; i < mcled_cdev->num_colors; i++) { + len += sprintf(buf + len, "%d", + mcled_cdev->subled_info[i].intensity); + len += sprintf(buf + len, " "); + } + + len += sprintf(buf + len, "\n"); + return len; +} +static DEVICE_ATTR_RW(multi_intensity); + +static ssize_t multi_index_show(struct device *dev, + struct device_attribute *multi_index_attr, + char *buf) +{ + struct led_classdev *led_cdev = dev_get_drvdata(dev); + struct led_classdev_mc *mcled_cdev = lcdev_to_mccdev(led_cdev); + int len = 0; + int index; + int i; + + for (i = 0; i < mcled_cdev->num_colors; i++) { + index = mcled_cdev->subled_info[i].color_index; + len += sprintf(buf + len, "%s", led_colors[index]); + len += sprintf(buf + len, " "); + } + + len += sprintf(buf + len, "\n"); + return len; +} +static DEVICE_ATTR_RO(multi_index); + +static struct attribute *led_multicolor_attrs[] = { + &dev_attr_multi_intensity.attr, + &dev_attr_multi_index.attr, + NULL, +}; +ATTRIBUTE_GROUPS(led_multicolor); + +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; + + if (!mcled_cdev) + return -EINVAL; + + if (!mcled_cdev->num_colors) + return -EINVAL; + + if (mcled_cdev->num_colors > LED_COLOR_ID_MAX) + return -EINVAL; + + led_cdev = &mcled_cdev->led_cdev; + mcled_cdev->led_cdev.groups = led_multicolor_groups; + + return led_classdev_register_ext(parent, led_cdev, init_data); +} +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); +} + +int devm_led_classdev_multicolor_register_ext(struct device *parent, + struct led_classdev_mc *mcled_cdev, + struct led_init_data *init_data) +{ + 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_ext(parent, mcled_cdev, + init_data); + if (ret) { + devres_free(dr); + return ret; + } + + *dr = mcled_cdev; + devres_add(parent, dr); + + return 0; +} +EXPORT_SYMBOL_GPL(devm_led_classdev_multicolor_register_ext); + +static int devm_led_classdev_multicolor_match(struct device *dev, + void *res, void *data) +{ + struct led_classdev_mc **p = res; + + if (WARN_ON(!p || !*p)) + return 0; + + return *p == data; +} + +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..50bd986497f0 --- /dev/null +++ b/include/linux/led-class-multicolor.h @@ -0,0 +1,121 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* LED Multicolor class interface + * Copyright (C) 2019-20 Texas Instruments Incorporated - http://www.ti.com/ + */ + +#ifndef _LINUX_MULTICOLOR_LEDS_H_INCLUDED +#define _LINUX_MULTICOLOR_LEDS_H_INCLUDED + +#include +#include + +struct mc_subled { + int color_index; + int brightness; + int intensity; + int channel; +}; + +struct led_classdev_mc { + /* led class device */ + struct led_classdev led_cdev; + int num_colors; + + struct mc_subled *subled_info; +}; + +static inline struct led_classdev_mc *lcdev_to_mccdev( + struct led_classdev *led_cdev) +{ + return container_of(led_cdev, struct led_classdev_mc, led_cdev); +} + +#if IS_ENABLED(CONFIG_LEDS_CLASS_MULTI_COLOR) +/** + * 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); + +static inline int led_classdev_multicolor_register(struct device *parent, + struct led_classdev_mc *mcled_cdev) +{ + return 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 */ +int led_mc_calc_color_components(struct led_classdev_mc *mcled_cdev, + enum led_brightness brightness); + +int devm_led_classdev_multicolor_register_ext(struct device *parent, + struct led_classdev_mc *mcled_cdev, + struct led_init_data *init_data); + +static inline int devm_led_classdev_multicolor_register(struct device *parent, + struct led_classdev_mc *mcled_cdev) +{ + return devm_led_classdev_multicolor_register_ext(parent, mcled_cdev, + NULL); +} + +void devm_led_classdev_multicolor_unregister(struct device *parent, + struct led_classdev_mc *mcled_cdev); +#else + +static inline int led_classdev_multicolor_register_ext(struct device *parent, + struct led_classdev_mc *mcled_cdev, + struct led_init_data *init_data) +{ + return -EINVAL; +} + +static inline int led_classdev_multicolor_register(struct device *parent, + struct led_classdev_mc *mcled_cdev) +{ + return led_classdev_multicolor_register_ext(parent, mcled_cdev, NULL); +} + +static inline void led_classdev_multicolor_unregister(struct led_classdev_mc *mcled_cdev) {}; +static inline int led_mc_calc_color_components(struct led_classdev_mc *mcled_cdev, + enum led_brightness brightness) +{ + return -EINVAL; +} + +static inline int devm_led_classdev_multicolor_register_ext(struct device *parent, + struct led_classdev_mc *mcled_cdev, + struct led_init_data *init_data) +{ + return -EINVAL; +} + +static inline int devm_led_classdev_multicolor_register(struct device *parent, + struct led_classdev_mc *mcled_cdev) +{ + return devm_led_classdev_multicolor_register_ext(parent, mcled_cdev, + NULL); +} + +static inline void devm_led_classdev_multicolor_unregister(struct device *parent, + struct led_classdev_mc *mcled_cdev) +{}; + +#endif /* IS_ENABLED(CONFIG_LEDS_CLASS_MULTI_COLOR) */ +#endif /* _LINUX_MULTICOLOR_LEDS_H_INCLUDED */ From patchwork Wed Jun 17 15:09:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 190869 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp538456ilo; Wed, 17 Jun 2020 08:10:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLfIQ1YwjVqtxBYWc50/RqRwR+crFgqce4ilQHYBMl3PQdmT6+mlgpw+2+cT0kax/aDorJ X-Received: by 2002:a17:906:3456:: with SMTP id d22mr7747954ejb.358.1592406606934; Wed, 17 Jun 2020 08:10:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592406606; cv=none; d=google.com; s=arc-20160816; b=yMwctdkMHoaS3prsZouzgfqIG0fuxpuKSkizUJBsgoV+ozXlJLAgD+5VgzcHzkmSga NHZEFLnZUso0E41lklHSUhZGj2cp+fBLQRxjL/zXB1NeYOhs/lsg22rFpTpT1k05oXSP sfQ3Wz03xZrS6n8yqgzGY9Js7kCMJirUfTGYCzsNv7vqgs8ApGqIZ8YLuvZFFI1kgrH7 Uh/HDN7VPEVWShrpUAxxsiz1tE3cLe5Uvh372MQpvqc4rJ9AqDtkoCYKkg2TwgGIzNiK rcUfIZCbJPChIL+pseiOZSBAL1Qm63NVKTyy3MvpNOnveQM4GlBTfpHQx0uKiJSudPNH ecNQ== 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=l5DBLATby1KM81lVYix9jAEvjwVv3jRRG9y+NT8lvMA=; b=pylXm2I33e/rF4vQn81Nyzdd3vcwasQmHMnGocH21DeopLTWKMFPh9joqrIASztJZ+ KiPvTnHhULPDdwG2iILisIwXyGXbQZ07E3IDpAlYZRPZbdWxcid01DpQZyqsElBy7lhw qw0AN2fgwcJnoStBD6CpEY/KO+XUQrmvyWsKAz7pEItyzexnoqX5c23HE4m1AFe46Y8h V6XmZbEseAtUgqnCyXcTiwQXQJxDYw9fGw46Af7S+1HsQZmFyEtUXHe4aWpSrYitfQ91 M0h62oytNOQihqBSFOZ3Oeqsj68L+mK1gDzS6XJKgbgtq1OsXlFZcdSm5+ozB/1b11OG q4ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=yKdUxblS; spf=pass (google.com: domain of linux-leds-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id dj24si166723edb.266.2020.06.17.08.10.06; Wed, 17 Jun 2020 08:10:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-leds-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=yKdUxblS; spf=pass (google.com: domain of linux-leds-owner@vger.kernel.org designates 23.128.96.18 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 S1727006AbgFQPKC (ORCPT + 1 other); Wed, 17 Jun 2020 11:10:02 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:54486 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727035AbgFQPKB (ORCPT ); Wed, 17 Jun 2020 11:10:01 -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 05HF9v3O004367; Wed, 17 Jun 2020 10:09:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1592406597; bh=l5DBLATby1KM81lVYix9jAEvjwVv3jRRG9y+NT8lvMA=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=yKdUxblSM4gp+HR7SC5xtMNmt3ZzxvkTpk4gWOOX6b8HCJP1eplucv3vpTVc1y6D4 A8Djjde7NMg6dVKhokMEQh3p/WR52Ur0fKAtnLCq1qaIlnLaLAuwdTyeqbyK4JaMI4 BYrBsXM9yD0LcSm8SWmdQ7fUAl/FUW/i3b9vP/PU= Received: from DLEE112.ent.ti.com (dlee112.ent.ti.com [157.170.170.23]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id 05HF9vPn111502; Wed, 17 Jun 2020 10:09:57 -0500 Received: from DLEE111.ent.ti.com (157.170.170.22) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 17 Jun 2020 10:09:57 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE111.ent.ti.com (157.170.170.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Wed, 17 Jun 2020 10:09:57 -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 05HF9vog040820; Wed, 17 Jun 2020 10:09:57 -0500 From: Dan Murphy To: , , CC: , , , Dan Murphy Subject: [PATCH v28 06/15] dt-bindings: leds: Convert leds-lp55xx to yaml Date: Wed, 17 Jun 2020 10:09:15 -0500 Message-ID: <20200617150924.12665-7-dmurphy@ti.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200617150924.12665-1-dmurphy@ti.com> References: <20200617150924.12665-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 Convert the leds-lp55xx.txt to yaml binding. Signed-off-by: Dan Murphy --- .../devicetree/bindings/leds/leds-lp55xx.txt | 228 ------------------ .../devicetree/bindings/leds/leds-lp55xx.yaml | 220 +++++++++++++++++ 2 files changed, 220 insertions(+), 228 deletions(-) delete mode 100644 Documentation/devicetree/bindings/leds/leds-lp55xx.txt create mode 100644 Documentation/devicetree/bindings/leds/leds-lp55xx.yaml -- 2.26.2 diff --git a/Documentation/devicetree/bindings/leds/leds-lp55xx.txt b/Documentation/devicetree/bindings/leds/leds-lp55xx.txt deleted file mode 100644 index 1b66a413fb9d..000000000000 --- a/Documentation/devicetree/bindings/leds/leds-lp55xx.txt +++ /dev/null @@ -1,228 +0,0 @@ -Binding for TI/National Semiconductor LP55xx Led Drivers - -Required properties: -- compatible: one of - national,lp5521 - national,lp5523 - ti,lp55231 - ti,lp5562 - ti,lp8501 - -- reg: I2C slave address -- clock-mode: Input clock mode, (0: automode, 1: internal, 2: external) - -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. - -Optional properties: -- enable-gpio: GPIO attached to the chip's enable pin -- label: Used for naming LEDs -- pwr-sel: LP8501 specific property. Power selection for output channels. - 0: D1~9 are connected to VDD - 1: D1~6 with VDD, D7~9 with VOUT - 2: D1~6 with VOUT, D7~9 with VDD - 3: D1~9 are connected to VOUT - -Alternatively, each child can have a specific channel name and trigger: -- chan-name (optional): name of channel -- linux,default-trigger (optional): see - Documentation/devicetree/bindings/leds/common.txt - -example 1) LP5521 -3 LED channels, external clock used. Channel names are 'lp5521_pri:channel0', -'lp5521_pri:channel1' and 'lp5521_pri:channel2', with a heartbeat trigger -on channel 0. - -lp5521@32 { - compatible = "national,lp5521"; - reg = <0x32>; - label = "lp5521_pri"; - clock-mode = /bits/ 8 <2>; - - chan0 { - led-cur = /bits/ 8 <0x2f>; - max-cur = /bits/ 8 <0x5f>; - linux,default-trigger = "heartbeat"; - }; - - chan1 { - led-cur = /bits/ 8 <0x2f>; - max-cur = /bits/ 8 <0x5f>; - }; - - chan2 { - led-cur = /bits/ 8 <0x2f>; - max-cur = /bits/ 8 <0x5f>; - }; -}; - -example 2) LP5523 -9 LED channels with specific name. Internal clock used. -The I2C slave address is configurable with ASEL1 and ASEL0 pins. -Available addresses are 32/33/34/35h. - -ASEL1 ASEL0 Address -------------------------- - GND GND 32h - GND VEN 33h - VEN GND 34h - VEN VEN 35h - -lp5523@32 { - compatible = "national,lp5523"; - reg = <0x32>; - clock-mode = /bits/ 8 <1>; - - chan0 { - chan-name = "d1"; - led-cur = /bits/ 8 <0x14>; - max-cur = /bits/ 8 <0x20>; - }; - - chan1 { - chan-name = "d2"; - led-cur = /bits/ 8 <0x14>; - max-cur = /bits/ 8 <0x20>; - }; - - chan2 { - chan-name = "d3"; - led-cur = /bits/ 8 <0x14>; - max-cur = /bits/ 8 <0x20>; - }; - - chan3 { - chan-name = "d4"; - led-cur = /bits/ 8 <0x14>; - max-cur = /bits/ 8 <0x20>; - }; - - chan4 { - chan-name = "d5"; - led-cur = /bits/ 8 <0x14>; - max-cur = /bits/ 8 <0x20>; - }; - - chan5 { - chan-name = "d6"; - led-cur = /bits/ 8 <0x14>; - max-cur = /bits/ 8 <0x20>; - }; - - chan6 { - chan-name = "d7"; - led-cur = /bits/ 8 <0x14>; - max-cur = /bits/ 8 <0x20>; - }; - - chan7 { - chan-name = "d8"; - led-cur = /bits/ 8 <0x14>; - max-cur = /bits/ 8 <0x20>; - }; - - chan8 { - chan-name = "d9"; - led-cur = /bits/ 8 <0x14>; - max-cur = /bits/ 8 <0x20>; - }; -}; - -example 3) LP5562 -4 channels are defined. - -lp5562@30 { - compatible = "ti,lp5562"; - reg = <0x30>; - clock-mode = /bits/8 <2>; - - chan0 { - chan-name = "R"; - led-cur = /bits/ 8 <0x20>; - max-cur = /bits/ 8 <0x60>; - }; - - chan1 { - chan-name = "G"; - led-cur = /bits/ 8 <0x20>; - max-cur = /bits/ 8 <0x60>; - }; - - chan2 { - chan-name = "B"; - led-cur = /bits/ 8 <0x20>; - max-cur = /bits/ 8 <0x60>; - }; - - chan3 { - chan-name = "W"; - led-cur = /bits/ 8 <0x20>; - max-cur = /bits/ 8 <0x60>; - }; -}; - -example 4) LP8501 -9 channels are defined. The 'pwr-sel' is LP8501 specific property. -Others are same as LP5523. - -lp8501@32 { - compatible = "ti,lp8501"; - reg = <0x32>; - clock-mode = /bits/ 8 <2>; - pwr-sel = /bits/ 8 <3>; /* D1~9 connected to VOUT */ - - chan0 { - chan-name = "d1"; - led-cur = /bits/ 8 <0x14>; - max-cur = /bits/ 8 <0x20>; - }; - - chan1 { - chan-name = "d2"; - led-cur = /bits/ 8 <0x14>; - max-cur = /bits/ 8 <0x20>; - }; - - chan2 { - chan-name = "d3"; - led-cur = /bits/ 8 <0x14>; - max-cur = /bits/ 8 <0x20>; - }; - - chan3 { - chan-name = "d4"; - led-cur = /bits/ 8 <0x14>; - max-cur = /bits/ 8 <0x20>; - }; - - chan4 { - chan-name = "d5"; - led-cur = /bits/ 8 <0x14>; - max-cur = /bits/ 8 <0x20>; - }; - - chan5 { - chan-name = "d6"; - led-cur = /bits/ 8 <0x14>; - max-cur = /bits/ 8 <0x20>; - }; - - chan6 { - chan-name = "d7"; - led-cur = /bits/ 8 <0x14>; - max-cur = /bits/ 8 <0x20>; - }; - - chan7 { - chan-name = "d8"; - led-cur = /bits/ 8 <0x14>; - max-cur = /bits/ 8 <0x20>; - }; - - chan8 { - chan-name = "d9"; - led-cur = /bits/ 8 <0x14>; - max-cur = /bits/ 8 <0x20>; - }; -}; diff --git a/Documentation/devicetree/bindings/leds/leds-lp55xx.yaml b/Documentation/devicetree/bindings/leds/leds-lp55xx.yaml new file mode 100644 index 000000000000..b1bb3feb0f4d --- /dev/null +++ b/Documentation/devicetree/bindings/leds/leds-lp55xx.yaml @@ -0,0 +1,220 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/leds/leds-lp55xx.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: TI/National Semiconductor LP55xx and LP8501 LED Drivers + +maintainers: + - Jacek Anaszewski + - Pavel Machek + +description: | + Bindings for the TI/National Semiconductor LP55xx and LP8501 multi channel + LED Drivers. + + For more product information please see the link below: + https://www.ti.com/lit/gpn/lp5521 + https://www.ti.com/lit/gpn/lp5523 + https://www.ti.com/lit/gpn/lp55231 + https://www.ti.com/lit/gpn/lp5562 + https://www.ti.com/lit/gpn/lp8501 + +properties: + compatible: + enum: + - national,lp5521 + - national,lp5523 + - ti,lp55231 + - ti,lp5562 + - ti,lp8501 + + reg: + maxItems: 1 + description: I2C slave address + + clock-mode: + $ref: /schemas/types.yaml#definitions/uint8 + description: | + Input clock mode + enum: + - 0 # automode + - 1 # internal + - 2 # external + + enable-gpio: + maxItems: 1 + description: | + GPIO attached to the chip's enable pin + + pwr-sel: + $ref: /schemas/types.yaml#definitions/uint8 + description: | + LP8501 specific property. Power selection for output channels. + enum: + - 0 # D1~9 are connected to VDD + - 1 # D1~6 with VDD, D7~9 with VOUT + - 2 # D1~6 with VOUT, D7~9 with VDD + - 3 # D1~9 are connected to VOUT + +patternProperties: + "(^led@[0-9a-f]$|led)": + type: object + $ref: common.yaml# + properties: + led-cur: + $ref: /schemas/types.yaml#definitions/uint8 + description: | + Current setting at each LED channel (mA x10, 0 if LED is not connected) + minimum: 0 + maximum: 255 + + max-cur: + $ref: /schemas/types.yaml#definitions/uint8 + description: Maximun current at each LED channel. + + reg: + description: | + 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 + enum: + - 0 # LED output D1 + - 1 # LED output D2 + - 2 # LED output D3 + - 3 # LED output D4 + - 4 # LED output D5 + - 5 # LED output D6 + - 6 # LED output D7 + - 7 # LED output D8 + - 8 # LED output D9 + + chan-name: + $ref: /schemas/types.yaml#definitions/string + description: name of channel + +required: + - compatible + - reg + +examples: + - | + #include + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + led-controller@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 */ + + led@0 { + reg = <0>; + chan-name = "d1"; + led-cur = /bits/ 8 <0x14>; + max-cur = /bits/ 8 <0x20>; + }; + + led@1 { + reg = <1>; + chan-name = "d2"; + led-cur = /bits/ 8 <0x14>; + max-cur = /bits/ 8 <0x20>; + }; + + led@2 { + reg = <2>; + chan-name = "d3"; + led-cur = /bits/ 8 <0x14>; + max-cur = /bits/ 8 <0x20>; + }; + + led@3 { + reg = <3>; + chan-name = "d4"; + led-cur = /bits/ 8 <0x14>; + max-cur = /bits/ 8 <0x20>; + }; + + led@4 { + reg = <4>; + chan-name = "d5"; + led-cur = /bits/ 8 <0x14>; + max-cur = /bits/ 8 <0x20>; + }; + + led@5 { + reg = <5>; + chan-name = "d6"; + led-cur = /bits/ 8 <0x14>; + max-cur = /bits/ 8 <0x20>; + }; + + led@6 { + reg = <6>; + chan-name = "d7"; + led-cur = /bits/ 8 <0x14>; + max-cur = /bits/ 8 <0x20>; + }; + + led@7 { + reg = <7>; + chan-name = "d8"; + led-cur = /bits/ 8 <0x14>; + max-cur = /bits/ 8 <0x20>; + }; + + led@8 { + reg = <8>; + chan-name = "d9"; + led-cur = /bits/ 8 <0x14>; + max-cur = /bits/ 8 <0x20>; + }; + }; + + led-controller@33 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "national,lp5523"; + reg = <0x33>; + clock-mode = /bits/ 8 <0>; + + multi-led@2 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0x2>; + 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 Jun 17 15:09:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 190871 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp538588ilo; Wed, 17 Jun 2020 08:10:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOL2RIJaBOSmubvoXOpccjdP49q++Tnoix5tZUZ4KVvQsefdKqfBvNivhENJmfziCyV0eI X-Received: by 2002:a17:906:3e0c:: with SMTP id k12mr7718770eji.441.1592406614258; Wed, 17 Jun 2020 08:10:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592406614; cv=none; d=google.com; s=arc-20160816; b=wBoc0PFXgkfE6IWN149aFNBPqMB/P/nl8X200XQNFF8vWg0RJ0UUwCVgXhSCI7cF44 dl+kHPuA2pRFPP9zgQr7qvQe5wA34dqmcV04QexhQLiHKNnYu8CjLD7usQXWbVz6RT86 6+hVLPxcXWJ9SEplrNpJG3ip9d525BZ3/Get45i8fNh1mmARHwYLMdzIej7TXIkS4ePL 55jywAj/8aSyBXBF4rUlPxQPg3S/CIgqR22DB5qh54Y0bH5e6769D7nUJIh54AafN147 WxMsFlzDy7MuvQV8uq2lPPLNdoxY3gtfKRp7RnDD3IeHvomEBkl/y5g9525WU/Nq5h0a 7DrA== 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=8IVrLn2oGajwW9HenWpKeQ4KhS7i7iRwTrL7dy0Erd8=; b=HPixf3x0gv/T8+4u7U8MzAz5OsVr5rkJMp4xjiWqeDHADHY83g64GI6mhS4l22KxNW j28fzmVBAfp6LpHVdOa6Qta88Zr+rBov7z1Vsjrw6VEiseWxqIZ1W+IlgHEZdvo0nUR2 FCd9rADncUWxA5LJpFXpUf7yeeELvIWWs/8C/jvqn1k9t2383WKlIvsSTN12EzHm/9+d +MZm2AkBUhc65SKj6J66503FjrCcaatSVWlav9yE5FF8VC/TwvthMamaPAehzD79bH4x UeDyP8R/4YDsj44+JaRa4hN+IQlYfCHQlm1StmX1gvMA8nYSKukuo8V6Q0XQojaTA81R Wmhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=fwikWo4w; spf=pass (google.com: domain of linux-leds-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id dj24si166723edb.266.2020.06.17.08.10.14; Wed, 17 Jun 2020 08:10:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-leds-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=fwikWo4w; spf=pass (google.com: domain of linux-leds-owner@vger.kernel.org designates 23.128.96.18 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 S1726853AbgFQPKM (ORCPT + 1 other); Wed, 17 Jun 2020 11:10:12 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:40512 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727035AbgFQPKJ (ORCPT ); Wed, 17 Jun 2020 11:10:09 -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 05HFA3Bc005046; Wed, 17 Jun 2020 10:10:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1592406603; bh=8IVrLn2oGajwW9HenWpKeQ4KhS7i7iRwTrL7dy0Erd8=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=fwikWo4wlJ0pVdEnxwRQptMeO2xI5zmjZ3aPVmLzb6HMRRc8FwfpDJpOKxn/8N3QL +7QH8YxdfDnSLQhCziFlORB1Wk+542Jt8qGXVsHeyiJrLed9U7iiac06xbXGkvSJzl ioZU7C/V/IkoD/QscBnwEbVGR5R3gXUHBFaAzuiw= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id 05HFA2aw111646; Wed, 17 Jun 2020 10:10:03 -0500 Received: from DLEE112.ent.ti.com (157.170.170.23) 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.1979.3; Wed, 17 Jun 2020 10:10:02 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Wed, 17 Jun 2020 10:10:02 -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 05HFA22a041222; Wed, 17 Jun 2020 10:10:02 -0500 From: Dan Murphy To: , , CC: , , , Dan Murphy , Tony Lindgren , =?utf-8?q?Beno=C3=AEt_Cousson?= Subject: [PATCH v28 07/15] ARM: dts: n900: Add reg property to the LP5523 channel node Date: Wed, 17 Jun 2020 10:09:16 -0500 Message-ID: <20200617150924.12665-8-dmurphy@ti.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200617150924.12665-1-dmurphy@ti.com> References: <20200617150924.12665-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 the reg property to each channel node. This update is to accommodate the multicolor framework. In addition to the accommodation 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 Acked-by: Tony Lindgren CC: Tony Lindgren CC: "BenoƮt Cousson" Acked-by: Pavel Machek --- arch/arm/boot/dts/omap3-n900.dts | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) -- 2.26.2 diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts index 4089d97405c9..ebe93b06b4f7 100644 --- a/arch/arm/boot/dts/omap3-n900.dts +++ b/arch/arm/boot/dts/omap3-n900.dts @@ -618,63 +618,74 @@ indicator { }; lp5523: lp5523@32 { + #address-cells = <1>; + #size-cells = <0>; compatible = "national,lp5523"; reg = <0x32>; clock-mode = /bits/ 8 <0>; /* LP55XX_CLOCK_AUTO */ enable-gpio = <&gpio2 9 GPIO_ACTIVE_HIGH>; /* 41 */ - chan0 { + chan@0 { chan-name = "lp5523:kb1"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; + reg = <0>; }; - chan1 { + chan@1 { chan-name = "lp5523:kb2"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; + reg = <1>; }; - chan2 { + chan@2 { chan-name = "lp5523:kb3"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; + reg = <2>; }; - chan3 { + chan@3 { chan-name = "lp5523:kb4"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; + reg = <3>; }; - chan4 { + chan@4 { chan-name = "lp5523:b"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; + reg = <4>; }; - chan5 { + chan@5 { chan-name = "lp5523:g"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; + reg = <5>; }; - chan6 { + chan@6 { chan-name = "lp5523:r"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; + reg = <6>; }; - chan7 { + chan@7 { chan-name = "lp5523:kb5"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; + reg = <7>; }; - chan8 { + chan@8 { chan-name = "lp5523:kb6"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; + reg = <8>; }; }; From patchwork Wed Jun 17 15:09:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 190873 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp538768ilo; Wed, 17 Jun 2020 08:10:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwm4Hqw7MhPSpwvWEZm5qq4xsTOPx/akWoFpXbSXLYS8m3/D29H4CNI0q9y7cIh8uquUynF X-Received: by 2002:aa7:dd8e:: with SMTP id g14mr7746493edv.263.1592406624513; Wed, 17 Jun 2020 08:10:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592406624; cv=none; d=google.com; s=arc-20160816; b=nVYWcszG1EAYKBbx8ioFiENzyWjf4v0OBjm2suv8mdbQGWPHSaZKmAlet3QiufP5zi wXSmjEN9nE4EQ7JPb4W46Jl+U46jF5c6PxR1WCAhvv9FPxajbnjAWGHbMqordbfrfSvi 5um+uWpL26bCrkqBkyCpZzSEfdWseEfW9OIWQALTbZHV/lhYhL2rG5Kf5ZlvdqBuWP+k gLpYktDogzIXzFlxCZAFPSK+iT3gaoM2HR5KPaQ4HwBmXGIqPlBsbXpItl3JKaqeKjkx tVzPIUbsCUGDA4UrQB0hK57UMu3+65g/O1P0HF42brk6npPfpntkIdzix44Wv/iCq7iJ EyWg== 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=Jf6MKK966/6Olzk1qJChUoSjiHhXr8OEtTXC2DBLRbo=; b=grvEJh3gRTx71P9Ndrf75tQ/wrBp99MBreOpTC3N9ugAaQVfub5jTgjzqRBTscUVnA ifamKkO2MNQtrHHnU2dQKCWFtdej/v6kFLErIV9AijPvBU3fucE9r4zDDJLUqhkriZ0y wBLcNjo2PYDCvfJuYG6UwRHEKRkOCZpbsUrvjDCKdbHsFeqvnY3kTMH3HSRsk92ikJiC 0NiHpcTNbSE/PVccVtNyOZSosVLrIPFbuYcDbnOJUZohzSXJaTtiB5zNwCk+eFeVEcxj vZG0+QUAL/r/MqdgY+/CLmR8Pkucd9J5qUeMHvKmJVXlGJon3YuVlOUcxrd5Fz/kssqo vtSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=muusjW1g; spf=pass (google.com: domain of linux-leds-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id dj24si166723edb.266.2020.06.17.08.10.24; Wed, 17 Jun 2020 08:10:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-leds-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=muusjW1g; spf=pass (google.com: domain of linux-leds-owner@vger.kernel.org designates 23.128.96.18 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 S1727083AbgFQPKV (ORCPT + 1 other); Wed, 17 Jun 2020 11:10:21 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:40540 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727075AbgFQPKT (ORCPT ); Wed, 17 Jun 2020 11:10:19 -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 05HFA85s005059; Wed, 17 Jun 2020 10:10:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1592406608; bh=Jf6MKK966/6Olzk1qJChUoSjiHhXr8OEtTXC2DBLRbo=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=muusjW1ggS1J0niRCtqbenqOuuw2PbiNrXkwCAALjA4fnO3qra19ssFB7jqf1lTTh y1QHzLVy2GSXhPXenX2qn4xbL397Vt+AIgqXY+G4LpyEzFUoCsWRC1s4eDQdWEQHus BP/a2OfmYCNkXzaeP1rcjMYX1A0BbLUW7zj83+ws= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id 05HFA8nH112464; Wed, 17 Jun 2020 10:10:08 -0500 Received: from DLEE100.ent.ti.com (157.170.170.30) 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.1979.3; Wed, 17 Jun 2020 10:10:07 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Wed, 17 Jun 2020 10:10: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 05HFA7xI041704; Wed, 17 Jun 2020 10:10:07 -0500 From: Dan Murphy To: , , CC: , , , Dan Murphy , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team Subject: [PATCH v28 08/15] ARM: dts: imx6dl-yapp4: Add reg property to the lp5562 channel node Date: Wed, 17 Jun 2020 10:09:17 -0500 Message-ID: <20200617150924.12665-9-dmurphy@ti.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200617150924.12665-1-dmurphy@ti.com> References: <20200617150924.12665-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 the reg property to each channel node. This update is to accommodate the multicolor framework. In addition to the accommodation this allows the LEDs to be placed on any channel and allow designs to skip channels as opposed to requiring sequential order. Acked-by: Pavel Machek 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 | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) -- 2.26.2 diff --git a/arch/arm/boot/dts/imx6dl-yapp4-common.dtsi b/arch/arm/boot/dts/imx6dl-yapp4-common.dtsi index 2b9423d55c37..77aa90640052 100644 --- a/arch/arm/boot/dts/imx6dl-yapp4-common.dtsi +++ b/arch/arm/boot/dts/imx6dl-yapp4-common.dtsi @@ -258,29 +258,35 @@ leds: led-controller@30 { reg = <0x30>; clock-mode = /bits/ 8 <1>; status = "disabled"; + #address-cells = <1>; + #size-cells = <0>; - chan0 { + chan@0 { chan-name = "R"; led-cur = /bits/ 8 <0x20>; max-cur = /bits/ 8 <0x60>; + reg = <0>; }; - chan1 { + chan@1 { chan-name = "G"; led-cur = /bits/ 8 <0x20>; max-cur = /bits/ 8 <0x60>; + reg = <1>; }; - chan2 { + chan@2 { chan-name = "B"; led-cur = /bits/ 8 <0x20>; max-cur = /bits/ 8 <0x60>; + reg = <2>; }; - chan3 { + chan@3 { chan-name = "W"; led-cur = /bits/ 8 <0x0>; max-cur = /bits/ 8 <0x0>; + reg = <3>; }; }; From patchwork Wed Jun 17 15:09:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 190872 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp538685ilo; Wed, 17 Jun 2020 08:10:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3jQwrc0Tx938AF9wAQY+wH2SugbDCrdItqwl2ckBbpT2xZO17i4784xQpm22nD3n6MKG1 X-Received: by 2002:a17:906:5652:: with SMTP id v18mr7613842ejr.72.1592406618953; Wed, 17 Jun 2020 08:10:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592406618; cv=none; d=google.com; s=arc-20160816; b=G88owbZagd108g9nUfKJv2xHq7CIvyY+akW+tA0mqAiahd07cyX82Q/D/Xxp2yZ81a IDQ+SpC1C9NGIJzU3Odn+Mxbnqk5gWIaQ0hFQV82sUm3em3zTZaIRD0Fv9o9bRkNMer5 ZFY1GG7yuxjkJT2SQN1xSOSBl5fMtLFma/4cKE4uIiTM/7rLsm15tG+SepB5AeS51NHB KNzHC7k/szaxGSTV88kthc51+8onjw2eJfwO3+RdjS0b0BvvAPMm3NKHUZV5YJs2P6QH XRMMUEqZcHRsWt8HIzIZ40n9FQzTtVOMPSyFDWV+mCVDtGnwHQtj6Qy9ZTzJFKD3QXGM waWA== 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=6kv4oPPzDnEU5/icPEIdws3eUefH8b8hua+2r+1UQCA=; b=h4JJr37rVwlgcKXZFrfTp3UXE3zBoTDYza1OnGlseSGeTUo21k/aLquwz2goOmHdDY 4wPNv4WGrzTgB2P97YXlqm76fVffBSgzebyZ2mUEPAFmGntGI4Xf0ksNBp/DKGm5U5cp qfKuxQVP9fZYd6yGjTqRqqVantq6O7+w52kKcV81p4tWrM0hfzypHk332RL6Y+GQ4hVM lO2Y3oBf76B0nKsz49ajh6JPBiVhfpJc6HV8EjezKmZFedEQIWs7hATGyrXEZKM8PR7u y7QRHWYLK3KZaa6J8WucQ5wub8mSpEGPr38FFZVHuEH4MAZtyB93a2Q9xdCl7MaIHvKN 3gYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=RJpGoT7g; spf=pass (google.com: domain of linux-leds-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id dj24si166723edb.266.2020.06.17.08.10.18; Wed, 17 Jun 2020 08:10:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-leds-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=RJpGoT7g; spf=pass (google.com: domain of linux-leds-owner@vger.kernel.org designates 23.128.96.18 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 S1726940AbgFQPKS (ORCPT + 1 other); Wed, 17 Jun 2020 11:10:18 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:40532 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727001AbgFQPKR (ORCPT ); Wed, 17 Jun 2020 11:10:17 -0400 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 05HFADhZ005071; Wed, 17 Jun 2020 10:10:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1592406613; bh=6kv4oPPzDnEU5/icPEIdws3eUefH8b8hua+2r+1UQCA=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=RJpGoT7gkdz/7ELsfFzAxz2w4YQlVQYH0Z+8D2AoMuSDPdUH5OoixSqBDHLKLAD0+ RwrP27nKR1zdbZeGzLz+PurPu3euSY3yAai6KTYi7s0dYp+MVqmprFcArsULG0q2XF xn7d4lO5/uFRfiAai9DOYEsDeJl3Bx+Csya6oa1Y= Received: from DLEE111.ent.ti.com (dlee111.ent.ti.com [157.170.170.22]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 05HFADOB110690 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 17 Jun 2020 10:10:13 -0500 Received: from DLEE109.ent.ti.com (157.170.170.41) by DLEE111.ent.ti.com (157.170.170.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 17 Jun 2020 10:10:13 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) 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.1979.3 via Frontend Transport; Wed, 17 Jun 2020 10:10:13 -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 05HFAC0l107424; Wed, 17 Jun 2020 10:10:13 -0500 From: Dan Murphy To: , , CC: , , , Dan Murphy , Linus Walleij Subject: [PATCH v28 09/15] ARM: dts: ste-href: Add reg property to the LP5521 channel nodes Date: Wed, 17 Jun 2020 10:09:18 -0500 Message-ID: <20200617150924.12665-10-dmurphy@ti.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200617150924.12665-1-dmurphy@ti.com> References: <20200617150924.12665-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 the reg property to each channel node. This update is to accommodate the multicolor framework. In addition to the accommodation 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: Linus Walleij Acked-by: Pavel Machek --- arch/arm/boot/dts/ste-href.dtsi | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) -- 2.26.2 diff --git a/arch/arm/boot/dts/ste-href.dtsi b/arch/arm/boot/dts/ste-href.dtsi index 33e3b0b3c53d..ff47cbf6ed3b 100644 --- a/arch/arm/boot/dts/ste-href.dtsi +++ b/arch/arm/boot/dts/ste-href.dtsi @@ -58,16 +58,21 @@ lp5521@33 { reg = <0x33>; label = "lp5521_pri"; clock-mode = /bits/ 8 <2>; - chan0 { + #address-cells = <1>; + #size-cells = <0>; + chan@0 { + reg = <0>; led-cur = /bits/ 8 <0x2f>; max-cur = /bits/ 8 <0x5f>; linux,default-trigger = "heartbeat"; }; - chan1 { + chan@1 { + reg = <1>; led-cur = /bits/ 8 <0x2f>; max-cur = /bits/ 8 <0x5f>; }; - chan2 { + chan@2 { + reg = <2>; led-cur = /bits/ 8 <0x2f>; max-cur = /bits/ 8 <0x5f>; }; @@ -77,15 +82,20 @@ lp5521@34 { reg = <0x34>; label = "lp5521_sec"; clock-mode = /bits/ 8 <2>; - chan0 { + #address-cells = <1>; + #size-cells = <0>; + chan@0 { + reg = <0>; led-cur = /bits/ 8 <0x2f>; max-cur = /bits/ 8 <0x5f>; }; - chan1 { + chan@1 { + reg = <1>; led-cur = /bits/ 8 <0x2f>; max-cur = /bits/ 8 <0x5f>; }; - chan2 { + chan@2 { + reg = <2>; led-cur = /bits/ 8 <0x2f>; max-cur = /bits/ 8 <0x5f>; }; From patchwork Wed Jun 17 15:09:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 209003 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.9 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA1BFC433DF for ; Wed, 17 Jun 2020 15:10:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BA2452070A for ; Wed, 17 Jun 2020 15:10:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="JmCVgppu" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727108AbgFQPK3 (ORCPT ); Wed, 17 Jun 2020 11:10:29 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:54532 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727097AbgFQPK2 (ORCPT ); Wed, 17 Jun 2020 11:10:28 -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 05HFANxY004561; Wed, 17 Jun 2020 10:10:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1592406623; bh=dOhpufUAnsje/brIgTno7852FNxpMKY163kb7+BzoEQ=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=JmCVgppuMnu1hK7cr7YXwGq3Ntfeg/j86WQnbG3o8dLhK2lOFgtU+EZjXd7I0oL3O j9qb5SFpCT/U1zyvX7L+xXpmB4ph3W0ah7HjPAhE7sDfn+z2PSIxWjoHSW21uHsKj0 jbtrKNkhIYsg2n6lrDKnp2TfpT1+aagKSRUNGfis= 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 05HFANfF119052 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 17 Jun 2020 10:10:23 -0500 Received: from DLEE100.ent.ti.com (157.170.170.30) 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.1979.3; Wed, 17 Jun 2020 10:10:23 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Wed, 17 Jun 2020 10:10:23 -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 05HFANLp042029; Wed, 17 Jun 2020 10:10:23 -0500 From: Dan Murphy To: , , CC: , , , Dan Murphy Subject: [PATCH v28 11/15] leds: lp55xx: Add multicolor framework support to lp55xx Date: Wed, 17 Jun 2020 10:09:20 -0500 Message-ID: <20200617150924.12665-12-dmurphy@ti.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200617150924.12665-1-dmurphy@ti.com> References: <20200617150924.12665-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 multicolor framework support for the lp55xx family. Acked-by: Pavel Machek Acked-by: Jacek Anaszewski Signed-off-by: Dan Murphy --- drivers/leds/Kconfig | 1 + drivers/leds/leds-lp5521.c | 14 +- drivers/leds/leds-lp5523.c | 14 +- drivers/leds/leds-lp5562.c | 13 +- drivers/leds/leds-lp55xx-common.c | 177 +++++++++++++++++++--- drivers/leds/leds-lp55xx-common.h | 14 +- drivers/leds/leds-lp8501.c | 14 +- include/linux/platform_data/leds-lp55xx.h | 8 + 8 files changed, 208 insertions(+), 47 deletions(-) diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index 68f63d1a7d48..04e0cb39f92e 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -398,6 +398,7 @@ config LEDS_LP50XX config LEDS_LP55XX_COMMON tristate "Common Driver for TI/National LP5521/5523/55231/5562/8501" depends on LEDS_LP5521 || LEDS_LP5523 || LEDS_LP5562 || LEDS_LP8501 + depends on OF select FW_LOADER select FW_LOADER_USER_HELPER help diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c index 6d2163c0f625..6ff81d6be789 100644 --- a/drivers/leds/leds-lp5521.c +++ b/drivers/leds/leds-lp5521.c @@ -505,9 +505,16 @@ static int lp5521_probe(struct i2c_client *client, struct lp55xx_platform_data *pdata = dev_get_platdata(&client->dev); struct device_node *np = client->dev.of_node; + chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); + if (!chip) + return -ENOMEM; + + chip->cfg = &lp5521_cfg; + if (!pdata) { if (np) { - pdata = lp55xx_of_populate_pdata(&client->dev, np); + pdata = lp55xx_of_populate_pdata(&client->dev, np, + chip); if (IS_ERR(pdata)) return PTR_ERR(pdata); } else { @@ -516,10 +523,6 @@ static int lp5521_probe(struct i2c_client *client, } } - chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); - if (!chip) - return -ENOMEM; - led = devm_kcalloc(&client->dev, pdata->num_channels, sizeof(*led), GFP_KERNEL); if (!led) @@ -527,7 +530,6 @@ static int lp5521_probe(struct i2c_client *client, chip->cl = client; chip->pdata = pdata; - chip->cfg = &lp5521_cfg; mutex_init(&chip->lock); diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c index 15e7051392f5..b076c16df9ab 100644 --- a/drivers/leds/leds-lp5523.c +++ b/drivers/leds/leds-lp5523.c @@ -872,9 +872,16 @@ static int lp5523_probe(struct i2c_client *client, struct lp55xx_platform_data *pdata = dev_get_platdata(&client->dev); struct device_node *np = client->dev.of_node; + chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); + if (!chip) + return -ENOMEM; + + chip->cfg = &lp5523_cfg; + if (!pdata) { if (np) { - pdata = lp55xx_of_populate_pdata(&client->dev, np); + pdata = lp55xx_of_populate_pdata(&client->dev, np, + chip); if (IS_ERR(pdata)) return PTR_ERR(pdata); } else { @@ -883,10 +890,6 @@ static int lp5523_probe(struct i2c_client *client, } } - chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); - if (!chip) - return -ENOMEM; - led = devm_kcalloc(&client->dev, pdata->num_channels, sizeof(*led), GFP_KERNEL); if (!led) @@ -894,7 +897,6 @@ static int lp5523_probe(struct i2c_client *client, chip->cl = client; chip->pdata = pdata; - chip->cfg = &lp5523_cfg; mutex_init(&chip->lock); diff --git a/drivers/leds/leds-lp5562.c b/drivers/leds/leds-lp5562.c index 1c94422408b0..7ecdd199d7ef 100644 --- a/drivers/leds/leds-lp5562.c +++ b/drivers/leds/leds-lp5562.c @@ -520,9 +520,16 @@ static int lp5562_probe(struct i2c_client *client, struct lp55xx_platform_data *pdata = dev_get_platdata(&client->dev); struct device_node *np = client->dev.of_node; + chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); + if (!chip) + return -ENOMEM; + + chip->cfg = &lp5562_cfg; + if (!pdata) { if (np) { - pdata = lp55xx_of_populate_pdata(&client->dev, np); + pdata = lp55xx_of_populate_pdata(&client->dev, np, + chip); if (IS_ERR(pdata)) return PTR_ERR(pdata); } else { @@ -531,9 +538,6 @@ static int lp5562_probe(struct i2c_client *client, } } - chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); - if (!chip) - return -ENOMEM; led = devm_kcalloc(&client->dev, pdata->num_channels, sizeof(*led), GFP_KERNEL); @@ -542,7 +546,6 @@ static int lp5562_probe(struct i2c_client *client, chip->cl = client; chip->pdata = pdata; - chip->cfg = &lp5562_cfg; mutex_init(&chip->lock); diff --git a/drivers/leds/leds-lp55xx-common.c b/drivers/leds/leds-lp55xx-common.c index 882ef39e4965..d33564aef563 100644 --- a/drivers/leds/leds-lp55xx-common.c +++ b/drivers/leds/leds-lp55xx-common.c @@ -35,6 +35,11 @@ static struct lp55xx_led *dev_to_lp55xx_led(struct device *dev) return cdev_to_lp55xx_led(dev_get_drvdata(dev)); } +static struct lp55xx_led *mcled_cdev_to_led(struct led_classdev_mc *mc_cdev) +{ + return container_of(mc_cdev, struct lp55xx_led, mc_cdev); +} + static void lp55xx_reset_device(struct lp55xx_chip *chip) { struct lp55xx_device_config *cfg = chip->cfg; @@ -131,6 +136,18 @@ static struct attribute *lp55xx_led_attrs[] = { }; ATTRIBUTE_GROUPS(lp55xx_led); +static int lp55xx_set_mc_brightness(struct led_classdev *cdev, + enum led_brightness brightness) +{ + struct led_classdev_mc *mc_dev = lcdev_to_mccdev(cdev); + struct lp55xx_led *led = mcled_cdev_to_led(mc_dev); + struct lp55xx_device_config *cfg = led->chip->cfg; + + led_mc_calc_color_components(&led->mc_cdev, brightness); + return cfg->multicolor_brightness_fn(led); + +} + static int lp55xx_set_brightness(struct led_classdev *cdev, enum led_brightness brightness) { @@ -147,9 +164,12 @@ static int lp55xx_init_led(struct lp55xx_led *led, struct lp55xx_platform_data *pdata = chip->pdata; struct lp55xx_device_config *cfg = chip->cfg; struct device *dev = &chip->cl->dev; + int max_channel = cfg->max_channel; + struct mc_subled *mc_led_info; + struct led_classdev *led_cdev; char name[32]; + int i, j = 0; int ret; - int max_channel = cfg->max_channel; if (chan >= max_channel) { dev_err(dev, "invalid channel: %d / %d\n", chan, max_channel); @@ -159,10 +179,43 @@ static int lp55xx_init_led(struct lp55xx_led *led, if (pdata->led_config[chan].led_current == 0) return 0; + if (pdata->led_config[chan].name) { + led->cdev.name = pdata->led_config[chan].name; + } else { + snprintf(name, sizeof(name), "%s:channel%d", + pdata->label ? : chip->cl->name, chan); + led->cdev.name = name; + } + + if (pdata->led_config[chan].num_colors > 1) { + mc_led_info = devm_kcalloc(dev, + pdata->led_config[chan].num_colors, + sizeof(*mc_led_info), GFP_KERNEL); + if (!mc_led_info) + return -ENOMEM; + + led_cdev = &led->mc_cdev.led_cdev; + led_cdev->name = led->cdev.name; + led_cdev->brightness_set_blocking = lp55xx_set_mc_brightness; + led->mc_cdev.num_colors = pdata->led_config[chan].num_colors; + for (i = 0; i < led->mc_cdev.num_colors; i++) { + mc_led_info[i].color_index = + pdata->led_config[chan].color_id[i]; + mc_led_info[i].channel = + pdata->led_config[chan].output_num[i]; + j++; + } + + led->mc_cdev.subled_info = mc_led_info; + } else { + led->cdev.brightness_set_blocking = lp55xx_set_brightness; + } + + led->cdev.groups = lp55xx_led_groups; + led->cdev.default_trigger = pdata->led_config[chan].default_trigger; led->led_current = pdata->led_config[chan].led_current; led->max_current = pdata->led_config[chan].max_current; led->chan_nr = pdata->led_config[chan].chan_nr; - led->cdev.default_trigger = pdata->led_config[chan].default_trigger; if (led->chan_nr >= max_channel) { dev_err(dev, "Use channel numbers between 0 and %d\n", @@ -170,18 +223,11 @@ static int lp55xx_init_led(struct lp55xx_led *led, return -EINVAL; } - led->cdev.brightness_set_blocking = lp55xx_set_brightness; - led->cdev.groups = lp55xx_led_groups; - - if (pdata->led_config[chan].name) { - led->cdev.name = pdata->led_config[chan].name; - } else { - snprintf(name, sizeof(name), "%s:channel%d", - pdata->label ? : chip->cl->name, chan); - led->cdev.name = name; - } + if (pdata->led_config[chan].num_colors > 1) + ret = devm_led_classdev_multicolor_register(dev, &led->mc_cdev); + else + ret = devm_led_classdev_register(dev, &led->cdev); - ret = devm_led_classdev_register(dev, &led->cdev); if (ret) { dev_err(dev, "led register err: %d\n", ret); return ret; @@ -525,14 +571,105 @@ void lp55xx_unregister_sysfs(struct lp55xx_chip *chip) } EXPORT_SYMBOL_GPL(lp55xx_unregister_sysfs); +static int lp55xx_parse_common_child(struct device_node *np, + struct lp55xx_led_config *cfg, + int led_number, int *chan_nr) +{ + int ret; + + of_property_read_string(np, "chan-name", + &cfg[led_number].name); + of_property_read_u8(np, "led-cur", + &cfg[led_number].led_current); + of_property_read_u8(np, "max-cur", + &cfg[led_number].max_current); + + ret = of_property_read_u32(np, "reg", chan_nr); + if (ret) + return ret; + + if (*chan_nr < 0 || *chan_nr > cfg->max_channel) + return -EINVAL; + + return 0; +} + +static int lp55xx_parse_multi_led_child(struct device_node *child, + struct lp55xx_led_config *cfg, + int child_number, int color_number) +{ + int chan_nr, color_id, ret; + + ret = lp55xx_parse_common_child(child, cfg, child_number, &chan_nr); + if (ret) + return ret; + + ret = of_property_read_u32(child, "color", &color_id); + if (ret) + return ret; + + cfg[child_number].color_id[color_number] = color_id; + cfg[child_number].output_num[color_number] = chan_nr; + + return 0; +} + +static int lp55xx_parse_multi_led(struct device_node *np, + struct lp55xx_led_config *cfg, + int child_number) +{ + struct device_node *child; + int num_colors = 0, ret; + + for_each_child_of_node(np, child) { + ret = lp55xx_parse_multi_led_child(child, cfg, child_number, + num_colors); + if (ret) + return ret; + num_colors++; + } + + cfg[child_number].num_colors = num_colors; + + return 0; +} + +static int lp55xx_parse_logical_led(struct device_node *np, + struct lp55xx_led_config *cfg, + int child_number) +{ + int led_color, ret; + int chan_nr = 0; + + cfg[child_number].default_trigger = + of_get_property(np, "linux,default-trigger", NULL); + + ret = of_property_read_u32(np, "color", &led_color); + if (ret) + return ret; + + if (led_color == LED_COLOR_ID_MULTI) + return lp55xx_parse_multi_led(np, cfg, child_number); + + ret = lp55xx_parse_common_child(np, cfg, child_number, &chan_nr); + if (ret < 0) + return ret; + + cfg[child_number].chan_nr = chan_nr; + + return ret; +} + struct lp55xx_platform_data *lp55xx_of_populate_pdata(struct device *dev, - struct device_node *np) + struct device_node *np, + struct lp55xx_chip *chip) { struct device_node *child; struct lp55xx_platform_data *pdata; struct lp55xx_led_config *cfg; int num_channels; int i = 0; + int ret; pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); if (!pdata) @@ -550,16 +687,12 @@ struct lp55xx_platform_data *lp55xx_of_populate_pdata(struct device *dev, pdata->led_config = &cfg[0]; pdata->num_channels = num_channels; + cfg->max_channel = chip->cfg->max_channel; for_each_child_of_node(np, child) { - cfg[i].chan_nr = i; - - of_property_read_string(child, "chan-name", &cfg[i].name); - of_property_read_u8(child, "led-cur", &cfg[i].led_current); - of_property_read_u8(child, "max-cur", &cfg[i].max_current); - cfg[i].default_trigger = - of_get_property(child, "linux,default-trigger", NULL); - + ret = lp55xx_parse_logical_led(child, cfg, i); + if (ret) + return ERR_PTR(-EINVAL); i++; } diff --git a/drivers/leds/leds-lp55xx-common.h b/drivers/leds/leds-lp55xx-common.h index b9b1041e8143..2f38c5b33830 100644 --- a/drivers/leds/leds-lp55xx-common.h +++ b/drivers/leds/leds-lp55xx-common.h @@ -12,6 +12,8 @@ #ifndef _LEDS_LP55XX_COMMON_H #define _LEDS_LP55XX_COMMON_H +#include + enum lp55xx_engine_index { LP55XX_ENGINE_INVALID, LP55XX_ENGINE_1, @@ -93,6 +95,7 @@ struct lp55xx_reg { * @max_channel : Maximum number of channels * @post_init_device : Chip specific initialization code * @brightness_fn : Brightness function + * @multicolor_brightness_fn : Multicolor brightness function * @set_led_current : LED current set function * @firmware_cb : Call function when the firmware is loaded * @run_engine : Run internal engine for pattern @@ -106,9 +109,12 @@ struct lp55xx_device_config { /* define if the device has specific initialization process */ int (*post_init_device) (struct lp55xx_chip *chip); - /* access brightness register */ + /* set LED brightness */ int (*brightness_fn)(struct lp55xx_led *led); + /* set multicolor LED brightness */ + int (*multicolor_brightness_fn)(struct lp55xx_led *led); + /* current setting function */ void (*set_led_current) (struct lp55xx_led *led, u8 led_current); @@ -159,6 +165,8 @@ struct lp55xx_chip { * struct lp55xx_led * @chan_nr : Channel number * @cdev : LED class device + * @mc_cdev : Multi color class device + * @color_components: Multi color LED map information * @led_current : Current setting at each led channel * @max_current : Maximun current at each led channel * @brightness : Brightness value @@ -167,6 +175,7 @@ struct lp55xx_chip { struct lp55xx_led { int chan_nr; struct led_classdev cdev; + struct led_classdev_mc mc_cdev; u8 led_current; u8 max_current; u8 brightness; @@ -196,6 +205,7 @@ extern void lp55xx_unregister_sysfs(struct lp55xx_chip *chip); /* common device tree population function */ extern struct lp55xx_platform_data -*lp55xx_of_populate_pdata(struct device *dev, struct device_node *np); +*lp55xx_of_populate_pdata(struct device *dev, struct device_node *np, + struct lp55xx_chip *chip); #endif /* _LEDS_LP55XX_COMMON_H */ diff --git a/drivers/leds/leds-lp8501.c b/drivers/leds/leds-lp8501.c index a58019cdb8c3..ac2c31db4a65 100644 --- a/drivers/leds/leds-lp8501.c +++ b/drivers/leds/leds-lp8501.c @@ -308,9 +308,16 @@ static int lp8501_probe(struct i2c_client *client, struct lp55xx_platform_data *pdata = dev_get_platdata(&client->dev); struct device_node *np = client->dev.of_node; + chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); + if (!chip) + return -ENOMEM; + + chip->cfg = &lp8501_cfg; + if (!pdata) { if (np) { - pdata = lp55xx_of_populate_pdata(&client->dev, np); + pdata = lp55xx_of_populate_pdata(&client->dev, np, + chip); if (IS_ERR(pdata)) return PTR_ERR(pdata); } else { @@ -319,10 +326,6 @@ static int lp8501_probe(struct i2c_client *client, } } - chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); - if (!chip) - return -ENOMEM; - led = devm_kcalloc(&client->dev, pdata->num_channels, sizeof(*led), GFP_KERNEL); if (!led) @@ -330,7 +333,6 @@ static int lp8501_probe(struct i2c_client *client, chip->cl = client; chip->pdata = pdata; - chip->cfg = &lp8501_cfg; mutex_init(&chip->lock); diff --git a/include/linux/platform_data/leds-lp55xx.h b/include/linux/platform_data/leds-lp55xx.h index 96a787100fda..d85275aea38c 100644 --- a/include/linux/platform_data/leds-lp55xx.h +++ b/include/linux/platform_data/leds-lp55xx.h @@ -12,17 +12,25 @@ #ifndef _LEDS_LP55XX_H #define _LEDS_LP55XX_H +#include + /* Clock configuration */ #define LP55XX_CLOCK_AUTO 0 #define LP55XX_CLOCK_INT 1 #define LP55XX_CLOCK_EXT 2 +#define LP55XX_MAX_GROUPED_CHAN 4 + struct lp55xx_led_config { const char *name; const char *default_trigger; u8 chan_nr; u8 led_current; /* mA x10, 0 if led is not connected */ u8 max_current; + int num_colors; + unsigned int max_channel; + int color_id[LED_COLOR_ID_MAX]; + int output_num[LED_COLOR_ID_MAX]; }; struct lp55xx_predef_pattern { From patchwork Wed Jun 17 15:09:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 190879 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp539410ilo; Wed, 17 Jun 2020 08:11:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8a5K4EnAwvYon4EhVQ7U+jgVGzHa2Qoi3WGrNUnQIJjFSgUbt+QR2/xIPG0xTudp5Rzvt X-Received: by 2002:a17:906:d216:: with SMTP id w22mr7731455ejz.420.1592406660692; Wed, 17 Jun 2020 08:11:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592406660; cv=none; d=google.com; s=arc-20160816; b=J4G7kyngdRiiGxg/Pj8EHlMGuYw+ldu2z6EQQy+7wsqIdE3IptIasgMN34HiV7yuD4 JmXci7IlGEPWKqMhv03MK8fvKMAsh/uFDUPjWMrxjzQ54pXgRT8Qrb2k2qh9ULOrHtMi dH1ZG2Kw1sNP29STH4QHX98AJ9RnYrkmwNni7ixImWrICF9cGbnDi1nJJwdH1eNvZt/b OE0H0KhvWtMraAh0/+5tHDnYdPCDEFbALdfe2Y0KTa5jWzkmwfzElcriUkBjezM0KYZf ld3hf4yePDZYl34RWJimZ3pwKByFuM1GspbIAGyhFN72AmzKJXnKYk9aNu196LPfGv5g XCWA== 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=+LYKN1Pq2F/LuV9iJvrrRWifuR4y4GQ5OVW8WFHqYck=; b=romX9nyERmxnRWzNsnRxglg73CLrpZXMRAUcGImc47fcdjRRjYhmEWkySpOv/J2Xvv +9D7Y6ExhK9VNiqbWViMkZ/FkbEyOXPLAC9aoYmkFMt3qolVen4DKsuE6oWw6xl5OBsy MpBozqNvMMeVEdoqZqH2AS5TAO4kialIWgSqfF4NyYX0rCwRDHmUJN6wO/1lpIg52rLh Z6+dKm5a5flj9m7lVPKR3nQb2Sks+L/alBdqMDbkhnJAh4aFCgzBqz+bPt1RmqDc69gX mJ7gItYrmf+pn/+PyteOaKgba6+m52FLxvKaDvXsXUO9/V/bfobNCmMTHShwGz3F8a4s SSLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Mjuj0dqF; spf=pass (google.com: domain of linux-leds-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id du7si118386ejc.341.2020.06.17.08.11.00; Wed, 17 Jun 2020 08:11:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-leds-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Mjuj0dqF; spf=pass (google.com: domain of linux-leds-owner@vger.kernel.org designates 23.128.96.18 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 S1727771AbgFQPKe (ORCPT + 1 other); Wed, 17 Jun 2020 11:10:34 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:32896 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727121AbgFQPKc (ORCPT ); Wed, 17 Jun 2020 11:10:32 -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 05HFATQ5117079; Wed, 17 Jun 2020 10:10:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1592406629; bh=+LYKN1Pq2F/LuV9iJvrrRWifuR4y4GQ5OVW8WFHqYck=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Mjuj0dqFIBqtUp92BS3SjGGdaO2dJfiE0413B+rz3zXaST7hJaaN0jPDV6hB28ipd 2f/YmXUUAd+plQvUh9UMHTPNyvPYa6IOo45RatBpQ/cc2iMUMI/jkRM6lTdLoldU/5 H75CL6C8nP2codtVew8FsX/ABwQdjDo/94uMSXwU= Received: from DLEE112.ent.ti.com (dlee112.ent.ti.com [157.170.170.23]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id 05HFATOj112797; Wed, 17 Jun 2020 10:10:29 -0500 Received: from DLEE112.ent.ti.com (157.170.170.23) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 17 Jun 2020 10:10:28 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Wed, 17 Jun 2020 10:10:28 -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 05HFASCi042118; Wed, 17 Jun 2020 10:10:28 -0500 From: Dan Murphy To: , , CC: , , , Dan Murphy Subject: [PATCH v28 12/15] leds: lp5523: Update the lp5523 code to add multicolor brightness function Date: Wed, 17 Jun 2020 10:09:21 -0500 Message-ID: <20200617150924.12665-13-dmurphy@ti.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200617150924.12665-1-dmurphy@ti.com> References: <20200617150924.12665-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 the multicolor brightness call back to support the multicolor framework. This call back allows setting brightness on grouped channels in a single function. Acked-by: Pavel Machek Acked-by: Jacek Anaszewski Signed-off-by: Dan Murphy --- drivers/leds/Kconfig | 1 + drivers/leds/leds-lp5523.c | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) -- 2.26.2 diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index 04e0cb39f92e..44d8b2293436 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -418,6 +418,7 @@ config LEDS_LP5521 config LEDS_LP5523 tristate "LED Support for TI/National LP5523/55231 LED driver chip" depends on LEDS_CLASS && I2C + depends on LEDS_CLASS_MULTI_COLOR || !LEDS_CLASS_MULTI_COLOR select LEDS_LP55XX_COMMON help If you say yes here you get support for TI/National Semiconductor diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c index b076c16df9ab..9776dc72a764 100644 --- a/drivers/leds/leds-lp5523.c +++ b/drivers/leds/leds-lp5523.c @@ -791,6 +791,25 @@ static ssize_t store_master_fader_leds(struct device *dev, return ret; } +static int lp5523_multicolor_brightness(struct lp55xx_led *led) +{ + struct lp55xx_chip *chip = led->chip; + int ret; + int i; + + mutex_lock(&chip->lock); + for (i = 0; i < led->mc_cdev.num_colors; i++) { + ret = lp55xx_write(chip, + LP5523_REG_LED_PWM_BASE + + led->mc_cdev.subled_info[i].channel, + led->mc_cdev.subled_info[i].brightness); + if (ret) + break; + } + mutex_unlock(&chip->lock); + return ret; +} + static int lp5523_led_brightness(struct lp55xx_led *led) { struct lp55xx_chip *chip = led->chip; @@ -857,6 +876,7 @@ static struct lp55xx_device_config lp5523_cfg = { .max_channel = LP5523_MAX_LEDS, .post_init_device = lp5523_post_init_device, .brightness_fn = lp5523_led_brightness, + .multicolor_brightness_fn = lp5523_multicolor_brightness, .set_led_current = lp5523_set_led_current, .firmware_cb = lp5523_firmware_loaded, .run_engine = lp5523_run_engine, From patchwork Wed Jun 17 15:09:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 209002 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86C7CC433E1 for ; Wed, 17 Jun 2020 15:10:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5E11A20888 for ; Wed, 17 Jun 2020 15:10:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="BRAsVLqV" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727774AbgFQPKe (ORCPT ); Wed, 17 Jun 2020 11:10:34 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:32904 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727097AbgFQPKd (ORCPT ); Wed, 17 Jun 2020 11:10:33 -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 05HFAT6J117083; Wed, 17 Jun 2020 10:10:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1592406629; bh=lMIaogbEfi0+ny6Ex1XJobeenrR+G5V3/yTQPvhRgXI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=BRAsVLqVAhptVUelnTlV0cbILICQhKyB/go8+/8doCSV0CV4fQJi7zNt/VKip7YWi Nmyg9SSQsShJwjt7cwmFEWDAh0uKdsxwj8qoX+iLYZKm4thSb8bKP3pNrwNv3SMz+A kR8duJv+i5LksU+tHn43IDIukzq4rDuzpB3DNJ2Q= Received: from DFLE112.ent.ti.com (dfle112.ent.ti.com [10.64.6.33]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 05HFATmV119104 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 17 Jun 2020 10:10:29 -0500 Received: from DFLE102.ent.ti.com (10.64.6.23) 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.1979.3; Wed, 17 Jun 2020 10:10:28 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) 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.1979.3 via Frontend Transport; Wed, 17 Jun 2020 10:10:28 -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 05HFASJR108741; Wed, 17 Jun 2020 10:10:28 -0500 From: Dan Murphy To: , , CC: , , , Dan Murphy Subject: [PATCH v28 13/15] leds: lp5521: Add multicolor framework multicolor brightness support Date: Wed, 17 Jun 2020 10:09:22 -0500 Message-ID: <20200617150924.12665-14-dmurphy@ti.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200617150924.12665-1-dmurphy@ti.com> References: <20200617150924.12665-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 the multicolor brightness call back to support the multicolor framework. This function allows setting the brightness across grouped LED channels in a single call. Acked-by: Pavel Machek Acked-by: Jacek Anaszewski Signed-off-by: Dan Murphy --- drivers/leds/Kconfig | 1 + drivers/leds/leds-lp5521.c | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index 44d8b2293436..adfa762cb291 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -408,6 +408,7 @@ config LEDS_LP55XX_COMMON config LEDS_LP5521 tristate "LED Support for N.S. LP5521 LED driver chip" depends on LEDS_CLASS && I2C + depends on LEDS_CLASS_MULTI_COLOR || !LEDS_CLASS_MULTI_COLOR select LEDS_LP55XX_COMMON help If you say yes here you get support for the National Semiconductor diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c index 6ff81d6be789..ef8c3bfa8f3c 100644 --- a/drivers/leds/leds-lp5521.c +++ b/drivers/leds/leds-lp5521.c @@ -349,6 +349,25 @@ static int lp5521_run_selftest(struct lp55xx_chip *chip, char *buf) return 0; } +static int lp5521_multicolor_brightness(struct lp55xx_led *led) +{ + struct lp55xx_chip *chip = led->chip; + int ret; + int i; + + mutex_lock(&chip->lock); + for (i = 0; i < led->mc_cdev.num_colors; i++) { + ret = lp55xx_write(chip, + LP5521_REG_LED_PWM_BASE + + led->mc_cdev.subled_info[i].channel, + led->mc_cdev.subled_info[i].brightness); + if (ret) + break; + } + mutex_unlock(&chip->lock); + return ret; +} + static int lp5521_led_brightness(struct lp55xx_led *led) { struct lp55xx_chip *chip = led->chip; @@ -490,6 +509,7 @@ static struct lp55xx_device_config lp5521_cfg = { .max_channel = LP5521_MAX_LEDS, .post_init_device = lp5521_post_init_device, .brightness_fn = lp5521_led_brightness, + .multicolor_brightness_fn = lp5521_multicolor_brightness, .set_led_current = lp5521_set_led_current, .firmware_cb = lp5521_firmware_loaded, .run_engine = lp5521_run_engine, From patchwork Wed Jun 17 15:09:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 190877 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp539307ilo; Wed, 17 Jun 2020 08:10:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxouenVeDGY3xGhzE2rL1gmFyUGW4R5TquEoKN8ZrtNy/zmQtUt+1FDOHn3M0NRWuzK/ya8 X-Received: by 2002:aa7:c38f:: with SMTP id k15mr8081599edq.342.1592406654905; Wed, 17 Jun 2020 08:10:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592406654; cv=none; d=google.com; s=arc-20160816; b=OkJAftygR3mIFkHusGgiOb/IFg5TAQ7eOJSDpRuj2jb7ziYCpBWh6SMXQdXZDGgKHS 8Usb+0XCh/+ROUWq2yBrE5laXT+0aa/P4BUPF+LR6NVg8lJqGpNV5nsOqmjs6ylyf843 PB7QtVPmM1fPoU47iC2QM4yF6o9mz87FB2CCwn+1S0D04TTXjLYXBjMor3xR67um6FRV yx3F5vOAIFg2+ZCgsnCXjU/CmnOdsfNsxu8BJjFONPxQGamRdaxTrNb8+XpgU4Idolvl Xm3w36EbIQe7fBnabDRiCGILqz0my4UR/qXLU/VywUEINX3RFFTPe5+OFgtuLXcUfe4w uxyw== 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=4Fus+1STo6fJcdmND8htjDFw0u7LkR/zKPWh9+ob2Js=; b=stf3pXWk3+2PkiGJ2NPEZHmEHNeOu22b+BlhyAkWNTORtR8di3Nzp+ZitLamvINQG0 aNR9JQavQBHnX3qV5mIBD68yPzGIcSHYonbz7VsO2rmwWSiNjXcG7YU2XzqPuUDBEkx9 IE/h0zhTmLhYHmxckeYXf0VZVXiHvohSBxRyDOOAuFOSO0Pc6Oqxv9UJ7eA9o3DJGBUb otZYmR/ObEhyLLPEdkdaRSPs/eMkBjePdrV/ik+T+7MPPBzAfHXj5QHrh+0IqqdI+uDO qBbhQc1oRTW4+VpT4tvrv51iHbUaOR9kwThtmx7Ewo4H3ndMGGSu9pNPzY/cGBNJD/Fs IHxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=gJR4GqFK; spf=pass (google.com: domain of linux-leds-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id du7si118386ejc.341.2020.06.17.08.10.54; Wed, 17 Jun 2020 08:10:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-leds-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=gJR4GqFK; spf=pass (google.com: domain of linux-leds-owner@vger.kernel.org designates 23.128.96.18 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 S1727051AbgFQPKo (ORCPT + 1 other); Wed, 17 Jun 2020 11:10:44 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:54592 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727097AbgFQPKn (ORCPT ); Wed, 17 Jun 2020 11:10:43 -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 05HFAdYF004749; Wed, 17 Jun 2020 10:10:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1592406639; bh=4Fus+1STo6fJcdmND8htjDFw0u7LkR/zKPWh9+ob2Js=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=gJR4GqFKYZYMhkoam6gYQ6C6qacYrV/6tUJ1QRcZGSIho7zzYm4XJkGzRkUcPmbJ4 Q3w0TLusJcap1zfj/nKfZ2nMbj1A9mYQKrwPG4Iak4f4IJh6KaeluXd58ubcYt0UK7 wtzaynW8cMmeAeaRraAVRK6uWe9c+UEEcxQsLTx4= Received: from DLEE112.ent.ti.com (dlee112.ent.ti.com [157.170.170.23]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 05HFAdAH111001 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 17 Jun 2020 10:10:39 -0500 Received: from DLEE103.ent.ti.com (157.170.170.33) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 17 Jun 2020 10:10:39 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Wed, 17 Jun 2020 10:10:39 -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 05HFAdVx108887; Wed, 17 Jun 2020 10:10:39 -0500 From: Dan Murphy To: , , CC: , , , Dan Murphy Subject: [PATCH v28 15/15] leds: lp5523: Fix various formatting issues in the code Date: Wed, 17 Jun 2020 10:09:24 -0500 Message-ID: <20200617150924.12665-16-dmurphy@ti.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200617150924.12665-1-dmurphy@ti.com> References: <20200617150924.12665-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 Fix checkpatch errors and warnings for the LP5523.c device driver. Acked-by: Pavel Machek Acked-by: Jacek Anaszewski Signed-off-by: Dan Murphy --- drivers/leds/leds-lp5523.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) -- 2.26.2 diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c index 9776dc72a764..f55d97258d5e 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;