Lines Matching refs:sc
518 static void sony_set_leds(struct sony_sc *sc);
520 static inline void sony_schedule_work(struct sony_sc *sc, in sony_schedule_work() argument
527 spin_lock_irqsave(&sc->lock, flags); in sony_schedule_work()
528 if (!sc->defer_initialization && sc->state_worker_initialized) in sony_schedule_work()
529 schedule_work(&sc->state_worker); in sony_schedule_work()
530 spin_unlock_irqrestore(&sc->lock, flags); in sony_schedule_work()
537 struct sony_sc *sc = urb->context; in ghl_magic_poke_cb() local
540 hid_err(sc->hdev, "URB transfer failed : %d", urb->status); in ghl_magic_poke_cb()
542 mod_timer(&sc->ghl_poke_timer, jiffies + GHL_GUITAR_POKE_INTERVAL*HZ); in ghl_magic_poke_cb()
548 struct sony_sc *sc = from_timer(sc, t, ghl_poke_timer); in ghl_magic_poke() local
550 ret = usb_submit_urb(sc->ghl_urb, GFP_ATOMIC); in ghl_magic_poke()
552 hid_err(sc->hdev, "usb_submit_urb failed: %d", ret); in ghl_magic_poke()
555 static int ghl_init_urb(struct sony_sc *sc, struct usb_device *usbdev, in ghl_init_urb() argument
565 cr = devm_kzalloc(&sc->hdev->dev, sizeof(*cr), GFP_ATOMIC); in ghl_init_urb()
569 databuf = devm_kzalloc(&sc->hdev->dev, poke_size, GFP_ATOMIC); in ghl_init_urb()
581 sc->ghl_urb, usbdev, pipe, in ghl_init_urb()
583 ghl_magic_poke_cb, sc); in ghl_init_urb()
749 struct sony_sc *sc = hid_get_drvdata(hdev); in sony_report_fixup() local
751 if (sc->quirks & (SINO_LITE_CONTROLLER | FUTUREMAX_DANCE_MAT)) in sony_report_fixup()
758 if ((sc->quirks & VAIO_RDESC_CONSTANT) && *rsize >= 56 && in sony_report_fixup()
770 if (sc->quirks & MOTION_CONTROLLER) in sony_report_fixup()
773 if (sc->quirks & PS3REMOTE) in sony_report_fixup()
780 if ((sc->quirks & SIXAXIS_CONTROLLER_USB) && *rsize >= 45 && in sony_report_fixup()
796 static void sixaxis_parse_report(struct sony_sc *sc, u8 *rd, int size) in sixaxis_parse_report() argument
810 offset = (sc->quirks & MOTION_CONTROLLER) ? 12 : 30; in sixaxis_parse_report()
821 spin_lock_irqsave(&sc->lock, flags); in sixaxis_parse_report()
822 sc->battery_capacity = battery_capacity; in sixaxis_parse_report()
823 sc->battery_status = battery_status; in sixaxis_parse_report()
824 spin_unlock_irqrestore(&sc->lock, flags); in sixaxis_parse_report()
826 if (sc->quirks & SIXAXIS_CONTROLLER) { in sixaxis_parse_report()
831 input_report_abs(sc->sensor_dev, ABS_X, val); in sixaxis_parse_report()
835 input_report_abs(sc->sensor_dev, ABS_Y, val); in sixaxis_parse_report()
838 input_report_abs(sc->sensor_dev, ABS_Z, val); in sixaxis_parse_report()
840 input_sync(sc->sensor_dev); in sixaxis_parse_report()
844 static void nsg_mrxu_parse_report(struct sony_sc *sc, u8 *rd, int size) in nsg_mrxu_parse_report() argument
869 input_report_key(sc->touchpad, BTN_LEFT, rd[offset] & 0x0F); in nsg_mrxu_parse_report()
883 input_mt_slot(sc->touchpad, n); in nsg_mrxu_parse_report()
884 input_mt_report_slot_state(sc->touchpad, MT_TOOL_FINGER, active & 0x03); in nsg_mrxu_parse_report()
889 input_report_abs(sc->touchpad, ABS_MT_TOUCH_MAJOR, in nsg_mrxu_parse_report()
891 input_report_abs(sc->touchpad, ABS_MT_TOUCH_MINOR, in nsg_mrxu_parse_report()
893 input_report_abs(sc->touchpad, ABS_MT_ORIENTATION, in nsg_mrxu_parse_report()
895 input_report_abs(sc->touchpad, ABS_MT_POSITION_X, x); in nsg_mrxu_parse_report()
896 input_report_abs(sc->touchpad, ABS_MT_POSITION_Y, in nsg_mrxu_parse_report()
904 input_report_rel(sc->touchpad, REL_X, relx); in nsg_mrxu_parse_report()
905 input_report_rel(sc->touchpad, REL_Y, rely); in nsg_mrxu_parse_report()
913 input_mt_sync_frame(sc->touchpad); in nsg_mrxu_parse_report()
915 input_sync(sc->touchpad); in nsg_mrxu_parse_report()
921 struct sony_sc *sc = hid_get_drvdata(hdev); in sony_raw_event() local
927 if ((sc->quirks & SIXAXIS_CONTROLLER) && rd[0] == 0x01 && size == 49) { in sony_raw_event()
944 sixaxis_parse_report(sc, rd, size); in sony_raw_event()
945 } else if ((sc->quirks & MOTION_CONTROLLER_BT) && rd[0] == 0x01 && size == 49) { in sony_raw_event()
946 sixaxis_parse_report(sc, rd, size); in sony_raw_event()
947 } else if ((sc->quirks & NAVIGATION_CONTROLLER) && rd[0] == 0x01 && in sony_raw_event()
949 sixaxis_parse_report(sc, rd, size); in sony_raw_event()
950 } else if ((sc->quirks & NSG_MRXU_REMOTE) && rd[0] == 0x02) { in sony_raw_event()
951 nsg_mrxu_parse_report(sc, rd, size); in sony_raw_event()
955 if (sc->defer_initialization) { in sony_raw_event()
956 sc->defer_initialization = 0; in sony_raw_event()
957 sony_schedule_work(sc, SONY_WORKER_STATE); in sony_raw_event()
967 struct sony_sc *sc = hid_get_drvdata(hdev); in sony_mapping() local
969 if (sc->quirks & BUZZ_CONTROLLER) { in sony_mapping()
992 if (sc->quirks & PS3REMOTE) in sony_mapping()
995 if (sc->quirks & NAVIGATION_CONTROLLER) in sony_mapping()
998 if (sc->quirks & SIXAXIS_CONTROLLER) in sony_mapping()
1001 if (sc->quirks & GH_GUITAR_CONTROLLER) in sony_mapping()
1008 static int sony_register_touchpad(struct sony_sc *sc, int touch_count, in sony_register_touchpad() argument
1015 sc->touchpad = devm_input_allocate_device(&sc->hdev->dev); in sony_register_touchpad()
1016 if (!sc->touchpad) in sony_register_touchpad()
1019 input_set_drvdata(sc->touchpad, sc); in sony_register_touchpad()
1020 sc->touchpad->dev.parent = &sc->hdev->dev; in sony_register_touchpad()
1021 sc->touchpad->phys = sc->hdev->phys; in sony_register_touchpad()
1022 sc->touchpad->uniq = sc->hdev->uniq; in sony_register_touchpad()
1023 sc->touchpad->id.bustype = sc->hdev->bus; in sony_register_touchpad()
1024 sc->touchpad->id.vendor = sc->hdev->vendor; in sony_register_touchpad()
1025 sc->touchpad->id.product = sc->hdev->product; in sony_register_touchpad()
1026 sc->touchpad->id.version = sc->hdev->version; in sony_register_touchpad()
1034 name_sz = strlen(sc->hdev->name) + sizeof(TOUCHPAD_SUFFIX); in sony_register_touchpad()
1035 name = devm_kzalloc(&sc->hdev->dev, name_sz, GFP_KERNEL); in sony_register_touchpad()
1038 snprintf(name, name_sz, "%s" TOUCHPAD_SUFFIX, sc->hdev->name); in sony_register_touchpad()
1039 sc->touchpad->name = name; in sony_register_touchpad()
1042 __set_bit(EV_KEY, sc->touchpad->evbit); in sony_register_touchpad()
1043 __set_bit(BTN_LEFT, sc->touchpad->keybit); in sony_register_touchpad()
1044 __set_bit(INPUT_PROP_BUTTONPAD, sc->touchpad->propbit); in sony_register_touchpad()
1046 input_set_abs_params(sc->touchpad, ABS_MT_POSITION_X, 0, w, 0, 0); in sony_register_touchpad()
1047 input_set_abs_params(sc->touchpad, ABS_MT_POSITION_Y, 0, h, 0, 0); in sony_register_touchpad()
1050 input_set_abs_params(sc->touchpad, ABS_MT_TOUCH_MAJOR, in sony_register_touchpad()
1053 input_set_abs_params(sc->touchpad, ABS_MT_TOUCH_MINOR, in sony_register_touchpad()
1056 input_set_abs_params(sc->touchpad, ABS_MT_ORIENTATION, in sony_register_touchpad()
1060 if (sc->quirks & NSG_MRXU_REMOTE) { in sony_register_touchpad()
1061 __set_bit(EV_REL, sc->touchpad->evbit); in sony_register_touchpad()
1064 ret = input_mt_init_slots(sc->touchpad, touch_count, INPUT_MT_POINTER); in sony_register_touchpad()
1068 ret = input_register_device(sc->touchpad); in sony_register_touchpad()
1075 static int sony_register_sensors(struct sony_sc *sc) in sony_register_sensors() argument
1081 sc->sensor_dev = devm_input_allocate_device(&sc->hdev->dev); in sony_register_sensors()
1082 if (!sc->sensor_dev) in sony_register_sensors()
1085 input_set_drvdata(sc->sensor_dev, sc); in sony_register_sensors()
1086 sc->sensor_dev->dev.parent = &sc->hdev->dev; in sony_register_sensors()
1087 sc->sensor_dev->phys = sc->hdev->phys; in sony_register_sensors()
1088 sc->sensor_dev->uniq = sc->hdev->uniq; in sony_register_sensors()
1089 sc->sensor_dev->id.bustype = sc->hdev->bus; in sony_register_sensors()
1090 sc->sensor_dev->id.vendor = sc->hdev->vendor; in sony_register_sensors()
1091 sc->sensor_dev->id.product = sc->hdev->product; in sony_register_sensors()
1092 sc->sensor_dev->id.version = sc->hdev->version; in sony_register_sensors()
1097 name_sz = strlen(sc->hdev->name) + sizeof(SENSOR_SUFFIX); in sony_register_sensors()
1098 name = devm_kzalloc(&sc->hdev->dev, name_sz, GFP_KERNEL); in sony_register_sensors()
1101 snprintf(name, name_sz, "%s" SENSOR_SUFFIX, sc->hdev->name); in sony_register_sensors()
1102 sc->sensor_dev->name = name; in sony_register_sensors()
1104 if (sc->quirks & SIXAXIS_CONTROLLER) { in sony_register_sensors()
1111 input_set_abs_params(sc->sensor_dev, ABS_X, -512, 511, 4, 0); in sony_register_sensors()
1112 input_set_abs_params(sc->sensor_dev, ABS_Y, -512, 511, 4, 0); in sony_register_sensors()
1113 input_set_abs_params(sc->sensor_dev, ABS_Z, -512, 511, 4, 0); in sony_register_sensors()
1114 input_abs_set_res(sc->sensor_dev, ABS_X, SIXAXIS_ACC_RES_PER_G); in sony_register_sensors()
1115 input_abs_set_res(sc->sensor_dev, ABS_Y, SIXAXIS_ACC_RES_PER_G); in sony_register_sensors()
1116 input_abs_set_res(sc->sensor_dev, ABS_Z, SIXAXIS_ACC_RES_PER_G); in sony_register_sensors()
1119 __set_bit(INPUT_PROP_ACCELEROMETER, sc->sensor_dev->propbit); in sony_register_sensors()
1121 ret = input_register_device(sc->sensor_dev); in sony_register_sensors()
1135 struct sony_sc *sc = hid_get_drvdata(hdev); in sixaxis_set_operational_usb() local
1167 if (sc->quirks & SHANWAN_GAMEPAD) in sixaxis_set_operational_usb()
1200 static void sixaxis_set_leds_from_id(struct sony_sc *sc) in sixaxis_set_leds_from_id() argument
1215 int id = sc->device_id; in sixaxis_set_leds_from_id()
1223 memcpy(sc->led_state, sixaxis_leds[id], sizeof(sixaxis_leds[id])); in sixaxis_set_leds_from_id()
1226 static void buzz_set_leds(struct sony_sc *sc) in buzz_set_leds() argument
1228 struct hid_device *hdev = sc->hdev; in buzz_set_leds()
1238 value[1] = sc->led_state[0] ? 0xff : 0x00; in buzz_set_leds()
1239 value[2] = sc->led_state[1] ? 0xff : 0x00; in buzz_set_leds()
1240 value[3] = sc->led_state[2] ? 0xff : 0x00; in buzz_set_leds()
1241 value[4] = sc->led_state[3] ? 0xff : 0x00; in buzz_set_leds()
1247 static void sony_set_leds(struct sony_sc *sc) in sony_set_leds() argument
1249 if (!(sc->quirks & BUZZ_CONTROLLER)) in sony_set_leds()
1250 sony_schedule_work(sc, SONY_WORKER_STATE); in sony_set_leds()
1252 buzz_set_leds(sc); in sony_set_leds()
1367 static int sony_leds_init(struct sony_sc *sc) in sony_leds_init() argument
1369 struct hid_device *hdev = sc->hdev; in sony_leds_init()
1382 BUG_ON(!(sc->quirks & SONY_LED_SUPPORT)); in sony_leds_init()
1384 if (sc->quirks & BUZZ_CONTROLLER) { in sony_leds_init()
1385 sc->led_count = 4; in sony_leds_init()
1392 } else if (sc->quirks & MOTION_CONTROLLER) { in sony_leds_init()
1393 sc->led_count = 3; in sony_leds_init()
1398 } else if (sc->quirks & NAVIGATION_CONTROLLER) { in sony_leds_init()
1401 memcpy(sc->led_state, navigation_leds, sizeof(navigation_leds)); in sony_leds_init()
1402 sc->led_count = 1; in sony_leds_init()
1408 sixaxis_set_leds_from_id(sc); in sony_leds_init()
1409 sc->led_count = 4; in sony_leds_init()
1421 sony_set_leds(sc); in sony_leds_init()
1425 for (n = 0; n < sc->led_count; n++) { in sony_leds_init()
1443 led->brightness = sc->led_state[n]; in sony_leds_init()
1452 sc->leds[n] = led; in sony_leds_init()
1464 static void sixaxis_send_output_report(struct sony_sc *sc) in sixaxis_send_output_report() argument
1479 (struct sixaxis_output_report *)sc->output_report_dmabuf; in sixaxis_send_output_report()
1486 report->rumble.right_motor_on = sc->right ? 1 : 0; in sixaxis_send_output_report()
1487 report->rumble.left_motor_force = sc->left; in sixaxis_send_output_report()
1490 report->leds_bitmap |= sc->led_state[0] << 1; in sixaxis_send_output_report()
1491 report->leds_bitmap |= sc->led_state[1] << 2; in sixaxis_send_output_report()
1492 report->leds_bitmap |= sc->led_state[2] << 3; in sixaxis_send_output_report()
1493 report->leds_bitmap |= sc->led_state[3] << 4; in sixaxis_send_output_report()
1509 if (sc->led_delay_on[n] || sc->led_delay_off[n]) { in sixaxis_send_output_report()
1510 report->led[3 - n].duty_off = sc->led_delay_off[n]; in sixaxis_send_output_report()
1511 report->led[3 - n].duty_on = sc->led_delay_on[n]; in sixaxis_send_output_report()
1516 if (sc->quirks & SHANWAN_GAMEPAD) in sixaxis_send_output_report()
1517 hid_hw_output_report(sc->hdev, (u8 *)report, in sixaxis_send_output_report()
1520 hid_hw_raw_request(sc->hdev, report->report_id, (u8 *)report, in sixaxis_send_output_report()
1525 static void motion_send_output_report(struct sony_sc *sc) in motion_send_output_report() argument
1527 struct hid_device *hdev = sc->hdev; in motion_send_output_report()
1529 (struct motion_output_report_02 *)sc->output_report_dmabuf; in motion_send_output_report()
1534 report->r = sc->led_state[0]; in motion_send_output_report()
1535 report->g = sc->led_state[1]; in motion_send_output_report()
1536 report->b = sc->led_state[2]; in motion_send_output_report()
1539 report->rumble = max(sc->right, sc->left); in motion_send_output_report()
1546 static inline void sony_send_output_report(struct sony_sc *sc) in sony_send_output_report() argument
1548 if (sc->send_output_report) in sony_send_output_report()
1549 sc->send_output_report(sc); in sony_send_output_report()
1555 struct sony_sc *sc = container_of(work, struct sony_sc, state_worker); in sony_state_worker() local
1557 sc->send_output_report(sc); in sony_state_worker()
1560 static int sony_allocate_output_report(struct sony_sc *sc) in sony_allocate_output_report() argument
1562 if ((sc->quirks & SIXAXIS_CONTROLLER) || in sony_allocate_output_report()
1563 (sc->quirks & NAVIGATION_CONTROLLER)) in sony_allocate_output_report()
1564 sc->output_report_dmabuf = in sony_allocate_output_report()
1565 devm_kmalloc(&sc->hdev->dev, in sony_allocate_output_report()
1568 else if (sc->quirks & MOTION_CONTROLLER) in sony_allocate_output_report()
1569 sc->output_report_dmabuf = devm_kmalloc(&sc->hdev->dev, in sony_allocate_output_report()
1575 if (!sc->output_report_dmabuf) in sony_allocate_output_report()
1586 struct sony_sc *sc = hid_get_drvdata(hid); in sony_play_effect() local
1591 sc->left = effect->u.rumble.strong_magnitude / 256; in sony_play_effect()
1592 sc->right = effect->u.rumble.weak_magnitude / 256; in sony_play_effect()
1594 sony_schedule_work(sc, SONY_WORKER_STATE); in sony_play_effect()
1598 static int sony_init_ff(struct sony_sc *sc) in sony_init_ff() argument
1603 if (list_empty(&sc->hdev->inputs)) { in sony_init_ff()
1604 hid_err(sc->hdev, "no inputs found\n"); in sony_init_ff()
1607 hidinput = list_entry(sc->hdev->inputs.next, struct hid_input, list); in sony_init_ff()
1615 static int sony_init_ff(struct sony_sc *sc) in sony_init_ff() argument
1626 struct sony_sc *sc = power_supply_get_drvdata(psy); in sony_battery_get_property() local
1632 spin_lock_irqsave(&sc->lock, flags); in sony_battery_get_property()
1633 battery_capacity = sc->battery_capacity; in sony_battery_get_property()
1634 battery_status = sc->battery_status; in sony_battery_get_property()
1635 spin_unlock_irqrestore(&sc->lock, flags); in sony_battery_get_property()
1657 static int sony_battery_probe(struct sony_sc *sc, int append_dev_id) in sony_battery_probe() argument
1662 struct power_supply_config psy_cfg = { .drv_data = sc, }; in sony_battery_probe()
1663 struct hid_device *hdev = sc->hdev; in sony_battery_probe()
1670 sc->battery_capacity = 100; in sony_battery_probe()
1672 sc->battery_desc.properties = sony_battery_props; in sony_battery_probe()
1673 sc->battery_desc.num_properties = ARRAY_SIZE(sony_battery_props); in sony_battery_probe()
1674 sc->battery_desc.get_property = sony_battery_get_property; in sony_battery_probe()
1675 sc->battery_desc.type = POWER_SUPPLY_TYPE_BATTERY; in sony_battery_probe()
1676 sc->battery_desc.use_for_apm = 0; in sony_battery_probe()
1677 sc->battery_desc.name = devm_kasprintf(&hdev->dev, GFP_KERNEL, in sony_battery_probe()
1678 battery_str_fmt, sc->mac_address, sc->device_id); in sony_battery_probe()
1679 if (!sc->battery_desc.name) in sony_battery_probe()
1682 sc->battery = devm_power_supply_register(&hdev->dev, &sc->battery_desc, in sony_battery_probe()
1684 if (IS_ERR(sc->battery)) { in sony_battery_probe()
1685 ret = PTR_ERR(sc->battery); in sony_battery_probe()
1690 power_supply_powers(sc->battery, &hdev->dev); in sony_battery_probe()
1714 static int sony_check_add_dev_list(struct sony_sc *sc) in sony_check_add_dev_list() argument
1723 ret = memcmp(sc->mac_address, entry->mac_address, in sony_check_add_dev_list()
1724 sizeof(sc->mac_address)); in sony_check_add_dev_list()
1726 if (sony_compare_connection_type(sc, entry)) { in sony_check_add_dev_list()
1730 hid_info(sc->hdev, in sony_check_add_dev_list()
1732 sc->mac_address); in sony_check_add_dev_list()
1739 list_add(&(sc->list_node), &sony_device_list); in sony_check_add_dev_list()
1746 static void sony_remove_dev_list(struct sony_sc *sc) in sony_remove_dev_list() argument
1750 if (sc->list_node.next) { in sony_remove_dev_list()
1752 list_del(&(sc->list_node)); in sony_remove_dev_list()
1757 static int sony_get_bt_devaddr(struct sony_sc *sc) in sony_get_bt_devaddr() argument
1762 ret = strlen(sc->hdev->uniq); in sony_get_bt_devaddr()
1766 ret = sscanf(sc->hdev->uniq, in sony_get_bt_devaddr()
1768 &sc->mac_address[5], &sc->mac_address[4], &sc->mac_address[3], in sony_get_bt_devaddr()
1769 &sc->mac_address[2], &sc->mac_address[1], &sc->mac_address[0]); in sony_get_bt_devaddr()
1777 static int sony_check_add(struct sony_sc *sc) in sony_check_add() argument
1782 if ((sc->quirks & MOTION_CONTROLLER_BT) || in sony_check_add()
1783 (sc->quirks & NAVIGATION_CONTROLLER_BT) || in sony_check_add()
1784 (sc->quirks & SIXAXIS_CONTROLLER_BT)) { in sony_check_add()
1791 if (sony_get_bt_devaddr(sc) < 0) { in sony_check_add()
1792 hid_warn(sc->hdev, "UNIQ does not contain a MAC address; duplicate check skipped\n"); in sony_check_add()
1795 } else if ((sc->quirks & SIXAXIS_CONTROLLER_USB) || in sony_check_add()
1796 (sc->quirks & NAVIGATION_CONTROLLER_USB)) { in sony_check_add()
1806 ret = hid_hw_raw_request(sc->hdev, 0xf2, buf, in sony_check_add()
1811 hid_err(sc->hdev, "failed to retrieve feature report 0xf2 with the Sixaxis MAC address\n"); in sony_check_add()
1821 sc->mac_address[5-n] = buf[4+n]; in sony_check_add()
1823 snprintf(sc->hdev->uniq, sizeof(sc->hdev->uniq), in sony_check_add()
1824 "%pMR", sc->mac_address); in sony_check_add()
1829 ret = sony_check_add_dev_list(sc); in sony_check_add()
1838 static int sony_set_device_id(struct sony_sc *sc) in sony_set_device_id() argument
1846 if (sc->quirks & SIXAXIS_CONTROLLER) { in sony_set_device_id()
1850 sc->device_id = -1; in sony_set_device_id()
1853 sc->device_id = ret; in sony_set_device_id()
1855 sc->device_id = -1; in sony_set_device_id()
1861 static void sony_release_device_id(struct sony_sc *sc) in sony_release_device_id() argument
1863 if (sc->device_id >= 0) { in sony_release_device_id()
1864 ida_simple_remove(&sony_device_id_allocator, sc->device_id); in sony_release_device_id()
1865 sc->device_id = -1; in sony_release_device_id()
1869 static inline void sony_init_output_report(struct sony_sc *sc, in sony_init_output_report() argument
1872 sc->send_output_report = send_output_report; in sony_init_output_report()
1874 if (!sc->state_worker_initialized) in sony_init_output_report()
1875 INIT_WORK(&sc->state_worker, sony_state_worker); in sony_init_output_report()
1877 sc->state_worker_initialized = 1; in sony_init_output_report()
1880 static inline void sony_cancel_work_sync(struct sony_sc *sc) in sony_cancel_work_sync() argument
1884 if (sc->state_worker_initialized) { in sony_cancel_work_sync()
1885 spin_lock_irqsave(&sc->lock, flags); in sony_cancel_work_sync()
1886 sc->state_worker_initialized = 0; in sony_cancel_work_sync()
1887 spin_unlock_irqrestore(&sc->lock, flags); in sony_cancel_work_sync()
1888 cancel_work_sync(&sc->state_worker); in sony_cancel_work_sync()
1895 struct sony_sc *sc = hid_get_drvdata(hdev); in sony_input_configured() local
1899 ret = sony_set_device_id(sc); in sony_input_configured()
1905 ret = append_dev_id = sony_check_add(sc); in sony_input_configured()
1909 ret = sony_allocate_output_report(sc); in sony_input_configured()
1915 if (sc->quirks & NAVIGATION_CONTROLLER_USB) { in sony_input_configured()
1934 sc->defer_initialization = 1; in sony_input_configured()
1942 sony_init_output_report(sc, sixaxis_send_output_report); in sony_input_configured()
1943 } else if (sc->quirks & NAVIGATION_CONTROLLER_BT) { in sony_input_configured()
1956 sony_init_output_report(sc, sixaxis_send_output_report); in sony_input_configured()
1957 } else if (sc->quirks & SIXAXIS_CONTROLLER_USB) { in sony_input_configured()
1966 sc->defer_initialization = 1; in sony_input_configured()
1974 ret = sony_register_sensors(sc); in sony_input_configured()
1976 hid_err(sc->hdev, in sony_input_configured()
1981 sony_init_output_report(sc, sixaxis_send_output_report); in sony_input_configured()
1982 } else if (sc->quirks & SIXAXIS_CONTROLLER_BT) { in sony_input_configured()
1995 ret = sony_register_sensors(sc); in sony_input_configured()
1997 hid_err(sc->hdev, in sony_input_configured()
2002 sony_init_output_report(sc, sixaxis_send_output_report); in sony_input_configured()
2003 } else if (sc->quirks & NSG_MRXU_REMOTE) { in sony_input_configured()
2008 ret = sony_register_touchpad(sc, 2, in sony_input_configured()
2011 hid_err(sc->hdev, in sony_input_configured()
2017 } else if (sc->quirks & MOTION_CONTROLLER) { in sony_input_configured()
2018 sony_init_output_report(sc, motion_send_output_report); in sony_input_configured()
2023 if (sc->quirks & SONY_LED_SUPPORT) { in sony_input_configured()
2024 ret = sony_leds_init(sc); in sony_input_configured()
2029 if (sc->quirks & SONY_BATTERY_SUPPORT) { in sony_input_configured()
2030 ret = sony_battery_probe(sc, append_dev_id); in sony_input_configured()
2042 if (sc->quirks & SONY_FF_SUPPORT) { in sony_input_configured()
2043 ret = sony_init_ff(sc); in sony_input_configured()
2052 sony_cancel_work_sync(sc); in sony_input_configured()
2053 sony_remove_dev_list(sc); in sony_input_configured()
2054 sony_release_device_id(sc); in sony_input_configured()
2062 struct sony_sc *sc; in sony_probe() local
2073 sc = devm_kzalloc(&hdev->dev, sizeof(*sc), GFP_KERNEL); in sony_probe()
2074 if (sc == NULL) { in sony_probe()
2079 spin_lock_init(&sc->lock); in sony_probe()
2081 sc->quirks = quirks; in sony_probe()
2082 hid_set_drvdata(hdev, sc); in sony_probe()
2083 sc->hdev = hdev; in sony_probe()
2091 if (sc->quirks & VAIO_RDESC_CONSTANT) in sony_probe()
2093 else if (sc->quirks & SIXAXIS_CONTROLLER) in sony_probe()
2102 if (sc->quirks & SIXAXIS_CONTROLLER) in sony_probe()
2125 if (sc->quirks & (GHL_GUITAR_PS3WIIU | GHL_GUITAR_PS4)) { in sony_probe()
2131 usbdev = to_usb_device(sc->hdev->dev.parent->parent); in sony_probe()
2133 sc->ghl_urb = usb_alloc_urb(0, GFP_ATOMIC); in sony_probe()
2134 if (!sc->ghl_urb) { in sony_probe()
2139 if (sc->quirks & GHL_GUITAR_PS3WIIU) in sony_probe()
2140 ret = ghl_init_urb(sc, usbdev, ghl_ps3wiiu_magic_data, in sony_probe()
2142 else if (sc->quirks & GHL_GUITAR_PS4) in sony_probe()
2143 ret = ghl_init_urb(sc, usbdev, ghl_ps4_magic_data, in sony_probe()
2150 timer_setup(&sc->ghl_poke_timer, ghl_magic_poke, 0); in sony_probe()
2151 mod_timer(&sc->ghl_poke_timer, in sony_probe()
2158 usb_free_urb(sc->ghl_urb); in sony_probe()
2166 struct sony_sc *sc = hid_get_drvdata(hdev); in sony_remove() local
2168 if (sc->quirks & (GHL_GUITAR_PS3WIIU | GHL_GUITAR_PS4)) { in sony_remove()
2169 del_timer_sync(&sc->ghl_poke_timer); in sony_remove()
2170 usb_free_urb(sc->ghl_urb); in sony_remove()
2175 sony_cancel_work_sync(sc); in sony_remove()
2177 sony_remove_dev_list(sc); in sony_remove()
2179 sony_release_device_id(sc); in sony_remove()
2192 struct sony_sc *sc = hid_get_drvdata(hdev); in sony_suspend() local
2194 sc->left = sc->right = 0; in sony_suspend()
2195 sony_send_output_report(sc); in sony_suspend()
2204 struct sony_sc *sc = hid_get_drvdata(hdev); in sony_resume() local
2210 if ((sc->quirks & SIXAXIS_CONTROLLER_USB) || in sony_resume()
2211 (sc->quirks & NAVIGATION_CONTROLLER_USB)) { in sony_resume()
2212 sixaxis_set_operational_usb(sc->hdev); in sony_resume()
2213 sc->defer_initialization = 1; in sony_resume()