Lines Matching +full:device +full:- +full:handle
1 // SPDX-License-Identifier: GPL-2.0-or-later
29 static int toshiba_haps_reset_protection(acpi_handle handle) in toshiba_haps_reset_protection() argument
33 status = acpi_evaluate_object(handle, "RSSS", NULL, NULL); in toshiba_haps_reset_protection()
36 return -EIO; in toshiba_haps_reset_protection()
42 static int toshiba_haps_protection_level(acpi_handle handle, int level) in toshiba_haps_protection_level() argument
46 status = acpi_execute_simple_method(handle, "PTLV", level); in toshiba_haps_protection_level()
49 return -EIO; in toshiba_haps_protection_level()
58 static ssize_t protection_level_show(struct device *dev, in protection_level_show()
63 return sprintf(buf, "%i\n", haps->protection_level); in protection_level_show()
66 static ssize_t protection_level_store(struct device *dev, in protection_level_store()
79 * 0 - Disabled | 1 - Low | 2 - Medium | 3 - High in protection_level_store()
82 return -EINVAL; in protection_level_store()
85 ret = toshiba_haps_protection_level(haps->acpi_dev->handle, level); in protection_level_store()
89 haps->protection_level = level; in protection_level_store()
95 static ssize_t reset_protection_store(struct device *dev, in reset_protection_store()
108 return -EINVAL; in reset_protection_store()
111 ret = toshiba_haps_reset_protection(haps->acpi_dev->handle); in reset_protection_store()
132 static void toshiba_haps_notify(struct acpi_device *device, u32 event) in toshiba_haps_notify() argument
136 acpi_bus_generate_netlink_event(device->pnp.device_class, in toshiba_haps_notify()
137 dev_name(&device->dev), in toshiba_haps_notify()
141 static void toshiba_haps_remove(struct acpi_device *device) in toshiba_haps_remove() argument
143 sysfs_remove_group(&device->dev.kobj, &haps_attr_group); in toshiba_haps_remove()
150 static int toshiba_haps_available(acpi_handle handle) in toshiba_haps_available() argument
156 * A non existent device as well as having (only) in toshiba_haps_available()
159 status = acpi_evaluate_integer(handle, "_STA", NULL, &hdd_present); in toshiba_haps_available()
179 return -EBUSY; in toshiba_haps_add()
181 if (!toshiba_haps_available(acpi_dev->handle)) in toshiba_haps_add()
182 return -ENODEV; in toshiba_haps_add()
184 pr_info("Toshiba HDD Active Protection Sensor device\n"); in toshiba_haps_add()
188 return -ENOMEM; in toshiba_haps_add()
190 haps->acpi_dev = acpi_dev; in toshiba_haps_add()
191 haps->protection_level = 2; in toshiba_haps_add()
192 acpi_dev->driver_data = haps; in toshiba_haps_add()
193 dev_set_drvdata(&acpi_dev->dev, haps); in toshiba_haps_add()
196 ret = toshiba_haps_protection_level(acpi_dev->handle, 2); in toshiba_haps_add()
200 ret = sysfs_create_group(&acpi_dev->dev.kobj, &haps_attr_group); in toshiba_haps_add()
210 static int toshiba_haps_suspend(struct device *device) in toshiba_haps_suspend() argument
215 haps = acpi_driver_data(to_acpi_device(device)); in toshiba_haps_suspend()
218 ret = toshiba_haps_protection_level(haps->acpi_dev->handle, 0); in toshiba_haps_suspend()
223 static int toshiba_haps_resume(struct device *device) in toshiba_haps_resume() argument
228 haps = acpi_driver_data(to_acpi_device(device)); in toshiba_haps_resume()
231 ret = toshiba_haps_protection_level(haps->acpi_dev->handle, in toshiba_haps_resume()
232 haps->protection_level); in toshiba_haps_resume()
235 ret = toshiba_haps_reset_protection(haps->acpi_dev->handle); in toshiba_haps_resume()