Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp261334pxf; Wed, 24 Mar 2021 04:41:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2Gc6hO9T2Ypklxi+ii5toRPnIKf1xEN9pFbDz8zl+FxuhOyUgEZjfjMax7N6dGYkZ3Xu8 X-Received: by 2002:aa7:df86:: with SMTP id b6mr2958294edy.294.1616586070611; Wed, 24 Mar 2021 04:41:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616586070; cv=none; d=google.com; s=arc-20160816; b=HrD0I/Wxz5vhCxZ5cZASGFOpSBlDa7YLFZ88PP//9zE9Vio1s4WBdY84I3T7JgpE6R qpt/hFAGgL6ujQ60zi+f6R3q91+nGHN20r5E8g4MAkErIOHeYC0xx19d/CyaY1fo/jIo AbPQBsTeKRiH10/P079I2n/xgHYIiWQTE2wG/V654AHGDYq9iKJDO3YrxvBh87OazHg1 79HkOyL+0DVoGCi0tIFrgq01oWy8MAwK8f7NDjYXHXQ0Y3H+3wEPbYDZYDwY+t5d3zUD IFUonvAKMf7MFVNc7w+qp5QhbKUfvx5huiN7+EH1Q5MRGdvihQNM0mXfGnUhEt0VdPXt ZTDw== 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=exRei5Z1HcXLpF3Cr9djTHLqbqQ4nXc5lZL5MRDZyLQ=; b=Calp4RfzHH9YaD6los2n/kx94HRN3PGM0PL/oZ53dyo8+826tmqcu5tEx26T92QSkp tmZs6qzXDUt9ZduNNKGRvJAZDd4bsLqbjFkLMt5glQGCrmc2Hzs4w/oMbSA//XpXxYix jORD/I0PivayYSuNMT7/QvF02hWe4eT8vMZjcZzMuLbegAD7ITJJ9pMrG0GYZggXW7Zb 6lKfAz1uc22ymT/UeeDTCHO9nMlqrKnLQTXVfSQ1b5V6WXD/bPZYplud1hFrR6GTClwM EkODmQ+7X/zmnYGHbWOGJ3VIrvNvrnvaMjNe/mGr6IwiT9bU2IrhgSb115l924qVAukb VdUA== 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 lr3si1657258ejb.215.2021.03.24.04.40.48; Wed, 24 Mar 2021 04:41:10 -0700 (PDT) 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 S232848AbhCXKkh (ORCPT + 99 others); Wed, 24 Mar 2021 06:40:37 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:35240 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233741AbhCXKkR (ORCPT ); Wed, 24 Mar 2021 06:40:17 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 531131C0B7D; Wed, 24 Mar 2021 11:40:16 +0100 (CET) Date: Wed, 24 Mar 2021 11:40:16 +0100 From: Pavel Machek To: Marek Behun Cc: Hermes Zhang , dmurphy@ti.com, robh+dt@kernel.org, linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, chenhuiz@axis.com, lkml@axis.com, kernel@axis.com Subject: Re: [PATCH 1/2] leds: leds-multi-gpio: Add multiple GPIOs LED driver Message-ID: <20210324104016.GA6035@duo.ucw.cz> References: <20210324075631.5004-1-chenhui.zhang@axis.com> <20210324075631.5004-2-chenhui.zhang@axis.com> <20210324103431.4b945915@thinkpad> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="0F1p//8PRICkK4MW" Content-Disposition: inline In-Reply-To: <20210324103431.4b945915@thinkpad> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --0F1p//8PRICkK4MW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > > From: Hermes Zhang > >=20 > > Introduce a new multiple GPIOs LED driver. This LED will made of > > multiple GPIOs (up to 8) and will map different brightness to different > > GPIOs states which defined in dts file. >=20 > I wonder how many boards have such LEDs. >=20 > Also if it wouldn't be better to expand the original leds-gpio driver. > Probably depends on how much larger would such expansion make the > leds-gpio driver. Let's start with separate. > Use flexible array members. Allocate with > devm_kzalloc(dev, struct_size(priv, states, priv->nr_states), > GFP_KERNEL) Better yet, assume the brightness is 0..2^(num leds) and avoid this complexity. > Again LED_FULL and LED_OFF... > What about default-state =3D "keep" ? >=20 > Hermes, do you actually have a device that controls LEDs this way? How > many brightness options do they have? He has two bits. > Also I think this functionality could be easily incorporated into the > existing leds-gpio driver, instead of creating new driver. > Moreover your driver can control only one LED, so it needs to be > probed multiple times for multiple LEDs. Meanwhile the leds-gpio driver > can register multiple LEDs in one probe... The current version is mostly fine. Let's not overcomplicate it. Best regards, Pavel --=20 http://www.livejournal.com/~pavelmachek --0F1p//8PRICkK4MW Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRPfPO7r0eAhk010v0w5/Bqldv68gUCYFsXEAAKCRAw5/Bqldv6 8hh3AKC/4zfyRmK8Z5Y/fhcZo2ZpYh2dgQCeLpkpVtX/yTXeX0ft8ohGz7APXnM= =yIjo -----END PGP SIGNATURE----- --0F1p//8PRICkK4MW--