[PATCH 2/2] power: supply: bq256xx: Add ability to omit battery class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add omit-battery-class property to avoid make a battery device
for charger when fg makes one.

Signed-off-by: Barnabás Czémán <barnabas.czeman@xxxxxxxxxxxxxx>
---
 drivers/power/supply/bq256xx_charger.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/power/supply/bq256xx_charger.c b/drivers/power/supply/bq256xx_charger.c
index 5514d1896bb8..62721d564b39 100644
--- a/drivers/power/supply/bq256xx_charger.c
+++ b/drivers/power/supply/bq256xx_charger.c
@@ -1547,12 +1547,14 @@ static int bq256xx_power_supply_init(struct bq256xx_device *bq,
 		return PTR_ERR(bq->charger);
 	}
 
-	bq->battery = devm_power_supply_register(bq->dev,
-						      &bq256xx_battery_desc,
-						      psy_cfg);
-	if (IS_ERR(bq->battery)) {
-		dev_err(dev, "power supply register battery failed\n");
-		return PTR_ERR(bq->battery);
+	if (!device_property_read_bool(dev, "omit-battery-class")) {
+		bq->battery = devm_power_supply_register(bq->dev,
+							 &bq256xx_battery_desc,
+							 psy_cfg);
+		if (IS_ERR(bq->battery)) {
+			dev_err(dev, "power supply register battery failed\n");
+			return PTR_ERR(bq->battery);
+		}
 	}
 	return 0;
 }

-- 
2.46.0





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux