From patchwork Fri Oct 18 12:25:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 176802 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp787792ill; Fri, 18 Oct 2019 05:26:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqy9Q96emcWONKy4C0b0RXvZB9otsWc32J4xmq40mEwmAskQoLEzvlQx3GNOmXCTv1GbG+21 X-Received: by 2002:a17:906:2ccc:: with SMTP id r12mr7903273ejr.249.1571401564870; Fri, 18 Oct 2019 05:26:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571401564; cv=none; d=google.com; s=arc-20160816; b=uZJZtBUPP7qkh110k6cmw5/+v9UaJGBjP5u7KQ1beyjxwcsnePVmuG6XmoJFe53Qzn fvxN1jve2qiT6lGUVW+vD3eRZ2TDH8KHn5k+5gn1euRpxP425r4xjg9XPDOECXTSEERR wJGROzYAL0+3xmv33z8xNdXfQsajA+JjssaDJQ60r87AvxBHN0FDzhsRTlivBYxOikpV nunDTb1/swLzmVzKBv34vcIucXoAC5fkjjdaVUMkj+0wah3K7pDmmQIxNaELCVAp8Tsy OURRx3/VqiNU3Wj23lYeQuw9Tehx44/jTov3w7isIvA9kfcCJz/L94nXUlm+I0btlj3J 4Srg== 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=zV3cVdmjhCBXzQdA/5xCOaiT1n6XKbwdMaP1jdy4goo=; b=OHOPb/vMEzFxA1vAhwXyYG0Uq7yKlPwyPBQrjjRLKsWNZ5svQarKN+Z8LtgiEbg/it M0LlfTRdFe6dYBA0LsdGFPjwjMOMQzVsA0GgP0tWY+rl43IYrcZZhw1gCKUmp8f9YH+i 3pNau4CsG0brYThupE/+OEEuUcZMO1OJkzLf9AD7BRCIfo7jX9q/hOwdm+nxAmdHZFwh To9N4QZkfld4StgVYwyx+FzJSpqh81XgiitgNSdHVgeWmVTNdrw2qi/YgKgNtekeHfOp pBgmW4/Wz+oC0oDMGtjmRY/eSexXeT7YiO7+3luYj36cUZplAW0vYU3RiGe3FSj/tNUo QEvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=JnziTdBN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e23si3505051edq.344.2019.10.18.05.26.04; Fri, 18 Oct 2019 05:26:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=JnziTdBN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2633701AbfJRM0B (ORCPT + 26 others); Fri, 18 Oct 2019 08:26:01 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:40346 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726423AbfJRMZ7 (ORCPT ); Fri, 18 Oct 2019 08:25:59 -0400 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x9ICPtRi078638; Fri, 18 Oct 2019 07:25:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1571401555; bh=zV3cVdmjhCBXzQdA/5xCOaiT1n6XKbwdMaP1jdy4goo=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=JnziTdBNxe0R5C7d4tduMXE2WzV7JvlqjhzSG+QPNlRcNVRqLphjx/SyM0/9Koxkm GmSlFQUo5EaoNwAP43aNwfeQn7SGNUnS6H6u0sCtOAf9gUD8XRdwR/CySryZor3msS iFH5ZsmdxqVE2ExxQDtEwPgWqHt1LL23WsM94fUU= Received: from DFLE109.ent.ti.com (dfle109.ent.ti.com [10.64.6.30]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x9ICPt4L092082 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 18 Oct 2019 07:25:55 -0500 Received: from DFLE102.ent.ti.com (10.64.6.23) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Fri, 18 Oct 2019 07:25:47 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Fri, 18 Oct 2019 07:25:55 -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 x9ICPtfL012253; Fri, 18 Oct 2019 07:25:55 -0500 From: Dan Murphy To: , CC: , , Dan Murphy Subject: [PATCH v14 02/19] dt-bindings: leds: Add multicolor ID to the color ID list Date: Fri, 18 Oct 2019 07:25:04 -0500 Message-ID: <20191018122521.6757-3-dmurphy@ti.com> X-Mailer: git-send-email 2.22.0.214.g8dca754b1e In-Reply-To: <20191018122521.6757-1-dmurphy@ti.com> References: <20191018122521.6757-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a new color ID that is declared as MULTICOLOR as with the multicolor framework declaring a definitive color is not accurate as the node can contain multiple colors. Signed-off-by: Dan Murphy --- include/dt-bindings/leds/common.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.22.0.214.g8dca754b1e diff --git a/include/dt-bindings/leds/common.h b/include/dt-bindings/leds/common.h index 9e1256a7c1bf..7006d15f71e8 100644 --- a/include/dt-bindings/leds/common.h +++ b/include/dt-bindings/leds/common.h @@ -29,7 +29,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 */ #define LED_FUNCTION_ACTIVITY "activity" From patchwork Fri Oct 18 12:25:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 176809 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp788255ill; Fri, 18 Oct 2019 05:26:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqwwtM/9X7CRMZw3I6zl3oh4900gBNl+o7hOMae/5o851MpVB7C34wSW3N3b1+IXzIiyPhAK X-Received: by 2002:a17:906:5fc1:: with SMTP id k1mr8574894ejv.268.1571401589622; Fri, 18 Oct 2019 05:26:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571401589; cv=none; d=google.com; s=arc-20160816; b=fNUZk5Kt2ccdd+XCLwHdmBWy0BNsvo5B0FwJ8lTB3SmWeG1A4JHV8tppI69REo3pET hUwxY5CUIL/LP+AUdLry9wq3aQapaYvkBQEqD7CAHtOuXdfkZm01ats8FTuWguTjslTC 4Iibjo1b7yxoIwbxkDsXWCLFH5antD/1xzjZQPBykwkpZyKTdq1fvJ/33p6BMIdUD3Ic 8XSQkF6DiWGz2HOp/zMETtcGhC4UYZFdQpTMk4d80jiBrFkwdbj2zY3w7Xi+JWW7y6+3 aEKmqo1Y3p+H5efi4p35pki2MjgOPujqJYPinwc0/8r7f5wag87r4x9fBpTSqUqTnoW5 7lUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vNLixCA7rV3r89geVpDyZT2afzJln66pkNhtKdigswM=; b=Cf9BYIEPLDstMfTzNiKc/kHb+oUqzZvPmAaxd7yfbppAh0Ehvsih7p+rf9HR/fb0RM +Nfy9MYYZ7xWq59tTJT1arxH9Ly0fxCH2tPxXDWEzYbdy5pwbmpi9BvERCA/CoQKKBVR L0Mmw55t0cMz84Z9UdgrsaY83LoIqNS4595v2s3bfkRswDUWDlkXtsvV+5FQDazSv/o4 XvVq6P5Ayt/jPB8RD99uRaYekiNHsIiOaPfBrxne1cpeUUl3OuwComCtH88zVqq6CVFP xi/IZUZPtU/CcJQwgxk4zs0+4hJTQpbTeNJXFW0etwQcmRcXGHFEyXLmDzYi9hyqGKOm YXwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="QFMy/67T"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d19si3286244ejr.163.2019.10.18.05.26.29; Fri, 18 Oct 2019 05:26:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="QFMy/67T"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2633713AbfJRM0C (ORCPT + 26 others); Fri, 18 Oct 2019 08:26:02 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:45838 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726365AbfJRMZ7 (ORCPT ); Fri, 18 Oct 2019 08:25:59 -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 x9ICPtfF087338; Fri, 18 Oct 2019 07:25:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1571401555; bh=vNLixCA7rV3r89geVpDyZT2afzJln66pkNhtKdigswM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=QFMy/67TiHTiWIA7TF8pdGi7P4giM89qEEUcGvrpuQE20eBpPFlHoOKrTNQlNon6l 1Jqb2JZ8HiHsJ6SlZhOJAXAYGBcPPU5A4q2qqnOupnVUtd94pL/ZZOGv9HV6nI9exk RLUzFevnaW7OHpGzNJypz3W/KvtBf6Jx51iU/1pk= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x9ICPtDW060733 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 18 Oct 2019 07:25:55 -0500 Received: from DLEE102.ent.ti.com (157.170.170.32) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Fri, 18 Oct 2019 07:25:47 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE102.ent.ti.com (157.170.170.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Fri, 18 Oct 2019 07:25:47 -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 x9ICPtWC073303; Fri, 18 Oct 2019 07:25:55 -0500 From: Dan Murphy To: , CC: , , Dan Murphy Subject: [PATCH v14 03/19] leds: Add multicolor ID to the color ID list Date: Fri, 18 Oct 2019 07:25:05 -0500 Message-ID: <20191018122521.6757-4-dmurphy@ti.com> X-Mailer: git-send-email 2.22.0.214.g8dca754b1e In-Reply-To: <20191018122521.6757-1-dmurphy@ti.com> References: <20191018122521.6757-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a new color ID that is declared as MULTICOLOR as with the multicolor framework declaring a definitive color is not accurate as the node can contain multiple colors. Signed-off-by: Dan Murphy --- drivers/leds/led-core.c | 1 + 1 file changed, 1 insertion(+) -- 2.22.0.214.g8dca754b1e diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c index f1f718dbe0f8..846248a0693d 100644 --- a/drivers/leds/led-core.c +++ b/drivers/leds/led-core.c @@ -34,6 +34,7 @@ const char * const led_colors[LED_COLOR_ID_MAX] = { [LED_COLOR_ID_VIOLET] = "violet", [LED_COLOR_ID_YELLOW] = "yellow", [LED_COLOR_ID_IR] = "ir", + [LED_COLOR_ID_MULTI] = "multicolor", }; EXPORT_SYMBOL_GPL(led_colors); From patchwork Fri Oct 18 12:25:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 176817 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp788903ill; Fri, 18 Oct 2019 05:27:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqwxvZwgG6Q4uiHW/39f1EARCwETGGJjd94Am0XlKrnbVEIrHwRUAvtqN2ROVSHs/s3wzcwi X-Received: by 2002:aa7:c603:: with SMTP id h3mr9367249edq.44.1571401625669; Fri, 18 Oct 2019 05:27:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571401625; cv=none; d=google.com; s=arc-20160816; b=JKrF6YD0GuqkUCKRivyyDVmAJ5nlkQ0SF0E2ZscNhDNJmhofbWs3O1udpZY6aP0+JA TLGDg9AIyjSphefWUFh0QRRSfT2EKgXoOM0W+UPhkj+ye+x/DWEzTlb670viN7khxF+Z QD984oBJ3m1Pvn1rOhQe39+9qIlYCZW5NUdM+nRaVULHcB2nz8rwZ0ZI3oTvW+pAUS4I JO/Zv3brMkUnlGsbskZal7UFLSSLH4YYnFv8wBZqlOwSoqIeUrtcqJI/SWTsAfQ35dJY H5R6vnqpyJF8MZeNLwjIrUSOd0k4MulMfwdn4/vtKizhMxGexiy7Qbe3jC7pX7w+Kd9f Mygg== 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=FPrJ1G2SUGEg3EfCVQ10S3wgUXXyt6yxKfxiPylb8lg=; b=VtkbuRhZg0bf0F3erzytEZxlqULq7svoNQrm9f7iDlpW/hNhJLG8IljhXx7rlhxltB 1ucG3TVmwRWQII4N2fiB/gwdwdREl/2skppWBJnK0ac2hH5XFzRmZUsDihLEFdznx2l5 Q1Qxw2eSuiuiyUoygAzTk290nGg3AKTrHbKgIqWwqXDo40ktTfHw1/xcyYUjH3z353eX hqAgjzP/ZCfuWC4MbYlOu4ErhF8FdelJEGPW2NPdM5zvBOQXf8wdrdKR5kmThxB7NZ6P FRA7k4Ci7uLucWtt9Pc6ud+JeAxfs0y2j7avFFFveFQmRFG1UiSCQMjGTCOfcvtfTB7m Ff1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=tXvqPLT9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y22si3071875ejw.144.2019.10.18.05.27.05; Fri, 18 Oct 2019 05:27:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=tXvqPLT9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2633883AbfJRM1C (ORCPT + 26 others); Fri, 18 Oct 2019 08:27:02 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:48396 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388384AbfJRM0A (ORCPT ); Fri, 18 Oct 2019 08:26:00 -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 x9ICPte1066220; Fri, 18 Oct 2019 07:25:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1571401555; bh=FPrJ1G2SUGEg3EfCVQ10S3wgUXXyt6yxKfxiPylb8lg=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=tXvqPLT9GisPzOnndWdIIIh6P1y5qoRCN0qGasvyV2Aw8itrPLd9WhC8HpPVZOBPk LeP1rjgEgtWWZ7Ix+kWIXsOkzvK7Fd1fDLjZrO/BJviOiNAkHyaLVktqFrzXXnpjrF 7EbHzm2F1nOX0X1DW+Z8nf5NV2bVFwJ8iujWY1JE= Received: from DFLE115.ent.ti.com (dfle115.ent.ti.com [10.64.6.36]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x9ICPtgG053628 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 18 Oct 2019 07:25:55 -0500 Received: from DFLE110.ent.ti.com (10.64.6.31) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Fri, 18 Oct 2019 07:25:47 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Fri, 18 Oct 2019 07:25:55 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id x9ICPtrT092004; Fri, 18 Oct 2019 07:25:55 -0500 From: Dan Murphy To: , CC: , , Dan Murphy Subject: [PATCH v14 04/19] leds: multicolor: Introduce a multicolor class definition Date: Fri, 18 Oct 2019 07:25:06 -0500 Message-ID: <20191018122521.6757-5-dmurphy@ti.com> X-Mailer: git-send-email 2.22.0.214.g8dca754b1e In-Reply-To: <20191018122521.6757-1-dmurphy@ti.com> References: <20191018122521.6757-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce a multicolor class that groups colored LEDs within a LED node. The multi color class groups monochrome LEDs and allows controlling two aspects of the final combined color: hue and lightness. The former is controlled via _intensity files and the latter is controlled via brightness file. Signed-off-by: Dan Murphy --- .../ABI/testing/sysfs-class-led-multicolor | 36 +++ Documentation/leds/index.rst | 1 + Documentation/leds/leds-class-multicolor.rst | 100 +++++++ drivers/leds/Kconfig | 10 + drivers/leds/Makefile | 1 + drivers/leds/led-class-multicolor.c | 271 ++++++++++++++++++ include/linux/led-class-multicolor.h | 97 +++++++ 7 files changed, 516 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.22.0.214.g8dca754b1e diff --git a/Documentation/ABI/testing/sysfs-class-led-multicolor b/Documentation/ABI/testing/sysfs-class-led-multicolor new file mode 100644 index 000000000000..3d1f9d726c70 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-class-led-multicolor @@ -0,0 +1,36 @@ +What: /sys/class/leds//brightness +Date: Sept 2019 +KernelVersion: 5.5 +Contact: Dan Murphy +Description: read/write + Writing to this file will update all LEDs within the group to a + calculated percentage of what each color LED intensity is set + to. The percentage is calculated for each grouped LED via the + equation below: + + led_brightness = brightness * _intensity/_max_intensity + + For additional details please refer to + Documentation/leds/leds-class-multicolor.rst. + + The value of the color is from 0 to + /sys/class/leds//max_brightness. + +What: /sys/class/leds//colors/_intensity +Date: Sept 2019 +KernelVersion: 5.5 +Contact: Dan Murphy +Description: read/write + The _intensity file is created based on the color + defined by the registrar of the class. + There is one file per color presented. + + The value of the color is from 0 to + /sys/class/leds//colors/_max_intensity. + +What: /sys/class/leds//colors/_max_intensity +Date: Sept 2019 +KernelVersion: 5.5 +Contact: Dan Murphy +Description: read only + Maximum intensity level for the LED color. diff --git a/Documentation/leds/index.rst b/Documentation/leds/index.rst index 060f4e485897..bc70c6aa7138 100644 --- a/Documentation/leds/index.rst +++ b/Documentation/leds/index.rst @@ -9,6 +9,7 @@ LEDs leds-class leds-class-flash + leds-class-multicolor ledtrig-oneshot ledtrig-transient ledtrig-usbport diff --git a/Documentation/leds/leds-class-multicolor.rst b/Documentation/leds/leds-class-multicolor.rst new file mode 100644 index 000000000000..c8a224cead51 --- /dev/null +++ b/Documentation/leds/leds-class-multicolor.rst @@ -0,0 +1,100 @@ +==================================== +Multi Color LED handling under Linux +==================================== + +Description +=========== +The multi color class groups monochrome LEDs and allows controlling two +aspects of the final combined color: hue and lightness. The former is +controlled via _intensity files and the latter is controlled +via brightness file. + +For more details on hue and lightness notions please refer to +https://en.wikipedia.org/wiki/CIECAM02. + +Note that intensity files only cache the written value and the actual +change of hardware state occurs upon writing brightness file. This +allows for changing many factors of the perceived color in a virtually +unnoticeable way for the human observer. + +Multicolor Class Control +======================== +The multicolor class presents the LED groups under a directory called "colors". +This directory is a child under the LED parent node created by the led_class +framework. The led_class framework is documented in led-class.rst within this +documentation directory. + +Each colored LED will have two files created under the colors directory +_intensity and _max_intensity. These files will contain +one of LED_COLOR_ID_* definitions from the header +include/dt-bindings/leds/common.h. + +Directory Layout Example +======================== +root:/sys/class/leds/rgb:grouped_leds# ls -lR colors/ +-rw-r--r-- 1 root root 4096 Jul 7 03:10 blue_intensity +-r--r--r-- 1 root root 4096 Jul 7 03:10 blue_max_intensity +-rw-r--r-- 1 root root 4096 Jul 7 03:10 green_intensity +-r--r--r-- 1 root root 4096 Jul 7 03:10 green_max_intensity +-rw-r--r-- 1 root root 4096 Jul 7 03:10 red_intensity +-r--r--r-- 1 root root 4096 Jul 7 03:10 red_max_intensity + +Multicolor Class Brightness Control +=================================== +The multiclor class framework will calculate each monochrome LEDs intensity. + +The brightness level for each LED is calculated based on the color LED +intensity setting divided by the color LED max intensity setting multiplied by +the requested brightness. + +led_brightness = brightness * _intensity/_max_intensity + +It is important to note that for each LED within the cluster the +_max_intensity value should be the same. This will help maintain a +consistent hue across brightness levels. + +Example: +Three LEDs are present in the group as defined in "Directory Layout Example" +within this document. + +A user first writes the color LED brightness file with the brightness level that +is necessary to achieve a blueish violet output from the RGB LED group. + +echo 138 > /sys/class/leds/rgb:grouped_leds/red_intensity +echo 43 > /sys/class/leds/rgb:grouped_leds/green_intensity +echo 226 > /sys/class/leds/rgb:grouped_leds/blue_intensity + +red - + intensity = 138 + max_intensity = 255 +green - + intensity = 43 + max_intensity = 255 +blue - + intensity = 226 + max_intensity = 255 + +The user can control the brightness of that RGB group by writing the parent +'brightness' control. Assuming a parent max_brightness of 255 the user may want +to dim the LED color group to half. The user would write a value of 128 to the +parent brightness file then the values written to each LED will be adjusted +base on this value + +cat /sys/class/leds/rgb:grouped_leds/max_brightness +255 +echo 128 > /sys/class/leds/rgb:grouped_leds/brightness + +adjusted_red_value = 128 * 138/255 = 69 +adjusted_green_value = 128 * 43/255 = 21 +adjusted_blue_value = 128 * 226/255 = 113 + +Reading the parent brightness file will return the current brightness value of +the color LED group. + +cat /sys/class/leds/rgb:grouped_leds/max_brightness +255 + +echo 128 > /sys/class/leds/rgb:grouped_leds/brightness + +cat /sys/class/leds/rgb:grouped_leds/brightness +128 diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index 4b68520ac251..a1ede89afc9e 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -30,6 +30,16 @@ config LEDS_CLASS_FLASH for the flash related features of a LED device. It can be built as a module. +config LEDS_CLASS_MULTI_COLOR + tristate "LED Mulit Color LED Class Support" + depends on LEDS_CLASS + help + This option enables the multicolor LED sysfs class in /sys/class/leds. + It wraps LED class and adds multicolor LED specific sysfs attributes + and kernel internal API to it. You'll need this to provide support + for multicolor LEDs that are grouped together. This class is not + intended for single color LEDs. It can be built as a module. + config LEDS_BRIGHTNESS_HW_CHANGED bool "LED Class brightness_hw_changed attribute support" depends on LEDS_CLASS diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile index 2da39e896ce8..841038cfe35b 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile @@ -4,6 +4,7 @@ obj-$(CONFIG_NEW_LEDS) += led-core.o obj-$(CONFIG_LEDS_CLASS) += led-class.o obj-$(CONFIG_LEDS_CLASS_FLASH) += led-class-flash.o +obj-$(CONFIG_LEDS_CLASS_MULTI_COLOR) += led-class-multicolor.o obj-$(CONFIG_LEDS_TRIGGERS) += led-triggers.o # LED Platform Drivers diff --git a/drivers/leds/led-class-multicolor.c b/drivers/leds/led-class-multicolor.c new file mode 100644 index 000000000000..453fd8e913e9 --- /dev/null +++ b/drivers/leds/led-class-multicolor.c @@ -0,0 +1,271 @@ +// SPDX-License-Identifier: GPL-2.0 +// LED Multi Color class interface +// Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ + +#include +#include +#include +#include +#include +#include + +#include "leds.h" + +#define INTENSITY_NAME "_intensity" +#define MAX_INTENSITY_NAME "_max_intensity" + +int led_mc_calc_color_components(struct led_classdev_mc *mcled_cdev, + enum led_brightness brightness, + struct led_mc_color_conversion color_component[]) +{ + struct led_mc_color_entry *priv; + int i = 0; + + list_for_each_entry(priv, &mcled_cdev->color_list, list) { + color_component[i].color_id = priv->led_color_id; + color_component[i].brightness = brightness * + priv->intensity / priv->max_intensity; + i++; + } + + return 0; +} +EXPORT_SYMBOL_GPL(led_mc_calc_color_components); + +static ssize_t intensity_store(struct device *dev, + struct device_attribute *intensity_attr, + const char *buf, size_t size) +{ + struct led_mc_color_entry *priv = container_of(intensity_attr, + struct led_mc_color_entry, + intensity_attr); + struct led_classdev *led_cdev = priv->mcled_cdev->led_cdev; + unsigned long value; + ssize_t ret; + + mutex_lock(&led_cdev->led_access); + + ret = kstrtoul(buf, 10, &value); + if (ret) + goto unlock; + + if (value > priv->max_intensity) { + ret = -EINVAL; + goto unlock; + } + + priv->intensity = value; + ret = size; + +unlock: + mutex_unlock(&led_cdev->led_access); + return ret; +} + +static ssize_t intensity_show(struct device *dev, + struct device_attribute *intensity_attr, + char *buf) +{ + struct led_mc_color_entry *priv = container_of(intensity_attr, + struct led_mc_color_entry, + intensity_attr); + + return sprintf(buf, "%d\n", priv->intensity); +} + +static ssize_t max_intensity_show(struct device *dev, + struct device_attribute *max_intensity_attr, + char *buf) +{ + struct led_mc_color_entry *priv = container_of(max_intensity_attr, + struct led_mc_color_entry, + max_intensity_attr); + + return sprintf(buf, "%d\n", priv->max_intensity); +} + +static struct attribute *led_color_attrs[] = { + NULL, +}; + +static struct attribute_group led_color_group = { + .name = "colors", + .attrs = led_color_attrs, +}; + +static int led_multicolor_init_color(struct led_classdev_mc *mcled_cdev, + int color_id) +{ + struct led_classdev *led_cdev = mcled_cdev->led_cdev; + struct led_mc_color_entry *mc_priv; + char *intensity_file_name; + char *max_intensity_file_name; + size_t len; + int ret; + + mc_priv = devm_kzalloc(led_cdev->dev, sizeof(*mc_priv), GFP_KERNEL); + if (!mc_priv) + return -ENOMEM; + + mc_priv->led_color_id = color_id; + mc_priv->mcled_cdev = mcled_cdev; + + sysfs_attr_init(&mc_priv->intensity_attr.attr); + len = strlen(led_colors[color_id]) + strlen(INTENSITY_NAME) + 1; + intensity_file_name = kzalloc(len, GFP_KERNEL); + if (!intensity_file_name) + return -ENOMEM; + + snprintf(intensity_file_name, len, "%s%s", + led_colors[color_id], INTENSITY_NAME); + mc_priv->intensity_attr.attr.name = intensity_file_name; + mc_priv->intensity_attr.attr.mode = 0644; + mc_priv->intensity_attr.store = intensity_store; + mc_priv->intensity_attr.show = intensity_show; + ret = sysfs_add_file_to_group(&led_cdev->dev->kobj, + &mc_priv->intensity_attr.attr, + led_color_group.name); + if (ret) + goto intensity_err_out; + + sysfs_attr_init(&mc_priv->max_intensity_attr.attr); + len = strlen(led_colors[color_id]) + strlen(MAX_INTENSITY_NAME) + 1; + max_intensity_file_name = kzalloc(len, GFP_KERNEL); + if (!max_intensity_file_name) { + ret = -ENOMEM; + goto intensity_err_out; + } + + snprintf(max_intensity_file_name, len, "%s%s", + led_colors[color_id], MAX_INTENSITY_NAME); + mc_priv->max_intensity_attr.attr.name = max_intensity_file_name; + mc_priv->max_intensity_attr.attr.mode = 0444; + mc_priv->max_intensity_attr.show = max_intensity_show; + ret = sysfs_add_file_to_group(&led_cdev->dev->kobj, + &mc_priv->max_intensity_attr.attr, + led_color_group.name); + if (ret) + goto max_intensity_err_out; + + mc_priv->max_intensity = LED_FULL; + list_add_tail(&mc_priv->list, &mcled_cdev->color_list); + +max_intensity_err_out: + kfree(max_intensity_file_name); +intensity_err_out: + kfree(intensity_file_name); + return ret; +} + +static int led_multicolor_init_color_dir(struct led_classdev_mc *mcled_cdev) +{ + struct led_classdev *led_cdev = mcled_cdev->led_cdev; + int ret; + int i; + + ret = sysfs_create_group(&led_cdev->dev->kobj, &led_color_group); + if (ret) + return ret; + + for (i = 0; i < LED_COLOR_ID_MAX; i++) { + if (test_bit(i, &mcled_cdev->available_colors)) { + ret = led_multicolor_init_color(mcled_cdev, i); + if (ret) + break; + + } + } + + return ret; +} + +int led_classdev_multicolor_register_ext(struct device *parent, + struct led_classdev_mc *mcled_cdev, + struct led_init_data *init_data) +{ + struct led_classdev *led_cdev; + int ret; + + if (!mcled_cdev) + return -EINVAL; + + led_cdev = mcled_cdev->led_cdev; + INIT_LIST_HEAD(&mcled_cdev->color_list); + + /* Register led class device */ + ret = led_classdev_register_ext(parent, led_cdev, init_data); + if (ret) + return ret; + + return led_multicolor_init_color_dir(mcled_cdev); +} +EXPORT_SYMBOL_GPL(led_classdev_multicolor_register_ext); + +void led_classdev_multicolor_unregister(struct led_classdev_mc *mcled_cdev) +{ + struct led_mc_color_entry *priv, *next; + + if (!mcled_cdev) + return; + + list_for_each_entry_safe(priv, next, &mcled_cdev->color_list, list) + list_del(&priv->list); + + sysfs_remove_group(&mcled_cdev->led_cdev->dev->kobj, &led_color_group); + led_classdev_unregister(mcled_cdev->led_cdev); +} +EXPORT_SYMBOL_GPL(led_classdev_multicolor_unregister); + +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(parent, mcled_cdev); + if (ret) { + devres_free(dr); + return ret; + } + + *dr = mcled_cdev; + devres_add(parent, dr); + + return 0; +} +EXPORT_SYMBOL_GPL(devm_led_classdev_multicolor_register_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..32b0d8cdc577 --- /dev/null +++ b/include/linux/led-class-multicolor.h @@ -0,0 +1,97 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* LED Multicolor class interface + * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ + */ + +#ifndef __LINUX_MULTICOLOR_LEDS_H_INCLUDED +#define __LINUX_MULTICOLOR_LEDS_H_INCLUDED + +#include +#include + +struct led_classdev_mc; + +struct led_mc_color_conversion { + int color_id; + int brightness; + int output_num; +}; + +struct led_mc_color_entry { + struct led_classdev_mc *mcled_cdev; + + struct device_attribute max_intensity_attr; + struct device_attribute intensity_attr; + + enum led_brightness max_intensity; + enum led_brightness intensity; + + struct list_head list; + + int led_color_id; +}; + +struct led_classdev_mc { + /* led class device */ + struct led_classdev *led_cdev; + struct list_head color_list; + + unsigned long available_colors; + int num_leds; +}; + +static inline struct led_classdev_mc *lcdev_to_mccdev( + struct led_classdev *lcdev) +{ + return container_of(lcdev, struct led_classdev_mc, led_cdev); +} + +/** + * led_classdev_multicolor_register_ext - register a new object of led_classdev + * class with support for multicolor LEDs + * @parent: the multicolor LED to register + * @mcled_cdev: the led_classdev_mc structure for this device + * @init_data: the LED class Multi color device initialization data + * + * Returns: 0 on success or negative error value on failure + */ +int led_classdev_multicolor_register_ext(struct device *parent, + struct led_classdev_mc *mcled_cdev, + struct led_init_data *init_data); + +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, + struct led_mc_color_conversion color_component[]); + +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); + +#endif /* __LINUX_MULTICOLOR_LEDS_H_INCLUDED */ From patchwork Fri Oct 18 12:25:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 176808 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp788166ill; Fri, 18 Oct 2019 05:26:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqwbxc+WE6ZfYckl086qh4sB3KgqnlsNsfTQJBrTwSfsckidIKrbvG8BlN3s3Q3Tz1L9hLRa X-Received: by 2002:a50:eb4d:: with SMTP id z13mr9151289edp.175.1571401584911; Fri, 18 Oct 2019 05:26:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571401584; cv=none; d=google.com; s=arc-20160816; b=ruGVXfUF2Y55/GKCnMM82Lgc12QazcnBC0tpxV+AhOomxwqwUlYj08vjJxMz+pKFkY uNiJllXHYnjwS+wk1y1oHJENoVXn8UqQ1uv4aq7IMF9fSElb2DeODiYXypAh8dC6iid2 Lh7vLwymrEBTUJfM4CJ2W2CESB2+9LRRM7CkbiRxm5iVgG9+13RXFvOamKJxLIA1MznY ARH+VNuE7sZMKoMlgn3LJ6v2CszS3Uv2icFWxHLuuCbQaoitUjNq6PlLJpu2OMBs2pUS +DOTD/ruhxu3w18vmUbpaal/zhtaDmsoCEbqUCrGqTtcbikvS6F6rcsxtENfADTgsCPT Fq2w== 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=rypLEJLbiDfP2WcD4ls+CXhyO//n5TYBDjfB1YBfbjc=; b=v+FdIpJSGl/mGkgLaacSfVTPfBzBTY6vDqrOWm2eFBiRgOJ/BQkHTDErc5wpenoRrp LluNB3LpBfSi/PPcIYDQ6rXVqeSm/RCDT8qQcEQMeVxX1/u492lRBLqrED+rtMwrUZ1S FMNm1ZBs/zyRYuVjLSjoXjJz0hBfPmKYkT4+GnoLhh2g5kWAeAqnOcDWWge3Mx8+nFJe zKPhswI3Qc/LieJOrDB5rrZlFsNXEKbc1v3eappAfFtq6bCFYUY/259DeBPQFgW4g8FR MXg4K4Ymw6cNXhUNFFIyZb/gNV48+yA8WtMep20HFhxfGMyG2weXO0eJihIiX4cBJr2N cHjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Xm4YPdUa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l22si3596899edb.241.2019.10.18.05.26.24; Fri, 18 Oct 2019 05:26:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Xm4YPdUa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2633733AbfJRM0E (ORCPT + 26 others); Fri, 18 Oct 2019 08:26:04 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:40838 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726489AbfJRM0A (ORCPT ); Fri, 18 Oct 2019 08:26:00 -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 x9ICPugp013931; Fri, 18 Oct 2019 07:25:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1571401556; bh=rypLEJLbiDfP2WcD4ls+CXhyO//n5TYBDjfB1YBfbjc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Xm4YPdUabZo/VFN/wpqPPdCyavaifEYrMI6uIy8gtiCo97crSTULIlwAR5pkKyn6T 6zHriaDBRC3f8oND8jbWjxC75ysBdD0r972YjiMY+skxL0+DfIqbeS0XB3gme9UeT9 gelOV15Oqma4xqLALlPb3UOWts4K5eMKyI7AbxqY= Received: from DLEE112.ent.ti.com (dlee112.ent.ti.com [157.170.170.23]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x9ICPuum092101 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 18 Oct 2019 07:25:56 -0500 Received: from DLEE105.ent.ti.com (157.170.170.35) 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.1713.5; Fri, 18 Oct 2019 07:25:47 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Fri, 18 Oct 2019 07:25:47 -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 x9ICPtE7099318; Fri, 18 Oct 2019 07:25:55 -0500 From: Dan Murphy To: , CC: , , Dan Murphy Subject: [PATCH v14 05/19] dt: bindings: lp50xx: Introduce the lp50xx family of RGB drivers Date: Fri, 18 Oct 2019 07:25:07 -0500 Message-ID: <20191018122521.6757-6-dmurphy@ti.com> X-Mailer: git-send-email 2.22.0.214.g8dca754b1e In-Reply-To: <20191018122521.6757-1-dmurphy@ti.com> References: <20191018122521.6757-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce the bindings for the Texas Instruments LP5036, LP5030, LP5024, LP5018, LP5012 and LP5009 RGB LED device driver. The LP5036/30/24/18/12/9 can control RGB LEDs individually or as part of a control bank group. These devices have the ability to adjust the mixing control for the RGB LEDs to obtain different colors independent of the overall brightness of the LED grouping. Datasheet: http://www.ti.com/lit/ds/symlink/lp5012.pdf http://www.ti.com/lit/ds/symlink/lp5024.pdf http://www.ti.com/lit/ds/symlink/lp5036.pdf Signed-off-by: Dan Murphy --- .../devicetree/bindings/leds/leds-lp50xx.txt | 148 ++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/leds-lp50xx.txt -- 2.22.0.214.g8dca754b1e diff --git a/Documentation/devicetree/bindings/leds/leds-lp50xx.txt b/Documentation/devicetree/bindings/leds/leds-lp50xx.txt new file mode 100644 index 000000000000..291d418642e0 --- /dev/null +++ b/Documentation/devicetree/bindings/leds/leds-lp50xx.txt @@ -0,0 +1,148 @@ +* Texas Instruments - LP5009/12/18/24/30/36 RGB LED driver + +The LP50XX is multi-channel, I2C RGB LED Drivers that can group RGB LEDs into +a LED group or control them individually. + +The difference in these RGB LED drivers is the number of supported RGB modules. + +Required parent properties: + - compatible: + "ti,lp5009" + "ti,lp5012" + "ti,lp5018" + "ti,lp5024" + "ti,lp5030" + "ti,lp5036" + - reg : I2C slave address + lp5009/12 - 0x14, 0x15, 0x16, 0x17 + lp5018/24 - 0x28, 0x29, 0x2a, 0x2b + lp5030/36 - 0x30, 0x31, 0x32, 0x33 + - #address-cells : 1 + - #size-cells : 0 + +Optional parent properties: + - enable-gpios : gpio pin to enable/disable the device. + - vled-supply : LED supply + +Required child properties: + - #address-cells : 1 + - #size-cells : 0 + - reg : This is the LED module number. + - color : Must be LED_COLOR_ID_MULTI + - function : see Documentation/devicetree/bindings/leds/common.txt + +Required child properties only if LED modules will be banked: + - ti,led-bank : This property denotes the LED module numbers that will + be controlled as a single RGB cluster. Each LED module + number will be controlled by a single LED class instance. + There can only be one instance of the ti,led-bank + property for each device node. + +Required grandchildren properties: + - reg : A single entry denoting the LED output that controls + the monochrome LED. + - color : see Documentation/devicetree/bindings/leds/common.txt + - led-sources : see Documentation/devicetree/bindings/leds/common.txt + +The LED outputs associated with the LED modules are defined in Table 1 of the +corresponding data sheets. + +LP5009 - 3 Total RGB cluster LED outputs 0-2 +LP5012 - 4 Total RGB cluster LED outputs 0-3 +LP5018 - 6 Total RGB cluster LED outputs 0-5 +LP5024 - 8 Total RGB cluster LED outputs 0-7 +LP5030 - 10 Total RGB cluster LED outputs 0-9 +LP5036 - 12 Total RGB cluster LED outputs 0-11 + +Optional child properties: + - label : see Documentation/devicetree/bindings/leds/common.txt + - linux,default-trigger : + see Documentation/devicetree/bindings/leds/common.txt + +Examples: +led-controller@29 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "ti,lp5024"; + reg = <0x29>; + enable-gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>; + vled-supply = <&vmmcsd_fixed>; + + multi-led@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + color = ; + function = LED_FUNCTION_STATUS; + + led@3 { + reg = <3>; + color = ; + }; + + led@4 { + reg = <4>; + color = ; + }; + + led@5 { + reg = <5>; + color = ; + }; + }; + + multi-led@2 { + #address-cells = <1>; + #size-cells = <0>; + reg = <2>; + color = ; + function = LED_FUNCTION_STANDBY; + ti,led-bank = <2 3 5>; + + led@6 { + reg = <0x6>; + color = ; + led-sources = <6 9 15>; + }; + + led@7 { + reg = <0x7>; + color = ; + led-sources = <7 10 16>; + }; + + led@8 { + reg = <0x8>; + color = ; + led-sources = <8 11 17>; + }; + }; + + multi-led@4 { + #address-cells = <1>; + #size-cells = <0>; + reg = <4>; + color = ; + function = LED_FUNCTION_ACTIVITY; + + led@12 { + reg = <12>; + color = ; + }; + + led@13 { + reg = <13>; + color = ; + }; + + led@14 { + reg = <14>; + color = ; + }; + }; +}; + +For more product information please see the link below: +http://www.ti.com/lit/ds/symlink/lp5012.pdf +http://www.ti.com/lit/ds/symlink/lp5024.pdf +http://www.ti.com/lit/ds/symlink/lp5036.pdf From patchwork Fri Oct 18 12:25:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 176807 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp788148ill; Fri, 18 Oct 2019 05:26:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqySt0GZMoGoHVQqmF47v2nor9gkXaWU/s7FuPDxGF1BHZMKkDXRLKNW41qdzAqq3LlaIVQl X-Received: by 2002:a05:6402:1b88:: with SMTP id cc8mr9267021edb.22.1571401584037; Fri, 18 Oct 2019 05:26:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571401584; cv=none; d=google.com; s=arc-20160816; b=RxpFV0Ky1muByEksUbt83SXkiLv1CXnnljp05wcDR5Y7wLnjb1H/0NU9iIgC/JTHT9 EFnvZKKyzjZcVLVCTjx1vbku5hB0+q+xexq8RQfDQ6RGdRUDEDLY0OnkZ3TgNnw4PdAT 9RnBsQqMwHJRul8vXALBpOY2BkOBiHUW4Owo6N3HUl8bajSd1ON024rt2VschCXA9glD npHb8njZVieBiLxdmrDHLjSC92yUvMC2l7nQ3IgVyq9JGs/wMPjgbXsCGyAwu8LBt8ay PsQO5ph6xIZXuW3RCRzZz5DOUp2DN8NUmr5QlzaZtK8YFtrb4ydP5z1SsIjyAhlq1rG1 srgA== 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=ynnE2bcE7/pjTvuXLjgDaxUYtz5RYI+D7gB1BXxX9Io=; b=ybNbTXdmlgZyr7XcEcugbV/V5lOpoLnSGCA8VySno61tUrl99qbPpEcyMb7w4QDrFH zzftdtw5fwkZex+lnwDLcfEnnBg/LGwcWqQFQGIMgR+72Itg+EdnNzwKtt+dU8lr2/BV J0eboekykjV79X6h//79bpJBFv2qkfPTnmQVUMve6Hmu10d89MJ+Z64Nw+E8JRsfYKjv bstJeKld4NqSridqMZZekwq83TOaWRWIyThynzkTwliaFsw8uIRFxcrHSER6oRNxDDPx DJ4+00LmC6IWCqNu2Fy6ATc52NXIQTkCE40mElMXGBwt7YM5eZ5redTeCosVM6dyJ9JG xSEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=TA8tdmBm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l22si3596899edb.241.2019.10.18.05.26.23; Fri, 18 Oct 2019 05:26:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=TA8tdmBm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2633790AbfJRM0T (ORCPT + 26 others); Fri, 18 Oct 2019 08:26:19 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:48456 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2633756AbfJRM0J (ORCPT ); Fri, 18 Oct 2019 08:26: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 x9ICPufK066233; Fri, 18 Oct 2019 07:25:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1571401556; bh=ynnE2bcE7/pjTvuXLjgDaxUYtz5RYI+D7gB1BXxX9Io=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=TA8tdmBmQR3ckoa7jNrxCwq6t4j1MotsVIup6a5SPQJhNv7vOLR/MEHdDi0hITifj 06YxwPqOnffYRZydHqhzERcO4Y1pldd2S1IFYuWpZyNARvIrJUkgXyf0AcOulh3zhV c+OVTb5HDUaIw8KR3Gujn7A4UliWVuR7dsH8J3vg= Received: from DLEE113.ent.ti.com (dlee113.ent.ti.com [157.170.170.24]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id x9ICPukV091725; Fri, 18 Oct 2019 07:25:56 -0500 Received: from DLEE104.ent.ti.com (157.170.170.34) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Fri, 18 Oct 2019 07:25:48 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Fri, 18 Oct 2019 07:25:48 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id x9ICPuAM092012; Fri, 18 Oct 2019 07:25:56 -0500 From: Dan Murphy To: , CC: , , Dan Murphy , Linus Walleij , Tony Lindgren , =?utf-8?q?Beno=C3=AEt_Cousson?= , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team Subject: [PATCH v14 08/19] dt: bindings: lp55xx: Update binding for Multicolor Framework Date: Fri, 18 Oct 2019 07:25:10 -0500 Message-ID: <20191018122521.6757-9-dmurphy@ti.com> X-Mailer: git-send-email 2.22.0.214.g8dca754b1e In-Reply-To: <20191018122521.6757-1-dmurphy@ti.com> References: <20191018122521.6757-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Update the DT binding to include the properties to use the multicolor framework for the devices that use the LP55xx framework. Reviewed-by: Linus Walleij Signed-off-by: Dan Murphy CC: Tony Lindgren CC: "Benoît Cousson" CC: Linus Walleij CC: Shawn Guo CC: Sascha Hauer CC: Pengutronix Kernel Team CC: Fabio Estevam CC: NXP Linux Team --- .../devicetree/bindings/leds/leds-lp55xx.txt | 149 +++++++++++++++--- 1 file changed, 124 insertions(+), 25 deletions(-) -- 2.22.0.214.g8dca754b1e diff --git a/Documentation/devicetree/bindings/leds/leds-lp55xx.txt b/Documentation/devicetree/bindings/leds/leds-lp55xx.txt index bfe2805c5534..0ccc1efc2499 100644 --- a/Documentation/devicetree/bindings/leds/leds-lp55xx.txt +++ b/Documentation/devicetree/bindings/leds/leds-lp55xx.txt @@ -1,6 +1,8 @@ Binding for TI/National Semiconductor LP55xx LED Drivers Required properties: +- #address-cells: 1 +- #size-cells: 0 - compatible: one of national,lp5521 national,lp5523 @@ -14,6 +16,18 @@ Required properties: Each child has own specific current settings - led-cur: Current setting at each LED channel (mA x10, 0 if LED is not connected) - max-cur: Maximun current at each LED channel. +- reg: Output channel for the LED. This is zero based channel identifier and + the data sheet is a one based channel identifier. + reg value to output to LED output number + D1 = reg value is 0 + D2 = reg value is 1 + D3 = reg value is 2 + D4 = reg value is 3 + D5 = reg value is 4 + D6 = reg value is 5 + D7 = reg value is 6 + D8 = reg value is 7 + D9 = reg value is 8 Optional properties: - enable-gpio: GPIO attached to the chip's enable pin @@ -35,23 +49,28 @@ example 1) LP5521 on channel 0. lp5521@32 { + #address-cells = <1>; + #size-cells = <0>; compatible = "national,lp5521"; reg = <0x32>; label = "lp5521_pri"; clock-mode = /bits/ 8 <2>; - chan0 { + 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>; }; @@ -70,59 +89,70 @@ ASEL1 ASEL0 Address VEN VEN 35h lp5523@32 { + #address-cells = <1>; + #size-cells = <0>; compatible = "national,lp5523"; reg = <0x32>; clock-mode = /bits/ 8 <1>; - chan0 { + chan@0 { + reg = <0>; chan-name = "d1"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; - chan1 { + chan@1 { + reg = <1>; chan-name = "d2"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; - chan2 { + chan@2 { + reg = <2>; chan-name = "d3"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; - chan3 { + chan@3 { + reg = <3>; chan-name = "d4"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; - chan4 { + chan@4 { + reg = <4>; chan-name = "d5"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; - chan5 { + chan@5 { + reg = <5>; chan-name = "d6"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; - chan6 { + chan@6 { + reg = <6>; chan-name = "d7"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; - chan7 { + chan@7 { + reg = <7>; chan-name = "d8"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; - chan8 { + chan@8 { + reg = <8>; chan-name = "d9"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; @@ -133,29 +163,35 @@ example 3) LP5562 4 channels are defined. lp5562@30 { + #address-cells = <1>; + #size-cells = <0>; compatible = "ti,lp5562"; reg = <0x30>; clock-mode = /bits/8 <2>; - chan0 { + chan@0 { + reg = <0>; chan-name = "R"; led-cur = /bits/ 8 <0x20>; max-cur = /bits/ 8 <0x60>; }; - chan1 { + chan@1 { + reg = <1>; chan-name = "G"; led-cur = /bits/ 8 <0x20>; max-cur = /bits/ 8 <0x60>; }; - chan2 { + chan@2 { + reg = <2>; chan-name = "B"; led-cur = /bits/ 8 <0x20>; max-cur = /bits/ 8 <0x60>; }; - chan3 { + chan@3 { + reg = <3>; chan-name = "W"; led-cur = /bits/ 8 <0x20>; max-cur = /bits/ 8 <0x60>; @@ -167,62 +203,125 @@ example 4) LP8501 Others are same as LP5523. lp8501@32 { + #address-cells = <1>; + #size-cells = <0>; compatible = "ti,lp8501"; reg = <0x32>; clock-mode = /bits/ 8 <2>; pwr-sel = /bits/ 8 <3>; /* D1~9 connected to VOUT */ - chan0 { + chan@0 { + reg = <0>; chan-name = "d1"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; - chan1 { + chan@1 { + reg = <1>; chan-name = "d2"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; - chan2 { + chan@2 { + reg = <2>; chan-name = "d3"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; - chan3 { + chan@3 { + reg = <3>; chan-name = "d4"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; - chan4 { + chan@4 { + reg = <4>; chan-name = "d5"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; - chan5 { + chan@5 { + reg = <5>; chan-name = "d6"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; - chan6 { + chan@6 { + reg = <6>; chan-name = "d7"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; - chan7 { + chan@7 { + reg = <7>; chan-name = "d8"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; - chan8 { + chan@8 { + reg = <8>; chan-name = "d9"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; }; + +Multicolor Framework Support +In addition to the nodes and properties defined above for device support the +properties below are needed for multicolor framework support as defined in +Documentation/devicetree/bindings/leds/leds-class-multicolor.txt + +Required child properties for multicolor framework + - color : Must be LED_COLOR_ID_MULTI + - function : see Documentation/devicetree/bindings/leds/common.txt + +Required grandchildren properties + - reg : This is the LED output of the device + - color : see Documentation/devicetree/bindings/leds/common.txt + +Multicolor LED example: +led-controller@32 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "national,lp5523"; + reg = <0x32>; + clock-mode = /bits/ 8 <0>; /* LP55XX_CLOCK_AUTO */ + + multi-led@2 { + #address-cells = <1>; + #size-cells = <0>; + reg = <2>; + color = ; + function = LED_FUNCTION_STANDBY; + linux,default-trigger = "heartbeat"; + + led@0 { + led-cur = /bits/ 8 <50>; + max-cur = /bits/ 8 <100>; + reg = <0x0>; + color = ; + }; + + led@1 { + led-cur = /bits/ 8 <50>; + max-cur = /bits/ 8 <100>; + reg = <0x1>; + color = ; + }; + + led@6 { + led-cur = /bits/ 8 <50>; + max-cur = /bits/ 8 <100>; + reg = <0x6>; + color = ; + }; + }; +}; From patchwork Fri Oct 18 12:25:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 176805 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp787963ill; Fri, 18 Oct 2019 05:26:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqyfoD1bZYLfczsN/65+jDKK1h3ZrJnsc+J2EN/lZndTlUjx1PfHSASZehBSCXBMDRHEe6rT X-Received: by 2002:a17:906:cc90:: with SMTP id oq16mr8218234ejb.322.1571401573459; Fri, 18 Oct 2019 05:26:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571401573; cv=none; d=google.com; s=arc-20160816; b=vkqrgfyki1qPlZ/5gcHXA0+iAOkeUH0oz7Y7UUDA0pnqSjzLmWBbbtVwxo8SAB7mlR 0Qc85W7xhVHCi1JgSon/sAFloHS7V5AAdQKg4ysoyW9fBo23yjASJpAdKyX/ZdYHGOdr NWzCFv6RYb7PG2dIjhU/HdDU9IwYWEBUzeA0U698rp+NiwpJQAHZ4HV0uqeipx4FjVSZ sKsstXw/U0X+2PjwowoE0SxHHTsloXWBIvwUrfRuu08+gaCtWlp8NrMXNHVQgOGrZcah wU6lTs2LW2j2Ztetqm+kBNs7RxX8mXcaa29AKy1BHDw/2Nq7De1Ny+JhFdDWucxC5mJK zKJQ== 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=Q6v3ZsELVVFaq45xRxLW4voHJAlhEXxHc1kVNsr3mZg=; b=rEuI13j68kaPJ0Z8W6VF1/r/plGEo+U+oTCaU+Zx+oCAi2Z49MFAXU2rjKUyl+S2YU t5HpCEAfgGQ9HmSnFblRSJV+rxuUAHyp8O25Es9HD5sNSzof+PvhyeoFdkdu3eetGiGX HtQMEdRRx8gjKo1f8l87n/CiUnph3wqIHO60/qtoQa9+x0Dh3MrpnMdgQzRtPSoSQurk KL44LOs1jW556SK3Y8JZ2f8INva15o1qRX8/5EvOAil/xoRlf7FX+Yaq3GRr51/Vk9f9 KI8F5fxMNtnrTiys/LwC7yjMOUKl0TxlIsMtM3LVCxjcE31+GL02UwB63iih8O628xhy DL+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Xti78K2E; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c26si3868240edx.353.2019.10.18.05.26.13; Fri, 18 Oct 2019 05:26:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Xti78K2E; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2633769AbfJRM0M (ORCPT + 26 others); Fri, 18 Oct 2019 08:26:12 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:48454 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2633690AbfJRM0J (ORCPT ); Fri, 18 Oct 2019 08:26: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 x9ICPvjP066237; Fri, 18 Oct 2019 07:25:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1571401557; bh=Q6v3ZsELVVFaq45xRxLW4voHJAlhEXxHc1kVNsr3mZg=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Xti78K2E6iFtvT5ieJrsjSg2cPXRXPVMZDL2pC1g4Z+muYBSX/ye2nAE5k03C2+8L zWpysiww5MAzt0Tmtrr9FJENO8U3PPzKjs3ngHZ+UDeq72g+TyhZDY6hrknYAoz42F SyoYMhuGqYR13pT5UQe5ziQJ5DxQ3ZvmQRJ+GkSY= 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 x9ICPvSF091732; Fri, 18 Oct 2019 07:25:57 -0500 Received: from DLEE100.ent.ti.com (157.170.170.30) 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.1713.5; Fri, 18 Oct 2019 07:25:48 -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.1713.5 via Frontend Transport; Fri, 18 Oct 2019 07:25:56 -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 x9ICPu3J073328; Fri, 18 Oct 2019 07:25:56 -0500 From: Dan Murphy To: , CC: , , Dan Murphy , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team Subject: [PATCH v14 10/19] ARM: dts: imx6dl-yapp4: Add reg property to the lp5562 channel node Date: Fri, 18 Oct 2019 07:25:12 -0500 Message-ID: <20191018122521.6757-11-dmurphy@ti.com> X-Mailer: git-send-email 2.22.0.214.g8dca754b1e In-Reply-To: <20191018122521.6757-1-dmurphy@ti.com> References: <20191018122521.6757-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add the reg property to each channel node. This update is to accomodate the multicolor framework. In addition to the accomodation this allows the LEDs to be placed on any channel and allow designs to skip channels as opposed to requiring sequential order. Signed-off-by: Dan Murphy CC: Shawn Guo CC: Sascha Hauer CC: Pengutronix Kernel Team CC: Fabio Estevam CC: NXP Linux Team --- arch/arm/boot/dts/imx6dl-yapp4-common.dtsi | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) -- 2.22.0.214.g8dca754b1e diff --git a/arch/arm/boot/dts/imx6dl-yapp4-common.dtsi b/arch/arm/boot/dts/imx6dl-yapp4-common.dtsi index e8d800fec637..efc466ed1fea 100644 --- a/arch/arm/boot/dts/imx6dl-yapp4-common.dtsi +++ b/arch/arm/boot/dts/imx6dl-yapp4-common.dtsi @@ -257,29 +257,35 @@ reg = <0x30>; clock-mode = /bits/ 8 <1>; status = "disabled"; + #address-cells = <1>; + #size-cells = <0>; - chan0 { + chan@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 Fri Oct 18 12:25:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 176804 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp787880ill; Fri, 18 Oct 2019 05:26:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqxa66rJJljA69CDmGxtEWMzmxZfAmnjDcbGUpYH4OZOahcQC5O2p4VJAxNSOFkD2BJbYnmi X-Received: by 2002:a17:906:6bcd:: with SMTP id t13mr8343409ejs.133.1571401569590; Fri, 18 Oct 2019 05:26:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571401569; cv=none; d=google.com; s=arc-20160816; b=lF1YSyo35n3NLcpf0YGqj8z3D8J+hmL/QYQbzNjbJaupExpf3I8NP6Wes1pOJonLlr 6z9NF6346JTT/XMhvRmKfBRfkJPNxT2VFsv/iumxNMadsW4QWZ//xeY4UAnE81Y/vWAj LsE1hZswI5JM9Rumd8DYTsGFoGB2QHKoISdNOaW63NMcGtkdvA8L6lWFc0lRa3GB25S7 Smjpv5WOff9elES6xZ1jLsfyGvsAj8RPrkfAXl6QyoteDgDUEvYZdRtspTEqd6B4xpEu YNRrX+kJLiQi80qGjZmBKrpjrsJUR6j8sys/OadMrXdiQqlu/679WBwPdbHmHrsLZuQT fj0Q== 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=+wdGS4JDNtXy3761t0WleRDrnXdstTT2XmnfYtPv+XM=; b=eQabsZKoGTIFDD8Kt3lokXx/q4n1bBWrp0EGcpfO/aMeReTXMo8okjsqfvlp3Ht+hh GA/5b7tvucOt8xhkLOjVVP/ulOV29AiY6LAFwPh6pwt8NGZMC2ehpDvqcyx4+xV2TICg XY2MAgf2JWTqDBbC/RKU9t/SGuZnozEwBMCRJrTSfJZtZEpA4KNkmMVguuyn/HrKlZkQ bZXaD+h5l5wRqgyhQbPduiGbsO0aq9Y8HiQY0EU34Lfl7Lv7C5/d0VVGfdnpbgAy5tMD i4EkHIFFIo1awLpkEWybmLK9ikZ9YhKuclhR6Sks5bAl9ocPtvuGkIsgfQHIY0m5FC5z /x3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ysmvgkNF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c26si3868240edx.353.2019.10.18.05.26.09; Fri, 18 Oct 2019 05:26:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ysmvgkNF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2633743AbfJRM0F (ORCPT + 26 others); Fri, 18 Oct 2019 08:26:05 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:48406 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2442719AbfJRM0A (ORCPT ); Fri, 18 Oct 2019 08:26:00 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x9ICPveo066249; Fri, 18 Oct 2019 07:25:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1571401557; bh=+wdGS4JDNtXy3761t0WleRDrnXdstTT2XmnfYtPv+XM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ysmvgkNF73jIwIVnZA0hTl+2qZqarmxC7awzijlBcRErzwWPvqwmiVJWp6S2XH80S ZQiKXcfgr2vW4Yaka74axlHUjjYQMYYFNMONOAAB7BFQonD9itBsGZpN0zwgGB7mHW inUpNWWGfJZoQ6Cvrz9l9qvthSPhiECkbvm4Cfgg= 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 x9ICPvL8060749 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 18 Oct 2019 07:25:57 -0500 Received: from DFLE105.ent.ti.com (10.64.6.26) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Fri, 18 Oct 2019 07:25:49 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Fri, 18 Oct 2019 07:25:57 -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 x9ICPvGf012278; Fri, 18 Oct 2019 07:25:57 -0500 From: Dan Murphy To: , CC: , , Dan Murphy Subject: [PATCH v14 13/19] leds: lp55xx: Add multicolor framework support to lp55xx Date: Fri, 18 Oct 2019 07:25:15 -0500 Message-ID: <20191018122521.6757-14-dmurphy@ti.com> X-Mailer: git-send-email 2.22.0.214.g8dca754b1e In-Reply-To: <20191018122521.6757-1-dmurphy@ti.com> References: <20191018122521.6757-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add multicolor framework support for the lp55xx family. Signed-off-by: Dan Murphy --- drivers/leds/Kconfig | 1 + drivers/leds/leds-lp55xx-common.c | 185 +++++++++++++++++++--- drivers/leds/leds-lp55xx-common.h | 9 ++ include/linux/platform_data/leds-lp55xx.h | 7 + 4 files changed, 179 insertions(+), 23 deletions(-) -- 2.22.0.214.g8dca754b1e diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index fb614a6b9afa..5706bf8d8bd1 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -377,6 +377,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-lp55xx-common.c b/drivers/leds/leds-lp55xx-common.c index 882ef39e4965..197b87ca5ca2 100644 --- a/drivers/leds/leds-lp55xx-common.c +++ b/drivers/leds/leds-lp55xx-common.c @@ -131,14 +131,62 @@ static struct attribute *lp55xx_led_attrs[] = { }; ATTRIBUTE_GROUPS(lp55xx_led); +#if IS_ENABLED(CONFIG_LEDS_CLASS_MULTI_COLOR) +static int lp55xx_map_channel(struct lp55xx_led *led, int color_id, + enum led_brightness brightness) +{ + int i; + + for (i = 0; i < led->mc_cdev.num_leds; i++) { + if (led->color_components[i].color_id == color_id) { + led->color_components[i].brightness = brightness; + return 0; + } + } + + return -EINVAL; +} +#endif + +static int lp55xx_set_mc_brightness(struct lp55xx_led *led, + struct lp55xx_device_config *cfg, + enum led_brightness brightness) +{ + int ret = -EINVAL; +#if IS_ENABLED(CONFIG_LEDS_CLASS_MULTI_COLOR) + struct led_mc_color_conversion color_components[LP55XX_MAX_GROUPED_CHAN]; + int i; + + if (!cfg->multicolor_brightness_fn) + return -EINVAL; + + led_mc_calc_color_components(&led->mc_cdev, brightness, + color_components); + + for (i = 0; i < led->mc_cdev.num_leds; i++) { + ret = lp55xx_map_channel(led, color_components[i].color_id, + color_components[i].brightness); + if (ret) + return ret; + } + + ret = cfg->multicolor_brightness_fn(led); +#endif + return ret; +} + static int lp55xx_set_brightness(struct led_classdev *cdev, enum led_brightness brightness) { struct lp55xx_led *led = cdev_to_lp55xx_led(cdev); struct lp55xx_device_config *cfg = led->chip->cfg; - led->brightness = (u8)brightness; - return cfg->brightness_fn(led); + if (led->mc_cdev.num_leds > 1) { + return lp55xx_set_mc_brightness(led, cfg, brightness); + } else { + led->brightness = (u8)brightness; + return cfg->brightness_fn(led); + } } static int lp55xx_init_led(struct lp55xx_led *led, @@ -147,9 +195,9 @@ 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; char name[32]; 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 +207,34 @@ 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) { + led->mc_cdev.led_cdev = &led->cdev; + led->cdev.brightness_set_blocking = lp55xx_set_brightness; + led->cdev.groups = lp55xx_led_groups; + led->mc_cdev.num_leds = pdata->led_config[chan].num_colors; + led->mc_cdev.available_colors = + pdata->led_config[chan].available_colors; + memcpy(led->color_components, + pdata->led_config[chan].color_components, + sizeof(led->color_components)); + } else { + + led->cdev.default_trigger = + pdata->led_config[chan].default_trigger; + led->cdev.brightness_set_blocking = lp55xx_set_brightness; + } led->cdev.groups = lp55xx_led_groups; + 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 +242,13 @@ 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 IS_ENABLED(CONFIG_LEDS_CLASS_MULTI_COLOR) + if (pdata->led_config[chan].num_colors > 1) + ret = devm_led_classdev_multicolor_register(dev, &led->mc_cdev); + else +#endif + 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,6 +592,82 @@ void lp55xx_unregister_sysfs(struct lp55xx_chip *chip) } EXPORT_SYMBOL_GPL(lp55xx_unregister_sysfs); +static int lp5xx_parse_common_child(struct device_node *np, + struct lp55xx_led_config *cfg, + int chan_num, bool is_multicolor, + int color_num) +{ + u32 led_number; + int ret; + + of_property_read_string(np, "chan-name", + &cfg[chan_num].name); + of_property_read_u8(np, "led-cur", + &cfg[chan_num].led_current); + of_property_read_u8(np, "max-cur", + &cfg[chan_num].max_current); + + ret = of_property_read_u32(np, "reg", &led_number); + if (ret) + return ret; + + if (led_number < 0 || led_number > 6) + return -EINVAL; + + if (is_multicolor) + cfg[chan_num].color_components[color_num].output_num = + led_number; + else + cfg[chan_num].chan_nr = led_number; + + return 0; +} + +static int lp5xx_parse_channel_child(struct device_node *np, + struct lp55xx_led_config *cfg, + int child_number) +{ + struct device_node *child; + int channel_color; + int num_colors = 0; + u32 color_id; + int ret; + + cfg[child_number].default_trigger = + of_get_property(np, "linux,default-trigger", NULL); + + ret = of_property_read_u32(np, "color", &channel_color); + if (ret) + channel_color = ret; + + + if (channel_color == LED_COLOR_ID_MULTI) { + for_each_child_of_node(np, child) { + ret = lp5xx_parse_common_child(child, cfg, + child_number, true, + num_colors); + if (ret) + return ret; + + ret = of_property_read_u32(child, "color", &color_id); + if (ret) + return ret; + + cfg[child_number].color_components[num_colors].color_id = + color_id; + set_bit(color_id, &cfg[child_number].available_colors); + num_colors++; + } + + cfg[child_number].num_colors = num_colors; + } else { + return lp5xx_parse_common_child(np, cfg, child_number, false, + num_colors); + } + + return 0; +} + struct lp55xx_platform_data *lp55xx_of_populate_pdata(struct device *dev, struct device_node *np) { @@ -533,6 +676,7 @@ struct lp55xx_platform_data *lp55xx_of_populate_pdata(struct device *dev, struct lp55xx_led_config *cfg; int num_channels; int i = 0; + int ret; pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); if (!pdata) @@ -552,14 +696,9 @@ struct lp55xx_platform_data *lp55xx_of_populate_pdata(struct device *dev, pdata->num_channels = num_channels; 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 = lp5xx_parse_channel_child(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..4a0cdbfe54a6 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, @@ -109,6 +111,9 @@ struct lp55xx_device_config { /* access brightness register */ int (*brightness_fn)(struct lp55xx_led *led); + /* perform brightness value to multiple LEDs */ + int (*multicolor_brightness_fn)(struct lp55xx_led *led); + /* current setting function */ void (*set_led_current) (struct lp55xx_led *led, u8 led_current); @@ -159,6 +164,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 +174,8 @@ struct lp55xx_chip { struct lp55xx_led { int chan_nr; struct led_classdev cdev; + struct led_classdev_mc mc_cdev; + struct led_mc_color_conversion color_components[LP55XX_MAX_GROUPED_CHAN]; u8 led_current; u8 max_current; u8 brightness; diff --git a/include/linux/platform_data/leds-lp55xx.h b/include/linux/platform_data/leds-lp55xx.h index 96a787100fda..ead9d145de0d 100644 --- a/include/linux/platform_data/leds-lp55xx.h +++ b/include/linux/platform_data/leds-lp55xx.h @@ -12,17 +12,24 @@ #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 long available_colors; + struct led_mc_color_conversion color_components[LP55XX_MAX_GROUPED_CHAN]; }; struct lp55xx_predef_pattern { From patchwork Fri Oct 18 12:25:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 176816 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp788847ill; Fri, 18 Oct 2019 05:27:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqxSOuW8zfUr+aad6nYoOxvBG3RcUHlKQxQdBIV6ovTkPpyAuiD4KKGKuF1W00jfriUwqAZt X-Received: by 2002:a50:8dc9:: with SMTP id s9mr9261953edh.168.1571401622775; Fri, 18 Oct 2019 05:27:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571401622; cv=none; d=google.com; s=arc-20160816; b=X0Dm6tBrvTZg6yy3CRnPd1KBT3VoK5VDDXeTka0bYHIRkvi9/svvNV5G8yeeFIFiow lqngK/9hqoM5p7ki2yviJ8qyLhaj4rzPCqBz+Xc0gURO7EpyMNXoEGlrDqWXzJ+K1fDi S6gEWBT4Ek5IgKbuwHMSYYxjbkqecj21MOSnftSNr7Ggna2syPczoGnfg28OzsLG+u4f 6rgIwS6C+1W0P0xdmRLkkQ0HhUTE63hBmXKXwoNrUMyX1FiBup1lixe3BrQv3p692/s9 tTmPlXxZQhMzALq4vkY+AQrOvJoRnMJ522d/9s+GkLYK34F645m7Sy0Aw26W1h8hNNHN jXvA== 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=qIVwr9pkpcECT7neqBC0u+TtvO9djbszrDToerausoI=; b=BABZRe09UQBpjD4QucBcgnk9DNQni6bD/p5FJlwoBoneY/KXfBykNqV67xtZyb/F8Q 7ajY55GTeFta5khV5EqMUvWLPDfHe2oQRZX5yfwsfnv0OLW9+ffNUj1nFBJn63afa08l 2CwbZecFVNKdjhb0PYgrxYeu56k07RhPhd8OWocmMn1wXsYgOccDO+/10MpW64zMbtwZ +KP+SQPlbaEqlUCxgFn+7BHqwQsJxE6MjJzvTGcHMQAkrj5CGnrbfeqADdSMVSiIXhhz 5PmvI7bcMzhMzU3tJL5+jAlMBDEw17FYjvbTzkH7w6/vlPtVc43yu7B8/mEVkxBIqvkv TqtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=XhGqSi3p; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gl26si3366635ejb.17.2019.10.18.05.27.02; Fri, 18 Oct 2019 05:27:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=XhGqSi3p; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2633872AbfJRM07 (ORCPT + 26 others); Fri, 18 Oct 2019 08:26:59 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:40844 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2633682AbfJRM0A (ORCPT ); Fri, 18 Oct 2019 08:26:00 -0400 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x9ICPvBQ013941; Fri, 18 Oct 2019 07:25:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1571401557; bh=qIVwr9pkpcECT7neqBC0u+TtvO9djbszrDToerausoI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=XhGqSi3py1DAD7/WulT9WvGrSCZuTNZ9x43yc1Hi+kdm5P5EEIMNXv6MjBH9jSNvy Y/4Jn4SCOazp9KCSPJ+k5WHSInSa2hkndBQ4+s0tzu6Nd3GzFaWkBS5zYi7nxL13aI bKmsSEMbKkqLjwiqKj2ZkQskTSf/AcUKUwJgoxqc= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x9ICPv60053642 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 18 Oct 2019 07:25:57 -0500 Received: from DLEE106.ent.ti.com (157.170.170.36) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Fri, 18 Oct 2019 07:25:49 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE106.ent.ti.com (157.170.170.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Fri, 18 Oct 2019 07:25: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 x9ICPvmC073332; Fri, 18 Oct 2019 07:25:57 -0500 From: Dan Murphy To: , CC: , , Dan Murphy Subject: [PATCH v14 14/19] leds: lp5523: Update the lp5523 code to add multicolor brightness function Date: Fri, 18 Oct 2019 07:25:16 -0500 Message-ID: <20191018122521.6757-15-dmurphy@ti.com> X-Mailer: git-send-email 2.22.0.214.g8dca754b1e In-Reply-To: <20191018122521.6757-1-dmurphy@ti.com> References: <20191018122521.6757-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add the multicolor brightness call back to support the multicolor framework. This call back allows setting brightness on grouped channels in a single function. Signed-off-by: Dan Murphy --- drivers/leds/leds-lp5523.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) -- 2.22.0.214.g8dca754b1e diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c index 15e7051392f5..287fc4756cd1 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_leds; i++) { + ret = lp55xx_write(chip, + LP5523_REG_LED_PWM_BASE + + led->color_components[i].output_num, + led->color_components[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 Fri Oct 18 12:25:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 176814 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp788672ill; Fri, 18 Oct 2019 05:26:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqx/2P+g7zrWa7LldQJoBerQcDZS6v9yeDL2Y6pgQ58gOoAE1FLCStLpHkKrNeNSyODvtpfc X-Received: by 2002:aa7:ccd3:: with SMTP id y19mr9373959edt.122.1571401612234; Fri, 18 Oct 2019 05:26:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571401612; cv=none; d=google.com; s=arc-20160816; b=MGFdWzdJOzYcIzH2F7HfcTrkL+Wb5t2dwhL5UakY9swHkH95zVgEuIaRFdeL1FgIrq ELm7E6vXnCt2PiK6zqFuvnSyZRSXLmjRtoo5ra+ejYURBrBvmGgurKth/vsdUx2WIMrn P5Cyh3MYVpqm6E8AOdSWGX3H6MvvAhcI56g1dQRZe+fBOKydZhMFPZJSbtgkO0V/ckKI NpmYUAzvdf7SS1663uVu1T1uc0aCNMOIQWxhoMQGD4x1twRMt9kLVHOkFqjOj/0qDj8T U5jO0vO9pFj3YTCqrz+1uPbeLjEC3WTSSLXDa/Ewx31/GusOWjVkAQpsirleYAJ7HHgl cRMg== 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=ptd9/47dYiWP3O8EesAD1PuDv716F1rLCMPl0qU/wSw=; b=KhFHbNT/zYvOBndQ+4ezNrGJ1Rdn7E2TrF33yn8e3x7GvjxXMYyecaBHrbDpzLtDl1 kmo7DYHzxf9f0zixFMQg8U+rDdNbZn6/O+PpiKilsWRIe8HGiLKXJ+iIRqvDP53ESQeT TxCCvnKSIK2UCJXYTpk9vQTg76CM6OTfhuAGhi0O8+2hRdT4mYetl62+J3rk28rjQ0lS dZRlnW9ElsS/YwrBwbVh6HvKGM6t2WqHaAX0DUFfKn3esKZkI82Hj15NHxKiZLkUPcPl fijhGc6x1ogWZqwzMrQepDLxVCjVsPj4NspMOg7RPCpis5twCbBkIo7uMOQmm+yVk4tW XqRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=G35YWps+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d3si3321716ejw.31.2019.10.18.05.26.52; Fri, 18 Oct 2019 05:26:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=G35YWps+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2633849AbfJRM0u (ORCPT + 26 others); Fri, 18 Oct 2019 08:26:50 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:40850 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387657AbfJRM0A (ORCPT ); Fri, 18 Oct 2019 08:26:00 -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 x9ICPwvt013945; Fri, 18 Oct 2019 07:25:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1571401558; bh=ptd9/47dYiWP3O8EesAD1PuDv716F1rLCMPl0qU/wSw=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=G35YWps+Eg/W38PIOMaqv1VoizIBS3d2Mrg+HP/vcvPDSxNx9rRtyYkrgZTwnNwuf NwfjlJX8pJeiVv0/k8rsTCStEHWVl29Ahr2g+qMydyKUfOqfjOpHkbvozPm4OZ6dzs iir++0RYrxXnl6nwqwJn1qGhQGuCy4OSNn+JoPz0= 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 x9ICPw4N060753 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 18 Oct 2019 07:25:58 -0500 Received: from DLEE102.ent.ti.com (157.170.170.32) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Fri, 18 Oct 2019 07:25:49 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE102.ent.ti.com (157.170.170.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Fri, 18 Oct 2019 07:25:49 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id x9ICPvjc092024; Fri, 18 Oct 2019 07:25:57 -0500 From: Dan Murphy To: , CC: , , Dan Murphy Subject: [PATCH v14 15/19] leds: lp5521: Add multicolor framework multicolor brightness support Date: Fri, 18 Oct 2019 07:25:17 -0500 Message-ID: <20191018122521.6757-16-dmurphy@ti.com> X-Mailer: git-send-email 2.22.0.214.g8dca754b1e In-Reply-To: <20191018122521.6757-1-dmurphy@ti.com> References: <20191018122521.6757-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add the multicolor brightness call back to support the multicolor framework. This function allows setting the brightness across grouped LED channels in a single call. Signed-off-by: Dan Murphy --- drivers/leds/leds-lp5521.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) -- 2.22.0.214.g8dca754b1e diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c index 6d2163c0f625..0ae7e4116859 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_leds; i++) { + ret = lp55xx_write(chip, + LP5521_REG_LED_PWM_BASE + + led->color_components[i].output_num, + led->color_components[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 Fri Oct 18 12:25:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 176803 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp787887ill; Fri, 18 Oct 2019 05:26:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqwhjuw8c+DfpWsbSVxzgLwpRqYvcGM/35Or3HQiuGm4J3tuJca3EmGPZoI3NkeEIhsywR2+ X-Received: by 2002:aa7:d045:: with SMTP id n5mr9338060edo.24.1571401569983; Fri, 18 Oct 2019 05:26:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571401569; cv=none; d=google.com; s=arc-20160816; b=FPFkak060ANMlGwhcxNhQvfEQYfBVvm/K3WsEt5HFCVMRS/HrT0OD+Y5QYjnVDCsPK iWHJzMDcCgPbFiuWQ0A14QsJzwu7u7DOSLbjOSvDcZ7OOluN5Bo0QRPQRWy2H/N5jjgu SSFwekipC4Sj8mwKY/vs9D10z30NmgBLfSIBOKv73AM5WmHvrMmljqsjEC5omMpTJ0ew +gqWi5Goxw0sTnotVtL7a48/pb2nwhRafZuhq7znB3Qchf04aJP8dA+32s/BMwIXi/BS OcKI7wsuRQAu5JP9yGfWcAvs79KjZMSZYRkuCDBaJRHMwnXf7urY1bxK3u1hq/N+mF1X 9bFA== 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=qDaOFl9kJBrQcy3q+Sh7kCQfBP1CTBiTNSCx8KNh/Ks=; b=Vm3RoZ1wzdOhmAudwwQNdgFnIhSt1RetkIFXsH5Pm5NWe0teGYUjWrQtr0DLOyPkyy FKGv09Vcbyco5Tn+jq49cBND5jaupXiBJcVy02WnBA1ChHZKRAXiYwq1XbmGH1UYmI2m l9/tslZLRVdbP9FZB8FGb6c9eGeYsSfqjZ4slqUWw5TCj6P6F1dGmosS6G6Ypb+3YTRX fFwxq4Iy5Uua8psUOarTA1GOttFHnhgLX7DpZ2zeqHPhBZAGqM/SV5w/KN2Z8jk+fprT TDUdJS1r0OJ3OaAtSSyb4uUhy4sP1uJgrnfi5MpP2nomZPW5xLLGCF5KT+FjcA/8OhBO BP6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=U6XXoPNj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c26si3868240edx.353.2019.10.18.05.26.09; Fri, 18 Oct 2019 05:26:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=U6XXoPNj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2633754AbfJRM0H (ORCPT + 26 others); Fri, 18 Oct 2019 08:26:07 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:45848 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2633690AbfJRM0B (ORCPT ); Fri, 18 Oct 2019 08:26: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 x9ICPwNm087352; Fri, 18 Oct 2019 07:25:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1571401558; bh=qDaOFl9kJBrQcy3q+Sh7kCQfBP1CTBiTNSCx8KNh/Ks=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=U6XXoPNjSsLm+60krHP3gA0fIcIwx8d+9TbUHtwzIvck1XQFHSd51FJpAzEI2N3Yc TfbbkSMiHMMAe+HJzkwLfcL8OUafvvTakHIxlN9IfQTaDE0wn5msu27j6Rj+ToeDi8 /k37Y/XIkvtst+/aGNiytkIqUge5eGJO8Hpbbbr0= 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 x9ICPw1f091744; Fri, 18 Oct 2019 07:25:58 -0500 Received: from DLEE108.ent.ti.com (157.170.170.38) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Fri, 18 Oct 2019 07:25:49 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Fri, 18 Oct 2019 07:25:49 -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 x9ICPvEI012287; Fri, 18 Oct 2019 07:25:58 -0500 From: Dan Murphy To: , CC: , , Dan Murphy Subject: [PATCH v14 17/19] leds: lp5523: Fix checkpatch issues in the code Date: Fri, 18 Oct 2019 07:25:19 -0500 Message-ID: <20191018122521.6757-18-dmurphy@ti.com> X-Mailer: git-send-email 2.22.0.214.g8dca754b1e In-Reply-To: <20191018122521.6757-1-dmurphy@ti.com> References: <20191018122521.6757-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix checkpatch errors and warnings for the LP5523.c device driver. Signed-off-by: Dan Murphy --- drivers/leds/leds-lp5523.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) -- 2.22.0.214.g8dca754b1e diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c index 287fc4756cd1..041b4e124855 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; From patchwork Fri Oct 18 12:25:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 176806 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp788034ill; Fri, 18 Oct 2019 05:26:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqyHeiYwrYLxZIbdj7ubW7ucIYb2hn9Qs37gFbHkCN4j22tDEkezwGiwxF4zQOpr10k0h/zh X-Received: by 2002:a17:906:b817:: with SMTP id dv23mr8303501ejb.22.1571401577592; Fri, 18 Oct 2019 05:26:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571401577; cv=none; d=google.com; s=arc-20160816; b=jLgf9iu7j7adICuZ0rjRWGwBlMyGY/mTUiQnfxBE4G7bTTNhUzdrvCO45ielQD0tbQ /7sJwyGyGOZdj1phaZ94NvZzlEh3ZFK0yuq+AYNo5vc2IZ7liNdAelSdxslxkCj3qNnE oDZt4TIYoPpvsQViI40g7uEwbjE1EA9j0O2H8dYNebG8cFISE1LY66VJz9EIfvQ5Cd82 LDqTacA5tA1bD+SONefQp008x/xOYvLoMXyvlcIQaThvvCsCrYSjLPny8ezkUo252Dut eJhPRYpUJZD9E+9UwJmo0+qiOxAksy7Z1iCLBg1FS0IePLMYM6jadcRhYCKQ+sZQDRy1 sshA== 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=EJK//JMShkFomcxIL7CoEODYJVjSFbKnvbLo+tDSL6s=; b=TLLEDw0fqcbSNPb8bk1QUaqYrwzvvx1F+/rAsSS5IVvfh1J4qXU4tu91jaRTisU+AW BKOW5G5xrYP5+Eafgosd8MKmUsHjbbnVQUuLVa7Llc/NvSFv29gcOiVi6o4eYdcjrL6H +6HB4KCPTFkrh8TVrA5BFzlRrEhUmiMv1NoldTAPhUSK4sTk2PhzHR5Epit8BtfIHgh+ hB7yM/Hv/Qxxu3Tb6vTfQ8cwmzY1L49/S9rT+ndoteBS4q98MrXI/d7GM2Z7rBog9ybt sxv94yx7oI/nuSME++yEd+OjOSpB5Jp+RuNXpGdeQBZZqQps1PovNYpqJ2zqqsybU+e9 5zCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="R7QSZ/31"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b14si3267527eju.187.2019.10.18.05.26.17; Fri, 18 Oct 2019 05:26:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="R7QSZ/31"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2633779AbfJRM0N (ORCPT + 26 others); Fri, 18 Oct 2019 08:26:13 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:45884 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2633757AbfJRM0K (ORCPT ); Fri, 18 Oct 2019 08:26:10 -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 x9ICPwQt087356; Fri, 18 Oct 2019 07:25:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1571401558; bh=EJK//JMShkFomcxIL7CoEODYJVjSFbKnvbLo+tDSL6s=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=R7QSZ/31b4jvNk9cli8myD2eOh9eyV6l5/1uLtJjHPm+vXi4Gna+BfRXDRd1eSSnl xlaMJ/pA2UUfMkvrK0F+tm/LeETrOFoP3oxEZ1TGaduOWns1X+KJERblTClvk42sNI lV8oaRLuLFWdgawEOkYc6xM6/zTJEXmt6eB/9cRI= Received: from DLEE114.ent.ti.com (dlee114.ent.ti.com [157.170.170.25]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x9ICPwVt053652 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 18 Oct 2019 07:25:58 -0500 Received: from DLEE114.ent.ti.com (157.170.170.25) by DLEE114.ent.ti.com (157.170.170.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Fri, 18 Oct 2019 07:25:50 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE114.ent.ti.com (157.170.170.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Fri, 18 Oct 2019 07:25:50 -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 x9ICPwrh073340; Fri, 18 Oct 2019 07:25:58 -0500 From: Dan Murphy To: , CC: , , Dan Murphy , Rob Herring , Tony Lindgren , =?utf-8?q?Beno=C3=AEt_Cousson?= , Linus Walleij , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team Subject: [PATCH v14 18/19] dt: bindings: Update lp55xx binding to recommended LED naming Date: Fri, 18 Oct 2019 07:25:20 -0500 Message-ID: <20191018122521.6757-19-dmurphy@ti.com> X-Mailer: git-send-email 2.22.0.214.g8dca754b1e In-Reply-To: <20191018122521.6757-1-dmurphy@ti.com> References: <20191018122521.6757-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Update the LP55xx DT binding examples to the recommended node naming convention. There are no changes to the DT properties. Signed-off-by: Dan Murphy CC: Rob Herring CC: Tony Lindgren CC: "Benoît Cousson" CC: Linus Walleij CC: Shawn Guo CC: Sascha Hauer CC: Pengutronix Kernel Team CC: Fabio Estevam CC: NXP Linux Team --- .../devicetree/bindings/leds/leds-lp55xx.txt | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) -- 2.22.0.214.g8dca754b1e diff --git a/Documentation/devicetree/bindings/leds/leds-lp55xx.txt b/Documentation/devicetree/bindings/leds/leds-lp55xx.txt index 0ccc1efc2499..5475f45ef51f 100644 --- a/Documentation/devicetree/bindings/leds/leds-lp55xx.txt +++ b/Documentation/devicetree/bindings/leds/leds-lp55xx.txt @@ -48,7 +48,7 @@ example 1) LP5521 'lp5521_pri:channel1' and 'lp5521_pri:channel2', with a heartbeat trigger on channel 0. -lp5521@32 { +led-controller@32 { #address-cells = <1>; #size-cells = <0>; compatible = "national,lp5521"; @@ -56,20 +56,20 @@ lp5521@32 { label = "lp5521_pri"; clock-mode = /bits/ 8 <2>; - chan@0 { + led@0 { reg = <0>; led-cur = /bits/ 8 <0x2f>; max-cur = /bits/ 8 <0x5f>; linux,default-trigger = "heartbeat"; }; - chan@1 { + led@1 { reg = <1>; led-cur = /bits/ 8 <0x2f>; max-cur = /bits/ 8 <0x5f>; }; - chan@2 { + led@2 { reg = <2>; led-cur = /bits/ 8 <0x2f>; max-cur = /bits/ 8 <0x5f>; @@ -88,70 +88,70 @@ ASEL1 ASEL0 Address VEN GND 34h VEN VEN 35h -lp5523@32 { +led-controller@32 { #address-cells = <1>; #size-cells = <0>; compatible = "national,lp5523"; reg = <0x32>; clock-mode = /bits/ 8 <1>; - chan@0 { + led@0 { reg = <0>; chan-name = "d1"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; - chan@1 { + led@1 { reg = <1>; chan-name = "d2"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; - chan@2 { + led@2 { reg = <2>; chan-name = "d3"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; - chan@3 { + led@3 { reg = <3>; chan-name = "d4"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; - chan@4 { + led@4 { reg = <4>; chan-name = "d5"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; - chan@5 { + led@5 { reg = <5>; chan-name = "d6"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; - chan@6 { + led@6 { reg = <6>; chan-name = "d7"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; - chan@7 { + led@7 { reg = <7>; chan-name = "d8"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; - chan@8 { + led@8 { reg = <8>; chan-name = "d9"; led-cur = /bits/ 8 <0x14>; @@ -162,35 +162,35 @@ lp5523@32 { example 3) LP5562 4 channels are defined. -lp5562@30 { +led-controller@30 { #address-cells = <1>; #size-cells = <0>; compatible = "ti,lp5562"; reg = <0x30>; clock-mode = /bits/8 <2>; - chan@0 { + led@0 { reg = <0>; chan-name = "R"; led-cur = /bits/ 8 <0x20>; max-cur = /bits/ 8 <0x60>; }; - chan@1 { + led@1 { reg = <1>; chan-name = "G"; led-cur = /bits/ 8 <0x20>; max-cur = /bits/ 8 <0x60>; }; - chan@2 { + led@2 { reg = <2>; chan-name = "B"; led-cur = /bits/ 8 <0x20>; max-cur = /bits/ 8 <0x60>; }; - chan@3 { + led@3 { reg = <3>; chan-name = "W"; led-cur = /bits/ 8 <0x20>; @@ -202,7 +202,7 @@ example 4) LP8501 9 channels are defined. The 'pwr-sel' is LP8501 specific property. Others are same as LP5523. -lp8501@32 { +led-controller@32 { #address-cells = <1>; #size-cells = <0>; compatible = "ti,lp8501"; @@ -210,63 +210,63 @@ lp8501@32 { clock-mode = /bits/ 8 <2>; pwr-sel = /bits/ 8 <3>; /* D1~9 connected to VOUT */ - chan@0 { + led@0 { reg = <0>; chan-name = "d1"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; - chan@1 { + led@1 { reg = <1>; chan-name = "d2"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; - chan@2 { + led@2 { reg = <2>; chan-name = "d3"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; - chan@3 { + led@3 { reg = <3>; chan-name = "d4"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; - chan@4 { + led@4 { reg = <4>; chan-name = "d5"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; - chan@5 { + led@5 { reg = <5>; chan-name = "d6"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; - chan@6 { + led@6 { reg = <6>; chan-name = "d7"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; - chan@7 { + led@7 { reg = <7>; chan-name = "d8"; led-cur = /bits/ 8 <0x14>; max-cur = /bits/ 8 <0x20>; }; - chan@8 { + led@8 { reg = <8>; chan-name = "d9"; led-cur = /bits/ 8 <0x14>;