Arnd Bergmann [Fri, 26 Feb 2016 11:53:22 +0000 (08:53 -0300)]
[media] em28xx: restore lost #ifdef
The cleanup that changed the em28xx driver to use v4l2_mc_create_media_graph
instead of its own implementation causes a build error when CONFIG_MEDIA_CONTROLLER
is disabled:
drivers/media/usb/em28xx/em28xx-video.c: In function 'em28xx_v4l2_init':
drivers/media/usb/em28xx/em28xx-video.c:2717:38: error: 'struct em28xx' has no member named 'media_dev'
This puts the new code inside the same #ifdef that controls the presence
of the 'media_dev' member, and that the old code was in.
This reverts commit 82c2ffeb217a ("[media] tvp5150: document input
connectors DT bindings") since the DT binding is too device driver
specific and should instead be more generic and use the bindings
in Documentation/devicetree/bindings/display/connector/ and linked
to the tvp5150 using the OF graph port and endpoints.
There are still ongoing discussions about how the input connectors
will be supported by the Media Controller framework so until that
is settled, it is better to revert the connectors portion of the
bindings to avoid known to be broken bindings docs to hit mainline.
Emilio López [Mon, 22 Feb 2016 01:26:36 +0000 (22:26 -0300)]
[media] usb: musb: sunxi: support module autoloading
MODULE_DEVICE_TABLE() is missing, so the module isn't auto-loading on
sunxi systems using the OTG controller. This commit adds the missing
line so it loads automatically when building it as a module and running
on a system with an USB OTG port.
Emilio López [Mon, 22 Feb 2016 01:26:34 +0000 (22:26 -0300)]
[media] rc: sunxi-cir: support module autoloading
MODULE_DEVICE_TABLE() is missing, so the module isn't auto-loading on
systems supporting infrared. This commit adds the missing line so it
works out of the box when built as a module and running on a sunxi
system with an infrared receiver.
Sakari Ailus [Sun, 21 Feb 2016 16:25:11 +0000 (13:25 -0300)]
[media] staging: v4l: omap4iss: Use V4L2 graph PM operations
Power on devices represented by entities in the graph through the pipeline
state using V4L2 graph PM operations instead of what was in the omap3isp
driver.
Sakari Ailus [Sun, 21 Feb 2016 16:25:10 +0000 (13:25 -0300)]
[media] v4l: omap3isp: Use V4L2 graph PM operations
Power on devices represented by entities in the graph through the pipeline
state using V4L2 graph PM operations instead of what was in the omap3isp
driver.
Sakari Ailus [Sun, 21 Feb 2016 16:25:09 +0000 (13:25 -0300)]
[media] v4l: Add generic pipeline power management code
When the Media controller framework was merged, it was decided not to add
pipeline power management code for it was not seen generic. As a result, a
number of drivers have copied the same piece of code, with same bugfixes
done to them at different points of time (or not at all).
Add these functions to V4L2. Their use is optional for drivers.
[mchehab@osg.samsung.com: Fix merge conflicts]
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
.//include/media/v4l2-mc.h:138: warning: No description found for parameter 'vdev'
.//include/media/v4l2-mc.h:152: warning: No description found for parameter 'vdev'
Shuah Khan [Fri, 19 Feb 2016 00:28:48 +0000 (22:28 -0200)]
[media] media: au0828 enable the right media source when input changes
Change vidioc_s_input() to enable the media source for the newly
selected input.
v4l2-core enables source before calling au0828's vidioc_s_input()
handler. Hence, when input selection changes, media source for the
newly selected input needs to be enabled.
Olli Salonen [Tue, 16 Feb 2016 20:17:45 +0000 (18:17 -0200)]
[media] cx23885: fix reversed I2C bus numbering
I2C buses for DVBSky T980C and S950C were numbered in an opposite
way compared to every other board in the driver. Switch numbering
to a more logical way.
Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Antti Palosaari [Thu, 4 Feb 2016 19:01:51 +0000 (17:01 -0200)]
[media] mn88473: finalize driver
Finalize the driver.
It still lacks a lot of features, like all statistics and PLP
filtering, but basic functionality and sensitivity is pretty good
shape.
Signed-off-by: Antti Palosaari <crope@iki.fi> Reviewed-by: Benjamin Larsson <benjamin@southpole.se> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Shuah Khan [Fri, 12 Feb 2016 23:18:03 +0000 (21:18 -0200)]
[media] media: au0828 set ctrl_input in au0828_s_input()
dev->ctrl_input is set in vidioc_s_input() and doesn't get set in
au0828_s_input(). As a result, dev->ctrl_input is left uninitialized
until user space calls s_input.
It works correctly because the default input value is 0 and which is
what dev->ctrl_input gets initialized via kzalloc().
Change to set dev->ctrl_input in au0828_s_input(). Also optimize
vidioc_s_input() to return if the new input value is same as the
current.
Fix AverMedia RM-KS keymap using user guide to meet LinuxTV wiki rules.
The remote command didn't seem to change in itself since its creation: it's
just to make keys more standard and remove the FIXME.
Signed-off-by: Philippe Valembois <lephilousophe@users.sourceforge.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Heiner Kallweit [Mon, 8 Feb 2016 19:25:59 +0000 (17:25 -0200)]
[media] media: rc: nuvoton: support reading / writing wakeup sequence via sysfs
This patch adds a binary attribute /sys/class/rc/rc?/wakeup_data which
allows to read / write the wakeup sequence.
In combination with the core extension for exposing the most recent raw
packet this allows to easily define and set a wakeup sequence.
At least on my Zotac CI321 the BIOS resets the wakeup sequence at each boot
to a factory default. Therefore I use a udev rule
SUBSYSTEM=="rc", DRIVERS=="nuvoton-cir", ACTION=="add", RUN+="<script>"
with the script basically doing
cat <stored wakeup sequence> >/sys${DEVPATH}/wakeup_data
Philipp Zabel [Wed, 17 Feb 2016 13:21:10 +0000 (11:21 -0200)]
[media] coda: add support for native order firmware files with Freescale header
Freescale distribute their VPU firmware files with a 16 byte header
in BIT processor native order. This patch allows to detect the header
and to reorder the firmware on the fly.
With this patch it should be possible to use the distributed
vpu_fw_imx{53,6q,6d}.bin files directly after renaming them to
v4l-coda*-imx{53,6q,6dl}.bin.
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Guenter Roeck [Tue, 9 Feb 2016 14:43:42 +0000 (12:43 -0200)]
[media] atmel-isi: Fix bad usage of IS_ERR_VALUE
IS_ERR_VALUE() assumes that its parameter is an unsigned long.
It can not be used to check if an unsigned int reflects an error.
Doing so can result in the following build warning.
drivers/media/platform/soc_camera/atmel-isi.c:
In function "atmel_isi_probe":
include/linux/err.h:21:38: warning:
comparison is always false due to limited range of data type
drivers/media/platform/soc_camera/atmel-isi.c:1089:6: note:
in expansion of macro "IS_ERR_VALUE"
If that warning is seen, the return value from platform_get_irq() is not
checked for errors.
Robert Jarzmik [Sun, 6 Sep 2015 11:42:13 +0000 (08:42 -0300)]
[media] pxa_camera: conversion to dmaengine
Convert pxa_camera to dmaengine. This removes all DMA registers
manipulation in favor of the more generic dmaengine API.
The functional level should be the same as before. The biggest change is
in the sg_split() function, which splits a videobuf-dma into several
scatterlists for 3 planes captures (Y, U, V).
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
[g.liakhovetski@gmx.de: fix a function prototype, use bool, struct init] Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Robert Jarzmik [Sun, 6 Sep 2015 11:42:12 +0000 (08:42 -0300)]
[media] pxa_camera: trivial move of dma irq functions
This moves the dma irq handling functions up in the source file, so that
they are available before DMA preparation functions. It prepares the
conversion to DMA engine, where the descriptors are populated with these
functions as callbacks.
Robert Jarzmik [Sun, 6 Sep 2015 11:42:11 +0000 (08:42 -0300)]
[media] pxa_camera: move interrupt to tasklet
In preparation for dmaengine conversion, move the camera interrupt
handling into a tasklet. This won't change the global flow, as this
interrupt is only used to detect the end of frame and activate DMA fifos
handling.
Robert Jarzmik [Sun, 6 Sep 2015 11:42:10 +0000 (08:42 -0300)]
[media] pxa_camera: fix the buffer free path
Fix the error path where the video buffer wasn't allocated nor
mapped. In this case, in the driver free path don't try to unmap memory
which was not mapped in the first place.
Arnd Bergmann [Mon, 1 Feb 2016 16:45:39 +0000 (14:45 -0200)]
[media] mx3_camera: use %pad format string for dma_ddr_t
The mx3_camera driver prints DMA addresses using the "%x" format
string, which is wrong when using a 64-bit dma_addr_t definition:
media/platform/soc_camera/mx3_camera.c: In function 'mx3_cam_dma_done':
media/platform/soc_camera/mx3_camera.c:149:125: error: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'dma_addr_t {aka long long unsigned int}' [-Werror=format=]
media/platform/soc_camera/mx3_camera.c: In function 'mx3_videobuf_queue':
media/platform/soc_camera/mx3_camera.c:317:119: error: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'dma_addr_t {aka long long unsigned int}' [-Werror=format=]
media/platform/soc_camera/mx3_camera.c: In function 'mx3_videobuf_release':
media/platform/soc_camera/mx3_camera.c:346:119: error: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'dma_addr_t {aka long long unsigned int}' [-Werror=format=]
This changes the code to use the special %pad format string, which
always does the right thing.
Aviv Greenberg [Wed, 3 Feb 2016 17:08:52 +0000 (15:08 -0200)]
[media] UVC: Add support for R200 depth camera
Add support for Intel R200 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.
[media] rc-core: allow calling rc_open with device not initialized
The device initialization completes only after calling
input_register_device(). However, rc_open() can be called while
the device is being registered by the input/evdev core. So, we
can't expect that rc_dev->initialized to be true.
Change the logic to don't require initialized == true at rc_open
and change the type of initialized to be atomic.
this way, we can check for it earlier where it is really needed,
without needing to lock the mutex just for testing it.
Tested with nuvoton_cir driver on a NUC5i7RYB with CIR integrated on it.
Hans Verkuil [Fri, 26 Feb 2016 07:44:35 +0000 (04:44 -0300)]
[media] media-device.h: fix compiler warning
Fix these compiler warnings:
media-git/include/media/media-device.h: In function 'media_device_pci_init':
media-git/include/media/media-device.h:610:9: warning: 'return' with a value, in function returning void
return NULL;
^
media-git/include/media/media-device.h: In function '__media_device_usb_init':
media-git/include/media/media-device.h:618:9: warning: 'return' with a value, in function returning void
return NULL;
^
[media] ati_remote: Put timeouts at the accel array
Instead of having the timeouts hardcoded, and getting only the
accel value from the array, put everything in the same place.
That simplifies the logic.
As a side effect, it also cleans several smatch errors:
include/linux/jiffies.h:359:41: error: strange non-value function or array
include/linux/jiffies.h:361:42: error: strange non-value function or array
(one per time_after/time_before line)
As warned by smatch:
drivers/media/usb/dvb-usb/technisat-usb2.c:263 technisat_usb2_set_led() error: doing dma on the stack (led)
drivers/media/usb/dvb-usb/technisat-usb2.c:280 technisat_usb2_set_led_timer() error: doing dma on the stack (&b)
drivers/media/usb/dvb-usb/technisat-usb2.c:341 technisat_usb2_identify_state() error: doing dma on the stack (version)
drivers/media/usb/dvb-usb/technisat-usb2.c:609 technisat_usb2_get_ir() error: doing dma on the stack (buf)
drivers/media/usb/dvb-usb/technisat-usb2.c:619 technisat_usb2_get_ir() error: doing dma on the stack (buf)
Create a buffer at the device state and use it for all the DMA
transfers.
[media] dib0090: Do the right check for state->rf_ramp
Smatch with -pkernel --no-data keeps complaining about rf_ramp:
drivers/media/dvb-frontends/dib0090.c:1119 dib0090_pwm_gain_reset() error: we previously assumed 'state->rf_ramp' could be null (see line 1086)
While there's no risk of divison by zero, the logic there is akward, as it
does the calculus for the numerator and denominator before checking
if this will be used.
Change the order to check first if the denominator is zero, and only
calculating the numerator/denominator if not.
This should also avoid those smatch errors:
drivers/media/dvb-frontends/drx39xyj/drxj.c:9605 ctrl_get_qam_sig_quality() debug: sval_binop_unsigned: divide by zero
drivers/media/dvb-frontends/drx39xyj/drxj.c:9605 ctrl_get_qam_sig_quality() debug: sval_binop_unsigned: divide by zero
drivers/media/dvb-frontends/drx39xyj/drxj.c:9605 ctrl_get_qam_sig_quality() debug: sval_binop_unsigned: divide by zero
drivers/media/dvb-frontends/drx39xyj/drxj.c:9605 ctrl_get_qam_sig_quality() debug: sval_binop_unsigned: divide by zero
drivers/media/dvb-frontends/drx39xyj/drxj.c:9605 ctrl_get_qam_sig_quality() debug: sval_binop_unsigned: divide by zero
[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.
Wesley Post [Mon, 29 Feb 2016 18:39:10 +0000 (15:39 -0300)]
[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>
Hans de Goede [Sun, 7 Feb 2016 11:24:29 +0000 (09:24 -0200)]
[media] bttv: Width must be a multiple of 16 when capturing planar formats
On my bttv card "Hauppauge WinTV [card=10]" capturing in YV12 fmt at max
size results in a solid green rectangle being captured (all colors 0 in
YUV).
This turns out to be caused by max-width (924) not being a multiple of 16.
We've likely never hit this problem before since normally xawtv / tvtime,
etc. will prefer packed pixel formats. But when using a video card which
is using xf86-video-modesetting + glamor, only planar XVideo fmts are
available, and xawtv will chose a matching capture format to avoid needing
to do conversion, triggering the solid green window problem.
Cc: stable@vger.kernel.org Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
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.
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]
Shuah Khan [Thu, 11 Feb 2016 23:41:33 +0000 (21:41 -0200)]
[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.
Shuah Khan [Thu, 11 Feb 2016 23:41:31 +0000 (21:41 -0200)]
[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.
Shuah Khan [Thu, 11 Feb 2016 23:41:30 +0000 (21:41 -0200)]
[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.
Shuah Khan [Thu, 11 Feb 2016 23:41:29 +0000 (21:41 -0200)]
[media] media: Change v4l-core to check if source is free
Change s_input, s_fmt, s_tuner, s_frequency, querystd, s_hw_freq_seek,
and vb2_core_streamon interfaces that alter the tuner configuration to
check if it is free, by calling v4l_enable_media_source().
If source isn't free, return -EBUSY.
v4l_disable_media_source() is called from v4l2_fh_exit() to release
tuner (source).
Shuah Khan [Thu, 11 Feb 2016 23:41:26 +0000 (21:41 -0200)]
[media] media: Move au8522_media_pads enum to au8522.h from au8522_priv.h
Move the au8522_media_pads enum to au8522.h from au8522_priv.h to export
them. This will allow au0828-core to use these defines instead of
hard-coding them them.
Shuah Khan [Thu, 11 Feb 2016 23:41:25 +0000 (21:41 -0200)]
[media] media: v4l-core add enable/disable source common interfaces
Add a new interfaces to be used by v4l-core to invoke enable
source and disable_source handlers in the media_device. The
enable_source helper function invokes the enable_source handler
to find media source entity connected to the entity and check
is it is available or busy. If source is available, link is
activated and pipeline is started. The disable_source helper
function invokes the disable_source handler to deactivate and
stop the pipeline.
Shuah Khan [Thu, 11 Feb 2016 23:41:22 +0000 (21:41 -0200)]
[media] media: Media Controller enable/disable source handler API
Add new fields to struct media_device to add enable_source, and
disable_source handlers, and source_priv to stash driver private
data that is used to run these handlers. The enable_source handler
finds source entity for the passed in entity and checks if it is
available. When link is found, it activates it. Disable source
handler deactivates the link.
Bridge driver is expected to implement and set these handlers.
Shuah Khan [Thu, 11 Feb 2016 23:41:21 +0000 (21:41 -0200)]
[media] media: Media Controller register/unregister entity_notify API
Add new interfaces to register and unregister entity_notify
hook to media device. These interfaces allow drivers to add
hooks to take appropriate actions when new entities get added
to a shared media device. For example, au0828 bridge driver
registers an entity_notify hook to create links as needed
between media graph nodes.
[mchehab@osg.samsung.com: simple comments should be /* and not /**]
[media] dib9000: read16/write16 could return an error code
Both dib9000_read16_attr and dib9000_write16_attr can return an
error code. However, they currently return an u16. This produces the
following warnings on smatch:
ivtv_flush_queues() calls ivtv_queue_move() with steal == NULL.
However, part of the code assumes that steal could be not null, as
pointed by smatch:
drivers/media/pci/ivtv/ivtv-queue.c:145 ivtv_queue_move() error: we previously assumed 'steal' could be null (see line 138)
This has the potential of causing an OOPS when the queue is
flushed.
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
[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)
[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.
Benoit Parrot [Fri, 19 Feb 2016 20:00:30 +0000 (18:00 -0200)]
[media] media: ti-vpe: cal: Fix warning: variable dereference before being checked
As reported ctx->sensor is being dereferenced before being checked
in cal_get_external_info(). That being the case it was also checked
twice in multiple other location where v4l2_subdev_call is already
checking it so no need to explicitly check it again.
Benoit Parrot [Fri, 19 Feb 2016 19:24:45 +0000 (17:24 -0200)]
[media] media: ti-vpe: cal: Fix unreachable code in enum_frame_interval
As reported, the current cal_enum_frameintervals() is confusing
and does not have the intended behavior.
Fix this by re-implementing to properly propagate the enum_frame_interval
request to the subdevice.
[mchehab@osg.samsung.com: remove a now bogus "ret = 0" statement] Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Reported-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Signed-off-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
[media] dib0090: do the right thing if rf_ramp is NULL
As warned by smatch:
drivers/media/dvb-frontends/dib0090.c:1118 dib0090_pwm_gain_reset() error: we previously assumed 'state->rf_ramp' could be null (see line 1086)