Lines Matching refs:appleir

107 struct appleir {  struct
151 static void key_up(struct hid_device *hid, struct appleir *appleir, int key) in key_up() argument
153 input_report_key(appleir->input_dev, key, 0); in key_up()
154 input_sync(appleir->input_dev); in key_up()
157 static void key_down(struct hid_device *hid, struct appleir *appleir, int key) in key_down() argument
159 input_report_key(appleir->input_dev, key, 1); in key_down()
160 input_sync(appleir->input_dev); in key_down()
163 static void battery_flat(struct appleir *appleir) in battery_flat() argument
165 dev_err(&appleir->input_dev->dev, "possible flat battery?\n"); in battery_flat()
170 struct appleir *appleir = from_timer(appleir, t, key_up_timer); in key_up_tick() local
171 struct hid_device *hid = appleir->hid; in key_up_tick()
174 spin_lock_irqsave(&appleir->lock, flags); in key_up_tick()
175 if (appleir->current_key) { in key_up_tick()
176 key_up(hid, appleir, appleir->current_key); in key_up_tick()
177 appleir->current_key = 0; in key_up_tick()
179 spin_unlock_irqrestore(&appleir->lock, flags); in key_up_tick()
185 struct appleir *appleir = hid_get_drvdata(hid); in appleir_raw_event() local
197 spin_lock_irqsave(&appleir->lock, flags); in appleir_raw_event()
202 if (appleir->current_key) in appleir_raw_event()
203 key_up(hid, appleir, appleir->current_key); in appleir_raw_event()
206 if (appleir->prev_key_idx > 0) in appleir_raw_event()
207 index = appleir->prev_key_idx; in appleir_raw_event()
212 appleir->current_key = appleir->keymap[index]; in appleir_raw_event()
214 key_down(hid, appleir, appleir->current_key); in appleir_raw_event()
220 mod_timer(&appleir->key_up_timer, jiffies + HZ / 8); in appleir_raw_event()
221 appleir->prev_key_idx = 0; in appleir_raw_event()
224 appleir->prev_key_idx = -index; in appleir_raw_event()
225 spin_unlock_irqrestore(&appleir->lock, flags); in appleir_raw_event()
229 appleir->prev_key_idx = 0; in appleir_raw_event()
232 key_down(hid, appleir, appleir->current_key); in appleir_raw_event()
237 mod_timer(&appleir->key_up_timer, jiffies + HZ / 8); in appleir_raw_event()
242 battery_flat(appleir); in appleir_raw_event()
255 struct appleir *appleir = hid_get_drvdata(hid); in appleir_input_configured() local
258 appleir->input_dev = input_dev; in appleir_input_configured()
260 input_dev->keycode = appleir->keymap; in appleir_input_configured()
262 input_dev->keycodemax = ARRAY_SIZE(appleir->keymap); in appleir_input_configured()
266 memcpy(appleir->keymap, appleir_key_table, sizeof(appleir->keymap)); in appleir_input_configured()
268 set_bit(appleir->keymap[i], input_dev->keybit); in appleir_input_configured()
284 struct appleir *appleir; in appleir_probe() local
286 appleir = devm_kzalloc(&hid->dev, sizeof(struct appleir), GFP_KERNEL); in appleir_probe()
287 if (!appleir) in appleir_probe()
290 appleir->hid = hid; in appleir_probe()
295 spin_lock_init(&appleir->lock); in appleir_probe()
296 timer_setup(&appleir->key_up_timer, key_up_tick, 0); in appleir_probe()
298 hid_set_drvdata(hid, appleir); in appleir_probe()
314 devm_kfree(&hid->dev, appleir); in appleir_probe()
320 struct appleir *appleir = hid_get_drvdata(hid); in appleir_remove() local
322 del_timer_sync(&appleir->key_up_timer); in appleir_remove()