Lines Matching +full:non +full:- +full:linear

1 // SPDX-License-Identifier: GPL-2.0+
7 * "Kid-friendly Wired Controller" PS3OFMINIPAD SONY
19 #include "hid-ids.h"
37 * 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
39 * 0x81, 0x01, // Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
47 * 0x81, 0x42, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State)
50 * 0x81, 0x01, // Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
59 * 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
74 * 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
77 …0xB1, 0x02, // Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-
79 … 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-
88 * 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
97 * - map buttons according to gamepad.rst
98 * - assign right stick from Z/Rz to Rx/Ry
99 * - map previously unused analog trigger data to Z/RZ
100 * - simplify feature and output descriptor
126 0x81, 0x02, /* Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) */
129 0x81, 0x01, /* Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) */
137 0x81, 0x42, /* Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State) */
140 0x81, 0x01, /* Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) */
149 0x81, 0x02, /* Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) */
151 0x81, 0x01, /* Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) */
158 0x81, 0x02, /* Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) */
160 0x81, 0x01, /* Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) */
162 …0xB1, 0x02, /* Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-
165 …0x91, 0x02, /* Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-v…
168 0x81, 0x02, /* Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) */
181 u8 left_motor_force; /* left motor force 0-255 */
192 spin_lock_irqsave(&bigben->lock, flags); in bigben_schedule_work()
193 if (!bigben->removed) in bigben_schedule_work()
194 schedule_work(&bigben->worker); in bigben_schedule_work()
195 spin_unlock_irqrestore(&bigben->lock, flags); in bigben_schedule_work()
202 struct hid_field *report_field = bigben->report->field[0]; in bigben_worker()
209 buf = hid_alloc_report_buf(bigben->report, GFP_KERNEL); in bigben_worker()
213 len = hid_report_len(bigben->report); in bigben_worker()
216 spin_lock_irqsave(&bigben->lock, flags); in bigben_worker()
218 if (bigben->work_led) { in bigben_worker()
219 bigben->work_led = false; in bigben_worker()
221 report_field->value[0] = 0x01; /* 1 = led message */ in bigben_worker()
222 report_field->value[1] = 0x08; /* reserved value, always 8 */ in bigben_worker()
223 report_field->value[2] = bigben->led_state; in bigben_worker()
224 report_field->value[3] = 0x00; /* padding */ in bigben_worker()
225 report_field->value[4] = 0x00; /* padding */ in bigben_worker()
226 report_field->value[5] = 0x00; /* padding */ in bigben_worker()
227 report_field->value[6] = 0x00; /* padding */ in bigben_worker()
228 report_field->value[7] = 0x00; /* padding */ in bigben_worker()
229 hid_output_report(bigben->report, buf); in bigben_worker()
232 spin_unlock_irqrestore(&bigben->lock, flags); in bigben_worker()
235 hid_hw_raw_request(bigben->hid, bigben->report->id, buf, len, in bigben_worker()
236 bigben->report->type, HID_REQ_SET_REPORT); in bigben_worker()
240 spin_lock_irqsave(&bigben->lock, flags); in bigben_worker()
242 if (bigben->work_ff) { in bigben_worker()
243 bigben->work_ff = false; in bigben_worker()
245 report_field->value[0] = 0x02; /* 2 = rumble effect message */ in bigben_worker()
246 report_field->value[1] = 0x08; /* reserved value, always 8 */ in bigben_worker()
247 report_field->value[2] = bigben->right_motor_on; in bigben_worker()
248 report_field->value[3] = bigben->left_motor_force; in bigben_worker()
249 report_field->value[4] = 0xff; /* duration 0-254 (255 = nonstop) */ in bigben_worker()
250 report_field->value[5] = 0x00; /* padding */ in bigben_worker()
251 report_field->value[6] = 0x00; /* padding */ in bigben_worker()
252 report_field->value[7] = 0x00; /* padding */ in bigben_worker()
253 hid_output_report(bigben->report, buf); in bigben_worker()
256 spin_unlock_irqrestore(&bigben->lock, flags); in bigben_worker()
259 hid_hw_raw_request(bigben->hid, bigben->report->id, buf, len, in bigben_worker()
260 bigben->report->type, HID_REQ_SET_REPORT); in bigben_worker()
280 if (effect->type != FF_RUMBLE) in hid_bigben_play_effect()
283 right_motor_on = effect->u.rumble.weak_magnitude ? 1 : 0; in hid_bigben_play_effect()
284 left_motor_force = effect->u.rumble.strong_magnitude / 256; in hid_bigben_play_effect()
286 if (right_motor_on != bigben->right_motor_on || in hid_bigben_play_effect()
287 left_motor_force != bigben->left_motor_force) { in hid_bigben_play_effect()
288 spin_lock_irqsave(&bigben->lock, flags); in hid_bigben_play_effect()
289 bigben->right_motor_on = right_motor_on; in hid_bigben_play_effect()
290 bigben->left_motor_force = left_motor_force; in hid_bigben_play_effect()
291 bigben->work_ff = true; in hid_bigben_play_effect()
292 spin_unlock_irqrestore(&bigben->lock, flags); in hid_bigben_play_effect()
303 struct device *dev = led->dev->parent; in bigben_set_led()
316 if (led == bigben->leds[n]) { in bigben_set_led()
317 spin_lock_irqsave(&bigben->lock, flags); in bigben_set_led()
319 work = (bigben->led_state & BIT(n)); in bigben_set_led()
320 bigben->led_state &= ~BIT(n); in bigben_set_led()
322 work = !(bigben->led_state & BIT(n)); in bigben_set_led()
323 bigben->led_state |= BIT(n); in bigben_set_led()
325 spin_unlock_irqrestore(&bigben->lock, flags); in bigben_set_led()
328 bigben->work_led = true; in bigben_set_led()
338 struct device *dev = led->dev->parent; in bigben_get_led()
349 if (led == bigben->leds[n]) in bigben_get_led()
350 return (bigben->led_state & BIT(n)) ? LED_ON : LED_OFF; in bigben_get_led()
361 spin_lock_irqsave(&bigben->lock, flags); in bigben_remove()
362 bigben->removed = true; in bigben_remove()
363 spin_unlock_irqrestore(&bigben->lock, flags); in bigben_remove()
365 cancel_work_sync(&bigben->worker); in bigben_remove()
379 bigben = devm_kzalloc(&hid->dev, sizeof(*bigben), GFP_KERNEL); in bigben_probe()
381 return -ENOMEM; in bigben_probe()
383 bigben->hid = hid; in bigben_probe()
384 bigben->removed = false; in bigben_probe()
398 bigben->report = hid_validate_values(hid, HID_OUTPUT_REPORT, 0, 0, 8); in bigben_probe()
399 if (!bigben->report) { in bigben_probe()
401 error = -ENODEV; in bigben_probe()
405 if (list_empty(&hid->inputs)) { in bigben_probe()
407 error = -ENODEV; in bigben_probe()
411 hidinput = list_first_entry(&hid->inputs, struct hid_input, list); in bigben_probe()
412 set_bit(FF_RUMBLE, hidinput->input->ffbit); in bigben_probe()
414 INIT_WORK(&bigben->worker, bigben_worker); in bigben_probe()
415 spin_lock_init(&bigben->lock); in bigben_probe()
417 error = input_ff_create_memless(hidinput->input, NULL, in bigben_probe()
422 name_sz = strlen(dev_name(&hid->dev)) + strlen(":red:bigben#") + 1; in bigben_probe()
426 &hid->dev, in bigben_probe()
431 error = -ENOMEM; in bigben_probe()
437 dev_name(&hid->dev), n + 1 in bigben_probe()
439 led->name = name; in bigben_probe()
440 led->brightness = (n == 0) ? LED_ON : LED_OFF; in bigben_probe()
441 led->max_brightness = 1; in bigben_probe()
442 led->brightness_get = bigben_get_led; in bigben_probe()
443 led->brightness_set = bigben_set_led; in bigben_probe()
444 bigben->leds[n] = led; in bigben_probe()
445 error = devm_led_classdev_register(&hid->dev, led); in bigben_probe()
451 bigben->led_state = BIT(0); in bigben_probe()
452 bigben->right_motor_on = 0; in bigben_probe()
453 bigben->left_motor_force = 0; in bigben_probe()
454 bigben->work_led = true; in bigben_probe()
455 bigben->work_ff = true; in bigben_probe()