Message ID | 20230320175131.174657-1-linmengbo0689@protonmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp1433891wrt; Mon, 20 Mar 2023 13:59:25 -0700 (PDT) X-Google-Smtp-Source: AK7set+HB0Ln1a3v8Nc4LbL9rF4qW2yQV+HrTdUekMZCnfgRBOT9vKBpI2WC8cDu2i3pQRvUFx+H X-Received: by 2002:a05:6a20:8b8a:b0:d8:e8aa:f323 with SMTP id m10-20020a056a208b8a00b000d8e8aaf323mr8673370pzh.44.1679345965129; Mon, 20 Mar 2023 13:59:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679345965; cv=none; d=google.com; s=arc-20160816; b=NrZBcvV0QoMJj811B1nwztjqiEQqklv3GcretL9cg74QNBySxO+Wn+9SUfp0ZMQrFv N7GeaPrbmWmNDm1drXsDLzqVrQtlDjeAK7Xrf87uyi6bUatKGIUqn4itXU/fochHWPF+ NdR72ywrj7BLsEVhzieXfhI7Gy6Z7KVf9iGc+O5dQ3xIGh7YR+q+rK/b/5tMrhax5D5M H9geEmg7XsAE0lEX7pJO3HV1V3wSiySwLYsSkE5Oswo7ZzgbTLqT7eYRbUWMsIxbHQwf qrTa42XsuNxUWTJ/W3VbTlSq0xzh3AF+uOMw/KeXw/IyalwBPa5GeupN+pacPqH3u+YG /r7g== 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 :feedback-id:references:in-reply-to:message-id:subject:cc:from:to :dkim-signature:date; bh=FAkqOD8kiqkTEaAEfEctBYZB4b4Y94ELoYgOe0EWWpk=; b=xgUE2RV1SsSpgUTwFk7z5IoMzyG2gbidRjP6P1iaxAmdA2MgDIKqr2GVhZgfgu8Jta fQ9H6Xpx6gaJS56mKEjRNb0JJ67DaKOOMHluV+pZbI5We+c3LLVkEt9ocSzDberNzjzt rJ0bmdIwAWmegFIQE/qRMwj1IYZyVRYq5jH/U+fh+GzoPIPQIdVwT4gm50RODS1Yv8X2 OHe2Y8OjYWZb16DZ1DfR8vrkfV8D7V4yfNXiBbyJ8JbFGD7NrIh6D5UglgjNpobhsIy9 Tqbwm6drhIUbXaWjutfsKGFVesnegeq5CJb5MtECh7SAzsFf4//flbp31bzNECs1G86C x94A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@protonmail.com header.s=protonmail3 header.b=ZMhAHgPg; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n127-20020a632785000000b00502f457059dsi11840119pgn.330.2023.03.20.13.59.12; Mon, 20 Mar 2023 13:59:25 -0700 (PDT) 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=@protonmail.com header.s=protonmail3 header.b=ZMhAHgPg; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229677AbjCTU4K (ORCPT <rfc822;pusanteemu@gmail.com> + 99 others); Mon, 20 Mar 2023 16:56:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229583AbjCTU4I (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 20 Mar 2023 16:56:08 -0400 X-Greylist: delayed 4199 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 20 Mar 2023 13:56:00 PDT Received: from mail-41104.protonmail.ch (mail-41104.protonmail.ch [185.70.41.104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E515DA3; Mon, 20 Mar 2023 13:55:59 -0700 (PDT) Date: Mon, 20 Mar 2023 17:55:21 +0000 Authentication-Results: mail-41104.protonmail.ch; dkim=pass (2048-bit key) header.d=protonmail.com header.i=@protonmail.com header.b="ZMhAHgPg" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1679334933; x=1679594133; bh=FAkqOD8kiqkTEaAEfEctBYZB4b4Y94ELoYgOe0EWWpk=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=ZMhAHgPg6OUDCGsoHzTQSoirpDB1jUXVGQCPGqI8sxUuA4OBl8bdZ/YxSxXofUTF4 dHBuRkWVrF1MbyOggw/Qx2i7/IZHBkxZ01EkOTinpD2jUp8Mf85eiRk9bHJnRt2loF ZoiOARjYnSd2A+Abk0wVkuwjEXtVTYAf4tf/AfP6hTcdcQMaZIsxWNwrgimNeGLO92 gdDDg0i/W/vZUcc61XgjatznxWorG2NNFH3L9msrdfaTlVPetnEIE5NeJfYY4G5m+Y uUMlqnaOjUz3n3FKsndqNq3G/f71uQ/zfxoxlS57W6kOiBBQ6mHZNksr08M4fUgDin JLVtV5Tl854/w== To: linux-kernel@vger.kernel.org From: "Lin, Meng-Bo" <linmengbo0689@protonmail.com> Cc: Pavel Machek <pavel@ucw.cz>, Lee Jones <lee@kernel.org>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Nikita Travkin <nikita@trvn.ru>, Stephan Gerhold <stephan@gerhold.net>, linux-leds@vger.kernel.org, devicetree@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht Subject: [PATCH v2 1/2] dt-bindings: leds: aw2013: Document vddio-supply Message-ID: <20230320175131.174657-1-linmengbo0689@protonmail.com> In-Reply-To: <20230320174949.174600-1-linmengbo0689@protonmail.com> References: <20230320174949.174600-1-linmengbo0689@protonmail.com> Feedback-ID: 40467236:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00,DATE_IN_PAST_03_06, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,SPF_HELO_PASS,SPF_PASS autolearn=no 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760912899224869426?= X-GMAIL-MSGID: =?utf-8?q?1760921874838046725?= |
Series |
leds: aw2013: Add vddio regulator
|
|
Commit Message
Lin, Meng-Bo
March 20, 2023, 5:55 p.m. UTC
Some LEDs controllers are used with external pull-up for the interrupt
line and the I2C lines, so we might need to enable a regulator to bring
the lines into usable state. Otherwise, this might cause spurious
interrupts and reading from I2C will fail.
Document support for "vddio-supply" that is enabled by the aw2013 driver
so that the regulator gets enabled when needed.
Signed-off-by: Lin, Meng-Bo <linmengbo0689@protonmail.com>
---
Documentation/devicetree/bindings/leds/leds-aw2013.yaml | 5 +++++
1 file changed, 5 insertions(+)
Comments
On 20/03/2023 19:59, Stephan Gerhold wrote: > On Mon, Mar 20, 2023 at 07:04:22PM +0100, Krzysztof Kozlowski wrote: >> On 20/03/2023 18:55, Lin, Meng-Bo wrote: >>> Some LEDs controllers are used with external pull-up for the interrupt >>> line and the I2C lines, so we might need to enable a regulator to bring >>> the lines into usable state. >> >> Not a property of this device. >> >>> Otherwise, this might cause spurious >>> interrupts and reading from I2C will fail. >>> >>> Document support for "vddio-supply" that is enabled by the aw2013 driver >>> so that the regulator gets enabled when needed. >>> >>> Signed-off-by: Lin, Meng-Bo <linmengbo0689@protonmail.com> >>> --- >>> Documentation/devicetree/bindings/leds/leds-aw2013.yaml | 5 +++++ >>> 1 file changed, 5 insertions(+) >>> >>> diff --git a/Documentation/devicetree/bindings/leds/leds-aw2013.yaml b/Documentation/devicetree/bindings/leds/leds-aw2013.yaml >>> index 08f3e1cfc1b1..79b69cf1d1fe 100644 >>> --- a/Documentation/devicetree/bindings/leds/leds-aw2013.yaml >>> +++ b/Documentation/devicetree/bindings/leds/leds-aw2013.yaml >>> @@ -23,6 +23,11 @@ properties: >>> vcc-supply: >>> description: Regulator providing power to the "VCC" pin. >>> >>> + vddio-supply: >>> + description: | >>> + Optional regulator that provides digital I/O voltage, >> >> NAK. I responded to your patch and you just send a v2 without explanation. >> >> The device does not have VDDIO pin, either. >> > > The power supply Lin is trying to add here is basically the "VIO1" > example in "Figure 1 AW2013 Typical Application Circuit" on page 1 of > the AW2013 datasheet [1]. The I2C pins and the interrupt output are both > open-drain and therefore require external pull-up resistors, connected > to a power supply that might not be always on. > > Because of the open-drain pins AW2013 does indeed not have a dedicated > input pin for the I/O supply voltage. However, it is still necessary to > describe the power supply _somewhere_, to ensure that it is enabled when > needed. > > It is hard to model this properly but it's generally easiest to handle > this inside the peripheral driver since it knows exactly when I2C and/or > interrupt lines are currently needed or not. This situation is fairly > common for I2C devices so there are several precedents, e.g.: > > 1. cypress,tm2-touchkey.yaml: "vddio-supply" > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3e730ec11d51283ad62a98436967c01b718132ab > 2. goodix,gt7375p.yaml: "mainboard-vddio-supply" > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1d18c1f3b7d938bdefc44289d137b4e6c7a3d502 Both are mistaken. How can you enumerate or autodetect a device if its regulator pulling up I2C are not on? What's more, on I2C lines you could have more devices, so you expect each of them having the supply? These are properties of I2C controller, not the consumer. I2C controller should enable any regulators necessary for the IO pins. Best regards, Krzysztof
On Tue, Mar 21, 2023 at 07:42:37AM +0100, Krzysztof Kozlowski wrote: > On 20/03/2023 19:59, Stephan Gerhold wrote: > > On Mon, Mar 20, 2023 at 07:04:22PM +0100, Krzysztof Kozlowski wrote: > >> On 20/03/2023 18:55, Lin, Meng-Bo wrote: > >>> Some LEDs controllers are used with external pull-up for the interrupt > >>> line and the I2C lines, so we might need to enable a regulator to bring > >>> the lines into usable state. > >> > >> Not a property of this device. > >> > >>> Otherwise, this might cause spurious > >>> interrupts and reading from I2C will fail. > >>> > >>> Document support for "vddio-supply" that is enabled by the aw2013 driver > >>> so that the regulator gets enabled when needed. > >>> > >>> Signed-off-by: Lin, Meng-Bo <linmengbo0689@protonmail.com> > >>> --- > >>> Documentation/devicetree/bindings/leds/leds-aw2013.yaml | 5 +++++ > >>> 1 file changed, 5 insertions(+) > >>> > >>> diff --git a/Documentation/devicetree/bindings/leds/leds-aw2013.yaml b/Documentation/devicetree/bindings/leds/leds-aw2013.yaml > >>> index 08f3e1cfc1b1..79b69cf1d1fe 100644 > >>> --- a/Documentation/devicetree/bindings/leds/leds-aw2013.yaml > >>> +++ b/Documentation/devicetree/bindings/leds/leds-aw2013.yaml > >>> @@ -23,6 +23,11 @@ properties: > >>> vcc-supply: > >>> description: Regulator providing power to the "VCC" pin. > >>> > >>> + vddio-supply: > >>> + description: | > >>> + Optional regulator that provides digital I/O voltage, > >> > >> NAK. I responded to your patch and you just send a v2 without explanation. > >> > >> The device does not have VDDIO pin, either. > >> > > > > The power supply Lin is trying to add here is basically the "VIO1" > > example in "Figure 1 AW2013 Typical Application Circuit" on page 1 of > > the AW2013 datasheet [1]. The I2C pins and the interrupt output are both > > open-drain and therefore require external pull-up resistors, connected > > to a power supply that might not be always on. > > > > Because of the open-drain pins AW2013 does indeed not have a dedicated > > input pin for the I/O supply voltage. However, it is still necessary to > > describe the power supply _somewhere_, to ensure that it is enabled when > > needed. > > > > It is hard to model this properly but it's generally easiest to handle > > this inside the peripheral driver since it knows exactly when I2C and/or > > interrupt lines are currently needed or not. This situation is fairly > > common for I2C devices so there are several precedents, e.g.: > > > > 1. cypress,tm2-touchkey.yaml: "vddio-supply" > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3e730ec11d51283ad62a98436967c01b718132ab > > 2. goodix,gt7375p.yaml: "mainboard-vddio-supply" > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1d18c1f3b7d938bdefc44289d137b4e6c7a3d502 > > Both are mistaken. How can you enumerate or autodetect a device if its > regulator pulling up I2C are not on? You don't. By design I2C does not support enumeration or autodetection. Nothing we implement in software can change that. I2C devices have all sorts of requirements before they show up on the bus at all (power supplies, enable GPIOs, clocks, ...). All these are currently modelled as part of the consumer IC. > What's more, on I2C lines you could have more devices, so you expect > each of them having the supply? Yes, I don't think this is a problem since it's typical for regulators to be shared. If at least one of the I2C devices is active, the bus will be active as well. > These are properties of I2C controller, not the consumer. I2C controller > should enable any regulators necessary for the IO pins. In general I agree with you here. But as I mentioned already there is usually more than just the I2C I/O lines. For AW2013 there is at least also the open-drain interrupt line. On other ICs there could also be arbitrary GPIO lines that are used in open-drain mode. Those are completely unrelated to the I2C controller. Do you have any suggestions how to handle the power supply for those? IMO for interrupts lines the pull-up I/O supply is hardly a property of the interrupt controller. It just cares that a line switches from high to low. It's not exactly a property of the consumer IC either. However, since operating the interrupt line in open-drain mode is part of the consumer IC specification I would say that the I/O supply for interrupt lines is better described on the consumer side. For sake of completeness we could additionally describe the supply for the I2C lines on the I2C controller, but then we still need this patch or something else for the interrupt lines. Thanks, Stephan
On Tue, Mar 21, 2023 at 09:21:36PM +0100, Stephan Gerhold wrote: > On Tue, Mar 21, 2023 at 07:42:37AM +0100, Krzysztof Kozlowski wrote: > > On 20/03/2023 19:59, Stephan Gerhold wrote: > > > On Mon, Mar 20, 2023 at 07:04:22PM +0100, Krzysztof Kozlowski wrote: > > >> On 20/03/2023 18:55, Lin, Meng-Bo wrote: > > >>> Some LEDs controllers are used with external pull-up for the interrupt > > >>> line and the I2C lines, so we might need to enable a regulator to bring > > >>> the lines into usable state. > > >> > > >> Not a property of this device. > > >> > > >>> Otherwise, this might cause spurious > > >>> interrupts and reading from I2C will fail. > > >>> > > >>> Document support for "vddio-supply" that is enabled by the aw2013 driver > > >>> so that the regulator gets enabled when needed. > > >>> > > >>> Signed-off-by: Lin, Meng-Bo <linmengbo0689@protonmail.com> > > >>> --- > > >>> Documentation/devicetree/bindings/leds/leds-aw2013.yaml | 5 +++++ > > >>> 1 file changed, 5 insertions(+) > > >>> > > >>> diff --git a/Documentation/devicetree/bindings/leds/leds-aw2013.yaml b/Documentation/devicetree/bindings/leds/leds-aw2013.yaml > > >>> index 08f3e1cfc1b1..79b69cf1d1fe 100644 > > >>> --- a/Documentation/devicetree/bindings/leds/leds-aw2013.yaml > > >>> +++ b/Documentation/devicetree/bindings/leds/leds-aw2013.yaml > > >>> @@ -23,6 +23,11 @@ properties: > > >>> vcc-supply: > > >>> description: Regulator providing power to the "VCC" pin. > > >>> > > >>> + vddio-supply: > > >>> + description: | > > >>> + Optional regulator that provides digital I/O voltage, > > >> > > >> NAK. I responded to your patch and you just send a v2 without explanation. > > >> > > >> The device does not have VDDIO pin, either. > > >> > > > > > > The power supply Lin is trying to add here is basically the "VIO1" > > > example in "Figure 1 AW2013 Typical Application Circuit" on page 1 of > > > the AW2013 datasheet [1]. The I2C pins and the interrupt output are both > > > open-drain and therefore require external pull-up resistors, connected > > > to a power supply that might not be always on. > > > > > > Because of the open-drain pins AW2013 does indeed not have a dedicated > > > input pin for the I/O supply voltage. However, it is still necessary to > > > describe the power supply _somewhere_, to ensure that it is enabled when > > > needed. > > > > > > It is hard to model this properly but it's generally easiest to handle > > > this inside the peripheral driver since it knows exactly when I2C and/or > > > interrupt lines are currently needed or not. This situation is fairly > > > common for I2C devices so there are several precedents, e.g.: > > > > > > 1. cypress,tm2-touchkey.yaml: "vddio-supply" > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3e730ec11d51283ad62a98436967c01b718132ab > > > 2. goodix,gt7375p.yaml: "mainboard-vddio-supply" > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1d18c1f3b7d938bdefc44289d137b4e6c7a3d502 > > > > Both are mistaken. How can you enumerate or autodetect a device if its > > regulator pulling up I2C are not on? > > You don't. By design I2C does not support enumeration or autodetection. > Nothing we implement in software can change that. > > I2C devices have all sorts of requirements before they show up on the > bus at all (power supplies, enable GPIOs, clocks, ...). All these are > currently modelled as part of the consumer IC. > > > What's more, on I2C lines you could have more devices, so you expect > > each of them having the supply? > > Yes, I don't think this is a problem since it's typical for regulators > to be shared. If at least one of the I2C devices is active, the bus will > be active as well. > > > These are properties of I2C controller, not the consumer. I2C controller > > should enable any regulators necessary for the IO pins. > > In general I agree with you here. But as I mentioned already there is > usually more than just the I2C I/O lines. For AW2013 there is at least > also the open-drain interrupt line. On other ICs there could also be > arbitrary GPIO lines that are used in open-drain mode. Those are > completely unrelated to the I2C controller. > > Do you have any suggestions how to handle the power supply for those? > > IMO for interrupts lines the pull-up I/O supply is hardly a property of > the interrupt controller. It just cares that a line switches from high > to low. It's not exactly a property of the consumer IC either. However, > since operating the interrupt line in open-drain mode is part of the > consumer IC specification I would say that the I/O supply for interrupt > lines is better described on the consumer side. > > For sake of completeness we could additionally describe the supply for > the I2C lines on the I2C controller, but then we still need this patch > or something else for the interrupt lines. I think a supply on the device side is fine here. Just be clear in the description about its purpose. We have much worse abuses than this (random bus clocks added to SoC devices). Rob
diff --git a/Documentation/devicetree/bindings/leds/leds-aw2013.yaml b/Documentation/devicetree/bindings/leds/leds-aw2013.yaml index 08f3e1cfc1b1..79b69cf1d1fe 100644 --- a/Documentation/devicetree/bindings/leds/leds-aw2013.yaml +++ b/Documentation/devicetree/bindings/leds/leds-aw2013.yaml @@ -23,6 +23,11 @@ properties: vcc-supply: description: Regulator providing power to the "VCC" pin. + vddio-supply: + description: | + Optional regulator that provides digital I/O voltage, + e.g. for pulling up the interrupt line or the I2C pins. + "#address-cells": const: 1