Lines Matching refs:sc
615 static void sony_set_leds(struct sony_sc *sc);
617 static inline void sony_schedule_work(struct sony_sc *sc, in sony_schedule_work() argument
624 spin_lock_irqsave(&sc->lock, flags); in sony_schedule_work()
625 if (!sc->defer_initialization && sc->state_worker_initialized) in sony_schedule_work()
626 schedule_work(&sc->state_worker); in sony_schedule_work()
627 spin_unlock_irqrestore(&sc->lock, flags); in sony_schedule_work()
630 if (sc->hotplug_worker_initialized) in sony_schedule_work()
631 schedule_work(&sc->hotplug_worker); in sony_schedule_work()
638 struct sony_sc *sc = urb->context; in ghl_magic_poke_cb() local
641 hid_err(sc->hdev, "URB transfer failed : %d", urb->status); in ghl_magic_poke_cb()
643 mod_timer(&sc->ghl_poke_timer, jiffies + GHL_GUITAR_POKE_INTERVAL*HZ); in ghl_magic_poke_cb()
649 struct sony_sc *sc = from_timer(sc, t, ghl_poke_timer); in ghl_magic_poke() local
651 ret = usb_submit_urb(sc->ghl_urb, GFP_ATOMIC); in ghl_magic_poke()
653 hid_err(sc->hdev, "usb_submit_urb failed: %d", ret); in ghl_magic_poke()
656 static int ghl_init_urb(struct sony_sc *sc, struct usb_device *usbdev, in ghl_init_urb() argument
666 cr = devm_kzalloc(&sc->hdev->dev, sizeof(*cr), GFP_ATOMIC); in ghl_init_urb()
670 databuf = devm_kzalloc(&sc->hdev->dev, poke_size, GFP_ATOMIC); in ghl_init_urb()
682 sc->ghl_urb, usbdev, pipe, in ghl_init_urb()
684 ghl_magic_poke_cb, sc); in ghl_init_urb()
708 struct sony_sc *sc = hid_get_drvdata(hdev); in ds4_show_poll_interval() local
710 return snprintf(buf, PAGE_SIZE, "%i\n", sc->ds4_bt_poll_interval); in ds4_show_poll_interval()
718 struct sony_sc *sc = hid_get_drvdata(hdev); in ds4_store_poll_interval() local
728 spin_lock_irqsave(&sc->lock, flags); in ds4_store_poll_interval()
729 sc->ds4_bt_poll_interval = interval; in ds4_store_poll_interval()
730 spin_unlock_irqrestore(&sc->lock, flags); in ds4_store_poll_interval()
732 sony_schedule_work(sc, SONY_WORKER_STATE); in ds4_store_poll_interval()
745 struct sony_sc *sc = hid_get_drvdata(hdev); in sony_show_firmware_version() local
747 return snprintf(buf, PAGE_SIZE, "0x%04x\n", sc->fw_version); in sony_show_firmware_version()
757 struct sony_sc *sc = hid_get_drvdata(hdev); in sony_show_hardware_version() local
759 return snprintf(buf, PAGE_SIZE, "0x%04x\n", sc->hw_version); in sony_show_hardware_version()
942 struct sony_sc *sc = hid_get_drvdata(hdev); in sony_report_fixup() local
944 if (sc->quirks & (SINO_LITE_CONTROLLER | FUTUREMAX_DANCE_MAT)) in sony_report_fixup()
951 if ((sc->quirks & VAIO_RDESC_CONSTANT) && *rsize >= 56 && in sony_report_fixup()
963 if (sc->quirks & MOTION_CONTROLLER) in sony_report_fixup()
966 if (sc->quirks & PS3REMOTE) in sony_report_fixup()
973 if ((sc->quirks & SIXAXIS_CONTROLLER_USB) && *rsize >= 45 && in sony_report_fixup()
989 static void sixaxis_parse_report(struct sony_sc *sc, u8 *rd, int size) in sixaxis_parse_report() argument
1003 offset = (sc->quirks & MOTION_CONTROLLER) ? 12 : 30; in sixaxis_parse_report()
1014 spin_lock_irqsave(&sc->lock, flags); in sixaxis_parse_report()
1015 sc->battery_capacity = battery_capacity; in sixaxis_parse_report()
1016 sc->battery_status = battery_status; in sixaxis_parse_report()
1017 spin_unlock_irqrestore(&sc->lock, flags); in sixaxis_parse_report()
1019 if (sc->quirks & SIXAXIS_CONTROLLER) { in sixaxis_parse_report()
1024 input_report_abs(sc->sensor_dev, ABS_X, val); in sixaxis_parse_report()
1028 input_report_abs(sc->sensor_dev, ABS_Y, val); in sixaxis_parse_report()
1031 input_report_abs(sc->sensor_dev, ABS_Z, val); in sixaxis_parse_report()
1033 input_sync(sc->sensor_dev); in sixaxis_parse_report()
1037 static void dualshock4_parse_report(struct sony_sc *sc, u8 *rd, int size) in dualshock4_parse_report() argument
1039 struct hid_input *hidinput = list_entry(sc->hdev->inputs.next, in dualshock4_parse_report()
1049 int data_offset = (sc->quirks & DUALSHOCK4_CONTROLLER_BT) ? 2 : 0; in dualshock4_parse_report()
1053 input_report_key(sc->touchpad, BTN_LEFT, rd[offset+2] & 0x2); in dualshock4_parse_report()
1109 if (!sc->timestamp_initialized) { in dualshock4_parse_report()
1110 sc->timestamp_us = ((unsigned int)timestamp * 16) / 3; in dualshock4_parse_report()
1111 sc->timestamp_initialized = true; in dualshock4_parse_report()
1115 if (sc->prev_timestamp > timestamp) in dualshock4_parse_report()
1116 delta = (U16_MAX - sc->prev_timestamp + timestamp + 1); in dualshock4_parse_report()
1118 delta = timestamp - sc->prev_timestamp; in dualshock4_parse_report()
1119 sc->timestamp_us += (delta * 16) / 3; in dualshock4_parse_report()
1121 sc->prev_timestamp = timestamp; in dualshock4_parse_report()
1122 input_event(sc->sensor_dev, EV_MSC, MSC_TIMESTAMP, sc->timestamp_us); in dualshock4_parse_report()
1128 struct ds4_calibration_data *calib = &sc->ds4_calib_data[n]; in dualshock4_parse_report()
1139 input_report_abs(sc->sensor_dev, calib->abs_code, calib_data); in dualshock4_parse_report()
1142 input_sync(sc->sensor_dev); in dualshock4_parse_report()
1193 spin_lock_irqsave(&sc->lock, flags); in dualshock4_parse_report()
1194 sc->battery_capacity = battery_capacity; in dualshock4_parse_report()
1195 sc->battery_status = battery_status; in dualshock4_parse_report()
1196 spin_unlock_irqrestore(&sc->lock, flags); in dualshock4_parse_report()
1205 max_touch_data = (sc->quirks & DUALSHOCK4_CONTROLLER_BT) ? 4 : 3; in dualshock4_parse_report()
1232 input_mt_slot(sc->touchpad, n); in dualshock4_parse_report()
1233 input_mt_report_slot_state(sc->touchpad, MT_TOOL_FINGER, active); in dualshock4_parse_report()
1236 input_report_abs(sc->touchpad, ABS_MT_POSITION_X, x); in dualshock4_parse_report()
1237 input_report_abs(sc->touchpad, ABS_MT_POSITION_Y, y); in dualshock4_parse_report()
1242 input_mt_sync_frame(sc->touchpad); in dualshock4_parse_report()
1243 input_sync(sc->touchpad); in dualshock4_parse_report()
1247 static void nsg_mrxu_parse_report(struct sony_sc *sc, u8 *rd, int size) in nsg_mrxu_parse_report() argument
1272 input_report_key(sc->touchpad, BTN_LEFT, rd[offset] & 0x0F); in nsg_mrxu_parse_report()
1286 input_mt_slot(sc->touchpad, n); in nsg_mrxu_parse_report()
1287 input_mt_report_slot_state(sc->touchpad, MT_TOOL_FINGER, active & 0x03); in nsg_mrxu_parse_report()
1292 input_report_abs(sc->touchpad, ABS_MT_TOUCH_MAJOR, in nsg_mrxu_parse_report()
1294 input_report_abs(sc->touchpad, ABS_MT_TOUCH_MINOR, in nsg_mrxu_parse_report()
1296 input_report_abs(sc->touchpad, ABS_MT_ORIENTATION, in nsg_mrxu_parse_report()
1298 input_report_abs(sc->touchpad, ABS_MT_POSITION_X, x); in nsg_mrxu_parse_report()
1299 input_report_abs(sc->touchpad, ABS_MT_POSITION_Y, in nsg_mrxu_parse_report()
1307 input_report_rel(sc->touchpad, REL_X, relx); in nsg_mrxu_parse_report()
1308 input_report_rel(sc->touchpad, REL_Y, rely); in nsg_mrxu_parse_report()
1316 input_mt_sync_frame(sc->touchpad); in nsg_mrxu_parse_report()
1318 input_sync(sc->touchpad); in nsg_mrxu_parse_report()
1324 struct sony_sc *sc = hid_get_drvdata(hdev); in sony_raw_event() local
1330 if ((sc->quirks & SIXAXIS_CONTROLLER) && rd[0] == 0x01 && size == 49) { in sony_raw_event()
1347 sixaxis_parse_report(sc, rd, size); in sony_raw_event()
1348 } else if ((sc->quirks & MOTION_CONTROLLER_BT) && rd[0] == 0x01 && size == 49) { in sony_raw_event()
1349 sixaxis_parse_report(sc, rd, size); in sony_raw_event()
1350 } else if ((sc->quirks & NAVIGATION_CONTROLLER) && rd[0] == 0x01 && in sony_raw_event()
1352 sixaxis_parse_report(sc, rd, size); in sony_raw_event()
1353 } else if ((sc->quirks & DUALSHOCK4_CONTROLLER_USB) && rd[0] == 0x01 && in sony_raw_event()
1355 dualshock4_parse_report(sc, rd, size); in sony_raw_event()
1356 } else if (((sc->quirks & DUALSHOCK4_CONTROLLER_BT) && rd[0] == 0x11 && in sony_raw_event()
1367 hid_dbg(sc->hdev, "DualShock 4 input report's CRC check failed, received crc 0x%0x != 0x%0x\n", in sony_raw_event()
1372 dualshock4_parse_report(sc, rd, size); in sony_raw_event()
1373 } else if ((sc->quirks & DUALSHOCK4_DONGLE) && rd[0] == 0x01 && in sony_raw_event()
1385 spin_lock_irqsave(&sc->lock, flags); in sony_raw_event()
1386 dongle_state = sc->ds4_dongle_state; in sony_raw_event()
1387 spin_unlock_irqrestore(&sc->lock, flags); in sony_raw_event()
1398 hid_info(sc->hdev, "DualShock 4 USB dongle: controller connected\n"); in sony_raw_event()
1399 sony_set_leds(sc); in sony_raw_event()
1401 spin_lock_irqsave(&sc->lock, flags); in sony_raw_event()
1402 sc->ds4_dongle_state = DONGLE_CALIBRATING; in sony_raw_event()
1403 spin_unlock_irqrestore(&sc->lock, flags); in sony_raw_event()
1405 sony_schedule_work(sc, SONY_WORKER_HOTPLUG); in sony_raw_event()
1413 hid_info(sc->hdev, "DualShock 4 USB dongle: controller disconnected\n"); in sony_raw_event()
1415 spin_lock_irqsave(&sc->lock, flags); in sony_raw_event()
1416 sc->ds4_dongle_state = DONGLE_DISCONNECTED; in sony_raw_event()
1417 spin_unlock_irqrestore(&sc->lock, flags); in sony_raw_event()
1428 dualshock4_parse_report(sc, rd, size); in sony_raw_event()
1430 } else if ((sc->quirks & NSG_MRXU_REMOTE) && rd[0] == 0x02) { in sony_raw_event()
1431 nsg_mrxu_parse_report(sc, rd, size); in sony_raw_event()
1435 if (sc->defer_initialization) { in sony_raw_event()
1436 sc->defer_initialization = 0; in sony_raw_event()
1437 sony_schedule_work(sc, SONY_WORKER_STATE); in sony_raw_event()
1447 struct sony_sc *sc = hid_get_drvdata(hdev); in sony_mapping() local
1449 if (sc->quirks & BUZZ_CONTROLLER) { in sony_mapping()
1472 if (sc->quirks & PS3REMOTE) in sony_mapping()
1475 if (sc->quirks & NAVIGATION_CONTROLLER) in sony_mapping()
1478 if (sc->quirks & SIXAXIS_CONTROLLER) in sony_mapping()
1481 if (sc->quirks & DUALSHOCK4_CONTROLLER) in sony_mapping()
1484 if (sc->quirks & GH_GUITAR_CONTROLLER) in sony_mapping()
1491 static int sony_register_touchpad(struct sony_sc *sc, int touch_count, in sony_register_touchpad() argument
1498 sc->touchpad = devm_input_allocate_device(&sc->hdev->dev); in sony_register_touchpad()
1499 if (!sc->touchpad) in sony_register_touchpad()
1502 input_set_drvdata(sc->touchpad, sc); in sony_register_touchpad()
1503 sc->touchpad->dev.parent = &sc->hdev->dev; in sony_register_touchpad()
1504 sc->touchpad->phys = sc->hdev->phys; in sony_register_touchpad()
1505 sc->touchpad->uniq = sc->hdev->uniq; in sony_register_touchpad()
1506 sc->touchpad->id.bustype = sc->hdev->bus; in sony_register_touchpad()
1507 sc->touchpad->id.vendor = sc->hdev->vendor; in sony_register_touchpad()
1508 sc->touchpad->id.product = sc->hdev->product; in sony_register_touchpad()
1509 sc->touchpad->id.version = sc->hdev->version; in sony_register_touchpad()
1514 name_sz = strlen(sc->hdev->name) + sizeof(DS4_TOUCHPAD_SUFFIX); in sony_register_touchpad()
1515 name = devm_kzalloc(&sc->hdev->dev, name_sz, GFP_KERNEL); in sony_register_touchpad()
1518 snprintf(name, name_sz, "%s" DS4_TOUCHPAD_SUFFIX, sc->hdev->name); in sony_register_touchpad()
1519 sc->touchpad->name = name; in sony_register_touchpad()
1522 __set_bit(EV_KEY, sc->touchpad->evbit); in sony_register_touchpad()
1523 __set_bit(BTN_LEFT, sc->touchpad->keybit); in sony_register_touchpad()
1524 __set_bit(INPUT_PROP_BUTTONPAD, sc->touchpad->propbit); in sony_register_touchpad()
1526 input_set_abs_params(sc->touchpad, ABS_MT_POSITION_X, 0, w, 0, 0); in sony_register_touchpad()
1527 input_set_abs_params(sc->touchpad, ABS_MT_POSITION_Y, 0, h, 0, 0); in sony_register_touchpad()
1530 input_set_abs_params(sc->touchpad, ABS_MT_TOUCH_MAJOR, in sony_register_touchpad()
1533 input_set_abs_params(sc->touchpad, ABS_MT_TOUCH_MINOR, in sony_register_touchpad()
1536 input_set_abs_params(sc->touchpad, ABS_MT_ORIENTATION, in sony_register_touchpad()
1540 if (sc->quirks & NSG_MRXU_REMOTE) { in sony_register_touchpad()
1541 __set_bit(EV_REL, sc->touchpad->evbit); in sony_register_touchpad()
1544 ret = input_mt_init_slots(sc->touchpad, touch_count, INPUT_MT_POINTER); in sony_register_touchpad()
1548 ret = input_register_device(sc->touchpad); in sony_register_touchpad()
1555 static int sony_register_sensors(struct sony_sc *sc) in sony_register_sensors() argument
1562 sc->sensor_dev = devm_input_allocate_device(&sc->hdev->dev); in sony_register_sensors()
1563 if (!sc->sensor_dev) in sony_register_sensors()
1566 input_set_drvdata(sc->sensor_dev, sc); in sony_register_sensors()
1567 sc->sensor_dev->dev.parent = &sc->hdev->dev; in sony_register_sensors()
1568 sc->sensor_dev->phys = sc->hdev->phys; in sony_register_sensors()
1569 sc->sensor_dev->uniq = sc->hdev->uniq; in sony_register_sensors()
1570 sc->sensor_dev->id.bustype = sc->hdev->bus; in sony_register_sensors()
1571 sc->sensor_dev->id.vendor = sc->hdev->vendor; in sony_register_sensors()
1572 sc->sensor_dev->id.product = sc->hdev->product; in sony_register_sensors()
1573 sc->sensor_dev->id.version = sc->hdev->version; in sony_register_sensors()
1578 name_sz = strlen(sc->hdev->name) + sizeof(SENSOR_SUFFIX); in sony_register_sensors()
1579 name = devm_kzalloc(&sc->hdev->dev, name_sz, GFP_KERNEL); in sony_register_sensors()
1582 snprintf(name, name_sz, "%s" SENSOR_SUFFIX, sc->hdev->name); in sony_register_sensors()
1583 sc->sensor_dev->name = name; in sony_register_sensors()
1585 if (sc->quirks & SIXAXIS_CONTROLLER) { in sony_register_sensors()
1592 input_set_abs_params(sc->sensor_dev, ABS_X, -512, 511, 4, 0); in sony_register_sensors()
1593 input_set_abs_params(sc->sensor_dev, ABS_Y, -512, 511, 4, 0); in sony_register_sensors()
1594 input_set_abs_params(sc->sensor_dev, ABS_Z, -512, 511, 4, 0); in sony_register_sensors()
1595 input_abs_set_res(sc->sensor_dev, ABS_X, SIXAXIS_ACC_RES_PER_G); in sony_register_sensors()
1596 input_abs_set_res(sc->sensor_dev, ABS_Y, SIXAXIS_ACC_RES_PER_G); in sony_register_sensors()
1597 input_abs_set_res(sc->sensor_dev, ABS_Z, SIXAXIS_ACC_RES_PER_G); in sony_register_sensors()
1598 } else if (sc->quirks & DUALSHOCK4_CONTROLLER) { in sony_register_sensors()
1600 input_set_abs_params(sc->sensor_dev, ABS_X, -range, range, 16, 0); in sony_register_sensors()
1601 input_set_abs_params(sc->sensor_dev, ABS_Y, -range, range, 16, 0); in sony_register_sensors()
1602 input_set_abs_params(sc->sensor_dev, ABS_Z, -range, range, 16, 0); in sony_register_sensors()
1603 input_abs_set_res(sc->sensor_dev, ABS_X, DS4_ACC_RES_PER_G); in sony_register_sensors()
1604 input_abs_set_res(sc->sensor_dev, ABS_Y, DS4_ACC_RES_PER_G); in sony_register_sensors()
1605 input_abs_set_res(sc->sensor_dev, ABS_Z, DS4_ACC_RES_PER_G); in sony_register_sensors()
1608 input_set_abs_params(sc->sensor_dev, ABS_RX, -range, range, 16, 0); in sony_register_sensors()
1609 input_set_abs_params(sc->sensor_dev, ABS_RY, -range, range, 16, 0); in sony_register_sensors()
1610 input_set_abs_params(sc->sensor_dev, ABS_RZ, -range, range, 16, 0); in sony_register_sensors()
1611 input_abs_set_res(sc->sensor_dev, ABS_RX, DS4_GYRO_RES_PER_DEG_S); in sony_register_sensors()
1612 input_abs_set_res(sc->sensor_dev, ABS_RY, DS4_GYRO_RES_PER_DEG_S); in sony_register_sensors()
1613 input_abs_set_res(sc->sensor_dev, ABS_RZ, DS4_GYRO_RES_PER_DEG_S); in sony_register_sensors()
1615 __set_bit(EV_MSC, sc->sensor_dev->evbit); in sony_register_sensors()
1616 __set_bit(MSC_TIMESTAMP, sc->sensor_dev->mscbit); in sony_register_sensors()
1619 __set_bit(INPUT_PROP_ACCELEROMETER, sc->sensor_dev->propbit); in sony_register_sensors()
1621 ret = input_register_device(sc->sensor_dev); in sony_register_sensors()
1635 struct sony_sc *sc = hid_get_drvdata(hdev); in sixaxis_set_operational_usb() local
1667 if (sc->quirks & SHANWAN_GAMEPAD) in sixaxis_set_operational_usb()
1704 static int dualshock4_get_calibration_data(struct sony_sc *sc) in dualshock4_get_calibration_data() argument
1722 if (sc->quirks & (DUALSHOCK4_CONTROLLER_USB | DUALSHOCK4_DONGLE)) { in dualshock4_get_calibration_data()
1736 ret = hid_hw_raw_request(sc->hdev, 0x02, buf, in dualshock4_get_calibration_data()
1745 hid_warn(sc->hdev, "Retrying DualShock 4 get calibration report (0x02) request\n"); in dualshock4_get_calibration_data()
1766 ret = hid_hw_raw_request(sc->hdev, 0x05, buf, in dualshock4_get_calibration_data()
1778 …hid_warn(sc->hdev, "DualShock 4 calibration report's CRC check failed, received crc 0x%0x != 0x%0x… in dualshock4_get_calibration_data()
1781 hid_warn(sc->hdev, "Retrying DualShock 4 get calibration report request\n"); in dualshock4_get_calibration_data()
1796 if (sc->quirks & DUALSHOCK4_CONTROLLER_USB) { in dualshock4_get_calibration_data()
1825 sc->ds4_calib_data[0].abs_code = ABS_RX; in dualshock4_get_calibration_data()
1826 sc->ds4_calib_data[0].bias = gyro_pitch_bias; in dualshock4_get_calibration_data()
1827 sc->ds4_calib_data[0].sens_numer = speed_2x*DS4_GYRO_RES_PER_DEG_S; in dualshock4_get_calibration_data()
1828 sc->ds4_calib_data[0].sens_denom = gyro_pitch_plus - gyro_pitch_minus; in dualshock4_get_calibration_data()
1830 sc->ds4_calib_data[1].abs_code = ABS_RY; in dualshock4_get_calibration_data()
1831 sc->ds4_calib_data[1].bias = gyro_yaw_bias; in dualshock4_get_calibration_data()
1832 sc->ds4_calib_data[1].sens_numer = speed_2x*DS4_GYRO_RES_PER_DEG_S; in dualshock4_get_calibration_data()
1833 sc->ds4_calib_data[1].sens_denom = gyro_yaw_plus - gyro_yaw_minus; in dualshock4_get_calibration_data()
1835 sc->ds4_calib_data[2].abs_code = ABS_RZ; in dualshock4_get_calibration_data()
1836 sc->ds4_calib_data[2].bias = gyro_roll_bias; in dualshock4_get_calibration_data()
1837 sc->ds4_calib_data[2].sens_numer = speed_2x*DS4_GYRO_RES_PER_DEG_S; in dualshock4_get_calibration_data()
1838 sc->ds4_calib_data[2].sens_denom = gyro_roll_plus - gyro_roll_minus; in dualshock4_get_calibration_data()
1844 sc->ds4_calib_data[3].abs_code = ABS_X; in dualshock4_get_calibration_data()
1845 sc->ds4_calib_data[3].bias = acc_x_plus - range_2g / 2; in dualshock4_get_calibration_data()
1846 sc->ds4_calib_data[3].sens_numer = 2*DS4_ACC_RES_PER_G; in dualshock4_get_calibration_data()
1847 sc->ds4_calib_data[3].sens_denom = range_2g; in dualshock4_get_calibration_data()
1850 sc->ds4_calib_data[4].abs_code = ABS_Y; in dualshock4_get_calibration_data()
1851 sc->ds4_calib_data[4].bias = acc_y_plus - range_2g / 2; in dualshock4_get_calibration_data()
1852 sc->ds4_calib_data[4].sens_numer = 2*DS4_ACC_RES_PER_G; in dualshock4_get_calibration_data()
1853 sc->ds4_calib_data[4].sens_denom = range_2g; in dualshock4_get_calibration_data()
1856 sc->ds4_calib_data[5].abs_code = ABS_Z; in dualshock4_get_calibration_data()
1857 sc->ds4_calib_data[5].bias = acc_z_plus - range_2g / 2; in dualshock4_get_calibration_data()
1858 sc->ds4_calib_data[5].sens_numer = 2*DS4_ACC_RES_PER_G; in dualshock4_get_calibration_data()
1859 sc->ds4_calib_data[5].sens_denom = range_2g; in dualshock4_get_calibration_data()
1868 struct sony_sc *sc = container_of(work, struct sony_sc, hotplug_worker); in dualshock4_calibration_work() local
1873 ret = dualshock4_get_calibration_data(sc); in dualshock4_calibration_work()
1881 hid_err(sc->hdev, "DualShock 4 USB dongle: calibration failed, disabling device\n"); in dualshock4_calibration_work()
1884 hid_info(sc->hdev, "DualShock 4 USB dongle: calibration completed\n"); in dualshock4_calibration_work()
1888 spin_lock_irqsave(&sc->lock, flags); in dualshock4_calibration_work()
1889 sc->ds4_dongle_state = dongle_state; in dualshock4_calibration_work()
1890 spin_unlock_irqrestore(&sc->lock, flags); in dualshock4_calibration_work()
1893 static int dualshock4_get_version_info(struct sony_sc *sc) in dualshock4_get_version_info() argument
1902 ret = hid_hw_raw_request(sc->hdev, 0xA3, buf, in dualshock4_get_version_info()
1911 sc->hw_version = get_unaligned_le16(&buf[35]); in dualshock4_get_version_info()
1912 sc->fw_version = get_unaligned_le16(&buf[41]); in dualshock4_get_version_info()
1918 static void sixaxis_set_leds_from_id(struct sony_sc *sc) in sixaxis_set_leds_from_id() argument
1933 int id = sc->device_id; in sixaxis_set_leds_from_id()
1941 memcpy(sc->led_state, sixaxis_leds[id], sizeof(sixaxis_leds[id])); in sixaxis_set_leds_from_id()
1944 static void dualshock4_set_leds_from_id(struct sony_sc *sc) in dualshock4_set_leds_from_id() argument
1957 int id = sc->device_id; in dualshock4_set_leds_from_id()
1965 memcpy(sc->led_state, color_code[id], sizeof(color_code[id])); in dualshock4_set_leds_from_id()
1968 static void buzz_set_leds(struct sony_sc *sc) in buzz_set_leds() argument
1970 struct hid_device *hdev = sc->hdev; in buzz_set_leds()
1980 value[1] = sc->led_state[0] ? 0xff : 0x00; in buzz_set_leds()
1981 value[2] = sc->led_state[1] ? 0xff : 0x00; in buzz_set_leds()
1982 value[3] = sc->led_state[2] ? 0xff : 0x00; in buzz_set_leds()
1983 value[4] = sc->led_state[3] ? 0xff : 0x00; in buzz_set_leds()
1989 static void sony_set_leds(struct sony_sc *sc) in sony_set_leds() argument
1991 if (!(sc->quirks & BUZZ_CONTROLLER)) in sony_set_leds()
1992 sony_schedule_work(sc, SONY_WORKER_STATE); in sony_set_leds()
1994 buzz_set_leds(sc); in sony_set_leds()
2109 static int sony_leds_init(struct sony_sc *sc) in sony_leds_init() argument
2111 struct hid_device *hdev = sc->hdev; in sony_leds_init()
2124 BUG_ON(!(sc->quirks & SONY_LED_SUPPORT)); in sony_leds_init()
2126 if (sc->quirks & BUZZ_CONTROLLER) { in sony_leds_init()
2127 sc->led_count = 4; in sony_leds_init()
2134 } else if (sc->quirks & DUALSHOCK4_CONTROLLER) { in sony_leds_init()
2135 dualshock4_set_leds_from_id(sc); in sony_leds_init()
2136 sc->led_state[3] = 1; in sony_leds_init()
2137 sc->led_count = 4; in sony_leds_init()
2143 } else if (sc->quirks & MOTION_CONTROLLER) { in sony_leds_init()
2144 sc->led_count = 3; in sony_leds_init()
2149 } else if (sc->quirks & NAVIGATION_CONTROLLER) { in sony_leds_init()
2152 memcpy(sc->led_state, navigation_leds, sizeof(navigation_leds)); in sony_leds_init()
2153 sc->led_count = 1; in sony_leds_init()
2159 sixaxis_set_leds_from_id(sc); in sony_leds_init()
2160 sc->led_count = 4; in sony_leds_init()
2172 sony_set_leds(sc); in sony_leds_init()
2176 for (n = 0; n < sc->led_count; n++) { in sony_leds_init()
2194 led->brightness = sc->led_state[n]; in sony_leds_init()
2203 sc->leds[n] = led; in sony_leds_init()
2215 static void sixaxis_send_output_report(struct sony_sc *sc) in sixaxis_send_output_report() argument
2230 (struct sixaxis_output_report *)sc->output_report_dmabuf; in sixaxis_send_output_report()
2237 report->rumble.right_motor_on = sc->right ? 1 : 0; in sixaxis_send_output_report()
2238 report->rumble.left_motor_force = sc->left; in sixaxis_send_output_report()
2241 report->leds_bitmap |= sc->led_state[0] << 1; in sixaxis_send_output_report()
2242 report->leds_bitmap |= sc->led_state[1] << 2; in sixaxis_send_output_report()
2243 report->leds_bitmap |= sc->led_state[2] << 3; in sixaxis_send_output_report()
2244 report->leds_bitmap |= sc->led_state[3] << 4; in sixaxis_send_output_report()
2260 if (sc->led_delay_on[n] || sc->led_delay_off[n]) { in sixaxis_send_output_report()
2261 report->led[3 - n].duty_off = sc->led_delay_off[n]; in sixaxis_send_output_report()
2262 report->led[3 - n].duty_on = sc->led_delay_on[n]; in sixaxis_send_output_report()
2267 if (sc->quirks & SHANWAN_GAMEPAD) in sixaxis_send_output_report()
2268 hid_hw_output_report(sc->hdev, (u8 *)report, in sixaxis_send_output_report()
2271 hid_hw_raw_request(sc->hdev, report->report_id, (u8 *)report, in sixaxis_send_output_report()
2276 static void dualshock4_send_output_report(struct sony_sc *sc) in dualshock4_send_output_report() argument
2278 struct hid_device *hdev = sc->hdev; in dualshock4_send_output_report()
2279 u8 *buf = sc->output_report_dmabuf; in dualshock4_send_output_report()
2291 if (sc->quirks & (DUALSHOCK4_CONTROLLER_USB | DUALSHOCK4_DONGLE)) { in dualshock4_send_output_report()
2299 buf[1] = 0xC0 /* HID + CRC */ | sc->ds4_bt_poll_interval; in dualshock4_send_output_report()
2305 buf[offset++] = sc->right; in dualshock4_send_output_report()
2306 buf[offset++] = sc->left; in dualshock4_send_output_report()
2312 if (sc->led_state[3]) { in dualshock4_send_output_report()
2313 buf[offset++] = sc->led_state[0]; in dualshock4_send_output_report()
2314 buf[offset++] = sc->led_state[1]; in dualshock4_send_output_report()
2315 buf[offset++] = sc->led_state[2]; in dualshock4_send_output_report()
2321 buf[offset++] = sc->led_delay_on[3]; in dualshock4_send_output_report()
2322 buf[offset++] = sc->led_delay_off[3]; in dualshock4_send_output_report()
2324 if (sc->quirks & (DUALSHOCK4_CONTROLLER_USB | DUALSHOCK4_DONGLE)) in dualshock4_send_output_report()
2338 static void motion_send_output_report(struct sony_sc *sc) in motion_send_output_report() argument
2340 struct hid_device *hdev = sc->hdev; in motion_send_output_report()
2342 (struct motion_output_report_02 *)sc->output_report_dmabuf; in motion_send_output_report()
2347 report->r = sc->led_state[0]; in motion_send_output_report()
2348 report->g = sc->led_state[1]; in motion_send_output_report()
2349 report->b = sc->led_state[2]; in motion_send_output_report()
2352 report->rumble = max(sc->right, sc->left); in motion_send_output_report()
2358 static inline void sony_send_output_report(struct sony_sc *sc) in sony_send_output_report() argument
2360 if (sc->send_output_report) in sony_send_output_report()
2361 sc->send_output_report(sc); in sony_send_output_report()
2366 struct sony_sc *sc = container_of(work, struct sony_sc, state_worker); in sony_state_worker() local
2368 sc->send_output_report(sc); in sony_state_worker()
2371 static int sony_allocate_output_report(struct sony_sc *sc) in sony_allocate_output_report() argument
2373 if ((sc->quirks & SIXAXIS_CONTROLLER) || in sony_allocate_output_report()
2374 (sc->quirks & NAVIGATION_CONTROLLER)) in sony_allocate_output_report()
2375 sc->output_report_dmabuf = in sony_allocate_output_report()
2376 devm_kmalloc(&sc->hdev->dev, in sony_allocate_output_report()
2379 else if (sc->quirks & DUALSHOCK4_CONTROLLER_BT) in sony_allocate_output_report()
2380 sc->output_report_dmabuf = devm_kmalloc(&sc->hdev->dev, in sony_allocate_output_report()
2383 else if (sc->quirks & (DUALSHOCK4_CONTROLLER_USB | DUALSHOCK4_DONGLE)) in sony_allocate_output_report()
2384 sc->output_report_dmabuf = devm_kmalloc(&sc->hdev->dev, in sony_allocate_output_report()
2387 else if (sc->quirks & MOTION_CONTROLLER) in sony_allocate_output_report()
2388 sc->output_report_dmabuf = devm_kmalloc(&sc->hdev->dev, in sony_allocate_output_report()
2394 if (!sc->output_report_dmabuf) in sony_allocate_output_report()
2405 struct sony_sc *sc = hid_get_drvdata(hid); in sony_play_effect() local
2410 sc->left = effect->u.rumble.strong_magnitude / 256; in sony_play_effect()
2411 sc->right = effect->u.rumble.weak_magnitude / 256; in sony_play_effect()
2413 sony_schedule_work(sc, SONY_WORKER_STATE); in sony_play_effect()
2417 static int sony_init_ff(struct sony_sc *sc) in sony_init_ff() argument
2422 if (list_empty(&sc->hdev->inputs)) { in sony_init_ff()
2423 hid_err(sc->hdev, "no inputs found\n"); in sony_init_ff()
2426 hidinput = list_entry(sc->hdev->inputs.next, struct hid_input, list); in sony_init_ff()
2434 static int sony_init_ff(struct sony_sc *sc) in sony_init_ff() argument
2445 struct sony_sc *sc = power_supply_get_drvdata(psy); in sony_battery_get_property() local
2451 spin_lock_irqsave(&sc->lock, flags); in sony_battery_get_property()
2452 battery_capacity = sc->battery_capacity; in sony_battery_get_property()
2453 battery_status = sc->battery_status; in sony_battery_get_property()
2454 spin_unlock_irqrestore(&sc->lock, flags); in sony_battery_get_property()
2476 static int sony_battery_probe(struct sony_sc *sc, int append_dev_id) in sony_battery_probe() argument
2481 struct power_supply_config psy_cfg = { .drv_data = sc, }; in sony_battery_probe()
2482 struct hid_device *hdev = sc->hdev; in sony_battery_probe()
2489 sc->battery_capacity = 100; in sony_battery_probe()
2491 sc->battery_desc.properties = sony_battery_props; in sony_battery_probe()
2492 sc->battery_desc.num_properties = ARRAY_SIZE(sony_battery_props); in sony_battery_probe()
2493 sc->battery_desc.get_property = sony_battery_get_property; in sony_battery_probe()
2494 sc->battery_desc.type = POWER_SUPPLY_TYPE_BATTERY; in sony_battery_probe()
2495 sc->battery_desc.use_for_apm = 0; in sony_battery_probe()
2496 sc->battery_desc.name = devm_kasprintf(&hdev->dev, GFP_KERNEL, in sony_battery_probe()
2497 battery_str_fmt, sc->mac_address, sc->device_id); in sony_battery_probe()
2498 if (!sc->battery_desc.name) in sony_battery_probe()
2501 sc->battery = devm_power_supply_register(&hdev->dev, &sc->battery_desc, in sony_battery_probe()
2503 if (IS_ERR(sc->battery)) { in sony_battery_probe()
2504 ret = PTR_ERR(sc->battery); in sony_battery_probe()
2509 power_supply_powers(sc->battery, &hdev->dev); in sony_battery_probe()
2533 static int sony_check_add_dev_list(struct sony_sc *sc) in sony_check_add_dev_list() argument
2542 ret = memcmp(sc->mac_address, entry->mac_address, in sony_check_add_dev_list()
2543 sizeof(sc->mac_address)); in sony_check_add_dev_list()
2545 if (sony_compare_connection_type(sc, entry)) { in sony_check_add_dev_list()
2549 hid_info(sc->hdev, in sony_check_add_dev_list()
2551 sc->mac_address); in sony_check_add_dev_list()
2558 list_add(&(sc->list_node), &sony_device_list); in sony_check_add_dev_list()
2565 static void sony_remove_dev_list(struct sony_sc *sc) in sony_remove_dev_list() argument
2569 if (sc->list_node.next) { in sony_remove_dev_list()
2571 list_del(&(sc->list_node)); in sony_remove_dev_list()
2576 static int sony_get_bt_devaddr(struct sony_sc *sc) in sony_get_bt_devaddr() argument
2581 ret = strlen(sc->hdev->uniq); in sony_get_bt_devaddr()
2585 ret = sscanf(sc->hdev->uniq, in sony_get_bt_devaddr()
2587 &sc->mac_address[5], &sc->mac_address[4], &sc->mac_address[3], in sony_get_bt_devaddr()
2588 &sc->mac_address[2], &sc->mac_address[1], &sc->mac_address[0]); in sony_get_bt_devaddr()
2596 static int sony_check_add(struct sony_sc *sc) in sony_check_add() argument
2601 if ((sc->quirks & DUALSHOCK4_CONTROLLER_BT) || in sony_check_add()
2602 (sc->quirks & MOTION_CONTROLLER_BT) || in sony_check_add()
2603 (sc->quirks & NAVIGATION_CONTROLLER_BT) || in sony_check_add()
2604 (sc->quirks & SIXAXIS_CONTROLLER_BT)) { in sony_check_add()
2611 if (sony_get_bt_devaddr(sc) < 0) { in sony_check_add()
2612 hid_warn(sc->hdev, "UNIQ does not contain a MAC address; duplicate check skipped\n"); in sony_check_add()
2615 } else if (sc->quirks & (DUALSHOCK4_CONTROLLER_USB | DUALSHOCK4_DONGLE)) { in sony_check_add()
2625 ret = hid_hw_raw_request(sc->hdev, 0x81, buf, in sony_check_add()
2630 hid_err(sc->hdev, "failed to retrieve feature report 0x81 with the DualShock 4 MAC address\n"); in sony_check_add()
2635 memcpy(sc->mac_address, &buf[1], sizeof(sc->mac_address)); in sony_check_add()
2637 snprintf(sc->hdev->uniq, sizeof(sc->hdev->uniq), in sony_check_add()
2638 "%pMR", sc->mac_address); in sony_check_add()
2639 } else if ((sc->quirks & SIXAXIS_CONTROLLER_USB) || in sony_check_add()
2640 (sc->quirks & NAVIGATION_CONTROLLER_USB)) { in sony_check_add()
2650 ret = hid_hw_raw_request(sc->hdev, 0xf2, buf, in sony_check_add()
2655 hid_err(sc->hdev, "failed to retrieve feature report 0xf2 with the Sixaxis MAC address\n"); in sony_check_add()
2665 sc->mac_address[5-n] = buf[4+n]; in sony_check_add()
2667 snprintf(sc->hdev->uniq, sizeof(sc->hdev->uniq), in sony_check_add()
2668 "%pMR", sc->mac_address); in sony_check_add()
2673 ret = sony_check_add_dev_list(sc); in sony_check_add()
2682 static int sony_set_device_id(struct sony_sc *sc) in sony_set_device_id() argument
2690 if ((sc->quirks & SIXAXIS_CONTROLLER) || in sony_set_device_id()
2691 (sc->quirks & DUALSHOCK4_CONTROLLER)) { in sony_set_device_id()
2695 sc->device_id = -1; in sony_set_device_id()
2698 sc->device_id = ret; in sony_set_device_id()
2700 sc->device_id = -1; in sony_set_device_id()
2706 static void sony_release_device_id(struct sony_sc *sc) in sony_release_device_id() argument
2708 if (sc->device_id >= 0) { in sony_release_device_id()
2709 ida_simple_remove(&sony_device_id_allocator, sc->device_id); in sony_release_device_id()
2710 sc->device_id = -1; in sony_release_device_id()
2714 static inline void sony_init_output_report(struct sony_sc *sc, in sony_init_output_report() argument
2717 sc->send_output_report = send_output_report; in sony_init_output_report()
2719 if (!sc->state_worker_initialized) in sony_init_output_report()
2720 INIT_WORK(&sc->state_worker, sony_state_worker); in sony_init_output_report()
2722 sc->state_worker_initialized = 1; in sony_init_output_report()
2725 static inline void sony_cancel_work_sync(struct sony_sc *sc) in sony_cancel_work_sync() argument
2729 if (sc->hotplug_worker_initialized) in sony_cancel_work_sync()
2730 cancel_work_sync(&sc->hotplug_worker); in sony_cancel_work_sync()
2731 if (sc->state_worker_initialized) { in sony_cancel_work_sync()
2732 spin_lock_irqsave(&sc->lock, flags); in sony_cancel_work_sync()
2733 sc->state_worker_initialized = 0; in sony_cancel_work_sync()
2734 spin_unlock_irqrestore(&sc->lock, flags); in sony_cancel_work_sync()
2735 cancel_work_sync(&sc->state_worker); in sony_cancel_work_sync()
2742 struct sony_sc *sc = hid_get_drvdata(hdev); in sony_input_configured() local
2746 ret = sony_set_device_id(sc); in sony_input_configured()
2752 ret = append_dev_id = sony_check_add(sc); in sony_input_configured()
2756 ret = sony_allocate_output_report(sc); in sony_input_configured()
2762 if (sc->quirks & NAVIGATION_CONTROLLER_USB) { in sony_input_configured()
2781 sc->defer_initialization = 1; in sony_input_configured()
2789 sony_init_output_report(sc, sixaxis_send_output_report); in sony_input_configured()
2790 } else if (sc->quirks & NAVIGATION_CONTROLLER_BT) { in sony_input_configured()
2803 sony_init_output_report(sc, sixaxis_send_output_report); in sony_input_configured()
2804 } else if (sc->quirks & SIXAXIS_CONTROLLER_USB) { in sony_input_configured()
2813 sc->defer_initialization = 1; in sony_input_configured()
2821 ret = sony_register_sensors(sc); in sony_input_configured()
2823 hid_err(sc->hdev, in sony_input_configured()
2828 sony_init_output_report(sc, sixaxis_send_output_report); in sony_input_configured()
2829 } else if (sc->quirks & SIXAXIS_CONTROLLER_BT) { in sony_input_configured()
2842 ret = sony_register_sensors(sc); in sony_input_configured()
2844 hid_err(sc->hdev, in sony_input_configured()
2849 sony_init_output_report(sc, sixaxis_send_output_report); in sony_input_configured()
2850 } else if (sc->quirks & DUALSHOCK4_CONTROLLER) { in sony_input_configured()
2851 ret = dualshock4_get_calibration_data(sc); in sony_input_configured()
2857 ret = dualshock4_get_version_info(sc); in sony_input_configured()
2859 hid_err(sc->hdev, "Failed to get version data from Dualshock 4\n"); in sony_input_configured()
2863 ret = device_create_file(&sc->hdev->dev, &dev_attr_firmware_version); in sony_input_configured()
2865 hid_err(sc->hdev, "can't create sysfs firmware_version attribute err: %d\n", ret); in sony_input_configured()
2868 sc->fw_version_created = true; in sony_input_configured()
2870 ret = device_create_file(&sc->hdev->dev, &dev_attr_hardware_version); in sony_input_configured()
2872 hid_err(sc->hdev, "can't create sysfs hardware_version attribute err: %d\n", ret); in sony_input_configured()
2875 sc->hw_version_created = true; in sony_input_configured()
2881 ret = sony_register_touchpad(sc, 2, 1920, 942, 0, 0, 0); in sony_input_configured()
2883 hid_err(sc->hdev, in sony_input_configured()
2889 ret = sony_register_sensors(sc); in sony_input_configured()
2891 hid_err(sc->hdev, in sony_input_configured()
2896 if (sc->quirks & DUALSHOCK4_CONTROLLER_BT) { in sony_input_configured()
2897 sc->ds4_bt_poll_interval = DS4_BT_DEFAULT_POLL_INTERVAL_MS; in sony_input_configured()
2898 ret = device_create_file(&sc->hdev->dev, &dev_attr_bt_poll_interval); in sony_input_configured()
2900 hid_warn(sc->hdev, in sony_input_configured()
2905 if (sc->quirks & DUALSHOCK4_DONGLE) { in sony_input_configured()
2906 INIT_WORK(&sc->hotplug_worker, dualshock4_calibration_work); in sony_input_configured()
2907 sc->hotplug_worker_initialized = 1; in sony_input_configured()
2908 sc->ds4_dongle_state = DONGLE_DISCONNECTED; in sony_input_configured()
2911 sony_init_output_report(sc, dualshock4_send_output_report); in sony_input_configured()
2912 } else if (sc->quirks & NSG_MRXU_REMOTE) { in sony_input_configured()
2917 ret = sony_register_touchpad(sc, 2, in sony_input_configured()
2920 hid_err(sc->hdev, in sony_input_configured()
2926 } else if (sc->quirks & MOTION_CONTROLLER) { in sony_input_configured()
2927 sony_init_output_report(sc, motion_send_output_report); in sony_input_configured()
2932 if (sc->quirks & SONY_LED_SUPPORT) { in sony_input_configured()
2933 ret = sony_leds_init(sc); in sony_input_configured()
2938 if (sc->quirks & SONY_BATTERY_SUPPORT) { in sony_input_configured()
2939 ret = sony_battery_probe(sc, append_dev_id); in sony_input_configured()
2951 if (sc->quirks & SONY_FF_SUPPORT) { in sony_input_configured()
2952 ret = sony_init_ff(sc); in sony_input_configured()
2965 if (sc->ds4_bt_poll_interval) in sony_input_configured()
2966 device_remove_file(&sc->hdev->dev, &dev_attr_bt_poll_interval); in sony_input_configured()
2967 if (sc->fw_version_created) in sony_input_configured()
2968 device_remove_file(&sc->hdev->dev, &dev_attr_firmware_version); in sony_input_configured()
2969 if (sc->hw_version_created) in sony_input_configured()
2970 device_remove_file(&sc->hdev->dev, &dev_attr_hardware_version); in sony_input_configured()
2971 sony_cancel_work_sync(sc); in sony_input_configured()
2972 sony_remove_dev_list(sc); in sony_input_configured()
2973 sony_release_device_id(sc); in sony_input_configured()
2981 struct sony_sc *sc; in sony_probe() local
2992 sc = devm_kzalloc(&hdev->dev, sizeof(*sc), GFP_KERNEL); in sony_probe()
2993 if (sc == NULL) { in sony_probe()
2998 spin_lock_init(&sc->lock); in sony_probe()
3000 sc->quirks = quirks; in sony_probe()
3001 hid_set_drvdata(hdev, sc); in sony_probe()
3002 sc->hdev = hdev; in sony_probe()
3010 if (sc->quirks & VAIO_RDESC_CONSTANT) in sony_probe()
3012 else if (sc->quirks & SIXAXIS_CONTROLLER) in sony_probe()
3021 if (sc->quirks & (SIXAXIS_CONTROLLER | DUALSHOCK4_CONTROLLER)) in sony_probe()
3044 if (sc->quirks & (GHL_GUITAR_PS3WIIU | GHL_GUITAR_PS4)) { in sony_probe()
3050 usbdev = to_usb_device(sc->hdev->dev.parent->parent); in sony_probe()
3052 sc->ghl_urb = usb_alloc_urb(0, GFP_ATOMIC); in sony_probe()
3053 if (!sc->ghl_urb) { in sony_probe()
3058 if (sc->quirks & GHL_GUITAR_PS3WIIU) in sony_probe()
3059 ret = ghl_init_urb(sc, usbdev, ghl_ps3wiiu_magic_data, in sony_probe()
3061 else if (sc->quirks & GHL_GUITAR_PS4) in sony_probe()
3062 ret = ghl_init_urb(sc, usbdev, ghl_ps4_magic_data, in sony_probe()
3069 timer_setup(&sc->ghl_poke_timer, ghl_magic_poke, 0); in sony_probe()
3070 mod_timer(&sc->ghl_poke_timer, in sony_probe()
3077 usb_free_urb(sc->ghl_urb); in sony_probe()
3085 struct sony_sc *sc = hid_get_drvdata(hdev); in sony_remove() local
3087 if (sc->quirks & (GHL_GUITAR_PS3WIIU | GHL_GUITAR_PS4)) { in sony_remove()
3088 del_timer_sync(&sc->ghl_poke_timer); in sony_remove()
3089 usb_free_urb(sc->ghl_urb); in sony_remove()
3094 if (sc->quirks & DUALSHOCK4_CONTROLLER_BT) in sony_remove()
3095 device_remove_file(&sc->hdev->dev, &dev_attr_bt_poll_interval); in sony_remove()
3097 if (sc->fw_version_created) in sony_remove()
3098 device_remove_file(&sc->hdev->dev, &dev_attr_firmware_version); in sony_remove()
3100 if (sc->hw_version_created) in sony_remove()
3101 device_remove_file(&sc->hdev->dev, &dev_attr_hardware_version); in sony_remove()
3103 sony_cancel_work_sync(sc); in sony_remove()
3105 sony_remove_dev_list(sc); in sony_remove()
3107 sony_release_device_id(sc); in sony_remove()
3120 struct sony_sc *sc = hid_get_drvdata(hdev); in sony_suspend() local
3122 sc->left = sc->right = 0; in sony_suspend()
3123 sony_send_output_report(sc); in sony_suspend()
3132 struct sony_sc *sc = hid_get_drvdata(hdev); in sony_resume() local
3138 if ((sc->quirks & SIXAXIS_CONTROLLER_USB) || in sony_resume()
3139 (sc->quirks & NAVIGATION_CONTROLLER_USB)) { in sony_resume()
3140 sixaxis_set_operational_usb(sc->hdev); in sony_resume()
3141 sc->defer_initialization = 1; in sony_resume()