linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Timon Baetz <timon.baetz@protonmail.com>
Cc: devicetree@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Mark Brown <broonie@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Rob Herring <robh+dt@kernel.org>,
	Sebastian Reichel <sre@kernel.org>,
	Chanwoo Choi <cw00.choi@samsung.com>,
	MyungJoo Ham <myungjoo.ham@samsung.com>,
	~postmarketos/upstreaming@lists.sr.ht,
	Lee Jones <lee.jones@linaro.org>,
	linux-arm-kernel@lists.infradead.org,
	Marek Szyprowski <m.szyprowski@samsung.com>
Subject: Re: [PATCH v4 4/7] power: supply: max8997_charger: Set CHARGER current limit
Date: Mon, 28 Dec 2020 11:30:52 +0100	[thread overview]
Message-ID: <20201228103052.GA6435@kozik-lap> (raw)
In-Reply-To: <20201225123300.07c84dd8.timon.baetz@protonmail.com>

On Fri, Dec 25, 2020 at 11:33:21AM +0000, Timon Baetz wrote:
> 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.

Good point.

> 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.

Yes, makes sense.

> 
> 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?

I don't think it is your problem to solve. It affects other MFD devices
as well.

Best regards,
Krzysztof

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-12-28 10:32 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-23 13:42 [PATCH v4 1/7] extcon: max8997: Add CHGINS and CHGRM interrupt handling Timon Baetz
2020-12-23 13:42 ` [PATCH v4 2/7] regulator: dt-bindings: Document max8997-pmic nodes Timon Baetz
2020-12-24  9:45   ` Krzysztof Kozlowski
2020-12-23 13:42 ` [PATCH v4 3/7] mfd: max8997: Add of_compatible to extcon and charger mfd_cell Timon Baetz
2020-12-23 15:32   ` Lee Jones
2020-12-24 11:23     ` Timon Baetz
2020-12-24 12:58       ` Lee Jones
2020-12-23 13:43 ` [PATCH v4 4/7] power: supply: max8997_charger: Set CHARGER current limit Timon Baetz
2020-12-24  9:55   ` Krzysztof Kozlowski
2020-12-24 13:13     ` Timon Baetz
2020-12-24 13:37       ` Krzysztof Kozlowski
2020-12-24 14:00         ` Krzysztof Kozlowski
2020-12-25 11:33           ` Timon Baetz
2020-12-28 10:30             ` Krzysztof Kozlowski [this message]
2020-12-23 13:43 ` [PATCH v4 5/7] ARM: dts: exynos: Added muic and charger nodes for i9100 Timon Baetz
2020-12-23 13:43 ` [PATCH v4 6/7] ARM: dts: exynos: Fix charging regulator voltage and current " Timon Baetz
2020-12-23 13:43 ` [PATCH v4 7/7] ARM: dts: exynos: Add top-off charging regulator node " Timon Baetz

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=20201228103052.GA6435@kozik-lap \
    --to=krzk@kernel.org \
    --cc=broonie@kernel.org \
    --cc=cw00.choi@samsung.com \
    --cc=devicetree@vger.kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=myungjoo.ham@samsung.com \
    --cc=robh+dt@kernel.org \
    --cc=sre@kernel.org \
    --cc=timon.baetz@protonmail.com \
    --cc=~postmarketos/upstreaming@lists.sr.ht \
    /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).