HID: use hid_hw_request() instead of direct call to usbhid
This allows the hid drivers to be independent from the transport layer. The patch was constructed by replacing all occurences of usbhid_submit_report() by its hid_hw_request() counterpart. Then, drivers not requiring USB_HID anymore have their USB_HID dependency cleaned in the Kconfig file. Finally, few drivers still depends on USB_HID. Many of them are requiring the io wait callback. They are found in the next patch. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> For the sensor-hub part: Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:

committed by
Jiri Kosina

父節點
f3757cea18
當前提交
d881427253
@@ -263,8 +263,8 @@ static void pidff_set_envelope_report(struct pidff_device *pidff,
|
||||
envelope->attack_level,
|
||||
pidff->set_envelope[PID_ATTACK_LEVEL].value[0]);
|
||||
|
||||
usbhid_submit_report(pidff->hid, pidff->reports[PID_SET_ENVELOPE],
|
||||
USB_DIR_OUT);
|
||||
hid_hw_request(pidff->hid, pidff->reports[PID_SET_ENVELOPE],
|
||||
HID_REQ_SET_REPORT);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -290,8 +290,8 @@ static void pidff_set_constant_force_report(struct pidff_device *pidff,
|
||||
pidff_set_signed(&pidff->set_constant[PID_MAGNITUDE],
|
||||
effect->u.constant.level);
|
||||
|
||||
usbhid_submit_report(pidff->hid, pidff->reports[PID_SET_CONSTANT],
|
||||
USB_DIR_OUT);
|
||||
hid_hw_request(pidff->hid, pidff->reports[PID_SET_CONSTANT],
|
||||
HID_REQ_SET_REPORT);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -325,8 +325,8 @@ static void pidff_set_effect_report(struct pidff_device *pidff,
|
||||
pidff->effect_direction);
|
||||
pidff->set_effect[PID_START_DELAY].value[0] = effect->replay.delay;
|
||||
|
||||
usbhid_submit_report(pidff->hid, pidff->reports[PID_SET_EFFECT],
|
||||
USB_DIR_OUT);
|
||||
hid_hw_request(pidff->hid, pidff->reports[PID_SET_EFFECT],
|
||||
HID_REQ_SET_REPORT);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -357,8 +357,8 @@ static void pidff_set_periodic_report(struct pidff_device *pidff,
|
||||
pidff_set(&pidff->set_periodic[PID_PHASE], effect->u.periodic.phase);
|
||||
pidff->set_periodic[PID_PERIOD].value[0] = effect->u.periodic.period;
|
||||
|
||||
usbhid_submit_report(pidff->hid, pidff->reports[PID_SET_PERIODIC],
|
||||
USB_DIR_OUT);
|
||||
hid_hw_request(pidff->hid, pidff->reports[PID_SET_PERIODIC],
|
||||
HID_REQ_SET_REPORT);
|
||||
|
||||
}
|
||||
|
||||
@@ -399,8 +399,8 @@ static void pidff_set_condition_report(struct pidff_device *pidff,
|
||||
effect->u.condition[i].left_saturation);
|
||||
pidff_set(&pidff->set_condition[PID_DEAD_BAND],
|
||||
effect->u.condition[i].deadband);
|
||||
usbhid_submit_report(pidff->hid, pidff->reports[PID_SET_CONDITION],
|
||||
USB_DIR_OUT);
|
||||
hid_hw_request(pidff->hid, pidff->reports[PID_SET_CONDITION],
|
||||
HID_REQ_SET_REPORT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -440,8 +440,8 @@ static void pidff_set_ramp_force_report(struct pidff_device *pidff,
|
||||
effect->u.ramp.start_level);
|
||||
pidff_set_signed(&pidff->set_ramp[PID_RAMP_END],
|
||||
effect->u.ramp.end_level);
|
||||
usbhid_submit_report(pidff->hid, pidff->reports[PID_SET_RAMP],
|
||||
USB_DIR_OUT);
|
||||
hid_hw_request(pidff->hid, pidff->reports[PID_SET_RAMP],
|
||||
HID_REQ_SET_REPORT);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -465,8 +465,8 @@ static int pidff_request_effect_upload(struct pidff_device *pidff, int efnum)
|
||||
int j;
|
||||
|
||||
pidff->create_new_effect_type->value[0] = efnum;
|
||||
usbhid_submit_report(pidff->hid, pidff->reports[PID_CREATE_NEW_EFFECT],
|
||||
USB_DIR_OUT);
|
||||
hid_hw_request(pidff->hid, pidff->reports[PID_CREATE_NEW_EFFECT],
|
||||
HID_REQ_SET_REPORT);
|
||||
hid_dbg(pidff->hid, "create_new_effect sent, type: %d\n", efnum);
|
||||
|
||||
pidff->block_load[PID_EFFECT_BLOCK_INDEX].value[0] = 0;
|
||||
@@ -475,8 +475,8 @@ static int pidff_request_effect_upload(struct pidff_device *pidff, int efnum)
|
||||
|
||||
for (j = 0; j < 60; j++) {
|
||||
hid_dbg(pidff->hid, "pid_block_load requested\n");
|
||||
usbhid_submit_report(pidff->hid, pidff->reports[PID_BLOCK_LOAD],
|
||||
USB_DIR_IN);
|
||||
hid_hw_request(pidff->hid, pidff->reports[PID_BLOCK_LOAD],
|
||||
HID_REQ_GET_REPORT);
|
||||
usbhid_wait_io(pidff->hid);
|
||||
if (pidff->block_load_status->value[0] ==
|
||||
pidff->status_id[PID_BLOCK_LOAD_SUCCESS]) {
|
||||
@@ -513,8 +513,8 @@ static void pidff_playback_pid(struct pidff_device *pidff, int pid_id, int n)
|
||||
pidff->effect_operation[PID_LOOP_COUNT].value[0] = n;
|
||||
}
|
||||
|
||||
usbhid_submit_report(pidff->hid, pidff->reports[PID_EFFECT_OPERATION],
|
||||
USB_DIR_OUT);
|
||||
hid_hw_request(pidff->hid, pidff->reports[PID_EFFECT_OPERATION],
|
||||
HID_REQ_SET_REPORT);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -535,8 +535,8 @@ static int pidff_playback(struct input_dev *dev, int effect_id, int value)
|
||||
static void pidff_erase_pid(struct pidff_device *pidff, int pid_id)
|
||||
{
|
||||
pidff->block_free[PID_EFFECT_BLOCK_INDEX].value[0] = pid_id;
|
||||
usbhid_submit_report(pidff->hid, pidff->reports[PID_BLOCK_FREE],
|
||||
USB_DIR_OUT);
|
||||
hid_hw_request(pidff->hid, pidff->reports[PID_BLOCK_FREE],
|
||||
HID_REQ_SET_REPORT);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -718,8 +718,8 @@ static void pidff_set_gain(struct input_dev *dev, u16 gain)
|
||||
struct pidff_device *pidff = dev->ff->private;
|
||||
|
||||
pidff_set(&pidff->device_gain[PID_DEVICE_GAIN_FIELD], gain);
|
||||
usbhid_submit_report(pidff->hid, pidff->reports[PID_DEVICE_GAIN],
|
||||
USB_DIR_OUT);
|
||||
hid_hw_request(pidff->hid, pidff->reports[PID_DEVICE_GAIN],
|
||||
HID_REQ_SET_REPORT);
|
||||
}
|
||||
|
||||
static void pidff_autocenter(struct pidff_device *pidff, u16 magnitude)
|
||||
@@ -744,8 +744,8 @@ static void pidff_autocenter(struct pidff_device *pidff, u16 magnitude)
|
||||
pidff->set_effect[PID_DIRECTION_ENABLE].value[0] = 1;
|
||||
pidff->set_effect[PID_START_DELAY].value[0] = 0;
|
||||
|
||||
usbhid_submit_report(pidff->hid, pidff->reports[PID_SET_EFFECT],
|
||||
USB_DIR_OUT);
|
||||
hid_hw_request(pidff->hid, pidff->reports[PID_SET_EFFECT],
|
||||
HID_REQ_SET_REPORT);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1158,18 +1158,18 @@ static void pidff_reset(struct pidff_device *pidff)
|
||||
|
||||
pidff->device_control->value[0] = pidff->control_id[PID_RESET];
|
||||
/* We reset twice as sometimes hid_wait_io isn't waiting long enough */
|
||||
usbhid_submit_report(hid, pidff->reports[PID_DEVICE_CONTROL], USB_DIR_OUT);
|
||||
hid_hw_request(hid, pidff->reports[PID_DEVICE_CONTROL], HID_REQ_SET_REPORT);
|
||||
usbhid_wait_io(hid);
|
||||
usbhid_submit_report(hid, pidff->reports[PID_DEVICE_CONTROL], USB_DIR_OUT);
|
||||
hid_hw_request(hid, pidff->reports[PID_DEVICE_CONTROL], HID_REQ_SET_REPORT);
|
||||
usbhid_wait_io(hid);
|
||||
|
||||
pidff->device_control->value[0] =
|
||||
pidff->control_id[PID_ENABLE_ACTUATORS];
|
||||
usbhid_submit_report(hid, pidff->reports[PID_DEVICE_CONTROL], USB_DIR_OUT);
|
||||
hid_hw_request(hid, pidff->reports[PID_DEVICE_CONTROL], HID_REQ_SET_REPORT);
|
||||
usbhid_wait_io(hid);
|
||||
|
||||
/* pool report is sometimes messed up, refetch it */
|
||||
usbhid_submit_report(hid, pidff->reports[PID_POOL], USB_DIR_IN);
|
||||
hid_hw_request(hid, pidff->reports[PID_POOL], HID_REQ_GET_REPORT);
|
||||
usbhid_wait_io(hid);
|
||||
|
||||
if (pidff->pool[PID_SIMULTANEOUS_MAX].value) {
|
||||
@@ -1181,8 +1181,8 @@ static void pidff_reset(struct pidff_device *pidff)
|
||||
break;
|
||||
}
|
||||
hid_dbg(pidff->hid, "pid_pool requested again\n");
|
||||
usbhid_submit_report(hid, pidff->reports[PID_POOL],
|
||||
USB_DIR_IN);
|
||||
hid_hw_request(hid, pidff->reports[PID_POOL],
|
||||
HID_REQ_GET_REPORT);
|
||||
usbhid_wait_io(hid);
|
||||
}
|
||||
}
|
||||
@@ -1269,8 +1269,8 @@ int hid_pidff_init(struct hid_device *hid)
|
||||
|
||||
if (test_bit(FF_GAIN, dev->ffbit)) {
|
||||
pidff_set(&pidff->device_gain[PID_DEVICE_GAIN_FIELD], 0xffff);
|
||||
usbhid_submit_report(hid, pidff->reports[PID_DEVICE_GAIN],
|
||||
USB_DIR_OUT);
|
||||
hid_hw_request(hid, pidff->reports[PID_DEVICE_GAIN],
|
||||
HID_REQ_SET_REPORT);
|
||||
}
|
||||
|
||||
error = pidff_check_autocenter(pidff, dev);
|
||||
|
Reference in New Issue
Block a user