diff options
author | Andy Walls <awalls@md.metrocast.net> | 2010-06-27 16:17:06 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-08-02 14:31:28 -0400 |
commit | eeefae532e723e8ce62664cb1d299a0baad50f35 (patch) | |
tree | 9f26290e5e06afcabe0ccae5d050bbb4df8e5196 /drivers | |
parent | b192ca983746585e807259414f8d6f58cb28311f (diff) |
V4L/DVB: cx23885: Convert from struct card_ir to struct cx23885_ir_input for IR Rx
Move from the generic, shared card_ir state structure to a cx23885 driver
specific IR state structure in anticipation of moving to the new IR pulse
decoders in the IR core.
Fix up the card name truncation in the dmesg log while we're at it,
by avoiding using fixed length string storage in our new IR state
structure.
Signed-off-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/cx23885/cx23885-input.c | 22 | ||||
-rw-r--r-- | drivers/media/video/cx23885/cx23885.h | 19 |
2 files changed, 31 insertions, 10 deletions
diff --git a/drivers/media/video/cx23885/cx23885-input.c b/drivers/media/video/cx23885/cx23885-input.c index 5de6ba98f7a8..c1abc35f9741 100644 --- a/drivers/media/video/cx23885/cx23885-input.c +++ b/drivers/media/video/cx23885/cx23885-input.c | |||
@@ -62,7 +62,7 @@ static inline unsigned int rc5_command(u32 rc5_baseband) | |||
62 | 62 | ||
63 | static void cx23885_input_process_raw_rc5(struct cx23885_dev *dev) | 63 | static void cx23885_input_process_raw_rc5(struct cx23885_dev *dev) |
64 | { | 64 | { |
65 | struct card_ir *ir_input = dev->ir_input; | 65 | struct cx23885_ir_input *ir_input = dev->ir_input; |
66 | unsigned int code, command; | 66 | unsigned int code, command; |
67 | u32 rc5; | 67 | u32 rc5; |
68 | 68 | ||
@@ -110,7 +110,7 @@ static void cx23885_input_next_pulse_width_rc5(struct cx23885_dev *dev, | |||
110 | u32 ns_pulse) | 110 | u32 ns_pulse) |
111 | { | 111 | { |
112 | const int rc5_quarterbit_ns = 444444; /* 32 cycles/36 kHz/2 = 444 us */ | 112 | const int rc5_quarterbit_ns = 444444; /* 32 cycles/36 kHz/2 = 444 us */ |
113 | struct card_ir *ir_input = dev->ir_input; | 113 | struct cx23885_ir_input *ir_input = dev->ir_input; |
114 | int i, level, quarterbits, halfbits; | 114 | int i, level, quarterbits, halfbits; |
115 | 115 | ||
116 | if (!ir_input->active) { | 116 | if (!ir_input->active) { |
@@ -166,7 +166,7 @@ static void cx23885_input_next_pulse_width_rc5(struct cx23885_dev *dev, | |||
166 | static void cx23885_input_process_pulse_widths_rc5(struct cx23885_dev *dev, | 166 | static void cx23885_input_process_pulse_widths_rc5(struct cx23885_dev *dev, |
167 | bool add_eom) | 167 | bool add_eom) |
168 | { | 168 | { |
169 | struct card_ir *ir_input = dev->ir_input; | 169 | struct cx23885_ir_input *ir_input = dev->ir_input; |
170 | struct ir_input_state *ir_input_state = &ir_input->ir; | 170 | struct ir_input_state *ir_input_state = &ir_input->ir; |
171 | 171 | ||
172 | u32 ns_pulse[RC5_HALF_BITS+1]; | 172 | u32 ns_pulse[RC5_HALF_BITS+1]; |
@@ -243,7 +243,7 @@ void cx23885_input_rx_work_handler(struct cx23885_dev *dev, u32 events) | |||
243 | 243 | ||
244 | static void cx23885_input_ir_start(struct cx23885_dev *dev) | 244 | static void cx23885_input_ir_start(struct cx23885_dev *dev) |
245 | { | 245 | { |
246 | struct card_ir *ir_input = dev->ir_input; | 246 | struct cx23885_ir_input *ir_input = dev->ir_input; |
247 | struct ir_input_state *ir_input_state = &ir_input->ir; | 247 | struct ir_input_state *ir_input_state = &ir_input->ir; |
248 | struct v4l2_subdev_ir_parameters params; | 248 | struct v4l2_subdev_ir_parameters params; |
249 | 249 | ||
@@ -303,7 +303,7 @@ static void cx23885_input_ir_start(struct cx23885_dev *dev) | |||
303 | 303 | ||
304 | static void cx23885_input_ir_stop(struct cx23885_dev *dev) | 304 | static void cx23885_input_ir_stop(struct cx23885_dev *dev) |
305 | { | 305 | { |
306 | struct card_ir *ir_input = dev->ir_input; | 306 | struct cx23885_ir_input *ir_input = dev->ir_input; |
307 | struct v4l2_subdev_ir_parameters params; | 307 | struct v4l2_subdev_ir_parameters params; |
308 | 308 | ||
309 | if (dev->sd_ir == NULL) | 309 | if (dev->sd_ir == NULL) |
@@ -338,7 +338,7 @@ static void cx23885_input_ir_stop(struct cx23885_dev *dev) | |||
338 | 338 | ||
339 | int cx23885_input_init(struct cx23885_dev *dev) | 339 | int cx23885_input_init(struct cx23885_dev *dev) |
340 | { | 340 | { |
341 | struct card_ir *ir; | 341 | struct cx23885_ir_input *ir; |
342 | struct input_dev *input_dev; | 342 | struct input_dev *input_dev; |
343 | char *ir_codes = NULL; | 343 | char *ir_codes = NULL; |
344 | int ir_type, ir_addr, ir_start; | 344 | int ir_type, ir_addr, ir_start; |
@@ -376,9 +376,9 @@ int cx23885_input_init(struct cx23885_dev *dev) | |||
376 | ir->start = ir_start; | 376 | ir->start = ir_start; |
377 | 377 | ||
378 | /* init input device */ | 378 | /* init input device */ |
379 | snprintf(ir->name, sizeof(ir->name), "cx23885 IR (%s)", | 379 | ir->name = kasprintf(GFP_KERNEL, "cx23885 IR (%s)", |
380 | cx23885_boards[dev->board].name); | 380 | cx23885_boards[dev->board].name); |
381 | snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(dev->pci)); | 381 | ir->phys = kasprintf(GFP_KERNEL, "pci-%s/ir0", pci_name(dev->pci)); |
382 | 382 | ||
383 | ret = ir_input_init(input_dev, &ir->ir, ir_type); | 383 | ret = ir_input_init(input_dev, &ir->ir, ir_type); |
384 | if (ret < 0) | 384 | if (ret < 0) |
@@ -410,6 +410,8 @@ err_out_stop: | |||
410 | cx23885_input_ir_stop(dev); | 410 | cx23885_input_ir_stop(dev); |
411 | dev->ir_input = NULL; | 411 | dev->ir_input = NULL; |
412 | err_out_free: | 412 | err_out_free: |
413 | kfree(ir->phys); | ||
414 | kfree(ir->name); | ||
413 | kfree(ir); | 415 | kfree(ir); |
414 | return ret; | 416 | return ret; |
415 | } | 417 | } |
@@ -422,6 +424,8 @@ void cx23885_input_fini(struct cx23885_dev *dev) | |||
422 | if (dev->ir_input == NULL) | 424 | if (dev->ir_input == NULL) |
423 | return; | 425 | return; |
424 | ir_input_unregister(dev->ir_input->dev); | 426 | ir_input_unregister(dev->ir_input->dev); |
427 | kfree(dev->ir_input->phys); | ||
428 | kfree(dev->ir_input->name); | ||
425 | kfree(dev->ir_input); | 429 | kfree(dev->ir_input); |
426 | dev->ir_input = NULL; | 430 | dev->ir_input = NULL; |
427 | } | 431 | } |
diff --git a/drivers/media/video/cx23885/cx23885.h b/drivers/media/video/cx23885/cx23885.h index 8d6a55e54ee7..25167dd22ab8 100644 --- a/drivers/media/video/cx23885/cx23885.h +++ b/drivers/media/video/cx23885/cx23885.h | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <media/tveeprom.h> | 30 | #include <media/tveeprom.h> |
31 | #include <media/videobuf-dma-sg.h> | 31 | #include <media/videobuf-dma-sg.h> |
32 | #include <media/videobuf-dvb.h> | 32 | #include <media/videobuf-dvb.h> |
33 | #include <media/ir-common.h> | ||
33 | 34 | ||
34 | #include "btcx-risc.h" | 35 | #include "btcx-risc.h" |
35 | #include "cx23885-reg.h" | 36 | #include "cx23885-reg.h" |
@@ -304,6 +305,22 @@ struct cx23885_tsport { | |||
304 | void *port_priv; | 305 | void *port_priv; |
305 | }; | 306 | }; |
306 | 307 | ||
308 | struct cx23885_ir_input { | ||
309 | struct input_dev *dev; | ||
310 | struct ir_input_state ir; | ||
311 | char *name; | ||
312 | char *phys; | ||
313 | |||
314 | int start; | ||
315 | int addr; | ||
316 | int rc5_key_timeout; | ||
317 | struct timer_list timer_keyup; | ||
318 | u32 last_rc5; | ||
319 | u32 last_bit; | ||
320 | u32 code; | ||
321 | int active; | ||
322 | }; | ||
323 | |||
307 | struct cx23885_dev { | 324 | struct cx23885_dev { |
308 | atomic_t refcount; | 325 | atomic_t refcount; |
309 | struct v4l2_device v4l2_dev; | 326 | struct v4l2_device v4l2_dev; |
@@ -363,7 +380,7 @@ struct cx23885_dev { | |||
363 | struct work_struct ir_tx_work; | 380 | struct work_struct ir_tx_work; |
364 | unsigned long ir_tx_notifications; | 381 | unsigned long ir_tx_notifications; |
365 | 382 | ||
366 | struct card_ir *ir_input; | 383 | struct cx23885_ir_input *ir_input; |
367 | atomic_t ir_input_stopping; | 384 | atomic_t ir_input_stopping; |
368 | 385 | ||
369 | /* V4l */ | 386 | /* V4l */ |