From patchwork Sat Jan 2 23:15:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 355974 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp13885948jai; Sat, 2 Jan 2021 15:17:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJwSngfIjII8taizHPJNoDET77OR79ZwndSLSc0QTchqKM/QkPqIdW0nsQri/isOR3rI+4sl X-Received: by 2002:aa7:d7d8:: with SMTP id e24mr63891530eds.135.1609629438206; Sat, 02 Jan 2021 15:17:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609629438; cv=none; d=google.com; s=arc-20160816; b=RG90nOMkIYRY4ip6cj0H3c7uqy2PhPjzEFXRbIC2XNLzO4clslr8cCcbH6qvLvFTr1 +t5pKjlxqSgdEAodDk2RYGtpXGIJ6LFK1baNsvwSXHG5lxvPAacD0i7jYPRtpZg/ZEuG uHsNGWtIOKO/nkjNSt+IyJ+ReKcEL9wEDOkDsLiehpxXr4SGqUufEV1LBRT9gOgx+AVj +2cIk7uw/0SY5JP1ou0fTcSTzVCKBY7765XHjSrEaAIPinrfh1WB+MUa0OajdvP4iegA q87TQVUFAaj9u2LzQegzUHFqACxwkmEF/GUrfR28VL6ztgIcP7QNHoEoLYV+SXRew21A F9Nw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=9u5iq0kakVYuhYGTXnHBQdkf9ffgnEBS99aL91HMqDo=; b=voDuR9IqCoQ/ZWw7gyoR74zGOnjFGYvRYi1cyutvnZfZucONVKfMEP6WWyMqCLLSUZ XnwNzlJlpYGRTKXSeylvw+i6KzYx5MjWPEzrFJwOb9uMjSAE6kx5ml5mfjkeJoFSGMAx mutISiQKwEYBTAyahd+gQswrNFfpyUlvp9gV47+hmWM1l2837KOKflliJea6UILzFl4T yz57tG3B9Ty+UYzAZGHu5SkTyRs+PCfcc4mVXOWNrWaybBsBOg2Q4/+erYhUc4/bPf94 iu7i02HkOUpU/8rhuGwg6SAIXGSygH2ibFeF28py5OMhOu16h9y8wmBQkiT58azqwB2D EDrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MUFfk9CS; spf=pass (google.com: domain of linux-leds-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-leds-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bt25si29835541edb.572.2021.01.02.15.17.18 for ; Sat, 02 Jan 2021 15:17:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-leds-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=@linaro.org header.s=google header.b=MUFfk9CS; spf=pass (google.com: domain of linux-leds-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-leds-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726881AbhABXQC (ORCPT ); Sat, 2 Jan 2021 18:16:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726807AbhABXQB (ORCPT ); Sat, 2 Jan 2021 18:16:01 -0500 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43B71C061573 for ; Sat, 2 Jan 2021 15:15:20 -0800 (PST) Received: by mail-lf1-x136.google.com with SMTP id h22so56130228lfu.2 for ; Sat, 02 Jan 2021 15:15:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=9u5iq0kakVYuhYGTXnHBQdkf9ffgnEBS99aL91HMqDo=; b=MUFfk9CS9fx2VjHaXZWTy6GR3mmpUKsZ5EOCcU2em3GuTF62+u03OyZ8n5rYX3Hzo9 lMkp8FmS2/40hEJL66NEf/IA+tOLSdKwcKhGNLEvjeOmwb1PQqbxi0VKYMiL2YHfIEnN PWCdaDLldw4Ao+FmunpMXDc1VF3vbJZKiUnQ/5etxu55/0PXOUBeq6iGji91OZomG7Jv hNbrNVyy8wO6WusIow2dhDGiXURbZRH4374scdT7XygMpZEUU9UVONV2CgWx1nI4kYLV CelvX2H7QL8ahpjzopZ2lRgRp9dvin+xT574GLTy1I4rUpHKxCIxxzCJCctdGbZFsfGm APUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=9u5iq0kakVYuhYGTXnHBQdkf9ffgnEBS99aL91HMqDo=; b=c9PBT2l0eKX2XRln8v1g8qYfCpiyJkdu8z2B6wYG4sIllvjuscw/Ts2D9icW2UaFSa dHS/ezGwSo2fyMMScbansb1D3zWxoKV8ecMFHFhDQGM8kiDf0Kr9j3BCaWSH6+q0win3 PhpiSLJ+4VS94CpUOcvcT9gcbaSpEe3p8jojd+Lu77UopTxt9aRzy/PpK7OzpzxtAg5P IzG/foFnoNj3TFwIULIBAHIr4DnoesihvmY+aebs/k8fOMbPND1DjxPb//ngKgFlR9rA 9rtIuJFA6f3D8r6oDOyd7ABnpgdKZ6vgmTKCrSvjkdmX2vBu62pGE7VFqtsTnF7O0yso 4fjA== X-Gm-Message-State: AOAM530T1JXMOdX0596ibm8lIrTGMyTH6h+zX52aKtWDbJ0AUHFpUcQ0 LctR9opQteGVL68xqemy9WR3mAJuAImaPw== X-Received: by 2002:a19:6901:: with SMTP id e1mr28116772lfc.335.1609629318794; Sat, 02 Jan 2021 15:15:18 -0800 (PST) Received: from localhost.localdomain (c-92d7225c.014-348-6c756e10.bbcust.telenor.se. [92.34.215.146]) by smtp.gmail.com with ESMTPSA id 204sm6833732lfj.269.2021.01.02.15.15.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Jan 2021 15:15:18 -0800 (PST) From: Linus Walleij To: Jacek Anaszewski , Pavel Machek , Dan Murphy Cc: linux-leds@vger.kernel.org, Linus Walleij , Sakari Ailus , newbytee@protonmail.com, Stephan Gerhold , phone-devel@vger.kernel.org, linux-media@vger.kernel.org, devicetree@vger.kernel.org, Rob Herring , Sakari Ailus Subject: [PATCH 1/2 v9] dt-bindings: leds: Add DT binding for Richtek RT8515 Date: Sun, 3 Jan 2021 00:15:09 +0100 Message-Id: <20210102231510.2068851-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org Add a YAML devicetree binding for the Richtek RT8515 dual channel flash/torch LED driver. Cc: Sakari Ailus Cc: newbytee@protonmail.com Cc: Stephan Gerhold Cc: phone-devel@vger.kernel.org Cc: linux-media@vger.kernel.org Cc: devicetree@vger.kernel.org Reviewed-by: Rob Herring Reviewed-by: Sakari Ailus Signed-off-by: Linus Walleij --- ChangeLog v8->v9: - No changes, resend with the driver. ChangeLog v7->v8: - Add additionalProperties: fals to the leds subnode - Fix the bug in the example. - Collect Rob's Reviewed-by. ChangeLog v6->v7: - Use led-max-microamp for the torch mode max current. - Drop the torch-specific new property from common.yaml in favor of this property. - Collect Sakari's review tag. ChangeLog v5->v6: - Use the suffix -ohms for the resistor values as this gets recognized by default by dtschema and is nominal. ChangeLog v4->v5: - Fix the RFS/RTS resistors to reference the u32 schema. - Fix resisitor speling error. ChangeLog v3->v4: - Add DT attributes for the RFS and RTS resistors, so that the hardware-defined maximum current can be determined. - Add torch-max-microamp to the common bindings so we can set an attribute for the max microamp in torch mode. - Add flash-max-microamp and torch-max-microamp as optional to the LED node. - Slot in some elabortative descriptions of the new properties and describe what the hardware is doing. - Cc phone-devel@vger.kernel.org ChangeLog v2->v3: - Add Sakari to CC - Resend ChangeLog v1->v2: - Explicitly inherit function, color and flash-max-timeout-us from common.yaml - Add "led" node as required. --- .../bindings/leds/richtek,rt8515.yaml | 111 ++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/richtek,rt8515.yaml -- 2.29.2 diff --git a/Documentation/devicetree/bindings/leds/richtek,rt8515.yaml b/Documentation/devicetree/bindings/leds/richtek,rt8515.yaml new file mode 100644 index 000000000000..68c328eec03b --- /dev/null +++ b/Documentation/devicetree/bindings/leds/richtek,rt8515.yaml @@ -0,0 +1,111 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/leds/richtek,rt8515.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Richtek RT8515 1.5A dual channel LED driver + +maintainers: + - Linus Walleij + +description: | + The Richtek RT8515 is a dual channel (two mode) LED driver that + supports driving a white LED in flash or torch mode. The maximum + current for each mode is defined in hardware using two resistors + RFS and RTS. + +properties: + compatible: + const: richtek,rt8515 + + enf-gpios: + maxItems: 1 + description: A connection to the 'ENF' (enable flash) pin. + + ent-gpios: + maxItems: 1 + description: A connection to the 'ENT' (enable torch) pin. + + richtek,rfs-ohms: + minimum: 7680 + maximum: 367000 + description: The resistance value of the RFS resistor. This + resistors limits the maximum flash current. This must be set + for the property flash-max-microamp to work, the RFS resistor + defines the range of the dimmer setting (brightness) of the + flash LED. + + richtek,rts-ohms: + minimum: 7680 + maximum: 367000 + description: The resistance value of the RTS resistor. This + resistors limits the maximum torch current. This must be set + for the property torch-max-microamp to work, the RTS resistor + defines the range of the dimmer setting (brightness) of the + torch LED. + + led: + type: object + $ref: common.yaml# + properties: + function: true + color: true + flash-max-timeout-us: true + + flash-max-microamp: + maximum: 700000 + description: The maximum current for flash mode + is hardwired to the component using the RFS resistor to + ground. The maximum hardware current setting is calculated + according to the formula Imax = 5500 / RFS. The lowest + allowed resistance value is 7.86 kOhm giving an absolute + maximum current of 700mA. By setting this attribute in + the device tree, you can further restrict the maximum + current below the hardware limit. This requires the RFS + to be defined as it defines the maximum range. + + led-max-microamp: + maximum: 700000 + description: The maximum current for torch mode + is hardwired to the component using the RTS resistor to + ground. The maximum hardware current setting is calculated + according to the formula Imax = 5500 / RTS. The lowest + allowed resistance value is 7.86 kOhm giving an absolute + maximum current of 700mA. By setting this attribute in + the device tree, you can further restrict the maximum + current below the hardware limit. This requires the RTS + to be defined as it defines the maximum range. + + additionalProperties: false + +required: + - compatible + - ent-gpios + - enf-gpios + - led + +additionalProperties: false + +examples: + - | + #include + #include + + led-controller { + compatible = "richtek,rt8515"; + enf-gpios = <&gpio4 12 GPIO_ACTIVE_HIGH>; + ent-gpios = <&gpio4 13 GPIO_ACTIVE_HIGH>; + richtek,rfs-ohms = <16000>; + richtek,rts-ohms = <100000>; + + led { + function = LED_FUNCTION_FLASH; + color = ; + flash-max-timeout-us = <250000>; + flash-max-microamp = <150000>; + led-max-microamp = <25000>; + }; + }; + +...