Lines Matching +full:enable +full:- +full:low +full:- +full:current +full:- +full:chrg
1 // SPDX-License-Identifier: GPL-2.0-only
48 if (charger->passive_mode) in tps65090_low_chrg_current()
51 ret = tps65090_write(charger->dev->parent, TPS65090_REG_CG_CTRL5, in tps65090_low_chrg_current()
54 dev_err(charger->dev, "%s(): error reading in register 0x%x\n", in tps65090_low_chrg_current()
66 if (charger->passive_mode) in tps65090_enable_charging()
69 ret = tps65090_read(charger->dev->parent, TPS65090_REG_CG_CTRL0, in tps65090_enable_charging()
72 dev_err(charger->dev, "%s(): error reading in register 0x%x\n", in tps65090_enable_charging()
77 ret = tps65090_write(charger->dev->parent, TPS65090_REG_CG_CTRL0, in tps65090_enable_charging()
80 dev_err(charger->dev, "%s(): error writing in register 0x%x\n", in tps65090_enable_charging()
92 if (charger->passive_mode) in tps65090_config_charger()
95 if (charger->pdata->enable_low_current_chrg) { in tps65090_config_charger()
98 dev_err(charger->dev, in tps65090_config_charger()
99 "error configuring low charge current\n"); in tps65090_config_charger()
104 /* Enable the VACG interrupt for AC power detect */ in tps65090_config_charger()
105 ret = tps65090_read(charger->dev->parent, TPS65090_REG_INTR_MASK, in tps65090_config_charger()
108 dev_err(charger->dev, "%s(): error reading in register 0x%x\n", in tps65090_config_charger()
113 ret = tps65090_write(charger->dev->parent, TPS65090_REG_INTR_MASK, in tps65090_config_charger()
116 dev_err(charger->dev, "%s(): error writing in register 0x%x\n", in tps65090_config_charger()
131 val->intval = charger->ac_online; in tps65090_ac_get_property()
132 charger->prev_ac_online = charger->ac_online; in tps65090_ac_get_property()
135 return -EINVAL; in tps65090_ac_get_property()
145 ret = tps65090_read(charger->dev->parent, TPS65090_REG_CG_STATUS1, in tps65090_charger_isr()
148 dev_err(charger->dev, "%s(): Error in reading reg 0x%x\n", in tps65090_charger_isr()
153 ret = tps65090_read(charger->dev->parent, TPS65090_REG_INTR_STS, in tps65090_charger_isr()
156 dev_err(charger->dev, "%s(): Error in reading reg 0x%x\n", in tps65090_charger_isr()
165 charger->ac_online = 1; in tps65090_charger_isr()
167 charger->ac_online = 0; in tps65090_charger_isr()
171 if (!charger->passive_mode) { in tps65090_charger_isr()
172 ret = tps65090_write(charger->dev->parent, in tps65090_charger_isr()
175 dev_err(charger->dev, in tps65090_charger_isr()
181 if (charger->prev_ac_online != charger->ac_online) in tps65090_charger_isr()
182 power_supply_changed(charger->ac); in tps65090_charger_isr()
191 struct device_node *np = pdev->dev.of_node; in tps65090_parse_dt_charger_data()
194 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); in tps65090_parse_dt_charger_data()
196 dev_err(&pdev->dev, "Memory alloc for tps65090_pdata failed\n"); in tps65090_parse_dt_charger_data()
200 prop = of_property_read_bool(np, "ti,enable-low-current-chrg"); in tps65090_parse_dt_charger_data()
201 pdata->enable_low_current_chrg = prop; in tps65090_parse_dt_charger_data()
203 pdata->irq_base = -1; in tps65090_parse_dt_charger_data()
216 tps65090_charger_isr(-1, data); in tps65090_charger_poll_task()
222 .name = "tps65090-ac",
238 pdata = dev_get_platdata(pdev->dev.parent); in tps65090_charger_probe()
240 if (IS_ENABLED(CONFIG_OF) && !pdata && pdev->dev.of_node) in tps65090_charger_probe()
244 dev_err(&pdev->dev, "%s():no platform data available\n", in tps65090_charger_probe()
246 return -ENODEV; in tps65090_charger_probe()
249 cdata = devm_kzalloc(&pdev->dev, sizeof(*cdata), GFP_KERNEL); in tps65090_charger_probe()
251 dev_err(&pdev->dev, "failed to allocate memory status\n"); in tps65090_charger_probe()
252 return -ENOMEM; in tps65090_charger_probe()
257 cdata->dev = &pdev->dev; in tps65090_charger_probe()
258 cdata->pdata = pdata; in tps65090_charger_probe()
260 psy_cfg.supplied_to = pdata->supplied_to; in tps65090_charger_probe()
261 psy_cfg.num_supplicants = pdata->num_supplicants; in tps65090_charger_probe()
262 psy_cfg.of_node = pdev->dev.of_node; in tps65090_charger_probe()
265 cdata->ac = devm_power_supply_register(&pdev->dev, &tps65090_charger_desc, in tps65090_charger_probe()
267 if (IS_ERR(cdata->ac)) { in tps65090_charger_probe()
268 dev_err(&pdev->dev, "failed: power supply register\n"); in tps65090_charger_probe()
269 return PTR_ERR(cdata->ac); in tps65090_charger_probe()
274 irq = -ENXIO; in tps65090_charger_probe()
275 cdata->irq = irq; in tps65090_charger_probe()
279 dev_err(&pdev->dev, "charger config failed, err %d\n", ret); in tps65090_charger_probe()
284 ret = tps65090_read(cdata->dev->parent, TPS65090_REG_CG_STATUS1, in tps65090_charger_probe()
287 dev_err(cdata->dev, "%s(): Error in reading reg 0x%x", __func__, in tps65090_charger_probe()
295 dev_err(cdata->dev, "error enabling charger\n"); in tps65090_charger_probe()
298 cdata->ac_online = 1; in tps65090_charger_probe()
299 power_supply_changed(cdata->ac); in tps65090_charger_probe()
302 if (irq != -ENXIO) { in tps65090_charger_probe()
303 ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, in tps65090_charger_probe()
304 tps65090_charger_isr, IRQF_ONESHOT, "tps65090-charger", cdata); in tps65090_charger_probe()
306 dev_err(cdata->dev, in tps65090_charger_probe()
312 cdata->poll_task = kthread_run(tps65090_charger_poll_task, in tps65090_charger_probe()
314 cdata->passive_mode = true; in tps65090_charger_probe()
315 if (IS_ERR(cdata->poll_task)) { in tps65090_charger_probe()
316 ret = PTR_ERR(cdata->poll_task); in tps65090_charger_probe()
317 dev_err(cdata->dev, in tps65090_charger_probe()
330 if (cdata->irq == -ENXIO) in tps65090_charger_remove()
331 kthread_stop(cdata->poll_task); in tps65090_charger_remove()
335 { .compatible = "ti,tps65090-charger", },
342 .name = "tps65090-charger",