Skip to contentSkip to conversation

Small fixes for Nokia N900 power supply drivers

PATCH In review Pali Rohár 4 participants 13 messages Feb 21, 2016 – Feb 23, 2016 Device tree bindings

lore
Share & tools
lore
#0 lore raw

cover Small fixes for Nokia N900 power supply drivers

This patch series add debug error output for isp1704 driver and fix module aliases for power supply drivers uses on Nokia N900.

Pali Rohár (6):
power_supply: isp1704_charger: Error messages when probe fail
power_supply: isp1704_charger: Add compatible of match for

    nxp,isp1707

power_supply: bq2415x_charger: Do not add acpi modalias when
CONFIG_ACPI is not enabled
power_supply: bq2415x_charger: Add of modalias and match table when
CONFIG_OF is enabled
power_supply: bq27xxx_battery: Add of modalias and match table when
CONFIG_OF is enabled
ARM: dts: n900: Rename isp1704 to isp1707 to match correct name

 arch/arm/boot/dts/omap3-n900.dts    |    6 +++---
 drivers/power/bq2415x_charger.c     |   22 ++++++++++++++++++++++
 drivers/power/bq27xxx_battery.c     |   12 ++++++++++++
 drivers/power/bq27xxx_battery_i2c.c |   24 ++++++++++++++++++++++++
 drivers/power/isp1704_charger.c     |   19 +++++++++++++++----
 5 files changed, 76 insertions(+), 7 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/6 power_supply: isp1704_charger: Error messages when probe fail

This patch adds more detailed error messages when probe function fail. It is useful for debbuging why driver refuse to register charger device.

---
 drivers/power/isp1704_charger.c |   18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
