Lines Matching +full:control +full:- +full:parent

1 // SPDX-License-Identifier: GPL-2.0-or-later
22 #include <linux/hid-roccat.h>
23 #include "hid-ids.h"
24 #include "hid-roccat-common.h"
25 #include "hid-roccat-pyra.h"
32 if (new_profile >= ARRAY_SIZE(pyra->profile_settings)) in profile_activated()
34 pyra->actual_profile = new_profile; in profile_activated()
35 pyra->actual_cpi = pyra->profile_settings[pyra->actual_profile].y_cpi; in profile_activated()
41 struct roccat_common2_control control; in pyra_send_control() local
46 return -EINVAL; in pyra_send_control()
48 control.command = ROCCAT_COMMON_COMMAND_CONTROL; in pyra_send_control()
49 control.value = value; in pyra_send_control()
50 control.request = request; in pyra_send_control()
53 &control, sizeof(struct roccat_common2_control)); in pyra_send_control()
87 struct device *dev = kobj_to_dev(kobj)->parent->parent; in pyra_sysfs_read()
96 return -EINVAL; in pyra_sysfs_read()
98 mutex_lock(&pyra->pyra_lock); in pyra_sysfs_read()
100 mutex_unlock(&pyra->pyra_lock); in pyra_sysfs_read()
112 struct device *dev = kobj_to_dev(kobj)->parent->parent; in pyra_sysfs_write()
118 return -EINVAL; in pyra_sysfs_write()
120 mutex_lock(&pyra->pyra_lock); in pyra_sysfs_write()
122 mutex_unlock(&pyra->pyra_lock); in pyra_sysfs_write()
177 PYRA_BIN_ATTRIBUTE_W(control, CONTROL);
186 struct device *dev = kobj_to_dev(kobj)->parent->parent; in pyra_sysfs_read_profilex_settings()
190 retval = pyra_send_control(usb_dev, *(uint *)(attr->private), in pyra_sysfs_read_profilex_settings()
204 struct device *dev = kobj_to_dev(kobj)->parent->parent; in pyra_sysfs_read_profilex_buttons()
208 retval = pyra_send_control(usb_dev, *(uint *)(attr->private), in pyra_sysfs_read_profilex_buttons()
223 .private = &profile_numbers[number-1], \
229 .private = &profile_numbers[number-1], \
241 struct device *dev = kobj_to_dev(kobj)->parent->parent; in pyra_sysfs_write_settings()
249 return -EINVAL; in pyra_sysfs_write_settings()
252 if (settings->startup_profile >= ARRAY_SIZE(pyra->profile_settings)) in pyra_sysfs_write_settings()
253 return -EINVAL; in pyra_sysfs_write_settings()
255 mutex_lock(&pyra->pyra_lock); in pyra_sysfs_write_settings()
259 mutex_unlock(&pyra->pyra_lock); in pyra_sysfs_write_settings()
263 profile_activated(pyra, settings->startup_profile); in pyra_sysfs_write_settings()
266 roccat_report.value = settings->startup_profile + 1; in pyra_sysfs_write_settings()
268 roccat_report_event(pyra->chrdev_minor, in pyra_sysfs_write_settings()
271 mutex_unlock(&pyra->pyra_lock); in pyra_sysfs_write_settings()
285 hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); in pyra_sysfs_show_actual_cpi()
286 return sysfs_emit(buf, "%d\n", pyra->actual_cpi); in pyra_sysfs_show_actual_cpi()
294 hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); in pyra_sysfs_show_actual_profile()
298 mutex_lock(&pyra->pyra_lock); in pyra_sysfs_show_actual_profile()
301 mutex_unlock(&pyra->pyra_lock); in pyra_sysfs_show_actual_profile()
315 dev = dev->parent->parent; in pyra_sysfs_show_firmware_version()
319 mutex_lock(&pyra->pyra_lock); in pyra_sysfs_show_firmware_version()
322 mutex_unlock(&pyra->pyra_lock); in pyra_sysfs_show_firmware_version()
378 mutex_init(&pyra->pyra_lock); in pyra_init_pyra_device_struct()
386 &pyra->profile_settings[i], i); in pyra_init_pyra_device_struct()
398 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); in pyra_init_specials()
403 if (intf->cur_altsetting->desc.bInterfaceProtocol in pyra_init_specials()
409 return -ENOMEM; in pyra_init_specials()
424 pyra->chrdev_minor = retval; in pyra_init_specials()
425 pyra->roccat_claimed = 1; in pyra_init_specials()
439 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); in pyra_remove_specials()
442 if (intf->cur_altsetting->desc.bInterfaceProtocol in pyra_remove_specials()
445 if (pyra->roccat_claimed) in pyra_remove_specials()
446 roccat_disconnect(pyra->chrdev_minor); in pyra_remove_specials()
456 return -EINVAL; in pyra_probe()
497 switch (button_event->type) { in pyra_keep_values_up_to_date()
499 profile_activated(pyra, button_event->data1 - 1); in pyra_keep_values_up_to_date()
502 pyra->actual_cpi = button_event->data1; in pyra_keep_values_up_to_date()
520 switch (button_event->type) { in pyra_report_to_chrdev()
523 roccat_report.type = button_event->type; in pyra_report_to_chrdev()
524 roccat_report.value = button_event->data1; in pyra_report_to_chrdev()
526 roccat_report_event(pyra->chrdev_minor, in pyra_report_to_chrdev()
532 if (button_event->data2 == PYRA_MOUSE_EVENT_BUTTON_PRESS) { in pyra_report_to_chrdev()
533 roccat_report.type = button_event->type; in pyra_report_to_chrdev()
534 roccat_report.key = button_event->data1; in pyra_report_to_chrdev()
536 * pyra reports profile numbers with range 1-5. in pyra_report_to_chrdev()
539 roccat_report.value = pyra->actual_profile + 1; in pyra_report_to_chrdev()
540 roccat_report_event(pyra->chrdev_minor, in pyra_report_to_chrdev()
550 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); in pyra_raw_event()
553 if (intf->cur_altsetting->desc.bInterfaceProtocol in pyra_raw_event()
562 if (pyra->roccat_claimed) in pyra_raw_event()