Lines Matching refs:kone

37 static void kone_profile_activated(struct kone_device *kone, uint new_profile)  in kone_profile_activated()  argument
39 kone->actual_profile = new_profile; in kone_profile_activated()
40 kone->actual_dpi = kone->profiles[new_profile - 1].startup_dpi; in kone_profile_activated()
43 static void kone_profile_report(struct kone_device *kone, uint new_profile) in kone_profile_report() argument
50 roccat_report_event(kone->chrdev_minor, (uint8_t *)&roccat_report); in kone_profile_report()
270 struct kone_device *kone = hid_get_drvdata(dev_get_drvdata(dev)); in kone_sysfs_read_settings() local
278 mutex_lock(&kone->kone_lock); in kone_sysfs_read_settings()
279 memcpy(buf, ((char const *)&kone->settings) + off, count); in kone_sysfs_read_settings()
280 mutex_unlock(&kone->kone_lock); in kone_sysfs_read_settings()
294 struct kone_device *kone = hid_get_drvdata(dev_get_drvdata(dev)); in kone_sysfs_write_settings() local
303 mutex_lock(&kone->kone_lock); in kone_sysfs_write_settings()
304 difference = memcmp(settings, &kone->settings, in kone_sysfs_write_settings()
317 old_profile = kone->settings.startup_profile; in kone_sysfs_write_settings()
318 memcpy(&kone->settings, settings, sizeof(struct kone_settings)); in kone_sysfs_write_settings()
320 kone_profile_activated(kone, kone->settings.startup_profile); in kone_sysfs_write_settings()
322 if (kone->settings.startup_profile != old_profile) in kone_sysfs_write_settings()
323 kone_profile_report(kone, kone->settings.startup_profile); in kone_sysfs_write_settings()
326 mutex_unlock(&kone->kone_lock); in kone_sysfs_write_settings()
340 struct kone_device *kone = hid_get_drvdata(dev_get_drvdata(dev)); in kone_sysfs_read_profilex() local
348 mutex_lock(&kone->kone_lock); in kone_sysfs_read_profilex()
349 memcpy(buf, ((char const *)&kone->profiles[*(uint *)(attr->private)]) + off, count); in kone_sysfs_read_profilex()
350 mutex_unlock(&kone->kone_lock); in kone_sysfs_read_profilex()
360 struct kone_device *kone = hid_get_drvdata(dev_get_drvdata(dev)); in kone_sysfs_write_profilex() local
369 profile = &kone->profiles[*(uint *)(attr->private)]; in kone_sysfs_write_profilex()
371 mutex_lock(&kone->kone_lock); in kone_sysfs_write_profilex()
380 mutex_unlock(&kone->kone_lock); in kone_sysfs_write_profilex()
404 struct kone_device *kone = in kone_sysfs_show_actual_profile() local
406 return snprintf(buf, PAGE_SIZE, "%d\n", kone->actual_profile); in kone_sysfs_show_actual_profile()
413 struct kone_device *kone = in kone_sysfs_show_actual_dpi() local
415 return snprintf(buf, PAGE_SIZE, "%d\n", kone->actual_dpi); in kone_sysfs_show_actual_dpi()
423 struct kone_device *kone; in kone_sysfs_show_weight() local
429 kone = hid_get_drvdata(dev_get_drvdata(dev)); in kone_sysfs_show_weight()
432 mutex_lock(&kone->kone_lock); in kone_sysfs_show_weight()
434 mutex_unlock(&kone->kone_lock); in kone_sysfs_show_weight()
445 struct kone_device *kone = in kone_sysfs_show_firmware_version() local
447 return snprintf(buf, PAGE_SIZE, "%d\n", kone->firmware_version); in kone_sysfs_show_firmware_version()
455 struct kone_device *kone = in kone_sysfs_show_tcu() local
457 return snprintf(buf, PAGE_SIZE, "%d\n", kone->settings.tcu); in kone_sysfs_show_tcu()
475 struct kone_device *kone; in kone_sysfs_set_tcu() local
481 kone = hid_get_drvdata(dev_get_drvdata(dev)); in kone_sysfs_set_tcu()
491 mutex_lock(&kone->kone_lock); in kone_sysfs_set_tcu()
520 retval = kone_get_settings(usb_dev, &kone->settings); in kone_sysfs_set_tcu()
525 if (kone->settings.tcu != state) { in kone_sysfs_set_tcu()
526 kone->settings.tcu = state; in kone_sysfs_set_tcu()
527 kone_set_settings_checksum(&kone->settings); in kone_sysfs_set_tcu()
529 retval = kone_set_settings(usb_dev, &kone->settings); in kone_sysfs_set_tcu()
536 retval = kone_get_settings(usb_dev, &kone->settings); in kone_sysfs_set_tcu()
542 kone_profile_activated(kone, kone->settings.startup_profile); in kone_sysfs_set_tcu()
549 mutex_unlock(&kone->kone_lock); in kone_sysfs_set_tcu()
557 struct kone_device *kone = in kone_sysfs_show_startup_profile() local
559 return snprintf(buf, PAGE_SIZE, "%d\n", kone->settings.startup_profile); in kone_sysfs_show_startup_profile()
565 struct kone_device *kone; in kone_sysfs_set_startup_profile() local
571 kone = hid_get_drvdata(dev_get_drvdata(dev)); in kone_sysfs_set_startup_profile()
581 mutex_lock(&kone->kone_lock); in kone_sysfs_set_startup_profile()
583 kone->settings.startup_profile = new_startup_profile; in kone_sysfs_set_startup_profile()
584 kone_set_settings_checksum(&kone->settings); in kone_sysfs_set_startup_profile()
586 retval = kone_set_settings(usb_dev, &kone->settings); in kone_sysfs_set_startup_profile()
588 mutex_unlock(&kone->kone_lock); in kone_sysfs_set_startup_profile()
593 kone_profile_activated(kone, new_startup_profile); in kone_sysfs_set_startup_profile()
594 kone_profile_report(kone, new_startup_profile); in kone_sysfs_set_startup_profile()
596 mutex_unlock(&kone->kone_lock); in kone_sysfs_set_startup_profile()
661 struct kone_device *kone) in kone_init_kone_device_struct() argument
666 mutex_init(&kone->kone_lock); in kone_init_kone_device_struct()
669 retval = kone_get_profile(usb_dev, &kone->profiles[i], i + 1); in kone_init_kone_device_struct()
674 retval = kone_get_settings(usb_dev, &kone->settings); in kone_init_kone_device_struct()
678 retval = kone_get_firmware_version(usb_dev, &kone->firmware_version); in kone_init_kone_device_struct()
682 kone_profile_activated(kone, kone->settings.startup_profile); in kone_init_kone_device_struct()
698 struct kone_device *kone; in kone_init_specials() local
704 kone = kzalloc(sizeof(*kone), GFP_KERNEL); in kone_init_specials()
705 if (!kone) in kone_init_specials()
707 hid_set_drvdata(hdev, kone); in kone_init_specials()
709 retval = kone_init_kone_device_struct(usb_dev, kone); in kone_init_specials()
721 kone->roccat_claimed = 1; in kone_init_specials()
722 kone->chrdev_minor = retval; in kone_init_specials()
730 kfree(kone); in kone_init_specials()
737 struct kone_device *kone; in kone_remove_specials() local
741 kone = hid_get_drvdata(hdev); in kone_remove_specials()
742 if (kone->roccat_claimed) in kone_remove_specials()
743 roccat_disconnect(kone->chrdev_minor); in kone_remove_specials()
788 static void kone_keep_values_up_to_date(struct kone_device *kone, in kone_keep_values_up_to_date() argument
793 kone->actual_dpi = kone->profiles[event->value - 1]. in kone_keep_values_up_to_date()
797 kone->actual_profile = event->value; in kone_keep_values_up_to_date()
801 kone->actual_dpi = event->value; in kone_keep_values_up_to_date()
806 static void kone_report_to_chrdev(struct kone_device const *kone, in kone_report_to_chrdev() argument
819 roccat_report_event(kone->chrdev_minor, in kone_report_to_chrdev()
826 roccat_report.value = kone->actual_profile; in kone_report_to_chrdev()
828 roccat_report_event(kone->chrdev_minor, in kone_report_to_chrdev()
844 struct kone_device *kone = hid_get_drvdata(hdev); in kone_raw_event() local
851 if (kone == NULL) in kone_raw_event()
859 if (memcmp(&kone->last_mouse_event.tilt, &event->tilt, 5)) in kone_raw_event()
860 memcpy(&kone->last_mouse_event, event, in kone_raw_event()
865 kone_keep_values_up_to_date(kone, event); in kone_raw_event()
867 if (kone->roccat_claimed) in kone_raw_event()
868 kone_report_to_chrdev(kone, event); in kone_raw_event()