diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-06 18:32:12 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-06 18:32:12 -0800 |
commit | 9e9bc9736756f25d6c47b4eba0ebf25b20a6f153 (patch) | |
tree | 647240f479c5f23910c3e6194d1c35b6ba54d75e /drivers/media/video/em28xx/em28xx-input.c | |
parent | 3c0cb7c31c206aaedb967e44b98442bbeb17a6c4 (diff) | |
parent | e3c92215198cb6aa00ad38db2780faa6b72e0a3f (diff) | |
download | linux-9e9bc9736756f25d6c47b4eba0ebf25b20a6f153.tar.gz linux-9e9bc9736756f25d6c47b4eba0ebf25b20a6f153.tar.bz2 linux-9e9bc9736756f25d6c47b4eba0ebf25b20a6f153.zip |
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6
* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (255 commits)
[media] radio-aimslab.c: Fix gcc 4.5+ bug
[media] cx25821: Fix compilation breakage due to BKL dependency
[media] v4l2-compat-ioctl32: fix compile warning
[media] zoran: fix compiler warning
[media] tda18218: fix compile warning
[media] ngene: fix compile warning
[media] DVB: IR support for TechnoTrend CT-3650
[media] cx23885, cimax2.c: Fix case of two CAM insertion irq
[media] ir-nec-decoder: fix repeat key issue
[media] staging: se401 depends on USB
[media] staging: usbvideo/vicam depends on USB
[media] soc_camera: Add the ability to bind regulators to soc_camedra devices
[media] V4L2: Add a v4l2-subdev (soc-camera) driver for OmniVision OV2640 sensor
[media] v4l: soc-camera: switch to .unlocked_ioctl
[media] v4l: ov772x: simplify pointer dereference
[media] ov9640: fix OmniVision OV9640 sensor driver's priv data retrieving
[media] ov9640: use macro to request OmniVision OV9640 sensor private data
[media] ivtv-i2c: Fix two warnings
[media] staging/lirc: Update lirc TODO files
[media] cx88: Remove the obsolete i2c_adapter.id field
...
Diffstat (limited to 'drivers/media/video/em28xx/em28xx-input.c')
-rw-r--r-- | drivers/media/video/em28xx/em28xx-input.c | 78 |
1 files changed, 36 insertions, 42 deletions
diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c index 6759cd5570dd..29cc74441a7d 100644 --- a/drivers/media/video/em28xx/em28xx-input.c +++ b/drivers/media/video/em28xx/em28xx-input.c @@ -25,7 +25,6 @@ #include <linux/init.h> #include <linux/delay.h> #include <linux/interrupt.h> -#include <linux/input.h> #include <linux/usb.h> #include <linux/slab.h> @@ -64,7 +63,7 @@ struct em28xx_ir_poll_result { struct em28xx_IR { struct em28xx *dev; - struct input_dev *input; + struct rc_dev *rc; char name[32]; char phys[32]; @@ -75,10 +74,6 @@ struct em28xx_IR { unsigned int last_readcount; int (*get_key)(struct em28xx_IR *, struct em28xx_ir_poll_result *); - - /* IR device properties */ - - struct ir_dev_props props; }; /********************************************************** @@ -302,12 +297,12 @@ static void em28xx_ir_handle_key(struct em28xx_IR *ir) poll_result.toggle_bit, poll_result.read_count, poll_result.rc_address, poll_result.rc_data[0]); if (ir->full_code) - ir_keydown(ir->input, + rc_keydown(ir->rc, poll_result.rc_address << 8 | poll_result.rc_data[0], poll_result.toggle_bit); else - ir_keydown(ir->input, + rc_keydown(ir->rc, poll_result.rc_data[0], poll_result.toggle_bit); @@ -331,9 +326,9 @@ static void em28xx_ir_work(struct work_struct *work) schedule_delayed_work(&ir->work, msecs_to_jiffies(ir->polling)); } -static int em28xx_ir_start(void *priv) +static int em28xx_ir_start(struct rc_dev *rc) { - struct em28xx_IR *ir = priv; + struct em28xx_IR *ir = rc->priv; INIT_DELAYED_WORK(&ir->work, em28xx_ir_work); schedule_delayed_work(&ir->work, 0); @@ -341,30 +336,30 @@ static int em28xx_ir_start(void *priv) return 0; } -static void em28xx_ir_stop(void *priv) +static void em28xx_ir_stop(struct rc_dev *rc) { - struct em28xx_IR *ir = priv; + struct em28xx_IR *ir = rc->priv; cancel_delayed_work_sync(&ir->work); } -int em28xx_ir_change_protocol(void *priv, u64 ir_type) +int em28xx_ir_change_protocol(struct rc_dev *rc_dev, u64 rc_type) { int rc = 0; - struct em28xx_IR *ir = priv; + struct em28xx_IR *ir = rc_dev->priv; struct em28xx *dev = ir->dev; u8 ir_config = EM2874_IR_RC5; /* Adjust xclk based o IR table for RC5/NEC tables */ - if (ir_type == IR_TYPE_RC5) { + if (rc_type == RC_TYPE_RC5) { dev->board.xclk |= EM28XX_XCLK_IR_RC5_MODE; ir->full_code = 1; - } else if (ir_type == IR_TYPE_NEC) { + } else if (rc_type == RC_TYPE_NEC) { dev->board.xclk &= ~EM28XX_XCLK_IR_RC5_MODE; ir_config = EM2874_IR_NEC; ir->full_code = 1; - } else if (ir_type != IR_TYPE_UNKNOWN) + } else if (rc_type != RC_TYPE_UNKNOWN) rc = -EINVAL; em28xx_write_reg_bits(dev, EM28XX_R0F_XCLK, dev->board.xclk, @@ -391,7 +386,7 @@ int em28xx_ir_change_protocol(void *priv, u64 ir_type) int em28xx_ir_init(struct em28xx *dev) { struct em28xx_IR *ir; - struct input_dev *input_dev; + struct rc_dev *rc; int err = -ENOMEM; if (dev->board.ir_codes == NULL) { @@ -400,28 +395,27 @@ int em28xx_ir_init(struct em28xx *dev) } ir = kzalloc(sizeof(*ir), GFP_KERNEL); - input_dev = input_allocate_device(); - if (!ir || !input_dev) + rc = rc_allocate_device(); + if (!ir || !rc) goto err_out_free; /* record handles to ourself */ ir->dev = dev; dev->ir = ir; - - ir->input = input_dev; + ir->rc = rc; /* * em2874 supports more protocols. For now, let's just announce * the two protocols that were already tested */ - ir->props.allowed_protos = IR_TYPE_RC5 | IR_TYPE_NEC; - ir->props.priv = ir; - ir->props.change_protocol = em28xx_ir_change_protocol; - ir->props.open = em28xx_ir_start; - ir->props.close = em28xx_ir_stop; + rc->allowed_protos = RC_TYPE_RC5 | RC_TYPE_NEC; + rc->priv = ir; + rc->change_protocol = em28xx_ir_change_protocol; + rc->open = em28xx_ir_start; + rc->close = em28xx_ir_stop; /* By default, keep protocol field untouched */ - err = em28xx_ir_change_protocol(ir, IR_TYPE_UNKNOWN); + err = em28xx_ir_change_protocol(rc, RC_TYPE_UNKNOWN); if (err) goto err_out_free; @@ -435,27 +429,27 @@ int em28xx_ir_init(struct em28xx *dev) usb_make_path(dev->udev, ir->phys, sizeof(ir->phys)); strlcat(ir->phys, "/input0", sizeof(ir->phys)); - input_dev->name = ir->name; - input_dev->phys = ir->phys; - input_dev->id.bustype = BUS_USB; - input_dev->id.version = 1; - input_dev->id.vendor = le16_to_cpu(dev->udev->descriptor.idVendor); - input_dev->id.product = le16_to_cpu(dev->udev->descriptor.idProduct); - - input_dev->dev.parent = &dev->udev->dev; - - + rc->input_name = ir->name; + rc->input_phys = ir->phys; + rc->input_id.bustype = BUS_USB; + rc->input_id.version = 1; + rc->input_id.vendor = le16_to_cpu(dev->udev->descriptor.idVendor); + rc->input_id.product = le16_to_cpu(dev->udev->descriptor.idProduct); + rc->dev.parent = &dev->udev->dev; + rc->map_name = dev->board.ir_codes; + rc->driver_name = MODULE_NAME; /* all done */ - err = ir_input_register(ir->input, dev->board.ir_codes, - &ir->props, MODULE_NAME); + err = rc_register_device(rc); if (err) goto err_out_stop; return 0; + err_out_stop: dev->ir = NULL; err_out_free: + rc_free_device(rc); kfree(ir); return err; } @@ -468,8 +462,8 @@ int em28xx_ir_fini(struct em28xx *dev) if (!ir) return 0; - em28xx_ir_stop(ir); - ir_input_unregister(ir->input); + em28xx_ir_stop(ir->rc); + rc_unregister_device(ir->rc); kfree(ir); /* done */ |