Lines Matching defs:bigben

188 static inline void bigben_schedule_work(struct bigben_device *bigben)
192 spin_lock_irqsave(&bigben->lock, flags);
193 if (!bigben->removed)
194 schedule_work(&bigben->worker);
195 spin_unlock_irqrestore(&bigben->lock, flags);
200 struct bigben_device *bigben = container_of(work,
202 struct hid_field *report_field = bigben->report->field[0];
209 buf = hid_alloc_report_buf(bigben->report, GFP_KERNEL);
213 len = hid_report_len(bigben->report);
216 spin_lock_irqsave(&bigben->lock, flags);
218 if (bigben->work_led) {
219 bigben->work_led = false;
223 report_field->value[2] = bigben->led_state;
229 hid_output_report(bigben->report, buf);
232 spin_unlock_irqrestore(&bigben->lock, flags);
235 hid_hw_raw_request(bigben->hid, bigben->report->id, buf, len,
236 bigben->report->type, HID_REQ_SET_REPORT);
240 spin_lock_irqsave(&bigben->lock, flags);
242 if (bigben->work_ff) {
243 bigben->work_ff = false;
247 report_field->value[2] = bigben->right_motor_on;
248 report_field->value[3] = bigben->left_motor_force;
253 hid_output_report(bigben->report, buf);
256 spin_unlock_irqrestore(&bigben->lock, flags);
259 hid_hw_raw_request(bigben->hid, bigben->report->id, buf, len,
260 bigben->report->type, HID_REQ_SET_REPORT);
270 struct bigben_device *bigben = hid_get_drvdata(hid);
275 if (!bigben) {
286 if (right_motor_on != bigben->right_motor_on ||
287 left_motor_force != bigben->left_motor_force) {
288 spin_lock_irqsave(&bigben->lock, flags);
289 bigben->right_motor_on = right_motor_on;
290 bigben->left_motor_force = left_motor_force;
291 bigben->work_ff = true;
292 spin_unlock_irqrestore(&bigben->lock, flags);
294 bigben_schedule_work(bigben);
305 struct bigben_device *bigben = hid_get_drvdata(hid);
310 if (!bigben) {
316 if (led == bigben->leds[n]) {
317 spin_lock_irqsave(&bigben->lock, flags);
319 work = (bigben->led_state & BIT(n));
320 bigben->led_state &= ~BIT(n);
322 work = !(bigben->led_state & BIT(n));
323 bigben->led_state |= BIT(n);
325 spin_unlock_irqrestore(&bigben->lock, flags);
328 bigben->work_led = true;
329 bigben_schedule_work(bigben);
340 struct bigben_device *bigben = hid_get_drvdata(hid);
343 if (!bigben) {
349 if (led == bigben->leds[n])
350 return (bigben->led_state & BIT(n)) ? LED_ON : LED_OFF;
358 struct bigben_device *bigben = hid_get_drvdata(hid);
361 spin_lock_irqsave(&bigben->lock, flags);
362 bigben->removed = true;
363 spin_unlock_irqrestore(&bigben->lock, flags);
365 cancel_work_sync(&bigben->worker);
372 struct bigben_device *bigben;
379 bigben = devm_kzalloc(&hid->dev, sizeof(*bigben), GFP_KERNEL);
380 if (!bigben)
382 hid_set_drvdata(hid, bigben);
383 bigben->hid = hid;
384 bigben->removed = false;
398 bigben->report = hid_validate_values(hid, HID_OUTPUT_REPORT, 0, 0, 8);
399 if (!bigben->report) {
414 INIT_WORK(&bigben->worker, bigben_worker);
415 spin_lock_init(&bigben->lock);
422 name_sz = strlen(dev_name(&hid->dev)) + strlen(":red:bigben#") + 1;
436 "%s:red:bigben%d",
444 bigben->leds[n] = led;
451 bigben->led_state = BIT(0);
452 bigben->right_motor_on = 0;
453 bigben->left_motor_force = 0;
454 bigben->work_led = true;
455 bigben->work_ff = true;
456 bigben_schedule_work(bigben);
485 .name = "bigben",