mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-04 20:19:47 +08:00
Merge branch 'for-6.17/pidff' into for-linus
- bunch of checkpatch fixes for hid-pidff (Tomasz Pakuła)
This commit is contained in:
commit
4859d6f8a5
@ -849,7 +849,7 @@
|
|||||||
#define USB_DEVICE_ID_PXN_V12 0x1212
|
#define USB_DEVICE_ID_PXN_V12 0x1212
|
||||||
#define USB_DEVICE_ID_PXN_V12_LITE 0x1112
|
#define USB_DEVICE_ID_PXN_V12_LITE 0x1112
|
||||||
#define USB_DEVICE_ID_PXN_V12_LITE_2 0x1211
|
#define USB_DEVICE_ID_PXN_V12_LITE_2 0x1211
|
||||||
#define USB_DEVICE_LITE_STAR_GT987_FF 0x2141
|
#define USB_DEVICE_ID_LITE_STAR_GT987 0x2141
|
||||||
|
|
||||||
#define USB_VENDOR_ID_LOGITECH 0x046d
|
#define USB_VENDOR_ID_LOGITECH 0x046d
|
||||||
#define USB_DEVICE_ID_LOGITECH_Z_10_SPK 0x0a07
|
#define USB_DEVICE_ID_LOGITECH_Z_10_SPK 0x0a07
|
||||||
|
@ -57,6 +57,7 @@ static int universal_pidff_probe(struct hid_device *hdev,
|
|||||||
const struct hid_device_id *id)
|
const struct hid_device_id *id)
|
||||||
{
|
{
|
||||||
int i, error;
|
int i, error;
|
||||||
|
|
||||||
error = hid_parse(hdev);
|
error = hid_parse(hdev);
|
||||||
if (error) {
|
if (error) {
|
||||||
hid_err(hdev, "HID parse failed\n");
|
hid_err(hdev, "HID parse failed\n");
|
||||||
@ -91,8 +92,8 @@ static int universal_pidff_probe(struct hid_device *hdev,
|
|||||||
|
|
||||||
/* Check if HID_PID support is enabled */
|
/* Check if HID_PID support is enabled */
|
||||||
int (*init_function)(struct hid_device *, u32);
|
int (*init_function)(struct hid_device *, u32);
|
||||||
init_function = hid_pidff_init_with_quirks;
|
|
||||||
|
|
||||||
|
init_function = hid_pidff_init_with_quirks;
|
||||||
if (!init_function) {
|
if (!init_function) {
|
||||||
hid_warn(hdev, "HID_PID support not enabled!\n");
|
hid_warn(hdev, "HID_PID support not enabled!\n");
|
||||||
return 0;
|
return 0;
|
||||||
@ -177,7 +178,7 @@ static const struct hid_device_id universal_pidff_devices[] = {
|
|||||||
.driver_data = HID_PIDFF_QUIRK_PERIODIC_SINE_ONLY },
|
.driver_data = HID_PIDFF_QUIRK_PERIODIC_SINE_ONLY },
|
||||||
{ HID_USB_DEVICE(USB_VENDOR_ID_LITE_STAR, USB_DEVICE_ID_PXN_V12_LITE_2),
|
{ HID_USB_DEVICE(USB_VENDOR_ID_LITE_STAR, USB_DEVICE_ID_PXN_V12_LITE_2),
|
||||||
.driver_data = HID_PIDFF_QUIRK_PERIODIC_SINE_ONLY },
|
.driver_data = HID_PIDFF_QUIRK_PERIODIC_SINE_ONLY },
|
||||||
{ HID_USB_DEVICE(USB_VENDOR_ID_LITE_STAR, USB_DEVICE_LITE_STAR_GT987_FF),
|
{ HID_USB_DEVICE(USB_VENDOR_ID_LITE_STAR, USB_DEVICE_ID_LITE_STAR_GT987),
|
||||||
.driver_data = HID_PIDFF_QUIRK_PERIODIC_SINE_ONLY },
|
.driver_data = HID_PIDFF_QUIRK_PERIODIC_SINE_ONLY },
|
||||||
{ HID_USB_DEVICE(USB_VENDOR_ID_ASETEK, USB_DEVICE_ID_ASETEK_INVICTA) },
|
{ HID_USB_DEVICE(USB_VENDOR_ID_ASETEK, USB_DEVICE_ID_ASETEK_INVICTA) },
|
||||||
{ HID_USB_DEVICE(USB_VENDOR_ID_ASETEK, USB_DEVICE_ID_ASETEK_FORTE) },
|
{ HID_USB_DEVICE(USB_VENDOR_ID_ASETEK, USB_DEVICE_ID_ASETEK_FORTE) },
|
||||||
|
@ -210,9 +210,7 @@ struct pidff_device {
|
|||||||
*/
|
*/
|
||||||
static s32 pidff_clamp(s32 i, struct hid_field *field)
|
static s32 pidff_clamp(s32 i, struct hid_field *field)
|
||||||
{
|
{
|
||||||
s32 clamped = clamp(i, field->logical_minimum, field->logical_maximum);
|
return (s32)clamp(i, field->logical_minimum, field->logical_maximum);
|
||||||
pr_debug("clamped from %d to %d", i, clamped);
|
|
||||||
return clamped;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -229,8 +227,10 @@ static int pidff_rescale(int i, int max, struct hid_field *field)
|
|||||||
*/
|
*/
|
||||||
static int pidff_rescale_signed(int i, struct hid_field *field)
|
static int pidff_rescale_signed(int i, struct hid_field *field)
|
||||||
{
|
{
|
||||||
if (i > 0) return i * field->logical_maximum / S16_MAX;
|
if (i > 0)
|
||||||
if (i < 0) return i * field->logical_minimum / S16_MIN;
|
return i * field->logical_maximum / S16_MAX;
|
||||||
|
if (i < 0)
|
||||||
|
return i * field->logical_minimum / S16_MIN;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,8 +241,8 @@ static u32 pidff_rescale_time(u16 time, struct hid_field *field)
|
|||||||
{
|
{
|
||||||
u32 scaled_time = time;
|
u32 scaled_time = time;
|
||||||
int exponent = field->unit_exponent;
|
int exponent = field->unit_exponent;
|
||||||
pr_debug("time field exponent: %d\n", exponent);
|
|
||||||
|
|
||||||
|
pr_debug("time field exponent: %d\n", exponent);
|
||||||
for (; exponent < FF_TIME_EXPONENT; exponent++)
|
for (; exponent < FF_TIME_EXPONENT; exponent++)
|
||||||
scaled_time *= 10;
|
scaled_time *= 10;
|
||||||
for (; exponent > FF_TIME_EXPONENT; exponent--)
|
for (; exponent > FF_TIME_EXPONENT; exponent--)
|
||||||
@ -275,8 +275,8 @@ static void pidff_set_signed(struct pidff_usage *usage, s16 value)
|
|||||||
|
|
||||||
static void pidff_set_time(struct pidff_usage *usage, u16 time)
|
static void pidff_set_time(struct pidff_usage *usage, u16 time)
|
||||||
{
|
{
|
||||||
u32 modified_time = pidff_rescale_time(time, usage->field);
|
usage->value[0] = pidff_clamp(
|
||||||
usage->value[0] = pidff_clamp(modified_time, usage->field);
|
pidff_rescale_time(time, usage->field), usage->field);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pidff_set_duration(struct pidff_usage *usage, u16 duration)
|
static void pidff_set_duration(struct pidff_usage *usage, u16 duration)
|
||||||
@ -332,6 +332,7 @@ static int pidff_needs_set_envelope(struct ff_envelope *envelope,
|
|||||||
struct ff_envelope *old)
|
struct ff_envelope *old)
|
||||||
{
|
{
|
||||||
bool needs_new_envelope;
|
bool needs_new_envelope;
|
||||||
|
|
||||||
needs_new_envelope = envelope->attack_level != 0 ||
|
needs_new_envelope = envelope->attack_level != 0 ||
|
||||||
envelope->fade_level != 0 ||
|
envelope->fade_level != 0 ||
|
||||||
envelope->attack_length != 0 ||
|
envelope->attack_length != 0 ||
|
||||||
@ -715,6 +716,7 @@ static void pidff_playback_pid(struct pidff_device *pidff, int pid_id, int n)
|
|||||||
static int pidff_playback(struct input_dev *dev, int effect_id, int value)
|
static int pidff_playback(struct input_dev *dev, int effect_id, int value)
|
||||||
{
|
{
|
||||||
struct pidff_device *pidff = dev->ff->private;
|
struct pidff_device *pidff = dev->ff->private;
|
||||||
|
|
||||||
pidff_playback_pid(pidff, pidff->pid_id[effect_id], value);
|
pidff_playback_pid(pidff, pidff->pid_id[effect_id], value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -940,7 +942,7 @@ static int pidff_find_fields(struct pidff_usage *usage, const u8 *table,
|
|||||||
struct hid_report *report, int count, int strict)
|
struct hid_report *report, int count, int strict)
|
||||||
{
|
{
|
||||||
if (!report) {
|
if (!report) {
|
||||||
pr_debug("pidff_find_fields, null report\n");
|
pr_debug("%s, null report\n", __func__);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -974,13 +976,11 @@ static int pidff_find_fields(struct pidff_usage *usage, const u8 *table,
|
|||||||
pr_debug("Delay field not found, but that's OK\n");
|
pr_debug("Delay field not found, but that's OK\n");
|
||||||
pr_debug("Setting MISSING_DELAY quirk\n");
|
pr_debug("Setting MISSING_DELAY quirk\n");
|
||||||
return_value |= HID_PIDFF_QUIRK_MISSING_DELAY;
|
return_value |= HID_PIDFF_QUIRK_MISSING_DELAY;
|
||||||
}
|
} else if (!found && table[k] == pidff_set_condition[PID_PARAM_BLOCK_OFFSET]) {
|
||||||
else if (!found && table[k] == pidff_set_condition[PID_PARAM_BLOCK_OFFSET]) {
|
|
||||||
pr_debug("PBO field not found, but that's OK\n");
|
pr_debug("PBO field not found, but that's OK\n");
|
||||||
pr_debug("Setting MISSING_PBO quirk\n");
|
pr_debug("Setting MISSING_PBO quirk\n");
|
||||||
return_value |= HID_PIDFF_QUIRK_MISSING_PBO;
|
return_value |= HID_PIDFF_QUIRK_MISSING_PBO;
|
||||||
}
|
} else if (!found && strict) {
|
||||||
else if (!found && strict) {
|
|
||||||
pr_debug("failed to locate %d\n", k);
|
pr_debug("failed to locate %d\n", k);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1069,7 +1069,7 @@ static struct hid_field *pidff_find_special_field(struct hid_report *report,
|
|||||||
int usage, int enforce_min)
|
int usage, int enforce_min)
|
||||||
{
|
{
|
||||||
if (!report) {
|
if (!report) {
|
||||||
pr_debug("pidff_find_special_field, null report\n");
|
pr_debug("%s, null report\n", __func__);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1081,12 +1081,11 @@ static struct hid_field *pidff_find_special_field(struct hid_report *report,
|
|||||||
if (!enforce_min ||
|
if (!enforce_min ||
|
||||||
report->field[i]->logical_minimum == 1)
|
report->field[i]->logical_minimum == 1)
|
||||||
return report->field[i];
|
return report->field[i];
|
||||||
else {
|
|
||||||
pr_err("logical_minimum is not 1 as it should be\n");
|
pr_err("logical_minimum is not 1 as it should be\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1207,6 +1206,7 @@ static int pidff_find_effects(struct pidff_device *pidff,
|
|||||||
|
|
||||||
for (i = 0; i < sizeof(pidff_effect_types); i++) {
|
for (i = 0; i < sizeof(pidff_effect_types); i++) {
|
||||||
int pidff_type = pidff->type_id[i];
|
int pidff_type = pidff->type_id[i];
|
||||||
|
|
||||||
if (pidff->set_effect_type->usage[pidff_type].hid !=
|
if (pidff->set_effect_type->usage[pidff_type].hid !=
|
||||||
pidff->create_new_effect_type->usage[pidff_type].hid) {
|
pidff->create_new_effect_type->usage[pidff_type].hid) {
|
||||||
hid_err(pidff->hid,
|
hid_err(pidff->hid,
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
/* Delay field (0xA7) missing. Skip it during set effect report upload */
|
/* Delay field (0xA7) missing. Skip it during set effect report upload */
|
||||||
#define HID_PIDFF_QUIRK_MISSING_DELAY BIT(0)
|
#define HID_PIDFF_QUIRK_MISSING_DELAY BIT(0)
|
||||||
|
|
||||||
/* Missing Paramter block offset (0x23). Skip it during SET_CONDITION
|
/* Missing Paramter block offset (0x23). Skip it during SET_CONDITION upload */
|
||||||
report upload */
|
|
||||||
#define HID_PIDFF_QUIRK_MISSING_PBO BIT(1)
|
#define HID_PIDFF_QUIRK_MISSING_PBO BIT(1)
|
||||||
|
|
||||||
/* Initialise device control field even if logical_minimum != 1 */
|
/* Initialise device control field even if logical_minimum != 1 */
|
||||||
|
Loading…
Reference in New Issue
Block a user