GitHub/MotorolaMobilityLLC/kernel-slsi.git
14 years agoV4L/DVB: v4l videobuf: remove unused mmap callback
Hans Verkuil [Sun, 28 Mar 2010 10:34:18 +0000 (07:34 -0300)]
V4L/DVB: v4l videobuf: remove unused mmap callback

The mmap callback in struct videobuf_qtype_ops is never used.
Remove.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: Add firmware v2.4 to xc2028/xc3028 extracting tool
Mauro Carvalho Chehab [Thu, 22 Apr 2010 20:09:18 +0000 (17:09 -0300)]
V4L/DVB: Add firmware v2.4 to xc2028/xc3028 extracting tool

From: Stefan Ringel <stefan.ringel@arcor.de>

The firmware were seen to be needed with some tm6000 devices that don't
work with version 2.7.

Thanks-to: Bee Hock Goh <beehock@gmail.com>
Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoRevert "V4L/DVB: Add FE_CAN_PSK_8 to allow apps to identify PSK_8 capable DVB devices"
Mauro Carvalho Chehab [Wed, 21 Apr 2010 14:36:57 +0000 (11:36 -0300)]
Revert "V4L/DVB: Add FE_CAN_PSK_8 to allow apps to identify PSK_8 capable DVB devices"

Patch reverted per Andreas Oberritter <obi@linuxtv.org> request. It is basically
not ready yet for upstream merge.

This reverts commit 77b2ad374a82e3d740cb1780ff4caedc3e051b37.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: s2255drv: firmware reload on timeout
Dean Anderson [Mon, 12 Apr 2010 18:05:37 +0000 (15:05 -0300)]
V4L/DVB: s2255drv: firmware reload on timeout

Signed-off-by: Dean Anderson <linux-dev@sensoray.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: Add FE_CAN_PSK_8 to allow apps to identify PSK_8 capable DVB devices
Klaus Schmidinger [Sun, 11 Apr 2010 09:12:52 +0000 (06:12 -0300)]
V4L/DVB: Add FE_CAN_PSK_8 to allow apps to identify PSK_8 capable DVB devices

The enum fe_caps provides flags that allow an application to detect
whether a device is capable of handling various modulation types etc.
A flag for detecting PSK_8, however, is missing.
This patch adds the flag FE_CAN_PSK_8 to frontend.h and implements
it for the gp8psk-fe.c and cx24116.c driver (apparently the only ones
with PSK_8). Only the gp8psk-fe.c has been explicitly tested, though.

Signed-off-by: Klaus Schmidinger <Klaus.Schmidinger@tvdr.de>
Tested-by: Derek Kelly <user.vdr@gmail.com>
Acked-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: ir-core: fix some confusing comments
David Härdeman [Thu, 15 Apr 2010 21:46:35 +0000 (18:46 -0300)]
V4L/DVB: ir-core: fix some confusing comments

