Lines Matching refs:charger
54 struct charger_data *charger = power_supply_get_drvdata(psy); in max8997_battery_get_property() local
55 struct i2c_client *i2c = charger->iodev->i2c; in max8997_battery_get_property()
100 struct charger_data *charger = in max8997_battery_extcon_evt_worker() local
102 struct extcon_dev *edev = charger->edev; in max8997_battery_extcon_evt_worker()
106 dev_dbg(charger->dev, "USB SDP charger is connected\n"); in max8997_battery_extcon_evt_worker()
109 dev_dbg(charger->dev, "USB DCP charger is connected\n"); in max8997_battery_extcon_evt_worker()
112 dev_dbg(charger->dev, "USB FAST charger is connected\n"); in max8997_battery_extcon_evt_worker()
115 dev_dbg(charger->dev, "USB SLOW charger is connected\n"); in max8997_battery_extcon_evt_worker()
118 dev_dbg(charger->dev, "USB CDP charger is connected\n"); in max8997_battery_extcon_evt_worker()
121 dev_dbg(charger->dev, "USB charger is disconnected\n"); in max8997_battery_extcon_evt_worker()
126 int ret = regulator_set_current_limit(charger->reg, current_limit, current_limit); in max8997_battery_extcon_evt_worker()
129 dev_err(charger->dev, "failed to set current limit: %d\n", ret); in max8997_battery_extcon_evt_worker()
132 ret = regulator_enable(charger->reg); in max8997_battery_extcon_evt_worker()
134 dev_err(charger->dev, "failed to enable regulator: %d\n", ret); in max8997_battery_extcon_evt_worker()
136 int ret = regulator_disable(charger->reg); in max8997_battery_extcon_evt_worker()
139 dev_err(charger->dev, "failed to disable regulator: %d\n", ret); in max8997_battery_extcon_evt_worker()
146 struct charger_data *charger = in max8997_battery_extcon_evt() local
148 schedule_work(&charger->extcon_work); in max8997_battery_extcon_evt()
163 struct charger_data *charger; in max8997_battery_probe() local
216 charger = devm_kzalloc(&pdev->dev, sizeof(*charger), GFP_KERNEL); in max8997_battery_probe()
217 if (!charger) in max8997_battery_probe()
220 platform_set_drvdata(pdev, charger); in max8997_battery_probe()
222 charger->dev = &pdev->dev; in max8997_battery_probe()
223 charger->iodev = iodev; in max8997_battery_probe()
225 psy_cfg.drv_data = charger; in max8997_battery_probe()
227 charger->battery = devm_power_supply_register(&pdev->dev, in max8997_battery_probe()
230 if (IS_ERR(charger->battery)) { in max8997_battery_probe()
232 return PTR_ERR(charger->battery); in max8997_battery_probe()
237 charger->reg = devm_regulator_get_optional(&pdev->dev, "charger"); in max8997_battery_probe()
239 if (IS_ERR(charger->reg)) { in max8997_battery_probe()
240 if (PTR_ERR(charger->reg) == -EPROBE_DEFER) in max8997_battery_probe()
244 charger->edev = extcon_get_extcon_dev("max8997-muic"); in max8997_battery_probe()
245 if (IS_ERR(charger->edev)) { in max8997_battery_probe()
246 dev_err_probe(charger->dev, PTR_ERR(charger->edev), in max8997_battery_probe()
248 return PTR_ERR(charger->edev); in max8997_battery_probe()
251 if (!IS_ERR(charger->reg) && !IS_ERR_OR_NULL(charger->edev)) { in max8997_battery_probe()
252 ret = devm_work_autocancel(&pdev->dev, &charger->extcon_work, in max8997_battery_probe()
258 charger->extcon_nb.notifier_call = max8997_battery_extcon_evt; in max8997_battery_probe()
259 ret = devm_extcon_register_notifier_all(&pdev->dev, charger->edev, in max8997_battery_probe()
260 &charger->extcon_nb); in max8997_battery_probe()