1
0
Fork 0
Commit Graph

1771 Commits (db744aaa279fa1d2a06dd6b95f9599acf3557885)

Author SHA1 Message Date
Mauro Carvalho Chehab f6f7b58ef0 [media] airspy: fix bit set/clean mess on s->flags
As warned by smatch:
	drivers/media/usb/airspy/airspy.c:541 airspy_start_streaming() warn: test_bit() takes a bit number
	drivers/media/usb/airspy/airspy.c:569 airspy_start_streaming() warn: test_bit() takes a bit number
	drivers/media/usb/airspy/airspy.c:605 airspy_stop_streaming() warn: test_bit() takes a bit number

set_bit/clear_bit argument is the bit number, and not 1 << bit.

Thankfully, one of the bits was not used (URB_BUF), with would
otherwise cause a driver misfunctioning.

Clean this mess by always using set_bit/clear_bit/test_bit and
removing the unused bit.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-03-01 10:48:17 -03:00
Hans de Goede b44d366934 [media] gspca: Remove unused ovfx2_vga_mode/ovfx2_cif_mode arrays
Remove the unused ovfx2_vga_mode/ovfx2_cif_mode arrays from the ov519
driver.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-03-01 10:44:28 -03:00
Wesley Post f7c7ac480d [media] gspca: Fix ov519 i2c r/w not working when connected to a xhci host
Fix the ov519 driver not working (unable to talk to the sensor) when
plugged into a xhci host. The root cause here is that uhci/ohci/ehci
hosts typically will send any pending async requests every milli-second
and then go to sleep for the rest if the milli-second, where as xhci hosts
send them immediately, causing things to go too fast for the ov519 bridge.

This commit adds a few delays fixing this.

Signed-off-by: Wesley Post <pa4wdh@xs4all.nl>
[hdegoede@redhat.com: Also add delays to w996Xcf.c, as that needs them too]
Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-03-01 10:40:14 -03:00
Shuah Khan b19581a94f [media] media: au0828 video change to use v4l_enable_media_source()
Change au0828 to check if tuner is free or not before changing tuner
configuration.

vidioc_g_tuner(), and au0828_v4l2_close() now call v4l-core interface
v4l_enable_media_source() before changing tuner configuration.

Remove au0828_enable_analog_tuner() as it is no longer needed because
v4l2-core implements common interfaces to check for media source
availability.

In addition, queue_setup() no longer needs the tuner availability check
since v4l2-core does it.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-27 09:35:18 -03:00
Shuah Khan c94903f1f7 [media] media: au0828 add enable, disable source handlers
Add enable_source and disable_source handlers. The enable source handler
is called from v4l2-core, dvb-core, and ALSA drivers to check if the
shared media source is free.

The disable source handler is called to release the shared media
source.

[mchehab@osg.samsung.com: fix merge conflicts]

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-27 09:29:20 -03:00
Shuah Khan f90c5d79e5 [media] media: au0828-core register entity_notify hook
Register entity_notify async hook to create links between existing
bridge driver entities and a newly added non-bridge driver entities. For
example, this handler creates link between V4L decoder entity and ALSA
mixer entity.

[mchehab@osg.samsung.com: fix merge conflicts and make
 au0828_media_graph_notify static to shut up a warning]

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-27 09:15:34 -03:00
Shuah Khan b176965176 [media] media: au0828 disable tuner to demod link
Change au0828_create_media_graph() to find and disable
tuner and demod link. This helps avoid an additional
disable step when tuner is requested by video or audio.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-27 09:11:46 -03:00
Shuah Khan 2926d7f445 [media] media: au0828 create tuner to decoder link in disabled state
Create tuner to demod pad link in disabled state to avoid disable step
when tuner resource is requested by dvb.

[mchehab@osg.samsung.com: fix a merge conflict]

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-27 09:09:52 -03:00
Shuah Khan 7b12adf6f5 [media] media: au0828 handle media_init and media_register window
Media device initialization and registration steps are split. There is a
window between media device init and media device register during usb
probe.

au0828 bridge driver and snd-usb-audio could try to initialize the media
device, if they simply checked, whether the device has been registered.
They also need to check whether the device has been initialized.

Change the au0828-core to check if media device is already initialized
during initialization step and check if media device is already
registered during the registration step.

[mchehab@osg.samsung.com: fix a merge conflict]
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-27 09:06:06 -03:00
Shuah Khan 182dde7c5d [media] media: au0828 change to use Managed Media Controller API
Change au0828 to use Managed Media Controller API to share media device
and coordinate creating/deleting the shared media device with the
snd-usb-audio driver. The shared media device is created as device
resource of the parent usb device of the two drivers.

Populate media device model with USB Device product name instead of
au0828 device board name. This change is necessary because, if the media
device is registered by the snd-usb-audio driver first, and it doesn't
know the au0828 board name.

[mchehab@osg.samsung.com: Fix merge conflicts]

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-27 08:55:15 -03:00
Shuah Khan 50512333f2 [media] media: au0828 Use au8522_media_pads enum for pad defines
Change au0828-core to use au8522_media_pads enum defines
instead of hard-coding the pad values.

[mchehab@osg.samsung.com: patch rebased, as the code was
 moved to au0828-video.c. Also added AU8522_PAD_INPUT to the list
 of pad number replacements]

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-27 08:45:43 -03:00
Mauro Carvalho Chehab 2e158d45fe [media] pvrusb2: don't go past buf array
That fixes the following smatch warning:
	drivers/media/usb/pvrusb2/pvrusb2-hdw.c:4909 pvr2_hdw_state_log_state() error: buffer overflow 'buf' 256 <= 4294967294

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-23 07:20:47 -03:00
Mauro Carvalho Chehab 19409c8969 [media] pvrusb2-io: no need to check if sp is not NULL
The buffer_complete() routine assumes that sp is not NULL,
otherwise it will fail completely. Btw, this is also
assumed at pvr2_buffer_queue(), with is the routine that
setups the URB handling.

So, remove the bogus for the callback at buffer_complete.

This fix this smatch warning:
	drivers/media/usb/pvrusb2/pvrusb2-io.c:476 buffer_complete() warn: variable dereferenced before check 'sp' (see line 472)

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-23 07:20:07 -03:00
Mauro Carvalho Chehab 6cf5dad17e [media] media_device: move allocation out of media_device_*_init
Right now, media_device_pci_init and media_device_usb_init does
media_device allocation internaly. That preents its usage when
the media_device struct is embedded on some other structure.

Move memory allocation outside it, to make it more generic.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-23 07:19:39 -03:00
Mauro Carvalho Chehab 41b44e35ba [media] media-device: move PCI/USB helper functions from v4l2-mc
Those ancillary functions could be called even when compiled
without V4L2 support, as warned by ktest build robot:

All errors (new ones prefixed by >>):

>> ERROR: "__v4l2_mc_usb_media_device_init" [drivers/media/usb/dvb-usb/dvb-usb.ko] undefined!
>> ERROR: "__v4l2_mc_usb_media_device_init" [drivers/media/usb/dvb-usb-v2/dvb_usb_v2.ko] undefined!
>> ERROR: "__v4l2_mc_usb_media_device_init" [drivers/media/usb/au0828/au0828.ko] undefined!

Also, there's nothing there that are specific to V4L2. So, move
those ancillary functions to MC core.

No functional changes. Just function rename.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-23 07:18:45 -03:00
Dan Carpenter 76880b4015 [media] usb/cpia2_core: clean up a min_t() cast
It makes sense to make the min_t() cast unsigned here since we don't
really want negative sizes.  Making it signed causes a static checker
warning in Smatch.  Smatch knows "fw->size - i" is positive but it
doesn't know that fw->size is less than INT_MAX so in theory casting it
to int might lead to a negative.

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>
2016-02-19 08:10:32 -02:00
Insu Yun bb07df8ae1 [media] pvrusb2: correctly handling failed thread run
Since kthread_run returns -ENOMEM if failed,
it needs to be checked whether it is error, not whether it is null.

Signed-off-by: Insu Yun <wuninsu@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-19 08:10:32 -02:00
Mauro Carvalho Chehab 3d0ccad0db [media] siano: use generic function to create MC device
Currently, it is initializing the driver name using the wrong
name ("usb"). Use the generic function, as its logic works
best, and avoids repeating the very same code everywhere.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-16 09:30:46 -02:00
Mauro Carvalho Chehab dd47fbd40e [media] smsusb: don't sleep while atomic
smscore_getbuffer() calls internally wait_event(), with can sleep.
As smsusb_onresponse() is called on interrupt context, this causes
the following warning:

	BUG: sleeping function called from invalid context at drivers/media/common/siano/smscoreapi.c:1653
	in_atomic(): 1, irqs_disabled(): 1, pid: 11084, name: systemd-udevd
	INFO: lockdep is turned off.
	irq event stamp: 0
	hardirqs last  enabled at (0): [<          (null)>]           (null)
	hardirqs last disabled at (0): [<ffffffff811480f7>] copy_process.part.7+0x10e7/0x56d0
	softirqs last  enabled at (0): [<ffffffff81148193>] copy_process.part.7+0x1183/0x56d0
	softirqs last disabled at (0): [<          (null)>]           (null)
	CPU: 2 PID: 11084 Comm: systemd-udevd Tainted: G    B   W       4.5.0-rc3+ #47
	Hardware name:                  /NUC5i7RYB, BIOS RYBDWi35.86A.0350.2015.0812.1722 08/12/2015
	 0000000000000000 ffff8803c6907a80 ffffffff81933901 ffff8802bd916000
	 ffff8802bd9165c8 ffff8803c6907aa8 ffffffff811c6af5 ffff8802bd916000
	 ffffffffa0ce9b60 0000000000000675 ffff8803c6907ae8 ffffffff811c6ce5
	Call Trace:
	 <IRQ>  [<ffffffff81933901>] dump_stack+0x85/0xc4
	 [<ffffffff811c6af5>] ___might_sleep+0x245/0x3a0
	 [<ffffffff811c6ce5>] __might_sleep+0x95/0x1a0
	 [<ffffffffa0ce020a>] ? list_add_locked+0xca/0x140 [smsmdtv]
	 [<ffffffffa0ce3b8d>] smscore_getbuffer+0x7d/0x120 [smsmdtv]
	 [<ffffffff8123819d>] ? trace_hardirqs_off+0xd/0x10
	 [<ffffffffa0ce3b10>] ? smscore_sendrequest_and_wait.isra.5+0x120/0x120 [smsmdtv]
	 [<ffffffffa0ce020a>] ? list_add_locked+0xca/0x140 [smsmdtv]
	 [<ffffffffa0ce13ca>] ? smscore_putbuffer+0x3a/0x40 [smsmdtv]
	 [<ffffffffa0d107bc>] smsusb_submit_urb+0x2ec/0x4f0 [smsusb]
	 [<ffffffffa0d10e36>] smsusb_onresponse+0x476/0x720 [smsusb]