Fix some confusing comments in drivers/media/IR/*

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: ir-core: fix table resize during keymap init
Mauro Carvalho Chehab [Tue, 18 May 2010 05:06:06 +0000 (02:06 -0300)]
V4L/DVB: ir-core: fix table resize during keymap init

drivers/media/IR/ir-keytable.c would alloc a suitably sized keymap table
only to have it resized as it is populated with the initial keymap.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: ir-core: fix double spinlock init in drivers/media/IR/rc-map.c
David Härdeman [Thu, 15 Apr 2010 21:46:25 +0000 (18:46 -0300)]
V4L/DVB: ir-core: fix double spinlock init in drivers/media/IR/rc-map.c

Fix a double initialization of the same spinlock in drivers/media/IR/rc-map.c.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: ir-core: remove ir-functions usage from dm1105
David Härdeman [Thu, 15 Apr 2010 21:46:15 +0000 (18:46 -0300)]
V4L/DVB: ir-core: remove ir-functions usage from dm1105

Convert drivers/media/dvb/dm1105/dm1105.c to not rely on
ir-functions.c.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: irmon: Cleanup some warning noise
Mauro Carvalho Chehab [Tue, 20 Apr 2010 22:11:30 +0000 (19:11 -0300)]
V4L/DVB: irmon: Cleanup some warning noise

Driver is not properly initializing u64 constants on 32 bit systems:
drivers/media/IR/imon.c:301: warning: integer constant is too large for ‘long’ type
drivers/media/IR/imon.c:302: warning: integer constant is too large for ‘long’ type
drivers/media/IR/imon.c:304: warning: integer constant is too large for ‘long’ type
drivers/media/IR/imon.c:305: warning: integer constant is too large for ‘long’ type
drivers/media/IR/imon.c:308: warning: integer constant is too large for ‘long’ type
drivers/media/IR/imon.c:309: warning: integer constant is too large for ‘long’ type
drivers/media/IR/imon.c:310: warning: integer constant is too large for ‘long’ type

Fix also a few troubles at error printk handling:
drivers/media/IR/imon.c: In function ‘imon_init_intf0’:
drivers/media/IR/imon.c:1909: warning: ‘ret’ may be used uninitialized in this function
drivers/media/IR/imon.c: In function ‘imon_init_intf1’:
drivers/media/IR/imon.c:1989: warning: ‘ret’ may be used uninitialized in this function

Cc: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: ir-core: Add Sony support to ir-core
David Härdeman [Thu, 15 Apr 2010 21:46:10 +0000 (18:46 -0300)]
V4L/DVB: ir-core: Add Sony support to ir-core

This patch adds a Sony12/15/20 decoder to ir-core.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: ir-core: Add JVC support to ir-core
David Härdeman [Thu, 15 Apr 2010 21:46:05 +0000 (18:46 -0300)]
V4L/DVB: ir-core: Add JVC support to ir-core

This patch adds a JVC decoder to ir-core.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: ir-core-priv.h: Fix a few CodingStyle errors
Mauro Carvalho Chehab [Tue, 20 Apr 2010 21:50:54 +0000 (18:50 -0300)]
V4L/DVB: ir-core-priv.h: Fix a few CodingStyle errors

As reported by checkpatch.pl:

ERROR: open brace '{' following function declarations go on the next line
+static inline bool geq_margin(unsigned d1, unsigned d2, unsigned margin) {

ERROR: open brace '{' following function declarations go on the next line
+static inline bool eq_margin(unsigned d1, unsigned d2, unsigned margin) {

ERROR: open brace '{' following function declarations go on the next line
+static inline bool is_transition(struct ir_raw_event *x, struct ir_raw_event *y) {

Cc: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: ir-core: change duration to be coded as a u32 integer
David Härdeman [Thu, 15 Apr 2010 21:46:00 +0000 (18:46 -0300)]
V4L/DVB: ir-core: change duration to be coded as a u32 integer

This patch implements the agreed upon 1:31 integer encoded pulse/duration
struct for ir-core raw decoders. All decoders have been tested after the
change. Comments are welcome.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: ir-core: add imon driver
Jarod Wilson [Fri, 16 Apr 2010 21:29:02 +0000 (18:29 -0300)]
V4L/DVB: ir-core: add imon driver

This is a new driver for the SoundGraph iMON and Antec Veris IR/display
devices commonly found in many home theater pc cases and as after-market
case additions.

[mchehab@redhat.com: add KERN_CONT on line 2098 to shutup checkpatc.pl]

Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: ir-core: add imon pad and mce keymaps
Jarod Wilson [Fri, 16 Apr 2010 21:28:35 +0000 (18:28 -0300)]
V4L/DVB: ir-core: add imon pad and mce keymaps

This adds the keymaps for the hardware decode scancodes imon
devices create for their native imon pad (and mini) remotes,
and the hardware scancodes generated by the imon devices when
used with an rc6 windows media center ed. remote.

Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: ir-core: make ir_g_keycode_from_table a public function
Jarod Wilson [Fri, 16 Apr 2010 21:27:58 +0000 (18:27 -0300)]
V4L/DVB: ir-core: make ir_g_keycode_from_table a public function

The imon driver I've previously submitted and have been porting to
use ir-core needs to use ir_g_keycode_from_table, as ir_keydown is
not sufficient, due to these things having really oddball hardware
decoders in them. This just moves the function declaration from
ir-core-priv.h over to ir-core.h.

Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: s2255drv: removes kref tracking and videodev parent
Dean Anderson [Fri, 9 Apr 2010 22:54:26 +0000 (19:54 -0300)]
V4L/DVB: s2255drv: removes kref tracking and videodev parent

kref replaced as suggested in code review
uses atomic variable to track when it is ok to delete device
removes setting of video device parent, which is now
handled in v4l2_device.c

Signed-off-by: Dean Anderson <linux-dev@sensoray.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: s2255drv: fix: v4l2_dev should be registered once only.
Dean Anderson [Tue, 20 Apr 2010 20:21:32 +0000 (17:21 -0300)]
V4L/DVB: s2255drv: fix: v4l2_dev should be registered once only.

usb_set_intfdata should not be used when using v4l2_device_register
and a non-NULL argument for the device.

Signed-off-by: Dean Anderson <linux-dev@sensoray.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: pvrusb2-v4l2: Rename dev_info to pdi
Joe Perches [Mon, 5 Apr 2010 19:05:39 +0000 (16:05 -0300)]
V4L/DVB: pvrusb2-v4l2: Rename dev_info to pdi

There is a macro called dev_info that prints struct device specific
information.  Having variables with the same name can be confusing and
prevents conversion of the macro to a function.

Rename the existing dev_info variables to something else in preparation
to converting the dev_info macro to a function.

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoir-core: Fix the delete logic
Mauro Carvalho Chehab [Sun, 11 Apr 2010 03:26:23 +0000 (00:26 -0300)]
ir-core: Fix the delete logic

Instead of removing an entry, the logic were doing both a deletion and
a key addition, as shown by the log:

[11517.323314] ir_getkeycode: unknown key for scancode 0x0050
[11517.326529] ir_do_setkeycode: #80: Deleting scan 0x0050
[11517.326529] ir_do_setkeycode: #80: New scan 0x0050 with key 0x0000
[11517.340598] ir_getkeycode: unknown key for scancode 0x0051
[11517.343811] ir_do_setkeycode: #81: Deleting scan 0x0051
[11517.343811] ir_do_setkeycode: #81: New scan 0x0051 with key 0x0000
[11517.357889] ir_getkeycode: unknown key for scancode 0x0052
[11517.361104] ir_do_setkeycode: #82: Deleting scan 0x0052
[11517.361104] ir_do_setkeycode: #82: New scan 0x0052 with key 0x0000
[11517.375453] ir_getkeycode: unknown key for scancode 0x0053
[11517.378474] ir_do_setkeycode: #83: Deleting scan 0x0053
[11517.378474] ir_do_setkeycode: #83: New scan 0x0053 with key 0x0000

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoir-core: Remove the quotation mark from the uevent names
Mauro Carvalho Chehab [Sun, 11 Apr 2010 02:43:39 +0000 (23:43 -0300)]
ir-core: Remove the quotation mark from the uevent names

There's no need to use quotation marks at the uevent names for the
driver and table.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: ir Kconfig: better describe the options
Mauro Carvalho Chehab [Fri, 9 Apr 2010 12:20:11 +0000 (09:20 -0300)]
V4L/DVB: ir Kconfig: better describe the options

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: ir-core-priv: fix a typo for RC6 config option
Mauro Carvalho Chehab [Fri, 9 Apr 2010 12:17:02 +0000 (09:17 -0300)]
V4L/DVB: ir-core-priv: fix a typo for RC6 config option

As Adreas pointed, RC6 should use CONFIG_IR_RC6_DECODER_MODULE, instead
of the RC5 config option.

Thanks-to: Andreas Oberitter <obi@linuxtv.org>
Acked-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: tm6000: fix compilation due to the lack of a semicolon
Mauro Carvalho Chehab [Fri, 9 Apr 2010 04:57:21 +0000 (01:57 -0300)]
V4L/DVB: tm6000: fix compilation due to the lack of a semicolon

Add a missing semicolon to fix this error:

In file included from drivers/staging/tm6000/tm6000-cards.c:32:
drivers/staging/tm6000/tm6000.h:123: error: two or more data types in
declaration specifiers

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: gspca - vc032x: Change the ov7670 format to YUYV
Jean-François Moine [Fri, 2 Apr 2010 10:12:42 +0000 (07:12 -0300)]
V4L/DVB: gspca - vc032x: Change the ov7670 format to YUYV

Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: gspca - sonixj: Add autogain for sensor gc0307
Jean-François Moine [Fri, 2 Apr 2010 10:08:39 +0000 (07:08 -0300)]
V4L/DVB: gspca - sonixj: Add autogain for sensor gc0307

Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: gspca - sonixj: Let the JPEG header in the device
Jean-François Moine [Fri, 2 Apr 2010 10:05:59 +0000 (07:05 -0300)]
V4L/DVB: gspca - sonixj: Let the JPEG header in the device

Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: gspca: Change some copyrights and module authors
Jean-François Moine [Fri, 2 Apr 2010 09:59:13 +0000 (06:59 -0300)]
V4L/DVB: gspca: Change some copyrights and module authors

Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: TM6000: Fix code which cause memory corruption
Bee Hock Goh [Wed, 7 Apr 2010 23:57:19 +0000 (20:57 -0300)]
V4L/DVB: TM6000: Fix code which cause memory corruption

The driver was doing malloc when buf is null causing memory corruption.

The analog part is still pretty much broken but at least fixing this
will stop it from crashing the machine when streamon.

Signed-off-by: Bee Hock Goh <beehock@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: pt1: Support Earthsoft PT2
HIRANO Takahito [Wed, 7 Apr 2010 14:48:48 +0000 (11:48 -0300)]
V4L/DVB: pt1: Support Earthsoft PT2

Support Earthsoft PT2.

Signed-off-by: HIRANO Takahito <hiranotaka@zng.info>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: tm6000: request labeling board version check
Stefan Ringel [Fri, 2 Apr 2010 16:52:49 +0000 (13:52 -0300)]
V4L/DVB: tm6000: request labeling board version check

request labeling board version check

Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: tm6000: tm6000_i2c_xfer: request labeling
Stefan Ringel [Fri, 2 Apr 2010 16:52:50 +0000 (13:52 -0300)]
V4L/DVB: tm6000: tm6000_i2c_xfer: request labeling

labeling the request after tuner reading and writeing

Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: cx88: improve error handling
Dan Carpenter [Fri, 2 Apr 2010 11:31:50 +0000 (08:31 -0300)]
V4L/DVB: cx88: improve error handling

Return -EINVAL if we don't find the right query control id.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: cx231xx: improve error handling
Dan Carpenter [Fri, 2 Apr 2010 11:30:10 +0000 (08:30 -0300)]
V4L/DVB: cx231xx: improve error handling

Return -EINVAL if we don't find the control id.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: [-next] gspca: fix build for INPUT=m or INPUT=n
Randy Dunlap [Tue, 30 Mar 2010 17:32:04 +0000 (14:32 -0300)]
V4L/DVB: [-next] gspca: fix build for INPUT=m or INPUT=n

Handle case of GSPCA=m, INPUT=m when building gspca core;
also handle case of INPUT=n by using stubs.

drivers/media/video/gspca/gspca.c:662: error: implicit declaration of function 'gspca_input_destroy_urb'
drivers/media/video/gspca/gspca.c:668: error: implicit declaration of function 'gspca_input_create_urb'
drivers/media/video/gspca/gspca.c:2284: error: implicit declaration of function 'gspca_input_connect'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: Fix default state Beholder H6 tuner
Dmitri Belimov [Tue, 30 Mar 2010 06:02:17 +0000 (03:02 -0300)]
V4L/DVB: Fix default state Beholder H6 tuner

The hybrid tuner FMD1216MEX_MK3 after cold start has disabled IF. This
tuner has internal I2C switch. This switch switch I2C bus between DVB-T
and IF part. Default state is DVB-T. When module saa7134 is load it
can't find IF tda9887 and disable analog TV mode.

Sets internal I2C switch of the tuner to IF by send special value to the
tuner as for receive analog TV from low band. It can be usefule for
other cards.

I didn't set configure a tuner by a tuner model because this tuner can
have different I2C address. May be we can do it later after discuss for
more robust support a tuners.

Signed-off-by: Beholder Intl. Ltd. Dmitry Belimov <d.belimov@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: tm6000: add gpios for tm6010 generic board
Stefan Ringel [Mon, 29 Mar 2010 16:51:12 +0000 (13:51 -0300)]
V4L/DVB: tm6000: add gpios for tm6010 generic board

Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: tm6000: add gpios to board struct
Stefan Ringel [Mon, 29 Mar 2010 16:51:11 +0000 (13:51 -0300)]
V4L/DVB: tm6000: add gpios to board struct

Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: tm6000: switch to gpio strcut
Stefan Ringel [Mon, 29 Mar 2010 16:51:10 +0000 (13:51 -0300)]
V4L/DVB: tm6000: switch to gpio strcut

switch to a gpio structure

Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: video/sn9c102: improve error handling
Dan Carpenter [Sun, 28 Mar 2010 11:50:05 +0000 (08:50 -0300)]
V4L/DVB: video/sn9c102: improve error handling

Return an error if the controller is not found.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: video/et61x251: improve error handling
Dan Carpenter [Sun, 28 Mar 2010 11:49:45 +0000 (08:49 -0300)]
V4L/DVB: video/et61x251: improve error handling

The original code doesn't handle the situation where the controller is
not found.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: video/zc0301: improve error handling
Dan Carpenter [Sun, 28 Mar 2010 11:49:20 +0000 (08:49 -0300)]
V4L/DVB: video/zc0301: improve error handling

Return an error if the controller is not found.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: video/cx231xx: cleanup. remove unneed null checks
Dan Carpenter [Sun, 28 Mar 2010 11:29:35 +0000 (08:29 -0300)]
V4L/DVB: video/cx231xx: cleanup. remove unneed null checks

"dev" is never NULL here so there is no need to check.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: s2255drv: adding v4l2_device structure. video_register_device cleanup
Dean Anderson [Fri, 9 Apr 2010 02:52:20 +0000 (23:52 -0300)]
V4L/DVB: s2255drv: adding v4l2_device structure. video_register_device cleanup

adding v4l2_device structure.
if one video_register_device call fails, allows use of other devices
or channels.

Signed-off-by: Dean Anderson <dean@sensoray.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: s2255drv: cleanup of debug messages
Dean Anderson [Fri, 9 Apr 2010 02:51:17 +0000 (23:51 -0300)]
V4L/DVB: s2255drv: cleanup of debug messages

Signed-off-by: Dean Anderson <dean@sensoray.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: s2255drv: removal of big kernel lock
Dean Anderson [Fri, 9 Apr 2010 02:46:08 +0000 (23:46 -0300)]
V4L/DVB: s2255drv: removal of big kernel lock

big kernel lock removed from open function.
v4l2 code does not require locking the open function except
to check asynchronous firmware load state, which is protected
by a mutex

Signed-off-by: Dean Anderson <dean@sensoray.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: s2255drv: video_device_alloc call not checked fix
Dean Anderson [Fri, 9 Apr 2010 02:40:31 +0000 (23:40 -0300)]
V4L/DVB: s2255drv: video_device_alloc call not checked fix

call to video_device_alloc was not being checked in probe function.
code simplified and uses video_device inside device structure.

Signed-off-by: Dean Anderson <dean@sensoray.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: s2255drv: code cleanup
Dean Anderson [Fri, 9 Apr 2010 02:39:12 +0000 (23:39 -0300)]
V4L/DVB: s2255drv: code cleanup

removal of unused pipe array (of size one).

Signed-off-by: Dean Anderson <dean@sensoray.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: s2255drv: cleanup of driver disconnect code
Dean Anderson [Fri, 9 Apr 2010 02:38:07 +0000 (23:38 -0300)]
V4L/DVB: s2255drv: cleanup of driver disconnect code

simplifies use of kref in driver

Signed-off-by: Dean Anderson <dean@sensoray.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: video/au0828: off by one bug
Dan Carpenter [Sun, 28 Mar 2010 11:21:18 +0000 (08:21 -0300)]
V4L/DVB: video/au0828: off by one bug

The "AUVI_INPUT(tmp)" macro uses "tmp" as an index of an array with
AU0828_MAX_INPUT elements.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: cx88: fix checks for analog TV inputs
istvan_v@mailbox.hu [Sat, 27 Mar 2010 12:31:32 +0000 (09:31 -0300)]
V4L/DVB: cx88: fix checks for analog TV inputs

The following patch fixes code that checks for CX88_VMUX_TELEVISION,
but not CX88_VMUX_CABLE. This prevented for example the audio standard
from being set when using the cable input.

Signed-off-by: Istvan Varga <istvanv@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: pwc Kconfig dependency fix
Christoph Fritz [Thu, 25 Mar 2010 01:40:41 +0000 (22:40 -0300)]
V4L/DVB: pwc Kconfig dependency fix

makes USB_PWC_INPUT_EVDEV to depend also on USB_PWC

Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: budget: Oops: "BUG: unable to handle kernel NULL pointer dereference"
Bjørn Mork [Wed, 24 Mar 2010 13:30:15 +0000 (10:30 -0300)]
V4L/DVB: budget: Oops: "BUG: unable to handle kernel NULL pointer dereference"

Never call dvb_frontend_detach if we failed to attach a frontend. This fixes
the following oops:

[    8.172997] DVB: registering new adapter (TT-Budget S2-1600 PCI)
[    8.209018] adapter has MAC addr = 00:d0:5c:cc:a7:29
[    8.328665] Intel ICH 0000:00:1f.5: PCI INT B -> GSI 17 (level, low) -> IRQ 17
[    8.328753] Intel ICH 0000:00:1f.5: setting latency timer to 64
[    8.562047] DVB: Unable to find symbol stv090x_attach()
[    8.562117] BUG: unable to handle kernel NULL pointer dereference at 000000ac
[    8.562239] IP: [<e08b04a3>] dvb_frontend_detach+0x4/0x67 [dvb_core]

Ref http://bugs.debian.org/575207

Also clean up if we are unable to register the tuner and LNB drivers

[mchehab@redhat.com: add printk log level, to calm down chechpatch.pl]
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Reported-by: Fladischer Michael <FladischerMichael@fladi.at>
Acked-by: Oliver Endriss <o.endriss@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: Add RC6 support to ir-core
David Härdeman [Thu, 8 Apr 2010 23:04:40 +0000 (20:04 -0300)]
V4L/DVB: Add RC6 support to ir-core

This patch adds an RC6 decoder (modes 0 and 6A) to ir-core.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: Add NECx support to ir-core
David Härdeman [Thu, 8 Apr 2010 23:04:35 +0000 (20:04 -0300)]
V4L/DVB: Add NECx support to ir-core

This patch adds NECx support to drivers/media/IR/ir-nec-decoder.c

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: Add RC5x support to ir-core
David Härdeman [Thu, 8 Apr 2010 23:04:30 +0000 (20:04 -0300)]
V4L/DVB: Add RC5x support to ir-core

This patch adds RC5x support to drivers/media/IR/ir-rc5-decoder.c

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: ds3000: fix divide-by-zero error in ds3000_read_snr()
Nicolas Noirbent [Mon, 22 Mar 2010 17:54:43 +0000 (14:54 -0300)]
V4L/DVB: ds3000: fix divide-by-zero error in ds3000_read_snr()

Fix a divide-by-zero error in ds3000's ds3000_read_snr(), when getting
a very low signal reading (dvbs2_signal_reading >= 1). This prevents
some nasty EIPs when running szap-s2 with a very low signal strength.

Signed-off-by: Nicolas Noirbent <nicolas.noirbent@smartjog.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: cpia1: comment unused command_setlights()
Mauro Carvalho Chehab [Thu, 8 Apr 2010 22:09:13 +0000 (19:09 -0300)]
V4L/DVB: cpia1: comment unused command_setlights()

drivers/media/video/gspca/cpia1.c:1063: warning: ‘command_setlights’ defined but not used

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: ir-core: Remove warining noise if decoders compiled builtin
Mauro Carvalho Chehab [Thu, 8 Apr 2010 22:04:06 +0000 (19:04 -0300)]
V4L/DVB: ir-core: Remove warining noise if decoders compiled builtin

drivers/media/IR/ir-raw-event.c:55: warning: ‘wq_load’ defined but not used
drivers/media/IR/ir-raw-event.c:222: warning: ‘init_decoders’ defined but not used
drivers/media/IR/rc-map.c: In function ‘get_rc_map’:
drivers/media/IR/rc-map.c:40: warning: unused variable ‘rc’

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: V4L2: Replace loops for finding max buffers in VIDIOC_REQBUFS callbacks
Andreas Bombe [Sun, 21 Mar 2010 19:02:45 +0000 (16:02 -0300)]
V4L/DVB: V4L2: Replace loops for finding max buffers in VIDIOC_REQBUFS callbacks

Due to obvious copy and paste coding a number of video capture drivers
which implement a limit on the buffer memory decremented the user
supplied buffer count in a while loop until it reaches an acceptable
value.

This is a silly thing to do when the maximum value can be directly
computed.

Signed-off-by: Andreas Bombe <aeb@debian.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoRevert "V4L/DVB (11906): saa7134: Use v4l bounding/alignment function"
Herton Ronaldo Krzesinski [Fri, 19 Mar 2010 17:58:23 +0000 (14:58 -0300)]
Revert "V4L/DVB (11906): saa7134: Use v4l bounding/alignment function"

This reverts commit bc52d6eb44de8f19934768d4d10d19fdbdc99950.

On newer kernels, a saa7134 board stopped to display TV video output
properly. After a bisect, I found it as the commit causing the issue.
Turns out that v4l_bound_align_image isn't doing the same bounding
calculation as manually done previously in saa7134_try_fmt_vid_cap.

What isn't equal is the calculation done in clamp align, while
previously it did "f->fmt.pix.width &= ~0x03", clamp_align function
does "Round to nearest aligned value" as stated in the comment, which
yields a different result. If I comment the round calculation in
clamp_align like this: "x = (x /*+ (1 << (align - 1))*/) & mask",
I get it fixed too, because this way the calculation is the same then.

Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: dvb/dib8000: fix build warning
Wolfram Sang [Mon, 5 Apr 2010 04:14:26 +0000 (01:14 -0300)]
V4L/DVB: dvb/dib8000: fix build warning

