Lines Matching +full:enable +full:- +full:usb +full:- +full:charging
1 // SPDX-License-Identifier: GPL-2.0
54 * charging the battery, but all register values are reset to default in tps65217_config_charger()
66 ret = tps65217_clear_bits(charger->tps, TPS65217_REG_CHGCONFIG1, in tps65217_config_charger()
70 dev_err(charger->dev, in tps65217_config_charger()
83 if (charger->online) in tps65217_enable_charging()
86 dev_dbg(charger->dev, "%s: enable charging\n", __func__); in tps65217_enable_charging()
87 ret = tps65217_set_bits(charger->tps, TPS65217_REG_CHGCONFIG1, in tps65217_enable_charging()
92 dev_err(charger->dev, in tps65217_enable_charging()
98 charger->online = 1; in tps65217_enable_charging()
110 val->intval = charger->online; in tps65217_charger_get_property()
113 return -EINVAL; in tps65217_charger_get_property()
121 charger->prev_online = charger->online; in tps65217_charger_irq()
123 ret = tps65217_reg_read(charger->tps, TPS65217_REG_STATUS, &val); in tps65217_charger_irq()
125 dev_err(charger->dev, "%s: Error in reading reg 0x%x\n", in tps65217_charger_irq()
130 dev_dbg(charger->dev, "%s: 0x%x\n", __func__, val); in tps65217_charger_irq()
136 dev_err(charger->dev, in tps65217_charger_irq()
137 "failed to enable charger: %d\n", ret); in tps65217_charger_irq()
141 charger->online = 0; in tps65217_charger_irq()
144 if (charger->prev_online != charger->online) in tps65217_charger_irq()
145 power_supply_changed(charger->psy); in tps65217_charger_irq()
147 ret = tps65217_reg_read(charger->tps, TPS65217_REG_CHGCONFIG0, &val); in tps65217_charger_irq()
149 dev_err(charger->dev, "%s: Error in reading reg 0x%x\n", in tps65217_charger_irq()
155 dev_dbg(charger->dev, "%s: charger is charging\n", __func__); in tps65217_charger_irq()
157 dev_dbg(charger->dev, in tps65217_charger_irq()
158 "%s: charger is NOT charging\n", __func__); in tps65217_charger_irq()
170 tps65217_charger_irq(-1, data); in tps65217_charger_poll_task()
176 .name = "tps65217-charger",
185 struct tps65217 *tps = dev_get_drvdata(pdev->dev.parent); in tps65217_charger_probe()
193 charger = devm_kzalloc(&pdev->dev, sizeof(*charger), GFP_KERNEL); in tps65217_charger_probe()
195 return -ENOMEM; in tps65217_charger_probe()
198 charger->tps = tps; in tps65217_charger_probe()
199 charger->dev = &pdev->dev; in tps65217_charger_probe()
201 cfg.of_node = pdev->dev.of_node; in tps65217_charger_probe()
204 charger->psy = devm_power_supply_register(&pdev->dev, in tps65217_charger_probe()
207 if (IS_ERR(charger->psy)) { in tps65217_charger_probe()
208 dev_err(&pdev->dev, "failed: power supply register\n"); in tps65217_charger_probe()
209 return PTR_ERR(charger->psy); in tps65217_charger_probe()
212 irq[0] = platform_get_irq_byname(pdev, "USB"); in tps65217_charger_probe()
217 dev_err(charger->dev, "charger config failed, err %d\n", ret); in tps65217_charger_probe()
227 dev_err(charger->dev, in tps65217_charger_probe()
232 charger->poll_task = poll_task; in tps65217_charger_probe()
238 ret = devm_request_threaded_irq(&pdev->dev, irq[i], NULL, in tps65217_charger_probe()
240 IRQF_SHARED, "tps65217-charger", in tps65217_charger_probe()
243 dev_err(charger->dev, in tps65217_charger_probe()
250 tps65217_charger_irq(-1, charger); in tps65217_charger_probe()
260 if (charger->poll_task) in tps65217_charger_remove()
261 kthread_stop(charger->poll_task); in tps65217_charger_remove()
265 { .compatible = "ti,tps65217-charger", },
274 .name = "tps65217-charger",