Lines Matching full:bat
63 static bool a500_battery_update_capacity(struct a500_battery *bat) in a500_battery_update_capacity() argument
68 err = regmap_read(bat->regmap, ec_data[REG_CAPACITY].reg, &capacity); in a500_battery_update_capacity()
75 if (bat->capacity != capacity) { in a500_battery_update_capacity()
76 bat->capacity = capacity; in a500_battery_update_capacity()
83 static int a500_battery_get_status(struct a500_battery *bat) in a500_battery_get_status() argument
85 if (bat->capacity < 100) { in a500_battery_get_status()
86 if (power_supply_am_i_supplied(bat->psy)) in a500_battery_get_status()
149 struct a500_battery *bat = power_supply_get_drvdata(psy); in a500_battery_get_property() local
155 val->intval = a500_battery_get_status(bat); in a500_battery_get_property()
163 a500_battery_update_capacity(bat); in a500_battery_get_property()
164 val->intval = bat->capacity; in a500_battery_get_property()
176 ret = regmap_read(bat->regmap, ec_data[ret].reg, &val->intval); in a500_battery_get_property()
201 struct a500_battery *bat; in a500_battery_poll_work() local
204 bat = container_of(work, struct a500_battery, poll_work.work); in a500_battery_poll_work()
205 capacity_changed = a500_battery_update_capacity(bat); in a500_battery_poll_work()
208 power_supply_changed(bat->psy); in a500_battery_poll_work()
211 schedule_delayed_work(&bat->poll_work, 30 * HZ); in a500_battery_poll_work()
226 struct a500_battery *bat; in a500_battery_probe() local
228 bat = devm_kzalloc(&pdev->dev, sizeof(*bat), GFP_KERNEL); in a500_battery_probe()
229 if (!bat) in a500_battery_probe()
232 platform_set_drvdata(pdev, bat); in a500_battery_probe()
235 psy_cfg.drv_data = bat; in a500_battery_probe()
237 bat->regmap = dev_get_regmap(pdev->dev.parent, "KB930"); in a500_battery_probe()
238 if (!bat->regmap) in a500_battery_probe()
241 bat->psy = devm_power_supply_register_no_ws(&pdev->dev, in a500_battery_probe()
244 if (IS_ERR(bat->psy)) in a500_battery_probe()
245 return dev_err_probe(&pdev->dev, PTR_ERR(bat->psy), in a500_battery_probe()
248 INIT_DELAYED_WORK(&bat->poll_work, a500_battery_poll_work); in a500_battery_probe()
249 schedule_delayed_work(&bat->poll_work, HZ); in a500_battery_probe()
256 struct a500_battery *bat = dev_get_drvdata(&pdev->dev); in a500_battery_remove() local
258 cancel_delayed_work_sync(&bat->poll_work); in a500_battery_remove()
265 struct a500_battery *bat = dev_get_drvdata(dev); in a500_battery_suspend() local
267 cancel_delayed_work_sync(&bat->poll_work); in a500_battery_suspend()
274 struct a500_battery *bat = dev_get_drvdata(dev); in a500_battery_resume() local
276 schedule_delayed_work(&bat->poll_work, HZ); in a500_battery_resume()