Lines Matching refs:ps_dev
784 static int ps_led_register(struct ps_device *ps_dev, struct led_classdev *led, in ps_led_register() argument
790 led->name = devm_kasprintf(&ps_dev->hdev->dev, GFP_KERNEL, in ps_led_register()
791 "%s:%s:%s", ps_dev->input_dev_name, led_info->color, led_info->name); in ps_led_register()
794 led->name = devm_kasprintf(&ps_dev->hdev->dev, GFP_KERNEL, in ps_led_register()
795 "%s:%s", ps_dev->input_dev_name, led_info->color); in ps_led_register()
808 ret = devm_led_classdev_register(&ps_dev->hdev->dev, led); in ps_led_register()
810 hid_err(ps_dev->hdev, "Failed to register LED %s: %d\n", led_info->name, ret); in ps_led_register()
818 static int ps_lightbar_register(struct ps_device *ps_dev, struct led_classdev_mc *lightbar_mc_dev, in ps_lightbar_register() argument
821 struct hid_device *hdev = ps_dev->hdev; in ps_lightbar_register()
840 ps_dev->input_dev_name); in ps_lightbar_register()
926 struct ps_device *ps_dev = hid_get_drvdata(hdev); in firmware_version_show() local
928 return sysfs_emit(buf, "0x%08x\n", ps_dev->fw_version); in firmware_version_show()
938 struct ps_device *ps_dev = hid_get_drvdata(hdev); in hardware_version_show() local
940 return sysfs_emit(buf, "0x%08x\n", ps_dev->hw_version); in hardware_version_show()
1315 static int dualsense_parse_report(struct ps_device *ps_dev, struct hid_report *report, in dualsense_parse_report() argument
1318 struct hid_device *hdev = ps_dev->hdev; in dualsense_parse_report()
1319 struct dualsense *ds = container_of(ps_dev, struct dualsense, base); in dualsense_parse_report()
1387 spin_lock_irqsave(&ps_dev->lock, flags); in dualsense_parse_report()
1390 spin_unlock_irqrestore(&ps_dev->lock, flags); in dualsense_parse_report()
1484 spin_lock_irqsave(&ps_dev->lock, flags); in dualsense_parse_report()
1485 ps_dev->battery_capacity = battery_capacity; in dualsense_parse_report()
1486 ps_dev->battery_status = battery_status; in dualsense_parse_report()
1487 spin_unlock_irqrestore(&ps_dev->lock, flags); in dualsense_parse_report()
1511 static void dualsense_remove(struct ps_device *ps_dev) in dualsense_remove() argument
1513 struct dualsense *ds = container_of(ps_dev, struct dualsense, base); in dualsense_remove()
1588 struct ps_device *ps_dev; in dualsense_create() local
1615 ps_dev = &ds->base; in dualsense_create()
1616 ps_dev->hdev = hdev; in dualsense_create()
1617 spin_lock_init(&ps_dev->lock); in dualsense_create()
1618 ps_dev->battery_capacity = 100; /* initial value until parse_report. */ in dualsense_create()
1619 ps_dev->battery_status = POWER_SUPPLY_STATUS_UNKNOWN; in dualsense_create()
1620 ps_dev->parse_report = dualsense_parse_report; in dualsense_create()
1621 ps_dev->remove = dualsense_remove; in dualsense_create()
1659 ret = ps_devices_list_add(ps_dev); in dualsense_create()
1675 ps_dev->input_dev_name = dev_name(&ds->gamepad->dev); in dualsense_create()
1690 ret = ps_device_register_battery(ps_dev); in dualsense_create()
1703 ret = ps_lightbar_register(ps_dev, &ds->lightbar, dualsense_lightbar_set_brightness); in dualsense_create()
1713 ret = ps_led_register(ps_dev, &ds->player_leds[i], led_info); in dualsense_create()
1718 ret = ps_device_set_player_id(ps_dev); in dualsense_create()
1737 ps_devices_list_remove(ps_dev); in dualsense_create()
2219 static int dualshock4_parse_report(struct ps_device *ps_dev, struct hid_report *report, in dualshock4_parse_report() argument
2222 struct hid_device *hdev = ps_dev->hdev; in dualshock4_parse_report()
2223 struct dualshock4 *ds4 = container_of(ps_dev, struct dualshock4, base); in dualshock4_parse_report()
2408 spin_lock_irqsave(&ps_dev->lock, flags); in dualshock4_parse_report()
2409 ps_dev->battery_capacity = battery_capacity; in dualshock4_parse_report()
2410 ps_dev->battery_status = battery_status; in dualshock4_parse_report()
2411 spin_unlock_irqrestore(&ps_dev->lock, flags); in dualshock4_parse_report()
2416 static int dualshock4_dongle_parse_report(struct ps_device *ps_dev, struct hid_report *report, in dualshock4_dongle_parse_report() argument
2419 struct dualshock4 *ds4 = container_of(ps_dev, struct dualshock4, base); in dualshock4_dongle_parse_report()
2434 hid_info(ps_dev->hdev, "DualShock 4 USB dongle: controller connected\n"); in dualshock4_dongle_parse_report()
2438 spin_lock_irqsave(&ps_dev->lock, flags); in dualshock4_dongle_parse_report()
2440 spin_unlock_irqrestore(&ps_dev->lock, flags); in dualshock4_dongle_parse_report()
2450 hid_info(ps_dev->hdev, "DualShock 4 USB dongle: controller disconnected\n"); in dualshock4_dongle_parse_report()
2452 spin_lock_irqsave(&ps_dev->lock, flags); in dualshock4_dongle_parse_report()
2454 spin_unlock_irqrestore(&ps_dev->lock, flags); in dualshock4_dongle_parse_report()
2467 return dualshock4_parse_report(ps_dev, report, data, size); in dualshock4_dongle_parse_report()
2491 static void dualshock4_remove(struct ps_device *ps_dev) in dualshock4_remove() argument
2493 struct dualshock4 *ds4 = container_of(ps_dev, struct dualshock4, base); in dualshock4_remove()
2502 if (ps_dev->hdev->product == USB_DEVICE_ID_SONY_PS4_CONTROLLER_DONGLE) in dualshock4_remove()
2550 struct ps_device *ps_dev; in dualshock4_create() local
2581 ps_dev = &ds4->base; in dualshock4_create()
2582 ps_dev->hdev = hdev; in dualshock4_create()
2583 spin_lock_init(&ps_dev->lock); in dualshock4_create()
2584 ps_dev->battery_capacity = 100; /* initial value until parse_report. */ in dualshock4_create()
2585 ps_dev->battery_status = POWER_SUPPLY_STATUS_UNKNOWN; in dualshock4_create()
2586 ps_dev->parse_report = dualshock4_parse_report; in dualshock4_create()
2587 ps_dev->remove = dualshock4_remove; in dualshock4_create()
2602 ps_dev->parse_report = dualshock4_dongle_parse_report; in dualshock4_create()
2618 ret = ps_devices_list_add(ps_dev); in dualshock4_create()
2635 ps_dev->input_dev_name = dev_name(&ds4->gamepad->dev); in dualshock4_create()
2650 ret = ps_device_register_battery(ps_dev); in dualshock4_create()
2657 ret = ps_led_register(ps_dev, &ds4->lightbar_leds[i], led_info); in dualshock4_create()
2664 ret = ps_device_set_player_id(ps_dev); in dualshock4_create()
2681 ps_devices_list_remove(ps_dev); in dualshock4_create()