1
0
Fork 0
Commit Graph

16570 Commits (f9eb7bf424e766e00bbc6d69fd7eaaf4bd003cf9)

Author SHA1 Message Date
Sylwester Nawrocki 450f5f5475 [media] exynos4-is: Remove debugfs entries properly
Ensure both debugfs: fimc_is directory and the fw_log file
are properly removed in the driver cleanup sequence.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-25 09:36:37 -03:00
Sylwester Nawrocki 11551ca3b6 [media] exynos4-is: Remove redundant module_put() for MIPI-CSIS module
Currently there is unbalanced module_put() on the s5p-csis module
which prevents it from being unloaded. The subdev's owner module
has reference count decremented in v4l2_device_unregister_subdev()
so just remove this erroneous call.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-25 09:36:25 -03:00
Sylwester Nawrocki a59ed48f0c [media] exynos4-is: Set fimc-lite subdev owner module
The FIMC-LITE.n subdevs have currently sd->owner field not set,
the exynos-fimc-lite module can be removed at any time, regardless
it is in use by other modules. When this module is unloaded the
kernel can crash easily by accessing video or media device nodes.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-25 09:36:09 -03:00
Sylwester Nawrocki e41a35cb4b [media] exynos4-is: Unregister fimc-is subdevs from the media device properly
Add missing v4l2_device_unregister_subdev() call for the FIMC-IS subdevs
(currently there is only the FIMC-IS-ISP subdev) so corresponding resources
are properly freed upon the media device driver module removal.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyugmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-25 09:35:56 -03:00
Sylwester Nawrocki 1bc515ac6e [media] exynos4-is: Don't overwrite subdevdata in the fimc-is sensor driver
It's an I2C client driver and it must not overwrite the struct v4l2_subdev
dev_priv field, which is used by the v4l2 core to store a pointer to
struct i2c_client.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-25 09:35:43 -03:00
Sylwester Nawrocki b2afa23669 [media] exynos4-is: Fix regulator/gpio resource releasing on the driver removal
Remove regulator_bulk_free() calls as devm_regulator_bulk_get() function
is used to get the regulators so those will be freed automatically while
the driver is removed.
Missing gpio free is fixed by requesting a gpio with the devm_* API.
All that is done now in the I2C client driver remove() callback is the
media entity cleanup call.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-25 09:35:23 -03:00
Sylwester Nawrocki 5a66561f42 [media] exynos4-is: Fix initialization of subdev 'flags' field
Ensure the value of struct v4l2_subdev::flags field as set
in v4l2_subdev_init() is preserved when initializing it in
the subdev drivers.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-25 09:35:03 -03:00
Sylwester Nawrocki 861a51fd40 [media] exynos4-is: Remove redundant MODULE_DEVICE_TABLE entries
Remove unneeded MODULE_DEVICE_TABLE(of,...) instances from files that
are linked into same module. This fixes following error when building
as a module:
LD [M]  drivers/media/platform/exynos4-is/s5p-fimc.o
drivers/media/platform/exynos4-is/fimc-is-sensor.o: In function `.LANCHOR1':
fimc-is-sensor.c:(.rodata+0x48): multiple definition of `__mod_of_device_table'
drivers/media/platform/exynos4-is/fimc-is.o:fimc-is.c:(.rodata+0x174): first defined here
drivers/media/platform/exynos4-is/fimc-is-i2c.o:(.rodata+0x5c): multiple definition of `__mod_of_device_table'
drivers/media/platform/exynos4-is/fimc-is.o:fimc-is.c:(.rodata+0x174): first defined here
make[4]: *** [drivers/media/platform/exynos4-is/exynos-fimc-is.o] Error 1
Also remove exporting fimc_is_(un)register_i2c_driver functions, it
is not needed since these functions should be called only from our
module.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-25 09:34:34 -03:00
Sylwester Nawrocki a5ad1dbe22 [media] s5c73m3: Add missing subdev .unregistered callback
This is needed to free any resources requested in
the .registered subdev op.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-25 09:33:58 -03:00
Sylwester Nawrocki 0c2224ee0e [media] s5c73m3: Fix remove() callback to free requested resources
Make sure v4l2_device_unregister_subdev() is called for both:
oif and sensor subdev and both media entities are freed on
driver removal.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-25 09:33:42 -03:00
Sachin Kamat 068b16b638 [media] exynos4-is: Convert index variable to signed
index variable is used to check the validity of the data by
testing for negative values. Hence make it signed.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-25 09:33:14 -03:00
Sachin Kamat 38c602b8ed [media] exynos4-is: Fix potential null pointer dereferencing
If fimc->drv_data is NULL, then fimc->drv_data->num_entities would
cause NULL pointer dereferencing. Hence remove it from print statement.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-25 09:32:57 -03:00
Kevin Baradon 5f3f254f7c [media] media/rc/imon.c: kill urb when send_packet() is interrupted
This avoids:
Apr 12 23:52:16 homeserver kernel: imon:send_packet: task interrupted
Apr 12 23:52:16 homeserver kernel: ------------[ cut here ]------------
Apr 12 23:52:16 homeserver kernel: WARNING: at drivers/usb/core/urb.c:327 usb_submit_urb+0x353/0x370()
Apr 12 23:52:16 homeserver kernel: Hardware name: Unknow
Apr 12 23:52:16 homeserver kernel: URB f64b6f00 submitted while active
Apr 12 23:52:16 homeserver kernel: Modules linked in:
Apr 12 23:52:16 homeserver kernel: Pid: 3154, comm: LCDd Not tainted 3.8.6-htpc-00005-g9e6fc5e #26
Apr 12 23:52:16 homeserver kernel: Call Trace:
Apr 12 23:52:16 homeserver kernel: [<c012d778>] ? warn_slowpath_common+0x78/0xb0
Apr 12 23:52:16 homeserver kernel: [<c04136c3>] ? usb_submit_urb+0x353/0x370
Apr 12 23:52:16 homeserver kernel: [<c04136c3>] ? usb_submit_urb+0x353/0x370
Apr 12 23:52:16 homeserver kernel: [<c0447010>] ? imon_ir_change_protocol+0x150/0x150
Apr 12 23:52:16 homeserver kernel: [<c012d843>] ? warn_slowpath_fmt+0x33/0x40
Apr 12 23:52:16 homeserver kernel: [<c04136c3>] ? usb_submit_urb+0x353/0x370
Apr 12 23:52:16 homeserver kernel: [<c0446c67>] ? send_packet+0x97/0x270
Apr 12 23:52:16 homeserver kernel: [<c0446cfe>] ? send_packet+0x12e/0x270
Apr 12 23:52:16 homeserver kernel: [<c05c5743>] ? do_nanosleep+0xa3/0xd0
Apr 12 23:52:16 homeserver kernel: [<c044760e>] ? vfd_write+0xae/0x250
Apr 12 23:52:16 homeserver kernel: [<c0447560>] ? lcd_write+0x180/0x180
Apr 12 23:52:16 homeserver kernel: [<c01b2b19>] ? vfs_write+0x89/0x140
Apr 12 23:52:16 homeserver kernel: [<c01b2dda>] ? sys_write+0x4a/0x90
Apr 12 23:52:16 homeserver kernel: [<c05c7c45>] ? sysenter_do_call+0x12/0x26
Apr 12 23:52:16 homeserver kernel: ---[ end trace a0b6f0fcfd2f9a1d ]---
Apr 12 23:52:16 homeserver kernel: imon:send_packet: error submitting urb(-16)
Apr 12 23:52:16 homeserver kernel: imon:vfd_write: send packet #3 failed
Apr 12 23:52:16 homeserver kernel: imon:send_packet: error submitting urb(-16)
Apr 12 23:52:16 homeserver kernel: imon:vfd_write: send packet #0 failed

Signed-off-by: Kevin Baradon <kevin.baradon@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-23 17:50:34 -03:00
Kevin Baradon 7d54ba0e37 [media] media/rc/imon.c: do not try to register 2nd intf if 1st intf failed
This bug could be triggered if 1st interface configuration fails:
Apr  8 18:20:30 homeserver kernel: usb 5-1: new low-speed USB device number 2 using ohci_hcd
Apr  8 18:20:30 homeserver kernel: input: iMON Panel, Knob and Mouse(15c2:0036) as /devices/pci0000:00/0000:00:13.0/usb5/5-1/5-1:1.0/input/input2
Apr  8 18:20:30 homeserver kernel: Registered IR keymap rc-imon-pad
Apr  8 18:20:30 homeserver kernel: input: iMON Remote (15c2:0036) as /devices/pci0000:00/0000:00:13.0/usb5/5-1/5-1:1.0/rc/rc0/input3
Apr  8 18:20:30 homeserver kernel: rc0: iMON Remote (15c2:0036) as /devices/pci0000:00/0000:00:13.0/usb5/5-1/5-1:1.0/rc/rc0
Apr  8 18:20:30 homeserver kernel: imon:send_packet: packet tx failed (-32)
Apr  8 18:20:30 homeserver kernel: imon 5-1:1.0: remote input dev register failed
Apr  8 18:20:30 homeserver kernel: imon 5-1:1.0: imon_init_intf0: rc device setup failed
Apr  8 18:20:30 homeserver kernel: imon 5-1:1.0: unable to initialize intf0, err 0
Apr  8 18:20:30 homeserver kernel: imon:imon_probe: failed to initialize context!
Apr  8 18:20:30 homeserver kernel: imon 5-1:1.0: unable to register, err -19
Apr  8 18:20:30 homeserver kernel: BUG: unable to handle kernel NULL pointer dereference at 00000014
Apr  8 18:20:30 homeserver kernel: IP: [<c05c4e4c>] mutex_lock+0xc/0x30
Apr  8 18:20:30 homeserver kernel: *pde = 00000000
Apr  8 18:20:30 homeserver kernel: Oops: 0002 [#1] PREEMPT SMP
Apr  8 18:20:30 homeserver kernel: Modules linked in:
Apr  8 18:20:30 homeserver kernel: Pid: 367, comm: khubd Not tainted 3.8.3-htpc-00002-g79b1403 #23 Unknow Unknow/RS780-SB700
Apr  8 18:20:30 homeserver kernel: EIP: 0060:[<c05c4e4c>] EFLAGS: 00010296 CPU: 1
Apr  8 18:20:30 homeserver kernel: EIP is at mutex_lock+0xc/0x30
Apr  8 18:20:30 homeserver kernel: EAX: 00000014 EBX: 00000014 ECX: 00000000 EDX: f590e480
Apr  8 18:20:30 homeserver kernel: ESI: f5deac00 EDI: f590e480 EBP: f5f3ee00 ESP: f6577c28
Apr  8 18:20:30 homeserver kernel: DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
Apr  8 18:20:30 homeserver kernel: CR0: 8005003b CR2: 00000014 CR3: 0081b000 CR4: 000007d0
Apr  8 18:20:30 homeserver kernel: DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
Apr  8 18:20:30 homeserver kernel: DR6: ffff0ff0 DR7: 00000400
Apr  8 18:20:30 homeserver kernel: Process khubd (pid: 367, ti=f6576000 task=f649ea00 task.ti=f6576000)
Apr  8 18:20:30 homeserver kernel: Stack:
Apr  8 18:20:30 homeserver kernel: 00000000 f5deac00 c0448de4 f59714c0 f5deac64 c03b8ad2 f6577c90 00000004
Apr  8 18:20:30 homeserver kernel: f649ea00 c0205142 f6779820 a1ff7f08 f5deac00 00000001 f5f3ee1c 00000014
Apr  8 18:20:30 homeserver kernel: 00000004 00000202 15c20036 c07a03e8 fffee0ca f6795c00 f5f3ee1c f5deac00
Apr  8 18:20:30 homeserver kernel: Call Trace:
Apr  8 18:20:30 homeserver kernel: [<c0448de4>] ? imon_probe+0x494/0xde0
Apr  8 18:20:30 homeserver kernel: [<c03b8ad2>] ? rpm_resume+0xb2/0x4f0
Apr  8 18:20:30 homeserver kernel: [<c0205142>] ? sysfs_addrm_finish+0x12/0x90
Apr  8 18:20:30 homeserver kernel: [<c04170e9>] ? usb_probe_interface+0x169/0x240
Apr  8 18:20:30 homeserver kernel: [<c03b0ca0>] ? __driver_attach+0x80/0x80
Apr  8 18:20:30 homeserver kernel: [<c03b0ca0>] ? __driver_attach+0x80/0x80
Apr  8 18:20:30 homeserver kernel: [<c03b0a94>] ? driver_probe_device+0x54/0x1e0
Apr  8 18:20:30 homeserver kernel: [<c0416abe>] ? usb_device_match+0x4e/0x80
Apr  8 18:20:30 homeserver kernel: [<c03af314>] ? bus_for_each_drv+0x34/0x70
Apr  8 18:20:30 homeserver kernel: [<c03b0a0b>] ? device_attach+0x7b/0x90
Apr  8 18:20:30 homeserver kernel: [<c03b0ca0>] ? __driver_attach+0x80/0x80
Apr  8 18:20:30 homeserver kernel: [<c03b00ff>] ? bus_probe_device+0x5f/0x80
Apr  8 18:20:30 homeserver kernel: [<c03aeab7>] ? device_add+0x567/0x610
Apr  8 18:20:30 homeserver kernel: [<c041a7bc>] ? usb_create_ep_devs+0x7c/0xd0
Apr  8 18:20:30 homeserver kernel: [<c0413837>] ? create_intf_ep_devs+0x47/0x70
Apr  8 18:20:30 homeserver kernel: [<c04156c4>] ? usb_set_configuration+0x454/0x750
Apr  8 18:20:30 homeserver kernel: [<c03b0ca0>] ? __driver_attach+0x80/0x80
Apr  8 18:20:30 homeserver kernel: [<c041de8a>] ? generic_probe+0x2a/0x80
Apr  8 18:20:30 homeserver kernel: [<c03b0ca0>] ? __driver_attach+0x80/0x80
Apr  8 18:20:30 homeserver kernel: [<c0205aff>] ? sysfs_create_link+0xf/0x20
Apr  8 18:20:30 homeserver kernel: [<c04171db>] ? usb_probe_device+0x1b/0x40
Apr  8 18:20:30 homeserver kernel: [<c03b0a94>] ? driver_probe_device+0x54/0x1e0
Apr  8 18:20:30 homeserver kernel: [<c03af314>] ? bus_for_each_drv+0x34/0x70
Apr  8 18:20:30 homeserver kernel: [<c03b0a0b>] ? device_attach+0x7b/0x90
Apr  8 18:20:30 homeserver kernel: [<c03b0ca0>] ? __driver_attach+0x80/0x80
Apr  8 18:20:30 homeserver kernel: [<c03b00ff>] ? bus_probe_device+0x5f/0x80
Apr  8 18:20:30 homeserver kernel: [<c03aeab7>] ? device_add+0x567/0x610
Apr  8 18:20:30 homeserver kernel: [<c040e6df>] ? usb_new_device+0x12f/0x1e0
Apr  8 18:20:30 homeserver kernel: [<c040f4d8>] ? hub_thread+0x458/0x1230
Apr  8 18:20:30 homeserver kernel: [<c015554f>] ? dequeue_task_fair+0x9f/0xc0
Apr  8 18:20:30 homeserver kernel: [<c0131312>] ? release_task+0x1d2/0x330
Apr  8 18:20:30 homeserver kernel: [<c01477b0>] ? abort_exclusive_wait+0x90/0x90
Apr  8 18:20:30 homeserver kernel: [<c040f080>] ? usb_remote_wakeup+0x40/0x40
Apr  8 18:20:30 homeserver kernel: [<c0146ed2>] ? kthread+0x92/0xa0
Apr  8 18:20:30 homeserver kernel: [<c05c7877>] ? ret_from_kernel_thread+0x1b/0x28
Apr  8 18:20:30 homeserver kernel: [<c0146e40>] ? kthread_freezable_should_stop+0x50/0x50
Apr  8 18:20:30 homeserver kernel: Code: 89 04 24 89 f0 e8 05 ff ff ff 8b 5c 24 24 8b 74 24 28 8b 7c 24 2c 8b 6c 24 30 83 c4 34 c3 00 83 ec 08 89 1c 24 89 74 24 04 89 c3 <f0> ff 08 79 05 e8 ca 03 00 00 64 a1 70 d6 80 c0 8b 74 24 04 89
Apr  8 18:20:30 homeserver kernel: EIP: [<c05c4e4c>] mutex_lock+0xc/0x30 SS:ESP 0068:f6577c28
Apr  8 18:20:30 homeserver kernel: CR2: 0000000000000014
Apr  8 18:20:30 homeserver kernel: ---[ end trace df134132c967205c ]---

Signed-off-by: Kevin Baradon <kevin.baradon@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-23 17:50:09 -03:00
Kevin Baradon f7d141b312 [media] imon: Use large delays earlier
send_packet() is used during initialization, before send_packet_delay
is set. So, move ictx->send_packet_delay to happen earlier.

[mchehab@redhat.com: fold two patches into one to make git history clearer]
Signed-off-by: Kevin Baradon <kevin.baradon@gmail.com>

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-23 17:37:27 -03:00
Dan Carpenter c06ca8f92b [media] media: info leak in media_device_enum_entities()
The last part of the "u_ent.name" buffer isn't cleared so it still has
uninitialized stack memory.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-23 16:58:52 -03:00
Olivier Grenie 59501bb792 [media] dib7090p: improve the support of the dib7090 and dib7790
The intend of this patch is to improve the support of the dib7090 and
dib7790. The AGC1 min value is set to 32768 by default. The actual AGC1 min
and the external attenuation are controled depending on the received RF
level.

Signed-off-by: Olivier Grenie <olivier.grenie@parrot.com>
Signed-off-by: Patrick Boettcher <patrick.boettcher@parrot.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-22 17:15:52 -03:00
Olivier Grenie f45f513a93 [media] dib7090p: remove the support for the dib7090E
The intend of this patch is to remove the support for the dib7090E. The
DiB7090E-package has never left prototype state and never made it to
mass-prod-state.

Signed-off-by: Olivier Grenie <olivier.grenie@parrot.com>
Signed-off-by: Patrick Boettcher <patrick.boettcher@parrot.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-22 17:15:26 -03:00
Olivier Grenie 5e9c85d983 [media] dib8096: enhancement
The intend of this patch is to improve the support of the dib8096. The PLL
parameters are not automatically computed. The limit to set/unset external
diode for attenuation has been updated. The TFE8096P board is using the
new I2C API.

Signed-off-by: Olivier Grenie <olivier.grenie@parrot.com>
Signed-off-by: Patrick Boettcher <patrick.boettcher@parrot.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-22 17:15:07 -03:00
Olivier Grenie aedabf7a54 [media] dib0090: enhancement
The intend of this patch is to improve the support of the dib0090 tuner.
The ramp tables have been updated. Also some minor enhancements has been
added (EFUSE and reset).

Signed-off-by: Olivier Grenie <olivier.grenie@parrot.com>
Signed-off-by: Patrick Boettcher <patrick.boettcher@parrot.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-22 17:14:11 -03:00
Olivier Grenie 6fe1099c7a [media] dib7000p: enhancement
The intend of this patch is to improve the support of the dib7000p. It is
now possible to set the minimum value for the AGC1. Also, the driver takes
into account the frequency offset introduced in the tuned frequency.

Signed-off-by: Olivier Grenie <olivier.grenie@parrot.com>
Signed-off-by: Patrick Boettcher <patrick.boettcher@parrot.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-22 17:13:43 -03:00
Patrick Boettcher 173a64cb3f [media] dib8000: enhancement
The intend of this patch is to improve the support of the dib8000.

Signed-off-by: Olivier Grenie <olivier.grenie@parrot.com>
Signed-off-by: Patrick Boettcher <patrick.boettcher@parrot.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-22 16:58:16 -03:00
Frank Schaefer 1552fb344d [media] em28xx: add a missing le16_to_cpu conversion
commit 61ff5d69 "em28xx: improve em2710/em2820 distinction" missed the
le16_to_cpu conversion of the USB vendor ID.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-22 10:11:05 -03:00
Alexey Khoroshilov 5ddfbbb9ca [media] cx88: Fix unsafe locking in suspend-resume
Legacy PCI suspend-resume handlers are called with interrupts enabled.

But cx8800_suspend/cx8800_resume and
cx8802_suspend_common/cx8802_resume_common use spin_lock/spin_unlock
functions to acquire dev->slock, while the same lock is acquired in the
corresponding irq-handlers: cx8800_irq and cx8802_irq.

That means a deadlock is possible if an interrupt happens while suspend
or resume owns the lock. The patch replaces spin_lock/spin_unlock with
spin_lock_irqsave/spin_unlock_irqrestore.

Found by Linux Driver Verification project (linuxtesting.org).

[mchehab@redhat.com: Fix CodingStyle]
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-22 10:08:30 -03:00
Dan Carpenter 7186797646 [media] lg2160: dubious one-bit signed bitfield
Sparse complains that these are "dubious one-bit signed bitfields" and
the comment says it was intended to be 1 and 0 instead of -1 and 0.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-22 10:04:20 -03:00
Andrey Smirnov b879a9c2a7 [media] v4l2: Add a V4L2 driver for SI476X MFD
This commit adds a driver that exposes all the radio related
functionality of the Si476x series of chips via the V4L2 subsystem.

[mchehab@redhat.com: change it to depends on MFD_SI476X_CORE instead of
 selecting it; vidioc_s_register now uses const struct]
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-18 21:20:34 -03:00
Mauro Carvalho Chehab 82cd0b278f Revert "[media] v4l2: Add a V4L2 driver for SI476X MFD"
As requested by Andrey Smirnov <andrew.smirnov@gmail.com>, revert
this patch.

This reverts commit 30bac91104.

Conflicts:
	drivers/media/radio/Kconfig
	drivers/media/radio/radio-si476x.c

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-17 06:05:18 -03:00
Mauro Carvalho Chehab 396f3659aa [media] r820t: Don't divide the IF by two
The original Win driver doesn't do; rtl-sdr also disabled that
piece of the code.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
2013-04-16 21:39:56 -03:00
Mauro Carvalho Chehab dfdeac8108 [media] r820t: disable auto gain/VGA setting
On field tests, the auto gain routine is not working, nor it is
used by the original driver. Let's comment it for now.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
2013-04-16 21:39:44 -03:00
Mauro Carvalho Chehab c8832e8f42 [media] rtl2832: Fix IF calculus
Spectrum is inverted. So, we need to invert it when calculating the
value for the IF register

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
2013-04-16 21:39:28 -03:00
Mauro Carvalho Chehab b5e2b97b0b [media] r820t: put it into automatic gain mode
Currently, it is putting it on manual mode.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
2013-04-16 21:39:11 -03:00
Mauro Carvalho Chehab f26588947b [media] r820t: Fix hp_cor filter mask
The bit mask was inverted here.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
2013-04-16 21:38:18 -03:00
Mauro Carvalho Chehab c0c6ed8d04 [media] r820t: fix PLL calculus
There are a few errors at the PLL calculus, causing the device
to use wrong values.
While here, change the calculus to use 32 bits, as there's no
need for 64 bits there.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
2013-04-16 21:37:17 -03:00
Mauro Carvalho Chehab 064fd169c5 [media] r820t: Don't put it in standby if not initialized yet
r820t_standby() can be called before r820t_init().
If that happens, just do nothing.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
2013-04-16 21:36:56 -03:00
Mauro Carvalho Chehab 4176e7ea88 [media] r820t: avoid rewrite all regs when not needed
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
2013-04-16 21:33:59 -03:00
Mauro Carvalho Chehab 52775fd5b5 [media] r820t: Allow disabling IMR callibration
The rtl-sdr library disabled IMR callibration. While I'm not sure
yet why, it could be a good idea to add a modprobe parameter here,
to allow to also disable it. There are two rationale behind it:
- It helps to compare USB dumps between rtl-sdr and the Kernel module;
- If rtl-sdr disabled it, perhaps there's a good reason (e. g. it
  might not be actually working, or it might be causing some trouble).
For both cases, it seems useful to add a modprobe parameter to allow
testing the device with both configurations.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
2013-04-16 21:33:36 -03:00
Mauro Carvalho Chehab 6596e88043 [media] r820t: add a commented code for GPIO
Add the code to set the GPIO for this tuner. This code is
currently unused, so it is kept there only for completeness.
With this patch there are just two things that got left from
the original driver:
- At standby, there's another mode, not used by rtl2832u.
  Not sure if it might be needed in the future, but I suspect
  it is not used at all;
- There is a "fast tune" mode. As nor DVB or V4L API supports
  it, it seems an overkill to implement it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
2013-04-16 21:33:23 -03:00
Mauro Carvalho Chehab 25cf4d462a [media] r820t: add IMR calibrate code
This code seems to calibrate I/Q phase and gain during the
device initialization.
This is done only once, and it doesn't seem to be needed to
happen after resuming.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
2013-04-16 21:33:11 -03:00
Mauro Carvalho Chehab d75d538899 [media] r820t: proper initialize the PLL register
The rtl-sdr library, from where this driver was initially
based, doesn't use half PLL clock, but this is used on
the Realtek Kernel driver. So, also do the same here.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
2013-04-16 21:32:27 -03:00
Mauro Carvalho Chehab 9cc2570a1d [media] r820t: use usleep_range()
Instead of using msleep(), use sleep_range(), as it provides
a closer sleep time.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
2013-04-16 21:31:42 -03:00
Mauro Carvalho Chehab 226471a18f [media] r820t: fix prefix of the r820t_read() function
Just cosmetic changes: all other functions are prefixed
by r820t. Do the same for r820t_read().

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
2013-04-16 21:31:15 -03:00
Mauro Carvalho Chehab 8678b03428 [media] r820t: split the function that read cached regs
As we'll need to retrieve cached registers, make this
function explicit.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
2013-04-16 21:31:01 -03:00
Mauro Carvalho Chehab 75c1819e5e [media] r820t: better report signal strength
If signal is zero, shows it as a zero, not as 0xff.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
2013-04-16 21:29:31 -03:00
Mauro Carvalho Chehab 84ddc33c20 [media] r820t: add support for diplexer
This is part of the original driver, and adding it doesn't hurt,
so add it, to better sync the code.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
2013-04-16 21:28:31 -03:00
Mauro Carvalho Chehab 6b8c230876 [media] r820t: Show the read data in the bit-reversed order
As the driver's logic uses the bit-reversed order for read,
use it as well when displaying the debug messages.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
2013-04-16 21:28:05 -03:00
Mauro Carvalho Chehab 6189f80d5d [media] r820t: use the second table for 7MHz
The Realtek Kernel driver uses the second DVB-T 7MHz table instead
of the first one. Use it as well.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
2013-04-16 21:27:51 -03:00
Mauro Carvalho Chehab 103fe2fb23 [media] r820t: Invert bits for read ops
On read, the bit order is inverted.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
2013-04-16 21:27:38 -03:00
Mauro Carvalho Chehab 884655ad2e [media] rtl2832: properly set en_bbin for r820t
DVBT_EN_BBIN should be set on both places where IF is set. So,
move it to a function and call it where needed.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
2013-04-16 21:27:19 -03:00
Mauro Carvalho Chehab a7dd065f49 [media] r820t: use the right IF for the selected TV standard
IF is set at r820t_set_tv_standard(). So, we can't calculate
LO frequency before calling it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
2013-04-16 21:26:06 -03:00
Mauro Carvalho Chehab fa4bfd2bd0 [media] rtl2832: add code to bind r820t on it
There are some init stuff to be done for each new tuner at the
demod code. Add the code there for r820t.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
2013-04-16 21:25:52 -03:00
Mauro Carvalho Chehab f60f5bcbe4 [media] r820t: Fix IF scale
Scale used at get_if_freq and LO freq calculus is Hz.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
2013-04-16 21:25:24 -03:00
Mauro Carvalho Chehab da31934fb8 [media] rtl820t: Add a debug msg when PLL gets locked
[ 2255.342797] r820t 3-001a: generic_set_freq: PLL locked on frequency 725476191 Hz, gain=45

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
2013-04-16 21:25:13 -03:00
Mauro Carvalho Chehab 7a5ef30dc3 [media] r820t: proper lock and set the I2C gate
As this tuner can be used by analog and digital parts of the
driver, be sure that all ops that access the hardware will
be be properly locked.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
2013-04-16 21:24:10 -03:00
Mauro Carvalho Chehab 9e30edd890 [media] rtl28xxu: use r820t to obtain the signal strength
Now that we can get the strength from r820t, use it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
2013-04-16 21:23:01 -03:00
Mauro Carvalho Chehab 50786ddfa8 [media] r820t: Set gain mode to auto
This tuner works with 2 modes: automatic gain mode and manual
gain mode. Put it into automatic mode, as we currently don't
have any API for manual gain adjustment.
The logic to allow setting the manual mode is there, as it is
just a few extra code. This way, if/when we latter add support
for setting the gain mode, the code is already there.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
2013-04-16 21:22:41 -03:00
Mauro Carvalho Chehab f8fde0e045 [media] r820t: Give a better estimation of the signal strength
Instead of a binary signal strength measure, use the tuner gain
to obtain a better estimation of the signal strength.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
2013-04-16 21:20:12 -03:00
Mauro Carvalho Chehab 6889ab2a25 [media] rtl28xxu: add support for Rafael Micro r820t
This tuner is used on some rtl2882 dongles. Add it to the driver.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
2013-04-16 21:19:10 -03:00
Mauro Carvalho Chehab a80abc58fe [media] r820t: Add a tuner driver for Rafael Micro R820T silicon tuner
This driver was written from scratch, based on an existing driver
that it is part of rtl-sdr git tree, released under GPLv2:
	https://groups.google.com/forum/#!topic/ultra-cheap-sdr/Y3rBEOFtHug
	https://github.com/n1gp/gr-baz
	http://cgit.osmocom.org/rtl-sdr/plain/src/tuner_r820t.c
	(there are also other variants of it out there)
>From what I understood from the threads, the original driver was converted
to userspace from a Realtek tree. I couldn't find the original tree.
However, the original driver look awkward on my eyes. So, I decided to
write a new version from it from the scratch, while trying to reproduce
everything found there.
TODO:
- After locking, the original driver seems to have some routines to
  improve reception. This was not implemented here yet.
- RF Gain set/get is not implemented.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
2013-04-16 21:18:42 -03:00
Mauro Carvalho Chehab 098af4bde0 [media] sta2x11_vip: Fix compilation if I2C is not set
From Fengguang Wu <fengguang.wu@intel.com>:

> drivers/media/pci/sta2x11/sta2x11_vip.c: In function 'sta2x11_vip_init_one':
> drivers/media/pci/sta2x11/sta2x11_vip.c:1314:2: error: implicit declaration of function 'i2c_get_adapter' [-Werror=implicit-function-declaration]
> drivers/media/pci/sta2x11/sta2x11_vip.c:1314:15: warning: assignment makes pointer from integer without a cast [enabled by default]
> drivers/media/pci/sta2x11/sta2x11_vip.c:1330:2: error: implicit declaration of function 'i2c_put_adapter' [-Werror=implicit-function-declaration]

And also:

> warning: (STA2X11_VIP) selects VIDEO_ADV7180 which has unmet direct dependencies (MEDIA_SUPPORT && VIDEO_V4L2 && I2C)
> drivers/media/i2c/adv7180.c: In function '__adv7180_status':
> drivers/media/i2c/adv7180.c:194:2: error: implicit declaration of function 'i2c_smbus_read_byte_data' [-Werror=implicit-function-declaration]
> drivers/media/i2c/adv7180.c: In function 'adv7180_s_routing':
> drivers/media/i2c/adv7180.c:251:2: error: implicit declaration of function 'i2c_smbus_write_byte_data' [-Werror=implicit-function-declaration]
> drivers/media/i2c/adv7180.c: In function 'adv7180_probe':
> drivers/media/i2c/adv7180.c:551:2: error: implicit declaration of function 'i2c_check_functionality' [-Werror=implicit-function-declaration]
> drivers/media/i2c/adv7180.c:554:2: error: implicit declaration of function 'i2c_adapter_id' [-Werror=implicit-function-declaration]
> drivers/media/i2c/adv7180.c: At top level:
> drivers/media/i2c/adv7180.c:663:1: warning: data definition has no type or storage class [enabled by default]
> drivers/media/i2c/adv7180.c:663:1: warning: type defaults to 'int' in declaration of 'module_i2c_driver' [-Wimplicit-int]
> drivers/media/i2c/adv7180.c:663:1: warning: parameter names (without types) in function declaration [enabled by default]
> drivers/media/i2c/adv7180.c:649:26: warning: 'adv7180_driver' defined but not used [-Wunused-variable]

This is due to the lack of I2C support:

...
> CONFIG_I2C is not set
...

So, Make sure that sta2x11_vip depends on I2C.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-16 20:06:34 -03:00
Mauro Carvalho Chehab 99ca5557ff [media] it913x: rename its tuner driver to tuner_it913x
There are three drivers with *it913x name on it, and they all
belong to the same device:
	a tuner, at it913x.c;
	a frontend: it913x-fe.c;
	a bridge: it913x.c, renamed to dvb_usb_it913x by the
building system.

This is confusing. Even more confusing are the two .c files with
the same name under different directories, with different contents
and different functions. So, prepend the tuner one.

This also breaks the out-of-tree compilation system.

Reported-by: Frederic Fays <frederic.fays@gmail.com>
Acked-by: Antti Palosaari <crope@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-16 20:06:05 -03:00
William Steidtmann 76dea4cf52 [media] mceusb: add some missing cmd sizes
Fix mceusb_cmdsize() which returns incorrect datasize=0 for
sub-commands MCE_RSP_GETPORTSTATUS, MCE_RSP_GETWAKESOURCE,
MCE_RSP_EQDEVDETAILS, MCE_RSP_EQEMVER, and MCE_RSP_EQIRNUMPORTS.

While here, change mceusb_cmdsize() name to reflect that it returns
data size not cmd size.

Signed-off-by: William Steidtmann <billstei@hbci.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-16 18:53:34 -03:00
David Howells bebe3c69de [media] zoran: Don't print proc_dir_entry data in debug [RFC]
Don't print proc_dir_entry data in debug as we're soon to have no direct
access to the contents of the PDE.  Print what was put in there instead.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-16 18:27:44 -03:00
Michal Marek 430c73fa47 [media] em28xx: Put remaining .vidioc_g_chip_info instance under ADV_DEBUG
Commit cd634f1 ("[media] v4l2: put VIDIOC_DBG_G_CHIP_NAME under
ADV_DEBUG") missed the initializer of radio_ioctl_ops:
drivers/media/usb/em28xx/em28xx-video.c:1830:2: error: unknown field 'vidioc_g_chip_info' specified in initializer
drivers/media/usb/em28xx/em28xx-video.c:1830:26: error: 'vidioc_g_chip_info' undeclared here (not in a function)

Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-16 18:26:08 -03:00
Hans Verkuil 486a7a2813 [media] cx25821: remove cx25821-audio-upstream.c from the Makefile
The audio output is currently not used as this should be rewritten as an
alsa driver. For the time being remove this source from the Makefile.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-16 18:13:06 -03:00
Hans Verkuil ea3f7ac6e9 [media] cx25821: replace custom ioctls with write()
Ideally this should be implemented with vb2, but it'll do for now.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-16 18:12:34 -03:00
Hans Verkuil 7087d31b0c [media] cx25821: drop cx25821-video-upstream-ch2.c/h
cx25821-video-upstream_ch2.c/h is practically identical to cx25821-video-upstream.c/h
so add support for ch2 into cx25821-video-upstream.c instead.
After this we can replace the custom ioctls with a proper write() interface.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-16 18:11:58 -03:00
Hans Verkuil e90878ab15 [media] cx25821: add output format ioctls
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-16 18:10:59 -03:00
Hans Verkuil 0df13d99f7 [media] cx25821: prepare querycap for output support
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-16 18:10:35 -03:00
Hans Verkuil 4c1d0f7302 [media] cx25821: group all fmt functions together
No other changes, just function reordering.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-16 18:10:21 -03:00
Hans Verkuil 1f1988706d [media] cx25821: setup output nodes correctly
Drop the custom ioctls and enable the video output nodes again, this time
using standard ioctls.
The next step will be to provide a proper write() interface.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-16 18:09:57 -03:00
Hans Verkuil a6aa0dc482 [media] cx25821: remove references to subdevices that aren't there
This driver does not have subdevices, so why call subdev ops? After
removing that it became apparent that only Composite is supported as
input, so remove also any reference to other inputs.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-16 18:09:18 -03:00
Hans Verkuil 7704cfb9cd [media] cx25821: remove custom ioctls that duplicate v4l2 ioctls
No idea why these custom ioctls exist: they have perfectly normal v4l2
counterparts which are already implemented.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-16 18:08:44 -03:00
Hans Verkuil 988f7b80ab [media] cx25821: g/s/try/enum_fmt related fixes and cleanups
- fill in colorspace
- zero priv
- delete unsupported formats
- fix field handling
- s_std should update width/height
- proper mapping of width/height to valid resolutions

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-16 18:08:13 -03:00
Hans Verkuil 8d125c507d [media] cx25821: switch to v4l2_fh, add event and prio handling
It is now possible to remove cx25821_fh and replace it with v4l2_fh,
which in turn makes event handling and core prio handling possible.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-16 18:07:43 -03:00
Hans Verkuil 84293f0843 [media] cx25821: replace resource management functions with fh ownership
Just remember which filehandle is streaming instead of using complicated
resource masks.
After this patch we can replace cx25821_fh with v4l2_fh.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-16 18:07:13 -03:00
Hans Verkuil 2efe2cc430 [media] cx25821: move vidq from cx25821_fh to cx25821_channel
This is not a per-filehandle object, it's a per-channel object.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-16 18:06:35 -03:00
Hans Verkuil 11f095aa41 [media] cx25821: remove 'type' field from cx25821_fh
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-16 18:05:49 -03:00
Hans Verkuil be178cb4f4 [media] cx25821: use core locking
This allows us to replace .ioctl with .unlocked_ioctl.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-16 18:05:22 -03:00
Hans Verkuil b6f8727e9f [media] cx25821: remove unnecessary debug messages
The v4l2 core already has support for debugging ioctls/file operations.
No need to do that again.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-16 18:05:00 -03:00
Hans Verkuil bad1f29d0f [media] cx25821: remove TRUE/FALSE/STATUS_(UN)SUCCESSFUL defines
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-16 18:04:37 -03:00
Hans Verkuil f8d7ee7091 [media] cx25821: convert to the control framework
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-16 18:04:12 -03:00
Hans Verkuil 467870ca26 [media] cx25821: embed video_device, clean up some kernel log spam
Embed the video_device struct instead of allocating it.
Remove some of the annoying and ugly kernel messages shown during
loading and unloading of the module.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-16 18:03:49 -03:00
Hans Verkuil 89c21389f2 [media] cx25821: remove bogus dependencies
This driver doesn't use DVB, RC, cx25840 or tveeprom.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-16 18:03:27 -03:00
Hans Verkuil de9ea4cf7f [media] cx25821: remove cropping ioctls
This driver does not implement cropping, so remove the cropping ioctls.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-16 18:03:09 -03:00
Hans Verkuil 95c232a24b [media] cx25821: make lots of externals static
A lot of functions and variables were external when they really can be
declared as static.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-16 18:02:54 -03:00
Hans Verkuil 6b1dce251f [media] cx25821: s_input didn't check for invalid input
The s_input implementation allowed input 1 even if that didn't exist.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-16 18:02:23 -03:00
Hans Verkuil a8f35ce3d6 [media] cx25821: remove unnecessary global devlist
This device list is not necessary. The kernel already has all that information,
so just use that instead.
Also remove a bogus refcount and some dead 'private_free' code in the alsa driver.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-16 18:02:02 -03:00
Hans Verkuil bfef0d35e5 [media] cx25821: make cx25821_sram_channels const
And get rid of the channel0-11 external pointers and two more unused fields
in cx25821.h.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-16 18:01:29 -03:00
Hans Verkuil 3dd473ca58 [media] cx25821: fix log_status, querycap
log_status shouldn't print LOG STATUS lines, the core does that already.
Fix querycap version number and add device_caps support.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-16 17:59:56 -03:00
Hans Verkuil 18c73af696 [media] cx25821: remove unused fields, ioctls
Do some spring cleaning:
- there are no board defines with tuners, so remove bogus tuner support.
- tv standard handling has nothing to do with tuners, so keep that.
- replace the deprecated current_norm by g_std.
- querystd isn't implemented, so remove the ioctl.
- remove a bunch of unused fields in cx25821.h

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-16 17:57:27 -03:00
Hans Verkuil ffd3c23304 [media] cx25821: remove bogus radio/vbi/'video-ioctl' support
This device does not support radio or vbi, so remove anything referring
to that.
In addition, the driver created an 'video ioctl' node, which was unused and
was effectively identical to the first video node.
This bogus video node is now removed, leaving us with 8 video capture nodes
and 2 video output nodes.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-16 17:56:19 -03:00
Hans Verkuil 170bd53303 [media] cx25821: fix compiler warning
drivers/media/pci/cx25821/cx25821-video.c: In function ‘cx25821_video_register’:
drivers/media/pci/cx25821/cx25821-video.c:518:1: warning: the frame size of 1600 bytes is larger than 1024 bytes [-Wframe-larger-than=]
Fixed by just making the struct video_device template static const.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-16 16:28:26 -03:00
Hans Verkuil 31b320739b [media] cx25821: the audio channel was registered as a video node
Skip the audio channel when registering the video nodes. This fixes a bug
where that incorrectly registered 'video' node was never unregistered.
Note: this bug only surfaces if the video output nodes are enabled again
after the previous patch disabled them.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-15 08:35:21 -03:00
Hans Verkuil a877e2771a [media] cx25821: do not expose broken video output streams
The cx25821 driver has support for one audio output channel and two video
output channels.
This is implemented in a very ugly and very evil way through a custom ioctl
that passes the filename of a file containing the video data, which is then
read by the driver itself using vfs.
There are a number of problems with this:
1) it's very ugly and very evil (I can't say that often enough).
2) V4L2 supports video output, so why not use that?
3) it's very buggy, closing the filehandle through which you passed the ioctl
   will oops the kernel.
4) it's a nasty security leak since this allows you to load any file in the
   system as a video or audio source, so in theory you can output /etc/passwd
   to audio or video out and record & decode it on another device.
Because of all these issues we no longer register those output video nodes.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-15 08:34:37 -03:00
Mauro Carvalho Chehab a9af539252 [media] cxd2820r_t2: Fix a warning: stream_id is unsigned
drivers/media/dvb-frontends/cxd2820r_t2.c: In function 'cxd2820r_set_frontend_t2':
drivers/media/dvb-frontends/cxd2820r_t2.c:128:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-15 08:32:41 -03:00
Hans Verkuil c95789ecd5 [media] cx25821: do not expose broken video output streams
The cx25821 driver has support for one audio output channel and two video
output channels.
This is implemented in a very ugly and very evil way through a custom ioctl
that passes the filename of a file containing the video data, which is then
read by the driver itself using vfs.
There are a number of problems with this:
1) it's very ugly and very evil (I can't say that often enough).
2) V4L2 supports video output, so why not use that?
3) it's very buggy, closing the filehandle through which you passed the ioctl
   will oops the kernel.
4) it's a nasty security leak since this allows you to load any file in the
   system as a video or audio source, so in theory you can output /etc/passwd
   to audio or video out and record & decode it on another device.
Because of all these issues we no longer register those output video nodes.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-15 08:28:41 -03:00
Antti Palosaari 4c41dab4d6 [media] rc: fix single line indentation of keymaps/Makefile
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-14 22:51:41 -03:00
Antti Palosaari 831378dbb6 [media] em28xx: map remote for 1b80:e425
Map RC_MAP_REDDO to that device.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-14 22:48:49 -03:00
Antti Palosaari 52f5ad6c5f [media] rc: add rc-reddo
It is very similar than rc-msi-digivox-iii but new keytable is needed
as there is one existing scancode mapped to different button. Also that
one has less buttons.
NEC extended protocol with address 0x61d6.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-14 22:48:35 -03:00
Seung-Woo Kim 068a0df760 [media] media: vb2: add length check for mmap
The length of mmap() can be bigger than length of vb2 buffer, so
it should be checked.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-14 22:37:26 -03:00