Commit graph

1607 commits

Author SHA1 Message Date
Linus Torvalds 2183a58803 media updates for v3.19-rc1
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJUhxhbAAoJEAhfPr2O5OEV4JwP/2I7D2KGz5tdNGDAh1H8+swR
 hoj3tX7HLhwBmF6XIUlMYbk5L/ClDace6kcjT6OjwJ9SktrrKks6ZSsYsBjCIyOC
 yS7xNQArUKzWk4vV+uJVAvtF8V57LLFul8dhHk0JJwAxrkWnPvDdfJNs4PhUAkgn
 1i0PPshNo5Ow/+4YMiOjEDR+q9TMSUUzaq5zkPF7AFCnykuJ1wUJwUE0qjTfGi+4
 gl1yMye0TEawTYSM8h/+Lh7wosNFZYcXg85r04A6a8h6GLgg0h6KSOJjyPITmQ+j
 hLdtyiYs8a6XT+Y8o416zxpbSozo7KXCUTtet/N5g+lgQMqZqSd9WxE52SOY+kfd
 UVeob0VfWR0xdDzaJp5rLQ/MQ16RTHaHppgUidFxxGe9D5f9JM/88I0OfwNzl4uO
 cv2cyeNktHH6bcjfOGqxSVmZWgAm6q6qU7MN07PoN+5TcUlYTAOi1WLE5K+7HGgw
 CxzOZ61oxi/OO1FapaVoipq6ycjltTql2kbcARvmrRrbge0ocAqHxHqFyUbDDhNw
 Wn/O6VzLfpW0vGTacC6+xcUSpIhwajJ80UJAOqJP8sw0Xtmian5Lcs6gVzxwkOdU
 36Po4RRGFqsG6Sq3HR+toNwKt/nHNEFkJwYcNFHdvBiXTEYYkMe6MccUxxb3i/iI
 KxB1s51zVy9t3PqjP+3J
 =i7gx
 -----END PGP SIGNATURE-----

Merge tag 'media/v3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media

Pull media updates from Mauro Carvalho Chehab:
 - Two new dvb frontend drivers: mn88472 and mn88473
 - A new driver for some PCIe DVBSky cards
 - A new remote controller driver: meson-ir
 - One LIRC staging driver got rewritten and promoted to mainstream:
   igorplugusb
 - A new tuner driver (m88rs6000t)
 - The old omap2 media driver got removed from staging.  This driver
   uses an old DMA API and it is likely broken on recent kernels.
   Nobody cared enough to fix it
 - Media bus format moved to a separate header, as DRM will also use the
   definitions there
 - mem2mem_testdev were renamed to vim2m, in order to use the same
   naming convention taken by the other virtual test driver (vivid)
 - Added a new driver for coda SoC (coda-jpeg)
 - The cx88 driver got converted to use videobuf2 core
 - Make DMABUF export buffer to work with DMA Scatter/Gather and Vmalloc
   cores
 - Lots of other fixes, improvements and cleanups on the drivers.

* tag 'media/v3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (384 commits)
  [media] mn88473: One function call less in mn88473_init() after error
  [media] mn88473: Remove uneeded check before release_firmware()
  [media] lirc_zilog: Deletion of unnecessary checks before vfree()
  [media] MAINTAINERS: Add myself as img-ir maintainer
  [media] img-ir: Don't set driver's module owner
  [media] img-ir: Depend on METAG or MIPS or COMPILE_TEST
  [media] img-ir/hw: Drop [un]register_decoder declarations
  [media] img-ir/hw: Fix potential deadlock stopping timer
  [media] img-ir/hw: Always read data to clear buffer
  [media] redrat3: ensure dma is setup properly
  [media] ddbridge: remove unneeded check before dvb_unregister_device()
  [media] si2157: One function call less in si2157_init() after error
  [media] tuners: remove uneeded checks before release_firmware()
  [media] arm: omap2: rx51-peripherals: fix build warning
  [media] stv090x: add an extra protetion against buffer overflow
  [media] stv090x: Remove an unreachable code
  [media] stv090x: Some whitespace cleanups
  [media] em28xx: checkpatch cleanup: whitespaces/new lines cleanups
  [media] si2168: add support for firmware files in new format
  [media] si2168: debug printout for firmware version
  ...
2014-12-11 11:49:23 -08:00
Mauro Carvalho Chehab fdf1bc9fa2 [media] em28xx: checkpatch cleanup: whitespaces/new lines cleanups
This patch is basically produced while testing a tool that
Joe Perches sent upstream sometime ago:
	https://lkml.org/lkml/2014/7/11/794

I used it with those arguments:
	$ reformat_with_checkpatch.sh drivers/media/usb/em28xx/em28xx*.[ch]

It actually produced 24 patches, with is too much, and showed
interesting things: gcc produced different codes on most of the
patches, even with just linespace changes. The total code data
remained the same on all cases I checked though.

Anyway, provided that we fold the resulting patches, this tool
seems useful.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-12-04 14:13:14 -02:00
Mauro Carvalho Chehab a2ea556117 [media] stv090x: remove export symbol for stv090x_set_gpio()
Drivers that use dvb_attach can have just one exported symbol,
or they will cause compilation breakages depending on the
selected frontends.

As Jim reported:
drivers/built-in.o: In function `technisat_usb2_set_voltage':
technisat-usb2.c:(.text+0x3b4919): undefined reference to `stv090x_set_gpio'
make: *** [vmlinux] Error 1

That happens because, on his configuration, the configuration
is:

	CONFIG_DVB_USB=y
	CONFIG_DVB_STV090x=m

Luis proposed ar way to fix, but that would just force the
STV090x to be selected, even if one wants to use a device
with a different frontend.

Instead, let's do the right thing: move set_gpio to the
configuration structure and fill it during dvb_attach().

This way, the driver can still call it, and dvb_attach()
will load stv090x module only if the device really needs it.

Reported by: Jim Davis <jim.epost@gmail.com>

Cc: Luis Rodriguez <mcgrof@suse.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-12-04 13:52:45 -02:00
Nibble Max 134e7e1cb3 [media] dvb-usb-dvbsky: add TechnoTrend CT2-4400 and CT2-4650 devices support
Signed-off-by: Nibble Max <nibble.max@gmail.com>
Reviewed-by: Olli Salonen <olli.salonen@iki.fi>
Tested-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-12-04 13:30:50 -02:00
Nibble Max 2adb177e57 [media] cxusb: remove TechnoTrend CT2-4400 and CT2-4650 devices
Remove TechnoTrend CT2-4400 and CT2-4650 devices from cxusb.
They are supported by dvb-usb-dvbsky driver in PATCH 3/3.

Signed-off-by: Nibble Max <nibble.max@gmail.com>
Reviewed-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-12-04 13:30:29 -02:00
Nibble Max 0a5a4f32ac [media] dvb-usb-dvbsky: add T330 dvb-t2/t/c usb stick support
DVBSky T330 dvb-t2/t/c usb stick:
1>dvb frontend: SI2157A30(tuner), SI2168B40(demod)
2>usb controller: CY7C68013A

Signed-off-by: Nibble Max <nibble.max@gmail.com>
Reviewed-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-12-04 13:28:38 -02:00
Hans Verkuil 2eb3b1adcb [media] media/usb,pci: fix querycap
Querycap shouldn't set the version field (the core does that for you),
but it should set the device_caps field.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-12-02 11:30:34 -02:00
Mauro Carvalho Chehab 504febc3f9 Revert "[media] lmed04: add missing breaks"
According with Malcolm, the missing breaks are intentional.

So, let's revert commit d442b15fb4,
add some comments to document it and fix the two smatch warnings:

drivers/media/usb/dvb-usb-v2/lmedm04.c:828 lme_firmware_switch() warn: missing break? reassigning 'st->dvb_usb_lme2510_firmware'
drivers/media/usb/dvb-usb-v2/lmedm04.c:850 lme_firmware_switch() warn: missing break? reassigning 'st->dvb_usb_lme2510_firmware'

using a different strategy to avoid reassign values to
st->dvb_usb_lme2510_firmware.

Acked-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-25 22:16:25 -02:00
Shuah Khan eb336eab3e [media] media/au0828: Fix IR stop, poll to not access device during disconnect
au0828 IR stop and poll routines continue to access device
while usb disconnect is in progress. There is small window
between device disconnect and usb interface is set to null.
This results in filling the log with several of the following
error messages. Fix it to detect device disconnect condition
and avoid device access.

Nov 20 18:58:02 anduin kernel: [  102.949819] au0828: au0828_usb_disconnect()
Nov 20 18:58:02 anduin kernel: [  102.950046] au0828: send_control_msg() Failed sending control message, error -71.
Nov 20 18:58:02 anduin kernel: [  102.950052] au0828: send_control_msg() Failed sending control message, error -19.
Nov 20 18:58:02 anduin kernel: [  102.950056] au0828: send_control_msg() Failed sending control message, error -19.
Nov 20 18:58:02 anduin kernel: [  102.950061] au0828: send_control_msg() Failed sending control message, error -19.
Nov 20 18:58:02 anduin kernel: [  102.950065] au0828: recv_control_msg() Failed receiving control message, error -19.
Nov 20 18:58:02 anduin kernel: [  102.950069] au0828: recv_control_msg() Failed receiving control message, error -19.
Nov 20 18:58:02 anduin kernel: [  102.950072] au0828: recv_control_msg() Failed receiving control message, error -19.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-25 13:32:49 -02:00
Markus Elfring 83f56f7cbd [media] USB: Deletion of unnecessary checks before three function calls
GIT_AUTHOR_DATE=1416486805
The functions pvr2_hdw_destroy(), rc_unregister_device() and vfree() perform
also input parameter validation. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-25 13:31:52 -02:00
Nibble Max b43a590d44 [media] dvb-usb-dvbsky: add T680CI dvb-t2/t/c usb ci box support
DVBSky T680CI dvb-t2/t/c usb ci box:
1>dvb frontend: SI2158A20(tuner), SI2168A30(demod)
2>usb controller: CY7C86013A
3>ci controller: CIMAX SP2 or its clone.

Signed-off-by: Nibble Max <nibble.max@gmail.com>
Reviewed-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-25 12:20:27 -02:00
Mauro Carvalho Chehab d442b15fb4 [media] lmed04: add missing breaks
drivers/media/usb/dvb-usb-v2/lmedm04.c:828 lme_firmware_switch() warn: missing break? reassigning 'st->dvb_usb_lme2510_firmware'
drivers/media/usb/dvb-usb-v2/lmedm04.c:849 lme_firmware_switch() warn: missing break? reassigning 'st->dvb_usb_lme2510_firmware'

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-25 09:18:45 -02:00
CrazyCat a0f629b975 [media] cxusb: Geniatech T230 support
Geniatech Mygica T230 DVB-T/T2/C USB stick support.

Signed-off-by: Evgeny Plehov <EvgenyPlehov@ukr.net>
Reviewed-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-25 09:15:54 -02:00
Olli Salonen fc30dd7647 [media] em28xx: Add support for Terratec Cinergy T2 Stick HD
Terratec Cinergy T2 Stick HD [eb1a:8179] is a USB DVB-T/T2/C tuner that
contains following components:

* Empia EM28178 USB bridge
* Silicon Labs Si2168-A30 demodulator
* Silicon Labs Si2146-A10 tuner

I don't have the remote, so the RC_MAP is a best guess based on the pictures of
the remote controllers and other supported Terratec devices with a similar
remote.

[Antti: Resolved conflict caused by Leadtek VC100 patch]

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-25 09:13:10 -02:00
Laurent Pinchart ef33d901db [media] uvcvideo: Return all buffers to vb2 at stream stop and start failure
videobuf2 requires drivers to give back ownership of all queue buffers
in the stop_streaming operation, as well as in the start_streaming
operation in case of failure. Mark all queued buffers as done in the
error or queued state.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-25 08:42:33 -02:00
Laurent Pinchart 0da4ab984b [media] uvcvideo: Rename and split uvc_queue_enable to uvc_queue_stream(on|off)
This brings the function name in line with the V4L2 API terminology and
allows removing the duplicate queue type check.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-25 08:42:01 -02:00
Laurent Pinchart 1b7f9c989e [media] uvcvideo: Rename uvc_alloc_buffers to uvc_request_buffers
This brings the function name in line with the V4L2 API terminology.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-25 08:41:05 -02:00
Laurent Pinchart 3f02de275e [media] uvcvideo: Don't stop the stream twice at file handle release
When releasing the file handle the driver calls the vb2_queue_release
which turns the stream off. There's thus no need to turn the stream off
explicitly beforehand.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-25 08:40:37 -02:00
Laurent Pinchart a11a03e50b [media] uvcvideo: Implement vb2 queue start and stop stream operations
To work propertly the videobuf2 core code needs to be in charge of
stream start/stop control. Implement the start_streaming and
stop_streaming vb2 operations and move video enable/disable code to
them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-25 08:40:08 -02:00
Laurent Pinchart bc75d5a009 [media] uvcvideo: Add function to convert from queue to stream
Factorize the container_of() call into an inline function and update
callers.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-25 08:39:34 -02:00
Laurent Pinchart b83bba24a2 [media] uvcvideo: Separate video and queue enable/disable operations
In order to make use of the vb2 queue start/stop_streaming operations
the video and queue enable/disable operations need to be split, as the
vb2 queue will need to enable and disable video instead of the other way
around.

Also move buffer queue disable outside of uvc_video_resume() to remove
all queue disable operations out of uvc_video.c.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-25 08:39:14 -02:00
Laurent Pinchart aa3d17df64 [media] uvcvideo: Set buffer field to V4L2_FIELD_NONE
The driver doesn't support interlaced video, set field to
V4L2_FIELD_NONE for all vb2 buffers.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-25 08:38:43 -02:00
Laurent Pinchart d5e90b7a6c [media] uvcvideo: Move to video_ioctl2
Simplify ioctl handling by using video_ioctl2.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-25 08:35:02 -02:00
Takashi Iwai 2228d80dd0 [media] uvcvideo: Fix destruction order in uvc_delete()
We've got a bug report at disconnecting a Webcam, where the kernel
spews warnings like below:
  WARNING: CPU: 0 PID: 8385 at ../fs/sysfs/group.c:219 sysfs_remove_group+0x87/0x90()
  sysfs group c0b2350c not found for kobject 'event3'
  CPU: 0 PID: 8385 Comm: queue2:src Not tainted 3.16.2-1.gdcee397-default #1
  Hardware name: ASUSTeK Computer INC. A7N8X-E/A7N8X-E, BIOS ASUS A7N8X-E Deluxe ACPI BIOS Rev 1013  11/12/2004
    c08d0705 ddc75cbc c0718c5b ddc75ccc c024b654 c08c6d44 ddc75ce8 000020c1
    c08d0705 000000db c03d1ec7 c03d1ec7 00000009 00000000 c0b2350c d62c9064
    ddc75cd4 c024b6a3 00000009 ddc75ccc c08c6d44 ddc75ce8 ddc75cfc c03d1ec7
  Call Trace:
    [<c0205ba6>] try_stack_unwind+0x156/0x170
    [<c02046f3>] dump_trace+0x53/0x180
    [<c0205c06>] show_trace_log_lvl+0x46/0x50
    [<c0204871>] show_stack_log_lvl+0x51/0xe0
    [<c0205c67>] show_stack+0x27/0x50
    [<c0718c5b>] dump_stack+0x3e/0x4e
    [<c024b654>] warn_slowpath_common+0x84/0xa0
    [<c024b6a3>] warn_slowpath_fmt+0x33/0x40
    [<c03d1ec7>] sysfs_remove_group+0x87/0x90
    [<c05a2c54>] device_del+0x34/0x180
    [<c05e3989>] evdev_disconnect+0x19/0x50
    [<c05e06fa>] __input_unregister_device+0x9a/0x140
    [<c05e0845>] input_unregister_device+0x45/0x80
    [<f854b1d6>] uvc_delete+0x26/0x110 [uvcvideo]
    [<f84d66f8>] v4l2_device_release+0x98/0xc0 [videodev]
    [<c05a25bb>] device_release+0x2b/0x90
    [<c04ad8bf>] kobject_cleanup+0x6f/0x1a0
    [<f84d5453>] v4l2_release+0x43/0x70 [videodev]
    [<c0372f31>] __fput+0xb1/0x1b0
    [<c02650c1>] task_work_run+0x91/0xb0
    [<c024d845>] do_exit+0x265/0x910
    [<c024df64>] do_group_exit+0x34/0xa0
    [<c025a76f>] get_signal_to_deliver+0x17f/0x590
    [<c0201b6a>] do_signal+0x3a/0x960
    [<c02024f7>] do_notify_resume+0x67/0x90
    [<c071ebb5>] work_notifysig+0x30/0x3b
    [<b7739e60>] 0xb7739e5f
   ---[ end trace b1e56095a485b631 ]---

The cause is that uvc_status_cleanup() is called after usb_put_*() in
uvc_delete().  usb_put_*() removes the sysfs parent and eventually
removes the children recursively, so the later device_del() can't find
its sysfs.  The fix is simply rearrange the call orders in
uvc_delete() so that the child is removed before the parent.

Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=897736
Reported-and-tested-by: Martin Pluskal <mpluskal@suse.com>

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-25 08:31:51 -02:00
Philipp Zabel e1b78a3359 [media] uvcvideo: Add quirk to force the Oculus DK2 IR tracker to grayscale
This patch adds a quirk to force Y8 pixel format even if the camera reports
half-width YUYV.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-25 08:31:08 -02:00
Olli Salonen bf9025f3e0 [media] em28xx: initialize si2168_config struct
When new parameters are added for si2168 driver, the parameters have to be explicitly defined for each device if the
si2168_config struct is not initialized to all zeros.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-21 16:47:40 -02:00
Olli Salonen 251a5c4e3c [media] af9035: initialize si2168_config struct
When new parameters are added for si2168 driver, the parameters have to be explicitly defined for each device if the
si2168_config struct is not initialized to all zeros.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-21 16:47:25 -02:00
Olli Salonen dfe8e5a1bd [media] cxusb: initialize si2168_config struct
When new parameters are added for si2168 driver, the parameters have to be explicitly defined for each device if the
si2168_config struct is not initialized to all zeros.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-21 16:47:09 -02:00
Antti Palosaari f2500ff3b8 [media] rtl28xxu: add SDR module for devices having R828D tuner
Load SDR sub-driver in order to support SDR for devices having
this tuner too.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-21 16:10:01 -02:00
Antti Palosaari 4507f75013 [media] rtl28xxu: remove unused SDR attach logic
That logic was duplicated from rtl2832_sdr.h in order to avoid hard
dependency for staging directory. rtl2832_sdr is moved to media, so
we could remove that code now.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-21 16:09:31 -02:00
Antti Palosaari 473eadf32a [media] rtl28xxu: rename tuner I2C client pointer
Better to rename tuner I2C to something which clearly says it is
for tuner as there is now multiple different I2C clients used.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-21 16:09:12 -02:00
Antti Palosaari fc694e444c [media] rtl28xxu: add support for Panasonic MN88473 slave demod
There is RTL2832P devices having extra MN88473 demodulator. This
patch add support for such configuration. Logically MN88473 slave
demodulator is connected to RTL2832 master demodulator, both I2C
bus and TS input. RTL2832 is integrated to RTL2832U and RTL2832P
chips. Chip version RTL2832P has extra TS interface for connecting
slave demodulator.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-21 16:08:47 -02:00
Antti Palosaari 80f189a1d0 [media] rtl28xxu: add support for Panasonic MN88472 slave demod
There is RTL2832P devices having extra MN88472 demodulator. This
patch add support for such configuration. Logically MN88472 slave
demodulator is connected to RTL2832 master demodulator, both I2C
bus and TS input. RTL2832 is integrated to RTL2832U and RTL2832P
chips. Chip version RTL2832P has extra TS interface for connecting
slave demodulator.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-21 16:05:10 -02:00
sensoray-dev 1f391217ad [media] s2255drv: fix payload size for JPG, MJPEG
length is the size of the buffer, not the payload. That's set using
vb2_set_plane_payload().

Signed-off-by: Dean Anderson <linux-dev@sensoray.com>
Cc: <stable@vger.kernel.org>      # for v3.15 and up
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-21 15:46:25 -02:00
Wilson Michaels 9aa785b150 [media] add "lgdt330x" device name i2c_devs array
This patch adds "lgdt330x" device name i2c_devs array used for debugging

Signed-off-by: Wilson Michaels <thebitpit@earthlink.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-14 18:26:49 -02:00
Boris BREZILLON 18cb5ec38f [media] usb: Make use of media_bus_format enum
In order to have subsytem agnostic media bus format definitions we've
moved media bus definition to include/uapi/linux/media-bus-format.h and
prefixed enum values with MEDIA_BUS_FMT instead of V4L2_MBUS_FMT.

Reference new definitions in all usb drivers.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-14 17:54:28 -02:00
Antti Palosaari 698f6260b8 [media] rtl28xxu: enable demod ADC only when needed
Enable integrated demod ADC only when demod is used. Keep integrated
demod ADC disabled when external demod is used. This fixes corrupted
stream in a case external demod was used.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-14 17:35:47 -02:00
nibble.max dd0a6fe2bc [media] dvb-usb-dvbsky: fix i2c adapter for sp2 device
It is wrong that sp2 device uses the i2c adapter from m88ds3103 return.
sp2 device sits on the same i2c bus with m88ds3103, not behind m88ds3103.

Signed-off-by: Nibble Max <nibble.max@gmail.com>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-11 12:55:32 -02:00
sensoray-dev 9694fbec95 [media] s2255drv: fix spinlock issue
qlock spinlock controls access to buf_list and sequence.
qlock spinlock should not be locked during a copy to video buffers, an
operation that may sleep.

Signed-off-by: Dean Anderson <linux-dev@sensoray.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-11 08:47:22 -02:00
Hans Verkuil d674a6547c [media] cxusb: fix sparse warnings
cxusb.c:1443:32: warning: restricted __le16 degrades to integer
cxusb.c:1487:32: warning: restricted __le16 degrades to integer

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-05 09:08:59 -02:00
Hans Verkuil 4580278f5d [media] stk1160: fix sparse warning
stk1160-v4l.c:478:49: warning: incorrect type in argument 3 (different base types)

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-05 09:08:38 -02:00
Mauro Carvalho Chehab 7e16e3fe1b [media] cx231xx: Remove a bogus check for NULL
As reported by kbuild test robot:
	drivers/media/usb/cx231xx/cx231xx-audio.c:445:16-20: ERROR: dev is NULL but dereferenced.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 18:56:48 -02:00
