Lines Matching full:ir
2 // handle au0828 IR remotes via linux kernel input layer.
36 int (*get_key_i2c)(struct au0828_rc *ir);
40 * AU8522 has a builtin IR receiver. Add functions to get IR from it
43 static int au8522_rc_write(struct au0828_rc *ir, u16 reg, u8 data) in au8522_rc_write() argument
47 struct i2c_msg msg = { .addr = ir->i2c_dev_addr, .flags = 0, in au8522_rc_write()
50 rc = i2c_transfer(ir->dev->i2c_client.adapter, &msg, 1); in au8522_rc_write()
58 static int au8522_rc_read(struct au0828_rc *ir, u16 reg, int val, in au8522_rc_read() argument
63 struct i2c_msg msg[2] = { { .addr = ir->i2c_dev_addr, .flags = 0, in au8522_rc_read()
65 { .addr = ir->i2c_dev_addr, .flags = I2C_M_RD, in au8522_rc_read()
75 rc = i2c_transfer(ir->dev->i2c_client.adapter, msg, 2); in au8522_rc_read()
83 static int au8522_rc_andor(struct au0828_rc *ir, u16 reg, u8 mask, u8 value) in au8522_rc_andor() argument
88 rc = au8522_rc_read(ir, reg, -1, &buf, 1); in au8522_rc_andor()
99 return au8522_rc_write(ir, reg, buf); in au8522_rc_andor()
102 #define au8522_rc_set(ir, reg, bit) au8522_rc_andor(ir, (reg), (bit), (bit)) argument
103 #define au8522_rc_clear(ir, reg, bit) au8522_rc_andor(ir, (reg), (bit), 0) argument
113 static int au0828_get_key_au8522(struct au0828_rc *ir) in au0828_get_key_au8522() argument
122 if (test_bit(DEV_DISCONNECTED, &ir->dev->dev_state)) in au0828_get_key_au8522()
125 /* Check IR int */ in au0828_get_key_au8522()
126 rc = au8522_rc_read(ir, 0xe1, -1, buf, 1); in au0828_get_key_au8522()
128 /* Be sure that IR is enabled */ in au0828_get_key_au8522()
129 au8522_rc_set(ir, 0xe0, 1 << 4); in au0828_get_key_au8522()
134 rc = au8522_rc_read(ir, 0xe3, 0x11, buf, sizeof(buf)); in au0828_get_key_au8522()
140 /* Disable IR */ in au0828_get_key_au8522()
141 au8522_rc_clear(ir, 0xe0, 1 << 4); in au0828_get_key_au8522()
143 /* Enable IR */ in au0828_get_key_au8522()
144 au8522_rc_set(ir, 0xe0, 1 << 4); in au0828_get_key_au8522()
185 ir_raw_event_store(ir->rc, &rawir); in au0828_get_key_au8522()
193 ir_raw_event_store(ir->rc, &rawir); in au0828_get_key_au8522()
205 ir_raw_event_store(ir->rc, &rawir); in au0828_get_key_au8522()
207 ir_raw_event_handle(ir->rc); in au0828_get_key_au8522()
213 * Generic IR code
218 struct au0828_rc *ir = container_of(work, struct au0828_rc, work.work); in au0828_rc_work() local
221 rc = ir->get_key_i2c(ir); in au0828_rc_work()
225 schedule_delayed_work(&ir->work, msecs_to_jiffies(ir->polling)); in au0828_rc_work()
230 struct au0828_rc *ir = rc->priv; in au0828_rc_start() local
232 INIT_DELAYED_WORK(&ir->work, au0828_rc_work); in au0828_rc_start()
234 /* Enable IR */ in au0828_rc_start()
235 au8522_rc_set(ir, 0xe0, 1 << 4); in au0828_rc_start()
237 schedule_delayed_work(&ir->work, msecs_to_jiffies(ir->polling)); in au0828_rc_start()
244 struct au0828_rc *ir = rc->priv; in au0828_rc_stop() local
246 cancel_delayed_work_sync(&ir->work); in au0828_rc_stop()
249 if (!test_bit(DEV_DISCONNECTED, &ir->dev->dev_state)) { in au0828_rc_stop()
250 /* Disable IR */ in au0828_rc_stop()
251 au8522_rc_clear(ir, 0xe0, 1 << 4); in au0828_rc_stop()
274 struct au0828_rc *ir; in au0828_rc_register() local
286 ir = kzalloc(sizeof(*ir), GFP_KERNEL); in au0828_rc_register()
288 if (!ir || !rc) in au0828_rc_register()
292 ir->dev = dev; in au0828_rc_register()
293 dev->ir = ir; in au0828_rc_register()
294 ir->rc = rc; in au0828_rc_register()
296 rc->priv = ir; in au0828_rc_register()
304 ir->get_key_i2c = au0828_get_key_au8522; in au0828_rc_register()
311 ir->i2c_dev_addr = i2c_rc_dev_addr; in au0828_rc_register()
314 /* This is how often we ask the chip for IR information */ in au0828_rc_register()
315 ir->polling = 100; /* ms */ in au0828_rc_register()
318 snprintf(ir->name, sizeof(ir->name), "au0828 IR (%s)", in au0828_rc_register()
321 usb_make_path(dev->usbdev, ir->phys, sizeof(ir->phys)); in au0828_rc_register()
322 strlcat(ir->phys, "/input0", sizeof(ir->phys)); in au0828_rc_register()
324 rc->device_name = ir->name; in au0828_rc_register()
325 rc->input_phys = ir->phys; in au0828_rc_register()
340 pr_info("Remote controller %s initialized\n", ir->name); in au0828_rc_register()
345 dev->ir = NULL; in au0828_rc_register()
347 kfree(ir); in au0828_rc_register()
353 struct au0828_rc *ir = dev->ir; in au0828_rc_unregister() local
356 if (!ir) in au0828_rc_unregister()
359 rc_unregister_device(ir->rc); in au0828_rc_unregister()
362 kfree(ir); in au0828_rc_unregister()
363 dev->ir = NULL; in au0828_rc_unregister()
368 struct au0828_rc *ir = dev->ir; in au0828_rc_suspend() local
370 if (!ir) in au0828_rc_suspend()
375 cancel_delayed_work_sync(&ir->work); in au0828_rc_suspend()
377 /* Disable IR */ in au0828_rc_suspend()
378 au8522_rc_clear(ir, 0xe0, 1 << 4); in au0828_rc_suspend()
385 struct au0828_rc *ir = dev->ir; in au0828_rc_resume() local
387 if (!ir) in au0828_rc_resume()
392 /* Enable IR */ in au0828_rc_resume()
393 au8522_rc_set(ir, 0xe0, 1 << 4); in au0828_rc_resume()
395 schedule_delayed_work(&ir->work, msecs_to_jiffies(ir->polling)); in au0828_rc_resume()