Let's add a work queue to handle the bottom half, preventing this
problem.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-16 09:29:34 -02:00
Mauro Carvalho Chehab 22d50e9a48 [media] cx231xx: get rid of CX231XX_VMUX_DEBUG
This macro is not used inside the driver. get rid of it.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-16 08:57:41 -02:00
Mauro Carvalho Chehab 34ac253203 [media] au0828: get rid of AU0828_VMUX_DEBUG
This is not used on the driver. remove it.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-16 08:56:56 -02:00
Mauro Carvalho Chehab 6168309acd [media] cx231xx: create connectors at the media graph
We need to add connectors to the cx231xx graph.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-16 08:55:26 -02:00
Mauro Carvalho Chehab 133bc4e4a3 [media] cx231xx, em28xx: pass media_device to si2157
As si2157 doesn't use the subdev, but has instead a binding
logic that doesn't have any core framework, we need to manually
pass the media_device struct via platform data on every place
it is called.

This fixes support for HVR-955Q when MC is enabled.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-16 08:53:06 -02:00
Mauro Carvalho Chehab 08f4920051 [media] cx231xx: use v4l2 core function to create the MC graph
Instead of having its own routine, use the one defined at the
core, as it is generic enough to handle the cx231xx usecases.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-16 08:50:03 -02:00
Mauro Carvalho Chehab e9ef88bd16 [media] em28xx-dvb: create RF connector on DVB-only mode
When in analog mode, the RF connector will be created by
em28xx-video. However, when the device is in digital mode only,
the RF connector is not shown. In this case, let the DVB
core to create it for us.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-16 08:44:24 -02:00
Mauro Carvalho Chehab 67873d4e75 [media] use v4l2_mc_usb_media_device_init() on most USB devices
Except for the usbuvc driver (with has an embedded media_device
struct on it), the other drivers have a pointer to media_device.

On those drivers, replace their own implementation for the core
one. That warrants that those subdev drivers will fill the
media_device info the same way.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-16 08:43:13 -02:00
Javier Martinez Canillas b802fb99ae [media] tvp5150: move input definition header to dt-bindings
Add a header file for the tvp5150 input connectors constants that
can be shared between the driver and Device Tree source files.

[mchehab@osg.samsung.com: rename tvp5150.h also at em28xx-cards.c]
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-11 11:10:59 -02:00
Mauro Carvalho Chehab 7b606ffd65 [media] au0828: move V4L2-specific code to au0828-core.c
Instead of having lots of #ifdefs inside au0828-core due to
V4L2, move the dependencies to au0828-video.c. That allows
removing all those ifdefs, as au0828-video is only compiled if
CONFIG_VIDEO_AU0828_V4L2.

This fixes the following warnings reported by Kbuild test
with a random config with au0828 enabled, but V4L2 is disabled.

All warnings (new ones prefixed by >>):

   drivers/media/usb/au0828/au0828-core.c: In function 'au0828_usb_probe':
>> drivers/media/usb/au0828/au0828-core.c:463:1: warning: label 'done' defined but not used [-Wunused-label]
    done:
    ^
   drivers/media/usb/au0828/au0828-core.c: At top level:
   drivers/media/usb/au0828/au0828-core.c:250:12: warning: 'au0828_create_media_graph' defined but not used [-Wunused-function]
    static int au0828_create_media_graph(struct au0828_dev *dev)
               ^

Tested with a WinTV HVR 950Q (USB ID: 2040:7200)

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-10 09:08:43 -02:00
Mauro Carvalho Chehab 82e92f4cad [media] au0828: only create V4L2 graph if V4L2 is registered
It doesn't make sense to try to create the analog TV graph,
if the device fails to register at V4L2, or if it doesn't have
V4L2 support.

Thanks to Shuah for pointing this issue.

Reported-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-10 08:03:29 -02:00
Mauro Carvalho Chehab de39078779 [media] em2xx: use v4l2_mc_create_media_graph()
Now that the core has a function to create the media graph,
we can get rid of the specialized code at em28xx.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-10 07:23:41 -02:00
Mauro Carvalho Chehab 7e3e68bcfd [media] dvb_frontend: pass the props cache to get_frontend() as arg
Instead of using the DTV properties cache directly, pass the get
frontend data as an argument. For now, everything should remain
the same, but the next patch will prevent get_frontend to
affect the global cache.

This is needed because several drivers don't care enough to only
change the properties if locked. Due to that, calling
G_PROPERTY before locking on those drivers will make them to
never lock. Ok, those drivers are crap and should never be
merged like that, but the core should not rely that the drivers
would be doing the right thing.

Reviewed-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-04 16:27:30 -02:00
Mauro Carvalho Chehab 6f1bd42612 [media] friio-fe: remove get_frontend() callback
This driver doesn't support getting frontend information and
it only works in automatic mode.

So, let's remove get_frontend() and update the cache at
set_frontend().

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-04 16:27:28 -02:00
Insu Yun 5ce625a42d [media] usbvision: fix locking error
When remove_pending is non-zero, v4l2_lock is never unlocked.

Signed-off-by: Insu Yun <wuninsu@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-02 14:28:56 -02:00
Arnd Bergmann b97baa3e22 [media] hdpvr: hide unused variable
The i2c client pointer is only used when CONFIG_I2C is set, and
otherwise produces a compile-time warning:

drivers/media/usb/hdpvr/hdpvr-core.c: In function 'hdpvr_probe':
drivers/media/usb/hdpvr/hdpvr-core.c:276:21: error: unused variable 'client' [-Werror=unused-variable]

This uses the same #ifdef to hide the variable when the code using
it is hidden.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01 13:14:27 -02:00
Hans de Goede 7445e45d19 [media] pwc: Add USB id for Philips Spc880nc webcam
SPC 880NC PC camera discussions:
	http://www.pclinuxos.com/forum/index.php/topic,135688.0.html

Cc: stable@vger.kernel.org
Reported-by: Kikim <klucznik0@op.pl>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01 10:21:10 -02:00
Antti Palosaari 4c7cad4bbf [media] rtl28xxu: retry failed i2c messages
Sometimes i2c transfer fails. That happens especially when large
amount of data is written sequentially eg. firmware download.
Problem arises with both integrated rtl2832 demod and external
mn88472 demod, which is clear indicator it is busy i2c bus issue.
Use i2c core retry logic in order fix the issue by repeating failed
message. Another solution which also works is to add ~100us delay
between i2c messages - but repeating sounds more elegant and does
not cause any extra delay for success cases.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01 09:20:24 -02:00
Torbjörn Jansson d309c8bb70 [media] dvb-usb-dvbsky: add new product id for TT CT2-4650 CI
Add a new product id to dvb-usb-dvbsky for new version of TechnoTrend CT2-4650 CI

Signed-off-by: Torbjörn Jansson <torbjorn.jansson@mbox200.swipnet.se>
Reviewed-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01 09:06:10 -02:00
Stefan Pöschel b8278f8b96 [media] af9035: add support for 2nd tuner of MSI DigiVox Diversity
PIP tested with VLC. Diversity tested with the Windows driver.

Signed-off-by: Stefan Pöschel <basic.master@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01 09:04:06 -02:00
Philipp Zabel 93b66420a4 [media] dw2102: Add support for Terratec Cinergy S2 USB BOX
The Terratec Cinergy S2 USB BOX uses a Montage M88TS2022 tuner
and a M88DS3103 demodulator, same as Technotrend TT-connect S2-4600.
This patch adds the missing USB Product ID to make it work.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01 09:01:34 -02:00
Jean-Baptiste Theou 9dd73448c6 [media] cx231xx: Fix memory leak
dma_area needs to be freed when the device is closed.

Based on em23xx-audio.c

Signed-off-by: Jean-Baptiste Theou <jtheou@adeneo-embedded.us>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01 08:00:47 -02:00
Julia Lawall 40205163ff [media] drivers/media/usb/dvb-usb-v2: constify mxl111sf_tuner_config structure
This mxl111sf_tuner_config structure is never modified, so declare it as
const.

There are some indentation changes to remain within 80 columns.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Reviewed-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01 07:58:08 -02:00
Insu Yun e22a3b34a1 [media] usbtv: correctly handling failed allocation
Since kzalloc can be failed,
if not properly handled, NULL dereference could be happened.

Signed-off-by: Insu Yun <wuninsu@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01 07:42:00 -02:00
Insu Yun f8433226d1 [media] cx231xx: correctly handling failed allocation
Since kmalloc can be failed in memory pressure,
if not properly handled, NULL dereference can be happend

Signed-off-by: Insu Yun <wuninsu@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01 07:41:37 -02:00
Markus Elfring b68554cd76 [media] hdpvr: Refactoring for hdpvr_read()
Let us return directly if the element "status" of the variable "buf"
indicates "BUFSTAT_READY".
A check repetition can be excluded for the variable "ret" at the end then.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01 07:41:14 -02:00
Markus Elfring 80c1bce9aa [media] au0828: Refactoring for start_urb_transfer()
This issue was detected by using the Coccinelle software.

1. Let us return directly if a buffer allocation failed.

2. Delete the jump label "err" then.

3. Drop the explicit initialisation for the variable "ret"
   at the beginning.

4. Return zero as a constant at the end.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01 07:39:25 -02:00
Ezequiel Garcia faccb05ca8 [media] stk1160: Remove redundant vb2_buf payload set
Calling vb2_set_plane_payload is enough, there's no need to
set the planes[] bytesused field. Remove it.

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01 07:37:20 -02:00
Geliang Tang 03c6bdfc65 [media] bttv-driver, usbvision-video: use to_video_device()
Use to_video_device() instead of open-coding it.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01 07:36:48 -02:00
Nikola Forró 80fa4f07fd [media] usbtv: discard redundant video fields
There are many dropped fields with some sources, leading to many
redundant fields without counterparts. When this redundant field
is odd, a new frame is pushed containing this odd field interleaved
with whatever was left in the buffer, causing video artifacts.

