Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp99077pxf; Wed, 24 Mar 2021 22:31:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyarwZwab5Lq6LVbtqVmwDz6sTuwnUAQjC2pP8Bf4irpXv+A8plpwjBD+CZ1jmm9T/Bub7D X-Received: by 2002:a05:6402:35cd:: with SMTP id z13mr7146255edc.21.1616650274478; Wed, 24 Mar 2021 22:31:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616650274; cv=none; d=google.com; s=arc-20160816; b=toi0GwOBQrAhFC0TFhSy/G8KaeFILnFbmiO/JlpF5agr1RNHR5cQ4axJdtQkPi7Jmb JjIShtiV0FTHcOoJXBGb+srG7hPV19qhQ0pod9T4F0qbdtYg8a44MpTZEvNcETmb3urm RBw2AfbHsiybzDPfIqfg/mC1jRaOGoOi4H1R4M6DBfKfduq3t7E7O10wy/iexaPFX2AG 3BAQLlvAUTdlOOaXykWPI0eq23MJIa7kIE2dkxE4AZrV7anbFHVoKbkix5vCwg78XP+L sNcUCJYj1WyaL2/RqjX/mu/Cj1IDdSOcwikS5tBkza+vKEdAf7Qjuw4ggkwS40WZNwtp QRfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=ZxHGrWsGgW6TprfvvINnFETzyCVg5VNycGG4rTWxoNQ=; b=hrhVGonoEcExprCii8G9eB43ThquY9Dv7bLZoqhzqvUAX9S5fkR9EoZan2/MtUmxyj V8g6mjM0W7PW4K3sfspHXo6pKNpla0NWSL3CFfWu0nEBxifCKCjeHJjY6xxbpUkX2x8P IiFejXUjurLVwRctOvEQwYRt08+IF5ZI3YwFeknkbxjTbqZT2fSjAVm6CHneJUiwdl3j o7Miza5JWlTAiLSpyAEE9n0e11FGnPPyHtcghrU+g5K730Qz4DZJqddn8pRJMfrgjHIv HPZQjAyPeVh79XFduPkGv0E/Vq8GZrjc3XZwA1VGayxa6nHvRAOg82lKoDhJKl8UeTGU Um/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bVHd3TJE; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k3si3804190edh.184.2021.03.24.22.30.51; Wed, 24 Mar 2021 22:31:14 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bVHd3TJE; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229781AbhCYF1l (ORCPT + 99 others); Thu, 25 Mar 2021 01:27:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229730AbhCYF1d (ORCPT ); Thu, 25 Mar 2021 01:27:33 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F989C06174A; Wed, 24 Mar 2021 22:27:32 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id b14so689439lfv.8; Wed, 24 Mar 2021 22:27:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=ZxHGrWsGgW6TprfvvINnFETzyCVg5VNycGG4rTWxoNQ=; b=bVHd3TJE0aQYr1W2z0J8gP18eIX/35mjuD+fGxsdk4GaHOvt9ZOm2WAaftPUlxmGSU Vx0RLY1ljrKuFdl4rp3Fog88g2sCSR6lhDUn8BOx4GFhpmumW334P69LJ4F4XGqT0iut CLaO6TQwTFoKuzb4/r4Qbx8JbJi/VhsfaOO363ZnfwyGZUhXL5p5h5Rc1S3uEwWMxFkS /y5d76oDV6rS2xuoLMTYF/aYD1Bz64ll8KLZ6Wp76Ll6TTixRGhM0bXaGPypFaA8hfZ7 FxCjjk8QO4pw0KRMNY7LSBg6OCSGPK6BZy1S0uaAVdGAWipcae4cMwPE243wGxgpgJ+1 vzvg== 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:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ZxHGrWsGgW6TprfvvINnFETzyCVg5VNycGG4rTWxoNQ=; b=SaxpYsN6rv8CahGT4kIGIxzi4TBUmBbQG5EN/YNciEOGJA2feuJldYWaaetlqPfjdZ QjCP96XV+4Cn/NLjrWm3McU0C7DXRFJOMqyvkPmESIU5IJk0TIKYFX5porCKr2mPN7/N k0+iKmpcPH/vzEP1xQEIgFugNkAcOGRb2SPvlEagyEDOmSs8kpq6nrTf0bDpWtVM8mZh Gmc2l+deuDkiXoA6GbDqT105u1+psyKV2rOYig5S1xDjqlqo2vtNaKoZb8RMZxa5sUnv mPsyvz3Ys3MivWMsyYJZ22AgBpX68Y7o9NEV6u3tMXDhpwRW4kNGt/QZc5nAOfwXHr3N Mucw== X-Gm-Message-State: AOAM533zP1hzhreph6FNMB8sXZgpuCm2Auj5TG+XfCrwKggy/qxDBKDQ zivc9w6BayUh91TkOeznkCI= X-Received: by 2002:ac2:48ab:: with SMTP id u11mr3913829lfg.79.1616650051160; Wed, 24 Mar 2021 22:27:31 -0700 (PDT) Received: from [192.168.1.221] (87-92-162-34.rev.dnainternet.fi. [87.92.162.34]) by smtp.googlemail.com with ESMTPSA id l7sm578168lje.30.2021.03.24.22.27.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 24 Mar 2021 22:27:30 -0700 (PDT) Subject: Re: [PATCH 2/2] dt-binding: leds: Document leds-multi-gpio bindings To: Hermes Zhang , pavel@ucw.cz, dmurphy@ti.com, robh+dt@kernel.org Cc: linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, chenhuiz@axis.com, lkml@axis.com, kernel@axis.com References: <20210324075631.5004-1-chenhui.zhang@axis.com> <20210324075631.5004-3-chenhui.zhang@axis.com> From: =?UTF-8?B?VmVzYSBKw6TDpHNrZWzDpGluZW4=?= Message-ID: <0648fff2-5b38-66da-7eb0-9969e517421f@gmail.com> Date: Thu, 25 Mar 2021 07:27:33 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210324075631.5004-3-chenhui.zhang@axis.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, See below. On 24.3.2021 9.56, Hermes Zhang wrote: > From: Hermes Zhang > > Document the device tree bindings of the multiple GPIOs LED driver > Documentation/devicetree/bindings/leds/leds-multi-gpio.yaml. > > Signed-off-by: Hermes Zhang > --- > .../bindings/leds/leds-multi-gpio.yaml | 50 +++++++++++++++++++ > 1 file changed, 50 insertions(+) > create mode 100644 Documentation/devicetree/bindings/leds/leds-multi-gpio.yaml > > diff --git a/Documentation/devicetree/bindings/leds/leds-multi-gpio.yaml b/Documentation/devicetree/bindings/leds/leds-multi-gpio.yaml > new file mode 100644 > index 000000000000..6f2b47487b90 > --- /dev/null > +++ b/Documentation/devicetree/bindings/leds/leds-multi-gpio.yaml > @@ -0,0 +1,50 @@ > +# SPDX-License-Identifier: GPL-2.0 > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/leds/leds-multi-gpio.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Multiple GPIOs LED driver > + > +maintainers: > + - Hermes Zhang > + > +description: > + This will support some LED made of multiple GPIOs and the brightness of the > + LED could map to different states of the GPIOs. > + > +properties: > + compatible: > + const: multi-gpio-led > + > + led-gpios: > + description: Array of one or more GPIOs pins used to control the LED. > + minItems: 1 > + maxItems: 8 # Should be enough We also have a case with multi color LEDs (which is probably a more common than multi intensity LED. So I am wondering how these both could co-exist. From: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/leds/leds-gpio.yaml?h=v5.12-rc4#n58 led-0 { gpios = <&mcu_pio 0 GPIO_ACTIVE_LOW>; linux,default-trigger = "disk-activity"; function = LED_FUNCTION_DISK; }; Now 'gpios' (and in LED context) and 'led-gpios' is very close to each other and could easily be confused. Perhaps this could be something like: intensity-gpios = ... or even simplified then just to gpios = <...> > + > + led-states: > + description: | > + The array list the supported states here which will map to brightness > + from 0 to maximum. Each item in the array will present all the GPIOs > + value by bit. > + $ref: /schemas/types.yaml#/definitions/uint8-array > + minItems: 1 > + maxItems: 16 # Should be enough > + > +required: > + - compatible > + - led-gpios > + - led-states > + > +additionalProperties: false > + > +examples: > + - | > + gpios-led { > + compatible = "multi-gpio-led"; > + > + led-gpios = <&gpio0 23 0x1>, > + <&gpio0 24 0x1>; > + led-states = /bits/ 8 <0x00 0x01 0x02 0x03>; > + }; > +... > From: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/leds/leds-lp55xx.yaml?h=v5.12-rc4#n196 There is example of multi color LED configuration. In example below I used two-color LED with red and green as an example (which what we seem to have most in use). Then if try to combine these into something like: # Multi color LED with single GPIO line per color multi-led@2 { compatible = "gpio-leds"; color = ; led@0 { color = ; gpios = <&mcu_pio 0 GPIO_ACTIVE_LOW>; }; led@1 { color = ; gpios = <&mcu_pio 1 GPIO_ACTIVE_LOW>; }; }; # And with intensity GPIOs: multi-led@2 { compatible = "gpio-leds"; color = ; led@0 { color = ; gpios = <&gpio0 23 0x1>, <&gpio0 24 0x1>; ... see below }; led@1 { color = ; gpios = <&gpio0 25 0x1>, <&gpio0 26 0x1>; ... see below }; }; # And then single GPIO with intensity GPIOs: led@2 { compatible = "gpio-leds"; gpios = <&gpio0 23 0x1>, <&gpio0 24 0x1>; gpios-brightness-levels = <0 1 2 3> }; I changed 'led-states' to 'gpios-brightness-levels' as it describe more that this is about brightness and not some other state information. How would this sound? Thanks, Vesa Jääskeläinen