Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4768434ybb; Tue, 7 Apr 2020 14:11:28 -0700 (PDT) X-Google-Smtp-Source: APiQypLF3RbQgefbQGHq0O70Ah1rrXroDL/G4cBQlNuyg6cV9ZBbrZ2OyoVrdeAtfRQUBHk8z2TX X-Received: by 2002:aca:4d8:: with SMTP id 207mr115899oie.70.1586293888522; Tue, 07 Apr 2020 14:11:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586293888; cv=none; d=google.com; s=arc-20160816; b=hPm53kfTOPA9TKRnC5o+9GJhMmpp4AG/nemHlh1Uv/oGmskU092KWo1aNj7GSfd5Hf 4tUKED2ffkebrU884mOpGB79Q1i6i38hwz2vT7W1KFwI+xfSmtBz0pZBazwjVYRCzwpr Vb1iEKZEeI0jeFxxrKC7gQS3N2PL/K1Gus8IdUCzsVildQR3gU1hVVM2IkQxwxKCmILT edITdqY5esAZn5CpQi9zoC21+RkJVCu9mQYBZYm68ATYPxzB1Wj7vcoBdxEcGltmJvbG oA2rpA1XU9cW8eeLQkTxbwaRc2j1FJqnYvD7z2k/6ehYCSilwz69Az/XZbyBe6twcoZ1 ZGYw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:cc:to:subject:dkim-signature; bh=Nu+B2/w9coH9HPVWoQt6VXSSZZQEj3l54ykzI9s+TtE=; b=0MT72bQ7MQE4H3ts0uzD0SIieDXiAbpsc3YNxz3imEzsuwuALEO6GoT8WVnWDl/XXW 99AfeDdSjtFBx3nNeJG6bOFKDxAB9ju+Urrw+hpOOhPZx1DZsaMjr4/vGol5PakXSuI3 nYkFKkzyEVlHpL9FXvFFMiacmmp/xAqVKr0Dgf+Rzy9A5c2PNeYKPFwml76WfaqltAmf T4y3+E1pbcG9rkp8APUAu/cV+9L+zW/L6P8eQ6k9NKQJA/VEbCZ43PGCtmDd7Vok0ddW ohELE5aYnFRWQQdLs65J+fR5cvFalCcplBNMKz+Ra8IikG6yIkTfM4jg3kogLpIOPU1A kkCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="Z9ChcA/f"; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f33si1832499otf.64.2020.04.07.14.11.09; Tue, 07 Apr 2020 14:11:28 -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=@gmail.com header.s=20161025 header.b="Z9ChcA/f"; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726602AbgDGVIf (ORCPT + 99 others); Tue, 7 Apr 2020 17:08:35 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:37231 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726426AbgDGVIf (ORCPT ); Tue, 7 Apr 2020 17:08:35 -0400 Received: by mail-wm1-f66.google.com with SMTP id j19so3342336wmi.2; Tue, 07 Apr 2020 14:08:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:autocrypt:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Nu+B2/w9coH9HPVWoQt6VXSSZZQEj3l54ykzI9s+TtE=; b=Z9ChcA/fJIRtnlXeS0z9quhp9NAlAIzQq9MMBiHAYx+5DKs5Nld+oRXkZDZ8lalTn/ MAZMOpT7xmtwqoV/7p295bRHmBEmdA1pqa5qf9UZz/JCdfo8tO4css0gnQBXZQbLwbKW D0fDz1VuZ/TdyMJOzBR/VflJ2P0qNEymRGIGKqvRHxQgCnvifOo6icoE7RojGdS2Y06B AfuJpqWDzy9CIdOUsSng6A0lC1atCwzJEDy/oJgncaREFEzDYpLHnfkecxB4I5PAoKB5 gagc3m6I0Lze++uDbwurl4U+1HwpxgYpwJUuOb2/OnhTFDhRpeXkUyuO98LZoH91a0oE /kiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=Nu+B2/w9coH9HPVWoQt6VXSSZZQEj3l54ykzI9s+TtE=; b=LUpRcJ/yBLhIzNsILhaGw/9evH7aZ4DN2LogGZPF8g3RKMWUE8IZqnZqRO4JNTKV1N SQRyDbRJiyUhMonAUrpMgpX9NzJNS1+adgLtVwIlBMdWSaYb2qxExP2yo7H8DRLCTcaL dQxeZSMFOWw8MD678iQ1pOlHlgYtPu4YxF9/eqxq0kbZcBCp4nvDWt2Fab8SJCXfmQOw hewHlVPDgt/7DQbweak6mb5x68TQlXNdGCnrm49SJWBuXfHlgyTqXG4SrfUJsyhHOa4G 23E+E9JvMBBcDmPaX6X/30kyKWldHk4G6s2Av0EBmuLQkC4hShVeO4YzeLRkhQmowM9o 58jQ== X-Gm-Message-State: AGi0PuZNsip1WuKEgaAp5uzgtNmZtc6ZaHO/Re8EIUc6FLBsuqjmzjoW 26vbmDa+N9cqOlDiXUfgCkpCkTD7 X-Received: by 2002:a7b:cfc9:: with SMTP id f9mr1225854wmm.137.1586293709773; Tue, 07 Apr 2020 14:08:29 -0700 (PDT) Received: from [192.168.1.23] (acgc191.neoplus.adsl.tpnet.pl. [83.9.230.191]) by smtp.gmail.com with ESMTPSA id a145sm4250639wmd.20.2020.04.07.14.08.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Apr 2020 14:08:29 -0700 (PDT) Subject: Re: [PATCH v19 04/18] leds: multicolor: Introduce a multicolor class definition To: Dan Murphy , pavel@ucw.cz Cc: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org References: <20200402204311.14998-1-dmurphy@ti.com> <20200402204311.14998-5-dmurphy@ti.com> From: Jacek Anaszewski Autocrypt: addr=jacek.anaszewski@gmail.com; prefer-encrypt=mutual; keydata= xsFNBFWjfaEBEADd66EQbd6yd8YjG0kbEDT2QIkx8C7BqMXR8AdmA1OMApbfSvEZFT1D/ECR eWFBS8XtApKQx1xAs1j5z70k3zebk2eeNs5ahxi6vM4Qh89vBM46biSKeeX5fLcv7asmGb/a FnHPAfQaKFyG/Bj9V+//ef67hpjJWR3s74C6LZCFLcbZM0z/wTH+baA5Jwcnqr4h/ygosvhP X3gkRzJLSFYekmEv+WHieeKXLrJdsUPUvPJTZtvi3ELUxHNOZwX2oRJStWpmL2QGMwPokRNQ 29GvnueQdQrIl2ylhul6TSrClMrKZqOajDFng7TLgvNfyVZE8WQwmrkTrdzBLfu3kScjE14Q Volq8OtQpTsw5570D4plVKh2ahlhrwXdneSot0STk9Dh1grEB/Jfw8dknvqkdjALUrrM45eF FM4FSMxIlNV8WxueHDss9vXRbCUxzGw37Ck9JWYo0EpcpcvwPf33yntYCbnt+RQRjv7vy3w5 osVwRR4hpbL/fWt1AnZ+RvbP4kYSptOCPQ+Pp1tCw16BOaPjtlqSTcrlD2fo2IbaB5D21SUa IsdZ/XkD+V2S9jCrN1yyK2iKgxtDoUkWiqlfRgH2Ep1tZtb4NLF/S0oCr7rNLO7WbqLZQh1q ShfZR16h7YW//1/NFwnyCVaG1CP/L/io719dPWgEd/sVSKT2TwARAQ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Y66Ws4kMedXuNUHe4zBLVlRbcYUdgT9Brw8nxmxu3KhEVsJkwOpXLUDuzo hQNfg9em95lpAK+VOTocke8PSESy3GbEtmoMueW3caSeDHb5dRP6WrndaYhEOzAA/KjuPU7J LMXOABOMIq+R38y7e2B3TnVDCrccdZDseFPUWmH0cGCGihH/j2UZG+PImrSDCh3h5MedVHGo sI62tmWm0q6lrljwSZmMZ30w1QaGmdFpI3Q6V+nZ7TZldI3x Message-ID: Date: Tue, 7 Apr 2020 23:08:27 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <20200402204311.14998-5-dmurphy@ti.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dan, One more nit below. On 4/2/20 10:42 PM, Dan Murphy wrote: > 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. [...] > # 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..838b1d679647 > --- /dev/null > +++ b/drivers/leds/led-class-multicolor.c > @@ -0,0 +1,206 @@ > +// SPDX-License-Identifier: GPL-2.0 > +// LED Multi Color class interface > +// Copyright (C) 2019-20 Texas Instruments Incorporated - http://www.ti.com/ > +// Author: Dan Murphy > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "leds.h" > + > +int led_mc_calc_color_components(struct led_classdev_mc *mcled_cdev, > + enum led_brightness brightness) > +{ > + struct led_classdev *led_cdev = &mcled_cdev->led_cdev; > + int i; > + > + for (i = 0; i < mcled_cdev->num_colors; i++) > + mcled_cdev->multicolor_info[i].color_brightness = (brightness * If you passed temporary array for collecting calculated brightness items to this function then you could remove this color_brightness field from struct multicolor_info. > + mcled_cdev->multicolor_info[i].color_led_intensity / > + led_cdev->max_brightness); > + > + return 0; [...] > +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..a6a3715c0d48 > --- /dev/null > +++ b/include/linux/led-class-multicolor.h > @@ -0,0 +1,121 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > +/* LED Multicolor class interface > + * Copyright (C) 2019-20 Texas Instruments Incorporated - http://www.ti.com/ > + */ > + > +#ifndef __LINUX_MULTICOLOR_LEDS_H_INCLUDED > +#define __LINUX_MULTICOLOR_LEDS_H_INCLUDED > + > +#include > +#include > + > +struct led_multicolor_info { s/led_multicolor_info/led_mc_subled/ ? > + int color_index; > + int color_brightness; This should not be needed. > + int color_led_intensity; > + int color_channel; > +}; > + > +struct led_classdev_mc { > + /* led class device */ > + struct led_classdev led_cdev; > + int num_colors; > + > + struct led_multicolor_info multicolor_info[LED_COLOR_ID_MAX]; > +}; -- Best regards, Jacek Anaszewski