Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp2724024rwi; Fri, 28 Oct 2022 10:23:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM597gEX+2XO/bAtLfgzvMKhOqpm+zEHvP61GLl6Si70e2v0CDqMEERYEM2bQqNvp7Miom8x X-Received: by 2002:a05:6402:51c8:b0:462:3e90:aef with SMTP id r8-20020a05640251c800b004623e900aefmr473163edd.225.1666977808833; Fri, 28 Oct 2022 10:23:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666977808; cv=none; d=google.com; s=arc-20160816; b=PY+S88w+BHMj3qz1ay4IlxuLYr2/OTm1BIXd9Ly8KmLXQBwOcvI7BOTzUed8ZSu8nf 9Esrfp+UNKZYKOXJzBvjVnwS0p3RZ3JO2fpe+knhCRF67fu2D4Q6DzFby2Hz0EKbFlt4 iEK+AG18iWYOOsKFNMCbjPpDwI3aTKv8/XfI8KmmS3KzJ8Ylt60anf2CEdTx0KnDHJq8 kNLrMEj0szMZgXIb+kn8OtmYkwDsqs5xlovFLjVX2SUXMGbXMqnBun3scCzukmPPIbo7 4QV0pjlRDSGFFI0Cb9R6qn8+FULO88NjHb/tTrOWRnGXMtYzh4cExMUiesXpz5nwqbT8 s8Kw== 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=TD3jMnNqbgEYHNwDU+NhQgRc5Db3HHZ4IJiim9Ul7lM=; b=lq3ZPlaVd+XC4Nqe277/YNp8RasKfdr5/4mMoJIr4Mn6o7+7efl+un3ETW6cYQHhDy XYBfr0c9zy7YsKENfiRMmGRNPKOImWPbroBXt4lm90Cbl27ceinf0fZ28gTnHjMgDMEc PNcX68/wXyKFQvSbMYFc0LFeYjtXG0PKe4rxPO6UrPc1wA8gJ0TZpVAvXVw3sITamtsY +zI2ITRZftj4eHiP//JXRWJ8djXlhx0PJMNxFVvUA93fl5+hp74dKaWs9RQoDKrsFa6z 7rjq20VvO7nBMgUG4sXzhSKt4UhwryHYSuzJM+W961nsY9D+muTYHrzqHVabs4v6gGgX qk0Q== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gb16-20020a170907961000b007ad6a0afbd4si1149465ejc.825.2022.10.28.10.23.03; Fri, 28 Oct 2022 10:23:28 -0700 (PDT) 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 S231226AbiJ1REn (ORCPT + 99 others); Fri, 28 Oct 2022 13:04:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231269AbiJ1REK (ORCPT ); Fri, 28 Oct 2022 13:04:10 -0400 Received: from smtpout1.mo3004.mail-out.ovh.net (smtpout1.mo3004.mail-out.ovh.net [79.137.123.219]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 910301EF05E; Fri, 28 Oct 2022 10:03:27 -0700 (PDT) Received: from pro2.mail.ovh.net (unknown [10.108.1.240]) by mo3004.mail-out.ovh.net (Postfix) with ESMTPS id 32AC8244439; Fri, 28 Oct 2022 17:03:25 +0000 (UTC) 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.13; Fri, 28 Oct 2022 19:03:24 +0200 From: Jean-Jacques Hiblot To: , , , , CC: , , , , , , , , Jean-Jacques Hiblot Subject: [PATCH v5 0/6] Add a multicolor LED driver for groups of monochromatic LEDs Date: Fri, 28 Oct 2022 19:03:02 +0200 Message-ID: <20221028170308.2676734-1-jjhiblot@traphandler.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [88.161.25.233] X-ClientProxiedBy: DAG2EX2.emp2.local (172.16.2.12) To DAG1EX1.emp2.local (172.16.2.1) X-Ovh-Tracer-Id: 818810708008516059 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvgedrtdeigddutdeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffoggfgtghisehtkeertdertddtnecuhfhrohhmpeflvggrnhdqlfgrtghquhgvshcujfhisghlohhtuceojhhjhhhisghlohhtsehtrhgrphhhrghnughlvghrrdgtohhmqeenucggtffrrghtthgvrhhnpeejuefhkeelgffhlefhtefhgeektdevvdfgkeeltdehgeeujeeutdehkeeuhffftdenucfkphepuddvjedrtddrtddruddpkeekrdduiedurddvhedrvdeffeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepoehjjhhhihgslhhothesthhrrghphhgrnhgulhgvrhdrtghomheqpdhnsggprhgtphhtthhopedupdhrtghpthhtoheplhgvvgdrjhhonhgvsheslhhinhgrrhhordhorhhgpdhprghvvghlsehutgifrdgtiidprhhosghhodgutheskhgvrhhnvghlrdhorhhgpdhsvhgvnhdrshgthhifvghrmhgvrhesughishhruhhpthhivhgvqdhtvggthhhnohhlohhgihgvshdrtghomhdpkhhriiihshiithhofhdrkhhoiihlohifshhkihdoughtsehlihhnrghrohdrohhrghdpjhhohhgrnhdolhhinhgrrhhosehkvghrnhgvlhdrohhrghdpmhgrrhhijhhnrdhsuhhijhhtvghnsehsohhmrghinh hlihhnvgdrohhrghdpsghjohhrnhdrrghnuggvrhhsshhonheslhhinhgrrhhordhorhhgpdgrnhguhidrshhhvghvtghhvghnkhhosehgmhgrihhlrdgtohhmpdhjrggtvghkrdgrnhgrshiivgifshhkihesghhmrghilhdrtghomhdplhhinhhugidqlhgvughssehvghgvrhdrkhgvrhhnvghlrdhorhhgpdguvghvihgtvghtrhgvvgesvhhgvghrrdhkvghrnhgvlhdrohhrghdplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdfovfetjfhoshhtpehmoheftddtgedpmhhouggvpehsmhhtphhouhht X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham 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 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 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 | 154 ++++++++++++++++++ include/linux/device.h | 13 ++ include/linux/leds.h | 3 + 8 files changed, 305 insertions(+), 14 deletions(-) create mode 100644 Documentation/devicetree/bindings/leds/leds-group-multicolor.yaml create mode 100644 drivers/leds/rgb/leds-group-multicolor.c -- 2.25.1