Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1584307rwb; Thu, 1 Dec 2022 20:49:45 -0800 (PST) X-Google-Smtp-Source: AA0mqf5PptJCopM0xeQ/OI3B/HpeuGDoG8IIcx8uFcBLiT28yaU+xCfZPFXoMpuT1xSDpy4iJyjA X-Received: by 2002:a05:6402:1107:b0:463:9b53:cbf6 with SMTP id u7-20020a056402110700b004639b53cbf6mr55212016edv.173.1669956584917; Thu, 01 Dec 2022 20:49:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669956584; cv=none; d=google.com; s=arc-20160816; b=RLTA5XnrHFmNsqhlYgr81SVMH7spgJub+VJJKQTRle/xa/OCU9vbRW2svhbgfs8cSH ag1cFkLaLIY1Z8WOr1qTfXgdzAP8seeD4/+HgEhJ6m8lUYf9NHQBtUW4CauwXP3ME5/N NQh+RitqLmokqygeIzWP3m4lSpAZZIwB+lnAE2CoJzI7ASFrHClVDLe5Z/QNa7GbsoXP hKGJcFHZvQUUBjaZDsN7JE4cNVQLiUtrG4wnCpNf2KUGFGU+eOG86PzLlQiAaS7RY6Vc vBxKPUhhnRnu9nnF0rRautI0/eBep5SxvFTUdjVD9/ZyOk3R/5LG0AmDI17Uqkk0Fgxe V78w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DcgpSVWbdnGyz27O63kyyynW87PPwff4FTigIa8LAE8=; b=IvwFHvs91mTCNI309BLB/3/W0k2Sg/kdfHj6QqoOC6Q0g7U4jIDlm9Nz9ZPZuy3vhC gkDHpzf3KI+nqaqnUacmrrZm2E1NrwoCXkfk5OuxQaXnzHSSugFBqd8hSq45MVCBdNI4 zDnSbv5GkVYpQIn7j8QSFuD6lw4j4tkBsvCzQh+jruq/IdtHjwGRDyy+RYBiQgs24wr7 /nLrhvsIeqCdejqCAJduit1ugCGDFnIsVjtQENFjqmHKSgP8ZDyw1E7KnrgqqBr/o2a5 OYLjF4Gm5YsngvyjJ1H4phyV7QMAfk3O8YFBgI/nedvCWi/mgJOSij34nSy8pFXERILv 1H6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ZSCPwyLa; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hp36-20020a1709073e2400b007adcc8fb7a0si5643766ejc.399.2022.12.01.20.49.25; Thu, 01 Dec 2022 20:49:44 -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=@gmail.com header.s=20210112 header.b=ZSCPwyLa; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232287AbiLBDnV (ORCPT + 81 others); Thu, 1 Dec 2022 22:43:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232250AbiLBDnT (ORCPT ); Thu, 1 Dec 2022 22:43:19 -0500 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F29F920AE; Thu, 1 Dec 2022 19:43:18 -0800 (PST) Received: by mail-pj1-x102d.google.com with SMTP id k2-20020a17090a4c8200b002187cce2f92so7130327pjh.2; Thu, 01 Dec 2022 19:43:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DcgpSVWbdnGyz27O63kyyynW87PPwff4FTigIa8LAE8=; b=ZSCPwyLaDzy9gC5ISXUZhJVzlWx38kHqwDmkd3+h63VteuZkUmnF65ke8rjjIzZsoO eofp8zUMtwU0sL0Lu1dLHWVZDJOdnr7WvwNr8iJcC/WLcMvf13+d7uo3u3lCdTAlqUiF 41kcEeDqQA339abK0OojrKUF2zztAV7bZeS5LHoUFSEXVkisFylg7qOK0wT0o0+CsYQN tlH2Z7Qi+lxpN2f5XtJ5QYcv55831FJWBTBfoC2llWai3UyqASEpdr9UtILdHql09TTY KD91HcVjkxjIdCtOQ2fchV7o8OIOBNIEOJoirqdjMCioA/IF9o7lQKw1T6FnHIGevwBe 9tsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DcgpSVWbdnGyz27O63kyyynW87PPwff4FTigIa8LAE8=; b=VffP2zvkbrOVvUMwFFkRAt5jM7p0XJ+PxZ6c0TUbx0PktMzYvSq/Cdc78u1H8yP7IR tujrozIHZPGrJS1NJMpqkVD4F6s6R2ToQ0u1vogJGe68xKRgOpD5lgmCZVC+wvcG/5Ph zcFeZqSGoa62RS/4OpdnmXSZ5q8xujYkJxpHgSlGURAkW1jnv8pDzFonJhW8wRxZnqxj o1wkSltY03NS5jpCmbvogMK2MK8Ljko6SYJbGsJKwzkOzyde4ILIkJt6QReMwNdp2GTS B71vWnH43ew7WVTmN3NjmtWRJJQRyKLmflmXzf5EVVxsoimANDOZKQ67Kx4a3tJmefNU J2eA== X-Gm-Message-State: ANoB5pljvU5prp2239i+slwOAA/10OSu5JkRTGMxNqotkRV1PnbNUowL 7vbVgAAtxvfMcFtkA6D3KkMyZESlgrg= X-Received: by 2002:a17:90b:264a:b0:213:7030:f69a with SMTP id pa10-20020a17090b264a00b002137030f69amr73829602pjb.231.1669952597261; Thu, 01 Dec 2022 19:43:17 -0800 (PST) Received: from guoguo-omen.scut.edu.cn ([2401:c080:1400:4da2:5400:3ff:feb4:7578]) by smtp.gmail.com with ESMTPSA id v3-20020a170902e8c300b0017f59ebafe7sm4370636plg.212.2022.12.01.19.43.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Dec 2022 19:43:16 -0800 (PST) From: Chuanhong Guo To: linux-leds@vger.kernel.org Cc: Chuanhong Guo , Pavel Machek , Rob Herring , Krzysztof Kozlowski , Stanislav Jakubek , Linus Walleij , Shawn Guo , Johan Hovold , Bjorn Andersson , Marijn Suijten , Sven Schwermer , devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2 2/3] dt-bindings: leds: add dt schema for worldsemi,ws2812b-spi Date: Fri, 2 Dec 2022 11:42:39 +0800 Message-Id: <20221202034240.455831-3-gch981213@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221202034240.455831-1-gch981213@gmail.com> References: <20221202034240.455831-1-gch981213@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,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 This patch adds dt binding schema for WorldSemi WS2812B driven using SPI bus. Signed-off-by: Chuanhong Guo --- Changes since v1: remove linux driver reference from description remove some obvious descriptions fix unit address regex in multi-led property drop various minItems add maxItems = 1 to reg fix node names and property orders in binding example drop -spi from compatible string add default-brightness .../bindings/leds/worldsemi,ws2812b.yaml | 138 ++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/worldsemi,ws2812b.yaml diff --git a/Documentation/devicetree/bindings/leds/worldsemi,ws2812b.yaml b/Documentation/devicetree/bindings/leds/worldsemi,ws2812b.yaml new file mode 100644 index 000000000000..f91908d0acef --- /dev/null +++ b/Documentation/devicetree/bindings/leds/worldsemi,ws2812b.yaml @@ -0,0 +1,138 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/leds/worldsemi,ws2812b.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: WS2812B LEDs driven using SPI + +maintainers: + - Chuanhong Guo + +description: | + WorldSemi WS2812B is a individually addressable LED chip that can be chained + together and controlled individually using a single wire. + This binding describes a chain of WS2812B LEDs connected to the SPI MOSI pin. + Typical setups includes connecting the data pin of the LED chain to MOSI as + the only device or using CS and MOSI with a tri-state voltage-level shifter + for the data pin. + The SPI frequency needs to be 2.105MHz~2.85MHz for the timing to be correct + and the controller needs to send all the bytes continuously. + +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +properties: + compatible: + const: worldsemi,ws2812b + + reg: + maxItems: 1 + + spi-max-frequency: + minimum: 2105000 + maximum: 2850000 + + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + +patternProperties: + "^multi-led@[0-9a-f]+$": + type: object + $ref: leds-class-multicolor.yaml# + unevaluatedProperties: false + + properties: + color-index: + description: | + A 3-item array specifying color of each components in this LED. It + should be one of the LED_COLOR_ID_* prefixed definitions from the + header include/dt-bindings/leds/common.h. Defaults to + + if unspecified. + $ref: /schemas/types.yaml#/definitions/uint32-array + maxItems: 3 + + default-brightness: + description: + The default brightness that should be applied to the LED by the operating + system on start-up. The brightness should not exceed the brightness the + LED can provide. + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 255 + default: 0 + + default-intensity: + description: | + An array of 3 integer specifying the default intensity of each color + components in this LED. <255 255 255> if unspecified. + $ref: /schemas/types.yaml#/definitions/uint32-array + maxItems: 3 + items: + minimum: 0 + maximum: 255 + + reg: + description: | + Which LED this node represents. The reg of the first LED on the chain + is 0. + maxItems: 1 + + required: + - reg + - color + - function + +required: + - compatible + +additionalProperties: false + +examples: + - | + #include + spi { + #address-cells = <1>; + #size-cells = <0>; + + leds@0 { + compatible = "worldsemi,ws2812b"; + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + spi-max-frequency = <2850000>; + multi-led@0 { + reg = <0>; + color-index = ; + default-brightness = <30>; + default-intensity = <10 50 90>; + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <0>; + }; + multi-led@1 { + reg = <1>; + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <1>; + }; + multi-led@2 { + reg = <2>; + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <2>; + }; + multi-led@3 { + reg = <3>; + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <3>; + }; + }; + }; + +... -- 2.38.1