Do not push a new frame after processing every odd field, but do it
only after those which come after an even field.

Signed-off-by: Nikola Forró <nikola.forro@gmail.com>
Acked-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01 07:35:59 -02:00
Julia Lawall ff880348e7 [media] go7007: constify go7007_hpi_ops structures
The go7007_hpi_ops structures are never modified, so declare them as const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01 07:34:07 -02:00
Julia Lawall f691ba9864 [media] drivers/media/usb/as102: constify as102_priv_ops_t structure
The as102_priv_ops_t structure is never modified, so declare it as
const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01 07:31:48 -02:00
Julia Lawall 242c503350 [media] constify stv6110x_devctl structure
The stv6110x_devctl structure is never modified, so declare it as
const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01 07:31:17 -02:00
Mauro Carvalho Chehab 37ecc7b127 [media] em28xx: add media controller support
Add the needed bits to make em28xx to create a media
controller graph.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01 07:29:46 -02:00
Mauro Carvalho Chehab 0962a76332 [media] em28xx: avoid divide by zero error
[ 1841.243670] divide error: 0000 [#1] SMP KASAN
[ 1841.243994] Modules linked in: em28xx_rc rc_core tda18271 drxk em28xx_dvb dvb_core em28xx_alsa mt9v011 em28xx_v4l videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_core em28xx tveeprom v4l2_common videodev media cpufreq_powersave cpufreq_conservative cpufreq_userspace cpufreq_stats parport_pc ppdev lp parport snd_hda_codec_hdmi intel_rapl x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm iTCO_wdt iTCO_vendor_support irqbypass crct10dif_pclmul crc32_pclmul crc32c_intel ghash_clmulni_intel sha256_ssse3 sha256_generic hmac drbg i915 snd_hda_codec_realtek snd_hda_codec_generic aesni_intel aes_x86_64 lrw gf128mul glue_helper ablk_helper cryptd btusb i2c_algo_bit snd_hda_intel btrtl drm_kms_helper btbcm evdev snd_hda_codec btintel psmouse bluetooth pcspkr snd_hwdep sg drm serio_raw
[ 1841.244845]  snd_hda_core snd_pcm mei_me rfkill snd_timer mei snd lpc_ich soundcore shpchp i2c_i801 mfd_core battery dw_dmac i2c_designware_platform i2c_designware_core dw_dmac_core video acpi_pad button tpm_tis tpm ext4 crc16 mbcache jbd2 dm_mod hid_generic usbhid sd_mod ahci libahci libata ehci_pci e1000e xhci_pci ptp scsi_mod ehci_hcd xhci_hcd pps_core fan thermal sdhci_acpi sdhci mmc_core i2c_hid hid [last unloaded: tveeprom]
[ 1841.245342] CPU: 2 PID: 38 Comm: kworker/2:1 Tainted: G        W       4.5.0-rc1+ #43
[ 1841.245413] Hardware name:                  /NUC5i7RYB, BIOS RYBDWi35.86A.0350.2015.0812.1722 08/12/2015
[ 1841.245503] Workqueue: events request_module_async [em28xx]
[ 1841.245557] task: ffff88009df10000 ti: ffff88009df18000 task.ti: ffff88009df18000
[ 1841.245626] RIP: 0010:[<ffffffffa135a0ad>]  [<ffffffffa135a0ad>] size_to_scale+0xed/0x2c0 [em28xx_v4l]
[ 1841.245714] RSP: 0018:ffff88009df1faa8  EFLAGS: 00010246
[ 1841.245756] RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffff8803bb933b38
[ 1841.245815] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff8803bb933b00
[ 1841.245879] RBP: ffff88009df1fad8 R08: ffff8803bb933b3c R09: 1ffff10077726760
[ 1841.245944] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
[ 1841.246006] R13: 0000000000000000 R14: dffffc0000000000 R15: ffff8803b391a130
[ 1841.246071] FS:  0000000000000000(0000) GS:ffff8803c6900000(0000) knlGS:0000000000000000
[ 1841.246141] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1841.246194] CR2: 0000000001d97008 CR3: 00000003bdd85000 CR4: 00000000003406e0
[ 1841.246256] Stack:
[ 1841.246278]  0000000000000246 ffff8803bb9321f0 ffff8803bb932270 ffffffffa136f7a0
[ 1841.246359]  0000000000000000 ffff8803bb932130 ffff88009df1fb20 ffffffffa13646a0
[ 1841.246439]  ffffffffa127f206 ffff8803bb932130 ffff8803bb932130 ffff8803b391a130
[ 1841.246517] Call Trace:
[ 1841.246548]  [<ffffffffa13646a0>] em28xx_set_video_format+0x140/0x1e0 [em28xx_v4l]

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01 07:28:46 -02:00
Mauro Carvalho Chehab 22580f7cb9 [media] em28xx: make sure that the device has video
There are some devices, like Terratec Cinergy HTC, where
while the device supports analog TV, the driver is not
capable yet of handling it, because the analog TV driver
was not written.

So, don't bind the em28xx-v4l drivers on such devices.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01 07:28:17 -02:00
Mauro Carvalho Chehab 41a5e7ea7d [media] em28xx: fix tuner detection for Pixelview Prolink PlayTV USB 2.0
The tuner is at address 0x60. This address is not probed by
default by tuner anymore, so we need to explicitly add it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01 07:27:10 -02:00
Mauro Carvalho Chehab 56a7f51554 [media] em28xx: unregister devices in case of failure
If something bad happens during device registration, unregister
the already registered devices.

Without that, it will have lots of KASAN errors when udev
would try to open the devices.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01 07:26:50 -02:00
Mauro Carvalho Chehab 163c9bca10 [media] tuner.h: rename TUNER_PAD_IF_OUTPUT to TUNER_PAD_OUTPUT
The output of a tuner is not only IF frequencies. They may also
output audio on some of its pins, and may even be a zero-IF tuner,
with outputs a baseband. So, rename the PAD name to make it
clearer and add a proper documentation about that at tuner.h.

No functional changes.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01 07:19:08 -02:00
Mauro Carvalho Chehab d83a96a53d [media] em28xx: remove unused input types
The em28xx driver have lots of different input types but
only 4 of such types are actually used. The others are bogus.

Remove them, in order to cleanup the driver.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01 07:14:57 -02:00
Mauro Carvalho Chehab 13d52fe40f [media] em28xx: fix implementation of s_stream
On em28xx driver, s_stream subdev ops was not implemented
properly. It was used only to disable stream, never enabling it.
That was the root cause of the regression when we added support
for s_stream on tvp5150 driver.

With that, we can get rid of the changes on tvp5150 side,
e. g. changeset 47de9bf893 ('[media] tvp5150: Fix breakage for serial usage').

Tested video output on em2820+tvp5150 on WinTV USB2 and
video and/or vbi output on em288x+tvp5150 on HVR 950.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-26 07:12:54 -02:00
Markus Elfring a73cfe527c [media] msi2500: Delete an unnecessary check in msi2500_set_usb_adc()
This issue was detected by using the Coccinelle software.

Return the value from a call of the msi2500_ctrl_msg() function
without using an extra check for the variable "ret" at the end.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-25 15:15:39 -02:00
Mauro Carvalho Chehab a561d768c1 [media] dw2102: use the new USB ID Terratec Cinergy S2 macros
Now that this was defined at usb-id.h, update the values for
USB_PID_TERRATEC_CINERGY_S2_R1 and USB_PID_TERRATEC_CINERGY_S2_R2.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-25 12:49:24 -02:00
Benjamin Larsson c5d89a49fc [media] Add support for Terratec Cinergy S2 Rev.4
Also Add Terratec Cinergy S2 usb id's

Signed-off-by: Benjamin Larsson <benjamin@southpole.se>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-25 12:43:53 -02:00
Nicolas Sugino 91be260faa [media] dib8000: Add support for Mygica/Geniatech S2870
MyGica/Geniatech S2870 is very similar to the S870 but with dual tuner. The card is recognised as Geniatech STK8096-PVR.

[mchehab@osg.samsung.com: Fix some checkpatch.pl issues]
Signed-off-by: Nicolas Sugino <nsugino@3way.com.ar>

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-25 12:19:23 -02:00
Patrick Boettcher 99e44da792 [media] media: change email address
Soon my dibcom.fr/parrot.com-address won't respond anymore.
Thus I'm replacing it. And, while being at it,
let's adapt some other (old) email-addresses as well.

Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-25 12:01:08 -02:00
Linus Torvalds 77a76b04d2 media updates for v4.5-rc1
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJWlNJNAAoJEAhfPr2O5OEVrVEP/3wGrkzC3ykROabLiuFx6+uN
 fUxMlSnnIwSPsiK7OIP45EHI7PJr2zRLfg4p3X6ABOTBtycziUQGP3ARCcqllrSG
 Tl7KoJokNBTiNRPY2nefC3gB7H36D+TBv3zgpR+vPggr6HGSfc8c6y6sETl/IAvl
 do7EltQ5BUJzgQ9/ZAM/FLBLNSLGexkqeJe7EC5IX0hqJ/tlc1vqIEu2xcdsG1cd
 w1k03C+/ukOr1wfcVmqlh9K2WCPZ59V0c3XcNS+4SeCKH4wnmmf4/BOrAuRFtCjh
 691RuXHXpZKdX1l9TVAmp9CuVvXNDjWdFfNovxVG8POn9TF769zI6t+9rCBSg5Gb
 lzSMOB75/EArOml8sU7gxhEsVsVw9RlukMN7luVwiqPi9vDSPzQw0fzvYkX85Ay3
 TMBW2z1cVjWBvjotTBkSg/rgqetmTgaU04kJ2vIqlfLLd8r/8o5ILZU5WzQtugLJ
 HHipyqG5FZIhXCRmqmr1cEmk+PKP8IA59zKQQG7Z2W+H3rqM6jakc3AxXtJFcz08
 8c4gwXrNBNCWYh9x6e3h0x3p5pdTvrhH0cG9BxWYwaqdCiFZVL+3ZgZB0LmlRc0m
 shJkNAGNX503SqeMQOJnfwEi7Kdeb8mIQBSvM1ZmCrheNwyxtrdJnFkJK3w+q/Tf
 PsycImJtKpskfiXbhqWR
 =6J4t
 -----END PGP SIGNATURE-----

Merge tag 'media/v4.5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media

