Lines Matching full:charger

2 // Battery charger driver for TI's tps65217
8 * Battery charger driver for TI's tps65217
45 static int tps65217_config_charger(struct tps65217_charger *charger) in tps65217_config_charger() argument
54 * is not recommended to do so. In sleep mode, the charger continues in tps65217_config_charger()
56 * values. Therefore, the charger would get the wrong temperature in tps65217_config_charger()
67 ret = tps65217_clear_bits(charger->tps, TPS65217_REG_CHGCONFIG1, in tps65217_config_charger()
71 dev_err(charger->dev, in tps65217_config_charger()
79 static int tps65217_enable_charging(struct tps65217_charger *charger) in tps65217_enable_charging() argument
83 /* charger already enabled */ in tps65217_enable_charging()
84 if (charger->online) in tps65217_enable_charging()
87 dev_dbg(charger->dev, "%s: enable charging\n", __func__); in tps65217_enable_charging()
88 ret = tps65217_set_bits(charger->tps, TPS65217_REG_CHGCONFIG1, in tps65217_enable_charging()
93 dev_err(charger->dev, in tps65217_enable_charging()
99 charger->online = 1; in tps65217_enable_charging()
108 struct tps65217_charger *charger = power_supply_get_drvdata(psy); in tps65217_charger_get_property() local
111 val->intval = charger->online; in tps65217_charger_get_property()
120 struct tps65217_charger *charger = dev; in tps65217_charger_irq() local
122 charger->prev_online = charger->online; in tps65217_charger_irq()
124 ret = tps65217_reg_read(charger->tps, TPS65217_REG_STATUS, &val); in tps65217_charger_irq()
126 dev_err(charger->dev, "%s: Error in reading reg 0x%x\n", in tps65217_charger_irq()
131 dev_dbg(charger->dev, "%s: 0x%x\n", __func__, val); in tps65217_charger_irq()
133 /* check for charger status bit */ in tps65217_charger_irq()
135 ret = tps65217_enable_charging(charger); in tps65217_charger_irq()
137 dev_err(charger->dev, in tps65217_charger_irq()
138 "failed to enable charger: %d\n", ret); in tps65217_charger_irq()
142 charger->online = 0; in tps65217_charger_irq()
145 if (charger->prev_online != charger->online) in tps65217_charger_irq()
146 power_supply_changed(charger->psy); in tps65217_charger_irq()
148 ret = tps65217_reg_read(charger->tps, TPS65217_REG_CHGCONFIG0, &val); in tps65217_charger_irq()
150 dev_err(charger->dev, "%s: Error in reading reg 0x%x\n", in tps65217_charger_irq()
156 dev_dbg(charger->dev, "%s: charger is charging\n", __func__); in tps65217_charger_irq()
158 dev_dbg(charger->dev, in tps65217_charger_irq()
159 "%s: charger is NOT charging\n", __func__); in tps65217_charger_irq()
177 .name = "tps65217-charger",
187 struct tps65217_charger *charger; in tps65217_charger_probe() local
194 charger = devm_kzalloc(&pdev->dev, sizeof(*charger), GFP_KERNEL); in tps65217_charger_probe()
195 if (!charger) in tps65217_charger_probe()
198 platform_set_drvdata(pdev, charger); in tps65217_charger_probe()
199 charger->tps = tps; in tps65217_charger_probe()
200 charger->dev = &pdev->dev; in tps65217_charger_probe()
203 cfg.drv_data = charger; in tps65217_charger_probe()
205 charger->psy = devm_power_supply_register(&pdev->dev, in tps65217_charger_probe()
208 if (IS_ERR(charger->psy)) { in tps65217_charger_probe()
210 return PTR_ERR(charger->psy); in tps65217_charger_probe()
216 ret = tps65217_config_charger(charger); in tps65217_charger_probe()
218 dev_err(charger->dev, "charger config failed, err %d\n", ret); in tps65217_charger_probe()
225 charger, "ktps65217charger"); in tps65217_charger_probe()
228 dev_err(charger->dev, in tps65217_charger_probe()
233 charger->poll_task = poll_task; in tps65217_charger_probe()
237 /* Create IRQ threads for charger interrupts */ in tps65217_charger_probe()
241 0, "tps65217-charger", in tps65217_charger_probe()
242 charger); in tps65217_charger_probe()
244 dev_err(charger->dev, in tps65217_charger_probe()
251 tps65217_charger_irq(-1, charger); in tps65217_charger_probe()
259 struct tps65217_charger *charger = platform_get_drvdata(pdev); in tps65217_charger_remove() local
261 if (charger->poll_task) in tps65217_charger_remove()
262 kthread_stop(charger->poll_task); in tps65217_charger_remove()
268 { .compatible = "ti,tps65217-charger", },
277 .name = "tps65217-charger",
286 MODULE_DESCRIPTION("TPS65217 battery charger driver");