From patchwork Mon Nov 23 21:44:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 330688 Delivered-To: patch@linaro.org Received: by 2002:a17:907:2110:0:0:0:0 with SMTP id qn16csp3860031ejb; Mon, 23 Nov 2020 13:44:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJzsHBV45Wu+6DOnK3/miVNs9pyFqk0OXmF5g6yKSBhiHQOXRvvELPoc7b4WoU4rzbxmUTu6 X-Received: by 2002:aa7:c546:: with SMTP id s6mr1169359edr.114.1606167892676; Mon, 23 Nov 2020 13:44:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606167892; cv=none; d=google.com; s=arc-20160816; b=x/xf8iPLQyO8JoYIXMdBIQod7AaTcAn1BfJ1WjhGxIupdSKM5o8I2k/Sa3Qp6FmWLk nN3t8LruuARomViv885fbLbhIqeImu99FaqF89HeednqsXayW1lQYey0WeLE2Dk04PI/ XPArJKvqVn4S5kKN790kzi5o+XVcpas/8/C0kaPBN+k6KPHP8Dvi+dqCiowHIharwA3Y swCdjpQ15KScZu7c/J5L4kNP94TOI8JlviBBAbZ0gKGv+8dV+Yv5Cd+Bn1j2b/ILTW1k ikTq5J5wOOKjvJ2vXy6EiXdEWcAADGFCiJgjNG1NBYtE7s7113mhEmIOkcsGrK/HnwI6 gWvg== 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=/YxkbAEJoDzP9KLF30Xn81dZ8K8UjGAlhsR7RpyDfp4=; b=PETjPhPu3ai0p/nZAa2jkJISd5SylM6UsdkYMt4fCR6kY3U0VDIVJS/mmeQN8Cgopu 2G5RM2xCT/0mznKbBBJyRDEj1nWD33bgU23V33Z4hDB9fkPO2DctBZ/o63pdTeeydS9R 8DDl1ne5Ei4QpG2ylo5WoRDw7HAy1j4UsEzXM1yEphoE8FHIKU4uobrrAst81+5Am+Qe Ea9Eb6XOcQm/MF1uoL7gyJHW+fuKWKJWGP/QPSvh2m2ZuoI6GBRaf3a9nzjm1I+/byzs +LbuC9qY39wtKnj0VcaRG+hTMuVDjJr0e3hBqwrY2YjViel9DuSVUhxNpGrvnM+w4GaN Q/dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=v7A0H3RX; 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 be11si7076134edb.164.2020.11.23.13.44.52 for ; Mon, 23 Nov 2020 13:44:52 -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=v7A0H3RX; 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 S1730786AbgKWVow (ORCPT ); Mon, 23 Nov 2020 16:44:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730374AbgKWVov (ORCPT ); Mon, 23 Nov 2020 16:44:51 -0500 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52D40C061A4D for ; Mon, 23 Nov 2020 13:44:51 -0800 (PST) Received: by mail-lj1-x22c.google.com with SMTP id s9so19635212ljo.11 for ; Mon, 23 Nov 2020 13:44:51 -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=/YxkbAEJoDzP9KLF30Xn81dZ8K8UjGAlhsR7RpyDfp4=; b=v7A0H3RXtNZYr9EOXz4a+9Txd9mDTmUn0Nz0fBYinQdkwQKNtmz1OUA29Kxu7LEeav yhk1zGuY3AQ8R1aMBCiCB1eU4NoEMsrUEXJfJ64ShwRU4fzvt0rkLzjs+T2E1fte/2ei 3p7rB1R15gD1G4sTBkE5uT16EDO04351pPeQyspRQUoPcOfBSoSqEzEfZjCMmdmyZPGd an8lzLkposEDFz2o638PFOjZL2vNcw8X4Gsy1jHZBovW7qO9AxpJDNIASrmZE7JlHNFt Usww6CiOgpx8DZvwncgn+MfUT++X2twH3AjJUXNxSflKJ+Ywz5sAecLdnNEWuqO08CxO Wgzw== 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=/YxkbAEJoDzP9KLF30Xn81dZ8K8UjGAlhsR7RpyDfp4=; b=ojdb8e8OgZr1hOtbIhwEq/9hesR6rSYnBOteBkjKh2hHKI0TnOuADQlpUJcZ16hlP7 U7xoTqnwRz+4PgVQNXv8Ct/PdNJ5c5YT5zmEsgVWF1nQRqmxTzaZ+6swmFESSV8j7hOR sQ0bDnMe8ncWOel+PzItkmDwWHeuc4HQMFz342s7FquURGJDrQSz7w24Zm0oRalkxRsF BKQroNbh3q+3ctLFK/9N+WN6wIGzRdZwhNe3McQeZXiBdO9pn+KoPmZqEZgVj1dndd6y a/eQzTWvtqv6dqZcAnFxcPxdg3Zu3aDkIBhIZoiZ3Igy49dSKpoo3Rsup4dEI5RWIHub JGHg== X-Gm-Message-State: AOAM532TFu5sJlqKcXrIddOgt9KLYVPW2jALjKowx47KFUaeWoI3E3kM 6d2QX1vik35DmAeaei/WVmveOw== X-Received: by 2002:a05:651c:299:: with SMTP id b25mr598045ljo.16.1606167889784; Mon, 23 Nov 2020 13:44:49 -0800 (PST) Received: from localhost.bredbandsbolaget (c-92d7225c.014-348-6c756e10.bbcust.telenor.se. [92.34.215.146]) by smtp.gmail.com with ESMTPSA id 16sm1505036lfk.186.2020.11.23.13.44.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Nov 2020 13:44:49 -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 Subject: [PATCH 1/2 v6] dt-bindings: leds: Add DT binding for Richtek RT8515 Date: Mon, 23 Nov 2020 22:44:38 +0100 Message-Id: <20201123214439.1279464-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.26.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 Signed-off-by: Linus Walleij --- 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. --- .../devicetree/bindings/leds/common.yaml | 6 + .../bindings/leds/richtek,rt8515.yaml | 109 ++++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/richtek,rt8515.yaml -- 2.26.2 Reviewed-by: Sakari Ailus diff --git a/Documentation/devicetree/bindings/leds/common.yaml b/Documentation/devicetree/bindings/leds/common.yaml index f1211e7045f1..92fa90b4a671 100644 --- a/Documentation/devicetree/bindings/leds/common.yaml +++ b/Documentation/devicetree/bindings/leds/common.yaml @@ -151,6 +151,12 @@ properties: Maximum flash LED supply current in microamperes. Required for flash LED nodes with configurable current. + torch-max-microamp: + description: + Maximum flash LED supply current in microamperes, when the flash LED is + used as a torch (flashlight). This is usually lower than the flash mode + maximum current, if the LED supports torch mode. + flash-max-timeout-us: description: Maximum timeout in microseconds after which the flash LED is turned off. diff --git a/Documentation/devicetree/bindings/leds/richtek,rt8515.yaml b/Documentation/devicetree/bindings/leds/richtek,rt8515.yaml new file mode 100644 index 000000000000..b2022cb3ee1c --- /dev/null +++ b/Documentation/devicetree/bindings/leds/richtek,rt8515.yaml @@ -0,0 +1,109 @@ +# 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. + + torch-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. + +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>; + torch-max-microamp = <25000>; + }; + }; + +...