Lines Matching refs:bigben

188 static inline void bigben_schedule_work(struct bigben_device *bigben)  in bigben_schedule_work()  argument
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()
200 struct bigben_device *bigben = container_of(work, in bigben_worker() local
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()
223 report_field->value[2] = bigben->led_state; 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()
247 report_field->value[2] = bigben->right_motor_on; in bigben_worker()
248 report_field->value[3] = bigben->left_motor_force; 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()
270 struct bigben_device *bigben = hid_get_drvdata(hid); in hid_bigben_play_effect() local
275 if (!bigben) { 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()
294 bigben_schedule_work(bigben); in hid_bigben_play_effect()
305 struct bigben_device *bigben = hid_get_drvdata(hid); in bigben_set_led() local
310 if (!bigben) { 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()
329 bigben_schedule_work(bigben); in bigben_set_led()
340 struct bigben_device *bigben = hid_get_drvdata(hid); in bigben_get_led() local
343 if (!bigben) { 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()
358 struct bigben_device *bigben = hid_get_drvdata(hid); in bigben_remove() local
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()
372 struct bigben_device *bigben; in bigben_probe() local
379 bigben = devm_kzalloc(&hid->dev, sizeof(*bigben), GFP_KERNEL); in bigben_probe()
380 if (!bigben) in bigben_probe()
382 hid_set_drvdata(hid, bigben); 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()
414 INIT_WORK(&bigben->worker, bigben_worker); in bigben_probe()
415 spin_lock_init(&bigben->lock); in bigben_probe()
444 bigben->leds[n] = 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()
456 bigben_schedule_work(bigben); in bigben_probe()