The TPS65217 charger is enabled by default, but by default the DT binding sets the charger as disabled, so currently all the devices that include the tps65217 binding have the charger enabled. This patch adds a check in the probe function of the tps65217 charger and disables it if the device status is disabled. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@xxxxxxxxxxxxx> --- drivers/power/supply/tps65217_charger.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/power/supply/tps65217_charger.c b/drivers/power/supply/tps65217_charger.c index 1f52340..55308f4 100644 --- a/drivers/power/supply/tps65217_charger.c +++ b/drivers/power/supply/tps65217_charger.c @@ -203,6 +203,23 @@ static int tps65217_charger_probe(struct platform_device *pdev) int ret; int i; + /* + * By default the charger is enabled but if device is disabled stop + * the charger accordingly to the configuration. + */ + if (!of_device_is_available(pdev->dev.of_node)) { + dev_dbg(&pdev->dev, "charger disabled\n"); + ret = tps65217_clear_bits(tps, TPS65217_REG_CHGCONFIG1, + TPS65217_CHGCONFIG1_CHG_EN, + TPS65217_PROTECT_NONE); + if (ret) { + dev_err(&pdev->dev, "Error writing in reg 0x%x: %d\n", + TPS65217_REG_CHGCONFIG1, ret); + return ret; + } + return -ENODEV; + } + charger = devm_kzalloc(&pdev->dev, sizeof(*charger), GFP_KERNEL); if (!charger) return -ENOMEM; -- 2.9.3 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html