aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-sony.c
diff options
context:
space:
mode:
authorFrank Praznik <frank.praznik@oh.rr.com>2014-02-05 20:03:44 -0500
committerJiri Kosina <jkosina@suse.cz>2014-02-17 08:11:06 -0500
commit48220237bac3555f2dbba37ccd6f0c1644490269 (patch)
tree00120a8177fc209b374b6b177261de1eaf76a363 /drivers/hid/hid-sony.c
parent3371ac4b3b8b7d56928949ba7cfa6fc6274445e9 (diff)
HID: sony: Use low-level transport driver functions
Switch to the low-level transport driver functions. sony_set_output_report is removed since it is no longer used. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-sony.c')
-rw-r--r--drivers/hid/hid-sony.c56
1 files changed, 14 insertions, 42 deletions
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index e6995bf9f95a..f93f3ca2c231 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -502,7 +502,6 @@ struct sony_sc {
502 spinlock_t lock; 502 spinlock_t lock;
503 struct hid_device *hdev; 503 struct hid_device *hdev;
504 struct led_classdev *leds[MAX_LEDS]; 504 struct led_classdev *leds[MAX_LEDS];
505 struct hid_report *output_report;
506 unsigned long quirks; 505 unsigned long quirks;
507 struct work_struct state_worker; 506 struct work_struct state_worker;
508 struct power_supply battery; 507 struct power_supply battery;
@@ -1051,21 +1050,26 @@ static void dualshock4_state_worker(struct work_struct *work)
1051{ 1050{
1052 struct sony_sc *sc = container_of(work, struct sony_sc, state_worker); 1051 struct sony_sc *sc = container_of(work, struct sony_sc, state_worker);
1053 struct hid_device *hdev = sc->hdev; 1052 struct hid_device *hdev = sc->hdev;
1054 struct hid_report *report = sc->output_report; 1053 int offset;
1055 __s32 *value = report->field[0]->value; 1054
1055 __u8 buf[32] = { 0 };
1056 1056
1057 value[0] = 0x03; 1057 buf[0] = 0x05;
1058 buf[1] = 0x03;
1059 offset = 4;
1058 1060
1059#ifdef CONFIG_SONY_FF 1061#ifdef CONFIG_SONY_FF
1060 value[3] = sc->right; 1062 buf[offset++] = sc->right;
1061 value[4] = sc->left; 1063 buf[offset++] = sc->left;
1064#else
1065 offset += 2;
1062#endif 1066#endif
1063 1067
1064 value[5] = sc->led_state[0]; 1068 buf[offset++] = sc->led_state[0];
1065 value[6] = sc->led_state[1]; 1069 buf[offset++] = sc->led_state[1];
1066 value[7] = sc->led_state[2]; 1070 buf[offset++] = sc->led_state[2];
1067 1071
1068 hid_hw_request(hdev, report, HID_REQ_SET_REPORT); 1072 hid_hw_output_report(hdev, buf, sizeof(buf));
1069} 1073}
1070 1074
1071#ifdef CONFIG_SONY_FF 1075#ifdef CONFIG_SONY_FF
@@ -1198,33 +1202,6 @@ static void sony_battery_remove(struct sony_sc *sc)
1198 sc->battery.name = NULL; 1202 sc->battery.name = NULL;
1199} 1203}
1200 1204
1201static int sony_set_output_report(struct sony_sc *sc, int req_id, int req_size)
1202{
1203 struct list_head *head, *list;
1204 struct hid_report *report;
1205 struct hid_device *hdev = sc->hdev;
1206
1207 list = &hdev->report_enum[HID_OUTPUT_REPORT].report_list;
1208
1209 list_for_each(head, list) {
1210 report = list_entry(head, struct hid_report, list);
1211
1212 if (report->id == req_id) {
1213 if (report->size < req_size) {
1214 hid_err(hdev, "Output report 0x%02x (%i bits) is smaller than requested size (%i bits)\n",
1215 req_id, report->size, req_size);
1216 return -EINVAL;
1217 }
1218 sc->output_report = report;
1219 return 0;
1220 }
1221 }
1222
1223 hid_err(hdev, "Unable to locate output report 0x%02x\n", req_id);
1224
1225 return -EINVAL;
1226}
1227
1228static int sony_register_touchpad(struct sony_sc *sc, int touch_count, 1205static int sony_register_touchpad(struct sony_sc *sc, int touch_count,
1229 int w, int h) 1206 int w, int h)
1230{ 1207{
@@ -1289,11 +1266,6 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
1289 else if (sc->quirks & SIXAXIS_CONTROLLER_BT) 1266 else if (sc->quirks & SIXAXIS_CONTROLLER_BT)
1290 ret = sixaxis_set_operational_bt(hdev); 1267 ret = sixaxis_set_operational_bt(hdev);
1291 else if (sc->quirks & DUALSHOCK4_CONTROLLER_USB) { 1268 else if (sc->quirks & DUALSHOCK4_CONTROLLER_USB) {
1292 /* Report 5 (31 bytes) is used to send data to the controller via USB */
1293 ret = sony_set_output_report(sc, 0x05, 248);
1294 if (ret < 0)
1295 goto err_stop;
1296
1297 /* The Dualshock 4 touchpad supports 2 touches and has a 1269 /* The Dualshock 4 touchpad supports 2 touches and has a
1298 * resolution of 1920x940. 1270 * resolution of 1920x940.
1299 */ 1271 */