In file included from drivers/media/dvb/dvb-usb/dib0700_devices.c:14:
  drivers/media/dvb/frontends/dib8000.h: In function 'dib8000_get_adc_power':
  drivers/media/dvb/frontends/dib8000.h:112: warning: no return statement in function returning non-void

Fixed by adding a return to the dummy function.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: DVB: ngene, remove unused #include <linux/version.h>
Huang Weiyi [Thu, 8 Apr 2010 11:50:17 +0000 (08:50 -0300)]
V4L/DVB: DVB: ngene, remove unused #include <linux/version.h>

Remove unused #include <linux/version.h>('s) in
  drivers/media/dvb/ngene/ngene-core.c

Signed-off-by: Huang Weiyi <weiyi.huang@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: ivtv: move the _IO() decoder ioctls into vidioc_default
Hans Verkuil [Tue, 6 Apr 2010 18:58:53 +0000 (15:58 -0300)]
V4L/DVB: ivtv: move the _IO() decoder ioctls into vidioc_default

Now that video_ioctl2 no longer clobbers the argument for _IO() ioctls we
can move these into vidioc_default where they really belong.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: video_ioctl2: handle the v4l1 compat bit first and move VIDIOCGMBUF into...
Hans Verkuil [Tue, 6 Apr 2010 18:56:08 +0000 (15:56 -0300)]
V4L/DVB: video_ioctl2: handle the v4l1 compat bit first and move VIDIOCGMBUF into the switch

