linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/1] charger-supply for max8997_charger
@ 2021-03-29 14:37 Timon Baetz
  2021-03-29 14:38 ` [PATCH v2 1/1] power: supply: max8997_charger: Switch to new binding Timon Baetz
  2021-04-02 12:14 ` [PATCH v2 0/1] charger-supply for max8997_charger Sebastian Reichel
  0 siblings, 2 replies; 3+ messages in thread
From: Timon Baetz @ 2021-03-29 14:37 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: linux-pm, linux-kernel, Krzysztof Kozlowski, Timon Baetz

Based on the discussion from [0] add an optional DT property to retrieve
the regulator used for charging control in the max8997_charger driver.

[0] https://lore.kernel.org/lkml/20210118124505.GG4455@sirena.org.uk/

Changes in v2:

* drop accepted patches

Timon Baetz (1):
  power: supply: max8997_charger: Switch to new binding

 drivers/power/supply/max8997_charger.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

--
2.25.1



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2 1/1] power: supply: max8997_charger: Switch to new binding
  2021-03-29 14:37 [PATCH v2 0/1] charger-supply for max8997_charger Timon Baetz
@ 2021-03-29 14:38 ` Timon Baetz
  2021-04-02 12:14 ` [PATCH v2 0/1] charger-supply for max8997_charger Sebastian Reichel
  1 sibling, 0 replies; 3+ messages in thread
From: Timon Baetz @ 2021-03-29 14:38 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: linux-pm, linux-kernel, Krzysztof Kozlowski, Timon Baetz

Get regulator from parent device's node and extcon by name.

Signed-off-by: Timon Baetz <timon.baetz@protonmail.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 drivers/power/supply/max8997_charger.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/power/supply/max8997_charger.c b/drivers/power/supply/max8997_charger.c
index a90c01884026..25207fe2aa68 100644
--- a/drivers/power/supply/max8997_charger.c
+++ b/drivers/power/supply/max8997_charger.c
@@ -168,6 +168,7 @@ static int max8997_battery_probe(struct platform_device *pdev)
 	int ret = 0;
 	struct charger_data *charger;
 	struct max8997_dev *iodev = dev_get_drvdata(pdev->dev.parent);
+	struct device_node *np = pdev->dev.of_node;
 	struct i2c_client *i2c = iodev->i2c;
 	struct max8997_platform_data *pdata = iodev->pdata;
 	struct power_supply_config psy_cfg = {};
@@ -237,20 +238,23 @@ static int max8997_battery_probe(struct platform_device *pdev)
 		return PTR_ERR(charger->battery);
 	}

+	// grab regulator from parent device's node
+	pdev->dev.of_node = iodev->dev->of_node;
 	charger->reg = devm_regulator_get_optional(&pdev->dev, "charger");
+	pdev->dev.of_node = np;
 	if (IS_ERR(charger->reg)) {
 		if (PTR_ERR(charger->reg) == -EPROBE_DEFER)
 			return -EPROBE_DEFER;
 		dev_info(&pdev->dev, "couldn't get charger regulator\n");
 	}
-	charger->edev = extcon_get_edev_by_phandle(&pdev->dev, 0);
-	if (IS_ERR(charger->edev)) {
-		if (PTR_ERR(charger->edev) == -EPROBE_DEFER)
+	charger->edev = extcon_get_extcon_dev("max8997-muic");
+	if (IS_ERR_OR_NULL(charger->edev)) {
+		if (!charger->edev)
 			return -EPROBE_DEFER;
 		dev_info(charger->dev, "couldn't get extcon device\n");
 	}

-	if (!IS_ERR(charger->reg) && !IS_ERR(charger->edev)) {
+	if (!IS_ERR(charger->reg) && !IS_ERR_OR_NULL(charger->edev)) {
 		INIT_WORK(&charger->extcon_work, max8997_battery_extcon_evt_worker);
 		ret = devm_add_action(&pdev->dev, max8997_battery_extcon_evt_stop_work, charger);
 		if (ret) {
--
2.25.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 0/1] charger-supply for max8997_charger
  2021-03-29 14:37 [PATCH v2 0/1] charger-supply for max8997_charger Timon Baetz
  2021-03-29 14:38 ` [PATCH v2 1/1] power: supply: max8997_charger: Switch to new binding Timon Baetz
@ 2021-04-02 12:14 ` Sebastian Reichel
  1 sibling, 0 replies; 3+ messages in thread
From: Sebastian Reichel @ 2021-04-02 12:14 UTC (permalink / raw)
  To: Timon Baetz; +Cc: linux-pm, linux-kernel, Krzysztof Kozlowski

[-- Attachment #1: Type: text/plain, Size: 584 bytes --]

Hi,

On Mon, Mar 29, 2021 at 02:37:47PM +0000, Timon Baetz wrote:
> Based on the discussion from [0] add an optional DT property to retrieve
> the regulator used for charging control in the max8997_charger driver.
> 
> [0] https://lore.kernel.org/lkml/20210118124505.GG4455@sirena.org.uk/
> 
> Changes in v2:
> 
> * drop accepted patches
> 
> Timon Baetz (1):
>   power: supply: max8997_charger: Switch to new binding
> 
>  drivers/power/supply/max8997_charger.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)

Thanks, queued.

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-02 12:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-29 14:37 [PATCH v2 0/1] charger-supply for max8997_charger Timon Baetz
2021-03-29 14:38 ` [PATCH v2 1/1] power: supply: max8997_charger: Switch to new binding Timon Baetz
2021-04-02 12:14 ` [PATCH v2 0/1] charger-supply for max8997_charger Sebastian Reichel

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