Pull second batch of media updates from Mauro Carvalho Chehab:
 "This is the second part of the media patches.  It contains the media
  controller next generation patches, with is the result of one year of
  discussions and development.  It also contains patches to enable media
  controller support at the DVB subsystem.

  The goal is to improve the media controller to allow proper support
  for other types of Video4Linux devices (radio and TV ones) and to
  extend the media controller functionality to allow it to be used by
  other subsystems like DVB, ALSA and IIO.

  In order to use the new functionality, a new ioctl is needed
  (MEDIA_IOC_G_TOPOLOGY).  As we're still discussing how to pack the
  struct fields of this ioctl in order to avoid compat32 issues, I
  decided to add a patch at the end of this series commenting out the
  new ioctl, in order to postpone the addition of the new ioctl to the
  next Kernel version (4.6).

  With that, no userspace visible changes should happen at the media
  controller API, as the existing ioctls are untouched.  Yet, it helps
  DVB, ALSA and IIO developers to develop and test the patches adding
  media controller support there, as the core will contain all required
  internal changes to allow adding support for devices that belong to
  those subsystems"

* tag 'media/v4.5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (177 commits)
  [media] Postpone the addition of MEDIA_IOC_G_TOPOLOGY
  [media] mxl111sf: Add a tuner entity
  [media] dvbdev: create links on devices with multiple frontends
  [media] media-entitiy: add a function to create multiple links
  [media] dvb-usb-v2: postpone removal of media_device
  [media] dvbdev: Add RF connector if needed
  [media] dvbdev: remove two dead functions if !CONFIG_MEDIA_CONTROLLER_DVB
  [media] call media_device_init() before registering the V4L2 device
  [media] uapi/media.h: Use u32 for the number of graph objects
  [media] media-entity: don't sleep at media_device_register_entity()
  [media] media-entity: increase max number of PADs
  [media] media-entity.h: document the remaining functions
  [media] media-device.h: use just one u32 counter for object ID
  [media] media-entity.h fix documentation for several parameters
  [media] DocBook: document media_entity_graph_walk_cleanup()
  [media] move documentation to the header files
  [media] media: Move MEDIA_ENTITY_MAX_PADS from media-entity.h to media-entity.c
  [media] media: Remove pre-allocated entity enumeration bitmap
  [media] staging: v4l: davinci_vpbe: Use the new media graph walk interface
  [media] staging: v4l: omap4iss: Use the new media graph walk interface
  ...
2016-01-13 11:46:37 -08:00
Mauro Carvalho Chehab ce084d487c [media] mxl111sf: Add a tuner entity
While mxl111sf may have multiple frontends, it has just one
tuner. Reflect that on the media graph.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:19:26 -02:00
Mauro Carvalho Chehab 33c6853347 [media] dvb-usb-v2: postpone removal of media_device
We should not remove the media_device until its last usage,
or we may have use after free troubles.

So, move the per-adapter media_device removal to happen at
the end of the adapter removal code.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:19:26 -02:00
Mauro Carvalho Chehab 0230d60e46 [media] dvbdev: Add RF connector if needed
Several pure digital TV devices have a frontend with the tuner
integrated on it. Add the RF connector when dvb_create_media_graph()
is called on such devices.

Tested with siano and dvb_usb_mxl111sf drivers.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:19:25 -02:00
Mauro Carvalho Chehab 9f80679511 [media] usb: check media device errors
There are now two new warnings:

drivers/media/usb/dvb-usb-v2/dvb_usb_core.c: In function 'dvb_usbv2_media_device_register':
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c:433:2: warning: ignoring return value of '__media_device_register', declared with attribute warn_unused_result [-Wunused-result]
  media_device_register(adap->dvb_adap.mdev);
  ^
drivers/media/usb/dvb-usb/dvb-usb-dvb.c: In function 'dvb_usb_media_device_register':
drivers/media/usb/dvb-usb/dvb-usb-dvb.c:128:2: warning: ignoring return value of '__media_device_register', declared with attribute warn_unused_result [-Wunused-result]
  media_device_register(adap->dvb_adap.mdev);
  ^

Those are because the drivers are not properly checking if the
media device init and register were succeeded.

Fix it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:19:15 -02:00
Javier Martinez Canillas 9832e155f1 [media] media-device: split media initialization and registration
The media device node is registered and so made visible to user-space
before entities are registered and links created which means that the
media graph obtained by user-space could be only partially enumerated
if that happens too early before all the graph has been created.

To avoid this race condition, split the media init and registration
in separate functions and only register the media device node when
all the pending subdevices have been registered, either explicitly
by the driver or asynchronously using v4l2_async_register_subdev().

The media_device_register() had a check for drivers not filling dev
and model fields but all drivers in mainline set them and not doing
it will be a driver bug so change the function return to void and
add a BUG_ON() for dev being NULL instead.

Also, add a media_device_cleanup() function that will destroy the
graph_mutex that is initialized in media_device_init().

[mchehab@osg.samsung.com: Fix compilation if !CONFIG_MEDIA_CONTROLLER
 and remove two warnings added by this changeset]
Suggested-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:19:15 -02:00
Javier Martinez Canillas 1cb2f6f4b1 [media] uvcvideo: register entity subdev on init
The uvc_mc_register_entities() function iterated over the entities three
times to initialize the entities, register the subdev for the ones whose
type was UVC_TT_STREAMING and to create the entities links.

But this can be simplied by merging the init and registration logic in a
single loop.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:19:09 -02:00
Javier Martinez Canillas 552faf4c08 [media] uvcvideo: remove pads prefix from uvc_mc_create_pads_links()
The function uvc_mc_create_pads_links() creates entities links but the
"pads" prefix is redundant since the driver doesn't handle any other
kind of link, so it can be removed.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:19:09 -02:00
Mauro Carvalho Chehab ab22e77cd3 [media] media framework: rename pads init function to media_entity_pads_init()
With the MC next gen rework, what's left for media_entity_init()
is to just initialize the PADs. However, certain devices, like
a FLASH led/light doesn't have any input or output PAD.

So, there's no reason why calling media_entity_init() would be
mandatory. Also, despite its name, what this function actually
does is to initialize the PADs data. So, rename it to
media_entity_pads_init() in order to reflect that.

The media entity actual init happens during entity register,
at media_device_register_entity(). We should move init of
num_links and num_backlinks to it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:19:03 -02:00
Mauro Carvalho Chehab 4ca72efaef [media] uapi/media.h: Rename entities types to functions
Rename the userspace types from MEDIA_ENT_T_ to MEDIA_ENT_F_
and add the backward compatibility bits.

The changes at the .c files was generated by the following
coccinelle script:

@@
@@
-MEDIA_ENT_T_UNKNOWN
+MEDIA_ENT_F_UNKNOWN
@@
@@
-MEDIA_ENT_T_DVB_BASE
+MEDIA_ENT_F_DVB_BASE
@@
@@
-MEDIA_ENT_T_V4L2_BASE
+MEDIA_ENT_F_V4L2_BASE
@@
@@
-MEDIA_ENT_T_V4L2_SUBDEV_BASE
+MEDIA_ENT_F_V4L2_SUBDEV_BASE
@@
@@
-MEDIA_ENT_T_CONNECTOR_BASE
+MEDIA_ENT_F_CONNECTOR_BASE
@@
@@
-MEDIA_ENT_T_V4L2_VIDEO
+MEDIA_ENT_F_IO_V4L
@@
@@
-MEDIA_ENT_T_V4L2_VBI
+MEDIA_ENT_F_IO_VBI
@@
@@
-MEDIA_ENT_T_V4L2_SWRADIO
+MEDIA_ENT_F_IO_SWRADIO
@@
@@
-MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN
+MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN
@@
@@
-MEDIA_ENT_T_CONN_RF
+MEDIA_ENT_F_CONN_RF
@@
@@
-MEDIA_ENT_T_CONN_SVIDEO
+MEDIA_ENT_F_CONN_SVIDEO
@@
@@
-MEDIA_ENT_T_CONN_COMPOSITE
+MEDIA_ENT_F_CONN_COMPOSITE
@@
@@
-MEDIA_ENT_T_CONN_TEST
+MEDIA_ENT_F_CONN_TEST
@@
@@
-MEDIA_ENT_T_V4L2_SUBDEV_SENSOR
+MEDIA_ENT_F_CAM_SENSOR
@@
@@
-MEDIA_ENT_T_V4L2_SUBDEV_FLASH
+MEDIA_ENT_F_FLASH
@@
@@
-MEDIA_ENT_T_V4L2_SUBDEV_LENS
+MEDIA_ENT_F_LENS
@@
@@
-MEDIA_ENT_T_V4L2_SUBDEV_DECODER
+MEDIA_ENT_F_ATV_DECODER
@@
@@
-MEDIA_ENT_T_V4L2_SUBDEV_TUNER
+MEDIA_ENT_F_TUNER
@@
@@
-MEDIA_ENT_T_DVB_DEMOD
+MEDIA_ENT_F_DTV_DEMOD
@@
@@
-MEDIA_ENT_T_DVB_DEMUX
+MEDIA_ENT_F_TS_DEMUX
@@
@@
-MEDIA_ENT_T_DVB_TSOUT
+MEDIA_ENT_F_IO_DTV
@@
@@
-MEDIA_ENT_T_DVB_CA
+MEDIA_ENT_F_DTV_CA
@@
@@
-MEDIA_ENT_T_DVB_NET_DECAP
+MEDIA_ENT_F_DTV_NET_DECAP

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:19:01 -02:00
Mauro Carvalho Chehab 0e576b76f5 [media] media-entity.h: rename entity.type to entity.function
Entities should have one or more functions. Calling it as a
type proofed to not be correct, as an entity could eventually
have more than one type.

So, rename the field as function.

Please notice that this patch doesn't extend support for
multiple function entities. Such change will happen when
we have real case drivers using it.

No functional changes.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:19:00 -02:00
Mauro Carvalho Chehab 4e26f3abaf [media] au0828: enforce check for graph creation
If the graph creation fails, don't register the device.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:19:00 -02:00
Mauro Carvalho Chehab ab232e46bf [media] cx231xx: enforce check for graph creation
If the graph creation fails, don't register the device.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:59 -02:00
Mauro Carvalho Chehab 0d3ab8410d [media] dvb core: must check dvb_create_media_graph()
If media controller is enabled and mdev is filled, it should
ensure that the media graph will be properly initialized.