Try to make a more sensible sequence of events in __video_do_ioctl: first
check for a valid ops pointer, then get the compat part done. The VIDIOCGMBUF
command is now part of the big switch.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: v4l2-framework.txt: fix incorrect statement
Hans Verkuil [Tue, 6 Apr 2010 14:44:39 +0000 (11:44 -0300)]
V4L/DVB: v4l2-framework.txt: fix incorrect statement

After unregister_device all fileops are blocked, except for ioctls.
So it is not just the open that is blocked, others are as well.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: w9966: convert to V4L2
Hans Verkuil [Tue, 6 Apr 2010 14:36:39 +0000 (11:36 -0300)]
V4L/DVB: w9966: convert to V4L2

Note that I have not been able to find anyone with this hardware. I tried
contacting the author without success, searched on eBay and similar places
without luck either.

So this conversion is untested. That said, it was pretty straightforward
so it is time to have this driver join the V4L2 world at last.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: DocBook/v4l/compat.xml: add missing </section>
Hans Verkuil [Tue, 6 Apr 2010 13:32:19 +0000 (10:32 -0300)]
V4L/DVB: DocBook/v4l/compat.xml: add missing </section>

The indentation of the sections had gone wrong, causing a mistake with
section nesting. Fixed.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: usbvision: remove non-working vbi device
Hans Verkuil [Tue, 6 Apr 2010 11:20:56 +0000 (08:20 -0300)]
V4L/DVB: usbvision: remove non-working vbi device

