Lines Matching +full:device +full:- +full:handle
1 // SPDX-License-Identifier: GPL-2.0
33 * Memory controller device control
44 * GTHS returning 'n' would mean that [0,n-1] states are supported
45 * In that case max_cstate would be n-1
51 struct acpi_device *device = cdev->devdata; in memory_get_max_bandwidth() local
52 acpi_handle handle = device->handle; in memory_get_max_bandwidth() local
62 status = acpi_evaluate_integer(handle, MEMORY_GET_BANDWIDTH, in memory_get_max_bandwidth()
65 return -EFAULT; in memory_get_max_bandwidth()
68 return -EINVAL; in memory_get_max_bandwidth()
70 *max_state = value - 1; in memory_get_max_bandwidth()
77 struct acpi_device *device = cdev->devdata; in memory_get_cur_bandwidth() local
78 acpi_handle handle = device->handle; in memory_get_cur_bandwidth() local
88 status = acpi_evaluate_integer(handle, MEMORY_GET_BANDWIDTH, in memory_get_cur_bandwidth()
91 return -EFAULT; in memory_get_cur_bandwidth()
100 struct acpi_device *device = cdev->devdata; in memory_set_cur_bandwidth() local
101 acpi_handle handle = device->handle; in memory_set_cur_bandwidth() local
109 return -EFAULT; in memory_set_cur_bandwidth()
112 return -EINVAL; in memory_set_cur_bandwidth()
120 acpi_evaluate_integer(handle, MEMORY_SET_BANDWIDTH, &arg_list, in memory_set_cur_bandwidth()
125 return -EFAULT; in memory_set_cur_bandwidth()
137 * Memory Device Management
139 static int intel_menlow_memory_add(struct acpi_device *device) in intel_menlow_memory_add() argument
141 int result = -ENODEV; in intel_menlow_memory_add()
144 if (!device) in intel_menlow_memory_add()
145 return -EINVAL; in intel_menlow_memory_add()
147 if (!acpi_has_method(device->handle, MEMORY_GET_BANDWIDTH)) in intel_menlow_memory_add()
150 if (!acpi_has_method(device->handle, MEMORY_SET_BANDWIDTH)) in intel_menlow_memory_add()
153 cdev = thermal_cooling_device_register("Memory controller", device, in intel_menlow_memory_add()
160 device->driver_data = cdev; in intel_menlow_memory_add()
161 result = sysfs_create_link(&device->dev.kobj, in intel_menlow_memory_add()
162 &cdev->device.kobj, "thermal_cooling"); in intel_menlow_memory_add()
166 result = sysfs_create_link(&cdev->device.kobj, in intel_menlow_memory_add()
167 &device->dev.kobj, "device"); in intel_menlow_memory_add()
169 sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); in intel_menlow_memory_add()
182 static int intel_menlow_memory_remove(struct acpi_device *device) in intel_menlow_memory_remove() argument
186 if (!device) in intel_menlow_memory_remove()
187 return -EINVAL; in intel_menlow_memory_remove()
189 cdev = acpi_driver_data(device); in intel_menlow_memory_remove()
191 return -EINVAL; in intel_menlow_memory_remove()
193 sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); in intel_menlow_memory_remove()
194 sysfs_remove_link(&cdev->device.kobj, "device"); in intel_menlow_memory_remove()
227 struct device *device; member
228 acpi_handle handle; member
236 * sensor_get_auxtrip - get the current auxtrip value from sensor
241 static int sensor_get_auxtrip(acpi_handle handle, int index, in sensor_get_auxtrip() argument
247 return -EINVAL; in sensor_get_auxtrip()
249 status = acpi_evaluate_integer(handle, index ? GET_AUX1 : GET_AUX0, in sensor_get_auxtrip()
252 return -EIO; in sensor_get_auxtrip()
258 * sensor_set_auxtrip - set the new auxtrip value to sensor
263 static int sensor_set_auxtrip(acpi_handle handle, int index, int value) in sensor_set_auxtrip() argument
275 return -EINVAL; in sensor_set_auxtrip()
277 status = acpi_evaluate_integer(handle, index ? GET_AUX0 : GET_AUX1, in sensor_set_auxtrip()
280 return -EIO; in sensor_set_auxtrip()
282 return -EINVAL; in sensor_set_auxtrip()
285 status = acpi_evaluate_integer(handle, index ? SET_AUX1 : SET_AUX0, in sensor_set_auxtrip()
288 return -EIO; in sensor_set_auxtrip()
298 static ssize_t aux_show(struct device *dev, struct device_attribute *dev_attr, in aux_show()
305 result = sensor_get_auxtrip(attr->handle, idx, &value); in aux_show()
312 static ssize_t aux0_show(struct device *dev, in aux0_show()
318 static ssize_t aux1_show(struct device *dev, in aux1_show()
324 static ssize_t aux_store(struct device *dev, struct device_attribute *dev_attr, in aux_store()
333 return -EINVAL; in aux_store()
336 return -EINVAL; in aux_store()
338 result = sensor_set_auxtrip(attr->handle, idx, in aux_store()
343 static ssize_t aux0_store(struct device *dev, in aux0_store()
350 static ssize_t aux1_store(struct device *dev, in aux1_store()
359 static ssize_t bios_enabled_show(struct device *dev, in bios_enabled_show()
367 return -ENODEV; in bios_enabled_show()
373 void *store, struct device *dev, in intel_menlow_add_one_attribute()
374 acpi_handle handle) in intel_menlow_add_one_attribute() argument
381 return -ENOMEM; in intel_menlow_add_one_attribute()
383 sysfs_attr_init(&attr->attr.attr); /* That is consistent naming :D */ in intel_menlow_add_one_attribute()
384 attr->attr.attr.name = name; in intel_menlow_add_one_attribute()
385 attr->attr.attr.mode = mode; in intel_menlow_add_one_attribute()
386 attr->attr.show = show; in intel_menlow_add_one_attribute()
387 attr->attr.store = store; in intel_menlow_add_one_attribute()
388 attr->device = dev; in intel_menlow_add_one_attribute()
389 attr->handle = handle; in intel_menlow_add_one_attribute()
391 result = device_create_file(dev, &attr->attr); in intel_menlow_add_one_attribute()
398 list_add_tail(&attr->node, &intel_menlow_attr_list); in intel_menlow_add_one_attribute()
404 static acpi_status intel_menlow_register_sensor(acpi_handle handle, u32 lvl, in intel_menlow_register_sensor() argument
412 result = acpi_bus_get_private_data(handle, (void **)&thermal); in intel_menlow_register_sensor()
417 status = acpi_get_handle(handle, GET_AUX0, &dummy); in intel_menlow_register_sensor()
421 status = acpi_get_handle(handle, SET_AUX0, &dummy); in intel_menlow_register_sensor()
427 &thermal->device, handle); in intel_menlow_register_sensor()
431 status = acpi_get_handle(handle, GET_AUX1, &dummy); in intel_menlow_register_sensor()
435 status = acpi_get_handle(handle, SET_AUX1, &dummy); in intel_menlow_register_sensor()
441 &thermal->device, handle); in intel_menlow_register_sensor()
454 &thermal->device, handle); in intel_menlow_register_sensor()
476 list_del(&pos->node); in intel_menlow_unregister_sensor()
477 device_remove_file(pos->device, &pos->attr); in intel_menlow_unregister_sensor()
487 int result = -ENODEV; in intel_menlow_module_init()
497 return -ENODEV; in intel_menlow_module_init()
499 /* Looking for ACPI device MEM0 with hardware id INT0002 */ in intel_menlow_module_init()
510 return -ENODEV; in intel_menlow_module_init()