Enforce that.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:59 -02:00
Mauro Carvalho Chehab 28b6ba1106 [media] au0828: Create connector links
Now that connectors are entities, we need to represent the
connector links.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:58 -02:00
Mauro Carvalho Chehab d1f337375a [media] au0828: add support for the connectors
Depending on the input, an au0828 may have a different
number of connectors. add entities to represent them.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:58 -02:00
Mauro Carvalho Chehab 7e9a8ad57c [media] au0828: postpone call to au0828_unregister_media_device()
The DVB core needs to unregister the media device. So, we
can't call au0828_unregister_media_device() before calling
au0828_dvb_unregister(), otherwise the DVB MC free code
(that will be implemented on the next patch) will fail.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:56 -02:00
Mauro Carvalho Chehab 188d2d5512 [media] tuner-core: add an input pad
Tuners actually have at least one connector on its input.

Add a PAD to connect it.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:55 -02:00
Mauro Carvalho Chehab 57208e5e25 [media] media: convert links from array to list
The entire logic that represent graph links were developed on a
time where there were no needs to dynamic remove links. So,
although links are created/removed one by one via some
functions, they're stored as an array inside the entity struct.

As the array may grow, there's a logic inside the code that
checks if the amount of space is not enough to store
the needed links. If it isn't the core uses krealloc()
to change the size of the link, with is bad, as it
leaves the memory fragmented.

So, convert links into a list.

Also, currently,  both source and sink entities need the link
at the graph traversal logic inside media_entity. So there's
a logic duplicating all links. That makes it to spend
twice the memory needed. This is not a big deal for today's
usage, where the number of links are not big.

Yet, if during the MC workshop discussions, it was said that
IIO graphs could have up to 4,000 entities. So, we may
want to remove the duplication on some future. The problem
is that it would require a separate linked list to store
the backlinks inside the entity, or to use a more complex
algorithm to do graph backlink traversal, with is something
that the current graph traversal inside the core can't cope
with. So, let's postpone a such change if/when it is actually
needed.

It should also be noticed that the media_link structure uses
44 bytes on 32-bit architectures and 84 bytes on 64-bit
architecture. It will thus be allocated out of the 64-bytes and
96-bytes pools respectively. That's a 12.5% memory waste on
64-bit architectures and 31.25% on 32-bit architecture.
A linked list is less efficient than an array in this case, but
this could later be optimized if we can get rid of the reverse
links (with would reduce memory allocation by 50%).

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:46 -02:00
Javier Martinez Canillas c5a98cac6e [media] uvcvideo: create pad links after subdev registration
The uvc driver creates the pads links before the media entity is
registered with the media device. This doesn't work now that obj
IDs are used to create links so the media_device has to be set.

Move entities registration logic before pads links creation.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:46 -02:00
Mauro Carvalho Chehab 8df00a1581 [media] media: rename the function that create pad links
With the new API, a link can be either between two PADs or between an interface
and an entity. So, we need to use a better name for the function that create
links between two pads.

So, rename the such function to media_create_pad_link().

No functional changes.

This patch was created via this shell script:
	for i in $(find drivers/media -name '*.[ch]' -type f) $(find drivers/staging/media -name '*.[ch]' -type f) $(find include/ -name '*.h' -type f) ; do sed s,media_entity_create_link,media_create_pad_link,g <$i >a && mv a $i; done

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:43 -02:00
Mauro Carvalho Chehab 20fe0319de [media] au0828: Fix the logic that enables the analog demoder link
This logic was broken on the original patch, likely due to a
cut-and-paste mistake.

Fix it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:40 -02:00
Mauro Carvalho Chehab 1809510715 [media] media: get rid of unused "extra_links" param on media_entity_init()
Currently, media_entity_init() creates an array with the links,
allocated at init time. It provides a parameter (extra_links)
that would allocate more links than the current needs, but this
is not used by any driver.

As we want to be able to do dynamic link allocation/removal,
we'll need to change the implementation of the links. So,
before doing that, let's first remove that extra unused
parameter, in order to cleanup the interface first.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:39 -02:00
Mauro Carvalho Chehab 0158e7b6a2 [media] au0828: Cache the decoder info at au0828 dev structure
Instead of seeking for the decoder every time analog stream is
started, cache it. This simplifies the code a little bit.

Requested-by: Hans Verkuil <hverkuil@xs4all.nl>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:39 -02:00
Rafael Lourenço de Lima Chehab bed6919665 [media] au0828: Add support for media controller
Add support for analog and dvb tv using media controller.

Signed-off-by: Rafael Lourenço de Lima Chehab <chehabrafael@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:39 -02:00
Mauro Carvalho Chehab c3152592e7 Merge branch 'patchwork' into v4l_for_linus
* patchwork: (204 commits)
  [media] rc: sunxi-cir: Initialize the spinlock properly
  [media] rtl2832: do not filter out slave TS null packets
  [media] rtl2832: print reg number on error case
  [media] rtl28xxu: return demod reg page from driver cache
  [media] coda: enable MPEG-2 ES decoding
  [media] coda: don't start streaming without queued buffers
  [media] coda: hook up vidioc_prepare_buf
  [media] coda: relax coda_jpeg_check_buffer for trailing bytes
  [media] coda: make to_coda_video_device static
  [media] s5p-mfc: remove volatile attribute from MFC register addresses
  [media] s5p-mfc: merge together s5p_mfc_hw_call and s5p_mfc_hw_call_void
  [media] s5p-mfc: use spinlock to protect MFC context
  [media] s5p-mfc: remove unnecessary callbacks
  [media] s5p-mfc: make queue cleanup code common
  [media] s5p-mfc: use one implementation of s5p_mfc_get_new_ctx
  [media] s5p-mfc: constify s5p_mfc_codec_ops structures
  [media] au8522: Avoid memory leak for device config data
  [media] ir-lirc-codec.c: don't leak lirc->drv-rbuf
  [media] uvcvideo: small cleanup in uvc_video_clock_update()
  [media] uvcvideo: Fix reading the current exposure value of UVC
  ...
2016-01-11 11:13:27 -02:00
Antti Palosaari 31d60f1bc5 [media] rtl28xxu: return demod reg page from driver cache
Return current active rtl2830/rtl2832 register page from the driver
cache in order to reduce I2C I/O. Register page is already cached
due to I2C write needs.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-23 14:11:02 -02:00
Antti Palosaari aa0850e1d5 [media] airspy: increase USB control message buffer size
Driver requested device firmware version string during probe using
only 24 byte long buffer. That buffer is too small for newer firmware
versions, which causes device firmware hang - device stops responding
to any commands after that. Increase buffer size to 128 which should
be enough for any current and future version strings.

Link: https://github.com/airspy/host/issues/27

Cc: <stable@vger.kernel.org> # 3.17+
Reported-by: Benjamin Vernoux <bvernoux@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 15:25:29 -02:00
Antti Palosaari d47fa5315c [media] hackrf: move RF gain ctrl enable behind module parameter
Used Avago MGA-81563 RF amplifier could be destroyed pretty easily
with too strong signal or transmitting to bad antenna.
Add module parameter 'enable_rf_gain_ctrl' which allows enabling
RF gain control - otherwise, default without the module parameter,
RF gain control is set to 'grabbed' state which prevents setting
value to the control.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 15:25:29 -02:00
Antti Palosaari eb35cf47c3 [media] hackrf: fix possible null ptr on debug printing
drivers/media/usb/hackrf/hackrf.c:1533 hackrf_probe()
error: we previously assumed 'dev' could be null (see line 1366)

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 15:25:29 -02:00
Dan Carpenter 0aff8a894a [media] uvcvideo: small cleanup in uvc_video_clock_update()
Smatch is not smart enough to see that "&stream->clock.lock" and
"&clock->lock" are the same thing so it complains about the locking
here.  Let's make it more consistent.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 15:21:35 -02:00
Anton V. Shokurov 1ab8c3fc75 [media] uvcvideo: Fix reading the current exposure value of UVC
V4L2_CID_EXPOSURE_ABSOLUTE property does not return an updated value when
autoexposure (V4L2_CID_EXPOSURE_AUTO) is turned on. This patch fixes this
issue by adding the UVC_CTRL_FLAG_AUTO_UPDATE flag.

Tested on a C920 camera.

Signed-off-by: Anton V. Shokurov <shokurov.anton.v@yandex.ru>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 15:21:34 -02:00
Junghak Sung d6dd645eae [media] media: videobuf2: Move timestamp to vb2_buffer
Move timestamp from struct vb2_v4l2_buffer to struct vb2_buffer
for common use, and change its type to u64 in order to handling
y2038 problem. This patch also includes all device drivers' changes related to
this restructuring.

Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 13:53:31 -02:00
Hans Verkuil df9ecb0cad [media] vb2: drop v4l2_format argument from queue_setup
The queue_setup callback has a void pointer that is just for V4L2
and is the pointer to the v4l2_format struct that was passed to
VIDIOC_CREATE_BUFS. The idea was that drivers would use the information
from that struct to buffers suitable for the requested format.

After the vb2 split series this pointer is now a void pointer,
which is ugly, and the reality is that all existing drivers will
effectively just look at the sizeimage field of v4l2_format.

To make this more generic the queue_setup callback is changed:
the void pointer is dropped, instead if the *num_planes argument
is 0, then use the current format size, if it is non-zero, then
it contains the number of requested planes and the sizes array
contains the requested sizes. If either is unsupported, then return
-EINVAL, otherwise use the requested size(s).

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 13:48:19 -02:00
Hans Verkuil e25cb20013 [media] cx231xx: fix NTSC cropcap, add missing cropcap for 417
The pixelaspect ratio was set incorrectly for 60Hz formats.
And since cropcap wasn't implemented at all for the -417 (compressed
video) the pixelaspect was unknown for compressed video.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 13:29:49 -02:00
Mauro Carvalho Chehab 52d60eb7e6 Revert "[media] UVC: Add support for ds4 depth camera"
This reverts commit 120c41d347.

The patch doesn't add the corresponding documentation bits to the
media infrastructure uAPI DocBook. Also, they're for 3D formats,
with requre further discussions.

Requested-by: Hans Verkuil <hverkuil@xs4all.nl>
Requested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-12-12 08:10:40 -02:00
Mauro Carvalho Chehab 991ce92f8d [media] use https://linuxtv.org for LinuxTV URLs
While https was always supported on linuxtv.org, only in
Dec 3 2015 the website is using valid certificates.