The usbvision driver created vbi device nodes but the actual implementation
was just stubs and only returned errors to userspace.

In addition it used video_usercopy() and we want to remove that eventually.

So remove all the vbi code except for the vbi flag in the card definition
should someone ever be mad enough to work on a proper implementation for this
driver.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: video_ioctl2: don't return, use break
Hans Verkuil [Tue, 6 Apr 2010 11:14:11 +0000 (08:14 -0300)]
V4L/DVB: video_ioctl2: don't return, use break

You want to be able to reach the debug code at the end of this function,
so don't use return, use break.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: video_ioctl2: do not replace arg with NULL for _IO() ioctls
Hans Verkuil [Tue, 6 Apr 2010 11:12:21 +0000 (08:12 -0300)]
V4L/DVB: video_ioctl2: do not replace arg with NULL for _IO() ioctls

If the ioctl was defined without direction (e.g. _IO('o', 25)), then
the arg as passed to vidioc_default was NULL instead of the original
argument.

Several ioctls in e.g. include/linux/dvb/video.h and audio.h use this type
of ioctl to pass simple numerical values to the driver.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: videodev2.h: move definition of enum v4l2_ctrl_type to the other control...
Hans Verkuil [Tue, 6 Apr 2010 09:53:57 +0000 (06:53 -0300)]
V4L/DVB: videodev2.h: move definition of enum v4l2_ctrl_type to the other control types

