Lines Matching +full:button +full:- +full:uid

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * dock.c - ACPI dock station driver
26 "undock immediately when the undock button is pressed, 0 will cause"
65 * add_dock_dependent_device - associate a device with the dock station
78 return -ENOMEM; in add_dock_dependent_device()
80 dd->adev = adev; in add_dock_dependent_device()
81 INIT_LIST_HEAD(&dd->list); in add_dock_dependent_device()
82 list_add_tail(&dd->list, &ds->dependent_devices); in add_dock_dependent_device()
90 struct acpi_device *adev = dd->adev; in dock_hotplug_event()
97 if (adev->hp) { in dock_hotplug_event()
99 fixup = adev->hp->fixup; in dock_hotplug_event()
101 uevent = adev->hp->uevent; in dock_hotplug_event()
103 notify = adev->hp->notify; in dock_hotplug_event()
121 if (ds->handle == handle) in find_dock_station()
128 * find_dock_dependent_device - get a device dependent on this dock
140 list_for_each_entry(dd, &ds->dependent_devices, list) in find_dock_dependent_device()
141 if (adev == dd->adev) in find_dock_dependent_device()
161 * is_dock_device - see if a device is on a dock station
175 if (acpi_dock_match(adev->handle)) in is_dock_device()
187 * dock_present - see if the dock station is present.
199 status = acpi_evaluate_integer(ds->handle, "_STA", NULL, &sta); in dock_present()
207 * hot_remove_dock_devices - Remove dock station devices.
219 list_for_each_entry_reverse(dd, &ds->dependent_devices, list) in hot_remove_dock_devices()
223 list_for_each_entry_reverse(dd, &ds->dependent_devices, list) in hot_remove_dock_devices()
224 acpi_bus_trim(dd->adev); in hot_remove_dock_devices()
228 * hotplug_dock_devices - Insert devices on a dock station.
241 /* Call driver specific post-dock fixups. */ in hotplug_dock_devices()
242 list_for_each_entry(dd, &ds->dependent_devices, list) in hotplug_dock_devices()
246 list_for_each_entry(dd, &ds->dependent_devices, list) in hotplug_dock_devices()
255 list_for_each_entry(dd, &ds->dependent_devices, list) { in hotplug_dock_devices()
256 struct acpi_device *adev = dd->adev; in hotplug_dock_devices()
259 int ret = acpi_bus_scan(adev->handle); in hotplug_dock_devices()
262 dev_dbg(&adev->dev, "scan error %d\n", -ret); in hotplug_dock_devices()
269 struct device *dev = &ds->dock_device->dev; in dock_event()
284 kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, envp); in dock_event()
286 list_for_each_entry(dd, &ds->dependent_devices, list) in dock_event()
290 kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, envp); in dock_event()
294 * handle_dock - handle a dock event
296 * @dock: to dock, or undock - that is the question
307 acpi_handle_info(ds->handle, "%s\n", dock ? "docking" : "undocking"); in handle_dock()
314 status = acpi_evaluate_integer(ds->handle, "_DCK", &arg_list, &value); in handle_dock()
316 acpi_handle_err(ds->handle, "Failed to execute _DCK (0x%x)\n", in handle_dock()
332 ds->flags |= DOCK_DOCKING; in begin_dock()
337 ds->flags &= ~(DOCK_DOCKING); in complete_dock()
338 ds->last_dock_time = jiffies; in complete_dock()
343 ds->flags |= DOCK_UNDOCKING; in begin_undock()
348 ds->flags &= ~(DOCK_UNDOCKING); in complete_undock()
352 * dock_in_progress - see if we are in the middle of handling a dock event
361 if ((ds->flags & DOCK_DOCKING) || in dock_in_progress()
362 time_before(jiffies, (ds->last_dock_time + HZ))) in dock_in_progress()
368 * handle_eject_request - handle an undock request checking for error conditions
378 return -EBUSY; in handle_eject_request()
391 acpi_evaluate_lck(ds->handle, 0); in handle_eject_request()
392 acpi_evaluate_ej0(ds->handle); in handle_eject_request()
394 acpi_handle_err(ds->handle, "Unable to undock!\n"); in handle_eject_request()
395 return -EBUSY; in handle_eject_request()
402 * dock_notify - Handle ACPI dock notification.
412 acpi_handle handle = adev->handle; in dock_notify()
417 return -ENODEV; in dock_notify()
424 if ((ds->flags & DOCK_IS_DOCK) && event == ACPI_NOTIFY_DEVICE_CHECK) in dock_notify()
428 * dock station: BUS_CHECK - docked or surprise removal in dock_notify()
429 * DEVICE_CHECK - undocked in dock_notify()
430 * other device: BUS_CHECK/DEVICE_CHECK - added or surprise removal in dock_notify()
450 acpi_evaluate_lck(ds->handle, 1); in dock_notify()
463 if ((immediate_undock && !(ds->flags & DOCK_IS_ATA)) in dock_notify()
474 * show_docked - read method for "docked" file in sysfs
479 struct dock_station *dock_station = dev->platform_data; in docked_show()
480 struct acpi_device *adev = acpi_fetch_acpi_dev(dock_station->handle); in docked_show()
487 * show_flags - read method for flags file in sysfs
492 struct dock_station *dock_station = dev->platform_data; in flags_show()
494 return sysfs_emit(buf, "%d\n", dock_station->flags); in flags_show()
500 * write_undock - write method for "undock" file in sysfs
506 struct dock_station *dock_station = dev->platform_data; in undock_store()
509 return -EINVAL; in undock_store()
520 * show_dock_uid - read method for "uid" file in sysfs
526 struct dock_station *dock_station = dev->platform_data; in uid_show()
528 acpi_status status = acpi_evaluate_integer(dock_station->handle, in uid_show()
535 static DEVICE_ATTR_RO(uid);
540 struct dock_station *dock_station = dev->platform_data; in type_show()
543 if (dock_station->flags & DOCK_IS_DOCK) in type_show()
545 else if (dock_station->flags & DOCK_IS_ATA) in type_show()
547 else if (dock_station->flags & DOCK_IS_BAT) in type_show()
570 * acpi_dock_add - Add a new dock station
579 acpi_handle handle = adev->handle; in acpi_dock_add()
593 dock_station = dd->dev.platform_data; in acpi_dock_add()
595 dock_station->handle = handle; in acpi_dock_add()
596 dock_station->dock_device = dd; in acpi_dock_add()
597 dock_station->last_dock_time = jiffies - HZ; in acpi_dock_add()
599 INIT_LIST_HEAD(&dock_station->sibling); in acpi_dock_add()
600 INIT_LIST_HEAD(&dock_station->dependent_devices); in acpi_dock_add()
603 dev_set_uevent_suppress(&dd->dev, 0); in acpi_dock_add()
606 dock_station->flags |= DOCK_IS_DOCK; in acpi_dock_add()
608 dock_station->flags |= DOCK_IS_ATA; in acpi_dock_add()
610 dock_station->flags |= DOCK_IS_BAT; in acpi_dock_add()
612 ret = sysfs_create_group(&dd->dev.kobj, &dock_attribute_group); in acpi_dock_add()
622 list_add(&dock_station->sibling, &dock_stations); in acpi_dock_add()
623 adev->flags.is_dock_station = true; in acpi_dock_add()
624 dev_info(&adev->dev, "ACPI dock station (docks/bays count: %d)\n", in acpi_dock_add()
629 sysfs_remove_group(&dd->dev.kobj, &dock_attribute_group); in acpi_dock_add()