Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp649463pxh; Tue, 9 Nov 2021 16:50:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJx13wGlD72wk3h/tau0QlVYNWYZbJJx1c1I3RNbrKkfhz3P3aMdjslnEqKm9h0og9EBHv2Q X-Received: by 2002:a05:6e02:e41:: with SMTP id l1mr8400599ilk.139.1636505408682; Tue, 09 Nov 2021 16:50:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636505408; cv=none; d=google.com; s=arc-20160816; b=mlBy82M1EWVCV9x1MZhCZrd/3cKj9CRZra2hneClDqKTt99Pq8nnnUGN4UfmCdav1J yczjhO0RfjOS4GUOsbRWp0BQJ/ERU0aktlWT/3+K/HvhOeFKnuanA4daAWvNdne5F8Oy nIAPxgLF3OsaWpmIXKqXBaGK36i2eSeXW34F+hqkAATfho2QJE8PT8NtvyQSXsAnxj2+ TMqDmItXFeRy5WpzMD6rxneFJ09D8PhUu5nZwgzqeMEa0jBx3VrtxBXEv7Kk8FzlN65P 8MGBbhLyT9NLBuBlz0OGU1jhwUEw2LVZcaATgvAFB9qqhtqml7MryHGCFM2GHfcNcBhK 2zGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=0Mvx6dgT1S5Z8APkXjfhuHxOB8ntXHyAWWkOXEnKgQQ=; b=eQiJRdGNZ43gB9T4fqCNZFXaFASna0RPm9xtoFiEEwI0Si2DJCKyRhi/XhoSKXo4gf jKOg8Nc5kh9EV99qW5jrFItrXQtlNikw7BeFC+u4SiWbqs/GOJFgfMchPvUGbMnPixLS mSNpdh62dGvgfmjpR1/PRh8KyaCQnEQJ2rEBxX1DYuSgmVPoxUHWWPwcfqiphylcorOj H6wF0uEImWJlonNEiULSwa/VrpdvX5YuAyHRRfTvc6Ss95RnaT2csjC+plXsC4/HkOWY g3jkd15lmHTaNqB18OwYG3mgaQqbYqy24+SpCRAh+nkvaMO+89M3JQr0OvtIInUGvghe WD3g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u5si51178489ill.11.2021.11.09.16.49.56; Tue, 09 Nov 2021 16:50:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232091AbhKIXc2 (ORCPT + 97 others); Tue, 9 Nov 2021 18:32:28 -0500 Received: from jabberwock.ucw.cz ([46.255.230.98]:55264 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232057AbhKIXcT (ORCPT ); Tue, 9 Nov 2021 18:32:19 -0500 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 273E71C0B80; Wed, 10 Nov 2021 00:29:32 +0100 (CET) Date: Wed, 10 Nov 2021 00:29:31 +0100 From: Pavel Machek To: Florian Eckert Cc: robh+dt@kernel.org, Eckert.Florian@googlemail.com, linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] leds: ktd20xx: Add the KTD20xx family of the RGB LEDs driver from Kinetic Message-ID: <20211109232930.GB26764@amd> References: <20211109100822.5412-1-fe@dev.tdt.de> <20211109100822.5412-2-fe@dev.tdt.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="NMuMz9nt05w80d4+" Content-Disposition: inline In-Reply-To: <20211109100822.5412-2-fe@dev.tdt.de> User-Agent: Mutt/1.5.23 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --NMuMz9nt05w80d4+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable hi! > Introduce the KTD2061/58/59/60 RGB LEDs driver. The difference in these > parts are the address number on the I2C bus the device is listen on. >=20 > All KT20xx device could control up to 12 LEDs. The chip can be operated > in two variants. How are the variants selected? > Variant 1: > The device has the ability to group LED outputs into two banks so that > the two LED banks can be controlled with the same color. This could not > be done via the LEDs 'sysfs' entry because of the limitation on the color > register count. The color of the two banks can be configured via device > 'sysfs' entry for all LEDs at once [current_color0|current_color1]. > Which color the LED is to be used can be set via the 'sysfs' of the > individual LEDs via the 'multi_intensity' file. Valid values for the > colors (RGB) are 0 | 1. The value 0 selects the color register 0 and the > value 1 selects the color register 1. So... you can select two colors (current_color0, current_color1), and then then each of the 12 LEDs get one of those colors. What about intensities? Can brightness be set arbitrarily for each LED? > Variant 2: > The device can also set the LED color independently. Since the chip only > has two color registers, but we want to control the 12 LEDs > independently via the 'led-class-multicolour' sysfs entry, > the full RGB color depth cannot be used. Due to this limitation, only 7 > colors and the color black (off) can be set. To use this mode the color > registers must be preset via the device tree or the device 'sysfs'. The > color registers 0 must be preset with 0x00 (Red=3D0x00 Green=3D0x00 Blue= =3D0x00). > The color register1 should be preset all with the same value. This value > depends on which light intensity is to be used in the setup. So now we have 7 colors we can select from. That sounds better than two colors. Why would we ever want to use variant 1? Can we simply pretend this is 7 LED RGB driver? > +/* Device attribute for color0 register > + * > + * The device attribute colour1 is intended to adjust the colour space. Use color, not colour. Plus run this through checkpatch. > + * The colour strength can be controlled via the current in 125uA steps. I don't know what "colour strength" is. > +/* > + * The chip also offers the option "Fade rate". > + */ > +static ssize_t faderate_show(struct device *dev, struct device_attribute= *a, > + char *buf) > +{ > + struct i2c_client *client =3D to_i2c_client(dev); > + struct ktd20xx *chip =3D i2c_get_clientdata(client); > + unsigned int value; > + > + mutex_lock(&chip->lock); > + regmap_field_read(chip->faderate, &value); > + mutex_unlock(&chip->lock); > + > + return sprintf(buf, "%d\n", value); > +} That's way too hardware specific. Best regards, Pavel --=20 http://www.livejournal.com/~pavelmachek --NMuMz9nt05w80d4+ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAmGLBFoACgkQMOfwapXb+vLgVgCfSAOGWebHBAMez7RBh1oGoRAp 6NsAn1cX05E3bf9cg2jmYsFiD+QpeE0W =DsMc -----END PGP SIGNATURE----- --NMuMz9nt05w80d4+--