For some reason the definition of enum v4l2_ctrl_type is far from the
place where it is actually needed. This makes it hard to work with this
header.

Move it to just before struct v4l2_queryctrl, which is the one that
actually uses it.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: V4L2 Spec: fix V4L2_CTRL_TYPE_CTRL_CLASS documentation
Hans Verkuil [Tue, 6 Apr 2010 09:41:28 +0000 (06:41 -0300)]
V4L/DVB: V4L2 Spec: fix V4L2_CTRL_TYPE_CTRL_CLASS documentation

The spec says that the control ID for these types of controls is the same
as that of the control class. But it should read: 'control class + 1'.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: davinci: don't return under lock on error path
Dan Carpenter [Wed, 7 Apr 2010 09:21:05 +0000 (06:21 -0300)]
V4L/DVB: davinci: don't return under lock on error path

If the kmalloc() failed for "ccdc_cfg = kmalloc(...);" then we would exit
with the lock held.  I moved the mutex_lock() below the allocation
because it isn't protecting anything in that block and allocations are
allocations are sometimes slow.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Vaibhav Hiremath <hvaibhav@ti.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: ir-core: move subsystem internal calls to ir-core-priv.h
Mauro Carvalho Chehab [Thu, 8 Apr 2010 18:10:27 +0000 (15:10 -0300)]
V4L/DVB: ir-core: move subsystem internal calls to ir-core-priv.h

ir-core.h has the kABI to be used by the bridge drivers, when needing to register
IR protocols and pass IR events. However, the same file also contains IR subsystem
internal calls, meant to be used inside ir-core and between ir-core and the raw
decoders.

Better to move those functions to an internal header, for some reasons:

1) Header will be a little more cleaner;

2) It avoids the need of recompile everything (bridge/hardware drivers, etc),
   just because a new decoder were added, or some other internal change were needed;

3) Better organize the ir-core API, splitting the functions that are internal to
   IR core and the ancillary drivers (decoders, lirc_dev) from the features that
   should be exported to IR subsystem clients.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: Teach drivers/media/IR/ir-raw-event.c to use durations
David Härdeman [Thu, 8 Apr 2010 16:10:00 +0000 (13:10 -0300)]
V4L/DVB: Teach drivers/media/IR/ir-raw-event.c to use durations

drivers/media/IR/ir-raw-event.c is currently written with the assumption
that all "raw" hardware will generate events only on state change (i.e.
when a pulse or space starts).

However, some hardware (like mceusb, probably the most popular IR receiver
out there) only generates duration data (and that data is buffered so using
any kind of timing on the data is futile).

Furthermore, using signed int's to represent pulse/space durations is a
well-known approach when writing ir decoders.

With this patch:

- s64 int's are used to represent pulse/space durations in ns

- a workqueue is used to decode the ir protocols outside of interrupt context

- #defines are added to make decoders clearer

- decoder reset is implemented by passing a zero duration to the kfifo queue
  and decoders are updated accordingly

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: ir-core: fix gcc warning noise
Mauro Carvalho Chehab [Thu, 8 Apr 2010 12:33:45 +0000 (09:33 -0300)]
V4L/DVB: ir-core: fix gcc warning noise

drivers/media/IR/ir-sysfs.c: In function ‘store_protocol’:
drivers/media/IR/ir-sysfs.c:93: warning: suggest parentheses around assignment used as truth value

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: ir-core: properly present the supported and current protocols
Mauro Carvalho Chehab [Thu, 8 Apr 2010 04:02:49 +0000 (01:02 -0300)]
V4L/DVB: ir-core: properly present the supported and current protocols

Hardware decoders have a more limited set of decoders than software ones.
In general, they support just one protocol at a given time, but allow
changing between a few options.

Rename the previous badly named "current_protocol" as just "protocol",
meaning the current protocol(s) accepted by the driver, and
add a "support_protocols" to represent the entire universe of supported
protocols by that specific hardware.

As commented on http://lwn.net/Articles/378884/, the "one file, one value"
rule doesn't fit nor does make much sense for bitmap or enum values. So, the
supported_protocols will enum all supported protocols, and the protocol
will present all active protocols.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: ir-core: Distinguish sysfs attributes for in-hardware and raw decoders
Mauro Carvalho Chehab [Wed, 7 Apr 2010 02:21:46 +0000 (23:21 -0300)]
V4L/DVB: ir-core: Distinguish sysfs attributes for in-hardware and raw decoders