As we're planning to drop pure http support on some
future, change all references at the media subsystem
to point to the https URL instead.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-04 10:38:59 -02:00
Aviv Greenberg 120c41d347 [media] UVC: Add support for ds4 depth camera
Add support for Intel DS4 depth camera in uvc driver.
This includes adding new uvc GUIDs for the new pixel formats,
adding new V4L pixel format definition to user api headers,
and updating the uvc driver GUID-to-4cc tables with the new formats.

Change-Id: If240d95a7d4edc8dcc3e02d58cd8267a6bbf6fcb

Tested-by: Greenberg, Aviv D <aviv.d.greenberg@intel.com>
Signed-off-by: Aviv Greenberg <aviv.d.greenberg@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-03 11:37:44 -02:00
Julia Lawall 083206fc3f [media] cx231xx: constify cx2341x_handler_ops structures
The cx2341x_handler_ops structures are never modified, so declare them as
const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-03 11:27:08 -02:00
Hans Verkuil 85f9e06c59 [media] v4l2-dv-timings: add new arg to v4l2_match_dv_timings
Add the new match_reduced_fps argument to v4l2_match_dv_timings().
Depending on the situation you may or may not desire to match the
reduced_fps flag. Typically only HDMI transmitters will need to
check for this flag.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-03 11:26:14 -02:00
Vladis Dronov fa52bd506f [media] usbvision: fix crash on detecting device with invalid configuration
The usbvision driver crashes when a specially crafted usb device with invalid
number of interfaces or endpoints is detected. This fix adds checks that the
device has proper configuration expected by the driver.

Reported-by: Ralf Spenneberg <ralf@spenneberg.net>
Signed-off-by: Vladis Dronov <vdronov@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 11:36:02 -02:00
Arno Bauernöppel 1efc21701d [media] Add support for dvb usb stick Hauppauge WinTV-soloHD
This patch adds support for the DVB-T/C/T2 usb stick WinTV-soloHD from
Hauppauge. It adds the usb ID 2040:0264 Hauppauge to the cards of the
driver em28xx.

I successfully tested DVB-T/C and the IR remote control with the
firmware dvb-demod-si2168-b40-01.fw.

Signed-off-by: Arno Bauernoeppel <arno@aziraphale.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 11:34:32 -02:00
Matthias Schwarzott 599bedb7d1 [media] cx231xx_dvb: use demod_i2c for demod attach
Tested:
* CX231XX_BOARD_HAUPPAUGE_930C_HD_1113xx
* CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx

Not Tested:
* CX231XX_BOARD_HAUPPAUGE_EXETER
* CX231XX_BOARD_HAUPPAUGE_955Q

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 11:23:06 -02:00
Julia Lawall 9bca62661e [media] ttusb-dec: constify ttusbdecfe_config structure
The ttusbdecfe_config structure is never modified, so declare it
as const.

Other references to this structure type were already declared as const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 11:22:15 -02:00
Julia Lawall 9c5e44a076 [media] drivers/media/usb/dvb-usb-v2: constify mxl111sf_demod_config structure
The mxl111sf_demod_config structure is never modified, so declare it
as const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Reviewed-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 11:20:18 -02:00
Laurent Pinchart 8afe97be37 [media] uvcvideo: Enable UVC 1.5 device detection
UVC 1.5 devices report a bInterfaceProtocol value set to 1 in their
interface descriptors. The uvcvideo driver only matches on
bInterfaceProtocol 0, preventing those devices from being detected.

More changes to the driver are needed for full UVC 1.5 compatibility.
However, at least the UVC 1.5 Microsoft Surface Pro 3 cameras have been
reported to work out of the box with the driver with an updated match
table.

Enable UVC 1.5 support in the match table to support the devices that
can work with the current driver implementation. Devices that can't will
fail, but that's hardly a regression as they're currently not detected
at all anyway.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 11:13:19 -02:00
Alberto Mardegan 8c47311d34 [media] em28xx: add Terratec Cinergy T XS (MT2060)
The Terratec Cinergy T XS is a DVB-T receiver with no analog TV tuner.
This patch adds support for the cards carrying the mt2060 tuner; it's
unclear whether there are cards sold under the same name which use a
different tuner.
As long as there are no reports of such cards, and indeed as long as
there are no working drivers for them, we assume that the USB device
[0ccd:0043] is carrying the mt2060 tuner.

Signed-off-by: Alberto Mardegan <mardy@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 09:29:16 -02:00
Christian Engelmayer b771852270 [media] as102: fix potential double free in as102_fw_upload()
In case the request to locate the firmware file part 2 fails, the error
path releases the already freed firmware memory location again. Thus
reset the firmware pointer to NULL after releasing firmware file part 1.

Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 09:16:10 -02:00
Insu Yun 997f69fb4a [media] mxl111sf: missing return values validation
Return values of mxl111sf_enable_usb_output and mxl1x1sf_top_master_ctrl
are not validated.

Signed-off-by: Insu Yun <wuninsu@gmail.com>
Reviewed-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 08:15:02 -02:00
Josh Wu 3d83078a08 [media] v4l2-clk: add new definition: V4L2_CLK_NAME_SIZE
Make all v4l2-clk's clock name use V4L2_CLK_NAME_SIZE definition.

In future, if the string is increased we just need to change the
V4L2_CLK_NAME_SIZE once.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 15:19:11 -02:00
Oliver Neukum 588afcc1c0 [media] usbvision fix overflow of interfaces array
This fixes the crash reported in:
http://seclists.org/bugtraq/2015/Oct/35
The interface number needs a sanity check.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Cc: Vladis Dronov <vdronov@redhat.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 14:56:31 -02:00
Kosuke Tatsukawa 5063452ecb [media] media: fix waitqueue_active without memory barrier in cpia2 driver
cpia2_usb_disconnect() seems to be missing a memory barrier which might
cause the waker to not notice the waiter and miss sending a wake_up as
in the following figure.

	cpia2_usb_disconnect			sync
------------------------------------------------------------------------
					mutex_unlock(&cam->v4l2_lock);
if (waitqueue_active(&cam->wq_stream))
/* The CPU might reorder the test for
   the waitqueue up here, before
   prior writes complete */
					/* wait_event_interruptible */
					 /* __wait_event_interruptible */
					  /* ___wait_event */
					  long __int = prepare_to_wait_event(
					    &wq, &__wait, state);
					  if (!cam->streaming ||
					    frame->status == FRAME_READY)
cam->curbuff->status = FRAME_READY;
cam->curbuff->length = 0;
					  schedule()
------------------------------------------------------------------------

The attached patch removes the call to waitqueue_active() leaving just
wake_up() behind.  This fixes the problem because the call to
spin_lock_irqsave() in wake_up() will be an ACQUIRE operation.

