public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Artur Weber <aweber.kernel@gmail.com>
To: Krzysztof Kozlowski <krzk@kernel.org>,
	Chanwoo Choi <cw00.choi@samsung.com>
Cc: Sebastian Reichel <sre@kernel.org>, Rob Herring <robh@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>, Lee Jones <lee@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Alim Akhtar <alim.akhtar@samsung.com>,
	linux-pm@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org,
	~postmarketos/upstreaming@lists.sr.ht,
	Henrik Grimler <henrik@grimler.se>,
	Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de>,
	Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Subject: Re: [PATCH RFC 05/11] power: supply: max77693: Expose INPUT_CURRENT_LIMIT and CURRENT_MAX
Date: Fri, 31 May 2024 14:22:14 +0200	[thread overview]
Message-ID: <e0b8a451-1bce-4cc2-8793-9372dcb558da@gmail.com> (raw)
In-Reply-To: <3b3beca0-80f7-4a20-93d0-01af89fcf508@kernel.org>

On 31.05.2024 11:38, Krzysztof Kozlowski wrote:
> On 30/05/2024 10:55, Artur Weber wrote:
>> There are two charger current limit registers:
>>
>> - Fast charge current limit (which controls current going from the
>>    charger to the battery);
>> - CHGIN input current limit (which controls current going into the
>>    charger through the cable, and is managed by the CHARGER regulator).
>>
> 
> 
> 
>> +	case POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT:
>> +		ret = max77693_get_input_current_limit(chg, &val->intval);
>> +		break;
>> +	case POWER_SUPPLY_PROP_CURRENT_MAX:
>> +		ret = max77693_get_fast_charge_current(regmap, &val->intval);
>> +		break;
>>   	case POWER_SUPPLY_PROP_MODEL_NAME:
>>   		val->strval = max77693_charger_model;
>>   		break;
>> @@ -680,6 +727,11 @@ static int max77693_charger_probe(struct platform_device *pdev)
>>   	chg->dev = &pdev->dev;
>>   	chg->max77693 = max77693;
>>   
>> +	chg->regu = devm_regulator_get(chg->dev, "CHARGER");
>> +	if (IS_ERR(chg->regu))
>> +		return dev_err_probe(&pdev->dev, PTR_ERR(chg->regu),
>> +				     "failed to get charger regulator\n");\
> 
> This breaks users... and where is the binding?
Assuming "this" means "erroring out if the CHARGER regulator is not
found":

The way it works here is that the CHARGER regulator is fetched directly
from the parent max77693 device (it's defined in the regulator subnode
in DT). I suppose we could add a DT property for it, in the charger node
(like we do for the USB connector), though I don't know if anyone would
use any other regulator here than the CHARGER regulator of the max77693
regulator device. (And after all, we're using it here to modify charger
registers... maybe another point to my argument that we should be
handling all of this directly in the charger driver instead of deferring
it to a regulator.)

Best regards
Artur

[1] https://lore.kernel.org/all/20160927081344.GC4394@kozik-lap/
[2] https://lore.kernel.org/all/298d81d5-fe41-e2d1-32a7-d3dc35b0fe25@kernel.org/

  reply	other threads:[~2024-05-31 12:22 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-30  8:55 [PATCH RFC 00/11] power: supply: max77693: Toggle charging/OTG based on extcon status Artur Weber
2024-05-30  8:55 ` [PATCH RFC 01/11] dt-bindings: power: supply: max77693: Add fast charge current property Artur Weber
2024-05-31  9:35   ` Krzysztof Kozlowski
2024-05-30  8:55 ` [PATCH RFC 02/11] dt-bindings: power: supply: max77693: Add maxim,usb-connector property Artur Weber
2024-05-31  9:15   ` Krzysztof Kozlowski
2024-05-30  8:55 ` [PATCH RFC 03/11] mfd: max77693: Add defines for charger current control Artur Weber
2024-05-31  9:14   ` Krzysztof Kozlowski
2024-05-30  8:55 ` [PATCH RFC 04/11] mfd: max77693: Add defines for OTG control Artur Weber
2024-05-31  9:36   ` Krzysztof Kozlowski
2024-05-30  8:55 ` [PATCH RFC 05/11] power: supply: max77693: Expose INPUT_CURRENT_LIMIT and CURRENT_MAX Artur Weber
2024-05-31  9:38   ` Krzysztof Kozlowski
2024-05-31 12:22     ` Artur Weber [this message]
2024-05-30  8:55 ` [PATCH RFC 06/11] power: supply: max77693: Set charge current limits during init Artur Weber
2024-05-31  9:47   ` Krzysztof Kozlowski
2024-05-31 11:55     ` Artur Weber
2024-05-31 12:18       ` Krzysztof Kozlowski
2024-06-05 14:43         ` Artur Weber
2024-05-30  8:55 ` [PATCH RFC 07/11] power: supply: max77693: Add USB extcon detection for enabling charging Artur Weber
2024-05-30  8:55 ` [PATCH RFC 08/11] power: supply: max77693: Add support for detecting and enabling OTG Artur Weber
2024-05-30  8:55 ` [PATCH RFC 09/11] power: supply: max77693: Set up charge/input current according to cable type Artur Weber
2024-05-30  8:56 ` [PATCH RFC 10/11] ARM: dts: samsung: exynos4212-tab3: Set fast charge current for MAX77693 Artur Weber
2024-05-30  8:56 ` [PATCH RFC 11/11] ARM: dts: samsung: exynos4212-tab3: Add USB connector node Artur Weber

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=e0b8a451-1bce-4cc2-8793-9372dcb558da@gmail.com \
    --to=aweber.kernel@gmail.com \
    --cc=GNUtoo@cyberdimension.org \
    --cc=alim.akhtar@samsung.com \
    --cc=conor+dt@kernel.org \
    --cc=cw00.choi@samsung.com \
    --cc=devicetree@vger.kernel.org \
    --cc=henrik@grimler.se \
    --cc=krzk+dt@kernel.org \
    --cc=krzk@kernel.org \
    --cc=lee@kernel.org \
    --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=robh@kernel.org \
    --cc=sre@kernel.org \
    --cc=wolfgit@wiedmeyer.de \
    --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