Some devices have in-hardware Remote Controller decoder, while others
need a software decoder to get the IR code. As each software decoder
can be enabled/disabled individually, allowing multiple protocol
decoding capability.

On the other hand, hardware decoders have a limited protocol
support, often being able of decoding just one protocol each time.
So, each type needs a different set of capabilities to control the
supported protocol(s).

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: rename sysfs remote controller devices from rcrcv to rc
David Härdeman [Sun, 28 Mar 2010 21:38:49 +0000 (18:38 -0300)]
V4L/DVB: rename sysfs remote controller devices from rcrcv to rc

When the remote controller class is anyway being renamed from ir to rc
this would be a good time to also rename the devices from rcrcvX to rcX.

I know we haven't reached any agreement on whether transmission will
eventually be handled by the same device, but this change will at
least make the device name non-receive-specific which will make it
possible in the future (and if a different approach is finally
agreed upon, the device name still works).

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: ir: Make sure that the spinlocks are properly initialized
Mauro Carvalho Chehab [Wed, 7 Apr 2010 19:19:36 +0000 (16:19 -0300)]
V4L/DVB: ir: Make sure that the spinlocks are properly initialized

Some spinlocks are not properly initialized on ir core:

[  471.714132] BUG: spinlock bad magic on CPU#0, modprobe/1899
[  471.719838]  lock: f92a08ac, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0
[  471.727301] Pid: 1899, comm: modprobe Not tainted 2.6.33 #36
[  471.733062] Call Trace:
[  471.735537]  [<c1498793>] ? printk+0x1d/0x22
[  471.739866]  [<c12694e3>] spin_bug+0xa3/0xf0
[  471.744224]  [<c126962d>] do_raw_spin_lock+0x7d/0x160
[  471.749364]  [<f92a01ff>] ? ir_rc5_register+0x6f/0xf0 [ir_rc5_decoder]

So, use static initialization for the static spinlocks, instead of the
dynamic ones (currently used), as proposed by David Härdeman on one
of his RFC patches.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: em28xx: fix a regression caused by the rc-map changes
Mauro Carvalho Chehab [Thu, 8 Apr 2010 01:57:04 +0000 (22:57 -0300)]
V4L/DVB: em28xx: fix a regression caused by the rc-map changes

The patch that adds the rc-map changes didn't take into account that an
a table with IR_TYPE_UNKNOWN would make change_protocol to return -EINVAL.

As this function is fundamental to initialize some data, including a
callback to the getkey function, this caused the driver to stop working,
hanging the machine most of the times.

The fix were simply to add a handler for the IR type, but, to avoid further
issues, explicitly call change_protocol and handle the error before
initializing the IR. Also, let input_dev to start/stop IR handling,
after the opening of the input device.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: ir-rc5-decoder: fix state machine
Mauro Carvalho Chehab [Tue, 6 Apr 2010 05:29:42 +0000 (02:29 -0300)]
V4L/DVB: ir-rc5-decoder: fix state machine

Reimplement the RC-5 decoder state machine. Code is now clear, and works
properly. It is also simpler than the previous implementations.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: re-add enable/disable check to the IR decoders
Mauro Carvalho Chehab [Sun, 4 Apr 2010 17:45:04 +0000 (14:45 -0300)]
V4L/DVB: re-add enable/disable check to the IR decoders

A previous cleanup patch removed more than needed. Re-add the logic that
disable the decoders.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: ir-core: Add support for badly-implemented hardware decoders
Mauro Carvalho Chehab [Sun, 4 Apr 2010 17:06:55 +0000 (14:06 -0300)]
V4L/DVB: ir-core: Add support for badly-implemented hardware decoders

A few hardware Remote Controller decoders, even using a standard protocol,
aren't able to provide the entire scancode. Due to that, the capability
of using other IR's are limited on those hardware.

Adds a way to indicate to ir-core what are the bits that the hardware
provides, from a scancode, allowing the addition of a complete IR table
to the kernel and allowing a limited support for changing the Remote
Controller on those devices.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: ir-core: move rc map code to rc-map.h
Mauro Carvalho Chehab [Sun, 4 Apr 2010 15:38:57 +0000 (12:38 -0300)]
V4L/DVB: ir-core: move rc map code to rc-map.h

The keymaps don't need to be recompiled every time a change at ir-core.h
happens, since it only depends on rc-map defines. By moving those
definitions to the proper header, the code became cleaner, and avoids
needing to recompile all the RC maps every time a non-related change
is introduced.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L-DVB: ir-core: remove the ancillary buffer
Mauro Carvalho Chehab [Sun, 4 Apr 2010 13:44:51 +0000 (10:44 -0300)]
V4L-DVB: ir-core: remove the ancillary buffer

Now that the decoders are state machine, there's no need to create
an ancillary buffer while decoding the protocol. Just call the decoders
code directly, event by event.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: cx88: don't handle IR on Pixelview too fast
Mauro Carvalho Chehab [Sun, 4 Apr 2010 13:32:04 +0000 (10:32 -0300)]
V4L/DVB: cx88: don't handle IR on Pixelview too fast

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L-DVB: ir-rc5-decoder: Add a decoder for RC-5 IR protocol
Mauro Carvalho Chehab [Sun, 4 Apr 2010 13:27:20 +0000 (10:27 -0300)]
V4L-DVB: ir-rc5-decoder: Add a decoder for RC-5 IR protocol

This decoder is also based on a state machine, just like the NEC protocol
decoder. It is pedantic in the sense that accepts only 14 bits. As there
are some variants that outputs less bits, it needs to be improved to also
handle those.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: ir-nec-decoder: Cleanups
Mauro Carvalho Chehab [Sat, 3 Apr 2010 23:33:00 +0000 (20:33 -0300)]
V4L/DVB: ir-nec-decoder: Cleanups

