linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: ChiYuan Huang <u0084500@gmail.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: "Rob Herring" <robh+dt@kernel.org>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
	"Sebastian Reichel" <sre@kernel.org>, 游子馨 <alina_yu@richtek.com>,
	cy_huang <cy_huang@richtek.com>,
	alinayu829@gmail.com, "Linux PM" <linux-pm@vger.kernel.org>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
	<devicetree@vger.kernel.org>, lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] dt-bindings: power: supply: Add Richtek RT9471 battery charger
Date: Fri, 12 Aug 2022 23:57:56 +0800	[thread overview]
Message-ID: <CADiBU38+9sR1r20=YWt-9s2+u7maHH+1VudCnV1-0+F4jYKdQQ@mail.gmail.com> (raw)
In-Reply-To: <40261b95-637a-1304-2e06-8c8ff7fc377b@linaro.org>

Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> 於 2022年8月12日 週五 下午2:54寫道:
>
> On 12/08/2022 04:32, ChiYuan Huang wrote:
> > Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> 於 2022年8月11日 週四 晚上10:12寫道:
> >>
> >> On 11/08/2022 16:41, cy_huang wrote:
> >>> From: ChiYuan Huang <cy_huang@richtek.com>
> >>>
> >>> Add bindings for the Richtek RT9471 I2C controlled battery charger.
> >>>
> >>
> >> Thank you for your patch. There is something to discuss/improve.
> >>
> >>> +properties:
> >>> +  compatible:
> >>> +    const: richtek,rt9471
> >>> +
> >>> +  reg:
> >>> +    maxItems: 1
> >>> +
> >>> +  ceb-gpios:
> >>> +    maxItems: 1
> >>
> >> This looks not standard, so please provide a description.
> > It's the external 'charge enable' pin that's used to control battery charging.
> > The priority is higher than the register 'CHG_EN' control.
> > In the word, 'b' means it's reverse logic, low to allow charging, high
> > to force disable charging.
>
> Isn't this standard enable-gpios property?
Not the same thing, this charger includes power patch control.
This gpio is used to 'force disable' charge the battery.
>
> >
> > description:
> >   External charge enable pin that can force control not to charge the battery.
> >   Low to allow charging, high to disable charging.
> >
> >>
> >>> +
> >>> +  wakeup-source: true
> >>> +
> >>> +  interrupts:
> >>> +    maxItems: 1
> >>> +
> >>> +  interrupt-controller: true
> >>> +
> >>> +  "#interrupt-cells":
> >>> +    const: 1
> >>
> >> Why a charger driver is a interrupt-controller?
> > There're 32 nested IRQs from RT9471.
> > The original thought is to make the user easy to bind the interrupt
> > into their driver.
>
> Bindings are not related to the driver but to hardware...
>
Sorry, I mislead  your comment.
Refer to bq2515x.yaml, I think it's better to change this property to
'charge-enable-gpios'.
It's the same usage like as TI charger.
> >
> > For charger driver, does it mean legacy IRQ handler is more preferred?
>
> Who is the consumer of these interrupts? Can you show the DTS with the
> interrupt consumer?
>
> >>
> >>> +
> >>> +  usb-otg-vbus-regulator:
> >>> +    type: object
> >>> +    unevaluatedProperties: false
> >>> +    $ref: /schemas/regulator/regulator.yaml#
> >>> +
> >>> +required:
> >>> +  - compatible
> >>> +  - reg
> >>> +  - wakeup-source
> >>> +  - interrupts
> >>> +  - interrupt-controller
> >>> +  - "#interrupt-cells"
> >>> +
> >>> +additionalProperties: false
> >>> +
> >>> +examples:
> >>> +  - |
> >>> +    #include <dt-bindings/interrupt-controller/irq.h>
> >>> +    i2c {
> >>> +      #address-cells = <1>;
> >>> +      #size-cells = <0>;
> >>> +
> >>> +      charger@53 {
> >>> +        compatible = "richtek,rt9471";
> >>> +        reg = <0x53>;
> >>> +        ceb-gpios = <&gpio26 1 0>;
> >>
> >> Isn't the last value a GPIO flag? If yes, use appropriate define.
> > I already specify GPIOD_OUT_LOW in the gpiod_request flag.
>
> It is not related to the DTS. Anyway writing "low" for a meaning of high
> is not correct usually...
>
> > Do I need to convert the gpio request code to GPIOD_OUT_HIGH,
> > and specify here as GPIO_ACTIVE_LOW?
>
> You need to properly describe the hardware. The polarity of logical
> signal is defined by DTS, not by driver. It does not make sense to do it
> in driver. What if on some board the signal is inverted?
>
From our discussion, binding example just keep the active level that the pin is.
So 'GPIO_ACTIVE_LOW', thanks.

All of the above will be fixed in the next revision.

> Best regards,
> Krzysztof

  reply	other threads:[~2022-08-12 15:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-11 13:41 [PATCH 0/2] Add Richtek RT9471 3A battery charger support cy_huang
2022-08-11 13:41 ` [PATCH 1/2] dt-bindings: power: supply: Add Richtek RT9471 battery charger cy_huang
2022-08-11 14:12   ` Krzysztof Kozlowski
2022-08-12  1:32     ` ChiYuan Huang
2022-08-12  6:54       ` Krzysztof Kozlowski
2022-08-12 15:57         ` ChiYuan Huang [this message]
2022-08-12 16:05           ` ChiYuan Huang
2022-08-12 18:53             ` Krzysztof Kozlowski
2022-08-13 14:52               ` ChiYuan Huang
2022-08-16  7:27                 ` Krzysztof Kozlowski
2022-08-12 15:13   ` Rob Herring
2022-08-12 16:07     ` ChiYuan Huang
2022-08-11 13:41 ` [PATCH 2/2] power: supply: rt9471: Add Richtek RT9471 charger driver cy_huang
2022-08-15  5:53   ` Matti Vaittinen
2022-08-15  6:10     ` ChiYuan Huang
2022-08-15  7:24       ` Matti Vaittinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADiBU38+9sR1r20=YWt-9s2+u7maHH+1VudCnV1-0+F4jYKdQQ@mail.gmail.com' \
    --to=u0084500@gmail.com \
    --cc=alina_yu@richtek.com \
    --cc=alinayu829@gmail.com \
    --cc=cy_huang@richtek.com \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=sre@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).