diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-05 16:36:30 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-05 16:36:30 -0700 |
commit | f4d33337eac4007793ca11fd1ab68d91ce7aa762 (patch) | |
tree | b775ad213179822225a3e1c1a27e4cc16f8aff68 /drivers/media/pci/bt8xx/bttv-input.c | |
parent | 91c2ff7708d4edf73ef1f0abb3ea4a44b4b0cf1d (diff) | |
parent | 0f3bf3dc1ca394a8385079a5653088672b65c5c4 (diff) | |
download | linux-f4d33337eac4007793ca11fd1ab68d91ce7aa762.tar.bz2 |
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media updates from Mauro Carvalho Chehab:
- removal of sn9c102. This device driver was replaced a long time ago
by gspca
- solo6x10 and go7007 webcam drivers moved from staging into
mainstream. They were waiting for an API to allow setting the image
detection matrix
- SDR drivers moved from staging into mainstream: sdr-msi3101 (renamed
as msi2500) and rtl2832
- added SDR driver for airspy
- added demux driver: si2165
- rework at several RC subsystem, making the code for RC-5 SZ variant
to be added at the standard RC5 decoder
- added decoder for the XMP IR protocol
- tuner driver moved from staging into mainstream: msi3101 (renamed as
msi001)
- added documentation for some additional SDR pixfmt
- some device tree bindings documented
- added support for exynos3250 at s5p-jpeg
- remove the obsolete, unmaintained and broken mx1_camera driver
- added support for remote controllers at au0828 driver
- added a RC driver: sunxi-cir
- several driver fixes, enhancements and cleanups.
* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (455 commits)
[media] cx23885: fix UNSET/TUNER_ABSENT confusion
[media] coda: fix build error by making reset control optional
[media] radio-miropcm20: fix sparse NULL pointer warning
[media] MAINTAINERS: Update go7007 pattern
[media] MAINTAINERS: Update solo6x10 patterns
[media] media: atmel-isi: add primary DT support
[media] media: atmel-isi: convert the pdata from pointer to structure
[media] media: atmel-isi: add v4l2 async probe support
[media] rcar_vin: add devicetree support
[media] media: pxa_camera device-tree support
[media] media: mt9m111: add device-tree suppport
[media] soc_camera: add support for dt binding soc_camera drivers
[media] media: soc_camera: pxa_camera documentation device-tree support
[media] media: mt9m111: add device-tree documentation
[media] s5p-mfc: remove unnecessary calling to function video_devdata()
[media] s5p-jpeg: add chroma subsampling adjustment for Exynos3250
[media] s5p-jpeg: Prevent erroneous downscaling for Exynos3250 SoC
[media] s5p-jpeg: Assure proper crop rectangle initialization
[media] s5p-jpeg: fix g_selection op
[media] s5p-jpeg: Adjust jpeg_bound_align_image to Exynos3250 needs
...
Diffstat (limited to 'drivers/media/pci/bt8xx/bttv-input.c')
-rw-r--r-- | drivers/media/pci/bt8xx/bttv-input.c | 78 |
1 files changed, 41 insertions, 37 deletions
diff --git a/drivers/media/pci/bt8xx/bttv-input.c b/drivers/media/pci/bt8xx/bttv-input.c index 5930bce16658..67c8d6b2c335 100644 --- a/drivers/media/pci/bt8xx/bttv-input.c +++ b/drivers/media/pci/bt8xx/bttv-input.c @@ -73,12 +73,12 @@ static void ir_handle_key(struct bttv *btv) if ((ir->mask_keydown && (gpio & ir->mask_keydown)) || (ir->mask_keyup && !(gpio & ir->mask_keyup))) { - rc_keydown_notimeout(ir->dev, data, 0); + rc_keydown_notimeout(ir->dev, RC_TYPE_UNKNOWN, data, 0); } else { /* HACK: Probably, ir->mask_keydown is missing for this board */ if (btv->c.type == BTTV_BOARD_WINFAST2000) - rc_keydown_notimeout(ir->dev, data, 0); + rc_keydown_notimeout(ir->dev, RC_TYPE_UNKNOWN, data, 0); rc_keyup(ir->dev); } @@ -103,7 +103,7 @@ static void ir_enltv_handle_key(struct bttv *btv) gpio, data, (gpio & ir->mask_keyup) ? " up" : "up/down"); - rc_keydown_notimeout(ir->dev, data, 0); + rc_keydown_notimeout(ir->dev, RC_TYPE_UNKNOWN, data, 0); if (keyup) rc_keyup(ir->dev); } else { @@ -117,7 +117,7 @@ static void ir_enltv_handle_key(struct bttv *btv) if (keyup) rc_keyup(ir->dev); else - rc_keydown_notimeout(ir->dev, data, 0); + rc_keydown_notimeout(ir->dev, RC_TYPE_UNKNOWN, data, 0); } ir->last_gpio = data | keyup; @@ -154,10 +154,10 @@ static void bttv_input_timer(unsigned long data) * testing. */ -#define RC5_START(x) (((x) >> 12) & 3) -#define RC5_TOGGLE(x) (((x) >> 11) & 1) -#define RC5_ADDR(x) (((x) >> 6) & 31) -#define RC5_INSTR(x) ((x) & 63) +#define RC5_START(x) (((x) >> 12) & 0x03) +#define RC5_TOGGLE(x) (((x) >> 11) & 0x01) +#define RC5_ADDR(x) (((x) >> 6) & 0x1f) +#define RC5_INSTR(x) (((x) >> 0) & 0x3f) /* decode raw bit pattern to RC5 code */ static u32 bttv_rc5_decode(unsigned int code) @@ -195,8 +195,8 @@ static void bttv_rc5_timer_end(unsigned long data) { struct bttv_ir *ir = (struct bttv_ir *)data; struct timeval tv; - u32 gap; - u32 rc5 = 0; + u32 gap, rc5, scancode; + u8 toggle, command, system; /* get time */ do_gettimeofday(&tv); @@ -221,26 +221,29 @@ static void bttv_rc5_timer_end(unsigned long data) if (ir->last_bit < 20) { /* ignore spurious codes (caused by light/other remotes) */ dprintk("short code: %x\n", ir->code); - } else { - ir->code = (ir->code << ir->shift_by) | 1; - rc5 = bttv_rc5_decode(ir->code); - - /* two start bits? */ - if (RC5_START(rc5) != ir->start) { - pr_info(DEVNAME ":" - " rc5 start bits invalid: %u\n", RC5_START(rc5)); - - /* right address? */ - } else if (RC5_ADDR(rc5) == ir->addr) { - u32 toggle = RC5_TOGGLE(rc5); - u32 instr = RC5_INSTR(rc5); - - /* Good code */ - rc_keydown(ir->dev, instr, toggle); - dprintk("instruction %x, toggle %x\n", - instr, toggle); - } + return; } + + ir->code = (ir->code << ir->shift_by) | 1; + rc5 = bttv_rc5_decode(ir->code); + + toggle = RC5_TOGGLE(rc5); + system = RC5_ADDR(rc5); + command = RC5_INSTR(rc5); + + switch (RC5_START(rc5)) { + case 0x3: + break; + case 0x2: + command += 0x40; + break; + default: + return; + } + + scancode = RC_SCANCODE_RC5(system, command); + rc_keydown(ir->dev, RC_TYPE_RC5, scancode, toggle); + dprintk("scancode %x, toggle %x\n", scancode, toggle); } static int bttv_rc5_irq(struct bttv *btv) @@ -310,8 +313,6 @@ static void bttv_ir_start(struct bttv *btv, struct bttv_ir *ir) /* set timer_end for code completion */ setup_timer(&ir->timer, bttv_rc5_timer_end, (unsigned long)ir); ir->shift_by = 1; - ir->start = 3; - ir->addr = 0x0; ir->rc5_remote_gap = ir_rc5_remote_gap; } } @@ -335,7 +336,8 @@ static void bttv_ir_stop(struct bttv *btv) * Get_key functions used by I2C remotes */ -static int get_key_pv951(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) +static int get_key_pv951(struct IR_i2c *ir, enum rc_type *protocol, + u32 *scancode, u8 *toggle) { unsigned char b; @@ -362,8 +364,9 @@ static int get_key_pv951(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) * the device is bound to the vendor-provided RC. */ - *ir_key = b; - *ir_raw = b; + *protocol = RC_TYPE_UNKNOWN; + *scancode = b; + *toggle = 0; return 1; } @@ -490,8 +493,8 @@ int bttv_input_init(struct bttv *btv) ir->polling = 50; // ms break; case BTTV_BOARD_NEBULA_DIGITV: - ir_codes = RC_MAP_NEBULA; - ir->rc5_gpio = true; + ir_codes = RC_MAP_NEBULA; + ir->rc5_gpio = true; break; case BTTV_BOARD_MACHTV_MAGICTV: ir_codes = RC_MAP_APAC_VIEWCOMP; @@ -514,7 +517,8 @@ int bttv_input_init(struct bttv *btv) ir->mask_keycode); break; } - if (NULL == ir_codes) { + + if (!ir_codes) { dprintk("Ooops: IR config error [card=%d]\n", btv->c.type); err = -ENODEV; goto err_out_free; |