Remove dead code and properly name a few constants

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: ir-nec-decoder: Reimplement the entire decoder
Mauro Carvalho Chehab [Sat, 3 Apr 2010 21:51:50 +0000 (18:51 -0300)]
V4L/DVB: ir-nec-decoder: Reimplement the entire decoder

Thanks to Andy Walls <awalls@md.metrocast.net> for pointing me his
code, that gave me some ideas to better implement it.

After some work with saa7134 bits, I found a way to catch both IRQ
edge pulses. By enabling it, the NEC decoder can now take both
pulse and spaces into account, making it more precise.

Instead of the old strategy of handling the events all at once,
this code implements a state machine. Due to that, it handles
individual pulse or space events, validating them against the
protocol, producing a much more reliable decoding.

With the new implementation, the protocol trailer bits are properly
handled, making possible for the repeat key to work.

Also, the code is now capable of handling both NEC and NEC extended
IR devices. With NEC, it produces a 16 bits code, while with NEC
extended, a 24 bits code is returned.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: Convert drivers/media/dvb/ttpci/budget-ci.c to use ir-core
David Härdeman [Fri, 2 Apr 2010 18:58:30 +0000 (15:58 -0300)]
V4L/DVB: Convert drivers/media/dvb/ttpci/budget-ci.c to use ir-core

Converts drivers/media/dvb/ttpci/budget-ci.c to use ir-core rather than
rolling its own keydown timeout handler and reporting keys via
drivers/media/IR/ir-functions.c.

[mchehab@redhat.com: Drop the call to ir_input_init() as it is no longer needed]

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: ir-core: improve keyup/keydown logic
David Härdeman [Fri, 2 Apr 2010 18:58:29 +0000 (15:58 -0300)]
V4L/DVB: ir-core: improve keyup/keydown logic

Rewrites the keyup/keydown logic in drivers/media/IR/ir-keytable.c.

All knowledge of keystates etc is now internal to ir-keytable.c
and not scattered around ir-raw-event.c and ir-nec-decoder.c (where
it doesn't belong).

In addition, I've changed the API slightly so that ir_input_dev is
passed as the first argument rather than input_dev. If we're ever
going to support multiple keytables we need to move towards making
ir_input_dev the main interface from a driver POV and obscure away
the input_dev as an implementational detail in ir-core.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: ir-core: re-add some debug functions for keytable changes
Mauro Carvalho Chehab [Sat, 3 Apr 2010 19:53:16 +0000 (16:53 -0300)]
V4L/DVB: ir-core: re-add some debug functions for keytable changes

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: drivers/media/IR - improve keytable code
David Härdeman [Fri, 2 Apr 2010 18:58:28 +0000 (15:58 -0300)]
V4L/DVB: drivers/media/IR - improve keytable code

The attached patch rewrites much of the keytable code in
drivers/media/IR/ir-keytable.c.

The scancodes are now inserted into the array in sorted
order which allows for a binary search on lookup.

The code has also been shrunk by about 150 lines.

In addition it fixes the following bugs:

Any use of ir_seek_table() was racy.

ir_dev->driver_name is leaked between ir_input_register() and
ir_input_unregister().

ir_setkeycode() unconditionally does clear_bit() on dev->keybit
when removing a mapping, but there might be another mapping with
a different scancode and the same keycode.

This version has been updated to incorporate patch feedback from
Mauro Carvalho Chehab.

[mchehab@redhat.com: Fix a conflict with RC keytable breakup patches and input changes]

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: saa7134: Add support for both positive and negative edge IRQ
Mauro Carvalho Chehab [Sat, 3 Apr 2010 14:26:01 +0000 (11:26 -0300)]
V4L/DVB: saa7134: Add support for both positive and negative edge IRQ

The code that enables IRQ for the Remote Controller on saa7134 is a little
messy: it is outside saa7134-input, it checks if RC is GPIO based, and
it mixes both serial raw decode with parallel reads from a hardware-based
IR decoder.

Also, currently, it doesn't allow to trigger both transition edges at GPIO16
and GPIO18 lines. A rework on the code is needed to provide a better way
to specify what saa7134-input needs, maybe even moving part of the code from
saa7134-core and saa7134-cards into saa7134-input.

Yet, as a large rework is happening at RC core, it is better to wait until
the core changes stablize, in order to rework saa7134 RC internals.While
this don't happen, let's just change the logic a little bit to allow
enabling IRQ to be generated on both edge transitions, in order to better
support pulse/space raw decoders.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: saa7134: Fix IRQ2 bit names for the register map
Mauro Carvalho Chehab [Sat, 3 Apr 2010 04:43:36 +0000 (01:43 -0300)]
V4L/DVB: saa7134: Fix IRQ2 bit names for the register map

There's an error at the IRQ2 bit map registers. Also, it doesn't
show what bits are needed for positive and for negative edge.

In the case of IR raw decoding, for some protocols, it is important
to detect both positive and negative edges. So, a latter patch
will need to use the other values.

Also, the code that detects problems on IRQ handling is incomplete,
as it disables only one of the IRQ bits for GPIO16 and GPIO18.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: ir-common: remove keymap tables from the module
Mauro Carvalho Chehab [Fri, 2 Apr 2010 23:11:45 +0000 (20:11 -0300)]
V4L/DVB: ir-common: remove keymap tables from the module

Now that the remote keymaps were broken into separate modules,
get rid of the keycode tables that were hardcoded into ir-common.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 years agoV4L/DVB: ir-core: Make use of the new IR keymap modules
Mauro Carvalho Chehab [Fri, 2 Apr 2010 23:01:00 +0000 (20:01 -0300)]
V4L/DVB: ir-core: Make use of the new IR keymap modules

Instead of using the ugly keymap sequences, use the new rc-*.ko keymap
files. For now, it is still needed to have one keymap loaded, for the
RC code to work. Later patches will remove this depenency.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>