Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp6515705rwl; Mon, 9 Jan 2023 09:15:57 -0800 (PST) X-Google-Smtp-Source: AMrXdXvkoo8UEWYdH0aK5F7CO2j9ijgGdC/AdHLeYvkc7pYaHNZHASqqGh9RlQLXXnQhg9bToky7 X-Received: by 2002:a17:906:d0d0:b0:7c1:23f2:5b51 with SMTP id bq16-20020a170906d0d000b007c123f25b51mr62450101ejb.60.1673284557678; Mon, 09 Jan 2023 09:15:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673284557; cv=none; d=google.com; s=arc-20160816; b=KVrAEFYiIjaoMh4ak0baZjQa+Q66VMsHB6iaRCZNttGS6P6xvTFxcftF9w5/nPuOR8 Oium3MA/csOtOtxU1eAyWWOJJVwPYZph/g7vfjs17UDoY1isFFmxY2JsxbwtguuEe8U4 yqHWCERUftCq+2acjPAghR4kli/BJdjbrc1PlOWu1Fcvdz2/FMSpuXW5Y24QFYqTw2lZ WhFo8In6O2L5ezb6kCocGTii/3J+7+WH2QmG/75ASIPF0gXe+lKzgBD6OOkt2oj7j4ry lBvNIa9Hhm1YOx4jGChkmS4v8egRw+Z+4yw/p2ImTvujuPBp7Qz2Hyg+/RtW0dhdEiSp 6jkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=PqzPi1tDiRVfCn4WNUHFSvgGFUtWojrsc8akZJ0lyp8=; b=DC7aw4CXX2we05bDINDMxMhTM1MUxZspt7rSrhVTjrfhbntcPPHGaxRQ5my5pl/68Z Yf7qCwRGLLkF5k816k0f9qBEe+mSBeSQqp/MqPmBwaUOGIAalPBrWszqMR8Zvj2RU4uh Bn5OJcmHLYhifX5mQHWRcKzSB0XYWutOkjmmteahcgwTUTWb4J4lfsWwmdtWtgv0gmKY FBzNmqOpt4ogafSQ5zN35gRLsaVb1I4Y3pEul+3o3bU5n14rOd9dViq+Iqp0nwYStGIz /iE1sbDEUa3wY1gIFWsHJfmncg8JRd2T/4OdavZkfYDb5RZGtrYn6YND8tzfe7x+Egdj fY0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="b/7MU+aX"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw9-20020a1709066a0900b007c0969e429bsi11095596ejc.30.2023.01.09.09.15.44; Mon, 09 Jan 2023 09:15:57 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="b/7MU+aX"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233499AbjAIQ5P (ORCPT + 53 others); Mon, 9 Jan 2023 11:57:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236677AbjAIQ4j (ORCPT ); Mon, 9 Jan 2023 11:56:39 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A155A22A; Mon, 9 Jan 2023 08:56:38 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 31E95611A0; Mon, 9 Jan 2023 16:56:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 994B1C433EF; Mon, 9 Jan 2023 16:56:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673283397; bh=NpgdUywdtZmmgVQ+ulovo4MOXF9WUa/Zni2/s0Grk2A=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=b/7MU+aXJgDuZvXlUTbYIQypzqKJIcJCR0ilMkZza5MFk+3Q35KuLJTtgu+L9NKU0 rbCCU2G5VlryEX50yxv1b4ZnSouI4ZEKaADU9B/Rf6lIbMfxvx04QKClac6jKkR7Jw Vu1St4n1CAlysMPJCxyCRU07OT0oNzq2udlGb/GXNb8sbNBxDYXD3Ir9dCHNdCSuHi 8152efaCbloMbNIt37bEvD27UJvQ1hDf7eth6kiTGnu6a8Q5Nqy0KFhufWKIGbmYNp tvvWCRqiKNjG5hc9mReiOtZe3xsVKWwgUOBWqGXDEv7X0zUonQ8txoWrt2eRd7In0B nur+ajEj9ikLQ== Date: Mon, 9 Jan 2023 16:56:32 +0000 From: Lee Jones To: Joseph Strauss Cc: pavel@ucw.cz, jansimon.moeller@gmx.de, conor@kernel.org, christophe.jaillet@wanadoo.fr, linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] Add multicolor support to BlinkM LED driver Message-ID: References: <20221228010958.9670-1-jstrauss@mailbox.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20221228010958.9670-1-jstrauss@mailbox.org> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 On Tue, 27 Dec 2022, Joseph Strauss wrote: > Added multicolor support to the BlinkM driver, making it easier to > control from userspace. The BlinkM LED is a programmable RGB LED. The > driver currently supports only the regular LED sysfs class, resulting in > the creation of three distinct classes, one for red, green, and blue. > The user then has to input three values into the three seperate > brightness files within those classes. The multicolor LED framework > makes the device easier to control with the multi_intensity file: the > user can input three values at once to form a color, while still > controlling the lightness with the brightness file. > > The main struct blinkm_led has changed slightly. A struct > led_classdev_mc has been added to represent the multicolor sysfs class, > and an additional struct led_classdev pointer has been added for > convenience, which points to the struct led_classdev within struct > led_classdev_mc. The struct led_classdev for the regular sysfs classes > remain. Additionally, a field representing the multicolor LED has been > added to the struct blinkm_data, seperate from the blinkm_leds[3] array. > > In the blinkm_probe function, the multicolor LED class is registered > after the regular LED classes. The blinkm_set_mc_brightness() function > had to be added to calculate the three color components and then set the > fields of the blinkm_data structure accordingly. > > Signed-off-by: Joseph Strauss > --- > Changes in v2: > - Replaced instances of the constant 3 with NUM_LEDS, where applicable > - Fixed formatting errors > - Replaced loop inside of blinkm_set_mc_brightness() with equivalent > statements > - Changed id of multicolor class from 4 to 3 > - Replaced call to devm_kmalloc_array() with devm_kcalloc() > > Documentation/leds/leds-blinkm.rst | 26 +++++- > drivers/leds/Kconfig | 1 + > drivers/leds/leds-blinkm.c | 143 +++++++++++++++++++++++------ > 3 files changed, 137 insertions(+), 33 deletions(-) Another one for Pavel until I can build some knowledge. -- Lee Jones [李琼斯]