[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201225123300.07c84dd8.timon.baetz@protonmail.com>
Date: Fri, 25 Dec 2020 11:33:21 +0000
From: Timon Baetz <timon.baetz@...tonmail.com>
To: Krzysztof Kozlowski <krzk@...nel.org>
Cc: Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
MyungJoo Ham <myungjoo.ham@...sung.com>,
Chanwoo Choi <cw00.choi@...sung.com>,
Lee Jones <lee.jones@...aro.org>,
Sebastian Reichel <sre@...nel.org>,
linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-samsung-soc@...r.kernel.org, linux-pm@...r.kernel.org,
~postmarketos/upstreaming@...ts.sr.ht,
Marek Szyprowski <m.szyprowski@...sung.com>
Subject: Re: [PATCH v4 4/7] power: supply: max8997_charger: Set CHARGER current limit
On Thu, 24 Dec 2020 15:00:38 +0100, Krzysztof Kozlowski wrote:
> On Thu, Dec 24, 2020 at 02:37:06PM +0100, Krzysztof Kozlowski wrote:
> > On Thu, Dec 24, 2020 at 01:13:02PM +0000, Timon Baetz wrote:
> > > On Thu, 24 Dec 2020 10:55:59 +0100, Krzysztof Kozlowski wrote:
> > > > > @@ -170,6 +237,28 @@ static int max8997_battery_probe(struct platform_device *pdev)
> > > > > return PTR_ERR(charger->battery);
> > > > > }
> > > > >
> > > > > + charger->reg = devm_regulator_get(&pdev->dev, "charger");
> > > >
> > > > Since you do not use get_optional, you will always get a dummy
> > > > regulator. In case of error, you should either print it or entirely fail
> > > > the probe. Silently continuing makes it difficult to spot errors.
> > > >
> > > > Since the driver could operate in case of extcon/regulator error, just
> > > > dev_err() so failure will be spotted with dmesg.
> > >
> > > I will switch to devm_regulator_get_optional() and print an error on
> > > failure, thanks.
> > >
> > > > It will complain on older DTBs because you are introducing incompatible
> > > > change, but that's expected. Just correct all other in-tree DTS.
> > >
> > > The other 2 in-tree DTS don't have CHARGER regulators. Not sure
> > > how to correct those. Should I add muic and charger nodes without a
> > > charger-supply? It will still complain in that case.
> >
> > +Cc Marek,
> >
> > This is why leaving the code as is - devm_regulator_get(), not optional
> > - makes sense. Core would provide dummy regulator, so you only have to
> > provide MUIC node.
> >
> > If you change the code to devm_regulator_get_optional(), you need to add
> > everything: the charger regulator, the charger node and MUIC node.
> >
> > For Trats, the configuration should be similar as i9100, although I
> > don't know the exact values of chargign voltage.
> >
> > For Origen, there is no battery, so the power supply should not bind.
> > Maybe this could be achieved with "status disabled" for charger node? It
> > depends whether MFD will respect such field... If it disables the
> > charger, you're done.
>
> I just looked at the MFD code and tested it - it nicely skips disabled
> devices. Therefore, for Origen I propose to add disabled nodes for
> charger and MUIC because these pins are not connected. No need to add
> regulators in such case.
With a dummy regulator regulator_set_current_limit() fails with -EINVAL.
Isn't it better to just skip charging control (and dev_info()) when there
is no extcon or regulator? The charger driver would still probe
without those 2 properties and work as before.
Adding disabled nodes for Origen would probably still makes sense.
I also noticed that adding nodes for those MFD cells prints "DMA mask
not set" which seems to be related to https://lkml.org/lkml/2020/4/23/873.
Any suggestions on how to handle that?
Thanks,
Timon
Powered by blists - more mailing lists