drivers/power/isp1704_charger.c +14 -4
index 46a292a..acaf7cf 100644
@@ -411,8 +411,10 @@ static int isp1704_charger_probe(struct platform_device *pdev)
 	if (np) {
 		int gpio = of_get_named_gpio(np, "nxp,enable-gpio", 0);
 
-		if (gpio < 0)
+		if (gpio < 0) {
+			dev_err(&pdev->dev, "missing DT GPIO nxp,enable-gpio\n");
 			return gpio;
+		}
 
 		pdata = devm_kzalloc(&pdev->dev,
 			sizeof(struct isp1704_charger_data), GFP_KERNEL);
@@ -422,8 +424,10 @@ static int isp1704_charger_probe(struct platform_device *pdev)
 
 		ret = devm_gpio_request_one(&pdev->dev, pdata->enable_gpio,
 					GPIOF_OUT_INIT_HIGH, "isp1704_reset");
-		if (ret)
+		if (ret) {
+			dev_err(&pdev->dev, "gpio request failed\n");
 			goto fail0;
+		}
 	}
 
 	if (!pdata) {
@@ -443,6 +447,7 @@ static int isp1704_charger_probe(struct platform_device *pdev)
 
 	if (IS_ERR(isp->phy)) {
 		ret = PTR_ERR(isp->phy);
+		dev_err(&pdev->dev, "usb_get_phy failed\n");
 		goto fail0;
 	}
 
@@ -452,8 +457,10 @@ static int isp1704_charger_probe(struct platform_device *pdev)
 	isp1704_charger_set_power(isp, 1);
 
 	ret = isp1704_test_ulpi(isp);
-	if (ret < 0)
+	if (ret < 0) {
+		dev_err(&pdev->dev, "isp1704_test_ulpi failed\n");
 		goto fail1;
+	}
 
 	isp->psy_desc.name		= "isp1704";
 	isp->psy_desc.type		= POWER_SUPPLY_TYPE_USB;
@@ -466,6 +473,7 @@ static int isp1704_charger_probe(struct platform_device *pdev)
 	isp->psy = power_supply_register(isp->dev, &isp->psy_desc, &psy_cfg);
 	if (IS_ERR(isp->psy)) {
 		ret = PTR_ERR(isp->psy);
+		dev_err(&pdev->dev, "power_supply_register failed\n");
 		goto fail1;
 	}
 
@@ -478,8 +486,10 @@ static int isp1704_charger_probe(struct platform_device *pdev)
 	isp->nb.notifier_call = isp1704_notifier_call;
 
 	ret = usb_register_notifier(isp->phy, &isp->nb);
-	if (ret)
+	if (ret) {
+		dev_err(&pdev->dev, "usb_register_notifier failed\n");
 		goto fail2;
+	}
 
 	dev_info(isp->dev, "registered with product id %s\n", isp->model);
 
Signature · 1 line
1.7.9.5
Acked-by on v1 1/6
#2 lore raw

Re: [PATCH 1/6] power_supply: isp1704_charger: Error messages when probe fail

Hi!

Quoted 2 lines

This patch adds more detailed error messages when probe function
fail.

...fails.

Quoted 1 line

It is useful for debbuging why driver refuse to register charger device.

...why the driver refuses to register...

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#3 lore raw

PATCH 2/6 power_supply: isp1704_charger: Add compatible of match for nxp,isp1707

In reply to Pali Rohár
---
 drivers/power/isp1704_charger.c |    1 +
 1 file changed, 1 insertion(+)
drivers/power/isp1704_charger.c +1 -0
index acaf7cf..4cd6899 100644
@@ -536,6 +536,7 @@ static int isp1704_charger_remove(struct platform_device *pdev)
 #ifdef CONFIG_OF
 static const struct of_device_id omap_isp1704_of_match[] = {
 	{ .compatible = "nxp,isp1704", },
+	{ .compatible = "nxp,isp1707", },
 	{},
 };
 MODULE_DEVICE_TABLE(of, omap_isp1704_of_match);
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH 3/6 power_supply: bq2415x_charger: Do not add acpi modalias when CONFIG_ACPI is not enabled

In reply to Pali Rohár
---
 drivers/power/bq2415x_charger.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/power/bq2415x_charger.c +2 -0
index 27e8953..b0863f4 100644
@@ -1759,6 +1759,7 @@ static const struct i2c_device_id bq2415x_i2c_id_table[] = {
 };
 MODULE_DEVICE_TABLE(i2c, bq2415x_i2c_id_table);
 
+#ifdef CONFIG_ACPI
 static const struct acpi_device_id bq2415x_i2c_acpi_match[] = {
 	{ "BQ2415X", BQUNKNOWN },
 	{ "BQ241500", BQ24150 },
@@ -1776,6 +1777,7 @@ static const struct acpi_device_id bq2415x_i2c_acpi_match[] = {
 	{},
 };
 MODULE_DEVICE_TABLE(acpi, bq2415x_i2c_acpi_match);
+#endif
 
 static struct i2c_driver bq2415x_driver = {
 	.driver = {
Signature · 1 line
1.7.9.5
Acked-by on v1 3/6
#5 lore raw

Re: [PATCH 3/6] power_supply: bq2415x_charger: Do not add acpi modalias when CONFIG_ACPI is not enabled

Quoted 1 line · Pali Rohár
Quoted 16 lines
drivers/power/bq2415x_charger.c +2 -0
@@ -1759,6 +1759,7 @@ static const struct i2c_device_id bq2415x_i2c_id_table[] = {
 };
 MODULE_DEVICE_TABLE(i2c, bq2415x_i2c_id_table);
 
+#ifdef CONFIG_ACPI
 static const struct acpi_device_id bq2415x_i2c_acpi_match[] = {
 	{ "BQ2415X", BQUNKNOWN },
 	{ "BQ241500", BQ24150 },
@@ -1776,6 +1777,7 @@ static const struct acpi_device_id bq2415x_i2c_acpi_match[] = {
 	{},
 };
 MODULE_DEVICE_TABLE(acpi, bq2415x_i2c_acpi_match);
+#endif
 
 static struct i2c_driver bq2415x_driver = {
 	.driver = {
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#6 lore raw

PATCH 4/6 power_supply: bq2415x_charger: Add of modalias and match table when CONFIG_OF is enabled

In reply to Pali Rohár
---
 drivers/power/bq2415x_charger.c |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/power/bq2415x_charger.c +20 -0
index b0863f4..73e2f0b 100644
@@ -1779,9 +1779,29 @@ static const struct acpi_device_id bq2415x_i2c_acpi_match[] = {
 MODULE_DEVICE_TABLE(acpi, bq2415x_i2c_acpi_match);
 #endif
 
+#ifdef CONFIG_OF
+static const struct of_device_id bq2415x_of_match_table[] = {
+	{ .compatible = "ti,bq24150" },
+	{ .compatible = "ti,bq24150a" },
+	{ .compatible = "ti,bq24151" },
+	{ .compatible = "ti,bq24151a" },
+	{ .compatible = "ti,bq24152" },
+	{ .compatible = "ti,bq24153" },
+	{ .compatible = "ti,bq24153a" },
+	{ .compatible = "ti,bq24155" },
+	{ .compatible = "ti,bq24156" },
+	{ .compatible = "ti,bq24156a" },
+	{ .compatible = "ti,bq24157s" },
+	{ .compatible = "ti,bq24158" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, bq2415x_of_match_table);
+#endif
+
 static struct i2c_driver bq2415x_driver = {
 	.driver = {
 		.name = "bq2415x-charger",
+		.of_match_table = of_match_ptr(bq2415x_of_match_table),
 		.acpi_match_table = ACPI_PTR(bq2415x_i2c_acpi_match),
 	},
 	.probe = bq2415x_probe,
Signature · 1 line
1.7.9.5
#7 lore raw

PATCH 5/6 power_supply: bq27xxx_battery: Add of modalias and match table when CONFIG_OF is enabled

In reply to Pali Rohár
---
 drivers/power/bq27xxx_battery.c     |   12 ++++++++++++
 drivers/power/bq27xxx_battery_i2c.c |   24 ++++++++++++++++++++++++
 2 files changed, 36 insertions(+)
drivers/power/bq27xxx_battery.c +12 -0
index 6b027a4..45f6ebf 100644
@@ -46,6 +46,7 @@
 #include <linux/platform_device.h>
 #include <linux/power_supply.h>
 #include <linux/slab.h>
+#include <linux/of.h>
 
 #include <linux/power/bq27xxx_battery.h>
 
@@ -1090,16 +1091,27 @@ static const struct platform_device_id bq27xxx_battery_platform_id_table[] = {
 };
 MODULE_DEVICE_TABLE(platform, bq27xxx_battery_platform_id_table);
 
+#ifdef CONFIG_OF
+static const struct of_device_id bq27xxx_battery_platform_of_match_table[] = {
+	{ .compatible = "ti,bq27000" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, bq27xxx_battery_platform_of_match_table);
+#endif
+
 static struct platform_driver bq27xxx_battery_platform_driver = {
 	.probe	= bq27xxx_battery_platform_probe,
 	.remove = bq27xxx_battery_platform_remove,
 	.driver = {
 		.name = "bq27000-battery",
+		.of_match_table = of_match_ptr(bq27xxx_battery_platform_of_match_table),
 	},
 	.id_table = bq27xxx_battery_platform_id_table,
 };
 module_platform_driver(bq27xxx_battery_platform_driver);
 
+MODULE_ALIAS("platform:bq27000-battery");
+
 MODULE_AUTHOR("Rodolfo Giometti <[email protected]>");
 MODULE_DESCRIPTION("BQ27xxx battery monitor driver");
 MODULE_LICENSE("GPL");
drivers/power/bq27xxx_battery_i2c.c +24 -0
index 9429e66..b810e08 100644
@@ -135,9 +135,33 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 };
 MODULE_DEVICE_TABLE(i2c, bq27xxx_i2c_id_table);
 
+#ifdef CONFIG_OF
+static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
+	{ .compatible = "ti,bq27200" },
+	{ .compatible = "ti,bq27210" },
+	{ .compatible = "ti,bq27500" },
+	{ .compatible = "ti,bq27510" },
+	{ .compatible = "ti,bq27520" },
+	{ .compatible = "ti,bq27530" },
+	{ .compatible = "ti,bq27531" },
+	{ .compatible = "ti,bq27541" },
+	{ .compatible = "ti,bq27542" },
+	{ .compatible = "ti,bq27546" },
+	{ .compatible = "ti,bq27742" },
+	{ .compatible = "ti,bq27545" },
+	{ .compatible = "ti,bq27421" },
+	{ .compatible = "ti,bq27425" },
+	{ .compatible = "ti,bq27441" },
+	{ .compatible = "ti,bq27621" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, bq27xxx_battery_i2c_of_match_table);
+#endif
+
 static struct i2c_driver bq27xxx_battery_i2c_driver = {
 	.driver = {
 		.name = "bq27xxx-battery",
+		.of_match_table = of_match_ptr(bq27xxx_battery_i2c_of_match_table),
 	},
 	.probe = bq27xxx_battery_i2c_probe,
 	.remove = bq27xxx_battery_i2c_remove,
Signature · 1 line
1.7.9.5
#8 lore raw

PATCH 6/6 ARM: dts: n900: Rename isp1704 to isp1707 to match correct name

In reply to Pali Rohár

This change does not break existing userspace or Maemo software because isp1704_charger.c always export power supply device under isp1704 name.

---
 arch/arm/boot/dts/omap3-n900.dts |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/omap3-n900.dts +3 -3
index 82df643..e0443cd 100644
@@ -107,8 +107,8 @@
 		};
 	};
 
-	isp1704: isp1704 {
-		compatible = "nxp,isp1704";
+	isp1707: isp1707 {
+		compatible = "nxp,isp1707";
 		nxp,enable-gpio = <&gpio3 3 GPIO_ACTIVE_HIGH>;
 		usb-phy = <&usb2_phy>;
 	};
@@ -735,7 +735,7 @@
 		ti,termination-current = <100>;
 		ti,resistor-sense = <68>;
 
-		ti,usb-charger-detection = <&isp1704>;
+		ti,usb-charger-detection = <&isp1707>;
 	};
 };
 
Signature · 1 line
1.7.9.5
#9 lore raw

Re: [PATCH 6/6] ARM: dts: n900: Rename isp1704 to isp1707 to match correct name

Quoted 2 lines · Pali Rohár

This change does not break existing userspace or Maemo software because isp1704_charger.c always export power supply device under isp1704 name.

..exports..

Quoted 1 line

4,5,6: Acked-by: Pavel Machek <[email protected]>

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Acked-by
#10 lore raw

Re: [PATCH 6/6] ARM: dts: n900: Rename isp1704 to isp1707 to match correct name

Quoted 9 lines · Pavel Machek
Quoted 2 lines · Pali Rohár

This change does not break existing userspace or Maemo software because isp1704_charger.c always export power supply device under isp1704 name.

..exports..

Quoted 1 line

4,5,6: Acked-by: Pavel Machek <[email protected]>

Ack for this one to get merged along with the driver changes:

Regards,

Tony

#11 lore raw

Re: [PATCH 6/6] ARM: dts: n900: Rename isp1704 to isp1707 to match correct name

Hi,

Quoted 7 lines · Tony Lindgren
Quoted 6 lines · Pavel Machek
Quoted 2 lines · Pali Rohár

This change does not break existing userspace or Maemo software because isp1704_charger.c always export power supply device under isp1704 name.

..exports..

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

4,5,6: Acked-by: Pavel Machek <[email protected]>

Ack for this one to get merged along with the driver changes:

Ok, done.

-- Sebastian

#12 lore raw
In reply to Pali Rohár

Hi,

Quoted 10 lines · Pali Rohár

This patch series add debug error output for isp1704 driver and fix module aliases for power supply drivers uses on Nokia N900.

Pali Rohár (6):
power_supply: isp1704_charger: Error messages when probe fail
power_supply: isp1704_charger: Add compatible of match for nxp,isp1707
power_supply: bq2415x_charger: Do not add acpi modalias when CONFIG_ACPI is not enabled
power_supply: bq2415x_charger: Add of modalias and match table when CONFIG_OF is enabled
power_supply: bq27xxx_battery: Add of modalias and match table when CONFIG_OF is enabled
ARM: dts: n900: Rename isp1704 to isp1707 to match correct name

I queued the power-supply patches for 4.6 applying Pavel's commit message changes and his Acked-By.

-- Sebastian