diff options
Diffstat (limited to 'drivers/usb/input/hid-pidff.c')
-rw-r--r-- | drivers/usb/input/hid-pidff.c | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/drivers/usb/input/hid-pidff.c b/drivers/usb/input/hid-pidff.c index 5420c13eb8eb..cbd2d53fefff 100644 --- a/drivers/usb/input/hid-pidff.c +++ b/drivers/usb/input/hid-pidff.c | |||
@@ -28,7 +28,9 @@ | |||
28 | #include <linux/input.h> | 28 | #include <linux/input.h> |
29 | #include <linux/usb.h> | 29 | #include <linux/usb.h> |
30 | 30 | ||
31 | #include "hid.h" | 31 | #include <linux/hid.h> |
32 | |||
33 | #include "usbhid.h" | ||
32 | 34 | ||
33 | #define PID_EFFECTS_MAX 64 | 35 | #define PID_EFFECTS_MAX 64 |
34 | 36 | ||
@@ -260,7 +262,7 @@ static void pidff_set_envelope_report(struct pidff_device *pidff, | |||
260 | debug("attack %u => %d", envelope->attack_level, | 262 | debug("attack %u => %d", envelope->attack_level, |
261 | pidff->set_envelope[PID_ATTACK_LEVEL].value[0]); | 263 | pidff->set_envelope[PID_ATTACK_LEVEL].value[0]); |
262 | 264 | ||
263 | hid_submit_report(pidff->hid, pidff->reports[PID_SET_ENVELOPE], | 265 | usbhid_submit_report(pidff->hid, pidff->reports[PID_SET_ENVELOPE], |
264 | USB_DIR_OUT); | 266 | USB_DIR_OUT); |
265 | } | 267 | } |
266 | 268 | ||
@@ -287,7 +289,7 @@ static void pidff_set_constant_force_report(struct pidff_device *pidff, | |||
287 | pidff_set_signed(&pidff->set_constant[PID_MAGNITUDE], | 289 | pidff_set_signed(&pidff->set_constant[PID_MAGNITUDE], |
288 | effect->u.constant.level); | 290 | effect->u.constant.level); |
289 | 291 | ||
290 | hid_submit_report(pidff->hid, pidff->reports[PID_SET_CONSTANT], | 292 | usbhid_submit_report(pidff->hid, pidff->reports[PID_SET_CONSTANT], |
291 | USB_DIR_OUT); | 293 | USB_DIR_OUT); |
292 | } | 294 | } |
293 | 295 | ||
@@ -322,7 +324,7 @@ static void pidff_set_effect_report(struct pidff_device *pidff, | |||
322 | pidff->effect_direction); | 324 | pidff->effect_direction); |
323 | pidff->set_effect[PID_START_DELAY].value[0] = effect->replay.delay; | 325 | pidff->set_effect[PID_START_DELAY].value[0] = effect->replay.delay; |
324 | 326 | ||
325 | hid_submit_report(pidff->hid, pidff->reports[PID_SET_EFFECT], | 327 | usbhid_submit_report(pidff->hid, pidff->reports[PID_SET_EFFECT], |
326 | USB_DIR_OUT); | 328 | USB_DIR_OUT); |
327 | } | 329 | } |
328 | 330 | ||
@@ -354,7 +356,7 @@ static void pidff_set_periodic_report(struct pidff_device *pidff, | |||
354 | pidff_set(&pidff->set_periodic[PID_PHASE], effect->u.periodic.phase); | 356 | pidff_set(&pidff->set_periodic[PID_PHASE], effect->u.periodic.phase); |
355 | pidff->set_periodic[PID_PERIOD].value[0] = effect->u.periodic.period; | 357 | pidff->set_periodic[PID_PERIOD].value[0] = effect->u.periodic.period; |
356 | 358 | ||
357 | hid_submit_report(pidff->hid, pidff->reports[PID_SET_PERIODIC], | 359 | usbhid_submit_report(pidff->hid, pidff->reports[PID_SET_PERIODIC], |
358 | USB_DIR_OUT); | 360 | USB_DIR_OUT); |
359 | 361 | ||
360 | } | 362 | } |
@@ -396,8 +398,8 @@ static void pidff_set_condition_report(struct pidff_device *pidff, | |||
396 | effect->u.condition[i].left_saturation); | 398 | effect->u.condition[i].left_saturation); |
397 | pidff_set(&pidff->set_condition[PID_DEAD_BAND], | 399 | pidff_set(&pidff->set_condition[PID_DEAD_BAND], |
398 | effect->u.condition[i].deadband); | 400 | effect->u.condition[i].deadband); |
399 | hid_wait_io(pidff->hid); | 401 | usbhid_wait_io(pidff->hid); |
400 | hid_submit_report(pidff->hid, pidff->reports[PID_SET_CONDITION], | 402 | usbhid_submit_report(pidff->hid, pidff->reports[PID_SET_CONDITION], |
401 | USB_DIR_OUT); | 403 | USB_DIR_OUT); |
402 | } | 404 | } |
403 | } | 405 | } |
@@ -438,7 +440,7 @@ static void pidff_set_ramp_force_report(struct pidff_device *pidff, | |||
438 | effect->u.ramp.start_level); | 440 | effect->u.ramp.start_level); |
439 | pidff_set_signed(&pidff->set_ramp[PID_RAMP_END], | 441 | pidff_set_signed(&pidff->set_ramp[PID_RAMP_END], |
440 | effect->u.ramp.end_level); | 442 | effect->u.ramp.end_level); |
441 | hid_submit_report(pidff->hid, pidff->reports[PID_SET_RAMP], | 443 | usbhid_submit_report(pidff->hid, pidff->reports[PID_SET_RAMP], |
442 | USB_DIR_OUT); | 444 | USB_DIR_OUT); |
443 | } | 445 | } |
444 | 446 | ||
@@ -463,19 +465,19 @@ static int pidff_request_effect_upload(struct pidff_device *pidff, int efnum) | |||
463 | int j; | 465 | int j; |
464 | 466 | ||
465 | pidff->create_new_effect_type->value[0] = efnum; | 467 | pidff->create_new_effect_type->value[0] = efnum; |
466 | hid_submit_report(pidff->hid, pidff->reports[PID_CREATE_NEW_EFFECT], | 468 | usbhid_submit_report(pidff->hid, pidff->reports[PID_CREATE_NEW_EFFECT], |
467 | USB_DIR_OUT); | 469 | USB_DIR_OUT); |
468 | debug("create_new_effect sent, type: %d", efnum); | 470 | debug("create_new_effect sent, type: %d", efnum); |
469 | 471 | ||
470 | pidff->block_load[PID_EFFECT_BLOCK_INDEX].value[0] = 0; | 472 | pidff->block_load[PID_EFFECT_BLOCK_INDEX].value[0] = 0; |
471 | pidff->block_load_status->value[0] = 0; | 473 | pidff->block_load_status->value[0] = 0; |
472 | hid_wait_io(pidff->hid); | 474 | usbhid_wait_io(pidff->hid); |
473 | 475 | ||
474 | for (j = 0; j < 60; j++) { | 476 | for (j = 0; j < 60; j++) { |
475 | debug("pid_block_load requested"); | 477 | debug("pid_block_load requested"); |
476 | hid_submit_report(pidff->hid, pidff->reports[PID_BLOCK_LOAD], | 478 | usbhid_submit_report(pidff->hid, pidff->reports[PID_BLOCK_LOAD], |
477 | USB_DIR_IN); | 479 | USB_DIR_IN); |
478 | hid_wait_io(pidff->hid); | 480 | usbhid_wait_io(pidff->hid); |
479 | if (pidff->block_load_status->value[0] == | 481 | if (pidff->block_load_status->value[0] == |
480 | pidff->status_id[PID_BLOCK_LOAD_SUCCESS]) { | 482 | pidff->status_id[PID_BLOCK_LOAD_SUCCESS]) { |
481 | debug("device reported free memory: %d bytes", | 483 | debug("device reported free memory: %d bytes", |
@@ -511,8 +513,8 @@ static void pidff_playback_pid(struct pidff_device *pidff, int pid_id, int n) | |||
511 | pidff->effect_operation[PID_LOOP_COUNT].value[0] = n; | 513 | pidff->effect_operation[PID_LOOP_COUNT].value[0] = n; |
512 | } | 514 | } |
513 | 515 | ||
514 | hid_wait_io(pidff->hid); | 516 | usbhid_wait_io(pidff->hid); |
515 | hid_submit_report(pidff->hid, pidff->reports[PID_EFFECT_OPERATION], | 517 | usbhid_submit_report(pidff->hid, pidff->reports[PID_EFFECT_OPERATION], |
516 | USB_DIR_OUT); | 518 | USB_DIR_OUT); |
517 | } | 519 | } |
518 | 520 | ||
@@ -534,7 +536,7 @@ static int pidff_playback(struct input_dev *dev, int effect_id, int value) | |||
534 | static void pidff_erase_pid(struct pidff_device *pidff, int pid_id) | 536 | static void pidff_erase_pid(struct pidff_device *pidff, int pid_id) |
535 | { | 537 | { |
536 | pidff->block_free[PID_EFFECT_BLOCK_INDEX].value[0] = pid_id; | 538 | pidff->block_free[PID_EFFECT_BLOCK_INDEX].value[0] = pid_id; |
537 | hid_submit_report(pidff->hid, pidff->reports[PID_BLOCK_FREE], | 539 | usbhid_submit_report(pidff->hid, pidff->reports[PID_BLOCK_FREE], |
538 | USB_DIR_OUT); | 540 | USB_DIR_OUT); |
539 | } | 541 | } |
540 | 542 | ||
@@ -714,7 +716,7 @@ static void pidff_set_gain(struct input_dev *dev, u16 gain) | |||
714 | struct pidff_device *pidff = dev->ff->private; | 716 | struct pidff_device *pidff = dev->ff->private; |
715 | 717 | ||
716 | pidff_set(&pidff->device_gain[PID_DEVICE_GAIN_FIELD], gain); | 718 | pidff_set(&pidff->device_gain[PID_DEVICE_GAIN_FIELD], gain); |
717 | hid_submit_report(pidff->hid, pidff->reports[PID_DEVICE_GAIN], | 719 | usbhid_submit_report(pidff->hid, pidff->reports[PID_DEVICE_GAIN], |
718 | USB_DIR_OUT); | 720 | USB_DIR_OUT); |
719 | } | 721 | } |
720 | 722 | ||
@@ -739,7 +741,7 @@ static void pidff_autocenter(struct pidff_device *pidff, u16 magnitude) | |||
739 | pidff_set(&pidff->set_effect[PID_GAIN], magnitude); | 741 | pidff_set(&pidff->set_effect[PID_GAIN], magnitude); |
740 | pidff->set_effect[PID_START_DELAY].value[0] = 0; | 742 | pidff->set_effect[PID_START_DELAY].value[0] = 0; |
741 | 743 | ||
742 | hid_submit_report(pidff->hid, pidff->reports[PID_SET_EFFECT], | 744 | usbhid_submit_report(pidff->hid, pidff->reports[PID_SET_EFFECT], |
743 | USB_DIR_OUT); | 745 | USB_DIR_OUT); |
744 | } | 746 | } |
745 | 747 | ||
@@ -1163,19 +1165,19 @@ static void pidff_reset(struct pidff_device *pidff) | |||
1163 | 1165 | ||
1164 | pidff->device_control->value[0] = pidff->control_id[PID_RESET]; | 1166 | pidff->device_control->value[0] = pidff->control_id[PID_RESET]; |
1165 | /* We reset twice as sometimes hid_wait_io isn't waiting long enough */ | 1167 | /* We reset twice as sometimes hid_wait_io isn't waiting long enough */ |
1166 | hid_submit_report(hid, pidff->reports[PID_DEVICE_CONTROL], USB_DIR_OUT); | 1168 | usbhid_submit_report(hid, pidff->reports[PID_DEVICE_CONTROL], USB_DIR_OUT); |
1167 | hid_wait_io(hid); | 1169 | usbhid_wait_io(hid); |
1168 | hid_submit_report(hid, pidff->reports[PID_DEVICE_CONTROL], USB_DIR_OUT); | 1170 | usbhid_submit_report(hid, pidff->reports[PID_DEVICE_CONTROL], USB_DIR_OUT); |
1169 | hid_wait_io(hid); | 1171 | usbhid_wait_io(hid); |
1170 | 1172 | ||
1171 | pidff->device_control->value[0] = | 1173 | pidff->device_control->value[0] = |
1172 | pidff->control_id[PID_ENABLE_ACTUATORS]; | 1174 | pidff->control_id[PID_ENABLE_ACTUATORS]; |
1173 | hid_submit_report(hid, pidff->reports[PID_DEVICE_CONTROL], USB_DIR_OUT); | 1175 | usbhid_submit_report(hid, pidff->reports[PID_DEVICE_CONTROL], USB_DIR_OUT); |
1174 | hid_wait_io(hid); | 1176 | usbhid_wait_io(hid); |
1175 | 1177 | ||
1176 | /* pool report is sometimes messed up, refetch it */ | 1178 | /* pool report is sometimes messed up, refetch it */ |
1177 | hid_submit_report(hid, pidff->reports[PID_POOL], USB_DIR_IN); | 1179 | usbhid_submit_report(hid, pidff->reports[PID_POOL], USB_DIR_IN); |
1178 | hid_wait_io(hid); | 1180 | usbhid_wait_io(hid); |
1179 | 1181 | ||
1180 | if (pidff->pool[PID_SIMULTANEOUS_MAX].value) { | 1182 | if (pidff->pool[PID_SIMULTANEOUS_MAX].value) { |
1181 | int sim_effects = pidff->pool[PID_SIMULTANEOUS_MAX].value[0]; | 1183 | int sim_effects = pidff->pool[PID_SIMULTANEOUS_MAX].value[0]; |
@@ -1187,9 +1189,9 @@ static void pidff_reset(struct pidff_device *pidff) | |||
1187 | break; | 1189 | break; |
1188 | } | 1190 | } |
1189 | debug("pid_pool requested again"); | 1191 | debug("pid_pool requested again"); |
1190 | hid_submit_report(hid, pidff->reports[PID_POOL], | 1192 | usbhid_submit_report(hid, pidff->reports[PID_POOL], |
1191 | USB_DIR_IN); | 1193 | USB_DIR_IN); |
1192 | hid_wait_io(hid); | 1194 | usbhid_wait_io(hid); |
1193 | } | 1195 | } |
1194 | } | 1196 | } |
1195 | } | 1197 | } |
@@ -1275,7 +1277,7 @@ int hid_pidff_init(struct hid_device *hid) | |||
1275 | 1277 | ||
1276 | if (test_bit(FF_GAIN, dev->ffbit)) { | 1278 | if (test_bit(FF_GAIN, dev->ffbit)) { |
1277 | pidff_set(&pidff->device_gain[PID_DEVICE_GAIN_FIELD], 0xffff); | 1279 | pidff_set(&pidff->device_gain[PID_DEVICE_GAIN_FIELD], 0xffff); |
1278 | hid_submit_report(pidff->hid, pidff->reports[PID_DEVICE_GAIN], | 1280 | usbhid_submit_report(pidff->hid, pidff->reports[PID_DEVICE_GAIN], |
1279 | USB_DIR_OUT); | 1281 | USB_DIR_OUT); |
1280 | } | 1282 | } |
1281 | 1283 | ||