• Home
  • Raw
  • Download

Lines Matching refs:ac

77 static int acpi_ac_get_state(struct acpi_ac *ac)  in acpi_ac_get_state()  argument
81 if (!ac) in acpi_ac_get_state()
85 ac->state = 1; in acpi_ac_get_state()
89 status = acpi_evaluate_integer(ac->device->handle, "_PSR", NULL, in acpi_ac_get_state()
90 &ac->state); in acpi_ac_get_state()
92 acpi_handle_info(ac->device->handle, in acpi_ac_get_state()
95 ac->state = ACPI_AC_STATUS_UNKNOWN; in acpi_ac_get_state()
107 struct acpi_ac *ac = to_acpi_ac(psy); in get_ac_property() local
109 if (!ac) in get_ac_property()
112 if (acpi_ac_get_state(ac)) in get_ac_property()
117 val->intval = ac->state; in get_ac_property()
133 struct acpi_ac *ac = acpi_driver_data(device); in acpi_ac_notify() local
135 if (!ac) in acpi_ac_notify()
156 acpi_ac_get_state(ac); in acpi_ac_notify()
159 (u32) ac->state); in acpi_ac_notify()
160 acpi_notifier_call_chain(device, event, (u32) ac->state); in acpi_ac_notify()
161 kobject_uevent(&ac->charger->dev.kobj, KOBJ_CHANGE); in acpi_ac_notify()
168 struct acpi_ac *ac = container_of(nb, struct acpi_ac, battery_nb); in acpi_ac_battery_notify() local
180 acpi_ac_get_state(ac); in acpi_ac_battery_notify()
221 struct acpi_ac *ac = NULL; in acpi_ac_add() local
227 ac = kzalloc(sizeof(struct acpi_ac), GFP_KERNEL); in acpi_ac_add()
228 if (!ac) in acpi_ac_add()
231 ac->device = device; in acpi_ac_add()
234 device->driver_data = ac; in acpi_ac_add()
236 result = acpi_ac_get_state(ac); in acpi_ac_add()
240 psy_cfg.drv_data = ac; in acpi_ac_add()
242 ac->charger_desc.name = acpi_device_bid(device); in acpi_ac_add()
243 ac->charger_desc.type = POWER_SUPPLY_TYPE_MAINS; in acpi_ac_add()
244 ac->charger_desc.properties = ac_props; in acpi_ac_add()
245 ac->charger_desc.num_properties = ARRAY_SIZE(ac_props); in acpi_ac_add()
246 ac->charger_desc.get_property = get_ac_property; in acpi_ac_add()
247 ac->charger = power_supply_register(&ac->device->dev, in acpi_ac_add()
248 &ac->charger_desc, &psy_cfg); in acpi_ac_add()
249 if (IS_ERR(ac->charger)) { in acpi_ac_add()
250 result = PTR_ERR(ac->charger); in acpi_ac_add()
255 acpi_device_bid(device), ac->state ? "on-line" : "off-line"); in acpi_ac_add()
257 ac->battery_nb.notifier_call = acpi_ac_battery_notify; in acpi_ac_add()
258 register_acpi_notifier(&ac->battery_nb); in acpi_ac_add()
261 kfree(ac); in acpi_ac_add()
269 struct acpi_ac *ac; in acpi_ac_resume() local
275 ac = acpi_driver_data(to_acpi_device(dev)); in acpi_ac_resume()
276 if (!ac) in acpi_ac_resume()
279 old_state = ac->state; in acpi_ac_resume()
280 if (acpi_ac_get_state(ac)) in acpi_ac_resume()
282 if (old_state != ac->state) in acpi_ac_resume()
283 kobject_uevent(&ac->charger->dev.kobj, KOBJ_CHANGE); in acpi_ac_resume()
293 struct acpi_ac *ac = NULL; in acpi_ac_remove() local
298 ac = acpi_driver_data(device); in acpi_ac_remove()
300 power_supply_unregister(ac->charger); in acpi_ac_remove()
301 unregister_acpi_notifier(&ac->battery_nb); in acpi_ac_remove()
303 kfree(ac); in acpi_ac_remove()