From patchwork Tue Dec 27 10:06:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Jacques Hiblot X-Patchwork-Id: 3329 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1322683wrt; Tue, 27 Dec 2022 02:25:42 -0800 (PST) X-Google-Smtp-Source: AMrXdXvxJvJS4vV6zsAH5b/Giw0Rh9SkQv/iquiQULSnNhJlTMaq5DZITO0ndWNZKDinNfiud1+j X-Received: by 2002:a17:907:a501:b0:7c1:700:1e2d with SMTP id vr1-20020a170907a50100b007c107001e2dmr19603886ejc.20.1672136742022; Tue, 27 Dec 2022 02:25:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672136742; cv=none; d=google.com; s=arc-20160816; b=mmUMywvLxxtYUFfDDJ8ujtvxRbhY5FikQHiVYCKCF4xjdcqNlLavgi6Px1dVcklab2 CgxebA2K4/SbZ2M1l/TlD1x7DSojJyMIRrMkgFHd3fF1NLHc/j9wORbCp+BnSg1Mlqvt 23EB4WfMHLhcmli9SGmj/HY+eHkrtFCRYFyRq+hoa/IVggjSg4+nOx9fiO6d9r2QaGLk y0iDw8lkRWJ5xcpPYnJ0QuNOB4xKg/5/ZLvcmaaB+tQY5SdZt3STjhuVns6Un7Fk8viW A3zA6llln7pxtGbuXeY60lCyqRRpigiXKNGTPyugi0s66VEHdmySXaK5keydYC/l4g/F lMOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=9uHqnT+xNoTJ04wsLAXNOTefMWGt7rFXApsFSiWQzs8=; b=AQxUlMQAR3NjumBAZ03yTZLPb6tn6kX+vMQAPoK4CjYS1uH+616+2OieeUUAjJow8Y 3+OWCmCP3uCNUFcY0kgpod1XTaJQu0w//x2L+3NtaM9GEB48LTbZX3E6ldVzpUxNPf79 6agJAKwCcC3YIRzWuaLW5OIjYG4T2Jt2Webz5IFq168cueUXeztd+mHvSQmzNnB9q7x1 nmrxtOLkf3BU5GovQyF0kNexPBIiqaWWbB5Y64iQR2pSXE6xBAlcgoVy4h3UkTJ1GsRj d9audu8tF+g4NhpEXeM1rIkCRUXn2ucnyKBfdSFPtGbpyg5P9Wcv1mCI+/uiPtn4mDwU hBOw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z27-20020a50cd1b000000b0046b3ecfe295si10228587edi.530.2022.12.27.02.25.18; Tue, 27 Dec 2022 02:25:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231447AbiL0KYK (ORCPT + 99 others); Tue, 27 Dec 2022 05:24:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229789AbiL0KYB (ORCPT ); Tue, 27 Dec 2022 05:24:01 -0500 Received: from smtpout1.mo528.mail-out.ovh.net (smtpout1.mo528.mail-out.ovh.net [46.105.34.251]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1551225CB; Tue, 27 Dec 2022 02:23:59 -0800 (PST) Received: from pro2.mail.ovh.net (unknown [10.108.4.193]) by mo528.mail-out.ovh.net (Postfix) with ESMTPS id 8ABB5147C1BE7; Tue, 27 Dec 2022 11:07:05 +0100 (CET) Received: from localhost.localdomain (88.161.25.233) by DAG1EX1.emp2.local (172.16.2.1) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Tue, 27 Dec 2022 11:07:04 +0100 From: Jean-Jacques Hiblot To: , , , , CC: , , , , , , , , Jean-Jacques Hiblot Subject: [RESEND PATCH v6 0/6] Add a multicolor LED driver for groups of monochromatic LEDs Date: Tue, 27 Dec 2022 11:06:53 +0100 Message-ID: <20221227100659.157071-1-jjhiblot@traphandler.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [88.161.25.233] X-ClientProxiedBy: DAG3EX1.emp2.local (172.16.2.21) To DAG1EX1.emp2.local (172.16.2.1) X-Ovh-Tracer-Id: 14107807311632546267 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedriedtgdduudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecunecujfgurhephffvvefufffkofgggfgtihesthekredtredttdenucfhrhhomheplfgvrghnqdflrggtqhhuvghsucfjihgslhhothcuoehjjhhhihgslhhothesthhrrghphhgrnhgulhgvrhdrtghomheqnecuggftrfgrthhtvghrnhepjeeuhfeklefghfelhfethfegkedtvedvgfekledtheegueejuedtheekuefhffdtnecukfhppeduvdejrddtrddtrddupdekkedrudeiuddrvdehrddvfeefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpeeojhhjhhhisghlohhtsehtrhgrphhhrghnughlvghrrdgtohhmqedpnhgspghrtghpthhtohepuddprhgtphhtthhopehlvggvsehkvghrnhgvlhdrohhrghdpphgrvhgvlhesuhgtfidrtgiipdhrohgshhdoughtsehkvghrnhgvlhdrohhrghdpshhvvghnrdhstghhfigvrhhmvghrseguihhsrhhuphhtihhvvgdqthgvtghhnhholhhoghhivghsrdgtohhmpdhkrhiihihsiihtohhfrdhkohiilhhofihskhhiodgutheslhhinhgrrhhordhorhhgpdhjohhhrghnodhlihhnrghroheskhgvrhhnvghlrdhorhhgpdhmrghrihhjnhdrshhuihhjthgvnhesshhomhgrihhnlhhinhgvrdhorh hgpdgsjhhorhhnrdgrnhguvghrshhsohhnsehlihhnrghrohdrohhrghdprghnugihrdhshhgvvhgthhgvnhhkohesghhmrghilhdrtghomhdpjhgrtggvkhdrrghnrghsiigvfihskhhisehgmhgrihhlrdgtohhmpdhlihhnuhigqdhlvggushesvhhgvghrrdhkvghrnhgvlhdrohhrghdpuggvvhhitggvthhrvggvsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdpoffvtefjohhsthepmhhohedvkedpmhhouggvpehsmhhtphhouhht X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL,SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753362456544389587?= X-GMAIL-MSGID: =?utf-8?q?1753362456544389587?= Resending the v6 of the series. I updated the date and kernel version in Documentation/ABI/testing/sysfs-class-led to Dec 2022 and version 6.2. Thanks, JJ Some HW design implement multicolor LEDs with several monochromatic LEDs. Grouping the monochromatic LEDs allows to configure them in sync and use the triggers. The PWM multicolor LED driver implements such grouping but only for PWM-based LEDs. As this feature is also desirable for the other types of LEDs, this series implements it for any kind of LED device. changes v5->v6: - restore sysfs access to the leds when the device is removed changes v4->v5: - Use "depends on COMPILE_TEST || OF" in Kconfig to indicate that OF is a functional requirement, not just a requirement for the compilation. - in led_mcg_probe() check if devm_of_led_get_optional() returns an error before testing for the end of the list. - use sysfs_emit() instead of sprintf() in color_show(). - some grammar fixes in the comments and the commit logs. changes v2->v3, only minor changes: - rephrased the Kconfig descritpion - make the sysfs interface of underlying LEDs read-only only if the probe is successful. - sanitize the header files - removed the useless call to dev_set_drvdata() - use dev_fwnode() to get the fwnode to the device. changes v1->v2: - Followed Rob Herrings's suggestion to make the dt binding much simpler. - Added a patch to store the color property of a LED in its class structure (struct led_classdev). Jean-Jacques Hiblot (6): devres: provide devm_krealloc_array() leds: class: simplify the implementation of devm_of_led_get() leds: provide devm_of_led_get_optional() leds: class: store the color index in struct led_classdev dt-bindings: leds: Add binding for a multicolor group of LEDs leds: Add a multicolor LED driver to group monochromatic LEDs Documentation/ABI/testing/sysfs-class-led | 9 + .../bindings/leds/leds-group-multicolor.yaml | 64 +++++++ drivers/leds/led-class.c | 65 +++++-- drivers/leds/rgb/Kconfig | 10 ++ drivers/leds/rgb/Makefile | 1 + drivers/leds/rgb/leds-group-multicolor.c | 168 ++++++++++++++++++ include/linux/device.h | 13 ++ include/linux/leds.h | 3 + 8 files changed, 319 insertions(+), 14 deletions(-) create mode 100644 Documentation/devicetree/bindings/leds/leds-group-multicolor.yaml create mode 100644 drivers/leds/rgb/leds-group-multicolor.c