I found this issue when I was looking through the linux source code
for places calling waitqueue_active() before wake_up*(), but without
preceding memory barriers, after sending a patch to fix a similar
issue in drivers/tty/n_tty.c  (Details about the original issue can be
found here: https://lkml.org/lkml/2015/9/28/849).

Signed-off-by: Kosuke Tatsukawa <tatsu@ab.jp.nec.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 14:55:06 -02:00
Antonio Ospite dcc7fdbec5 [media] gspca: ov534/topro: prevent a division by 0
v4l2-compliance sends a zeroed struct v4l2_streamparm in
v4l2-test-formats.cpp::testParmType(), and this results in a division by
0 in some gspca subdrivers:

  divide error: 0000 [#1] SMP
  Modules linked in: gspca_ov534 gspca_main ...
  CPU: 0 PID: 17201 Comm: v4l2-compliance Not tainted 4.3.0-rc2-ao2 #1
  Hardware name: System manufacturer System Product Name/M2N-E SLI, BIOS
    ASUS M2N-E SLI ACPI BIOS Revision 1301 09/16/2010
  task: ffff8800818306c0 ti: ffff880095c4c000 task.ti: ffff880095c4c000
  RIP: 0010:[<ffffffffa079bd62>]  [<ffffffffa079bd62>] sd_set_streamparm+0x12/0x60 [gspca_ov534]
  RSP: 0018:ffff880095c4fce8  EFLAGS: 00010296
  RAX: 0000000000000000 RBX: ffff8800c9522000 RCX: ffffffffa077a140
  RDX: 0000000000000000 RSI: ffff880095e0c100 RDI: ffff8800c9522000
  RBP: ffff880095e0c100 R08: ffffffffa077a100 R09: 00000000000000cc
  R10: ffff880067ec7740 R11: 0000000000000016 R12: ffffffffa07bb400
  R13: 0000000000000000 R14: ffff880081b6a800 R15: 0000000000000000
  FS:  00007fda0de78740(0000) GS:ffff88012fc00000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 00000000014630f8 CR3: 00000000cf349000 CR4: 00000000000006f0
  Stack:
   ffffffffa07a6431 ffff8800c9522000 ffffffffa077656e 00000000c0cc5616
   ffff8800c9522000 ffffffffa07a5e20 ffff880095e0c100 0000000000000000
   ffff880067ec7740 ffffffffa077a140 ffff880067ec7740 0000000000000016
  Call Trace:
   [<ffffffffa07a6431>] ? v4l_s_parm+0x21/0x50 [videodev]
   [<ffffffffa077656e>] ? vidioc_s_parm+0x4e/0x60 [gspca_main]
   [<ffffffffa07a5e20>] ? __video_do_ioctl+0x280/0x2f0 [videodev]
   [<ffffffffa07a5ba0>] ? video_ioctl2+0x20/0x20 [videodev]
   [<ffffffffa07a59b9>] ? video_usercopy+0x319/0x4e0 [videodev]
   [<ffffffff81182dc1>] ? page_add_new_anon_rmap+0x71/0xa0
   [<ffffffff811afb92>] ? mem_cgroup_commit_charge+0x52/0x90
   [<ffffffff81179b18>] ? handle_mm_fault+0xc18/0x1680
   [<ffffffffa07a15cc>] ? v4l2_ioctl+0xac/0xd0 [videodev]
   [<ffffffff811c846f>] ? do_vfs_ioctl+0x28f/0x480
   [<ffffffff811c86d4>] ? SyS_ioctl+0x74/0x80
   [<ffffffff8154a8b6>] ? entry_SYSCALL_64_fastpath+0x16/0x75
  Code: c7 93 d9 79 a0 5b 5d e9 f1 f3 9a e0 0f 1f 00 66 2e 0f 1f 84 00
    00 00 00 00 66 66 66 66 90 53 31 d2 48 89 fb 48 83 ec 08 8b 46 10 <f7>
    76 0c 80 bf ac 0c 00 00 00 88 87 4e 0e 00 00 74 09 80 bf 4f
  RIP  [<ffffffffa079bd62>] sd_set_streamparm+0x12/0x60 [gspca_ov534]
   RSP <ffff880095c4fce8>
  ---[ end trace 279710c2c6c72080 ]---

Following what the doc says about a zeroed timeperframe (see
http://www.linuxtv.org/downloads/v4l-dvb-apis/vidioc-g-parm.html):

  ...
  To reset manually applications can just set this field to zero.

fix the issue by resetting the frame rate to a default value in case of
an unusable timeperframe.

The fix is done in the subdrivers instead of gspca.c because only the
subdrivers have notion of a default frame rate to reset the camera to.

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Cc: stable@vger.kernel.org
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 14:54:25 -02:00
Terry Heo ce3556bde3 [media] cx231xx: fix bulk transfer mode
The current cx231xx driver doesn't work with bulk transfer mode.
This patch makes it possible to use bulk transfer mode.

Signed-off-by: Terry Heo <terryheo@google.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 14:53:41 -02:00
Ricardo Ribalda 082afb7c4e [media] media/usb/pvrusb2: Support for V4L2_CTRL_WHICH_DEF_VAL
This driver does not use the control infrastructure.
Add support for the new field which on structure
 v4l2_ext_controls

Acked-by: Mike Isely <isely@pobox.com>
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 14:46:44 -02:00
Ricardo Ribalda 91739838a5 [media] usb/uvc: Support for V4L2_CTRL_WHICH_DEF_VAL
This driver does not use the control infrastructure.
Add support for the new field which on structure
 v4l2_ext_controls

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 14:46:21 -02:00
Hans Verkuil ba463988a0 [media] go7007: fix broken test
The wrong flags field was tested for the GO7007_BOARD_HAS_AUDIO flag: that
flag is in board->main_info.flags, not in board->flags.

Reported-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>
2015-11-17 14:33:41 -02:00
Mauro Carvalho Chehab d647f0b70c [media] include/media: move driver interface headers to a separate dir
Let's not mix headers used by the core with those headers that
are needed by some driver-specific interface header.

The headers used on drivers were manually moved using:
    mkdir include/media/drv-intf/
    git mv include/media/cx2341x.h include/media/cx25840.h \
	include/media/exynos-fimc.h include/media/msp3400.h \
	include/media/s3c_camif.h include/media/saa7146.h \
	include/media/saa7146_vv.h  include/media/sh_mobile_ceu.h \
	include/media/sh_mobile_csi2.h include/media/sh_vou.h \
	include/media/si476x.h include/media/soc_mediabus.h \
	include/media/tea575x.h include/media/drv-intf/

And the references for those headers were corrected using:

    MAIN_DIR="media/"
    PREV_DIR="media/"
    DIRS="drv-intf/"

    echo "Checking affected files" >&2
    for i in $DIRS; do
	for j in $(find include/$MAIN_DIR/$i -type f -name '*.h'); do
		 n=`basename $j`
		git grep -l $n
	done
    done|sort|uniq >files && (
	echo "Handling files..." >&2;
	echo "for i in \$(cat files|grep -v Documentation); do cat \$i | \\";
	(
		cd include/$MAIN_DIR;
		for j in $DIRS; do
			for i in $(ls $j); do
				echo "perl -ne 's,(include [\\\"\\<])$PREV_DIR($i)([\\\"\\>]),\1$MAIN_DIR$j\2\3,; print \$_' |\\";
			done;
		done;
		echo "cat > a && mv a \$i; done";
	);
	echo "Handling documentation..." >&2;
	echo "for i in MAINTAINERS \$(cat files); do cat \$i | \\";
	(
		cd include/$MAIN_DIR;
		for j in $DIRS; do
			for i in $(ls $j); do
				echo "  perl -ne 's,include/$PREV_DIR($i)\b,include/$MAIN_DIR$j\1,; print \$_' |\\";
			done;
		done;
		echo "cat > a && mv a \$i; done"
	);
    ) >script && . ./script

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
2015-11-17 06:57:29 -02:00
Mauro Carvalho Chehab b5dcee225c [media] include/media: split I2C headers from V4L2 core
Currently, include/media is messy, as it contains both the V4L2 core
headers and some driver-specific headers on the same place. That makes
harder to identify what core headers should be documented and what
headers belong to I2C drivers that are included only by bridge/main
drivers that would require the functions provided by them.

Let's move those i2c specific files to its own subdirectory.

The files to move were produced via the following script:
	mkdir include/media/i2c
	(cd include/media; for i in *.h; do n=`echo $i|sed s/.h$/.c/`; if [ -e ../../drivers/media/i2c/$n ]; then echo $i; git mv $i i2c/; fi; done)
	(cd include/media; for i in *.h; do n=`echo $i|sed s/.h$/.c/`; if [ -e ../../drivers/media/*/i2c/$n ]; then echo $i; git mv $i i2c/; fi; done)
	for i in include/media/*.h; do n=`basename $i`;  (for j in $(git grep -l $n); do dirname $j; done)|sort|uniq|grep -ve '^.$' > list; num=$(wc -l list|cut -d' ' -f1); if [ $num == 1 ]; then if [ "`grep i2c list`" != "" ]; then git mv $i include/media/i2c; fi; fi; done

And the references corrected via this script:
    MAIN_DIR="media/"
    PREV_DIR="media/"
    DIRS="i2c/"

    echo "Checking affected files" >&2
    for i in $DIRS; do
	for j in $(find include/$MAIN_DIR/$i -type f -name '*.h'); do
		 n=`basename $j`
		git grep -l $n
	done
    done|sort|uniq >files && (
	echo "Handling files..." >&2;
	echo "for i in \$(cat files|grep -v Documentation); do cat \$i | \\";
	(
		cd include/$MAIN_DIR;
		for j in $DIRS; do
			for i in $(ls $j); do
				echo "perl -ne 's,(include [\\\"\\<])$PREV_DIR($i)([\\\"\\>]),\1$MAIN_DIR$j\2\3,; print \$_' |\\";
			done;
		done;
		echo "cat > a && mv a \$i; done";
	);
	echo "Handling documentation..." >&2;
	echo "for i in MAINTAINERS \$(cat files); do cat \$i | \\";
	(
		cd include/$MAIN_DIR;
		for j in $DIRS; do
			for i in $(ls $j); do
				echo "  perl -ne 's,include/$PREV_DIR($i)\b,include/$MAIN_DIR$j\1,; print \$_' |\\";
			done;
		done;
		echo "cat > a && mv a \$i; done"
	);
    ) >script && . ./script

Merged Sakari Ailus patch that moves smiapp.h to include/media/i2c.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
2015-11-17 06:57:11 -02:00
Linus Torvalds b037865754 media updates for v4.4-rc1
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJWOJZoAAoJEAhfPr2O5OEVmjYP/0RnfVjvRDtx0RxHDmvsowlt
 sHyrm5C7VME06b4J3O9qpC7PbMCAalvSkYp+bbxF+b//9EfwjvRER+NR8ebgn1Mw
 1NQKMtCusWRf4RzI+9osB3pFYgg/cYG2nKl0QVCXHL6xZszEQ9dBrFHEEHfVe8db
 JU1fGuF6TQNJdYgsVNMN9rStRB0vj3urfehLjB+E138VzDAnzPNA7I7Z4xsWWJw3
 V+J7CWLN1xW9IT59LXtRjbD/aCF9KrAmGigS0nCtDz7XVRPh+ZoXQLD073uLP2L3
 uYxOmadvc5+5iVwUP4zSsJ6+vw9kLr6Q30sNtLP7V+VkCSlCQNTOePLavB5T8qVY
 M2qALvwWjujtoSEjZHr7TqrlEpio98OSy1dNJ8GmuOb3UUAKocNN8sGG8h2nR/BR
 wv2OL/XPNcyB2LV6HeHZz9JiXB+rTbyXEN8CP2cD8ruGhNM5haak3d2l4FYszRXr
 /a/5JlYAcNrJii6PAXHyBtm6l0C4GPiAk3HQhII2fTErRr8fpln/G5AfaKjun5H8
 1Rbxx5JP+5qSHozmz2hNb4w92qqtPugj7qqu7sHCbwKLhh2Aspwo12GkN9acOIsI
 Kn1U/DWMRrkyptJAxBihsrEX3BXeQdNOPydKfMYEM7qE8EfTDM0uaIFQ+KVWCmNA
 Qh2TXAp6CZiuBvaqKzyl
 =sR0p
 -----END PGP SIGNATURE-----

Merge tag 'media/v4.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media

Pull media updates from Mauro Carvalho Chehab:
 "Media updates, including:

   - Lots of improvements at the kABI documentation
   - Split of Videobuf2 into a common part and a V4L2 specific one
   - Split of the VB2 tracing events into a separate header file
   - s5p-mfc got support for Exynos 5433
   - v4l2 fixes for 64-bits alignment when running 32 bits userspace
     on ARM
   - Added support for SDR radio transmitter at core, vivid and hackrf
     drivers
   - Some y2038 fixups
   - Some improvements at V4L2 colorspace support
   - saa7164 converted to use the V4L2 core control framework
   - several new boards additions, cleanups and fixups

  PS: There are two patches for scripts/kernel-doc that are needed by
  the documentation patches on Media.  Jon is OK on merging those via
  my tree"

* tag 'media/v4.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (146 commits)
  [media] c8sectpfe: Remove select on CONFIG_FW_LOADER_USER_HELPER_FALLBACK
  [media] DocBook media: update copyright/version numbers
  [media] ivtv: Convert to get_user_pages_unlocked()
  [media] media/v4l2-ctrls: fix setting autocluster to manual with VIDIOC_S_CTRL
  [media] DocBook media: Fix a typo in encoder cmd
  [media] DocBook: add SDR specific info to G_MODULATOR / S_MODULATOR
  [media] DocBook: add SDR specific info to G_TUNER / S_TUNER
  [media] hackrf: do not set human readable name for formats
  [media] hackrf: add support for transmitter
  [media] hackrf: switch to single function which configures everything
  [media] hackrf: add control for RF amplifier
  [media] DocBook: add modulator type field
  [media] v4l: add type field to v4l2_modulator struct
  [media] DocBook: document SDR transmitter
  [media] v4l2: add support for SDR transmitter
  [media] DocBook: document tuner RF gain control
  [media] v4l2: add RF gain control
  [media] v4l2: rename V4L2_TUNER_ADC to V4L2_TUNER_SDR
  [media] media/vivid-osd: fix info leak in ioctl
  [media] media: videobuf2: Move v4l2-specific stuff to videobuf2-v4l2
  ...
2015-11-05 12:05:15 -08:00
Antti Palosaari d18ca5b7ce [media] rtl28xxu: fix control message flaws
Add lock to prevent concurrent access for control message as control
message function uses shared buffer. Without the lock there may be
remote control polling which messes the buffer causing IO errors.
Increase buffer size and add check for maximum supported message
length.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=103391
Fixes: c56222a6b2 ("[media] rtl28xxu: move usb buffers to state")

Cc: <stable@vger.kernel.org> # 4.0+
Signed-off-by: Antti Palosaari <crope@iki.fi>
2015-10-22 15:48:27 -02:00
Antti Palosaari 36c6326c5c [media] hackrf: do not set human readable name for formats
Format names are set by core nowadays. Remove name from driver.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-20 15:55:28 -02:00
Antti Palosaari 8bc4a9ed85 [media] hackrf: add support for transmitter
HackRF SDR device has both receiver and transmitter. There is limitation
that receiver and transmitter cannot be used at the same time
(half-duplex operation). That patch implements transmitter support to
existing receiver only driver.

Signed-off-by: Antti Palosaari <crope@iki.fi>
[hans.verkuil@cisco.com: fix krobot unused variable warning]
[hans.verkuil@cisco.com: add back s_modulator from PATCHv4]
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-20 15:55:03 -02:00
Antti Palosaari eec20f0654 [media] hackrf: switch to single function which configures everything
Implement single funtion, hackrf_set_params(), which handles all
needed settings. Controls and other IOCTLs are just wrappers to that
function. That way we can get easily better control what we could do
on different device states - sleeping, receiving, transmitting.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-20 15:53:49 -02:00
Antti Palosaari b3ae29667e [media] hackrf: add control for RF amplifier
There is Avago MGA-81563 amplifier just right after antenna connector.
It could be turned on/off and its gain is around 12dB.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-20 15:52:26 -02:00
Junghak Sung 33119e80c3 [media] media: videobuf2: Change queue_setup argument
Replace struct v4l2_format * with void * to make queue_setup()
for common use.
And then, modify all device drivers related with this change.

Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
[hans.verkuil@cisco.com: fix missing const in fimc-lite.c]

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-20 14:48:39 -02:00
Mauro Carvalho Chehab 2f684b239c [media] dvb: get rid of enum dmx_success
This enum is not actually used anymore. The only value used from
the enum is DMX_OK, passed as a parameter on two callbacks.

Yet, this value is not used anywhere. So, just remove it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-06 19:53:02 -03:00
Andrzej Hajda e54560d963 [media] cx231xx: fix handling cx231xx_read_i2c_data result
The function can return negative value.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2046107

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-03 11:32:32 -03:00
Erik Andresen 2788052a8a [media] Add Terratec H7 Revision 4 to DVBSky driver
Adds Terratec H7 Rev. 4 with USB id 0ccd:10a5 to DVBSky driver.

Signed-off-by: Erik Andresen <erik@vontaene.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-03 11:08:12 -03:00
Graham Eccleston 702c287082 [media] Compro U650F support
Added Compro U650F to the rtl28xxu devices.

Signed-off-by: Graham Eccleston <grahameccleston_@hotmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-03 09:36:55 -03:00
Junghak Sung 2d7007153f [media] media: videobuf2: Restructure vb2_buffer
Remove v4l2 stuff - v4l2_buf, v4l2_plane - from struct vb2_buffer.

Add new member variables - bytesused, length, offset, userptr, fd,
data_offset - to struct vb2_plane in order to cover all information
of v4l2_plane.
struct vb2_plane {
        <snip>
        unsigned int            bytesused;
        unsigned int            length;
        union {
                unsigned int    offset;
                unsigned long   userptr;
                int             fd;
        } m;
        unsigned int            data_offset;
}

Replace v4l2_buf with new member variables - index, type, memory - which
are common fields for buffer management.
struct vb2_buffer {
        <snip>
        unsigned int            index;
        unsigned int            type;
        unsigned int            memory;
        unsigned int            num_planes;
        struct vb2_plane        planes[VIDEO_MAX_PLANES];
        <snip>
};

v4l2 specific fields - flags, field, timestamp, timecode,
sequence - are moved to vb2_v4l2_buffer in videobuf2-v4l2.c
struct vb2_v4l2_buffer {
        struct vb2_buffer       vb2_buf;

        __u32                   flags;
        __u32                   field;
        struct timeval          timestamp;
        struct v4l2_timecode    timecode;
        __u32                   sequence;
};

Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 09:04:43 -03:00
Junghak Sung c139990e84 [media] media: videobuf2: Replace videobuf2-core with videobuf2-v4l2
Make videobuf2-v4l2 as a wrapper of videobuf2-core for v4l2-use.
And replace videobuf2-core.h with videobuf2-v4l2.h.
This renaming change should be accompanied by the modifications
of all device drivers that include videobuf2-core.h.
It can be done with just running this shell script.

replace()
{
str1=$1
str2=$2
dir=$3
for file in $(find $dir -name *.h -o -name *.c -o -name Makefile)
do
    echo $file
    sed "s/$str1/$str2/g" $file > $file.out
    mv $file.out $file
done
}

replace "videobuf2-core" "videobuf2-v4l2" "include/media/"
replace "videobuf2-core" "videobuf2-v4l2" "drivers/media/"
replace "videobuf2-core" "videobuf2-v4l2" "drivers/usb/gadget/"
replace "videobuf2-core" "videobuf2-v4l2" "drivers/staging/media/"

Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 08:48:18 -03:00
Luis de Bethencourt d275d93590 [media] cx25821, cx88, tm6000: use SNDRV_DEFAULT_ENABLE_PNP
Instead of manually initializing the bool array enable, use the
SNDRV_DEFAULT_ENABLE_PNP macro. As most drivers do.

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 08:42:52 -03:00
Javier Martinez Canillas 5bcc0dd790 [media] go7007: Fix returned errno code in gen_mjpeghdr_to_package()
The driver is using -1 instead of the -ENOMEM defined macro to specify
that a buffer allocation failed. Since the error number is propagated,
the caller will get a -EPERM which is the wrong error condition.

Also, the smatch tool complains with the following warning:

gen_mjpeghdr_to_package() warn: returning -1 instead of -ENOMEM is sloppy

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 08:32:52 -03:00
Arnd Bergmann 5ba0e2c3ad [media] use v4l2_get_timestamp where possible
This is a preparation for a change to the type of v4l2 timestamps.
v4l2_get_timestamp() is a helper function that reads the monotonic
time and stores it into a 'struct timeval'. Multiple drivers implement
the same thing themselves for historic reasons.

Changing them all to use v4l2_get_timestamp() is more consistent
and reduces the amount of code duplication, and most importantly
simplifies the following changes.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
[hans.verkuil@cisco.com: dropped the v4l2-dev.c patch that didn't belong here]
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 08:29:23 -03:00
Laurent Pinchart 5d0fd3c806 [media] uvcvideo: Disable hardware timestamps by default
The hardware timestamping implementation has been reported as not
working correctly on at least the Logitech C920. Until this can be
fixed, disable it by default.

Reported-by: Peter Rabbitson <rabbit@rabbit.us>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-25 17:23:26 -03:00
Steven Rostedt 543409a247 [media] cx231xx: Use wake_up_interruptible() instead of wake_up_interruptible_nr()
While looking at use cases of the wake queues in order to add support
for simple wait queues, I noticed that there was only a single user of
wake_up_interruptible_nr(), and that use was doing a single task wake
up. Have that user use the proper wake_up_interruptible() instead, and
perhaps we can even remove the function wake_up_interruptible_nr().

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-03 13:50:52 -03:00
Christian Löpke 3139f43f8e [media] Technisat SkyStar USB HD,(DVB-S/S2) too much URBs for arm devices
Using 8 URBs results in a consecutive buffer allocation of too much
memory for some arm devices.
As we use isochronuous transfers the number of URBs can be reduced
without risking data-loss.

Signed-off-by: Christian Loepke <loepke@edfritsch.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 14:43:23 -03:00
Krzysztof Kozlowski ebf8dce56a [media] Drop owner assignment from i2c_driver
i2c_driver does not need to set an owner because i2c_register_driver()
will set it.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 13:01:57 -03:00
Vaishali Thakkar 38dcdca387 [media] pctv452e: Replace memset with eth_zero_addr
Use eth_zero_addr to assign the zero address to the given address
array instead of memset when second argument is address of zero.
Note that the 6 in the third argument of memset appears to represent
an ethernet address size (ETH_ALEN).

The Coccinelle semantic patch that makes this change is as follows:

// <smpl>
@eth_zero_addr@
expression e;
@@

-memset(e,0x00,6);
+eth_zero_addr(e);
// </smpl>

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 12:57:01 -03:00
Maninder Singh a73df85892 [media] usb/airspy: removing unneeded goto
This patch removes unneded goto,
reported by coccinelle.

Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Reviewed-by: Akhilesh Kumar <akhilesh.k@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 12:50:18 -03:00
Antti Palosaari d029419dc6 [media] em28xx: remove unused a8293 SEC config
Devices that were using a8293 SEC are converted to I2C platform data
thus that old config structure is left unused.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 07:08:01 -03:00
Hans Verkuil df3cfa6d92 [media] usbvision: move init code to probe()
These things are only initialized if you start streaming video, but
they are also used in the disconnect function. So just init them
always during probe time.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:55:26 -03:00
Hans Verkuil 94384014f6 [media] usbvision: fix standards for S-Video/Composite inputs
The standards supported by S-Video and Composite inputs are not
limited by PAL, so make it more generic.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:55:00 -03:00
Hans Verkuil 8926e84534 [media] usbvision: fix DMA from stack warnings
In various places the stack was used to provide buffers for USB data, but
this should be allocated memory.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:54:22 -03:00
Hans Verkuil e2c84ccb0f [media] usbvision: fix locking error
If remove_pending is non-zero, then the v4l2_lock is never unlocked.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:53:21 -03:00