Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp632959rwd; Wed, 31 May 2023 03:17:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7prOJG55GG44pkJdSLmUILjzVI73DcIEsP68b5hEd8YxCuxO8RcaNfbl2Cml9lYCDjFP1+ X-Received: by 2002:a17:902:cec7:b0:1b0:56cf:b8c0 with SMTP id d7-20020a170902cec700b001b056cfb8c0mr5694729plg.13.1685528251575; Wed, 31 May 2023 03:17:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685528251; cv=none; d=google.com; s=arc-20160816; b=NgtqgiAb5R8BQRmVU7UPX4L2UsKne4W8Qf21NgPvyeJLQ1UL6IZtDK3VwxVwYqKUji 8tZAWyuy8Pgj6hKYVe8Htt+IGWXFkO9o6Im6S8oaSBYasrPieRVxv8a6laqGBJ/tS3VW Dy/F+hDiIUK2rcZMhKbez03gi88njnJRh6G2RywXHid7QDOXEk4oZVHLyatJUld+1S7B qXymcC2t3pSvL+4tUgkS5KoHtAQ3R9Yuo7oBTjfRloZCzy1a4aqwAZsz9JHbdNTnJW92 O+p5lHKY5Gc57yHcqoylZ3koaSTycCjLv3Ewsg8uYtG4BQf3LhnjWAUhNfZ1itfXv/bc JOYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=3PItSMAxY+WRa/kZ+O6RQnnZyDdtZMHuSiRR/BgNKkM=; b=srJF/hpnSwr4v3BjchzMSbFECZDOmDL13N1tp7JZgiN3nlWlWD/nq4hwEiH+1orssS Wb3F2NY8q3yTY+jyHvf1w2R57pEGks3oFczriUI2gH4e3hyvixrGJZ1Ik44iLRWT/+p+ d8hSID1IkDEGHjqZMlRkrrMuh4u+qcvcADR1JX7sz3x+ZXx2/NY0wFvbvGilSwnvLnmV MTvHB83lk+6GooKHLshwbR6b9TClpXVu1FLcDQx1vh6T63/h/ZBZ5zToH2TpFWSJLpmQ IuAm/2M8eH2ZtfwGlKhjqqaF6Uw6wUVkZOaskr6pUtyAs84pAVWIVCAEHaeHWb9MpO14 pIHg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j3-20020a170903028300b001b178baf356si713041plr.95.2023.05.31.03.17.19; Wed, 31 May 2023 03:17:31 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235551AbjEaJgh (ORCPT + 99 others); Wed, 31 May 2023 05:36:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230236AbjEaJgf (ORCPT ); Wed, 31 May 2023 05:36:35 -0400 Received: from mg.richtek.com (mg.richtek.com [220.130.44.152]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CBA83C0; Wed, 31 May 2023 02:36:32 -0700 (PDT) X-MailGates: (flag:4,DYNAMIC,BADHELO,RELAY,NOHOST:PASS)(compute_score:DE LIVER,40,3) Received: from 192.168.10.46 by mg.richtek.com with MailGates ESMTP Server V5.0(761:0:AUTH_RELAY) (envelope-from ); Wed, 31 May 2023 17:36:19 +0800 (CST) Received: from ex3.rt.l (192.168.10.46) by ex3.rt.l (192.168.10.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.25; Wed, 31 May 2023 17:36:18 +0800 Received: from linuxcarl2.richtek.com (192.168.10.154) by ex3.rt.l (192.168.10.45) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Wed, 31 May 2023 17:36:18 +0800 Date: Wed, 31 May 2023 17:36:18 +0800 From: ChiYuan Huang To: Krzysztof Kozlowski CC: , , , , , , , Subject: Re: [PATCH] dt-bindings: power: supply: Fix rt9467 charger enable gpio active level Message-ID: <20230531093618.GA17005@linuxcarl2.richtek.com> References: <1685522813-14481-1-git-send-email-cy_huang@richtek.com> <1f966e93-50c3-142e-620c-8fbb16e9b1a7@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1f966e93-50c3-142e-620c-8fbb16e9b1a7@linaro.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On Wed, May 31, 2023 at 11:17:37AM +0200, Krzysztof Kozlowski wrote: > On 31/05/2023 10:46, cy_huang@richtek.com wrote: > > From: ChiYuan Huang > > > > The RT9467 charger enable pin is an external signal that used to enable > > battery charging. From the datasheet, the active level is low. Although > > it's already configured to logic low at driver probe function, but the > > NAK. > > You mix two different things. Driver behavior and DTS. Driver can > operate either on real level - matching hardware - or on logical level > (high as enable, low as disable). First choice is usually wrong, because > it does not allow inverted signals. > > 'Correcting' bindings to wrong approach is wrong. If the signal is > active low, then the flag is active low. Simple as that. > If my understanding is right, so the correct way is to fix the driver code, not binding exmaple. > > current binding example declared it as 'GPIO_ACTIVE_LOW', this causes > > this pin be output high and disable battery charging. > > > > Fixes: e1b4620fb503 ("dt-bindings: power: supply: Add Richtek RT9467 battery charger") > > Signed-off-by: ChiYuan Huang > > --- > > Hi, > > > > This patch is to fix the active level for charger enable gpio polarity. > > This is just example - it does not fix anything... > Sorry, this issue comes from the customer. They directly copy the example into their platform dts. That's why originally I think it may be a fix. Anyway, you're right. To maintain the maximum flexibility, the choice shouldn't be to fix the example. It has to correct the driver code for this pin behavior. Thanks. > > Currently, the wrong active level makes the user confused and > > unexpectedly disable battery charging by default. > > --- > > Documentation/devicetree/bindings/power/supply/richtek,rt9467.yaml | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/Documentation/devicetree/bindings/power/supply/richtek,rt9467.yaml b/Documentation/devicetree/bindings/power/supply/richtek,rt9467.yaml > > index 3723717..cdc7678 100644 > > --- a/Documentation/devicetree/bindings/power/supply/richtek,rt9467.yaml > > +++ b/Documentation/devicetree/bindings/power/supply/richtek,rt9467.yaml > > @@ -69,7 +69,7 @@ examples: > > reg = <0x5b>; > > wakeup-source; > > interrupts-extended = <&gpio_intc 32 IRQ_TYPE_LEVEL_LOW>; > > - charge-enable-gpios = <&gpio26 1 GPIO_ACTIVE_LOW>; > > + charge-enable-gpios = <&gpio26 1 GPIO_ACTIVE_HIGH>; > > > > rt9467_otg_vbus: usb-otg-vbus-regulator { > > regulator-name = "rt9467-usb-otg-vbus"; > > Best regards, > Krzysztof >