Lines Matching +full:a500 +full:- +full:iconia +full:- +full:ec

1 // SPDX-License-Identifier: GPL-2.0+
3 * Battery driver for Acer Iconia Tab A500.
5 * Copyright 2020 GRATE-driver project.
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()
85 if (bat->capacity < 100) { in a500_battery_get_status()
86 if (power_supply_am_i_supplied(bat->psy)) in a500_battery_get_status()
106 val->intval *= base_unit_conversion; in a500_battery_unit_adjustment()
110 val->intval -= temp_kelvin_to_celsius; in a500_battery_unit_adjustment()
114 val->intval = !!val->intval; in a500_battery_unit_adjustment()
129 * DESIGN_CAPACITY register always returns a non-zero value if in a500_battery_get_ec_data_index()
142 return -EINVAL; in a500_battery_get_ec_data_index()
150 struct device *dev = psy->dev.parent; in a500_battery_get_property()
155 val->intval = a500_battery_get_status(bat); in a500_battery_get_property()
159 val->intval = POWER_SUPPLY_TECHNOLOGY_LION; 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()
181 return -EINVAL; in a500_battery_get_property()
190 __func__, psp, val->intval); in a500_battery_get_property()
194 return -ENODATA; in a500_battery_get_property()
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()
215 .name = "ec-battery",
228 bat = devm_kzalloc(&pdev->dev, sizeof(*bat), GFP_KERNEL); in a500_battery_probe()
230 return -ENOMEM; in a500_battery_probe()
234 psy_cfg.of_node = pdev->dev.parent->of_node; 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()
239 return -EINVAL; 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()
258 cancel_delayed_work_sync(&bat->poll_work); in a500_battery_remove()
265 cancel_delayed_work_sync(&bat->poll_work); in a500_battery_suspend()
274 schedule_delayed_work(&bat->poll_work, HZ); in a500_battery_resume()
284 .name = "acer-a500-iconia-battery",
292 MODULE_DESCRIPTION("Battery gauge driver for Acer Iconia Tab A500");
294 MODULE_ALIAS("platform:acer-a500-iconia-battery");