Lines Matching +full:enable +full:- +full:remote +full:- +full:sense

1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * Infrared remote control input device
12 * derived from Linux kernel files linux/media/video/.../...-input.c marked as:
25 #include "cx23885-input.h"
28 #include <media/rc-core.h>
29 #include <media/v4l2-subdev.h>
36 struct cx23885_kernel_ir *kernel_ir = dev->kernel_ir; in cx23885_input_process_measurements()
45 v4l2_subdev_call(dev->sd_ir, ir, rx_read, (u8 *) ir_core_event, in cx23885_input_process_measurements()
51 ir_raw_event_store(kernel_ir->rc, in cx23885_input_process_measurements()
58 ir_raw_event_overflow(kernel_ir->rc); in cx23885_input_process_measurements()
60 ir_raw_event_handle(kernel_ir->rc); in cx23885_input_process_measurements()
68 if (dev->sd_ir == NULL || events == 0) in cx23885_input_rx_work_handler()
71 switch (dev->board) { in cx23885_input_rx_work_handler()
106 v4l2_subdev_call(dev->sd_ir, ir, rx_g_parameters, &params); in cx23885_input_rx_work_handler()
107 params.enable = false; in cx23885_input_rx_work_handler()
109 params.shutdown = atomic_read(&dev->ir_input_stopping); in cx23885_input_rx_work_handler()
110 v4l2_subdev_call(dev->sd_ir, ir, rx_s_parameters, &params); in cx23885_input_rx_work_handler()
118 params.enable = true; in cx23885_input_rx_work_handler()
120 params.shutdown = atomic_read(&dev->ir_input_stopping); in cx23885_input_rx_work_handler()
121 v4l2_subdev_call(dev->sd_ir, ir, rx_s_parameters, &params); in cx23885_input_rx_work_handler()
129 if (dev->sd_ir == NULL) in cx23885_input_ir_start()
130 return -ENODEV; in cx23885_input_ir_start()
132 atomic_set(&dev->ir_input_stopping, 0); in cx23885_input_ir_start()
134 v4l2_subdev_call(dev->sd_ir, ir, rx_g_parameters, &params); in cx23885_input_ir_start()
135 switch (dev->board) { in cx23885_input_ir_start()
154 params.enable = true; in cx23885_input_ir_start()
158 /* Setup for baseband compatible with both RC-5 and RC-6A */ in cx23885_input_ir_start()
160 /* RC-5: 2,222,222 ns = 1/36 kHz * 32 cycles * 2 marks * 1.25*/ in cx23885_input_ir_start()
161 /* RC-6A: 3,333,333 ns = 1/36 kHz * 16 cycles * 6 marks * 1.25*/ in cx23885_input_ir_start()
163 /* RC-5: 666,667 ns = 1/36 kHz * 32 cycles * 1 mark * 0.75 */ in cx23885_input_ir_start()
164 /* RC-6A: 333,333 ns = 1/36 kHz * 16 cycles * 1 mark * 0.75 */ in cx23885_input_ir_start()
167 * This board has inverted receive sense: in cx23885_input_ir_start()
182 params.enable = true; in cx23885_input_ir_start()
208 v4l2_subdev_call(dev->sd_ir, ir, rx_s_parameters, &params); in cx23885_input_ir_start()
214 struct cx23885_kernel_ir *kernel_ir = rc->priv; in cx23885_input_ir_open()
216 if (kernel_ir->cx == NULL) in cx23885_input_ir_open()
217 return -ENODEV; in cx23885_input_ir_open()
219 return cx23885_input_ir_start(kernel_ir->cx); in cx23885_input_ir_open()
226 if (dev->sd_ir == NULL) in cx23885_input_ir_stop()
234 * re-enable the subdevice. in cx23885_input_ir_stop()
236 atomic_set(&dev->ir_input_stopping, 1); in cx23885_input_ir_stop()
237 v4l2_subdev_call(dev->sd_ir, ir, rx_g_parameters, &params); in cx23885_input_ir_stop()
239 params.enable = false; in cx23885_input_ir_stop()
242 v4l2_subdev_call(dev->sd_ir, ir, rx_s_parameters, &params); in cx23885_input_ir_stop()
243 v4l2_subdev_call(dev->sd_ir, ir, rx_g_parameters, &params); in cx23885_input_ir_stop()
245 flush_work(&dev->cx25840_work); in cx23885_input_ir_stop()
246 flush_work(&dev->ir_rx_work); in cx23885_input_ir_stop()
247 flush_work(&dev->ir_tx_work); in cx23885_input_ir_stop()
252 struct cx23885_kernel_ir *kernel_ir = rc->priv; in cx23885_input_ir_close()
254 if (kernel_ir->cx != NULL) in cx23885_input_ir_close()
255 cx23885_input_ir_stop(kernel_ir->cx); in cx23885_input_ir_close()
271 if (dev->sd_ir == NULL) in cx23885_input_init()
272 return -ENODEV; in cx23885_input_init()
274 switch (dev->board) { in cx23885_input_init()
282 /* The grey Hauppauge RC-5 remote */ in cx23885_input_init()
288 /* The grey Terratec remote with orange buttons */ in cx23885_input_init()
294 /* A guess at the remote */ in cx23885_input_init()
300 /* A guess at the remote */ in cx23885_input_init()
307 /* A guess at the remote */ in cx23885_input_init()
326 return -ENODEV; in cx23885_input_init()
332 return -ENOMEM; in cx23885_input_init()
334 kernel_ir->cx = dev; in cx23885_input_init()
335 kernel_ir->name = kasprintf(GFP_KERNEL, "cx23885 IR (%s)", in cx23885_input_init()
336 cx23885_boards[dev->board].name); in cx23885_input_init()
337 if (!kernel_ir->name) { in cx23885_input_init()
338 ret = -ENOMEM; in cx23885_input_init()
342 kernel_ir->phys = kasprintf(GFP_KERNEL, "pci-%s/ir0", in cx23885_input_init()
343 pci_name(dev->pci)); in cx23885_input_init()
344 if (!kernel_ir->phys) { in cx23885_input_init()
345 ret = -ENOMEM; in cx23885_input_init()
352 ret = -ENOMEM; in cx23885_input_init()
356 kernel_ir->rc = rc; in cx23885_input_init()
357 rc->device_name = kernel_ir->name; in cx23885_input_init()
358 rc->input_phys = kernel_ir->phys; in cx23885_input_init()
359 rc->input_id.bustype = BUS_PCI; in cx23885_input_init()
360 rc->input_id.version = 1; in cx23885_input_init()
361 if (dev->pci->subsystem_vendor) { in cx23885_input_init()
362 rc->input_id.vendor = dev->pci->subsystem_vendor; in cx23885_input_init()
363 rc->input_id.product = dev->pci->subsystem_device; in cx23885_input_init()
365 rc->input_id.vendor = dev->pci->vendor; in cx23885_input_init()
366 rc->input_id.product = dev->pci->device; in cx23885_input_init()
368 rc->dev.parent = &dev->pci->dev; in cx23885_input_init()
369 rc->allowed_protocols = allowed_protos; in cx23885_input_init()
370 rc->priv = kernel_ir; in cx23885_input_init()
371 rc->open = cx23885_input_ir_open; in cx23885_input_init()
372 rc->close = cx23885_input_ir_close; in cx23885_input_init()
373 rc->map_name = rc_map; in cx23885_input_init()
374 rc->driver_name = MODULE_NAME; in cx23885_input_init()
377 dev->kernel_ir = kernel_ir; in cx23885_input_init()
386 dev->kernel_ir = NULL; in cx23885_input_init()
389 kfree(kernel_ir->phys); in cx23885_input_init()
391 kfree(kernel_ir->name); in cx23885_input_init()
402 if (dev->kernel_ir == NULL) in cx23885_input_fini()
404 rc_unregister_device(dev->kernel_ir->rc); in cx23885_input_fini()
405 kfree(dev->kernel_ir->phys); in cx23885_input_fini()
406 kfree(dev->kernel_ir->name); in cx23885_input_fini()
407 kfree(dev->kernel_ir); in cx23885_input_fini()
408 dev->kernel_ir = NULL; in cx23885_input_fini()