Mauro Carvalho Chehab 336fea9229 [media] cx231xx: Improve the log message
Unfortunately, on devices that have multiple interfaces, udev->dev
points to the parent device (usb) instead of the cx231xx specific one.

Due to that the logs don't look too nice, as they'll print messages
as if they were produced by USB core:
  usb-1-2: New device Conexant Corporation Polaris AV Capturb @ 480 Mbps (1554:5010) with 7 interfaces

Instead of using the name of the parent device, let's use the name
of the first cx231xx interface for all cx231xx sub-modules.

With this path, the logs will be nicer:

  cx231xx 1-2:1.1: New device Conexant Corporation Polaris AV Capturb @ 480 Mbps (1554:5010) with 7 interfaces

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 15:59:59 -02:00
Mauro Carvalho Chehab ac550faabd [media] cx231xx: simplify I2C scan debug messages
Don't need to show when it starts or stops. Just print lines
when devices are found.

After the changes, the output for i2c scan will be like:

	usb 1-2: i2c scan: found device @ port 0 addr 0x40  [???]
	usb 1-2: i2c scan: found device @ port 0 addr 0x60  [colibri]
	usb 1-2: i2c scan: found device @ port 0 addr 0x88  [hammerhead]
	usb 1-2: i2c scan: found device @ port 0 addr 0x98  [???]
	usb 1-2: i2c scan: found device @ port 3 addr 0xa0  [eeprom]
	usb 1-2: i2c scan: found device @ port 2 addr 0x60  [colibri]
	usb 1-2: i2c scan: found device @ port 2 addr 0xc0  [tuner]
	usb 1-2: i2c scan: found device @ port 4 addr 0x20  [demod]

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 15:59:35 -02:00
Mauro Carvalho Chehab 3d28cf3ee6 [media] cx231xx: too much changes. Bump version number
The I2C mux changes are significant. Bump version number.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 15:59:17 -02:00
Mauro Carvalho Chehab fb1817e48f [media] cx231xx: use dev_info() for extension load/unload
Now that we're using dev_foo, the logs become like:

	usb 1-2: DVB: registering adapter 0 frontend 0 (Fujitsu mb86A20s)...
	usb 1-2: Successfully loaded cx231xx-dvb
	cx231xx: Cx231xx dvb Extension initialized

It is not clear, by the logs, that usb 1-2 name is an alias for
cx231xx. So, we also need to use dvb_info() at extension load/unload.

After the patch, it will print:
	usb 1-2: Cx231xx dvb Extension initialized

With is coherent with the other logs.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 15:59:03 -02:00
Mauro Carvalho Chehab ec2a387eaf [media] cx231xx: add addr for demod and make i2c_devs const
I2C address 0x10 is the demod. While here, make the array const.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 15:58:45 -02:00
Mauro Carvalho Chehab 3b795d01c2 [media] cx231xx: use dev_foo instead of printk
There are several places at cx231xx that uses printk without
any special reason. Change all of them to use dev_foo().

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 15:58:30 -02:00
Mauro Carvalho Chehab 56d8a3b068 [media] cx231xx: get rid of audio debug parameter
There's just one debug level on cx231xx-audio. So, converting it
to dev_dbg() is easy.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 15:58:09 -02:00
Mauro Carvalho Chehab b7085c0864 [media] cx231xx: convert from pr_foo to dev_foo
Replace all pr_foo occurrences by dev_foo, as this is
the recommended way for drivers.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 15:57:54 -02:00
Mauro Carvalho Chehab 77e97ba2da [media] cx231xx: disable I2C errors during i2c_scan
Otherwise, it would produce lots of useless messages like:
	cx231xx: cx231xx_send_usb_command: failed with status --32

After this patch, I2C scan will produce an useful report:

[ 9494.050807] cx231xx: i2c_scan: checking for I2C devices on port=0 ..
[ 9494.074928] cx231xx: i2c scan: Completed Checking for I2C devices on port=0.
[ 9494.074936] cx231xx: i2c_scan: checking for I2C devices on port=3 ..
[ 9494.098934] cx231xx: i2c scan: Completed Checking for I2C devices on port=3.
[ 9494.098942] cx231xx: i2c_scan: checking for I2C devices on port=2 ..
[ 9494.118440] cx231xx: i2c scan: Completed Checking for I2C devices on port=2.
[ 9494.118448] cx231xx: i2c_scan: checking for I2C devices on port=4 ..
[ 9494.141889] cx231xx: i2c scan: Completed Checking for I2C devices on port=4.

[ 9494.060182] cx231xx: i2c scan: found device @ 0x40  [???]
[ 9494.062953] cx231xx: i2c scan: found device @ 0x60  [colibri]
[ 9494.066071] cx231xx: i2c scan: found device @ 0x88  [hammerhead]
[ 9494.067383] cx231xx: i2c scan: found device @ 0x98  [???]
[ 9494.090113] cx231xx: i2c scan: found device @ 0xa0  [eeprom]
[ 9494.106463] cx231xx: i2c scan: found device @ 0x60  [colibri]
[ 9494.113762] cx231xx: i2c scan: found device @ 0xc0  [tuner]
[ 9494.121882] cx231xx: i2c scan: found device @ 0x20  [???]
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 15:57:28 -02:00
Matthias Schwarzott 0d88d0916b [media] cx231xx: use 1 byte read for i2c scan
Now cx231xx_i2c_check_for_device works like i2c_check_for_device of em28xx driver.

For me this fixes scanning of all ports but port 2.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 15:57:08 -02:00
Mauro Carvalho Chehab ed0e3729c9 [media] cx231xx: Cleanup printk at the driver
There are lots of debug printks printed with pr_info. Also, the
printk's data are not too coherent:

- there are duplicated driver name at the print format;
- function name format string differs from function to function;
- long strings broken into multiple lines;
- some printks just produce ugly reports, being almost useless
  as-is.

Do a cleanup on that.

Still, there are much to be done in order to do a better printk
job on this driver, but, at least it will now be a way less
verbose, if debug printks are disabled, and some logs might
actually be useful.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 15:56:22 -02:00
Mauro Carvalho Chehab 88538bb544 [media] cx231xx: Fix identation
One of the identation blocks is wrong. Fix it.

While here, replace pr_info by pr_debug inside such block and
add the function name to the print messages, as otherwise they
will not help much.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 15:56:03 -02:00
Mauro Carvalho Chehab 589dadf299 [media] cx231xx: get rid of driver-defined printk macros
It currently does just like what pr_foo() macros do. So,
replace them.

A deeper cleanup is needed, as there are lots of debug macros
printed with pr_info.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 15:55:23 -02:00
Olli Salonen e5f3d00c24 [media] cxusb: TS mode setting for TT CT2-4400
There is a new version of the TechnoTrend CT2-4400 USB tuner. The difference is the demodulator that is used (Si2168-B40 instead of -A30).

For TT CT2-4400v2 a TS stream related parameter needs to be set, otherwise the stream becomes corrupted. The Windows driver for both CT2-4400 and CT2-4400v2 sets this as well. After this patch the driver works for both versions.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 12:26:56 -02:00
Richard Vollkommer 52e269b133 [media] xc5000: add IF output level control
Adds control of the IF output level to the xc5000 tuner
configuration structure.  Increases the IF level to the
demodulator to fix failure to lock and picture breakup
issues (with the au8522 demodulator, in the case of the
Hauppauge HVR950Q).

This patch works with all XC5000 firmware versions.

Signed-off-by: Richard Vollkommer <linux@hauppauge.com>
Signed-off-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Reviewed-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 12:24:52 -02:00
nibble.max 24d333f387 [media] dvb-usb-dvbsky: add s960ci dvb-s/s2 usb ci box support
DVBSky s960ci dvb-s/s2 usb ci box:
1>dvb frontend: M88TS2022(tuner),M88DS3103(demod)
2>usb controller: CY7C86013A
3>ci controller: CIMAX SP2 or its clone.

Signed-off-by: Nibble Max <nibble.max@gmail.com>
Reviewed-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 11:37:36 -02:00
Witold Krecicki eace972103 [media] em28xx: add support for Leadtek VC100 USB capture device
Leadtek VC100 is a simple USB capture stick, similar to
Yakumo Movie Mixer.

Signed-off-by: Witold Krecicki <wpk+lkml@culm.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 11:33:36 -02:00
Olli Salonen 69e7b6503e [media] dvbsky: add option to disable IR receiver
Add an option to disable remote controller for DVBSky devices by specifying
the disable_rc option at modprobe.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 11:06:43 -02:00
Olli Salonen 40bba097ef [media] dvbsky: clean logging
dev_err includes the function name in the log printout, so there is no need to include it manually. While here, fix a small grammatical error in the i2c error message.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 11:05:52 -02:00
Olli Salonen 49141aa249 [media] dvbsky: don't print MAC address from read_mac_address
The dvb-usb-v2 already prints out the MAC address, no need to print
it out also here.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 11:02:42 -02:00
Matthias Schwarzott 082417d10f [media] cx231xx: remove direct register PWR_CTL_EN modification that switches port3
The only remaining place that modifies the relevant bit is in function
cx231xx_set_Colibri_For_LowIF

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-01 08:59:06 -02:00
Matthias Schwarzott e4de03f263 [media] cx231xx: scan all four existing i2c busses instead of the 3 masters
The scanning itself just fails (as before this series) but now
the correct busses are scanned.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-10-30 17:42:17 -02:00
Matthias Schwarzott 660acd54d1 [media] cx231xx: drop unconditional port3 switching
All switching should be done by i2c mux adapters.
Drop explicit dont_use_port_3 flag.
Drop info message about switch.

Only the removed code in start_streaming is questionable:
It did switch the port_3 flag without accessing i2c in between.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-10-30 17:42:11 -02:00
Matthias Schwarzott 15c212dd0f [media] cx231xx: register i2c mux adapters for bus 1
I2C bus 1 has internally a switch. Use it as I2C_1_MUX_1 and
I2C_1_MUX_3, letting the I2C core handling the switch.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-10-30 17:38:43 -02:00
Matthias Schwarzott b9ce9dfd18 [media] cx231xx: change usage of I2C_1 to the real i2c port
change almost all instances of I2C_1 to I2C_1_MUX_3

Only these cases are changed to I2C_1_MUX_1:
* All that have dont_use_port_3 set.
* CX231XX_BOARD_HAUPPAUGE_EXETER, old code did explicitly not switch to port3.
* eeprom access for 930C

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-10-30 17:38:42 -02:00
Matthias Schwarzott 8a0253481c [media] cx231xx: let is_tuner check the real i2c port and not the i2c master number
Get used i2c port from bus_nr and status of port_3 switch.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-10-30 17:38:36 -02:00
Matthias Schwarzott a1f267651f [media] cx231xx: remember status of i2c port_3 switch
This is used later for is_tuner function that switches i2c behaviour for
some tuners.

[mchehab@osg.samsung.com: Fix CodingStyle on a multi-line comment]

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-10-30 17:21:46 -02:00
Matthias Schwarzott c3c3f1ae8b [media] cx231xx: add wrapper to get the i2c_adapter pointer
This is a preparation for mapping I2C_1_MUX_1 and I2C_1_MUX_3 later to the seperate
muxed i2c adapters.

Map mux adapters to I2C_1 for now.

Add local variables for i2c_adapters in dvb_init to get line lengths
shorter.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-10-30 17:18:22 -02:00
Matthias Schwarzott d032ca1283 [media] cx231xx: Use symbolic constants for i2c ports instead of numbers
Replace numbers by the constants of same value and same meaning.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-10-30 17:16:41 -02:00
Matthias Schwarzott 9abe3b89f3 [media] cx231xx: Modifiy the symbolic constants for i2c ports and describe
Change to I2C_0 ... I2C_2 for the master ports
and add I2C_1_MUX_1 and I2C_1_MUX_3 for the muxed ones.

V2: Renamed mux adapters to seperate them from master adapters.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-10-30 17:15:43 -02:00
Matthias Schwarzott 8da4f2d58d [media] cx231xx: give each master i2c bus a seperate name
Instead of using the same name for all 3 i2c physical buses
inside cx231xx, name them differently, adding a number
to it. This helps to better deal with the logs.

[mchehab@osg.samsung.com: removed an unused bus_name var from
 the original patch]
Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-10-30 17:12:21 -02:00
Matthias Schwarzott 23b0e41b47 [media] cx231xx: delete i2c_client per bus
For each i2c master there is a i2c_client allocated that could be
deleted now that its only two users have been changed to use their
own i2c_client.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-10-30 17:10:19 -02:00
Matthias Schwarzott 9c67289061 [media] cx231xx: use own i2c_client for eeprom access
This is a preparation for deleting the otherwise useless i2c_clients
that are allocated for all the i2c master adapters.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-10-30 17:10:13 -02:00
Matthias Schwarzott 7c894a3b34 [media] cx231xx: let i2c bus scanning use its own i2c_client
This is a preparation for deleting the otherwise useless i2c_clients
that are allocated for all the i2c master adapters.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-10-30 17:10:07 -02:00
Frank Schaefer 2279948735 [media] af9005: fix kernel panic on init if compiled without IR
This patches fixes an ancient bug in the dvb_usb_af9005 driver, which
has been reported at least in the following threads:
https://lkml.org/lkml/2009/2/4/350
https://lkml.org/lkml/2014/9/18/558

If the driver is compiled in without any IR support (neither
DVB_USB_AF9005_REMOTE nor custom symbols), the symbol_request calls in
af9005_usb_module_init() return pointers != NULL although the IR
symbols are not available.

