Lines Matching +full:entry +full:- +full:method

1 // SPDX-License-Identifier: GPL-2.0-or-later
27 #define DRIVER_NAME "msi-wmi-platform"
29 #define MSI_PLATFORM_GUID "ABBC0F6E-8EA1-11d1-00A0-C90629100000"
81 enum msi_wmi_platform_method method; member
121 if (obj->type != ACPI_TYPE_BUFFER) in msi_wmi_platform_parse_buffer()
122 return -ENOMSG; in msi_wmi_platform_parse_buffer()
124 if (obj->buffer.length != length) in msi_wmi_platform_parse_buffer()
125 return -EPROTO; in msi_wmi_platform_parse_buffer()
127 if (!obj->buffer.pointer[0]) in msi_wmi_platform_parse_buffer()
128 return -EIO; in msi_wmi_platform_parse_buffer()
130 memcpy(output, obj->buffer.pointer, obj->buffer.length); in msi_wmi_platform_parse_buffer()
135 static int msi_wmi_platform_query(struct wmi_device *wdev, enum msi_wmi_platform_method method, in msi_wmi_platform_query() argument
148 return -EINVAL; in msi_wmi_platform_query()
150 status = wmidev_evaluate_method(wdev, 0x0, method, &in, &out); in msi_wmi_platform_query()
152 return -EIO; in msi_wmi_platform_query()
156 return -ENODATA; in msi_wmi_platform_query()
216 struct seq_file *seq = fp->private_data; in msi_wmi_platform_write()
217 struct msi_wmi_platform_debugfs_data *data = seq->private; in msi_wmi_platform_write()
223 return -EINVAL; in msi_wmi_platform_write()
226 if (length != data->length) in msi_wmi_platform_write()
227 return -EINVAL; in msi_wmi_platform_write()
233 down_write(&data->buffer_lock); in msi_wmi_platform_write()
234 ret = msi_wmi_platform_query(data->wdev, data->method, payload, data->length, data->buffer, in msi_wmi_platform_write()
235 data->length); in msi_wmi_platform_write()
236 up_write(&data->buffer_lock); in msi_wmi_platform_write()
246 struct msi_wmi_platform_debugfs_data *data = seq->private; in msi_wmi_platform_show()
249 down_read(&data->buffer_lock); in msi_wmi_platform_show()
250 ret = seq_write(seq, data->buffer, data->length); in msi_wmi_platform_show()
251 up_read(&data->buffer_lock); in msi_wmi_platform_show()
258 struct msi_wmi_platform_debugfs_data *data = inode->i_private; in msi_wmi_platform_open()
261 return single_open_size(fp, msi_wmi_platform_show, data, data->length + 1); in msi_wmi_platform_open()
281 const char *name, enum msi_wmi_platform_method method) in msi_wmi_platform_debugfs_add() argument
284 struct dentry *entry; in msi_wmi_platform_debugfs_add() local
286 data = devm_kzalloc(&wdev->dev, sizeof(*data), GFP_KERNEL); in msi_wmi_platform_debugfs_add()
290 data->wdev = wdev; in msi_wmi_platform_debugfs_add()
291 data->method = method; in msi_wmi_platform_debugfs_add()
292 init_rwsem(&data->buffer_lock); in msi_wmi_platform_debugfs_add()
297 data->length = 32; in msi_wmi_platform_debugfs_add()
299 entry = debugfs_create_file(name, 0600, dir, data, &msi_wmi_platform_debugfs_fops); in msi_wmi_platform_debugfs_add()
300 if (IS_ERR(entry)) in msi_wmi_platform_debugfs_add()
301 devm_kfree(&wdev->dev, data); in msi_wmi_platform_debugfs_add()
308 int ret, method; in msi_wmi_platform_debugfs_init() local
310 scnprintf(dir_name, ARRAY_SIZE(dir_name), "%s-%s", DRIVER_NAME, dev_name(&wdev->dev)); in msi_wmi_platform_debugfs_init()
316 ret = devm_add_action_or_reset(&wdev->dev, msi_wmi_platform_debugfs_remove, dir); in msi_wmi_platform_debugfs_init()
320 for (method = MSI_PLATFORM_GET_PACKAGE; method <= MSI_PLATFORM_GET_WMI; method++) in msi_wmi_platform_debugfs_init()
321 msi_wmi_platform_debugfs_add(wdev, dir, msi_wmi_platform_debugfs_names[method - 1], in msi_wmi_platform_debugfs_init()
322 method); in msi_wmi_platform_debugfs_init()
329 hdev = devm_hwmon_device_register_with_info(&wdev->dev, "msi_wmi_platform", wdev, in msi_wmi_platform_hwmon_init()
349 dev_dbg(&wdev->dev, "EC RAM version %lu.%lu\n", in msi_wmi_platform_ec_init()
352 dev_dbg(&wdev->dev, "EC firmware version %.28s\n", in msi_wmi_platform_ec_init()
357 return -ENODEV; in msi_wmi_platform_ec_init()
359 dev_warn(&wdev->dev, "Loading on a non-Tigerlake platform\n"); in msi_wmi_platform_ec_init()
376 dev_dbg(&wdev->dev, "WMI interface version %u.%u\n", in msi_wmi_platform_init()
382 return -ENODEV; in msi_wmi_platform_init()
384 dev_warn(&wdev->dev, "Loading despite unsupported WMI interface version (%u.%u)\n", in msi_wmi_platform_init()