From patchwork Thu Nov 12 11:56:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 324175 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:5ce:0:0:0:0 with SMTP id l14csp269491ils; Thu, 12 Nov 2020 03:57:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJzafoL+MRFMLtRXrjaTnvVu/Fj+FN3I64smGGKTqxgvFPI0AqmpGojTAcfg8uvQWHouvljz X-Received: by 2002:a05:6402:370:: with SMTP id s16mr4548532edw.50.1605182242652; Thu, 12 Nov 2020 03:57:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605182242; cv=none; d=google.com; s=arc-20160816; b=RY7unat6ppUTxrHcIxK3PxRavp2BUDAbIB24yCn2tx11dV1qgb45/lQHFJe1wtYw6U umx5gy9f4BJAlmSgGd/mcJmn7BgRJZGs//zKfB8e0ZryqzD+M32eAlRZkCbcBcdUckh0 c9H/cEE5yBEbCgNM5vT5snUOtIKZp//lnGMAiQ5ieyatrbZTpeDS9e+lqX0kzE5imCKN Iwz4jFihLFA0+5l9fzF3m2MiQsnO7W+ZqUMhmSsVNUnByXuoodzxEMJn2vAqmMfG/OpA Fr+UEOhRkjp7PI+yI5bzYZPMOSfCeFlgv/yJvSLPI013P9cNNcr9d7boj5kaReZjY6ck iYgQ== 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=2QnFX94ue+MfUcZEh811vnO774W9JyKEs6qXHdD7T6s=; b=YQ/x2jRsC9C+ytny0/gXNG5YWCHNif3/7y9UgLhdzRtYY1YEzHo3VFIg2GEx2tXJwj 9XOQos6iM7DlLUPWo+EuufgyYu5GcgNhT0hfI93qknht0DwYCXTbKtSoDSNemAg+bKhD 3Ien8QGZj3F+1B5e/ZZnSNQZpzGKip6CEjQilvzQV4EOsyfJz22TBlhkb/6x8GTLECnR ekv2jrV3iu6VZszhsecbUKfYCxkv+1GJd2unlIs8o6Fm1LHOJ1Yf5ixDS7z6XGWJndzJ MIVThaW74fj9IpsQC9VCcWl8mtaDcxwbt0SCEaAtZ1OGNdw2gGssTmToe1grELZnCGD3 c/SA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=S22X0xD4; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 m20si3359065ejc.60.2020.11.12.03.57.22; Thu, 12 Nov 2020 03:57:22 -0800 (PST) Received-SPF: pass (google.com: domain of devicetree-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=S22X0xD4; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 S1728207AbgKLL5S (ORCPT + 6 others); Thu, 12 Nov 2020 06:57:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728244AbgKLL4x (ORCPT ); Thu, 12 Nov 2020 06:56:53 -0500 Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B906AC0617A7 for ; Thu, 12 Nov 2020 03:56:52 -0800 (PST) Received: by mail-lf1-x143.google.com with SMTP id s30so7999446lfc.4 for ; Thu, 12 Nov 2020 03:56:52 -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=2QnFX94ue+MfUcZEh811vnO774W9JyKEs6qXHdD7T6s=; b=S22X0xD4Oq76x0B/GT0nueMl18VR4qJt2SNmPXKqeWc8UKg6kPL3fyGoaV2LWTK8jx dDTCl2gOYfvv8mwyyEaSvT5FAF20wj2en61DghZjYyglEM55lym3rOXo4DE3zwoLZfhu 7kSJuORfsKSYTRGrqEQmfksmos1wCENuuS1rF0Usn+DM0CACglczSL8Xt0eZ5Cavq3Ue 8R6JYFVqAAcpthrlwTWVXzo6SPGMEE3E2Uzns7hbHmmfotteVtbssTTq7dADQ9T+ChbO Pp2ZrzNOstE8jv5WZoF8/BBXM/343O21vdBgmPQFPHbg4WdP/q/XqdigwLPf8wXifRo7 ZXgQ== 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=2QnFX94ue+MfUcZEh811vnO774W9JyKEs6qXHdD7T6s=; b=hETkMDt0MHHvb+cs5lhhnCK5T3ZX2m+CS7p1rgEW5H1KGmHRWxJ6D6DMJ1prpp8XIE 7tikLT+orrxFLUMXr7rA/7GLGaoC1wfSc/1gS0udzbUUU48C3hYOatqzdpHrHvCKpIDI cIQ1BLXvB0S/6zxWNMDwtLs3HsEOj8c+aeLzoc3XlcZIaphIicwdO11Z72YIyE71lB0Q znQNrUVSQZO9VIur+xdTuuZ9oKLtAIQMSDNlBsExbtv2cIKPcLpEzoMQ3zIv0dVFa79A 5Ch50lbtsNW46ALQukDuhZATrOZDXF+GMtKZNzWARmHLHY8jklXlhhwh0OZ7UYe7Mtfg YBPQ== X-Gm-Message-State: AOAM5332KnDgx1udBxpN6n6MLOcWl2XtZQjQ55Gcdjf8ZqzXmi2lsQF9 4LfNaJo2esx7WFR4tCr6PkjnbQ== X-Received: by 2002:a19:be13:: with SMTP id o19mr8527924lff.445.1605182211115; Thu, 12 Nov 2020 03:56:51 -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 v4sm534624lfa.309.2020.11.12.03.56.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Nov 2020 03:56:50 -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 v4] dt-bindings: leds: Add DT binding for Richtek RT8515 Date: Thu, 12 Nov 2020 12:56:45 +0100 Message-Id: <20201112115646.2562467-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@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 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 | 111 ++++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/richtek,rt8515.yaml -- 2.26.2 diff --git a/Documentation/devicetree/bindings/leds/common.yaml b/Documentation/devicetree/bindings/leds/common.yaml index 08b6700ca61e..28bdf09b4af4 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..5f65a20b997d --- /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: + maxItems: 1 + minimum: 7680 + maximum: 367000 + description: The resistance value of the RFS resisitor. 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: + maxItems: 1 + minimum: 7680 + maximum: 367000 + description: The resistance value of the RTS resisitor. 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 = <16000>; + richtek,rts = <100000>; + + led { + function = LED_FUNCTION_FLASH; + color = ; + flash-max-timeout-us = <250000>; + flash-max-microamp = <150000>; + torch-max-microamp = <25000>; + }; + }; + +...