This leads to the following oops:
...
[    8.529751] usbcore: registered new interface driver dvb_usb_af9005
[    8.531584] BUG: unable to handle kernel paging request at 02e00000
[    8.533385] IP: [<7d9d67c6>] af9005_usb_module_init+0x6b/0x9d
[    8.535613] *pde = 00000000
[    8.536416] Oops: 0000 [#1] PREEMPT PREEMPT DEBUG_PAGEALLOCDEBUG_PAGEALLOC
[    8.537863] CPU: 0 PID: 1 Comm: swapper Not tainted 3.15.0-rc6-00151-ga5c075c #1
[    8.539827] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140531_083030-gandalf 04/01/2014
[    8.541519] task: 89c9a670 ti: 89c9c000 task.ti: 89c9c000
[    8.541519] EIP: 0060:[<7d9d67c6>] EFLAGS: 00010206 CPU: 0
[    8.541519] EIP is at af9005_usb_module_init+0x6b/0x9d
[    8.541519] EAX: 02e00000 EBX: 00000000 ECX: 00000006 EDX: 00000000
[    8.541519] ESI: 00000000 EDI: 7da33ec8 EBP: 89c9df30 ESP: 89c9df2c
[    8.541519]  DS: 007b ES: 007b FS: 0000 GS: 00e0 SS: 0068
[    8.541519] CR0: 8005003b CR2: 02e00000 CR3: 05a54000 CR4: 00000690
[    8.541519] Stack:
[    8.541519]  7d9d675b 89c9df90 7d992a49 7d7d5914 89c9df4c 7be3a800 7d08c58c 8a4c3968
[    8.541519]  89c9df80 7be3a966 00000192 00000006 00000006 7d7d3ff4 8a4c397a 00000200
[    8.541519]  7d6b1280 8a4c3979 00000006 000009a6 7da32db8 b13eec81 00000006 000009a6
[    8.541519] Call Trace:
[    8.541519]  [<7d9d675b>] ? ttusb2_driver_init+0x16/0x16
[    8.541519]  [<7d992a49>] do_one_initcall+0x77/0x106
[    8.541519]  [<7be3a800>] ? parameqn+0x2/0x35
[    8.541519]  [<7be3a966>] ? parse_args+0x113/0x25c
[    8.541519]  [<7d992bc2>] kernel_init_freeable+0xea/0x167
[    8.541519]  [<7cf01070>] kernel_init+0x8/0xb8
[    8.541519]  [<7cf27ec0>] ret_from_kernel_thread+0x20/0x30
[    8.541519]  [<7cf01068>] ? rest_init+0x10c/0x10c
[    8.541519] Code: 08 c2 c7 05 44 ed f9 7d 00 00 e0 02 c7 05 40 ed f9 7d 00 00 e0 02 c7 05 3c ed f9 7d 00 00 e0 02 75 1f b8 00 00 e0 02 85 c0 74 16 <a1> 00 00 e0 02 c7 05 54 84 8e 7d 00 00 e0 02 a3 58 84 8e 7d eb
[    8.541519] EIP: [<7d9d67c6>] af9005_usb_module_init+0x6b/0x9d SS:ESP 0068:89c9df2c
[    8.541519] CR2: 0000000002e00000
[    8.541519] ---[ end trace 768b6faf51370fc7 ]---

The prefered fix would be to convert the whole IR code to use the kernel IR
infrastructure (which wasn't available at the time this driver had been created).

Until anyone who still has this old hardware steps up an does the conversion,
fix it by not calling the symbol_request calls if the driver is compiled in
without the default IR symbols (CONFIG_DVB_USB_AF9005_REMOTE).
Due to the IR related pointers beeing NULL by default, IR support will then be disabled.

The downside of this solution is, that it will no longer be possible to
compile custom IR symbols (not using CONFIG_DVB_USB_AF9005_REMOTE) in.

Please note that this patch has NOT been tested with all possible cases.
I don't have the hardware and could only verify that it fixes the reported
bug.

Reported-by: Fengguag Wu <fengguang.wu@intel.com>
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Cc: <stable@vger.kernel.org>
Acked-by: Luca Olivetti <luca@ventoso.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-10-30 16:57:19 -02:00
Mauro Carvalho Chehab 5d1f00a20d [media] sound: simplify au0828 quirk table
Add a macro to simplify au0828 quirk table. That makes easier
to check it against the USB IDs at drivers/media/usb/au0828/au0828-cards.c.

Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-10-30 09:23:57 -02:00
Mauro Carvalho Chehab 1b07a77f6e [media] em28xx-dvb: remove unused mfe_sharing
This field is not used on this driver anymore. Remove it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-10-30 09:06:27 -02:00
Dan Carpenter 470a914789 [media] usbvision-video: two use after frees
The lock has been freed in usbvision_release() so there is no need to
call mutex_unlock() here.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-10-24 09:30:14 -02:00
Dan Carpenter 34d7c248ad [media] em28xx-input: NULL dereference on error
We call "kfree(ir->i2c_client);" in the error handling and that doesn't
work if "ir" is NULL.

Fixes: 78e719a5f3 ('[media] em28xx-input: i2c IR decoders: improve i2c_client handling')

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-10-24 09:28:12 -02:00
Dan Carpenter 9f93c52783 [media] hackrf: harmless off by one in debug code
My static checker complains that "i" could be one element beyond the end
of the array.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-10-21 08:56:52 -02:00
Laurent Pinchart c601f53f8f [media] v4l: uvcvideo: Fix buffer completion size check
Commit e93e7fd9f5 ("v4l2: uvcvideo: Allow
using larger buffers") reworked the buffer size sanity check at buffer
completion time to use the frame size instead of the allocated buffer
size. However, it introduced two bugs in doing so:

- it assigned the allocated buffer size to the frame_size field, instead
  of assigning the correct frame size

- it performed the assignment in the S_FMT handler, resulting in the
  frame_size field being uninitialized if the userspace application
  doesn't call S_FMT.

Fix both issues by removing the frame_size field and validating the
buffer size against the UVC video control dwMaxFrameSize.

Fixes: e93e7fd9f5 ("v4l2: uvcvideo: Allow using larger buffers")

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-10-21 08:53:27 -02:00
Hans Verkuil 430e35724b [media] em28xx: fix uninitialized variable warning
Fix this daily build warning:

In file included from build/media_build/v4l/em28xx-core.c:35:0:
build/media_build/v4l/em28xx-core.c: In function 'em28xx_audio_setup':
build/media_build/v4l/em28xx.h:798:2: warning: 'vid' may be used uninitialized in this function [-Wmaybe-uninitialized]
  printk(KERN_INFO "%s: "fmt,\
  ^
build/media_build/v4l/em28xx-core.c:507:6: note: 'vid' was declared here
  u32 vid;
      ^

As far as I can tell 'vid' can not really be used uninitialized here, but the code
is sufficiently complex that apparently gcc can't figure that out.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-10-21 08:51:07 -02:00
Kees Cook 7383159f41 [media] anysee: make sure loading modules is const
Make sure that loaded modules are const char strings so we don't
load arbitrary modules in the future, nor allow for format string
leaks in the module request call.

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-10-21 08:49:11 -02:00
Kees Cook a1ecf3c456 [media] af9035: make sure loading modules is const
Make sure that loaded modules are const char strings so we don't
load arbitrary modules in the future, nor allow for format string
leaks in the module request call.

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-10-21 08:48:51 -02:00
Linus Torvalds 4d9708ea5e media updates for v3.18-rc1
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJUNr9iAAoJEAhfPr2O5OEVSygP/iVpHK7JZCFSvy1ly67gUcIw
 zeO2q0Exm3WwApchaCNX0b9qB9A6jeaRiJtuqOgR7L8ksYorku7k12g0IrveK8e4
 UhwscWw1HkYvTR3JG4Z2a8LoYiUatQCgcknICgjJ12fo2fCg2SnzbGp9jKiLqJew
 dx1zOgn5Hslqy+PWQULtkLo/XxdlAX8YNUhXU5q5gxCfhciaJ7Kq+tvM9NodobHG
 u94b10fmOclLug37b+Vpg01pxjqe+X+HbrHzbOsL7dvxW84igqzpyb9+WNH8FGZZ
 +oSu66faokH8rVxzkPyODT8TSwHuqafVF1IFafsFFJpYYfRWiY0SttMACVMuuB3z
 m6kVM9pTApmh736xvzB4JP4i/+aIu2qQftYTybQkTpn1AIy2kw8b09pOWbhEgdjl
 5CfI7I2iSkSviZXMrIe51znIhdxohF7gEN8PyaPto3N1LHVnHAd7/J43nolSSnke
 DE0lQGk+NaGFv/MiESiKC8lSiEGzqpMkrxpOIeDZAsKxQ3ihxKai3kqAYYiPt2+n
 2HVhLsmfMqdd23DGSf7LjhhLqjXKhEC/+LDsLl105keRYLN/TYZuQxieJEDikRF/
 NLJcuuXUQkcsdgrAChAonu1K3roAsgZ8E6BP+814CWZ5LM4xW0kQqqKN6S88eKx2
 HcIz2xwveR6sZBNZE7Kl
 =DUbD
 -----END PGP SIGNATURE-----

Merge tag 'media/v3.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media

Pull media updates from Mauro Carvalho Chehab:

 - new IR driver: hix5hd2-ir

 - the virtual test driver (vivi) was replaced by vivid, with has an
   almost complete set of features to emulate most v4l2 devices and
   properly test all sorts of userspace apps

 - the as102 driver had several bugs fixed and was properly split into a
   frontend and a core driver.  With that, it got promoted from staging
   into mainstream

 - one new CI driver got added for CIMaX SP2/SP2HF (sp2 driver)

 - one new frontend driver for Toshiba ISDB-T/ISDB-S demod (tc90522)

 - one new PCI driver for ISDB-T/ISDB-S (pt3 driver)

 - saa7134 driver got support for go7007-based devices

 - added a new PCI driver for Techwell 68xx chipsets (tw68)

 - a new platform driver was added (coda)

 - new tuner drivers: mxl301rf and qm1d1c0042

 - a new DVB USB driver was added for DVBSky S860 & similar devices

 - added a new SDR driver (hackrf)

 - usbtv got audio support

 - several platform drivers are now compiled with COMPILE_TEST

 - a series of compiler fixup patches, making sparse/spatch happier with
   the media stuff and removing several warnings, especially on those
   platform drivers that didn't use to compile on x86

 - Support for several new modern devices got added

 - lots of other fixes, improvements and cleanups

* tag 'media/v3.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (544 commits)
  [media] ir-hix5hd2: fix build on c6x arch
  [media] pt3: fix DTV FE I2C driver load error paths
  Revert "[media] media: em28xx - remove reset_resume interface"
  [media] exynos4-is: fix some warnings when compiling on arm64
  [media] usb drivers: use %zu instead of %zd
  [media] pci drivers: use %zu instead of %zd
  [media] dvb-frontends: use %zu instead of %zd
  [media] s5p-mfc: Fix several printk warnings
  [media] s5p_mfc_opr: Fix warnings
  [media] ti-vpe: Fix typecast
  [media] s3c-camif: fix dma_addr_t printks
  [media] s5p_mfc_opr_v6: get rid of warnings when compiled with 64 bits
  [media] s5p_mfc_opr_v5: Fix lots of warnings on x86_64
  [media] em28xx: Fix identation
  [media] drxd: remove a dead code
  [media] saa7146: remove return after BUG()
  [media] cx88: remove return after BUG()
  [media] cx88: fix cards table CodingStyle
  [media] radio-sf16fmr2: declare some structs as static
  [media] radio-sf16fmi: declare pnp_attached as static
  ...
2014-10-10 22:04:49 -04:00
Mauro Carvalho Chehab a66d05d504 Merge branch 'patchwork' into v4l_for_linus
* patchwork: (544 commits)
  [media] ir-hix5hd2: fix build on c6x arch
  [media] pt3: fix DTV FE I2C driver load error paths
  Revert "[media] media: em28xx - remove reset_resume interface"
  [media] exynos4-is: fix some warnings when compiling on arm64
  [media] usb drivers: use %zu instead of %zd
  [media] pci drivers: use %zu instead of %zd
  [media] dvb-frontends: use %zu instead of %zd
  [media] s5p-mfc: Fix several printk warnings
  [media] s5p_mfc_opr: Fix warnings
  [media] ti-vpe: Fix typecast
  [media] s3c-camif: fix dma_addr_t printks
  [media] s5p_mfc_opr_v6: get rid of warnings when compiled with 64 bits
  [media] s5p_mfc_opr_v5: Fix lots of warnings on x86_64
  [media] em28xx: Fix identation
  [media] drxd: remove a dead code
  [media] saa7146: remove return after BUG()
  [media] cx88: remove return after BUG()
  [media] cx88: fix cards table CodingStyle
  [media] radio-sf16fmr2: declare some structs as static
  [media] radio-sf16fmi: declare pnp_attached as static
  ...

Conflicts:
	Documentation/DocBook/media/v4l/compat.xml
2014-10-09 14:00:54 -03:00
Linus Torvalds 28596c9722 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
Pull "trivial tree" updates from Jiri Kosina:
 "Usual pile from trivial tree everyone is so eagerly waiting for"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (39 commits)
  Remove MN10300_PROC_MN2WS0038
  mei: fix comments
  treewide: Fix typos in Kconfig
  kprobes: update jprobe_example.c for do_fork() change
  Documentation: change "&" to "and" in Documentation/applying-patches.txt
  Documentation: remove obsolete pcmcia-cs from Changes
  Documentation: update links in Changes
  Documentation: Docbook: Fix generated DocBook/kernel-api.xml
  score: Remove GENERIC_HAS_IOMAP
  gpio: fix 'CONFIG_GPIO_IRQCHIP' comments
  tty: doc: Fix grammar in serial/tty
  dma-debug: modify check_for_stack output
  treewide: fix errors in printk
  genirq: fix reference in devm_request_threaded_irq comment
  treewide: fix synchronize_rcu() in comments
  checkstack.pl: port to AArch64
  doc: queue-sysfs: minor fixes
  init/do_mounts: better syntax description
  MIPS: fix comment spelling
  powerpc/simpleboot: fix comment
  ...
2014-10-07 21:16:26 -04:00
Mauro Carvalho Chehab 90a5dbef1a Revert "[media] media: em28xx - remove reset_resume interface"
The reset_resume call is needed, otherwise it will break resume
on some conditions, depending on the usb ehci/xhci controller.

This reverts commit b89193e0b0.

Reported-by: Johannes Stezenbach <js@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-28 22:25:24 -03:00
Mauro Carvalho Chehab 214635f94d Revert "[media] media: em28xx - remove reset_resume interface"
The reset_resume call is needed, otherwise it will break resume
on some conditions, depending on the usb ehci/xhci controller.

This reverts commit b89193e0b0.

Reported-by: Johannes Stezenbach <js@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-26 06:53:15 -03:00
Mauro Carvalho Chehab 7983b773ba [media] usb drivers: use %zu instead of %zd
size_t is unsigned.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-26 06:51:00 -03:00
Mauro Carvalho Chehab 0db3241458 [media] em28xx: Fix identation
drivers/media/usb/em28xx/em28xx-audio.c:270 snd_em28xx_capture_open() warn: if statement not indented

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-26 06:47:59 -03:00
Mauro Carvalho Chehab d51a12c962 [media] as102: fix endiannes casts
Smatch complains a lot about endiannes issues on as102:

drivers/media/usb/as102/as10x_cmd_stream.c:41:47: warning: incorrect type in assignment (different base types)
drivers/media/usb/as102/as10x_cmd_stream.c:41:47:    expected unsigned short [unsigned] [usertype] proc_id
drivers/media/usb/as102/as10x_cmd_stream.c:41:47:    got restricted __le16 [usertype] <noident>
drivers/media/usb/as102/as10x_cmd_stream.c:43:43: warning: incorrect type in assignment (different base types)
drivers/media/usb/as102/as10x_cmd_stream.c:43:43:    expected unsigned short [unsigned] [usertype] pid
drivers/media/usb/as102/as10x_cmd_stream.c:43:43:    got restricted __le16 [usertype] <noident>
drivers/media/usb/as102/as10x_cmd_stream.c:98:47: warning: incorrect type in assignment (different base types)
drivers/media/usb/as102/as10x_cmd_stream.c:98:47:    expected unsigned short [unsigned] [usertype] proc_id
drivers/media/usb/as102/as10x_cmd_stream.c:98:47:    got restricted __le16 [usertype] <noident>
drivers/media/usb/as102/as10x_cmd_stream.c💯43: warning: incorrect type in assignment (different base types)
drivers/media/usb/as102/as10x_cmd_stream.c💯43:    expected unsigned short [unsigned] [usertype] pid
drivers/media/usb/as102/as10x_cmd_stream.c💯43:    got restricted __le16 [usertype] <noident>
drivers/media/usb/as102/as10x_cmd_stream.c:142:48: warning: incorrect type in assignment (different base types)
drivers/media/usb/as102/as10x_cmd_stream.c:142:48:    expected unsigned short [unsigned] [usertype] proc_id
drivers/media/usb/as102/as10x_cmd_stream.c:142:48:    got restricted __le16 [usertype] <noident>
drivers/media/usb/as102/as10x_cmd_stream.c:185:47: warning: incorrect type in assignment (different base types)
drivers/media/usb/as102/as10x_cmd_stream.c:185:47:    expected unsigned short [unsigned] [usertype] proc_id
drivers/media/usb/as102/as10x_cmd_stream.c:185:47:    got restricted __le16 [usertype] <noident>
drivers/media/usb/as102/as10x_cmd_cfg.c:46:40: warning: incorrect type in assignment (different base types)
drivers/media/usb/as102/as10x_cmd_cfg.c:46:40:    expected unsigned short [unsigned] [usertype] proc_id
drivers/media/usb/as102/as10x_cmd_cfg.c:46:40:    got restricted __le16 [usertype] <noident>
drivers/media/usb/as102/as10x_cmd_cfg.c:47:36: warning: incorrect type in assignment (different base types)
drivers/media/usb/as102/as10x_cmd_cfg.c:47:36:    expected unsigned short [unsigned] [usertype] tag
drivers/media/usb/as102/as10x_cmd_cfg.c:47:36:    got restricted __le16 [usertype] <noident>
drivers/media/usb/as102/as10x_cmd_cfg.c:48:37: warning: incorrect type in assignment (different base types)
drivers/media/usb/as102/as10x_cmd_cfg.c:48:37:    expected unsigned short [unsigned] [usertype] type
drivers/media/usb/as102/as10x_cmd_cfg.c:48:37:    got restricted __le16 [usertype] <noident>
drivers/media/usb/as102/as10x_cmd_cfg.c:72:27: warning: cast to restricted __le32
drivers/media/usb/as102/as10x_cmd_cfg.c:102:40: warning: incorrect type in assignment (different base types)
drivers/media/usb/as102/as10x_cmd_cfg.c:102:40:    expected unsigned short [unsigned] [usertype] proc_id
drivers/media/usb/as102/as10x_cmd_cfg.c:102:40:    got restricted __le16 [usertype] <noident>
drivers/media/usb/as102/as10x_cmd_cfg.c:104:50: warning: incorrect type in assignment (different base types)
drivers/media/usb/as102/as10x_cmd_cfg.c:104:50:    expected unsigned int [unsigned] [usertype] value32
drivers/media/usb/as102/as10x_cmd_cfg.c:104:50:    got restricted __le32 [usertype] <noident>
drivers/media/usb/as102/as10x_cmd_cfg.c:105:36: warning: incorrect type in assignment (different base types)
drivers/media/usb/as102/as10x_cmd_cfg.c:105:36:    expected unsigned short [unsigned] [usertype] tag
drivers/media/usb/as102/as10x_cmd_cfg.c:105:36:    got restricted __le16 [usertype] <noident>
drivers/media/usb/as102/as10x_cmd_cfg.c:106:37: warning: incorrect type in assignment (different base types)
drivers/media/usb/as102/as10x_cmd_cfg.c:106:37:    expected unsigned short [unsigned] [usertype] type
drivers/media/usb/as102/as10x_cmd_cfg.c:106:37:    got restricted __le16 [usertype] <noident>
drivers/media/usb/as102/as10x_cmd_cfg.c:156:48: warning: incorrect type in assignment (different base types)
drivers/media/usb/as102/as10x_cmd_cfg.c:156:48:    expected unsigned short [unsigned] [usertype] proc_id
drivers/media/usb/as102/as10x_cmd_cfg.c:156:48:    got restricted __le16 [usertype] <noident>
drivers/media/usb/as102/as10x_cmd_cfg.c:197:14: warning: cast to restricted __le16
drivers/media/usb/as102/as10x_cmd.c:40:40: warning: incorrect type in assignment (different base types)
drivers/media/usb/as102/as10x_cmd.c:40:40:    expected unsigned short [unsigned] [usertype] proc_id
drivers/media/usb/as102/as10x_cmd.c:40:40:    got restricted __le16 [usertype] <noident>
drivers/media/usb/as102/as10x_cmd.c:81:41: warning: incorrect type in assignment (different base types)
drivers/media/usb/as102/as10x_cmd.c:81:41:    expected unsigned short [unsigned] [usertype] proc_id
drivers/media/usb/as102/as10x_cmd.c:81:41:    got restricted __le16 [usertype] <noident>
drivers/media/usb/as102/as10x_cmd.c:123:41: warning: incorrect type in assignment (different base types)
drivers/media/usb/as102/as10x_cmd.c:123:41:    expected unsigned short [unsigned] [usertype] proc_id
drivers/media/usb/as102/as10x_cmd.c:123:41:    got restricted __le16 [usertype] <noident>
drivers/media/usb/as102/as10x_cmd.c:124:43: warning: incorrect type in assignment (different base types)
drivers/media/usb/as102/as10x_cmd.c:124:43:    expected unsigned int [unsigned] [usertype] freq
drivers/media/usb/as102/as10x_cmd.c:124:43:    got restricted __le32 [usertype] <noident>
drivers/media/usb/as102/as10x_cmd.c:178:48: warning: incorrect type in assignment (different base types)
drivers/media/usb/as102/as10x_cmd.c:178:48:    expected unsigned short [unsigned] [usertype] proc_id
drivers/media/usb/as102/as10x_cmd.c:178:48:    got restricted __le16 [usertype] <noident>
drivers/media/usb/as102/as10x_cmd.c:202:17: warning: cast to restricted __le16
drivers/media/usb/as102/as10x_cmd.c:203:24: warning: cast to restricted __le16
drivers/media/usb/as102/as10x_cmd.c:204:24: warning: cast to restricted __le16
drivers/media/usb/as102/as10x_cmd.c:230:48: warning: incorrect type in assignment (different base types)
drivers/media/usb/as102/as10x_cmd.c:230:48:    expected unsigned short [unsigned] [usertype] proc_id
drivers/media/usb/as102/as10x_cmd.c:230:48:    got restricted __le16 [usertype] <noident>
drivers/media/usb/as102/as10x_cmd.c:262:25: warning: cast to restricted __le16
drivers/media/usb/as102/as10x_cmd.c:289:48: warning: incorrect type in assignment (different base types)
drivers/media/usb/as102/as10x_cmd.c:289:48:    expected unsigned short [unsigned] [usertype] proc_id
drivers/media/usb/as102/as10x_cmd.c:289:48:    got restricted __le16 [usertype] <noident>
drivers/media/usb/as102/as10x_cmd.c:313:17: warning: cast to restricted __le32
drivers/media/usb/as102/as10x_cmd.c:315:17: warning: cast to restricted __le32
drivers/media/usb/as102/as10x_cmd.c:317:17: warning: cast to restricted __le32
drivers/media/usb/as102/as10x_cmd.c:319:17: warning: cast to restricted __le16
drivers/media/usb/as102/as10x_cmd.c:349:48: warning: incorrect type in assignment (different base types)
drivers/media/usb/as102/as10x_cmd.c:349:48:    expected unsigned short [unsigned] [usertype] proc_id
drivers/media/usb/as102/as10x_cmd.c:349:48:    got restricted __le16 [usertype] <noident>
drivers/media/usb/as102/as10x_cmd.c:387:29: warning: incorrect type in assignment (different base types)
drivers/media/usb/as102/as10x_cmd.c:387:29:    expected unsigned short [unsigned] [usertype] req_id
drivers/media/usb/as102/as10x_cmd.c:387:29:    got restricted __le16 [usertype] <noident>
drivers/media/usb/as102/as10x_cmd.c:388:27: warning: incorrect type in assignment (different base types)
drivers/media/usb/as102/as10x_cmd.c:388:27:    expected unsigned short [unsigned] [usertype] prog
drivers/media/usb/as102/as10x_cmd.c:388:27:    got restricted __le16 [usertype] <noident>
drivers/media/usb/as102/as10x_cmd.c:389:30: warning: incorrect type in assignment (different base types)
drivers/media/usb/as102/as10x_cmd.c:389:30:    expected unsigned short [unsigned] [usertype] version
drivers/media/usb/as102/as10x_cmd.c:389:30:    got restricted __le16 [usertype] <noident>
drivers/media/usb/as102/as10x_cmd.c:390:31: warning: incorrect type in assignment (different base types)
drivers/media/usb/as102/as10x_cmd.c:390:31:    expected unsigned short [unsigned] [usertype] data_len
drivers/media/usb/as102/as10x_cmd.c:390:31:    got restricted __le16 [usertype] <noident>
drivers/media/usb/as102/as10x_cmd.c:408:14: warning: cast to restricted __le16

This happens because of the command endiannes that are sent/received to
the firmware. So, add the correct endiannes tags to the command fields.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-26 06:47:52 -03:00
Mauro Carvalho Chehab 289297b9a3 [media] as102_drv.h: added a missing newline
drivers/media/usb/as102/as102_drv.h:83:6: warning: no newline at end of file

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-26 06:47:51 -03:00
Olli Salonen 5b5560842a [media] af9035: Add support for IT930x USB bridge
Add support for IT930x USB bridge and IT9303 reference design.

It is a DVB-T/T2/C tuner with the following components:
- IT9303 USB bridge
- Si2168-B40 demodulator
- Si2147-A30 tuner

The IT9303 requires firmware that can be downloaded here:
http://trsqr.net/olli/linux/firmwares/it930x/

The Si2168-B40 requires firmware, but the one that is used by PCTV 292e can be used.
http://palosaari.fi/linux/v4l-dvb/firmware/Si2168/Si2168-B40/

The Si2147-A30 tuner does not require firmware loading.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 21:49:42 -03:00
Olli Salonen 5dcf5bf6d9 [media] af9035: Add possibility to define which I2C adapter to use
Some I2C tuner drivers require that the I2C device of the tuner is added
to the I2C adapter of the demodulator (Si2168+Si2157 for example). Add
possibility to tell af9035_add_i2c_dev which I2C adapter should be used.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 21:47:28 -03:00
nibble.max af64fb3fa4 [media] dvbsky: new driver to support DVBSky S860/S960 devices
Support for DVBSky dvb-s2 usb: add dvb-usb-v2 driver for DVBSky dvb-s2
box, no ci support yet.

Signed-off-by: Nibble Max <nibble.max@gmail.com>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:50 -03:00
Dan Carpenter 271430efb2 [media] as102: remove some unneeded checks
We know "ret" is zero so we don't need to test for it.  It upsets the
static checkers when we test stuff but we know the answer.

drivers/media/usb/as102/as102_usb_drv.c:164 as102_send_ep1() warn: we tested 'ret' before and it was 'false'
drivers/media/usb/as102/as102_usb_drv.c:189 as102_read_ep2() warn: we tested 'ret' before and it was 'false'

Also, we don't need to initialize "ret".

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:44 -03:00
Amber Thrall 146af9cb80 [media] Media: USB: usbtv: Fixed all coding style issues in usbtv source files
Fixed various coding styles, ignoring coding style error on line 5 for all files containing a link that is longer than 80 characters long.

Signed-off-by: Amber Thrall <amber.rose.thrall@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:44 -03:00
Frank Schaefer 43c3ea312c [media] em28xx: remove dead code line from em28xx_audio_setup()
Setting the value of the chip config register to EM28XX_CHIPCFG_AC97 in
case of a read error is a leftover from the past which is no longer
needed.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:42 -03:00
Frank Schaefer 920f1e4a52 [media] em28xx: get rid of field has_audio in struct em28xx_audio_mode
Field has_audio in struct em28xx_audio_mode is used together with value
EM28XX_NO_AC97 of field ac97 to determine the internal type of audio
(none/i2s/ac97). This makes the code difficult to understand:

  !audio_mode.has_audio && audio_mode.ac97 == EM28XX_NO_AC97 => no audio
  !audio_mode.has_audio && audio_mode.ac97 != EM28XX_NO_AC97 => BUG
  audio_mode.has_audio  && audio_mode.ac97 == EM28XX_NO_AC97 => AC97 audio
  audio_mode.has_audio  && audio_mode.ac97 != EM28XX_NO_AC97 => I2S audio

Simplify the whole thing by introducing an enum em28xx_int_audio_type
which describes the internal audio type (none, ac97, i2s) and is hooked
directly to the device struct. Then get rid of field has_audio in struct
em28xx_audio_mode.

A follow-up patch will then remove struct em28xx_ac97_mode and finally
the whole struct em28xx_audio_mode.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:42 -03:00
Frank Schaefer c5874208ff [media] em28xx: simplify usb audio class handling
As far as we know devices can either have audio class or vendor class
usb interfaces but not both at the same time. Even if both interface
types could be provided by devices at the same time, the current code is
totally broken for that case.

So clean up and simplify the usb audio class handling by replacing
fields "has_audio_class" (device has usb audio class compliant
interface) and "has_alsa_audio" (device has vendor audio interface) in
struct em28xx with a single enum em28xx_usb_audio_type.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:41 -03:00
Frank Schaefer 60a24ba03c [media] em28xx: remove some unnecessary fields from struct em28xx_audio_mode
Fields "ac97_feat", "ac97_vendor_id" and "i2s_samplerates" of struct
em28xx_audio_mode are used nowhere, except in function
em28xx_audio_setup(). So get rid of them and use local variables
instead.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:41 -03:00
Dan Carpenter f2e323ec96 [media] ttusb-dec: buffer overflow in ioctl
We need to add a limit check here so we don't overflow the buffer.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:37 -03:00
Andy Shevchenko 9380e112f7 [media] hdpvr: reduce memory footprint when debugging
There is no need to use hex_dump_to_buffer() since we have a kernel helper to
dump up to 64 bytes just via printk().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:36 -03:00
Frank Schaefer fb91bde9d3 [media] em28xx: check if a device has audio earlier"
GIT_AUTHOR_DATE=1409603039
This reverts

commit b99f0aadd3
Author: Mauro Carvalho Chehab <m.chehab@samsung.com>

    [media] em28xx: check if a device has audio earlier

    Better to split chipset detection from the audio setup. So, move the
    detection code to em28xx_init_dev().

It broke analog audio of the Hauppauge winTV HVR 900 and very likely many other
em28xx devices.

Background:
The local variable has_audio in em28xx_usb_probe() describes if the currently
probed _usb_interface_ has an audio endpoint, while dev->audio_mode.has_audio
means that the _device_ as a whole provides analog audio.
Hence it is wrong to set dev->audio_mode.has_audio = has_audio in em28xx_usb_probe().
As result, audio support is no longer detected and configured on devices which
have the audio endpoint on a separate interface, because em28xx_audio_setup()
bails out immediately at the beginning.

Revert the faulty commit to restore the old audio detection procedure, which checks
the chip configuration register to determine if the device has analog audio.

Cc: <stable@vger.kernel.org>	# 3.14 to 3.16
Reported-by: Oravecz Csaba <oravecz@nytud.mta.hu>
Tested-by: Oravecz Csaba <oravecz@nytud.mta.hu>
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:35 -03:00
Matthias Schwarzott 8618ac4d01 [media] cx231xx: Add support for Hauppauge WinTV-HVR-901H (1114xx)
Add support for:
	[2040:b139] Hauppauge WinTV HVR-901H (1114xx)

According to the inf file, the hardware is similar to [2040:b131] Hauppauge WinTV 930C-HD (model 1114xx)
The only difference is the demod Si2161 instead of Si2165 (but both are
supported by the si2165 driver).

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:34 -03:00
Matthias Schwarzott 57cbf3efc8 [media] cx231xx: Add support for Hauppauge WinTV-HVR-900H (111xxx)
Add support for:
	[2040:b138] Hauppauge WinTV HVR-900H (111xxx)

The hardware is similar to [2040:b130] Hauppauge WinTV 930C-HD (model 1113xx)
The only difference is the demod Si2161 instead of Si2165 (but both are
supported by the si2165 driver).

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:34 -03:00
Mauro Carvalho Chehab 09628b2c21 [media] dib0700_devices: Use c99 initializers for structures.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@decl@
identifier i1,fld;
type T;
field list[n] fs;
@@

struct i1 {
 fs
 T fld;
 ...};

@bad@
identifier decl.i1,i2;
expression e;
initializer list[decl.n] is;
@@

struct i1 i2 = { is,
+ .fld = e
- e
 ,...};
// </smpl>

Not sure why, but some tables are still using the old way,
but at least several of them got fixed.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-22 19:00:28 -03:00
Mauro Carvalho Chehab 5d40018623 [media] au0828: fill tuner type on all boards
This is used by the I2C code in order to slow down the
speed to 20 kHz on devices with xc5000 or xc5000c.

So, it needs to be filled for all devices that use either
xc5000 or xc5000c.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-22 17:51:24 -03:00
Mauro Carvalho Chehab b13b47e0b5 [media] au0828: explicitly identify boards with analog TV
Right now, the au0828 driver uses .tuner to detect if analog
tv is being used or not. By not filling .tuner fields at the
board struct, the I2C core can't do decisions based on it.

So, add a field to explicitly tell when analog TV is supported.

No functional changes.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-22 17:51:19 -03:00
Mauro Carvalho Chehab 1ba3f927ad [media] au0828-cards: remove a comment about i2c clock stretching
This comment is already at the au0828-i2c where it belongs.
So, remove it from a board's entry. It doesn't make any sense
there, as we're setting the clock to 250kHz there, slowing it
down only at the au0828-i2c.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-22 17:48:01 -03:00
Frank Schaefer 78e719a5f3 [media] em28xx-input: i2c IR decoders: improve i2c_client handling
Instead of using a temporary stack allocated i2c_client in em28xx_i2c_ir_handle_key(),
allocate/free the i2c_client at module init/uninit and hook it into struct em28xx_IR
(if the device has an i2c IR decoder).
This reduces the frame size of function em28xx_i2c_ir_handle_key() and speeds
it up a bit.
Also make sure that all fields of struct i2c_client are initialized properly.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-22 17:29:06 -03:00
Frank Schaefer 8e2c8717c1 [media] em28xx-v4l: get rid of field "users" in struct em28xx_v4l2"
This reverts commit 747dba7de2.

It breaks concurrent vbi and video capturing:
While v4l2->users is the number of users of the whole device (all device nodes),
v4l2_fh_is_singular() only checks the number of users of a specific device node.
As a result. if one device node is open and a second device node is opened
(closed), the device is reinitialized (streaming is stopped).

Reported-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 21:27:57 -03:00
Mauro Carvalho Chehab c7854c2c5d [media] em28xx: fix VBI handling logic
When both VBI and video are streaming, and video stream is stopped,
a subsequent trial to restart it will fail, because S_FMT will
return -EBUSY.

That prevents applications like zvbi to work properly.

Please notice that, while this fix it fully for zvbi, the
best is to get rid of streaming_users and res_get logic as a hole.

However, this single-line patch is better to be merged at -stable.

Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 21:07:29 -03:00
Mauro Carvalho Chehab eb500df22c [media] em28xx: Get rid of some unused modprobe parameters at vbi code
There are two modprobe parameters for VBI that aren't used
anywhere (one for debug, the other one related to the buffer
size). Get rid of them!

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 21:06:44 -03:00
Morgan Phillips e0aa2b28d4 [media] sn9c20x: fix checkpatch warning: sizeof cmatrix should be sizeof(cmatrix)
Signed-off-by: Morgan Phillips <winter2718@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 20:59:57 -03:00
Morgan Phillips 312487ccfd [media] sn9c20x.c: fix checkpatch error: that open brace { should be on the previous line
Signed-off-by: Morgan Phillips <winter2718@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 20:59:35 -03:00
Guennadi Liakhovetski e93e7fd9f5 [media] v4l2: uvcvideo: Allow using larger buffers
A test in uvc_video_decode_isoc() checks whether an image has been
received from the camera completely. For this the data amount is compared
to the buffer length, which, however, doesn't have to be equal to the
image size. Switch to using formats .sizeimage field for an exact
expected image size.

[Renamed image_size to frame_size]

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 20:37:55 -03:00
Mauro Carvalho Chehab 720b055d4b [media] hackrf: Fix a long constant
drivers/media/usb/hackrf/hackrf.c:64:3: warning: this decimal constant is unsigned only in ISO C90 [enabled by default]
   .rangehigh  = 4294967294, /* max u32, hw goes over 7GHz */
   ^

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 20:35:47 -03:00
Antti Palosaari 969ec1f6bd [media] hackrf: HackRF SDR driver
V4L2 driver for HackRF SDR. Very basic version, with reduced
feature set. Driver implements receiver only, hardware supports
also transmitter.

USB ID 1d50:6089. Model HackRF One

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 20:32:37 -03:00
Paul Fertser 62ea864f84 [media] media: usb: uvc: add a quirk for Dell XPS M1330 webcam
As reported on [1], this device needs this quirk to be able to
reliably initialise the webcam.

[1] http://ubuntuforums.org/showthread.php?t=2145996

Cc: stable@vger.kernel.org
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 20:26:25 -03:00
William Manley 17e1319fd0 [media] uvcvideo: Work around buggy Logitech C920 firmware
The uvcvideo webcam driver exposes the v4l2 control "Exposure (Absolute)"
which allows the user to control the exposure time of the webcam,
essentially controlling the brightness of the received image.  By default
the webcam automatically adjusts the exposure time automatically but the
if you set the control "Exposure, Auto"="Manual Mode" the user can fix
the exposure time.

Unfortunately it seems that the Logitech C920 has a firmware bug where
it will forget that it's in manual mode temporarily during initialisation.
This means that the camera doesn't respect the exposure time that the user
requested if they request it before starting to stream video.  They end up
with a video stream which is either too bright or too dark and must reset
the controls after video starts streaming.

This patch introduces the quirk UVC_QUIRK_RESTORE_CTRLS_ON_INIT which
causes the cached controls to be re-uploaded to the camera immediately
after initialising the camera.  This quirk is applied to the C920 to work
around this camera bug.

Signed-off-by: William Manley <will@williammanley.net>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 20:25:54 -03:00
Vincent Palatin 3ea375239c [media] v4l: uvcvideo: Add support for pan/tilt speed controls
Map V4L2_CID_TILT_SPEED and V4L2_CID_PAN_SPEED to the standard UVC
CT_PANTILT_RELATIVE_CONTROL terminal control request.

Tested by plugging a Logitech ConferenceCam C3000e USB camera
and controlling pan/tilt from the userspace using the VIDIOC_S_CTRL ioctl.
Verified that it can pan and tilt at the same time in both directions.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Pawel Osciak <posciak@chromium.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 20:24:42 -03:00
Antti Palosaari ac7a24fb75 [media] em28xx: convert tda18212 tuner to I2C client
Used tda18212 tuner is implemented as a I2C driver. Use em28xx
tuner I2C client for tda18212 driver.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 19:59:57 -03:00
Antti Palosaari f80f2ae213 [media] anysee: convert tda18212 tuner to I2C client
Used tda18212 tuner is implemented as I2C driver. Implement I2C
client to anysee and use it for tda18212.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 19:59:13 -03:00
Antti Palosaari d4d6a34d36 [media] af9035: remove I2C client differently
It crash kernel when device was removed while it was streaming.
That is because we removed driver and frontend thread was still
running. Use new callback which allows I2C driver removal just
after frontend is unregistered.

V2: fixed by reported by Daniel

Reported-by: Daniel Glöckner <daniel-gl@gmx.net>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 19:50:11 -03:00
Antti Palosaari 1066d77f68 [media] dvb-usb-v2: add tuner_detach callback
Add tuner_detach callback in order to allow custom detach. It is
needed when tuner driver is implemented I2C client or some other
kernel bus, but not proprietary dvb_attach / dvb_detach.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 19:49:18 -03:00
Antti Palosaari ca42129f86 [media] dvb-usb-v2: add frontend_detach callback
Add frontend_detach callback in order to allow custom detach. It is
needed when demod driver is implemented I2C client or some other
kernel bus, but not proprietary dvb_attach / dvb_detach.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 19:48:30 -03:00
Antti Palosaari 5c114a4f88 [media] af9035: replace PCTV device model numbers with name
Use device names for recent PCTV Systems devices:
PCTV AndroiDTV (78e)
PCTV microStick (79e)

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 19:40:37 -03:00
Antti Palosaari a781edd16c [media] af9033: remove I2C addr from config
I2C driver address is passed as a i2c_new_device() parameter when
device is created. Thus no need to keep it in config struct.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 19:39:47 -03:00
Antti Palosaari ee36381ee8 [media] af9035: few small I2C master xfer changes
Biggest problem of that function is complexity. Try reduce complexity:

* define macros to detect all 3 supported xfers
* remove duplicate message maximum size checks

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 19:39:12 -03:00
Antti Palosaari f5b00a7670 [media] af9033: convert to I2C client
Convert driver to kernel I2C model.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 19:37:33 -03:00
Antti Palosaari 676c350f97 [media] it913x: re-implement sleep
Re-implement sleep. Based USB sniffs taken from the latest Hauppauge
windows driver version 07/10/2014, 14.6.23.32191.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 18:24:32 -03:00
Antti Palosaari 3b2a5e8c08 [media] it913x: convert to I2C driver
Change the it913x driver to use the I2C high lever tuner
binding model. As af9035 depends on it, add a code there
to do the binding.

[mchehab@osg.samsung.com: Merge 3 patches into one, because
 we don't want to break bisect due to the conversion]
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 17:48:23 -03:00
Antti Palosaari c2ba9726c3 [media] it913x: rename tuner_it913x => it913x
Remove tuner_ prefix from module name and file names. Prefix was
added due to file name conflict on media out-tree build system.
Demodulator having same name does not exists anymore. So lets
remove dumb prefix.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 17:45:00 -03:00
Antti Palosaari c10989a2a8 [media] af9035: make checkpatch.pl happy
Correct issues reported by checkpatch.pl.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 17:26:42 -03:00
Antti Palosaari b619ff7ab4 [media] af9035: remove AVerMedia eeprom override
Reverts commit 3ab2512337
[media] af9035: override tuner for AVerMedia A835B devices

Original commit itself is correct, but it was replaced by more
general solution (commit 1cbbf90d04).
This old solution was committed by a accident and is not needed
anymore.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 17:25:33 -03:00
Antti Palosaari 15ba8202e6 [media] af9035: enable AF9033 demod clock source for IT9135
Integrated RF tuner of IT9135 is connected to demod clock source
named dyn0_clk. Enable that clock source in order to provide stable
clock early enough.

Cc: Bimow Chen <Bimow.Chen@ite.com.tw>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 17:04:24 -03:00
Antti Palosaari b63ab6b064 [media] msi2500: remove unneeded spinlock irq flags initialization
There is no need to init flags before calling spin_lock_irqsave().
spin_lock_irqsave is macro which stores value to 'flags'.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 16:42:35 -03:00
Antti Palosaari 100b7931f4 [media] msi2500: logging changes
Kernel logging system needs pointer to usb interface device in
order to print names and bus numbers properly. There was wrong
device pointer given and log printings wasn't correct.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 16:42:34 -03:00
Antti Palosaari b8843c7979 [media] airspy: enhance sample rate debug calculation precision
Sample rate calculation gives a little bit too large results because
in real life there was around one milliseconds (~one usb packet) too
much data for given time. Calculate time more accurate in order to
provide better results.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 16:42:33 -03:00
Antti Palosaari 8880f2cbdb [media] airspy: remove unneeded spinlock irq flags initialization
There is no need to init flags before calling spin_lock_irqsave().
spin_lock_irqsave is a macro which stores value to 'flags'.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 16:42:33 -03:00
Antti Palosaari 617123ae38 [media] airspy: logging changes
Kernel logging system needs pointer to usb interface device in
order to print names and bus numbers properly. There was wrong
device pointer given and log printings wasn't correct.

Remove some debug logging from v4l2 ioctl functions. v4l2 core debug
prints almost same information when enabled.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 16:42:32 -03:00
Antti Palosaari 7057005db6 [media] airspy: coding style issues
Fix issues reported by checkpatch.pl.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 16:42:31 -03:00
Antti Palosaari 6b831d7847 [media] airspy: fix error handling on start streaming
Free all reserved USB buffers and URBs on failure. Return all queued
buffers to vb2 with state queued on error case.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 16:42:31 -03:00
Mauro Carvalho Chehab 3cf0c6bd68 Merge remote-tracking branch 'linus/master' into patchwork
There are some patches that depends on media-v3.16-rc6.
So, merge back from upstream before applying them.

* linus/master: (1123 commits)
  drm/nouveau: ltc/gf100-: fix cbc issues on certain boards
  drm/bochs: add missing drm_connector_register call
  drm/cirrus: add missing drm_connector_register call
  staging: vt6655: buffer overflow in ioctl
  USB: storage: Add quirks for Entrega/Xircom USB to SCSI converters
  USB: storage: Add quirk for Ariston Technologies iConnect USB to SCSI adapter
  USB: storage: Add quirk for Adaptec USBConnect 2000 USB-to-SCSI Adapter
  USB: EHCI: unlink QHs even after the controller has stopped
  [SCSI] fix for bidi use after free
  [SCSI] fix regression that accidentally disabled block-based tcq
  [SCSI] libiscsi: fix potential buffer overrun in __iscsi_conn_send_pdu
  drm/radeon: Fix typo 'addr' -> 'entry' in rs400_gart_set_page
  drm/nouveau/runpm: fix module unload
  drm/radeon/px: fix module unload
  vgaswitcheroo: add vga_switcheroo_fini_domain_pm_ops
  drm/radeon: don't reset dma on r6xx-evergreen init
  drm/radeon: don't reset sdma on CIK init
  drm/radeon: don't reset dma on NI/SI init
  drm/radeon/dpm: fix resume on mullins
  drm/radeon: Disable HDP flush before every CS again for < r600
  ...
2014-09-21 16:40:04 -03:00
Antonio Ospite 751e78d0f5 [media] trivial: drivers/media/usb/gspca/gspca.h: indent with TABs, not spaces
Signed-off-by: Antonio Ospite <ao2@ao2.it>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-08 10:00:57 -03:00
Antonio Ospite 59234e5973 [media] trivial: drivers/media/usb/gspca/gspca.c: fix the indentation of a comment
Fix indentation of a comment, put it on the same level of the code it
refers to.

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-08 10:00:56 -03:00
Malcolm Priestley a04646c045 [media] af9035: new IDs: add support for PCTV 78e and PCTV 79e
add the following IDs
USB_PID_PCTV_78E (0x025a) for PCTV 78e
USB_PID_PCTV_79E (0x0262) for PCTV 79e

For these it9135 devices.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Cc: Antti Palosaari <crope@iki.fi>
Cc: <stable@vger.kernel.org> # v3.14+
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-04 12:24:19 -03:00
Mauro Carvalho Chehab ea21f702fc [media] cx231xx: just return 0 instead of using a var
Instead of allocating a var to store 0 and just return it,
change the code to return 0 directly.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 17:59:57 -03:00
Mauro Carvalho Chehab ad7b8c0227 [media] msi2500: simplify boolean tests
Instead of using if (foo == false), just use
if (!foo).

That allows a faster mental parsing when analyzing the
code.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 17:59:23 -03:00
Mauro Carvalho Chehab 61f6a0569c [media] af9005: use true/false for boolean vars
Instead of using 0 or 1 for boolean, use the true/false
defines.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 17:59:22 -03:00
Mauro Carvalho Chehab 235d89ec4a [media] lmedm04: use true/false for boolean vars
Instead of using 0 or 1 for boolean, use the true/false
defines.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 17:59:22 -03:00
Mauro Carvalho Chehab f6b83c3e06 [media] au0828-dvb: use true/false for boolean vars
Instead of using 0 or 1 for boolean, use the true/false
defines.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 17:59:21 -03:00
Mauro Carvalho Chehab 7e6c8c1981 [media] em28xx: use true/false for boolean vars
Instead of using 0 or 1 for boolean, use the true/false
defines.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 17:59:13 -03:00
Hans Verkuil 4a9e512afa [media] em28xx: fix sparse warnings
drivers/media/usb/em28xx/em28xx-core.c:297:16: warning: cast to restricted __le16
drivers/media/usb/em28xx/em28xx-cards.c:2249:20: warning: symbol 'em28xx_bcount' was not declared. Should it be static?

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 10:34:58 -03:00
Hans Verkuil 41150cb9f5 [media] cxusb: fix sparse warning
drivers/media/usb/dvb-usb/cxusb.c:178:40: warning: restricted __le16 degrades to integer

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 10:33:20 -03:00
Hans Verkuil 3f9280a8b4 [media] cx231xx: fix sparse warnings
drivers/media/usb/cx231xx/cx231xx-avcore.c:2226:15: warning: cast to restricted __le32
drivers/media/usb/cx231xx/cx231xx-avcore.c:2447:15: warning: cast to restricted __le32
drivers/media/usb/cx231xx/cx231xx-avcore.c:2475:15: warning: cast to restricted __le32
drivers/media/usb/cx231xx/cx231xx-avcore.c:2500:15: warning: cast to restricted __le32
drivers/media/usb/cx231xx/cx231xx-avcore.c:2647:18: warning: incorrect type in assignment (different base types)
drivers/media/usb/cx231xx/cx231xx-avcore.c:2659:21: warning: cast to restricted __le32
drivers/media/usb/cx231xx/cx231xx-dvb.c:743:57: warning: Using plain integer as NULL pointer
drivers/media/usb/cx231xx/cx231xx-dvb.c:776:57: warning: Using plain integer as NULL pointer

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 10:32:39 -03:00
Hans Verkuil 2954192529 [media] pwc: fix sparse warning
drivers/media/usb/pwc/pwc-v4l.c:55:12: warning: symbol 'pwc_auto_whitebal_qmenu' was not declared. Should it be static?

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 09:55:43 -03:00
Hans Verkuil 6812667381 [media] dvb_usb_core: fix sparse warning
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c:24:5: warning: symbol 'dvb_usbv2_disable_rc_polling' was not declared. Should it be static?

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 09:54:54 -03:00
Hans Verkuil ff3ec57df9 [media] s2255drv: fix sparse warning
drivers/media/usb/s2255/s2255drv.c:2248:20: warning: cast to restricted __le16

At the USB structs there are two different idProduct:
	usb_device_id::idProduct - already on CPU endiannes
	usb_device::descriptor.idProduct - with is LE16

In this specific case, the driver checks for the one at usb_device_id
struct, with already have CPU endianness. So, no conversion is required.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 09:54:16 -03:00
Hans Verkuil 6fbf4d0412 [media] usbtv: fix sparse warnings
drivers/media/usb/usbtv/usbtv-video.c:285:14: warning: cast to restricted __be32
drivers/media/usb/usbtv/usbtv-video.c:285:14: warning: cast to restricted __be32
drivers/media/usb/usbtv/usbtv-video.c:285:14: warning: cast to restricted __be32
drivers/media/usb/usbtv/usbtv-video.c:285:14: warning: cast to restricted __be32
drivers/media/usb/usbtv/usbtv-video.c:285:14: warning: cast to restricted __be32
drivers/media/usb/usbtv/usbtv-video.c:285:14: warning: cast to restricted __be32
drivers/media/usb/usbtv/usbtv-video.c:287:20: warning: cast to restricted __be32
drivers/media/usb/usbtv/usbtv-video.c:287:20: warning: cast to restricted __be32
drivers/media/usb/usbtv/usbtv-video.c:287:20: warning: cast to restricted __be32
drivers/media/usb/usbtv/usbtv-video.c:287:20: warning: cast to restricted __be32
drivers/media/usb/usbtv/usbtv-video.c:287:20: warning: cast to restricted __be32
drivers/media/usb/usbtv/usbtv-video.c:287:20: warning: cast to restricted __be32
drivers/media/usb/usbtv/usbtv-video.c:288:15: warning: cast to restricted __be32
drivers/media/usb/usbtv/usbtv-video.c:288:15: warning: cast to restricted __be32
drivers/media/usb/usbtv/usbtv-video.c:288:15: warning: cast to restricted __be32
drivers/media/usb/usbtv/usbtv-video.c:288:15: warning: cast to restricted __be32
drivers/media/usb/usbtv/usbtv-video.c:288:15: warning: cast to restricted __be32
drivers/media/usb/usbtv/usbtv-video.c:288:15: warning: cast to restricted __be32
drivers/media/usb/usbtv/usbtv-video.c:289:20: warning: cast to restricted __be32
drivers/media/usb/usbtv/usbtv-video.c:289:20: warning: cast to restricted __be32
drivers/media/usb/usbtv/usbtv-video.c:289:20: warning: cast to restricted __be32
drivers/media/usb/usbtv/usbtv-video.c:289:20: warning: cast to restricted __be32
drivers/media/usb/usbtv/usbtv-video.c:289:20: warning: cast to restricted __be32
drivers/media/usb/usbtv/usbtv-video.c:289:20: warning: cast to restricted __be32

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 09:37:04 -03:00
Hans Verkuil d71b0b348f [media] uvc: fix sparse warning
drivers/media/usb/uvc/uvc_video.c:1466:38: warning: incorrect type in return expression (different base types)

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 09:36:44 -03:00
Hans Verkuil 6cde2904df [media] kinect: fix sparse warnings
drivers/media/usb/gspca/kinect.c:151:19: warning: incorrect type in assignment (different base types)
drivers/media/usb/gspca/kinect.c:152:19: warning: incorrect type in assignment (different base types)
drivers/media/usb/gspca/kinect.c:153:19: warning: incorrect type in assignment (different base types)
drivers/media/usb/gspca/kinect.c:191:13: warning: restricted __le16 degrades to integer
drivers/media/usb/gspca/kinect.c:217:16: warning: incorrect type in assignment (different base types)
drivers/media/usb/gspca/kinect.c:218:16: warning: incorrect type in assignment (different base types)

Note that this fixes a real bug where cpu_to_le16 was used instead of the correct
le16_to_cpu.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Antonio Ospite <ao2@ao2.it>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 09:34:14 -03:00
Hans Verkuil 616e3506a9 [media] go7007: fix sparse warnings
drivers/media/usb/go7007/go7007-usb.c:699:30: warning: cast to restricted __le16
drivers/media/usb/go7007/go7007-usb.c:769:38: warning: cast to restricted __le16
drivers/media/usb/go7007/go7007-usb.c:770:39: warning: cast to restricted __le16

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 09:33:24 -03:00
Hans Verkuil ee40d32fc2 [media] pctv452e: fix sparse warnings
drivers/media/usb/dvb-usb/pctv452e.c:886:64: warning: Using plain integer as NULL pointer
drivers/media/usb/dvb-usb/pctv452e.c:903:63: warning: Using plain integer as NULL pointer
drivers/media/usb/dvb-usb/pctv452e.c:968:19: warning: Using plain integer as NULL pointer
drivers/media/usb/dvb-usb/pctv452e.c:1026:19: warning: Using plain integer as NULL pointer

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 09:32:42 -03:00
Hans Verkuil 18d6a28ac0 [media] opera1: fix sparse warnings
drivers/media/usb/dvb-usb/opera1.c:557:29: warning: restricted __le16 degrades to integer
drivers/media/usb/dvb-usb/opera1.c:558:33: warning: restricted __le16 degrades to integer

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 09:32:15 -03:00
Hans Verkuil ed26716521 [media] mxl111sf: fix sparse warnings
drivers/media/usb/dvb-usb-v2/mxl111sf.c:34:5: warning: symbol 'dvb_usb_mxl111sf_isoc' was not declared. Should it be static?
drivers/media/usb/dvb-usb-v2/mxl111sf.c:38:5: warning: symbol 'dvb_usb_mxl111sf_spi' was not declared. Should it be static?
drivers/media/usb/dvb-usb-v2/mxl111sf.c:46:5: warning: symbol 'dvb_usb_mxl111sf_rfswitch' was not declared. Should it be static?
drivers/media/usb/dvb-usb-v2/mxl111sf.c:890:22: warning: symbol 'mxl111sf_i2c_algo' was not declared. Should it be static?

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 09:31:58 -03:00
Hans Verkuil 1ad5d0645e [media] dw2102: fix sparse warnings
drivers/media/usb/dvb-usb/dw2102.c:670:65: warning: restricted __le16 degrades to integer
drivers/media/usb/dvb-usb/dw2102.c:1601:32: warning: restricted __le16 degrades to integer
drivers/media/usb/dvb-usb/dw2102.c:1644:40: warning: restricted __le16 degrades to integer
drivers/media/usb/dvb-usb/dw2102.c:1644:40: warning: restricted __le16 degrades to integer
drivers/media/usb/dvb-usb/dw2102.c:1644:40: warning: restricted __le16 degrades to integer
drivers/media/usb/dvb-usb/dw2102.c:1644:40: warning: restricted __le16 degrades to integer
drivers/media/usb/dvb-usb/dw2102.c:1644:40: warning: restricted __le16 degrades to integer
drivers/media/usb/dvb-usb/dw2102.c:1644:40: warning: restricted __le16 degrades to integer
drivers/media/usb/dvb-usb/dw2102.c:1904:34: warning: symbol 'p1100' was not declared. Should it be static?
drivers/media/usb/dvb-usb/dw2102.c:1911:34: warning: symbol 's660' was not declared. Should it be static?
drivers/media/usb/dvb-usb/dw2102.c:1930:34: warning: symbol 'p7500' was not declared. Should it be static?
drivers/media/usb/dvb-usb/dw2102.c:1937:34: warning: symbol 's421' was not declared. Should it be static?

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 09:31:31 -03:00
Hans Verkuil 744263246d [media] af9015: fix sparse warning
drivers/media/usb/dvb-usb-v2/af9015.c:422:38: warning: cast to restricted __le32

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 09:28:22 -03:00
Hans Verkuil b565e71dd2 [media] dibusb: fix sparse warnings
drivers/media/usb/dvb-usb/dibusb-common.c:261:40: warning: restricted __le16 degrades to integer
drivers/media/usb/dvb-usb/dibusb-common.c:262:52: warning: restricted __le16 degrades to integer
drivers/media/usb/dvb-usb/dibusb-common.c:300:40: warning: restricted __le16 degrades to integer
drivers/media/usb/dvb-usb/dibusb-common.c:301:44: warning: restricted __le16 degrades to integer
drivers/media/usb/dvb-usb/dibusb-common.c:313:47: warning: restricted __le16 degrades to integer
drivers/media/usb/dvb-usb/dibusb-common.c:314:47: warning: restricted __le16 degrades to integer

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 09:23:31 -03:00
Antti Palosaari de3f2e2e0a [media] msi2500: remove unneeded local pointer on msi2500_isoc_init()
There is no need to keep local copy of usb_device pointer as we
have same pointer stored and available easily from device state.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-02 15:47:19 -03:00
Antti Palosaari 206ace2288 [media] dvb-usb-v2: remove dvb_usb_device NULL check
Reported by Dan Carpenter:

The patch d10d1b9ac9: "[media] dvb_usb_v2: use dev_* logging
macros" from Jun 26, 2012, leads to the following Smatch complaint:

drivers/media/usb/dvb-usb-v2/dvb_usb_urb.c:31 dvb_usb_v2_generic_io()
	 error: we previously assumed 'd' could be null (see line 29)

...
Remove whole check as it must not happen in any case. Driver is
totally broken if it does not have valid pointer to device.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-02 15:46:50 -03:00
Olli Salonen a45c2994d5 [media] cxusb: Add read_mac_address for TT CT2-4400 and CT2-4650
Read MAC address from the EEPROM.

This version two corrects a flaw in the result code returning that
did exist in the first version.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-02 15:13:22 -03:00
Olli Salonen 6832d11edd [media] cxusb: Add support for TechnoTrend TT-connect CT2-4650 CI
TechnoTrend TT-connect CT2-4650 CI (0b48:3012) is an USB DVB-T2/C tuner with
the following components:

 USB interface: Cypress CY7C68013A-56LTXC
 Demodulator: Silicon Labs Si2168-A20
 Tuner: Silicon Labs Si2158-A20
 CI chip: CIMaX SP2HF

The firmware for the tuner is the same as for TechnoTrend TT-TVStick CT2-4400.
See https://www.mail-archive.com/linux-media@vger.kernel.org/msg76944.html

The demodulator needs a firmware that can be extracted from the Windows drivers.
File ttConnect4650_64.sys should be extracted from
http://www.tt-downloads.de/bda-treiber_4.1.0.4.zip (MD5 sum below).

3464bfc37a47b4032568718bacba23fb  ttConnect4650_64.sys

Then the firmware can be extracted:
dd if=ttConnect4650_64.sys ibs=1 skip=273376 count=6424 of=dvb-demod-si2168-a20-01.fw

The SP2 CI module requires a definition of a function cxusb_tt_ct2_4650_ci_ctrl
that is passed on to the SP2 driver and called back for CAM operations.

[crope@iki.fi: meld USB ID define patch to this]
Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-02 15:12:38 -03:00
Olli Salonen 9b9beb1bf5 [media] cxusb: add ts mode setting for TechnoTrend CT2-4400
TS mode must be set in the existing TechnoTrend CT2-4400 driver.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-02 15:03:59 -03:00
Olli Salonen 6fd2f44a00 [media] em28xx: add ts mode setting for PCTV 292e
TS mode must be set in the existing PCTV 292e driver.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-02 15:03:40 -03:00
nibble.max 79d0933032 [media] m88ds3103: implement set voltage and TS clock
Implement set voltage operation.
Separate TS clock as a own configuration parameter.
Add TS clock polarity parameter.

[crope@iki.fi: merge em28xx driver m88ds3103 config change patch
to that one, in order to keep build unbroken]

Signed-off-by: Nibble Max <nibble.max@gmail.com>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-02 15:02:10 -03:00
Changbing Xiong 7a0af6ed97 [media] media: fix kernel deadlock due to tuner pull-out while playing
Normally, ADAP_STREAMING bit is set in dvb_usb_start_feed and cleared in
dvb_usb_stop_feed.

But in exceptional cases, for example, when the tv is playing programs
and the tuner is pulled out, then dvb_usbv2_disconnect is called.

In such case, it will first call dvb_usbv2_adapter_frontend_exit to stop
dvb_frontend_thread, and then call dvb_usbv2_adapter_dvb_exit to clear
ADAP_STREAMING bit.

At this point, if dvb_frontend_thread is sleeping and waiting for
ADAP_STREAMING to be cleared to get out of sleep. then
dvb_frontend_thread can never be stoped, because clearing ADAP_STREAMING
bit is performed after dvb_frontend_thread is stopped (i.e. performed in
dvb_usbv2_adapter_dvb_exit).

So, deadlock:

[  240.822037] INFO: task khubd:497 blocked for more than 120 seconds.
[  240.822655] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  240.830493] khubd           D c0013b3c     0   497      2 0x00000000
[  240.836996] [<c0013b3c>] (__schedule+0x200/0x54c) from [<c00110f4>] (schedule_timeout+0x14c/0x19c)
[  240.845940] [<c00110f4>] (schedule_timeout+0x14c/0x19c) from [<c00137f4>] (wait_for_common+0xac/0x150)
[  240.855234] [<c00137f4>] (wait_for_common+0xac/0x150) from [<c004989c>] (kthread_stop+0x58/0x90)
[  240.864004] [<c004989c>] (kthread_stop+0x58/0x90) from [<c03b2ebc>] (dvb_frontend_stop+0x3c/0x9c)
[  240.872849] [<c03b2ebc>] (dvb_frontend_stop+0x3c/0x9c) from [<c03b2f3c>] (dvb_unregister_frontend+0x20/0xd8)
[  240.882666] [<c03b2f3c>] (dvb_unregister_frontend+0x20/0xd8) from [<c03ed938>] (dvb_usbv2_exit+0x68/0xfc)
[  240.892204] [<c03ed938>] (dvb_usbv2_exit+0x68/0xfc) from [<c03eda18>] (dvb_usbv2_disconnect+0x4c/0x70)
[  240.901499] [<c03eda18>] (dvb_usbv2_disconnect+0x4c/0x70) from [<c031c050>] (usb_unbind_interface+0x58/0x188)
[  240.911395] [<c031c050>] (usb_unbind_interface+0x58/0x188) from [<c02c3e78>] (__device_release_driver+0x74/0xd0)
[  240.921544] [<c02c3e78>] (__device_release_driver+0x74/0xd0) from [<c02c3ef0>] (device_release_driver+0x1c/0x28)
[  240.931697] [<c02c3ef0>] (device_release_driver+0x1c/0x28) from [<c02c39b8>] (bus_remove_device+0xc4/0xe4)
[  240.941332] [<c02c39b8>] (bus_remove_device+0xc4/0xe4) from [<c02c1344>] (device_del+0xf4/0x178)
[  240.950106] [<c02c1344>] (device_del+0xf4/0x178) from [<c0319eb0>] (usb_disable_device+0xa0/0x1c8)
[  240.959040] [<c0319eb0>] (usb_disable_device+0xa0/0x1c8) from [<c03128b4>] (usb_disconnect+0x88/0x188)
[  240.968326] [<c03128b4>] (usb_disconnect+0x88/0x188) from [<c0313edc>] (hub_thread+0x4d0/0x1200)
[  240.977100] [<c0313edc>] (hub_thread+0x4d0/0x1200) from [<c0049690>] (kthread+0xa4/0xb0)
[  240.985174] [<c0049690>] (kthread+0xa4/0xb0) from [<c0009118>] (ret_from_fork+0x14/0x3c)
[  240.993259] INFO: task kdvb-ad-0-fe-0:3256 blocked for more than 120 seconds.
[  241.000349] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  241.008162] kdvb-ad-0-fe-0  D c0013b3c     0  3256      2 0x00000000
[  241.014507] [<c0013b3c>] (__schedule+0x200/0x54c) from [<c03eda44>] (wait_schedule+0x8/0x10)
[  241.022924] [<c03eda44>] (wait_schedule+0x8/0x10) from [<c001120c>] (__wait_on_bit+0x74/0xb8)
[  241.031434] [<c001120c>] (__wait_on_bit+0x74/0xb8) from [<c00112b8>] (out_of_line_wait_on_bit+0x68/0x70)
[  241.040902] [<c00112b8>] (out_of_line_wait_on_bit+0x68/0x70) from [<c03e5e88>] (dvb_usb_fe_sleep+0xf4/0xfc)
[  241.050618] [<c03e5e88>] (dvb_usb_fe_sleep+0xf4/0xfc) from [<c03b4b74>] (dvb_frontend_thread+0x124/0x4e8)
[  241.060164] [<c03b4b74>] (dvb_frontend_thread+0x124/0x4e8) from [<c0049690>] (kthread+0xa4/0xb0)
[  241.068929] [<c0049690>] (kthread+0xa4/0xb0) from [<c0009118>] (ret_from_fork+0x14/0x3c)

Fix it by calling dvb_usbv2_adapter_frontend_exit() latter.

Test enviroment: odroidx2 + Hauppauge(WinTV-Aero-M)

Signed-off-by: Changbing Xiong <cb.xiong@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-02 11:47:56 -03:00
Masanari Iida 9b13494c91 treewide: Fix typo in printk
This patch fix spelling typo in printk within vairous
part of the code.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-08-26 09:35:54 +02:00
Mauro Carvalho Chehab 85c1abcb52 [media] usbtv: Make it dependent on ALSA
Now that alsa code is part of the driver, it can be compiled
only if alsa is enabled.

   drivers/built-in.o: In function `snd_usbtv_hw_free':
>> usbtv-audio.c:(.text+0x21eb55): undefined reference to `snd_pcm_lib_free_pages'
   drivers/built-in.o: In function `snd_usbtv_hw_params':
>> usbtv-audio.c:(.text+0x21eb72): undefined reference to `snd_pcm_lib_malloc_pages'
   drivers/built-in.o: In function `usbtv_audio_urb_received':
>> usbtv-audio.c:(.text+0x21ed66): undefined reference to `snd_pcm_link_rwlock'
>> usbtv-audio.c:(.text+0x21ed9f): undefined reference to `snd_pcm_link_rwlock'
>> usbtv-audio.c:(.text+0x21edf5): undefined reference to `snd_pcm_period_elapsed'
   drivers/built-in.o: In function `usbtv_audio_init':
>> (.text+0x21f00a): undefined reference to `snd_card_new'
   drivers/built-in.o: In function `usbtv_audio_init':
>> (.text+0x21f0a2): undefined reference to `snd_pcm_new'
   drivers/built-in.o: In function `usbtv_audio_init':
>> (.text+0x21f0e5): undefined reference to `snd_pcm_set_ops'
   drivers/built-in.o: In function `usbtv_audio_init':
>> (.text+0x21f103): undefined reference to `snd_pcm_lib_preallocate_pages_for_all'
   drivers/built-in.o: In function `usbtv_audio_init':
>> (.text+0x21f10c): undefined reference to `snd_card_register'
   drivers/built-in.o: In function `usbtv_audio_init':
>> (.text+0x21f12a): undefined reference to `snd_card_free'
   drivers/built-in.o: In function `usbtv_audio_free':
>> (.text+0x21f15c): undefined reference to `snd_card_free'
>> drivers/built-in.o:(.data+0x43250): undefined reference to `snd_pcm_lib_ioctl'

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:38 -05:00
Shuah Khan 66cae53024 [media] media: fix au0828 dvb suspend/resume to call dvb_frontend_suspend/resume
au0828 doesn't resume correctly and TV tuning fails with
xc_set_signal_source(0) failed message. Change au0828 dvb
suspend and resume interfaces to suspend and resume frontend
during suspend and resume respectively. dvb_frontend_suspend()
suspends tuner and fe using tuner and fe ops. dvb_frontend_resume()
resumes fe and tuner using fe and tuner ops ini before waking up
the frontend. With this change HVR950Q suspend and resume work
when system gets suspended when digital function is tuned to a
channel and with active TV stream, and after resume it went right
back to active TV stream.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:38 -05:00
Frank Schaefer 662c97cf8f [media] em28xx-v4l: fix video buffer field order reporting in progressive mode
The correct field order in progressive mode is V4L2_FIELD_NONE, not V4L2_FIELD_INTERLACED.

Cc: <stable@vger.kernel.org>
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:38 -05:00
Frank Schaefer 627530c32a [media] em28xx-v4l: give back all active video buffers to the vb2 core properly on streaming stop
When a new video frame is started, the driver takes the next video buffer from
the list of active buffers and moves it to dev->usb_ctl.vid_buf / dev->usb_ctl.vbi_buf
for further processing.

On streaming stop we currently only give back the pending buffers from the list
but not the ones which are currently processed.

This causes the following warning from the vb2 core since kernel 3.15:

...
 ------------[ cut here ]------------
 WARNING: CPU: 1 PID: 2284 at drivers/media/v4l2-core/videobuf2-core.c:2115 __vb2_queue_cancel+0xed/0x150 [videobuf2_core]()
 [...]
 Call Trace:
  [<c0769c46>] dump_stack+0x48/0x69
  [<c0245b69>] warn_slowpath_common+0x79/0x90
  [<f925e4ad>] ? __vb2_queue_cancel+0xed/0x150 [videobuf2_core]
  [<f925e4ad>] ? __vb2_queue_cancel+0xed/0x150 [videobuf2_core]
  [<c0245bfd>] warn_slowpath_null+0x1d/0x20
  [<f925e4ad>] __vb2_queue_cancel+0xed/0x150 [videobuf2_core]
  [<f925fa35>] vb2_internal_streamoff+0x35/0x90 [videobuf2_core]
  [<f925fac5>] vb2_streamoff+0x35/0x60 [videobuf2_core]
  [<f925fb27>] vb2_ioctl_streamoff+0x37/0x40 [videobuf2_core]
  [<f8e45895>] v4l_streamoff+0x15/0x20 [videodev]
  [<f8e4925d>] __video_do_ioctl+0x23d/0x2d0 [videodev]
  [<f8e49020>] ? video_ioctl2+0x20/0x20 [videodev]
  [<f8e48c63>] video_usercopy+0x203/0x5a0 [videodev]
  [<f8e49020>] ? video_ioctl2+0x20/0x20 [videodev]
  [<c039d0e7>] ? fsnotify+0x1e7/0x2b0
  [<f8e49012>] video_ioctl2+0x12/0x20 [videodev]
  [<f8e49020>] ? video_ioctl2+0x20/0x20 [videodev]
  [<f8e4461e>] v4l2_ioctl+0xee/0x130 [videodev]
  [<f8e44530>] ? v4l2_open+0xf0/0xf0 [videodev]
  [<c0378de2>] do_vfs_ioctl+0x2e2/0x4d0
  [<c0368eec>] ? vfs_write+0x13c/0x1c0
  [<c0369a8f>] ? vfs_writev+0x2f/0x50
  [<c0379028>] SyS_ioctl+0x58/0x80
  [<c076fff3>] sysenter_do_call+0x12/0x12
 ---[ end trace 5545f934409f13f4 ]---
...

Many thanks to Hans Verkuil, whose recently added check in the vb2 core unveiled
this long standing issue and who has investigated it further.

Cc: <stable@vger.kernel.org>
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:37 -05:00
Federico Simoncelli 63ddf68de5 [media] usbtv: add audio support
Add an ALSA handler inside usbtv module, in order to make
audio to work with those devices.

Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
Tested-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:34 -05:00
Mauro Carvalho Chehab dcae778148 [media] as102-fe: make it an independent driver
Move as102-fe to dvb-frontends directory and make it an
independent driver.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:30 -05:00
Mauro Carvalho Chehab 47f79129ec [media] as102: prepare as102_fe to be compiled as a module
Remove the dependencies of as102_cmd from as102, in order to
allow it to be compiled as a separate module.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:30 -05:00
Mauro Carvalho Chehab c098c219b0 [media] as102: get rid of as10x_fe_copy_tps_parameters()
This function just converts from the as10x internal data into
the DVBv5 cache. Get rid of it.

No functional changes.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:30 -05:00
Mauro Carvalho Chehab 1d6207fd2c [media] as102: get rid of as102_fe_copy_tune_parameters()
This function just parses the frontend cache and converts
to the as102 internal format message. Get rid of it.

No functional changes.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:29 -05:00
Mauro Carvalho Chehab b601d9a5d6 [media] as102: Move ancillary routines to the beggining
Avoid having function prototypes by moving some
ancillary routines to the beginning of the file.

No functional changes.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:29 -05:00
Mauro Carvalho Chehab d8eb070b66 [media] as102: better name the unknown frontend
Make the frontend .name more coherent with DVB namespace.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:29 -05:00
Mauro Carvalho Chehab 1d5c2bb1f9 [media] as102: CodingStyle fixes
Fix this warning:

WARNING: quoted string split across lines
566: FILE: drivers/media/usb/as102/as102_fe.c:141:
+				"demod status: fc: 0x%08x, bad fc: 0x%08x, "
+				"bytes corrected: 0x%08x , MER: 0x%04x\n",

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:29 -05:00
Mauro Carvalho Chehab 1f2563d68c [media] as102: get rid of FSF mail address
Make checkpatch happier by removing FSF mail address.

No functional changes.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:28 -05:00
Mauro Carvalho Chehab d6317c68f3 [media] as102: promote it out of staging
This driver is stable and doesn't contain any really serious
issue. Move it out of staging.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:28 -05:00
Mauro Carvalho Chehab 29bbb7bd0a [media] siano: add support for PCTV 77e
Add support for PCTV microStick (77e) device that uses a sms1140
chipset.

Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:27 -05:00
Mauro Carvalho Chehab 2930977ac5 [media] au0828: Fix DVB resume when streaming
When DVB is streaming and suspend is called, it will call
au0828_stop_transport(), with will clean the streaming flag.

Due to that, stop_urb_transfer() will be called twice,
causing an oops.

So, we need another flag to be used at resume, telling it
to restart DVB.

While here, add a logic at stop_urb_transfer() to prevent
it of being called twice, and convert the usb_streaming
flag into boolean.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:10 -05:00
Mauro Carvalho Chehab bbc62a18b6 [media] au0828: fix checks if dvb is initialized
dev->dvb is always not null, as it is an area at the dev
memory. So, checking if (dev->dvb) is always true.

Instead of this stupid check, what the code wants to do is
to know if the DVB was successully registered.

Fix it by checking, instead, for dvb->frontend. It should
also be sure that this var will be NULL if the device was
not properly initialized.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:10 -05:00
Mauro Carvalho Chehab 811872404b [media] au0828: add pr_info to track au0828 suspend/resume code
Suspend/resume conditions can be very tricky. Add some info
printk's to help tracking what's happening there.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:08 -05:00
Mauro Carvalho Chehab 83afb32aa9 [media] au0828: use pr_foo macros
Instead of using printk(KERN_foo, use pr_foo() macros.

No functional changes.

Note: we should do the same for dprintk(), but that would
require to remove the dprintk levels. So, for now, let's
not touch on it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:08 -05:00
Mauro Carvalho Chehab 3d8de92e07 [media] au0828: Remove a bad whitespace
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:08 -05:00
Mauro Carvalho Chehab 1a1ba95e80 [media] au0828: add suspend/resume code for V4L2
No timers should be enabled during suspend. So,
stop them. At resume time, we should do the proper
initialization for it to keep working.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:08 -05:00
Mauro Carvalho Chehab e2147d0af0 [media] au0828: properly handle stream on/off state
The STREAM_ON state is used by s_format callback,
but the driver never sets it.

Fix it. This will also be needed in order to handle
suspend/resume ops.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:07 -05:00
Mauro Carvalho Chehab b799de75e0 [media] au0828: Add suspend code for DVB
The scheduled work should be cancelled during suspend.

At resume time, we need to set the frontend again. So,
add such logic to the driver.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:07 -05:00
Mauro Carvalho Chehab fa500461db [media] au0828: be sure to reenable the bridge and GPIOs on resume
At resume, we should restore the register contents. So,
reenable the bridge and GPIO settings.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:07 -05:00
Mauro Carvalho Chehab aaeac1991b [media] au0828: don't let the IR polling thread to run at suspend
Trying to make au0828 to suspend can do very bad things, as
the polling Kthread is not handled. We should disable it
during suspend, only re-enabling it at resume.

Still, analog and digital TV won't work, as we don't reinit
the settings at resume, but at least it won't hang.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:07 -05:00
Shuah Khan 92143f6fb0 [media] au0828: remove CONFIG_VIDEO_AU0828_RC scope around au0828_rc_*()
Remove CONFIG_VIDEO_AU0828_RC scope around au0828_rc_register()
and au0828_rc_unregister() calls in au0828-core

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:06 -05:00
Shuah Khan 917cbcde46 [media] au0828: add au0828_rc_*() stubs for VIDEO_AU0828_RC disabled case
Define au0828_rc_*() stubs to avoid compile errors when
VIDEO_AU0828_RC is disabled and avoid the need to enclose
au0828_rc_*() in ifdef CONFIG_VIDEO_AU0828_RC in .c files.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:06 -05:00
Mauro Carvalho Chehab 345e3bfdad [media] au0828: handle IR int during suspend/resume
It doesn't make sense to handle an IR code given before
suspending after the device resume. So, turn off IR
int while suspending.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:06 -05:00
Mauro Carvalho Chehab e9018af0b8 [media] au0828: avoid race conditions at RC stop
As the RC kthread can re-enable IR int, we should first
cancel the kthread and then disable IR int.

While here, remove a temporary debug printk.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:06 -05:00
Mauro Carvalho Chehab 2e0cc7ee75 [media] au0828-input: Be sure that IR is enabled at polling
When the DVB code sets the frontend, it disables the IR
INT, probably due to some hardware bug, as there's no code
there at au8522 frontend that writes on register 0xe0.

Fixing it at au8522 code is hard, as it doesn't know if the
IR is enabled or disabled, and just restoring the value of
register 0xe0 could cause other nasty effects. So, better
to add a hack at au0828-input polling interval to enable int,
if disabled.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:05 -05:00
Mauro Carvalho Chehab d84fdc774b [media] au0828: Enable IR for HVR-850
HVR-850 also has a remote. Enable it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:05 -05:00
Mauro Carvalho Chehab ff346b0f5d [media] au0828: add an option to disable IR via modprobe parameter
The IR code increases the power consumption of the device.
Allow to disable it via modprobe parameter.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:05 -05:00
Mauro Carvalho Chehab f5885f4097 [media] au0828: no need to sleep at the IR code
This sleep was doing some debouncing on the original driver.
This is not needed on Linux, because the RC core and the input
layer already takes care of it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:05 -05:00
Joe Perches 6850aeabdd media: use pci_zalloc_consistent
Remove the now unnecessary memset too.

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Mauro Carvalho Chehab <m.chehab@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-08-08 15:57:28 -07:00
Linus Torvalds f4d33337ea Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media updates from Mauro Carvalho Chehab:
 - removal of sn9c102.  This device driver was replaced a long time ago
   by gspca
 - solo6x10 and go7007 webcam drivers moved from staging into
   mainstream.  They were waiting for an API to allow setting the image
   detection matrix
 - SDR drivers moved from staging into mainstream: sdr-msi3101 (renamed
   as msi2500) and rtl2832
 - added SDR driver for airspy
 - added demux driver: si2165
 - rework at several RC subsystem, making the code for RC-5 SZ variant
   to be added at the standard RC5 decoder
 - added decoder for the XMP IR protocol
 - tuner driver moved from staging into mainstream: msi3101 (renamed as
   msi001)
 - added documentation for some additional SDR pixfmt
 - some device tree bindings documented
 - added support for exynos3250 at s5p-jpeg
 - remove the obsolete, unmaintained and broken mx1_camera driver
 - added support for remote controllers at au0828 driver
 - added a RC driver: sunxi-cir
 - several driver fixes, enhancements and cleanups.

* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (455 commits)
  [media] cx23885: fix UNSET/TUNER_ABSENT confusion
  [media] coda: fix build error by making reset control optional
  [media] radio-miropcm20: fix sparse NULL pointer warning
  [media] MAINTAINERS: Update go7007 pattern
  [media] MAINTAINERS: Update solo6x10 patterns
  [media] media: atmel-isi: add primary DT support
  [media] media: atmel-isi: convert the pdata from pointer to structure
  [media] media: atmel-isi: add v4l2 async probe support
  [media] rcar_vin: add devicetree support
  [media] media: pxa_camera device-tree support
  [media] media: mt9m111: add device-tree suppport
  [media] soc_camera: add support for dt binding soc_camera drivers
  [media] media: soc_camera: pxa_camera documentation device-tree support
  [media] media: mt9m111: add device-tree documentation
  [media] s5p-mfc: remove unnecessary calling to function video_devdata()
  [media] s5p-jpeg: add chroma subsampling adjustment for Exynos3250
  [media] s5p-jpeg: Prevent erroneous downscaling for Exynos3250 SoC
  [media] s5p-jpeg: Assure proper crop rectangle initialization
  [media] s5p-jpeg: fix g_selection op
  [media] s5p-jpeg: Adjust jpeg_bound_align_image to Exynos3250 needs
  ...
2014-08-05 16:36:30 -07:00
Mauro Carvalho Chehab 2fcfd317f6 [media] au0828: add support for IR on HVR-950Q
HVR-950Q uses an I2C remote controller at address 0x47 (7-bits
notation). Add support for it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-30 15:51:43 -03:00
Mauro Carvalho Chehab cfd0c77d08 [media] au0828: improve I2C speed
Commits 21dc61d3c0 and 7a1dd50b89 reduced the board I2C
speed to 20 MHz by default, due to a I2C stretch issue:
while xc5000 uses i2c stretch when a command is sent to it,
au0828 doesn't support this feature.

However, this is needed only for Xceive tuners. The other
I2C devices can work at the max speed.

So, revert the workarounds at board level, handling it at
I2C level, only when talking with xc5000.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-30 15:44:25 -03:00
Ingo Molnar ca5bc6cd5d Merge branch 'sched/urgent' into sched/core, to merge fixes before applying new changes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2014-07-28 10:03:00 +02:00
Mauro Carvalho Chehab 1f97947c15 [media] cx231xx: handle errors at read_eeprom()
Fix the following warnings:
	drivers/media/usb/cx231xx/cx231xx-cards.c: In function 'read_eeprom':
	drivers/media/usb/cx231xx/cx231xx-cards.c:979:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-27 17:03:51 -03:00
Matthias Schwarzott 140a7987db [media] cx231xx: Add support for PCTV QuatroStick 522e
Add support for:
	[2013:025e] PCTV QuatroStick 522e

The hardware is identical to Hauppauge WinTV 930C-HD (model 1114xx)

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-27 17:03:36 -03:00
Matthias Schwarzott a141a887e0 [media] cx231xx: Add support for PCTV QuatroStick 521e
Add support for:
	[2013:0259] PCTV QuatroStick 521e

The hardware is identical to Hauppauge WinTV 930C-HD (model 1113xx)

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-27 17:03:23 -03:00
Matthias Schwarzott 9e49f7c3d6 [media] cx231xx: Add digital support for HVR930C-HD model 1114xx
Add support for:
	[2040:b131] Hauppauge WinTV 930C-HD (model 1114xx)

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Tested-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-27 17:03:07 -03:00
Matthias Schwarzott dd2e7dd20c [media] cx231xx: Add digital support for HVR 930c-HD model 1113xx
Add support for:
	[2040:b130] Hauppauge WinTV 930C-HD (model 1113xx)

After loading the driver the first open to dvb device node fails.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-27 17:02:48 -03:00
Matthias Schwarzott 6d3debafc8 [media] cx231xx: prepare for i2c_client attachment
This is needed to support PCTV QuatroStick 522e which uses a si2157.
The si2157 driver is written using i2c_client attachment.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Tested-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-27 17:02:22 -03:00
Mauro Carvalho Chehab 52841e5e14 [media] cx231xx: return an error if it can't read PCB config
Instead of using some random value, return an error if the
PCB config is not available or doesn't match a know profile

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-27 16:57:43 -03:00
Mauro Carvalho Chehab 4d2a7d3509 [media] cx231xx: move analog init code to a separate function
That makes easier to understand the code. It would also help
to add support for having boards with just digital support
on some latter patch, as allowed by some PCB configs.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-27 16:57:27 -03:00
Mauro Carvalho Chehab 184a82784d [media] cx231xx: use devm_ functions to allocate memory
The initialization is already too complex. Use devm_ functions
to make the code simpler and easier to modify.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-27 16:54:21 -03:00
Mauro Carvalho Chehab dcb78ac761 [media] cx231xx: Don't let an interface number to go past the array
On some newer boards, like HVR-930C HD, the information at
the PCB tables are sometimes higher than the ones actually
available on the device. That causes the probing code to
go past the interfaces array.

Add checks to the interface number before going past the
array.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-27 16:54:04 -03:00
Mauro Carvalho Chehab 139d28826b [media] cx231xx: Fix the max number of interfaces
The max number of interfaces was read from the wrong descriptor.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-27 16:53:40 -03:00
Frank Schaefer 3d3a41098e [media] em28xx-v4l: fix disabling ioctl VIDIOC_S_PARM for vbi devices
Fixes an old copy+paste bug that has survived all recent code
changes in this code area.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 16:45:47 -03:00
Frank Schaefer 747dba7de2 [media] em28xx-v4l: get rid of field "users" in struct em28xx_v4l2
Instead of counting the number of opened file handles, use function
v4l2_fh_is_singular_file() in em28xx_v4l2_open() and em28xx_v4l2_close() to
determine if the file handle is the first/last opened one.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 16:45:14 -03:00
Frank Schaefer 3c0f90e14c [media] em28xx-v4l: simplify em28xx_v4l2_open() by using v4l2_fh_open()
Instead of calling

...
struct v4l2_fh *fh = kzalloc(sizeof(*fh), GFP_KERNEL);
filp->private_data = fh;
v4l2_fh_init(fh, vdev);
v4l2_fh_add(fh);
...

simply use function v4l2_fh_open() which does all of these calls for us.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 16:44:30 -03:00
Frank Schaefer 917ba6b0b6 [media] em28xx-v4l: get rid of struct em28xx_fh
struct em28xx_fh isn't needed anymore because the only used field which is left is struct v4l2_fh fh.
Use struct v4l2_fh directly and remvove struct em28xx_fh.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 16:43:41 -03:00
Frank Schaefer 5015389fda [media] em28xx-v4l: simplify some pointers in em28xx_init_camera()
Pointer v4l2" can be used instead of "dev->v4l2, which saves some characters.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 16:42:28 -03:00
Raimonds Cicans ad86faada7 [media] Fix typo in comments
Expression ((7bit i2c_addr << 1) & 0x01) can not be right
because it is always 0

Signed-off-by: Raimonds Cicans <ray@apollo.lv>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 15:09:47 -03:00
Fabian Frederick 0ee4c2ac18 [media] drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c: remove unnecessary null test before usb_free_urb
Fix checkpatch warning:
WARNING: usb_free_urb(NULL) is safe this check is probably not required

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 14:55:00 -03:00
Antti Palosaari 3ab2512337 [media] af9035: override tuner for AVerMedia A835B devices
Tuner ID set into EEPROM is wrong, which causes driver to select
wrong tuner profile. That leads device non-working. Fix issue by
overriding known bad tuner IDs with suitable default value.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 12:04:10 -03:00
Shuah Khan f68e35af99 [media] media: em28xx-dvb update fe exit flag to indicate device disconnect
Change em28xx_dvb_fini() to set fe exit flag to DVB_FE_DEVICE_REMOVED
when device is disconnected. em28xx maintains device disconnect status
in em28xx device. fe drivers will be able to now check the fe exit
status to avoid accessing the device, from their release interfaces
when called from disconnect path. This change depends on dvb-core
change that exports fe exit flag by moving it from fepriv to fe.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:18:57 -03:00
Shuah Khan cc5c5d20c3 [media] media: em28xx - fix i2c_xfer to return -ENODEV when dev is removed
In em28xx usb disconnect code path, some dvb fe and tuner drivers
attempt i2c transfers from their release interfaces. When device
is removed, return -ENODEV instead of attempting to transfer data
over i2c.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:15:17 -03:00
Shuah Khan b89193e0b0 [media] media: em28xx - remove reset_resume interface
em28xx uses resume interface as its reset_resume interface.
If usb device is reset during suspend, reset_resume doesn't
do the necessary initialization which leads to resume failure.
Many systems don't maintain do not maintain suspend current to
the USB host controllers during hibernation. Remove reset_resume
to allow disconnect to be called followed by device restore
sequence.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:14:24 -03:00
Shuah Khan 4db8954afa [media] media: em28xx - add error handling for KWORLD dvb_attach failures
Add error hanlding when EM2870_BOARD_KWORLD_A340 dvb_attach()
for fe and tuner fail in em28xx_dvb_init().

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:09:40 -03:00
Shuah Khan 6eb5e3399e [media] media: em28xx-dvb - fix em28xx_dvb_resume() to not unregister i2c and dvb
em28xx_dvb_resume() unregisters i2c tuner, i2c demod, and dvb.
This erroneous cleanup results in i2c tuner, i2c demod, and dvb
devices unregistered and removed during resume. This error is a
result of merge conflict between two patches that went into 3.15.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:03:36 -03:00
Sebastian 89c5ff0557 [media] rtl28xxu: add [1b80:d3b0] Sveon STV21
Added Sveon STV21 device based on Realtek RTL2832U and FC0013 tuner

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
Acked-by: Antti Palosaari <crope@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 10:52:28 -03:00
James Harper 9e334c7564 [media] Fix regression in some dib0700 based devices
Fix regression in some dib0700 based devices.
Set size_of_priv, and don't call dvb_detach unnecessarily.
This resolves the oops(s) for my "Leadtek Winfast DTV Dongle (STK7700P based)"

Signed-off-by: James Harper <james.harper@ejbdigital.com.au>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 00:51:02 -03:00
David Härdeman 9d2f1d3cde [media] rc-core: rename dev->scanmask to dev->scancode_mask
We already have dev->scancode_filter and dev->scancode_wakeup_filter
so rename dev->scanmask to dev->scancode_mask for consistency.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-25 19:10:43 -03:00
David Härdeman c5540fbb9d [media] rc-core: remove protocol arrays
The basic API of rc-core used to be:

	dev = rc_allocate_device();
	dev->x = a;
	dev->y = b;
	dev->z = c;
	rc_register_device();

which is a pretty common pattern in the kernel, after the introduction of
protocol arrays the API looks something like:

	dev = rc_allocate_device();
	dev->x = a;
	rc_set_allowed_protocols(dev, RC_BIT_X);
	dev->z = c;
	rc_register_device();

There's no real need for the protocols to be an array, so change it
back to be consistent (and in preparation for the following patches).

[m.chehab@samsung.com: added missing changes at some files]
Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-25 19:10:43 -03:00
David Härdeman 120703f9eb [media] rc-core: document the protocol type
Right now the protocol information is not preserved, rc-core gets handed a
scancode but has no idea which protocol it corresponds to.

This patch (which required reading through the source/keymap for all drivers,
not fun) makes the protocol information explicit which is important
documentation and makes it easier to e.g. support multiple protocols with one
decoder (think rc5 and rc-streamzap). The information isn't used yet so there
should be no functional changes.

[m.chehab@samsung.com: rebased, added cxusb and removed bad whitespacing]
Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-23 21:50:48 -03:00
David Härdeman af3a4a9bbe [media] dib0700: NEC scancode cleanup
the RC RX packet is defined as:

        struct dib0700_rc_response {
		...
                                u8 not_system;
                                u8 system;
		...
                u8 data;
                u8 not_data;

The NEC protocol transmits in the order:
        system
        not_system
        data
        not_data

Note that the code defines the NEC extended scancode as:

        scancode = be16_to_cpu(poll_reply->system16) << 8 | poll_reply->data;

i.e.

        scancode = poll_reply->not_system << 16 |
                   poll_reply->system     << 8  |
                   poll_reply->data;

Which, if the order *is* reversed, would mean that the scancode that
gets defined is in reality:

        scancode = poll_reply->system     << 16 |
                   poll_reply->not_system << 8  |
                   poll_reply->data;

Which is the same as the order used in drivers/media/rc/ir-nec-decoder.c.

This patch changes the code to match my assumption (the generated scancode
should, however, not change).

[m.chehab@samsung.com: rebased and fixed the decoding error message]
Signed-off-by: David Härdeman <david@hardeman.nu>
CC: Patrick Boettcher <pboettcher@kernellabs.com>
Tested-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-23 21:26:08 -03:00
David Härdeman 4dd9bb91bb [media] rc-core: improve ir-kbd-i2c get_key functions
The arguments used for ir-kbd-i2c's get_key() functions are not
really suited for rc-core and the ir_raw/ir_key distinction is
just confusing.

Convert all of them to return a protocol/scancode/toggle triple instead.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-23 20:05:56 -03:00
Mauro Carvalho Chehab eb9da073bd [media] cxusb: increase buffer length to 80 bytes
As reported by Vincent:
	[   16.332247] xc2028 0-0061: Loading firmware for type=BASE F8MHZ (3), id 0000000000000000.
	[   16.344378] cxusb: i2c wr: len=64 is too big!

64 bytes is too short for firmware load on this device. So, increase it
to 80 bytes.

Reported-by: Vincent McIntyre <vincent.mcintyre@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 21:58:23 -03:00
Hans Verkuil 7955f03d18 [media] go7007: move out of staging into drivers/media/usb.
Now that the custom motion detection API in this driver has been
replaced with a standard API there is no reason anymore to keep it
in staging. So (finally!) move it to drivers/media/usb.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 12:53:33 -03:00
Antti Palosaari 06ce32cbad [media] msi2500: rename namespace msi3101 => msi2500
Rename driver namespace according to current driver name. Old
msi3101 was name of reference design, msi2500 is name of chip
itself.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 11:35:39 -03:00
Antti Palosaari 8591f70804 [media] msi2500: refactor USB stream copying
There was a lot of duplicated functionality between different
stream format handling. Refactor functionality in order to get
rid of duplicated code.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 11:34:57 -03:00
Antti Palosaari c08de62f1f [media] msi2500: correct style issues
Correct some style issues, mostly reported by checkpatch.pl.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 11:33:34 -03:00
CrazyCat 7b71ef7eac [media] dw2102: Geniatech T220 init fixed
Geniatech T220 init fixed - reset cmd from windows driver and fixed TS bus config for cxd2820r.

Signed-off-by: Evgeny Plehov <EvgenyPlehov@ukr.net>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 09:48:12 -03:00
Mauro Carvalho Chehab a733291d69 Merge commit '67dd8f35c2d8ed80f26c9654b474cffc11c6674d' into patchwork
* .: (268 commits)
  Linux 3.16-rc6
  um: segv: Save regs only in case of a kernel mode fault
  um: Fix hung task in fix_range_common()
  um: Ensure that a stub page cannot get unmapped
  Revert "um: Fix wait_stub_done() error handling"
  btrfs: test for valid bdev before kobj removal in btrfs_rm_device
  Btrfs: fix abnormal long waiting in fsync
  random: check for increase of entropy_count because of signed conversion
  ARM: EXYNOS: Fix core ID used by platsmp and hotplug code
  ahci: add support for the Promise FastTrak TX8660 SATA HBA (ahci mode)
  ARM: at91/dt: add missing clocks property to pwm node in sam9x5.dtsi
  ARM: at91/dt: fix usb0 clocks definition in sam9n12 dtsi
  ARM: at91: at91sam9x5: correct typo error for ohci clock
  irqchip: gic: Fix core ID calculation when topology is read from DT
  GFS2: fs/gfs2/rgrp.c: kernel-doc warning fixes
  GFS2: memcontrol: Spelling s/invlidate/invalidate/
  GFS2: Allow caching of glocks for flock
  GFS2: Allow flocks to use normal glock dq rather than dq_wait
  GFS2: replace count*size kzalloc by kcalloc
  GFS2: Use GFP_NOFS when allocating glocks
  ...

Conflicts:
	drivers/media/dvb-frontends/si2168.c
	drivers/media/dvb-frontends/si2168_priv.h
	drivers/media/tuners/si2157.c
2014-07-22 02:03:59 -03:00
Antti Palosaari 64a43323e4 [media] rtl2832_sdr: fix Kconfig dependencies
MEDIA_SDR_SUPPORT and I2C_MUX are needed for rtl2832_sdr.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 01:36:29 -03:00
Antti Palosaari a54e0fee61 [media] msi2500: fill FMT buffer size
Fill FMT buffer size field in order to inform app which will be
used streaming buffer size. Currently driver doesn't allow buffer
size value proposed by application.

Cc: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-21 23:29:14 -03:00
Antti Palosaari c33590778f [media] msi2500: print notice to point SDR API is not 100% stable yet
SDR API is very new and surprises may occur. Due to that print
notice to remind possible users.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-21 23:28:51 -03:00
Antti Palosaari 3912eb6d1e [media] msi2500: change supported formats
Enable two native formats, V4L2_SDR_FMT_CS8 and V4L2_SDR_FMT_CS14LE.
Move emulated formats behind module parameter.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-21 23:28:32 -03:00
Antti Palosaari fd8b5f5029 msi2500: move msi3101 out of staging and rename
Move msi3101 out of staging and rename to msi2500.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-21 23:15:12 -03:00
Antti Palosaari 1b303e1a58 [media] airspy: fill FMT buffer size
Fill FMT buffer size field in order to inform app which will be
used streaming buffer size. Currently driver doesn't allow buffer
size value proposed by application.

Cc: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-21 21:41:48 -03:00
Matthias Schwarzott c3b513bd69 [media] em28xx-dvb: Prepare for si2157 driver getting more parameters
Modify all users of si2157_config to correctly initialize all not
listed values to 0.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-21 21:28:41 -03:00
Matthias Schwarzott 9f7ca3d46b [media] cxusb: Prepare for si2157 driver getting more parameters
Modify all users of si2157_config to correctly initialize all not
listed values to 0.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-21 21:28:10 -03:00
Antti Palosaari ac4f90ca1b [media] airspy: print notice to point SDR API is not 100% stable yet
Print notice on driver load: "SDR API is still slightly
experimental and functionality changes may follow". It is just
remind possible used SDR API is very new and surprises may occur.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-21 21:02:38 -03:00
Antti Palosaari f3e775962c [media] airspy: move out of staging into drivers/media/usb
Move it out of staging into media like all the other SDR drivers
too. There is no good reasons to keep these SDR drivers in staging.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-21 21:01:54 -03:00
Antti Palosaari 77bbb2b049 rtl2832_sdr: move from staging to media
Move rtl2832_sdr driver module from staging to media.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-21 20:55:41 -03:00
Antti Palosaari 435ef148ca [media] Kconfig: add SDR support
Add software defined radio device support for media Kconfig.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-21 20:33:35 -03:00
Linus Torvalds 67dd8f35c2 Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media fixes from Mauro Carvalho Chehab:
 "A series of driver fixes:
   - fix DVB-S tuning with tda1071
   - fix tuner probe on af9035 when the device has a bad eeprom
   - some fixes for the new si2168/2157 drivers
   - one Kconfig build fix (for omap4iss)
   - fixes at vpif error path
   - don't lock saa7134 ioctl at driver's base core level, as it now
     uses V4L2 and VB2 locking schema
   - fix audio at hdpvr driver
   - fix the aspect ratio at the digital timings table
   - one new USB ID (at gspca_pac7302): Genius i-Look 317 webcam"

* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
  [media] gspca_pac7302: Add new usb-id for Genius i-Look 317
  [media] tda10071: fix returned symbol rate calculation
  [media] tda10071: fix spec inversion reporting
  [media] tda10071: add missing DVB-S2/PSK-8 FEC AUTO
  [media] tda10071: force modulation to QPSK on DVB-S
  [media] hdpvr: fix two audio bugs
  [media] davinci: vpif: missing unlocks on error
  [media] af9035: override tuner id when bad value set into eeprom
  [media] saa7134: use unlocked_ioctl instead of ioctl
  [media] media: v4l2-core: v4l2-dv-timings.c: Cleaning up code wrong value used in aspect ratio
  [media] si2168: firmware download fix
  [media] si2157: add one missing parenthesis
  [media] si2168: add one missing parenthesis
  [media] staging: tighten omap4iss dependencies
2014-07-21 11:44:34 -07:00
Andrey Utkin 599bc36a79 [media] media: pvrusb2: make logging code sane
The issue was discovered by static analysis. It turns out that code is
somewhat insane, being
if (x) {...} else { if (x) {...} }

Edited it to do the only reasonable thing, which is to log the
information about the failed call. The most descriptive logging commands
set is taken from original code.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=79801

Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Andrey Utkin <andrey.krieger.utkin@gmail.com>
Acked-by: Mike Isely <isely@pobox.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17 20:05:38 -03:00
Hans Verkuil 93e6a855ff [media] hdpvr: fix reported HDTV colorspace
The colorspace for HDTV is REC709, not SMPTE240M.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17 19:57:57 -03:00
Laurent Pinchart d52e238136 [media] v4l: Support extending the v4l2_pix_format structure
The v4l2_pix_format structure has no reserved field. It is embedded in
the v4l2_framebuffer structure which has no reserved fields either, and
in the v4l2_format structure which has reserved fields that were not
previously required to be zeroed out by applications.

To allow extending v4l2_pix_format, inline it in the v4l2_framebuffer
structure, and use the priv field as a magic value to indicate that the
application has set all v4l2_pix_format extended fields and zeroed all
reserved fields following the v4l2_pix_format field in the v4l2_format
structure.

The availability of this API extension is reported to userspace through
the new V4L2_CAP_EXT_PIX_FORMAT capability flag. Just checking that the
priv field is still set to the magic value at [GS]_FMT return wouldn't
be enough, as older kernels don't zero the priv field on return.

To simplify the internal API towards drivers zero the extended fields
and set the priv field to the magic value for applications not aware of
the extensions.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17 12:44:47 -03:00
Hans Verkuil 0d5e8c4313 [media] Fix 64-bit division fall-out from 64-bit control ranges
Commit 0ba2aeb6da increased the internal control ranges
to 64 bit, but that caused problems in drivers that use the minimum/maximum/step/default_value
control values in a division or modulus operations since not all architectures support
those natively.

Luckily, in almost all cases it is possible to just cast to 32 bits (the control value
is known to be 32 bits, so it is safe to cast). Only in v4l2-ctrls.c was it necessary to
use do_div in one function.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17 12:44:38 -03:00
NeilBrown 743162013d sched: Remove proliferation of wait_on_bit() action functions
The current "wait_on_bit" interface requires an 'action'
function to be provided which does the actual waiting.
There are over 20 such functions, many of them identical.
Most cases can be satisfied by one of just two functions, one
which uses io_schedule() and one which just uses schedule().

So:
 Rename wait_on_bit and        wait_on_bit_lock to
        wait_on_bit_action and wait_on_bit_lock_action
 to make it explicit that they need an action function.

 Introduce new wait_on_bit{,_lock} and wait_on_bit{,_lock}_io
 which are *not* given an action function but implicitly use
 a standard one.
 The decision to error-out if a signal is pending is now made
 based on the 'mode' argument rather than being encoded in the action
 function.

 All instances of the old wait_on_bit and wait_on_bit_lock which
 can use the new version have been changed accordingly and their
 action functions have been discarded.
 wait_on_bit{_lock} does not return any specific error code in the
 event of a signal so the caller must check for non-zero and
 interpolate their own error code as appropriate.

The wait_on_bit() call in __fscache_wait_on_invalidate() was
ambiguous as it specified TASK_UNINTERRUPTIBLE but used
fscache_wait_bit_interruptible as an action function.
David Howells confirms this should be uniformly
"uninterruptible"

The main remaining user of wait_on_bit{,_lock}_action is NFS
which needs to use a freezer-aware schedule() call.

A comment in fs/gfs2/glock.c notes that having multiple 'action'
functions is useful as they display differently in the 'wchan'
field of 'ps'. (and /proc/$PID/wchan).
As the new bit_wait{,_io} functions are tagged "__sched", they
will not show up at all, but something higher in the stack.  So
the distinction will still be visible, only with different
function names (gds2_glock_wait versus gfs2_glock_dq_wait in the
gfs2/glock.c case).

Since first version of this patch (against 3.15) two new action
functions appeared, on in NFS and one in CIFS.  CIFS also now
uses an action function that makes the same freezer aware
schedule call as NFS.

Signed-off-by: NeilBrown <neilb@suse.de>
Acked-by: David Howells <dhowells@redhat.com> (fscache, keys)
Acked-by: Steven Whitehouse <swhiteho@redhat.com> (gfs2)
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Steve French <sfrench@samba.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/20140707051603.28027.72349.stgit@notabene.brown
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2014-07-16 15:10:39 +02:00
Olli Salonen 26c42b0dd5 [media] cxusb: TechnoTrend CT2-4400 USB DVB-T2/C tuner support
USB ID 0b48:3014.

USB interface: Cypress CY7C68013A-56LTXC
Demodulator: Silicon Labs Si2168-30
Tuner: Silicon Labs Si2158-20

Cc: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Reviewed-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14 21:07:07 -03:00
Hans de Goede 242841d3d7 [media] gspca_pac7302: Add new usb-id for Genius i-Look 317
Tested-and-reported-by: yullaw <yullaw@mageia.cz>

Cc: stable@vger.kernel.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14 21:06:35 -03:00
Mauro Carvalho Chehab 40d1a7c3de [media] dib0700: better document struct init
Instead of using anonymous initialization for dib0896 structs,
identify each field by name. That helps to understand what's
being initialized.

No functional changes.

Acked-By: Patrick Boettcher <pboettcher@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-07 09:56:37 -03:00
Ramakrishnan Muthukrishnan 95cd5d5ee6 [media] media: remove the setting of the flag V4L2_FL_USE_FH_PRIO
Since all the drivers that use `struct v4l2_fh' use the core
priority checking, the setting of the flag in the drivers can
be removed.

Signed-off-by: Ramakrishnan Muthukrishnan <ramakrmu@cisco.com>
Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-04 16:14:59 -03:00
Alexey Khoroshilov e7d40c3721 [media] tlg2300: fix leak at failure path in poseidon_probe()
Error handling code in poseidon_probe() misses usb_put_intf()
and usb_put_dev().

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

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-04 15:45:20 -03:00
Rickard Strandqvist e5a89998d4 [media] media: usb: dvb-usb-v2: mxl111sf.c: Cleaning up uninitialized variables
There is a risk that the variable will be used without being initialized.

This was largely found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-04 15:43:34 -03:00
Peter Senna Tschudin 4df16f702c [media] drivers/media: Remove useless return variables
This patch remove variables that are initialized with a constant,
are never updated, and are only used as parameter of return.
Return the constant instead of using a variable.

Verified by compilation only.

The coccinelle script that find and fixes this issue is:
// <smpl>
@@
type T;
constant C;
identifier ret;
@@
- T ret = C;
... when != ret
    when strict
return
- ret
+ C
;
// </smpl>

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-04 15:35:27 -03:00
Peter Senna Tschudin 931387fa94 [media] drivers/media/usb/usbvision/usbvision-core.c: Remove useless return variables
This patch remove variables that are initialized with a constant,
are never updated, and are only used as parameter of return.
Return the constant instead of using a variable.

Verified by compilation only.

The coccinelle script that find and fixes this issue is:
// <smpl>
@@
type T;
constant C;
identifier ret;
@@
- T ret = C;
... when != ret
    when strict
return
- ret
+ C
;
// </smpl>

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-04 15:35:02 -03:00
Hans Verkuil e22eca7857 [media] em28xx: add MSI Digivox Trio support
Add support for the MSI Digivox Trio device.

Signed-off-by: P. van Gaans <w3ird_n3rd@gmx.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-04 15:34:40 -03:00
Hans Verkuil 3445857b22 [media] hdpvr: fix two audio bugs
When the audio encoding is changed the driver calls hdpvr_set_audio
with the current opt->audio_input value. However, that should have
been opt->audio_input + 1. So changing the audio encoding inadvertently
changes the input as well. This bug has always been there.

The second bug was introduced in kernel 3.10 and that broke the
default_audio_input module option handling: the audio encoding was
never switched to AC3 if default_audio_input was set to 2 (SPDIF input).

In addition, since starting with 3.10 the audio encoding is always set
at the start the first bug now always happens when the driver is loaded.
In the past this bug would only surface if the user would change the
audio encoding after the driver was loaded.

Also fixes a small trivial typo (bufffer -> buffer).

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reported-by: Scott Doty <scott@corp.sonic.net>
Cc: stable@vger.kernel.org      # for v3.10 and up
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-04 15:13:02 -03:00
Antti Palosaari 1cbbf90d04 [media] af9035: override tuner id when bad value set into eeprom
Tuner ID set into EEPROM is wrong in some cases, which causes driver
to select wrong tuner profile. That leads device non-working. Fix
issue by overriding known bad tuner IDs with suitable default value.

Thanks to MX-NET Telekomunikace s.r.o. for providing non-working
DTV stick, that I could fix the bug!

Cc: stable@vger.kernel.org # v3.15+
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-04 15:06:43 -03:00
Antonio Ospite c87c0f079c [media] gspca_kinect: add support for the depth stream
Add support for the depth stream at 10bpp, for now use a 'depth_mode'
command line parameter to switch between video and depth mode.

Signed-off-by: Alexander Sosna <alexander@xxor.de>
Signed-off-by: Antonio Ospite <ao2@ao2.it>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-04 14:51:01 -03:00
Antonio Ospite 2fe152451d [media] gspca: provide a mechanism to select a specific transfer endpoint
Currently gspca selects the first ISOC input endpoint as the input
transfer endpoint, however some devices can provide streams on endpoints
different then the first one, so some subdrivers (e.g. gspca_kinect) may
want to select a specific endpoint to use as a transfer endpoint.

Add an xfer_ep field to struct gspca_dev, and change alt_xfer() so that
it accepts a parameter which represents a specific endpoint address to
look for.

If a subdriver wants to specify a value for gspca_dev->xfer_ep it can do
that in its sd_config() callback.

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-04 14:50:11 -03:00
CrazyCat b5b620584b [media] technisat-sub2: Fix stream curruption on high bitrate
Fix stream curruption on high bitrate (>60mbit).

Signed-off-by: Evgeny Plehov <EvgenyPlehov@ukr.net>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-06-26 09:20:18 -03:00
Mauro Carvalho Chehab 1fe3a8fe49 [media] au0828: don't hardcode height/width
While this device doesn't have a scaler (or have it disabled),
the screen dimentions are a function of the standard. Ok, right
now, only 480 lines standards are implemented, although it
supports other ones. Yet, let's calculate the size, to make
easier to add more standards latter.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-06-19 13:36:10 -03:00
Mauro Carvalho Chehab 64ea37bbd8 [media] au0828: Only alt setting logic when needed
It seems that there's a bug at au0828 hardware/firmware
related to alternate setting: when the device is already at
alt 5, a further call causes the URBs to receive -ESHUTDOWN.

I found two different encarnations of this issue:

1) at qv4l2, it fails the second time we try to open the
video screen;
2) at xawtv, when audio underrun occurs, with is very
frequent, at least on my test machine.

The fix is simple: just check if alt=5 before calling
set_usb_interface().

Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-06-19 13:32:03 -03:00
Mauro Carvalho Chehab f2fd7ce6f2 [media] au0828/au8522: Add PAL-M support
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-06-19 13:31:37 -03:00
Mauro Carvalho Chehab 0bf49ec9f7 [media] au0828: add missing tuner Kconfig dependency
The analog part of au0828 is missing the tuner Kconfig dependency.
That makes the device to not work while in analog mode.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-06-19 13:16:49 -03:00
Mauro Carvalho Chehab d44913c1e5 [media] dib8000: export just one symbol
Exporting multiple symbols don't work as it causes compilation
breakages, due to the way dvb_attach() works.

The bug happens when:
        CONFIG_DVB_DIB8000=m
	CONFIG_DVB_USB_DIB0700=y

As a bonus, dib8000 won't be loaded anymore if the device uses
a different frontend, reducing the memory footprint.

Tested with both Pixelview PV-D231 and MyGica S870.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-06-17 12:04:50 -03:00
Mauro Carvalho Chehab b9bc7d59b7 [media] dib8000: rename dib8000_attach to dib8000_init
Well, what we call as "foo_attach" is the method that should
be called by the dvb_attach() macro.

It should be noticed that the name "dvb_attach" is really a
bad name and don't express what it does.

dvb_attach() basically does three things, if the frontend is
compiled as a module:
- It lookups for the module that it is known to have the
  given symbol name and requests such module;
- It increments the module usage (anonymously - so lsmod
  doesn't print who loaded the module);
- after loading the module, it runs the function associated
  with the dynamic symbol.

When compiled as builtin, it just calls the function given to it.

As dvb_attach() increments refcount, it can't be (easily)
called more than once for the same module, or the kernel
will deny to remove the module, because refcount will never
be zeroed.

In other words, the function name given to dvb_attach()
should be one single symbol that will always be called
before any other function on that module to be used.

For almost all DVB frontends, there's just one function,
but, on dib8000, there are several exported symbols.

We need to get rid of all those direct calls, because they
cause compilation breakages when bridge is builtin and
frontend is module, we'll need to add a new function that
will be the first one to be called, whatever initialization
is needed.

So, let's rename this function, in order to prepare for
a next patch that will add a new attach() function that
will be the only one exported by this module.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-06-17 12:04:49 -03:00
Mauro Carvalho Chehab 8abe4a0a3f [media] dib7000: export just one symbol
Exporting multiple symbols don't work as it causes compilation
breakages, due to the way dvb_attach() works.

This were reported several times, like:

   drivers/built-in.o: In function `cxusb_dualdig4_rev2_tuner_attach':
>> cxusb.c:(.text+0x27d4b5): undefined reference to `dib7000p_get_i2c_master'
   drivers/built-in.o: In function `dib7070_set_param_override':
   cxusb.c:(.text+0x27d5a5): undefined reference to `dib0070_wbd_offset'
>> cxusb.c:(.text+0x27d5be): undefined reference to `dib7000p_set_wbd_ref'
   drivers/built-in.o: In function `dib7070_tuner_reset':
>> cxusb.c:(.text+0x27d5f9): undefined reference to `dib7000p_set_gpio'
   drivers/built-in.o: In function `cxusb_dualdig4_rev2_frontend_attach':
>> cxusb.c:(.text+0x27df5c): undefined reference to `dib7000p_i2c_enumeration'

In this specific report:
	CONFIG_DVB_USB_CXUSB=y
	CONFIG_DVB_DIB7000P=m

But the same type of bug can happen if:
	CONFIG_DVB_DIB7000P=m
and one of the bridge drivers is compiled builtin (cxusb, cx23885-dvb
and/or dib0700).

As a bonus, dib7000p won't be loaded anymore if the device uses
a different frontend, reducing the memory footprint.

Tested with Hauppauge Nova-TD (2 frontends).

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-06-17 12:04:49 -03:00
Mauro Carvalho Chehab 7f67d96ab1 [media] dib7000p: rename dib7000p_attach to dib7000p_init
Well, what we call as "foo_attach" is the method that should
be called by the dvb_attach() macro.

It should be noticed that the name "dvb_attach" is really a
bad name and don't express what it does.

dvb_attach() basically does three things, if the frontend is
compiled as a module:
- It lookups for the module that it is known to have the
  given symbol name and requests such module;
- It increments the module usage (anonymously - so lsmod
  doesn't print who loaded the module);
- after loading the module, it runs the function associated
  with the dynamic symbol.

When compiled as builtin, it just calls the function given to it.

As dvb_attach() increments refcount, it can't be (easily)
called more than once for the same module, or the kernel
will deny to remove the module, because refcount will never
be zeroed.

In other words, the function name given to dvb_attach()
should be one single symbol that will always be called
before any other function on that module to be used.

For almost all DVB frontends, there's just one function.

However, the dib7000p initialization can require up to 3
functions to be called:
	- dib7000p_get_i2c_master;
	- dib7000p_i2c_enumeration;
	- dib7000p_init (before this patch dib7000_attach).

(plus a bunch of other functions that the bridge driver will
need to call).

As we need to get rid of all those direct calls, because they
cause compilation breakages when bridge is builtin and
frontend is module, we'll need to add a new function that
will be the first one to be called, whatever initialization
is needed.

So, let's rename the function that probes and init the hardware
to dib7000p_init.

A latter patch will add a new dib7000p_attach that will be
used as originally conceived by dvb_attach() way.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-06-17 12:04:48 -03:00
Malcolm Priestley 3a370222b0 [media] lmedm04: rs2000 check if interrupt urb is over due
Change handling of signal_lock on rs2000. Use ibuf[2] to detect
lock as there is a longer wait for lock to appear in ibuf[6].

Remove last_key and key_timeout and use jiffies plus 60ms
to detect that streaming is still active.

If the current jiffies is time_after the interrupt urb overdue and
clear signal lock.

This results in far faster recovery of lock and streaming.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-06-17 12:04:47 -03:00
Alexey Khoroshilov ebdae6507b [media] usbtv: fix leak at failure path in usbtv_probe()
Error handling code in usbtv_probe() misses usb_put_dev().

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

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Acked-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-06-17 12:04:46 -03:00
Linus Torvalds aaeb255433 Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media into next
Pull media updates from Mauro Carvalho Chehab:
 "This contains:
   - a new frontend/tuner driver set for si2168 and sa2157
   - Videobuf 2 core now supports DVB too
   - A new gspca sub-driver (dtcs033)
   - saa7134 is now converted to use videobuf2
   - add support for 4K timings
   - several other driver fixes and improvements

  PS.  This pull request is shorter than usual, partly because I have
  some other patches on topic branches that I'll be sending you later
  this week"

* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (286 commits)
  [media] au0828-dvb: restore its permission to 644
  [media] xc5000: delay tuner sleep to 5 seconds
  [media] xc5000: Don't use whitespace before tabs
  [media] xc5000: fix CamelCase
  [media] xc5000: Don't wrap msleep()
  [media] xc5000: get rid of positive error codes
  [media] au0828: reset streaming when a new frequency is set
  [media] au0828: Improve debug messages for urb_completion
  [media] au0828: Cancel stream-restart operation if frontend is disconnected
  [media] dib0700: fix RC support on Hauppauge Nova-TD
  [media] USB: as102_usb_drv.c: Remove useless return variables
  [media] v4l: Fix documentation of V4L2_PIX_FMT_H264_MVC and VP8 pixel formats
  [media] m5mols: Replace missing header
  [media] staging: lirc: Fix sparse warnings
  [media] fix mceusb endpoint type identification/handling
  [media] az6027: Added the PID for a new revision of the Elgato EyeTV Sat DVB-S Tuner
  [media] DocBook media: fix typo
  [media] adv7604: Add missing include to linux/types.h
  [media] v4l: Validate fields in the core code for subdev EDID ioctls
  [media] v4l: Add support for DV timings ioctls on subdev nodes
  ...
2014-06-04 14:24:30 -07:00
Mauro Carvalho Chehab a2668e10d7 [media] au0828-dvb: restore its permission to 644
A previous patch mistakenly changed the file permission to 755.
Restore it to 644.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-06-04 15:19:36 -03:00
Linus Torvalds 776edb5931 Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into next
Pull core locking updates from Ingo Molnar:
 "The main changes in this cycle were:

   - reduced/streamlined smp_mb__*() interface that allows more usecases
     and makes the existing ones less buggy, especially in rarer
     architectures

   - add rwsem implementation comments

   - bump up lockdep limits"

* 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (33 commits)
  rwsem: Add comments to explain the meaning of the rwsem's count field
  lockdep: Increase static allocations
  arch: Mass conversion of smp_mb__*()
  arch,doc: Convert smp_mb__*()
  arch,xtensa: Convert smp_mb__*()
  arch,x86: Convert smp_mb__*()
  arch,tile: Convert smp_mb__*()
  arch,sparc: Convert smp_mb__*()
  arch,sh: Convert smp_mb__*()
  arch,score: Convert smp_mb__*()
  arch,s390: Convert smp_mb__*()
  arch,powerpc: Convert smp_mb__*()
  arch,parisc: Convert smp_mb__*()
  arch,openrisc: Convert smp_mb__*()
  arch,mn10300: Convert smp_mb__*()
  arch,mips: Convert smp_mb__*()
  arch,metag: Convert smp_mb__*()
  arch,m68k: Convert smp_mb__*()
  arch,m32r: Convert smp_mb__*()
  arch,ia64: Convert smp_mb__*()
  ...
2014-06-03 12:57:53 -07:00
Mauro Carvalho Chehab f6fef86341 [media] au0828: reset streaming when a new frequency is set
As reported by Trevor, doing several opening/streaming/closing
operations to the demux causes it to fail.

I was able to simulate this bug too. I also noticed that,
sometimes, changing channels with au0828, the same thing
happens.

Most of the issues seem to be due to some hardware bug, that
causes the device to not fill all the URBs allocated. When
the bug happens, the only known fix is to either replug the
device, or to send an USB reset to it.

There's also a hack a the au0828 driver that starts a thread
that tries to reset the device when a package doesn't start
with a sync.

One of the culpits for this bad hardware behavior seem to be
caused by the lack of stopping and restarting the stream every
time a new channel is set.

This patch warrants that the stream will be properly reset
every time the set_frontend callback is called, partially
solving the problem.

A complete fix, however, would also need to check the PM
conditions for the tuner and demux.

Reported-by: Trevor Graffa <tlgraffa@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-25 17:50:02 -03:00
Mauro Carvalho Chehab c35fbd03ae [media] au0828: Improve debug messages for urb_completion
Sometimes, it helps to know how much data was received by
urb_completion. Add that information to the optional debug
log.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-25 17:46:36 -03:00
Changbing Xiong d9e091fe71 [media] au0828: Cancel stream-restart operation if frontend is disconnected
If the tuner is already disconnected, It is meaningless to go on doing the
stream-restart operation, It is better to cancel this operation.

Signed-off-by: Changbing Xiong <cb.xiong@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-25 17:45:55 -03:00
Mauro Carvalho Chehab c4018fa2e4 [media] dib0700: fix RC support on Hauppauge Nova-TD
The RC support o Nova-TD is broken, as the RC endpoint there
is an interrupt endpoint.

That produces an ugly calltrace at the Kernel logs:

	WARNING: CPU: 2 PID: 56 at drivers/usb/core/urb.c:450 usb_submit_urb+0x1fd/0x5c0()
	usb 1-1.2: BOGUS urb xfer, pipe 3 != type 1
	Modules linked in: rc_dib0700_rc5(OF) dvb_usb_dib0700(OF) dib9000(OF) dib8000(OF) dib7000m(OF) dib0090(OF) dib0070(OF) dib7000p(OF) dib3000mc(OF) dibx000_common(OF) dvb_usb(OF) rc_core(OF) snd_usb_audio snd_usbmidi_lib snd_hwdep snd_rawmidi snd_seq snd_seq_device snd_pcm snd_timer snd soundcore bnep bluetooth 6lowpan_iphc rfkill au0828(OF) xc5000(OF) au8522_dig(OF) au8522_common(OF) tveeprom(OF) dvb_core(OF) nouveau i915 mxm_wmi ttm i2c_algo_bit drm_kms_helper drm r8169 mii i2c_core video wmi [last unloaded: au0828]
	CPU: 2 PID: 56 Comm: khubd Tainted: GF          O 3.14.2-200.fc20.x86_64 #1
	Hardware name: SAMSUNG ELECTRONICS CO., LTD. 550P5C/550P7C/SAMSUNG_NP1234567890, BIOS P05ABI.016.130917.dg 09/17/2013
	 0000000000000000 00000000610866bc ffff880223703860 ffffffff816eec92
	 ffff8802237038a8 ffff880223703898 ffffffff8108a1bd ffff8800916a2180
	 ffff8801d5b16000 0000000000000003 0000000000000003 0000000000000020
	Call Trace:
	 [<ffffffff816eec92>] dump_stack+0x45/0x56
	 [<ffffffff8108a1bd>] warn_slowpath_common+0x7d/0xa0
	 [<ffffffff8108a23c>] warn_slowpath_fmt+0x5c/0x80
	 [<ffffffff814e3ebd>] usb_submit_urb+0x1fd/0x5c0
	 [<ffffffffa0445925>] dib0700_rc_setup+0xb5/0x120 [dvb_usb_dib0700]
	 [<ffffffffa0445a58>] dib0700_probe+0xc8/0x130 [dvb_usb_dib0700]
	...

Fix it by detecting if the endpoint is bulk or interrupt.

Tested with both Hauppauge Nova-TD model 52009 (interrupt) and with a
		 Prolink Pixelview SBTVD model PV-D231U (bulk).

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-25 17:44:19 -03:00
Manuel Schönlaub 44f83144ca [media] az6027: Added the PID for a new revision of the Elgato EyeTV Sat DVB-S Tuner
There is another clone of AZ6027. This patch adds the relevant PID.

Signed-off-by: Manuel Schönlaub <manuel.schoenlaub@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-25 15:49:35 -03:00
Ezequiel Garcia 85ac1a1772 [media] media: stk1160: Avoid stack-allocated buffer for control URBs
Currently stk1160_read_reg() uses a stack-allocated char to get the
read control value. This is wrong because usb_control_msg() requires
a kmalloc-ed buffer.

This commit fixes such issue by kmalloc'ating a 1-byte buffer to receive
the read value.

While here, let's remove the urb_buf array which was meant for a similar
purpose, but never really used.

Cc: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Sander Eikelenboom <linux@eikelenboom.it>
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: stable@vger.kernel.org      # for v3.7 and up
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-24 17:12:11 -03:00
Laurent Pinchart 8774bed9ce [media] v4l: subdev: Move [gs]_std operation to video ops
The g_std and s_std operations are video-related, move them to the video
ops where they belong.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-24 17:11:26 -03:00
Luis R. Rodriguez fff287bb22 [media] technisat-usb2: rename led enums to be specific to driver
The current names clash with include/linux/leds.h namespace,
although there is no compile issue currently this does affect
backports. Drivers should also try to avoid generic namespaces
for things like this.

Cc: Felipe Pena <felipensp@gmail.com>
Cc: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-23 19:47:43 -03:00
Mauro Carvalho Chehab f472c0b59f [media] em28xx: make em28xx_free_v4l2 static()
Changeset 95d2608b88 created this function, but declared it as
global, by mistake.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-23 14:29:59 -03:00
Frank Schaefer a5c075cfd2 [media] em28xx: move fields wq_trigger and streaming_started from struct em28xx to struct em28xx_audio
Both wq_trigger and stream_started are used only to control the em28xx
alsa streaming. They don't belong to em28xx common struct.

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 <m.chehab@samsung.com>
2014-05-23 13:44:42 -03:00
Frank Schaefer 3319e6f839 [media] em28xx: remove field tuner_addr from struct em28xx
The tuner address is only used by the v4l submodule and at tuner setup and
can be obtained from the board data directly (if specified).

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 <m.chehab@samsung.com>
2014-05-23 13:43:09 -03:00
Frank Schaefer 6867bd5aa7 [media] em28xx: remove field tda9887_conf from struct em28xx
The tda9887 chipset is part of the analog tuner. Move it out of
em28xx-cards.

Also, it is used only one time by the v4l2 sub-module at tuner setup.

With that, we can get rid of an additional data inside the em28xx
common structure.

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 <m.chehab@samsung.com>
2014-05-23 13:41:56 -03:00
Frank Schaefer 3854b0d847 [media] em28xx: move tuner frequency field from struct em28xx to struct v4l2
Move V4L2-specific frequency cache to struct em28xx_v4l2.

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 <m.chehab@samsung.com>
2014-05-23 13:39:38 -03:00
Frank Schaefer 8139a4d583 [media] em28xx: move v4l2 user counting fields from struct em28xx to struct v4l2
Despite being at the common em28xx struct, those two fields are
actually taking into account only the usage inside em28xx v4l2
submodule. So, move them out of the common struct.

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 <m.chehab@samsung.com>
2014-05-23 13:37:49 -03:00
Frank Schaefer f0e38230b3 [media] em28xx: move capture state tracking fields from struct em28xx to struct v4l2
Move some temporary capture tracking date to the em28xx_v4l2 struct,
as those info are used only by em28xx v4l2 submodule.

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 <m.chehab@samsung.com>
2014-05-23 13:23:36 -03:00
Frank Schaefer d7dc18da63 [media] em28xx: move sensor parameter fields from struct em28xx to struct v4l2
Move camera sensor resolution and xtal out of em28xx common struct,
as thore are used only by the em28xx v4l2 submodule.

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 <m.chehab@samsung.com>
2014-05-23 13:22:06 -03:00
Frank Schaefer 58159171c7 [media] em28xx: move progressive/interlaced fields from struct em28xx to struct v4l2
The video progressive data fields belong to analog TV. Move them out
of the common em28xx struct.

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 <m.chehab@samsung.com>
2014-05-23 13:20:13 -03:00
Frank Schaefer 06e206721c [media] em28xx: move struct em28xx_fmt *format from struct em28xx to struct v4l2
The analog format struct belongs to analog TV. Move it out of the
common em28xx struct.

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 <m.chehab@samsung.com>
2014-05-23 13:19:15 -03:00
Frank Schaefer 52faaf78b5 [media] em28xx: move TV norm from struct em28xx to struct v4l2
TV norm is specific to analog TV reception. move it out of the common
em28xx struct.

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 <m.chehab@samsung.com>
2014-05-23 13:16:54 -03:00
Frank Schaefer 9297285e51 [media] em28xx: move vinmode and vinctrl data from struct em28xx to struct v4l2
The video input mode and control data also belong only to the
analog side. move them to struct em28xx_v4l.

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 <m.chehab@samsung.com>
2014-05-23 13:16:03 -03:00
Frank Schaefer 753aee7738 [media] em28xx: move v4l2 frame resolutions and scale data from struct em28xx to struct v4l2
The em28xx scaler data are used only for analog video. Move them to
struct em28xx_v4l2.

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 <m.chehab@samsung.com>
2014-05-23 13:14:53 -03:00
Frank Schaefer 27a36df63b [media] em28xx: move videobuf2 related data from struct em28xx to struct v4l2
The video and VBI-specific VB2 queue and mutexes are used only by
the v4l2 sub-driver. Move them to the V4L2 struct, preventing
wasting memory if this sub-driver is not used.

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 <m.chehab@samsung.com>
2014-05-23 13:13:35 -03:00
Frank Schaefer ef74a0b9ff [media] em28xx: move video_device structs from struct em28xx to struct v4l2
There are 3 struct video_device at the em28xx common struct,
for video, VBI and radio. They all are used only by the V4L2 driver.
So, move them to the v4l2-specific struct.

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 <m.chehab@samsung.com>
2014-05-23 13:11:59 -03:00
Frank Schaefer 2c52a2fce0 [media] em28xx: move struct v4l2_clk *clk from struct em28xx to struct v4l2
The current clock definition applies only to the V4L2 side of the
driver. Move its struct pointer to the v4l2_dev, where it belongs.

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 <m.chehab@samsung.com>
2014-05-23 13:09:54 -03:00
Frank Schaefer abc1308f0b [media] em28xx: move struct v4l2_ctrl_handler ctrl_handler from struct em28xx to struct v4l2
Controls are only applicable to V4L2 module. Move the corresponding
data structs to the proper place.

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 <m.chehab@samsung.com>
2014-05-23 13:08:01 -03:00
Frank Schaefer 95d2608b88 [media] em28xx: start moving em28xx-v4l specific data to its own struct
That reduces a little bit the memory footprint when em28xx-video
is not loaded.

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 <m.chehab@samsung.com>
2014-05-23 13:06:11 -03:00
Frank Schaefer ad2980557d [media] em28xx-video: simplify usage of the pointer to struct v4l2_ctrl_handler in em28xx_v4l2_init()
The local var hdl is already pointing to &dev->ctrl_handler.
Use it, instead of dereferencing it all the time.

Code cleanup. No functional changes.

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 <m.chehab@samsung.com>
2014-05-23 13:03:54 -03:00
Frank Schaefer 6743033e58 [media] em28xx: move sub-module data structs to a common place in the main struct
Just a cleanup. No functional changes.

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 <m.chehab@samsung.com>
2014-05-23 13:02:21 -03:00
Frank Schaefer aa4ce5f7f3 [media] em28xx: remove the i2c_set_adapdata() call in em28xx_i2c_register()
It is no longer needed since nobody is calling i2c_get_adapdata() anymore.

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 <m.chehab@samsung.com>
2014-05-23 12:56:35 -03:00
Daeseok Youn e21c94e772 [media] s2255drv: fix memory leak s2255_probe()
smatch says:
 drivers/media/usb/s2255/s2255drv.c:2246 s2255_probe() warn:
possible memory leak of 'dev'

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-23 12:19:42 -03:00
Kirill Tkhai 9f6be2bc40 [media] s2255: Do not free fw_data until timer handler has actually stopped using it
Function del_timer() does not guarantee that timer was really deleted.
If the timer handler is beeing executed at the moment, the function
does nothing. So, we have a race between del_timer() and kfree(), and
it's possible to use already freed memory in the handler.

Signed-off-by: Kirill Tkhai <tkhai@yandex.ru>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-23 12:16:39 -03:00
Frank Schaefer 25c61e4cfc [media] em28xx: move norm_maxw() and norm_maxh() from em28xx.h to em28xx-video.c
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 <m.chehab@samsung.com>
2014-05-23 12:11:34 -03:00
Frank Schaefer cba8e9b32d [media] em28xx: remove function em28xx_compression_disable() and its call
em28xx_compression_disable() is a single line function which is called only one
time and this call also isn't needed.
Register 0x26 is always configured as part of the scaler configuration, which
in turn is always done when the resolution changes. And the initial resolution
setting is applied at first device open.

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 <m.chehab@samsung.com>
2014-05-23 12:11:06 -03:00
Frank Schaefer 88d285965c [media] em28xx: remove some unused fields from struct em28xx
Just driver cleanup. No functional changes.

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 <m.chehab@samsung.com>
2014-05-23 12:06:07 -03:00
Frank Schaefer 5869778301 [media] em28xx: fix indenting in em28xx_usb_probe()
No functional changes.

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 <m.chehab@samsung.com>
2014-05-23 12:05:32 -03:00
Olivier Langlois 3b35fc81e7 [media] uvcvideo: Fix clock param realtime setting
timestamps in v4l2 buffers returned to userspace are updated in
uvc_video_clock_update() which uses timestamps fetched from
uvc_video_clock_decode() by calling unconditionally ktime_get_ts().

Hence setting the module clock param to realtime has no effect before
this patch.

This has been tested with ffmpeg:

ffmpeg -y -f v4l2 -input_format yuyv422 -video_size 640x480 -framerate 30 -i /dev/video0 \
 -f alsa -acodec pcm_s16le -ar 16000 -ac 1 -i default \
 -c:v libx264 -preset ultrafast \
 -c:a libfdk_aac \
 out.mkv

and inspecting the v4l2 input starting timestamp.

Cc: Stable <stable@vger.kernel.org>
Signed-off-by: Olivier Langlois <olivier@trillion01.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-23 11:27:37 -03:00
Anton Leontiev f8918ba071 [media] uvcvideo: Fix marking buffer erroneous in case of FID toggling
Set error bit for incomplete buffers when end of buffer is detected by
FID toggling (for example when last transaction with EOF is lost).
This prevents passing incomplete buffers to the userspace.

Signed-off-by: Anton Leontiev <bunder@t-25.ru>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-23 11:25:02 -03:00
Alessandro Miceli 74a86272f0 [media] rtl28xxu: add [1b80:d3af] Sveon STV27
Added support for Sveon STV27 device (rtl2832u + FC0013 tuner)

Signed-off-by: Alessandro Miceli <angelofsky1980@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-13 20:25:47 -03:00
Alessandro Miceli f27f5b0ee4 [media] rtl28xxu: add [1b80:d39d] Sveon STV20
Added Sveon STV20 device based on Realtek RTL2832U and FC0012 tuner

Signed-off-by: Alessandro Miceli <angelofsky1980@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-13 20:25:31 -03:00
Brian Healy 9ca24ae408 [media] rtl28xxu: add 1b80:d395 Peak DVB-T USB
Add USB ID for Peak DVB-T USB.

[crope@iki.fi: fix Brian email address and indentation]
Signed-off-by: Brian Healy <healybrian@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Cc: stable@vger.kernel.org

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-13 20:25:04 -03:00
Hans Verkuil e37559b22c [media] vb2: stop_streaming should return void
The vb2 core ignores any return code from the stop_streaming op.
And there really isn't anything it can do anyway in case of an error.
So change the return type to void and update any drivers that implement it.

The int return gave drivers the idea that this operation could actually
fail, but that's really not the case.

The pwc amd sdr-msi3101 drivers both had this construction:

        if (mutex_lock_interruptible(&s->v4l2_lock))
                return -ERESTARTSYS;

This has been updated to just call mutex_lock(). The stop_streaming op
expects this to really stop streaming and I very much doubt this will
work reliably if stop_streaming just returns without really stopping the
DMA.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Pawel Osciak <pawel@osciak.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-04-23 10:12:51 -03:00
Robert Butora ac9687a2e6 [media] media:gspca:dtcs033 Clean sparse check warnings on endianess
Warnings due to __le16 / u16 conversions.
Replace offending struct and so stay on cpu domain.

Signed-off-by: Robert Butora <robert.butora.fi@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-04-23 10:07:52 -03:00
Antti Palosaari ffb9948e65 [media] em28xx: PCTV tripleStick (292e) LNA support
External LNA between antenna connector and RF tuner is controlled
by EM28178 GPIO 0. GPIO value 1 is LNA active and value 0 is LNA
disabled.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-04-23 09:56:20 -03:00
Antti Palosaari 1922924031 [media] em28xx: add [2013:025f] PCTV tripleStick (292e)
Empia EM28178, Silicon Labs Si2168, Silicon Labs Si2157.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-04-23 09:51:31 -03:00
Peter Zijlstra 4e857c58ef arch: Mass conversion of smp_mb__*()
Mostly scripted conversion of the smp_mb__* barriers.

Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/n/tip-55dhyhocezdw1dg7u19hmh1u@git.kernel.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-arch@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2014-04-18 14:20:48 +02:00
Ismael Luceno ae5fd3d530 [media] gspca_gl860: Clean up idxdata structs
Signed-off-by: Ismael Luceno <ismael.luceno@gmail.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-04-16 18:13:56 -03:00
Robert Butora 30ece903f5 [media] media/usb/gspca: Add support for Scopium astro webcam (0547:7303)
This patch does not modify existing drivers. It adds subdriver
to gspca for DTCS033 (Scopium) webcam for astrophotography.
The patch adds dtcs033.c and modifies Kconfig and Makefile.

Signed-off-by: Robert Butora <robert.butora.fi@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-04-15 10:07:23 -03:00