Commit Graph

18206 Commits

Author SHA1 Message Date
James Hogan 3fed7dbe8b [media] rc: img-ir: add raw driver
Add raw IR remote control input driver for the ImgTec Infrared decoder
block's raw edge interrupts. Generic software protocol decoders are used
to allow multiple protocols to be supported at a time, including those
not supported by the hardware decoder.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 15:13:00 -03:00
James Hogan 160a8f8aec [media] rc: img-ir: add base driver
Add base driver for the ImgTec Infrared decoder block. The driver is
split into separate components for raw (software) decode and hardware
decoder which are in following commits.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 15:10:56 -03:00
James Hogan 6bea25af14 [media] rc-main: automatically refresh filter on protocol change
When either of the normal or wakeup filter protocols are changed,
refresh the corresponding scancode filter, i.e. try and set the same
scancode filter with the new protocol. If that fails clear the filter
instead.

If no protocol was selected the filter is just cleared, and if no
s_filter callback exists the filter is left unmodified.

Similarly clear the filter mask when the filter is set if no protocol is
currently selected.

This simplifies driver code which no longer has to explicitly worry
about modifying the filter on a protocol change. This also allows the
change_wakeup_protocol callback to be omitted entirely if there is only
a single available wakeup protocol at a time, since selecting no
protocol will automatically clear the wakeup filter, disabling wakeup.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: Antti Seppälä <a.seppala@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 13:29:52 -03:00
James Hogan ab88c66dea [media] rc: add wakeup_protocols sysfs file
Add a wakeup_protocols sysfs file which controls the new
rc_dev::enabled_protocols[RC_FILTER_WAKEUP], which is the mask of
protocols that are used for the wakeup filter.

A new RC driver callback change_wakeup_protocol() is called to change
the wakeup protocol mask.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: Antti Seppälä <a.seppala@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 13:28:20 -03:00
James Hogan acff5f2473 [media] rc: add allowed/enabled wakeup protocol masks
Only a single allowed and enabled protocol mask currently exists in
struct rc_dev, however to support a separate wakeup filter protocol two
of each are needed, ideally as an array.

Therefore make both rc_dev::allowed_protos and rc_dev::enabled_protocols
arrays, update all users to reference the first element
(RC_FILTER_NORMAL), and add a couple more helper functions for drivers
to use for setting the allowed and enabled wakeup protocols.

We also rename allowed_protos to allowed_protocols while we're at it,
which is more consistent with enabled_protocols.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: Antti Seppälä <a.seppala@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 13:25:49 -03:00
James Hogan 1a1934fab0 [media] rc: abstract access to allowed/enabled protocols
The allowed and enabled protocol masks need to be expanded to be per
filter type in order to support wakeup filter protocol selection. To
ease that process abstract access to the rc_dev::allowed_protos and
rc_dev::enabled_protocols members with inline functions.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: Antti Seppälä <a.seppala@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 13:24:39 -03:00
James Hogan b8c7d91508 [media] rc-main: add generic scancode filtering
Add generic scancode filtering of RC input events, and fall back to
permitting any RC_FILTER_NORMAL scancode filter to be set if no s_filter
callback exists. This allows raw IR decoder events to be filtered, and
potentially allows hardware decoders to set looser filters and rely on
generic code to filter out the corner cases.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: Antti Seppälä <a.seppala@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 13:21:40 -03:00
Antti Seppälä c3c2077d95 [media] nuvoton-cir: Activate PNP device when probing
On certain motherboards (mainly Intel NUC series) bios keeps the
Nuvoton CIR device disabled at boot.

This patch adds a call to kernel PNP layer to activate the device if it
is not already activated. This will improve the chances of the PNP probe
actually succeeding on Intel NUC platforms.

Signed-off-by: Antti Seppälä <a.seppala@gmail.com>
Cc: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 12:22:50 -03:00
Joonyoung Shim 7a1dd50b89 [media] au0828: fix i2c clock speed for DViCO FusionHDTV7
DViCO FusionHDTV7 device that use au0828 can fail to communicate with
xc5000 using i2c interface because of high i2c clock speed - i2c clock
stretching bug. It causes to fail xc5000 firmware loading normally at
the current driver.

Already this problem fixed as changing to low i2c clock speed at
HVR-950q device, also DViCO FusionHDTV7 device can solve it as using low
i2c clock speed - 20KHz.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 12:14:39 -03:00
James Hogan 7b802ce7e8 [media] rc-main: store_filter: pass errors to userland
Propagate errors returned by drivers from the s_filter callback back to
userland when updating scancode filters. This allows userland to see
when the filter couldn't be updated, usually because it's not a valid
filter for the hardware.

Previously the filter was being updated conditionally on success of
s_filter, but the write always reported success back to userland.

Reported-by: Antti Seppälä <a.seppala@gmail.com>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 12:13:23 -03:00
Satoshi Nagahama f61e2268a0 [media] Siano: smsusb - Add a device id for PX-S1UD
Add a device id to support for PX-S1UD (PLEX ISDB-T usb dongle) which
has sms2270.

Signed-off-by: Satoshi Nagahama <sattnag@aim.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 12:12:53 -03:00
Laurent Pinchart c6a328a06b [media] omap_vout: Add DVI display type support
Since the introduction of the new OMAP DSS DVI connector driver in
commit 348077b154 ("OMAPDSS: Add new DVI
Connector driver"), DVI outputs report a new display type of
OMAP_DISPLAY_TYPE_DVI instead of OMAP_DISPLAY_TYPE_DPI. Handle the new
type in the IRQ handler.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 12:10:06 -03:00
Pojar George 493a9cfdb9 [media] bttv: Add support for Kworld V-Stream Xpert TV PVR878
New board addition. No other changes.

[m.chehab@samsung.com: rebase patch and fix whitespace mangling]
Signed-off-by: Pojar George <geoubuntu@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 11:40:31 -03:00
Marcus Folkesson e01c15dbbd [media] media: i2c: Kconfig: create dependency to MEDIA_CONTROLLER for adv7*
These chips makes use of the media_entity in the v4l2_subdev struct
and is therefor dependent of the  MEDIA_CONTROLLER config.

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 10:53:29 -03:00
Gianluca Gennari 90d9c3e1ed [media] drx39xyj: fix 64 bit division on 32 bit arch
Fix this linker warning:
WARNING: "__divdi3" [media_build/v4l/drx39xyj.ko] undefined!

[m.chehab@samsung.com: add include for asm/div64.h]
Signed-off-by: Gianluca Gennari <gennarone@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 10:50:36 -03:00
Hans Verkuil 5c3112b5be [media] mem2mem_testdev: improve field handling
try_fmt should just set field to NONE and not return an error if
a different field was passed.

buf_prepare should check if the field passed in from userspace has a
supported field value. At the moment only NONE is supported and ANY
is mapped to NONE.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 10:34:56 -03:00
Hans Verkuil ca5f5fdb29 [media] mem2mem_testdev: fix field, sequence and time copying
- Set the sequence counters correctly.
- Copy timestamps, timecode, relevant buffer flags and field from
  the received buffer to the outgoing buffer.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 10:34:36 -03:00
Hans Verkuil a773632c1f [media] mem2mem_testdev: return pending buffers in stop_streaming()
To keep the vb2 buffer administration in balance stop_streaming() must
return any pending buffers to the vb2 framework.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 10:31:45 -03:00
Hans Verkuil 782f36ca69 [media] mem2mem_testdev: add USERPTR support
There is no reason why we shouldn't enable this here.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 10:31:19 -03:00
Hans Verkuil f063bb6638 [media] mem2mem_testdev: set priv to 0
v4l2_compliance fix.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 10:31:04 -03:00
Hans Verkuil 4e8ec0a46f [media] mem2mem_testdev: pick default format with try_fmt
This resolves an issue raised by v4l2-compliance: if the given format does
not exist, then pick a default format.

While there is an exception regarding this for TV capture drivers, this
m2m driver should do the right thing.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 10:30:08 -03:00
Hans Verkuil 4340583159 [media] mem2mem_testdev: use 40ms default transfer time
The default of 1 second is a bit painful, switch to a 25 Hz framerate.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 10:29:38 -03:00
Seung-Woo Kim ad7f22b55d [media] s5p-mfc: remove meaningless memory bank assignment
This patch removes meaningless assignment of memory bank to itself.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 10:29:09 -03:00
Joonyoung Shim d0ce898c39 [media] s5p-mfc: Replaced commas with semicolons
There is no any reason to use comma here.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 10:28:49 -03:00
Lars-Peter Clausen e246c3332d [media] adv7180: Add support for power down
The adv7180 has a low power mode in which the analog and the digital processing
section are shut down. Implement the s_power callback to let bridge drivers put
the part into low power mode when not needed.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 10:26:38 -03:00
Lars-Peter Clausen fa5b7945ae [media] adv7180: Add support for async device registration
Add support for async device registration to the adv7180 driver.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 10:26:15 -03:00
Lars-Peter Clausen 0c25534d45 [media] adv7180: Use threaded IRQ instead of IRQ + workqueue
The proper way to handle IRQs that need to be able to sleep in their IRQ handler
is to use a threaded IRQ.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 10:25:58 -03:00
Lars-Peter Clausen 7933c177fa [media] adv7180: Remove duplicated probe error message
The device driver core already prints out a very similar message when a driver
fails to probe. No need to print one in the driver itself.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 10:25:05 -03:00
Lars-Peter Clausen 3de0a91156 [media] adv7180: Remove unnecessary v4l2_device_unregister_subdev() from probe error path
The device can't possibly be registered at this point, so no need to to call
v4l2_device_unregister_subdev().

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 10:24:49 -03:00
Lars-Peter Clausen b13f4af25c [media] adv7180: Free control handler on remove()
Make sure to free the control handler when the device is removed.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 10:23:35 -03:00
Lars-Peter Clausen 297a0ae32b [media] adv7180: Fix remove order
The mutex is used in the subdev callbacks, so unregister the subdev before the
mutex is destroyed.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 10:21:55 -03:00
Hans Verkuil b09dfac832 [media] adv*: replace the deprecated v4l2_subdev_edid by v4l2_edid
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 10:13:15 -03:00
Hans Verkuil dd519bb34a [media] v4l2: add VIDIOC_G/S_EDID support to the v4l2 core
Support this ioctl as part of the v4l2 core. Use the new ioctl
name and struct v4l2_edid type in the existing core code.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 10:06:53 -03:00
Hans Verkuil bc826d6e39 [media] v4l2-compat-ioctl32: fix wrong VIDIOC_SUBDEV_G/S_EDID32 support
The wrong ioctl numbers were used due to a copy-and-paste error.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: stable@vger.kernel.org      # for v3.7 and up
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 10:04:47 -03:00
Daniel Jeong dc76df5d48 [media] lm3646: add new dual LED Flash driver
This patch adds the driver for the LM3646, dual LED Flash driver.
The LM3646 has two 1.5A sync. boost converter with dual white current source.
It is controlled via an I2C compatible interface.
Each flash brightness, torch brightness and enable/disable can be controlled.
Under voltage, input voltage monitor and thermal threshhold Faults are added.
Please refer the datasheet http://www.ti.com/lit/ds/snvs962/snvs962.pdf

Signed-off-by: Daniel Jeong <gshark.jeong@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 10:00:26 -03:00
Andy Shevchenko 341ef565f8 [media] lm3560: prevent memory leak in case of pdata absence
If we have no pdata defined and driver fails to register we leak memory.
Converting to devm_kzalloc prevents this to happen.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 09:56:39 -03:00
Andy Shevchenko d1166b0f17 [media] lm3560: keep style for the comments
Let's keep the style for all comments in the code, namely using small letters
whenever it's possible.

There is no functional change.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 09:56:26 -03:00
Andy Shevchenko bc46263b84 [media] lm3560: remove FSF address from the license
There is no need to keep the FSF address inside each file. Moreover, it might
change in future which will make this one obsolete.

There is no functional change.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 09:56:08 -03:00
Laurent Pinchart b9db140c1e [media] v4l: of: Support empty port nodes
Empty port nodes are allowed but currently unsupported as the
v4l2_of_get_next_endpoint() function assumes that all port nodes have at
least an endpoint. Fix this.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 09:38:49 -03:00
Phil Edworthy cbe504d4d4 [media] media: soc_camera: rcar_vin: Add support for 10-bit YUV cameras
Add support for MBUS YUV10 BT656 and BT601 formats at rcar driver.

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 09:32:26 -03:00
sensoray-dev 4a1df5e8f6 [media] s2255drv: memory leak fix
Fixes memory leak introduced by
commit 47d8c881c3.

Signed-off-by: Dean Anderson <linux-dev@sensoray.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 09:28:31 -03:00
Philipp Zabel 2a0489d351 [media] tvp5150: Make debug module parameter visible in sysfs
Set permissions on the debug module parameter to make it appear in sysfs.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 09:27:49 -03:00
Philipp Zabel 785a3de18b [media] tvp5150: Fix type mismatch warning in clamp macro
This patch fixes the following warning:

drivers/media/i2c/tvp5150.c: In function '__tvp5150_try_crop':
include/linux/kernel.h:762:17: warning: comparison of distinct pointer types lacks a cast [enabled by default]
  (void) (&__val == &__min);  \
                 ^
drivers/media/i2c/tvp5150.c:886:16: note: in expansion of macro 'clamp'
  rect->width = clamp(rect->width,
                ^
include/linux/kernel.h:763:17: warning: comparison of distinct pointer types lacks a cast [enabled by default]
  (void) (&__val == &__max);  \
                 ^
drivers/media/i2c/tvp5150.c:886:16: note: in expansion of macro 'clamp'
  rect->width = clamp(rect->width,
                ^
include/linux/kernel.h:762:17: warning: comparison of distinct pointer types lacks a cast [enabled by default]
  (void) (&__val == &__min);  \
                 ^
drivers/media/i2c/tvp5150.c:904:17: note: in expansion of macro 'clamp'
  rect->height = clamp(rect->height,
                 ^
include/linux/kernel.h:763:17: warning: comparison of distinct pointer types lacks a cast [enabled by default]
  (void) (&__val == &__max);  \
                 ^
drivers/media/i2c/tvp5150.c:904:17: note: in expansion of macro 'clamp'
  rect->height = clamp(rect->height,
                 ^

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 09:27:38 -03:00
Dan Carpenter 73a8ca4877 [media] em28xx-cards: remove a wrong indent level
This code is correct but the indenting is wrong and triggers a static
checker warning "add curly braces?".

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 09:27:14 -03:00
Arnd Bergmann f97881fe50 [media] arv: fix sleep_on race
interruptible_sleep_on is racy and going away. In the arv driver that
race has probably never caused problems since it would require a whole
video frame to be captured before the read function has a chance to
go to sleep, but using wait_event_interruptible lets us kill off the
old interface. In order to do this, we have to slightly adapt the
meaning of the ar->start_capture field to distinguish between not having
started a frame and having completed it.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 09:23:10 -03:00
Geert Uytterhoeven 111eeaa73a [media] v4l: VIDEO_SH_VOU should depend on HAS_DMA
If NO_DMA=y:

    warning: (VIDEO_DM6446_CCDC && VIDEO_DM355_CCDC && VIDEO_DM365_ISIF && VIDEO_OMAP2_VOUT && VIDEO_SH_VOU && VIDEO_VIU && VIDEO_TIMBERDALE && VIDEO_MX1 && VIDEO_OMAP1) selects VIDEOBUF_DMA_CONTIG which has unmet direct dependencies (MEDIA_SUPPORT && HAS_DMA)

    drivers/built-in.o: In function `videobuf_vm_close':
    videobuf-dma-contig.c:(.text+0x407aa0): undefined reference to `videobuf_queue_cancel'
    drivers/built-in.o: In function `__videobuf_dc_alloc':
    videobuf-dma-contig.c:(.text+0x407ba2): undefined reference to `dma_alloc_coherent'
    drivers/built-in.o: In function `__videobuf_mmap_mapper':
    videobuf-dma-contig.c:(.text+0x407d44): undefined reference to `dma_free_coherent'
    drivers/built-in.o: In function `free_buffer':
    sh_vou.c:(.text+0x41f73a): undefined reference to `videobuf_waiton'
    drivers/built-in.o: In function `sh_vou_poll':
    sh_vou.c:(.text+0x41f884): undefined reference to `videobuf_poll_stream'
    drivers/built-in.o: In function `sh_vou_buf_prepare':
    sh_vou.c:(.text+0x41fdf6): undefined reference to `videobuf_iolock'
    drivers/built-in.o: In function `sh_vou_reqbufs':
    sh_vou.c:(.text+0x4203b0): undefined reference to `videobuf_reqbufs'
    drivers/built-in.o: In function `sh_vou_querybuf':
    sh_vou.c:(.text+0x42040a): undefined reference to `videobuf_querybuf'
    drivers/built-in.o: In function `sh_vou_qbuf':
    sh_vou.c:(.text+0x42045e): undefined reference to `videobuf_qbuf'
    drivers/built-in.o: In function `sh_vou_dqbuf':
    sh_vou.c:(.text+0x4204c2): undefined reference to `videobuf_dqbuf'
    drivers/built-in.o: In function `sh_vou_streamon':
    sh_vou.c:(.text+0x420572): undefined reference to `videobuf_streamon'
    drivers/built-in.o: In function `sh_vou_streamoff':
    sh_vou.c:(.text+0x4205d2): undefined reference to `videobuf_streamoff'
    drivers/built-in.o: In function `sh_vou_mmap':
    sh_vou.c:(.text+0x420c46): undefined reference to `videobuf_mmap_mapper'

VIDEO_SH_VOU selects VIDEOBUF_DMA_CONTIG, which bypasses its dependency on
HAS_DMA.  Make VIDEO_SH_VOU depend on HAS_DMA to fix this.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 09:22:48 -03:00
Hans Verkuil c817d927b0 [media] v4l2-ctrls: replace BUG_ON by WARN_ON
BUG_ON is unnecessarily strict.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 09:22:22 -03:00
Fengguang Wu 9b05837352 [media] drivers/media/usb/usbtv/usbtv-core.c:119:22: sparse: symbol 'usbtv_id_table' was not declared. Should it be static?
tree:   git://linuxtv.org/media_tree.git master
head:   a3550ea665
commit: a3550ea665 [499/499] [media] usbtv: split core and video implementation
reproduce: make C=1 CF=-D__CHECK_ENDIAN__

sparse warnings: (new ones prefixed by >>)

>> drivers/media/usb/usbtv/usbtv-core.c:119:22: sparse: symbol 'usbtv_id_table' was not declared. Should it be static?
>> drivers/media/usb/usbtv/usbtv-core.c:129:19: sparse: symbol 'usbtv_usb_driver' was not declared. Should it be static?

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 09:22:07 -03:00
Mauro Carvalho Chehab 0d49e77611 drx-j: Fix post-BER calculus on QAM modulation
There are two troubles there:
	1) the bit error measure were not accumulating;
	2) it was missing the bit count.

Fix them.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 07:43:54 -03:00
Mauro Carvalho Chehab ee0f4a1444 drx-j: use ber_count var
drivers/media/dvb-frontends/drx39xyj/drxj.c: In function 'ctrl_get_qam_sig_quality':
drivers/media/dvb-frontends/drx39xyj/drxj.c:9468:6: warning: variable 'ber_cnt' set but not used [-Wunused-but-set-variable]
  u32 ber_cnt = 0; /* BER count */
      ^

By reading the comment, it is said that BER should be calculated as:
	qam_pre_rs_ber = frac_times1e6( ber_cnt, rs_bit_cnt );

Also, it makes sense to take the mantissa into account, so fix the
code to do what's commented.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 07:37:21 -03:00
Mauro Carvalho Chehab d591590e1b [media] drx-j: enable DVBv5 stats
Now that everything is set, let's enable DVBv5 stats, for
applications that support it.

DVBv3 apps will still work.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 07:37:21 -03:00
Mauro Carvalho Chehab 80846a5c2f [media] drx-j: Fix detection of no signal
When the signal is 7, it means that no signal was received.

Value experimentally measured.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 07:37:20 -03:00
Mauro Carvalho Chehab 6983257813 [media] drx-j: properly handle bit counts on stats
Instead of just assuming that the min resolution is 1E-6,
pass both bit error and bit counts for userspace to calculate
BER. The same applies for PER, for 8VSB. It is not clear how
to get the packet count for QAM. So, for now, don't expose PER
for QAM.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 07:37:20 -03:00
Mauro Carvalho Chehab 03fdfbfd3b [media] drx-j: Prepare to use DVBv5 stats
Convert the stats internally to use DVBv5. For now, it will keep
showing everything via DVBv3 API only, as the .len value were
not initialized.

That allows testing if the new stats code didn't break anything.

A latter patch will add the final bits for the DVBv5 stats to
fully work.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 07:37:19 -03:00
Mauro Carvalho Chehab 80e5ed14e1 [media] drx-j: re-add get_sig_strength()
We'll need to use this function. Restore it from the
git history.

This function will be used on the next patch.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 07:37:19 -03:00
Mauro Carvalho Chehab 6f64c522bc [media] drx-j: Don't use "state" for DVB lock state
State is already used on other places for the state struct.
Don't use it here, to avoid troubles with latter patches.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 07:37:18 -03:00
Mauro Carvalho Chehab 9c44a5d76e [media] drx-j: get rid of some unused vars
As reported when compiled with W=1:

drivers/media/dvb-frontends/drx39xyj/drxj.c: In function ‘ctrl_set_channel’:
drivers/media/dvb-frontends/drx39xyj/drxj.c:10340:26: warning: variable ‘common_attr’ set but not used [-Wunused-but-set-variable]
  struct drx_common_attr *common_attr = NULL;
                          ^
drivers/media/dvb-frontends/drx39xyj/drxj.c:10336:6: warning: variable ‘intermediate_freq’ set but not used [-Wunused-but-set-variable]
  s32 intermediate_freq = 0;

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 07:37:18 -03:00
Mauro Carvalho Chehab 691cbbe354 [media] drx-j: propagate returned error from request_firmware()
Fix a smatch warning:
	drivers/media/dvb-frontends/drx39xyj/drxj.c:11711 drx_ctrl_u_code() info: why not propagate 'rc' from request_firmware() instead of (-2)?

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 07:37:17 -03:00
Mauro Carvalho Chehab 1e5ec31a46 [media] drx-j: Fix usage of drxj_close()
This function is currently not used. However, it was meant to
be called at device release. So, add it there.

While here, remove the bad check, as reported by Dan, as
smatch warning:
	drivers/media/dvb-frontends/drx39xyj/drxj.c:20041 drxj_close() warn: variable dereferenced before check 'demod' (see line 20036)

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 07:37:17 -03:00
Mauro Carvalho Chehab 0147314639 [media] drx-j: remove external symbols
This driver doesn't export any external symbol, except for
the attach() method.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 07:37:16 -03:00
Mauro Carvalho Chehab b6c4065eef [media] drx-j: get rid of dead code
There are large chunks of code at drx-j that aren't used. Most
of them are due to analog TV support. Well, just enabling them
won't make analog support work, as devices with DRX and analog
support requires an extra chip (avf4910).

We don't have drivers for it, nor the current device that uses
this frontend has support for analog TV.

So, let's just get rid of this code. If latter needed, this
patch can easily be reverted from git history.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 07:37:16 -03:00
Mauro Carvalho Chehab 1d001c3fde [media] drx-j: don't use mc_info before checking if its not NULL
smatch warning:
	drivers/media/dvb-frontends/drx39xyj/drxj.c:20803 drx_ctrl_u_code() warn: variable dereferenced before check 'mc_info' (see line 20800)

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 07:37:15 -03:00
Mauro Carvalho Chehab d1f2aae3d9 [media] drx39xxj.h: Fix undefined reference to attach function
As reported by the kbuild test robot <fengguang.wu@intel.com>:

drivers/built-in.o: In function `em28xx_dvb_init':
    em28xx-dvb.c:(.text+0x876f2c): undefined reference to `drx39xxj_attach'

That happens when CONFIG_VIDEO_EM28XX_DVB is selected, and neither
CONFIG_MEDIA_SUBDRV_AUTOSELECT or DVB_DRX39XYJ is selected.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 07:37:15 -03:00
Mauro Carvalho Chehab 87bf0e5487 [media] drx-j: Fix dubious usage of "&" instead of "&&"
Fixes the following warnings:
	drivers/media/dvb-frontends/drx39xyj/drxj.c:16764:68: warning: dubious: x & !y
	drivers/media/dvb-frontends/drx39xyj/drxj.c:16778:68: warning: dubious: x & !y
	drivers/media/dvb-frontends/drx39xyj/drxj.c:16797:68: warning: dubious: x & !y

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 06:56:49 -03:00
Mauro Carvalho Chehab db5657c5ec [media] drx-j: Don't use 0 as NULL
Fixes the following warnings:
	drivers/media/dvb-frontends/drx39xyj/drxj.c:1679:65: warning: Using plain integer as NULL pointer
	drivers/media/dvb-frontends/drx39xyj/drxj.c:1679:71: warning: Using plain integer as NULL pointer
	drivers/media/dvb-frontends/drx39xyj/drxj.c:1681:52: warning: Using plain integer as NULL pointer
	drivers/media/dvb-frontends/drx39xyj/drxj.c:1681:58: warning: Using plain integer as NULL pointer

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 06:56:48 -03:00
Dave Jones 73b8922fef [media] drx-d: add missing braces in drxd_hard.c:DRXD_init
No functional changes, but removes a duplicate check, if
!state->type_A.

Signed-off-by: Dave Jones <davej@fedoraproject.org>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 06:56:48 -03:00
Fengguang Wu c4cfb29303 [media] drx-j: drxj_default_aud_data_g can be static
Fix sparse warning:
	drivers/media/dvb-frontends/drx39xyj/drxj.c:1039:16: sparse: symbol 'drxj_default_aud_data_g' was not declared. Should it be static?

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 06:56:47 -03:00
Mauro Carvalho Chehab b45e34f2a6 [media] em28xx-dvb: remove one level of identation at fini callback
Simplify the logic a little by removing one level of identation.
Also, it only makes sense to print something if the .fini callback
is actually doing something.

Reviewed-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 06:56:46 -03:00
Mauro Carvalho Chehab 47677e51e2 [media] em28xx: Only deallocate struct em28xx after finishing all extensions
We can't free struct em28xx while one of the extensions is still
using it.

So, add a kref() to control it, freeing it only after the
extensions fini calls.

Reviewed-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 06:56:46 -03:00
Mauro Carvalho Chehab 88e4fcda55 [media] em28xx: only enable PCTV 80e led when streaming
Instead of keeping the led always on, use it to indicate
when DVB is streaming.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 06:56:45 -03:00
Hans Verkuil ba38acb142 [media] vivi: fix ENUM_FRAMEINTERVALS implementation
This function never checked if width and height are correct. Add such
a check so the v4l2-compliance tool returns OK again for vivi.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 06:56:45 -03:00
Hans Verkuil 48d829dadb [media] vivi: correctly cleanup after a start_streaming failure
If start_streaming fails then any queued buffers must be given back
to the vb2 core.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 06:56:44 -03:00
Hans Verkuil 9cf3c31a8b [media] vb2: call buf_finish after the state check
Don't call buf_finish unless we know that the buffer is in a valid state.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 06:56:44 -03:00
Hans Verkuil 3f1a9a33a5 [media] vb2: fix streamoff handling if streamon wasn't called
If you request buffers, then queue buffers and then call STREAMOFF
those buffers are not returned to their dequeued state because streamoff
will just return if q->streaming was 0.

This means that afterwards you can never QBUF that same buffer again unless
you do STREAMON, REQBUFS or close the filehandle first.

It is clear that if you do STREAMOFF even if no STREAMON was called before,
you still want to have all buffers returned to their proper dequeued state.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 06:56:43 -03:00
Hans Verkuil e4d2581649 [media] vb2: replace BUG by WARN_ON
No need to oops for this, WARN_ON is good enough.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 06:56:43 -03:00
Hans Verkuil fb64dca805 [media] vb2: properly clean up PREPARED and QUEUED buffers
If __reqbufs was called then existing buffers are freed. However, if that
happens without ever having started STREAMON, but if buffers have been queued,
then the buf_finish op is never called.

Add a call to __vb2_queue_cancel in __reqbufs so that these buffers are
cleaned up there as well.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 06:56:42 -03:00
Hans Verkuil b3379c6201 [media] vb2: only call start_streaming if sufficient buffers are queued
In commit 02f142ecd2 support was added to
start_streaming to return -ENOBUFS if insufficient buffers were queued
for the DMA engine to start. The vb2 core would attempt calling
start_streaming again if another buffer would be queued up.

Later analysis uncovered problems with the queue management if start_streaming
would return an error: the buffers are enqueued to the driver before the
start_streaming op is called, so after an error they are never returned to
the vb2 core. The solution for this is to let the driver return them to
the vb2 core in case of an error while starting the DMA engine. However,
in the case of -ENOBUFS that would be weird: it is not a real error, it
just says that more buffers are needed. Requiring start_streaming to give
them back only to have them requeued again the next time the application
calls QBUF is inefficient.

This patch changes this mechanism: it adds a 'min_buffers_needed' field
to vb2_queue that drivers can set with the minimum number of buffers
required to start the DMA engine. The start_streaming op is only called
if enough buffers are queued. The -ENOBUFS handling has been dropped in
favor of this new method.

Drivers are expected to return buffers back to vb2 core with state QUEUED
if start_streaming would return an error. The vb2 core checks for this
and produces a warning if that didn't happen and it will forcefully
reclaim such buffers to ensure that the internal vb2 core state remains
consistent and all buffer-related resources have been correctly freed
and all op calls have been balanced.

__reqbufs() has been updated to check that at least min_buffers_needed
buffers could be allocated. If fewer buffers were allocated then __reqbufs
will free what was allocated and return -ENOMEM. Based on a suggestion from
Pawel Osciak.

__create_bufs() doesn't do that check, since the use of __create_bufs
assumes some advance scenario where the user might want more control.
Instead streamon will check if enough buffers were allocated to prevent
streaming with fewer than the minimum required number of buffers.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 06:56:41 -03:00
Hans Verkuil a7afcaccfa [media] vb2: don't init the list if there are still buffers
__vb2_queue_free() would init the queued_list at all times, even if
q->num_buffers > 0. This should only happen if num_buffers == 0.

This situation can happen if a CREATE_BUFFERS call couldn't allocate
enough buffers and had to free those it did manage to allocate before
returning an error.

While we're at it: __vb2_queue_alloc() returns the number of buffers
allocated, not an error code. So stick the result in allocated_buffers
instead of ret as that's very confusing.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 06:56:41 -03:00
Hans Verkuil 6ea3b980f0 [media] vb2: rename queued_count to owned_by_drv_count
'queued_count' is a bit vague since it is not clear to which queue it
refers to: the vb2 internal list of buffers or the driver-owned list
of buffers.

Rename to make it explicit.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Pawel Osciak <pawel@osciak.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 06:56:40 -03:00
Hans Verkuil 256f3162c1 [media] vb2: fix buf_init/buf_cleanup call sequences
Ensure that these ops are properly balanced.

There are two scenarios:

1) for MMAP buf_init is called when the buffers are created and buf_cleanup
   must be called when the queue is finally freed. This scenario was always
   working.

2) for USERPTR and DMABUF it is more complicated. When a buffer is queued
   the code checks if all planes of this buffer have been acquired before.
   If that's the case, then only buf_prepare has to be called. Otherwise
   buf_cleanup needs to be called if the buffer was acquired before, then,
   once all changed planes have been (re)acquired, buf_init has to be
   called followed by buf_prepare. Should buf_prepare fail, then buf_cleanup
   must be called on the newly acquired planes to release them in.

Finally, in __vb2_queue_free we have to check if the buffer was actually
acquired before calling buf_cleanup. While that it always true for MMAP
mode, it is not necessarily true for the other modes. E.g. if you just
call REQBUFS and close the file handle, then buffers were never queued and
so no buf_init was ever called.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 06:56:40 -03:00
Hans Verkuil 9c0863b1cc [media] vb2: call buf_finish from __queue_cancel
If a queue was canceled, then the buf_finish op was never called for the
pending buffers. So add this call to queue_cancel. Before calling buf_finish
set the buffer state to PREPARED, which is the correct state. That way the
states DONE and ERROR will only be seen in buf_finish if streaming is in
progress.

Since buf_finish can now be called from non-streaming state we need to
adapt the handful of drivers that actually need to know this.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 06:56:39 -03:00
Hans Verkuil 1a17948184 [media] pwc: do not decompress the image unless the state is DONE
There is no point in trying to decompress a captured frame unless
the buffer state is OK. It won't be used in any other state, and
in fact the contents of the buffer might well be corrupt.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 06:56:38 -03:00
Hans Verkuil 0647064293 [media] vb2: change result code of buf_finish to void
The buf_finish op should always work, so change the return type to void.
Update the few drivers that use it.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Pawel Osciak <pawel@osciak.com>
Reviewed-by: Pawel Osciak <pawel@osciak.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 06:56:38 -03:00
Hans Verkuil b5b4541eef [media] vb2: add debugging code to check for unbalanced ops
When a vb2_queue is freed check if all the mem_ops and queue ops were balanced.
So the number of calls to e.g. buf_finish has to match the number of calls to
buf_prepare, etc.

This code is only enabled if CONFIG_VIDEO_ADV_DEBUG is set.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Pawel Osciak <pawel@osciak.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 06:56:37 -03:00
Hans Verkuil 952c9ee290 [media] vb2: fix PREPARE_BUF regression
Fix an incorrect test in vb2_internal_qbuf() where only DEQUEUED buffers
are allowed. But PREPARED buffers are also OK.

Introduced by commit 4138111a27
("vb2: simplify qbuf/prepare_buf by removing callback").

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 06:56:37 -03:00
Hans Verkuil 4e5a4d8a8e [media] vb2: fix read/write regression
Commit 88e268702b ("vb2: Improve file I/O
emulation to handle buffers in any order") broke read/write support if
the size of the buffer being read/written is less than the size of the
image.

When the commit was tested originally I used qv4l2, which calls read()
with exactly the size of the image. But if you try 'cat /dev/video0'
then it will fail and typically hang after reading two buffers.

This patch fixes the behavior by adding a new cur_index field that
contains the index of the field currently being filled/read, or it
is num_buffers in which case a new buffer needs to be dequeued.

The old index field has been renamed to initial_index in order to be
a bit more descriptive.

This has been tested with both read and write.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 06:56:36 -03:00
Ricardo Ribalda Delgado 249f5a58bc [media] vb2: Check if there are buffers before streamon
This patch adds a test preventing streamon() if there is no buffer
ready.

Without this patch, a user could call streamon() before
preparing any buffer. This leads to a situation where if he calls
close() before calling streamoff() the device is kept streaming.

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 <m.chehab@samsung.com>
2014-03-11 06:56:36 -03:00
Mauro Carvalho Chehab c897df0e2d Linux 3.14-rc5
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJTE+9XAAoJEHm+PkMAQRiGrMQIAKI2V49Kj8WlnwGchFvsbGJB
 SLALwNi33T/IBKdZRhrfryBu02Zj7eVvZ2ML35dJEnmF88O+dJBDMTkKV1xalrip
 mtkBrjUnfAI04fq/daLQ1TsAy4qqlra5tSTuDCw8ILOnGPwT0VydIEHNdtmoUIfw
 xlZLxHzny1MslZ78d7uR/cUnV9ylKRRajWzfw1HT8hL51fCt8nRWY0sCvwvl+kMJ
 LsK+6I7mHDUuzA7QBmBI+dhzQgos5+JkkrnpmqHAqwmIh+AI3ksmjUCQ4dM7owrO
 IvEx+ZNDqxAdLcm1WAxATNfxddFXHc62JTvKuuKqTVWuaxVfK1Aqt8MjDMIPeAQ=
 =yV5u
 -----END PGP SIGNATURE-----

Merge tag 'v3.14-rc5' into patchwork

Linux 3.14-rc5

* tag 'v3.14-rc5': (1117 commits)
  Linux 3.14-rc5
  drm/vmwgfx: avoid null pointer dereference at failure paths
  drm/vmwgfx: Make sure backing mobs are cleared when allocated. Update driver date.
  drm/vmwgfx: Remove some unused surface formats
  MAINTAINERS: add maintainer entry for Armada DRM driver
  arm64: Fix !CONFIG_SMP kernel build
  arm64: mm: Add double logical invert to pte accessors
  dm cache: fix truncation bug when mapping I/O to >2TB fast device
  perf tools: Fix strict alias issue for find_first_bit
  powerpc/powernv: Fix indirect XSCOM unmangling
  powerpc/powernv: Fix opal_xscom_{read,write} prototype
  powerpc/powernv: Refactor PHB diag-data dump
  powerpc/powernv: Dump PHB diag-data immediately
  powerpc: Increase stack redzone for 64-bit userspace to 512 bytes
  powerpc/ftrace: bugfix for test_24bit_addr
  powerpc/crashdump : Fix page frame number check in copy_oldmem_page
  powerpc/le: Ensure that the 'stop-self' RTAS token is handled correctly
  kvm, vmx: Really fix lazy FPU on nested guest
  perf tools: fix BFD detection on opensuse
  drm/radeon: enable speaker allocation setup on dce3.2
  ...
2014-03-11 06:55:49 -03:00
Philipp Zabel f2a575f676 [media] of: move common endpoint parsing to drivers/of
This patch adds a new struct of_endpoint which is then embedded in struct
v4l2_of_endpoint and contains the endpoint properties that are not V4L2
(or even media) specific: the port number, endpoint id, local device tree
node and remote endpoint phandle. of_graph_parse_endpoint parses those
properties and is used by v4l2_of_parse_endpoint, which just adds the
V4L2 MBUS information to the containing v4l2_of_endpoint structure.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
2014-03-06 17:41:48 +01:00
Philipp Zabel fd9fdb78a9 [media] of: move graph helpers from drivers/media/v4l2-core to drivers/of
This patch moves the parsing helpers used to parse connected graphs
in the device tree, like the video interface bindings documented in
Documentation/devicetree/bindings/media/video-interfaces.txt, from
drivers/media/v4l2-core/v4l2-of.c into drivers/of/base.c.

This allows to reuse the same parser code from outside the V4L2
framework, most importantly from display drivers.
The functions v4l2_of_get_next_endpoint, v4l2_of_get_remote_port,
and v4l2_of_get_remote_port_parent are moved. They are renamed to
of_graph_get_next_endpoint, of_graph_get_remote_port, and
of_graph_get_remote_port_parent, respectively.
Since there are not that many current users yet, switch all of
them to the new functions right away.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
2014-03-06 17:41:22 +01:00
Peter Meerwald 1e9c4d4902 [media] omap3isp: Fix kerneldoc for _module_sync_is_stopping and isp_isr()
Use the correct name in the comment describing function
omap3isp_module_sync_is_stopping().

isp_isr() never returned IRQ_NONE, remove the comment saying so.

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 17:02:07 -03:00
Lad, Prabhakar 872aba5103 [media] omap3isp: Rename the variable names in description
This patch renames the variable in the description to match it
appropriately to function definition.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 17:01:43 -03:00
Lad, Prabhakar fdf7bbe24d [media] omap3isp: ispccdc: Remove unwanted comments
This patch removes the description of members which does not exists for
ispccdc_lsc structure.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 17:00:56 -03:00
Lad, Prabhakar 25aeb418c6 [media] omap3isp: Fix typos
Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 17:00:23 -03:00
Edgar Thier e72ed08e66 [media] uvcvideo: Add bayer 8-bit patterns to uvcvideo
Add bayer 8-bit GUIDs to uvcvideo and associated them with the
corresponding V4L2 pixel formats.

Signed-off-by: Edgar Thier <info@edgarthier.net>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 16:58:21 -03:00
Oleksij Rempel b1e43f2326 [media] uvcvideo: Do not use usb_set_interface on bulk EP
The UVC specification uses alternate setting selection to notify devices
of stream start/stop. This breaks when using bulk-based devices, as the
video streaming interface has a single alternate setting in that case,
making video stream start and video stream stop events to appear
identical to the device. Bulk-based devices are thus not well supported
by UVC.

The webcam built in the Asus Zenbook UX302LA ignores the set interface
request and will keep the video stream enabled when the driver tries to
stop it. If USB autosuspend is enabled the device will then be suspended
and will crash, requiring a cold reboot.

USB trace capture showed that Windows sends a CLEAR_FEATURE(HALT)
request to the bulk endpoint when stopping the stream instead of
selecting alternate setting 0. The camera then behaves correctly, and
thus seems to require that behaviour.

Replace selection of alternate setting 0 with clearing of the endpoint
halt feature at video stream stop for bulk-based devices. Let's refrain
from blaming Microsoft this time, as it's not clear whether this
Windows-specific but USB-compliant behaviour was specifically developed
to handle bulkd-based UVC devices, or if the camera just took advantage
of it.

CC: stable@vger.kernel.org
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 16:57:46 -03:00
Sakari Ailus 309f4d62ed [media] v4l: Copy timestamp source flags to destination on m2m devices
Copy the flags containing the timestamp source from source buffer flags to
the destination buffer flags on memory-to-memory devices. This is analogous
to copying the timestamp field from source to destination.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 16:47:15 -03:00
Sakari Ailus 599b08929e [media] exynos-gsc, m2m-deinterlace, mx2_emmaprp: Copy v4l2_buffer data from src to dst
The timestamp and timecode fields were copied from destination to source,
not the other way around as they should. Fix it.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 16:45:58 -03:00
Sakari Ailus c767492a58 [media] uvcvideo: Tell the user space we're using start-of-exposure timestamps
The UVC device provided timestamps are taken from the clock once the
exposure of the frame has begun, not when the reception of the frame would
have been finished as almost anywhere else. Show this to the user space by
using V4L2_BUF_FLAG_TSTAMP_SRC_SOE buffer flag.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 16:34:50 -03:00
Sakari Ailus 7ce6fd8f18 [media] v4l: Handle buffer timestamp flags correctly
For COPY timestamps, buffer timestamp source flags will traverse the queue
untouched.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 16:34:50 -03:00
Sakari Ailus 872484ce40 [media] v4l: Add timestamp source flags, mask and document them
Some devices do not produce timestamps that correspond to the end of the
frame. The user space should be informed on the matter. This patch achieves
that by adding buffer flags (and a mask) for timestamp sources since more
possible timestamping points are expected than just two.

A three-bit mask is defined (V4L2_BUF_FLAG_TSTAMP_SRC_MASK) and two of the
eight possible values is are defined V4L2_BUF_FLAG_TSTAMP_SRC_EOF for end of
frame (value zero) V4L2_BUF_FLAG_TSTAMP_SRC_SOE for start of exposure (next
value).

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Kamil Debski <k.debski@samsung.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 16:34:49 -03:00
Sakari Ailus c57ff79270 [media] v4l: Timestamp flags will soon contain timestamp source, not just type
Mask out other bits when comparing timestamp types.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 16:34:49 -03:00
Sakari Ailus ade48681f1 [media] v4l: Rename vb2_queue.timestamp_type as timestamp_flags
The timestamp_type field used to contain only the timestamp type. Soon it
will be used for timestamp source flags as well. Rename the field
accordingly.

[m.chehab@samsung.com: do the change also to drivers/staging/media and at s2255]
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 16:34:14 -03:00
Hans Verkuil f1343281d8 [media] vb2: fix timecode and flags handling for output buffers
When sending a buffer to a video output device some of the fields need
to be copied so they arrive in the driver. These are the KEY/P/BFRAME
flags and the TIMECODE flag, and, if that flag is set, the timecode field
itself.

There are a number of functions involved in this: the __fill_vb2_buffer()
is called while preparing a buffer. For output buffers the buffer contains
the video data, so any meta data associated with that (KEY/P/BFRAME and
the field information) should be stored at that point.

The timecode, timecode flag and timestamp information is not part of that,
that information will have to be set when vb2_internal_qbuf() is called to
actually queue the buffer to the driver. Usually VIDIOC_QBUF will do the
prepare as well, but you can call PREPARE_BUF first and only later VIDIOC_QBUF.
You most likely will want to set the timestamp and timecode when you actually
queue the buffer, not when you prepare it.

Finally, in buf_prepare() make sure the timestamp and sequence fields are
actually cleared so that when you do a QUERYBUF of a prepared-but-not-yet-queued
buffer you will not see stale timestamp/sequence data.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 16:18:59 -03:00
Antti Palosaari 80807fada4 [media] v4l: add RF tuner gain controls
Modern silicon RF tuners used nowadays has many controllable gain
stages on signal path. Usually, but not always, there is at least
3 gain stages. Also on some cases there could be multiple gain
stages within the ones specified here. However, I think that having
these three controllable gain stages offers enough fine-tuning for
real use cases.

1) LNA gain. That is first gain just after antenna input.
2) Mixer gain. It is located quite middle of the signal path, where
RF signal is down-converted to IF/BB.
3) IF gain. That is last gain in order to adjust output signal level
to optimal level for receiving party (usually demodulator ADC).

Each gain stage could be set rather often both manual or automatic
(AGC) mode. Due to that add separate controls for controlling
operation mode.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 15:46:56 -03:00
Antti Palosaari 92d20d9fd1 [media] rtl2832: implement delayed I2C gate close
Delay possible I2C gate close a little bit in order to see if there
is next message coming to tuner in a sequence.

Also, export private muxed I2C adapter. That is aimed only for SDR
extension module as SDR belongs to same RTL2832 physical I2C bus (it
is physically property of RTL2832, whilst it is own kernel module).

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 15:41:18 -03:00
Luis Alves 0db5c800aa [media] rtl2832: Fix deadlock on i2c mux select function
Signed-off-by: Luis Alves <ljalvs@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 15:39:34 -03:00
Antti Palosaari 0ea872d43e [media] rtl2832: add muxed I2C adapter for demod itself
There was a deadlock between master I2C adapter and muxed I2C
adapter. Implement two I2C muxed I2C adapters and leave master
alone, just only for offering I2C adapter for these mux adapters.

Reported-by: Luis Alves <ljalvs@gmail.com>
Reported-by: Benjamin Larsson <benjamin@southpole.se>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 15:39:17 -03:00
Antti Palosaari 8823f0288d [media] rtl2832: provide muxed I2C adapter
RTL2832 provides gated / repeater I2C adapter for tuner.
Implement it as a muxed I2C adapter.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 15:38:28 -03:00
Antti Palosaari 3ca2418d70 [media] rtl2832: style changes and minor cleanup
Most of those were reported by checkpatch.pl...

debug module parameter is not used anywhere so remove it.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 15:38:01 -03:00
Antti Palosaari 5791eee264 [media] rtl2832: remove unused if_dvbt config parameter
All used tuners has get_if_frequency() callback and that parameter
is not needed and will not needed as all upcoming tuner drivers
should implement get_if_frequency().

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 15:36:59 -03:00
Antti Palosaari 94b5fa6c20 [media] rtl28xxu: add module parameter to disable IR
Disable IR interrupts in order to avoid SDR sample loss.
IR interrupts causes some extra load for device and it seems
be one reason to loss samples when sampling rate is high.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 15:36:26 -03:00
Antti Palosaari 96a5b3a869 [media] xc2028: silence compiler warnings
There is now new tuner types which are not handled on that switch-case.
Print error if unknown tuner type is meet.

drivers/media/tuners/tuner-xc2028.c: In function ‘generic_set_freq’:
drivers/media/tuners/tuner-xc2028.c:1037:2: warning: enumeration value ‘V4L2_TUNER_ADC’ not handled in switch [-Wswitch]
  switch (new_type) {
  ^
drivers/media/tuners/tuner-xc2028.c:1037:2: warning: enumeration value ‘V4L2_TUNER_RF’ not handled in switch [-Wswitch]

Cc: Mauro Carvalho Chehab <m.chehab@samsung.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 15:35:25 -03:00
Hans Verkuil bfffd7431c [media] v4l: do not allow modulator ioctls for non-radio devices
Modulator ioctls could be enabled mistakenly for non-radio devices.
Currently those ioctls are only valid for radio. Fix it.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 14:16:00 -03:00
Antti Palosaari 582c52cb9c [media] v4l: enable some IOCTLs for SDR receiver
Enable stream format (FMT) IOCTLs for SDR use. These are used for negotiate
used data stream format.

Reorganise some some IOCTL selection logic.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Acked-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 14:15:20 -03:00
Antti Palosaari 6f3073b8dc [media] v4l: add stream format for SDR receiver
Add new V4L2 stream format definition, V4L2_BUF_TYPE_SDR_CAPTURE,
for SDR receiver.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 14:15:12 -03:00
Antti Palosaari 84099a282e [media] v4l: add new tuner types for SDR
Define tuner types V4L2_TUNER_ADC and V4L2_TUNER_RF for SDR usage.

ADC is used for setting sampling rate (sampling frequency) to SDR
device.

Another tuner type, named as V4L2_TUNER_RF, is possible RF tuner.
Is is used to down-convert RF frequency to range ADC could sample.
Having RF tuner is optional, whilst in practice it is almost always
there.

Also add checks to VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY and
VIDIOC_ENUM_FREQ_BANDS only allow these two tuner types when device
type is SDR (VFL_TYPE_SDR). For VIDIOC_G_FREQUENCY we do not check
tuner type, instead override type with V4L2_TUNER_ADC in every
case (requested by Hans in order to keep functionality in line with
existing tuners and existing API does not specify it).

Prohibit VIDIOC_S_HW_FREQ_SEEK explicitly when device type is SDR,
as device cannot do hardware seek without a hardware demodulator.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 14:15:03 -03:00
Antti Palosaari d42626bda4 [media] v4l: add device type for Software Defined Radio
Add new V4L device type VFL_TYPE_SDR for Software Defined Radio.
It is registered as /dev/swradio0 (/dev/sdr0 was already reserved).

Signed-off-by: Antti Palosaari <crope@iki.fi>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 14:14:59 -03:00
Mauro Carvalho Chehab 59432be1c7 [media] em28xx: Add LED support for Kworld UB435-Q v3
This device has a led at bit 7 of GPIO reg. 0x80 to indicate
when a DVB capture is happening.

Add support for it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:44:18 -03:00
Mauro Carvalho Chehab 54e925498c [media] em28xx: add support for DVB monitor led
Some devices have a LED to indicate when DVB capture started.
Add support for it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:44:09 -03:00
Mauro Carvalho Chehab 02bc1f5574 [media] em28xx: add support for Kworld UB435-Q version 3
This device is close to Kworld UB435-Q, but it uses a different
tuner. Add support for it.

Tested with both 8VSB and 256QAM modulations.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:43:59 -03:00
Mauro Carvalho Chehab 6cff36b23b [media] tda18212: add support for ATSC and clearQAM on tda18272
tda18272 is programmed just like tda18212, but it also
supports ClearQAM and ATSC.

Add support for them. Tested with a Kworld UB435-Q on both
8VSB and 256QAM modes.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:43:43 -03:00
Mauro Carvalho Chehab a5e7a67f9e [media] drx-j: set it to serial mode by default
Currently, there's just one device using this frontend: PCTV 80e,
and it works on serial mode.

Change the default here to serial mode. If we add more devices,
then this option should be set via config structure.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:42:09 -03:00
Mauro Carvalho Chehab 41b5cc0c91 [media] drx-j: Properly initialize mpeg struct before using it
The cfg_mpeg_output has more fields than what it is initialized
when the code is called. Be sure to initialize everything before
use, in order to avoid random behaviors.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:42:00 -03:00
Mauro Carvalho Chehab bf9b94ab92 [media] drx-j: disable OOB
Just like the windows driver, disable OOB after setting the driver
version.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:41:49 -03:00
Shuah Khan 1ad77b5c29 [media] drx-j: fix boot failure due to null pointer dereference
DJH_DEBUG only code path in drxbsp_i2c_write_read() dereferences
w_dev_addr and subsequently w_dev_addr->user_data->i2c which results
in failure during boot. This patch fixes the null pointer derefence
bug as well as the following compile errors:

  LD      arch/x86/built-in.o
  CC      drivers/media/dvb-frontends/drx39xyj/drxj.o
drivers/media/dvb-frontends/drx39xyj/drxj.c: In function ‘drxbsp_i2c_write_read’:
drivers/media/dvb-frontends/drx39xyj/drxj.c:1558:25: error: redeclaration of ‘state’ with no linkage
  struct drx39xxj_state *state = w_dev_addr->user_data;
                         ^
drivers/media/dvb-frontends/drx39xyj/drxj.c:1512:25: note: previous declaration of ‘state’ was here
  struct drx39xxj_state *state;
                         ^
drivers/media/dvb-frontends/drx39xyj/drxj.c:1558:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  struct drx39xxj_state *state = w_dev_addr->user_data;
  ^
drivers/media/dvb-frontends/drx39xyj/drxj.c:1560:17: error: redeclaration of ‘msg’ with no linkage
  struct i2c_msg msg[2] = {
                 ^
drivers/media/dvb-frontends/drx39xyj/drxj.c:1513:17: note: previous declaration of ‘msg’ was here
  struct i2c_msg msg[2];
                 ^

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:41:29 -03:00
Shuah Khan 546ef6bf25 [media] drx-j: remove return that prevents DJH_DEBUG code to run
drxbsp_i2c_write_read() has return that prevents DJH_DEBUG code to run.
Remove it.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:41:14 -03:00
Shuah Khan 6c955b8b3b [media] drx-j: fix pr_dbg undefined compile errors when DJH_DEBUG is defined
drxj.c fails to compile with the following errors when DJH_DEBUG
is defined.

drivers/media/dvb-frontends/drx39xyj/drxj.c:1567:2: error: implicit declaration of function ‘pr_dbg’ [-Werror=implicit-function-declaration]
  pr_dbg("drx3933 i2c operation addr=%x i2c=%p, wc=%x rc=%x\n",
  ^

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:41:04 -03:00
Mauro Carvalho Chehab 8afff9a23f [media] drx-j: be sure to do a full software reset
Mimic what windows driver does here: it writes 0x07 to
SIO_CC_SOFT_RST__A, instead of just 0x03.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:40:54 -03:00
Mauro Carvalho Chehab d7a5478a8a [media] drx-j: be sure to send the powerup command at device open
As drxj_close puts the device in powerdown, we need to power it up
properly at drxj_open.

This is the behavior noticed at the Windows driver.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:40:43 -03:00
Mauro Carvalho Chehab 9e4c509d74 [media] drx-j: Use single master mode
There are no other I2C masters here. Also, the Windows driver uses
this mode (and both drxd and drxk Kernel drivers). So, switch
to it.

That helps to compare the logs between the Linux driver and the
Windows one.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:40:29 -03:00
Mauro Carvalho Chehab ea8f3c2c60 [media] drx-j: Allow userspace control of LNA
Instead of just disabling the LNA every time, allow to control it from
userspace.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:40:10 -03:00
Mauro Carvalho Chehab 244c0e06bf [media] drx-j: get rid of function wrappers
On several places, the I2C functions are just wrappers to others.

Get rid of it.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:40:00 -03:00
Mauro Carvalho Chehab 80bff4b075 [media] drx-j: get rid of struct drx_dap_fasi_funct_g
This struct contains the first abstraction layer for the I2C
access routines. Get rid of it.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:39:44 -03:00
Mauro Carvalho Chehab 73b3fc3d74 [media] drx-j: get rid of drx_dap_fasi.c
This file contains an abstract layer for the I2C transfer
functions. Get rid of it, merging it at drxj. This will allow
to remove another abstraction layer there, making the code
easier to read, and removing the functions that just return
-EIO.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:39:06 -03:00
Mauro Carvalho Chehab 0ad0c37c7c [media] drx-j: get rid of function prototypes at drx_dap_fasi.c
Reorder functions and data at drx_dap_fasi.c, in order to avoid
having function prototypes.

This is in preparation to merge this code inside drxj, removing
some duplicated bits there, and getting rid of yet another
abstraction layer.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:38:54 -03:00
Mauro Carvalho Chehab 97a8918abf [media] drx-j: Get rid of I2C protocol version
This is not used anywere. Get rid of it.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:38:42 -03:00
Mauro Carvalho Chehab 938f11fa3f [media] drx-j: Fix qam/256 mode
QAM/256 currently doesn't work, as the code is only called if
channel->mirror is DRX_MIRROR_AUTO, but a prevous if prevents
this condition to happen.

While here, returns -EINVAL to not supported QAM modes and
simplify the code, reducing the number of indents.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:38:30 -03:00
Mauro Carvalho Chehab 096c8fac7d [media] drx-j: remove some unused data
Those struct data aren't used anymore. Get rid of them.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:37:53 -03:00
Mauro Carvalho Chehab ceea5e2d9d [media] drx-j: use the proper timeout code on scu_command
Checking if a time is after another one can have issues, as
times are generally u32 wide.

Use the proper macros for that at scu_command().

It should be noticed that other places also use jiffies
calculus on an improper way. This should be fixed too,
but the logic there is more complex. So, let's do it in
separate patches.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:37:41 -03:00
Mauro Carvalho Chehab c4dc6f9222 [media] drx-j: call ctrl_set_standard even if a standard is powered
Modulation and other parameters might have changed. So, better
to call ctrl_set_standard() even if the device is already
powered.

That helps to put the device into a sane state, if something
got wrong on a previous set_frontend call.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:37:09 -03:00
Mauro Carvalho Chehab c76286bafc [media] drx-j: avoid calling power_down_foo twice
When switching from one video standard to another one,
power_down_vsb is called twice. Well, as the device is already
in power_down mode, the second call always fail. This causes that
any subsequent frontend set to fail as well:

[145074.501243] drx39xyj:power_down_vsb: called
[145089.195396] drx39xyj:power_down_vsb: error -5
[145089.195404] drx39xyj:ctrl_set_standard: error -5
[145089.195417] drx39xyj:drx39xxj_set_frontend: Failed to set standard! result=fffffffb
[145089.195470] drx39xyj:ctrl_sig_quality: error -5
[145089.195473] drx39xyj:drx39xxj_read_ber: drx39xxj: could not get ber!
[145089.195475] drx39xyj:ctrl_sig_quality: error -5
[145089.195477] drx39xyj:drx39xxj_read_signal_strength: drx39xxj: could not get signal strength!
[145089.195479] drx39xyj:ctrl_sig_quality: error -5
[145089.195480] drx39xyj:drx39xxj_read_snr: drx39xxj: could not read snr!
[145089.195482] drx39xyj:ctrl_sig_quality: error -5
[145089.195484] drx39xyj:drx39xxj_read_ucblocks: drx39xxj: could not get uc blocks!
[145089.195498] drx39xyj:ctrl_sig_quality: error -5
[145089.195500] drx39xyj:drx39xxj_read_ber: drx39xxj: could not get ber!
[145089.195502] drx39xyj:ctrl_sig_quality: error -5
[145089.195503] drx39xyj:drx39xxj_read_signal_strength: drx39xxj: could not get signal strength!
[145089.195505] drx39xyj:ctrl_sig_quality: error -5
[145089.195506] drx39xyj:drx39xxj_read_snr: drx39xxj: could not read snr!
[145089.195508] drx39xyj:ctrl_sig_quality: error -5
[145089.195510] drx39xyj:drx39xxj_read_ucblocks: drx39xxj: could not get uc blocks!
[145090.196291] drx39xyj:drx39xxj_read_status: drx39xxj: could not get lock status!
[145090.196508] drx39xyj:ctrl_sig_quality: error -5
[145090.196511] drx39xyj:drx39xxj_read_ber: drx39xxj: could not get ber!
[145090.196514] drx39xyj:ctrl_sig_quality: error -5
[145090.196515] drx39xyj:drx39xxj_read_signal_strength: drx39xxj: could not get signal strength!
[145090.196518] drx39xyj:ctrl_sig_quality: error -5
[145090.196519] drx39xyj:drx39xxj_read_snr: drx39xxj: could not read snr!
[145090.196522] drx39xyj:ctrl_sig_quality: error -5
[145090.196523] drx39xyj:drx39xxj_read_ucblocks: drx39xxj: could not get uc blocks!
[145090.196553] drx39xyj:ctrl_sig_quality: error -5
[145090.196554] drx39xyj:drx39xxj_read_ber: drx39xxj: could not get ber!
[145090.196557] drx39xyj:ctrl_sig_quality: error -5
[145090.196558] drx39xyj:drx39xxj_read_signal_strength: drx39xxj: could not get signal strength!
[145090.196560] drx39xyj:ctrl_sig_quality: error -5
[145090.196562] drx39xyj:drx39xxj_read_snr: drx39xxj: could not read snr!
[145090.196564] drx39xyj:ctrl_sig_quality: error -5
[145090.196565] drx39xyj:drx39xxj_read_ucblocks: drx39xxj: could not get uc blocks!
[145091.119265] drx39xyj:ctrl_sig_quality: error -5
[145091.119271] drx39xyj:drx39xxj_read_ber: drx39xxj: could not get ber!
[145091.119274] drx39xyj:ctrl_sig_quality: error -5
[145091.119276] drx39xyj:drx39xxj_read_signal_strength: drx39xxj: could not get signal strength!
[145091.119278] drx39xyj:ctrl_sig_quality: error -5
[145091.119280] drx39xyj:drx39xxj_read_snr: drx39xxj: could not read snr!
[145091.119282] drx39xyj:ctrl_sig_quality: error -5
[145091.119283] drx39xyj:drx39xxj_read_ucblocks: drx39xxj: could not get uc blocks!

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:36:59 -03:00
Mauro Carvalho Chehab 7abc7a54da [media] drx-j: be sure to use tuner's IF
Instead of just hardcoding an IF value of 5MHz, use the one
provided by the tuner, with can be different for QAM and
VSB.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:36:48 -03:00
Mauro Carvalho Chehab a6530ce54b [media] drx-j: get rid of tuner dummy get/set frequency
Those functions will never be used with Linux DVB binding.

Get rid of them.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:36:39 -03:00
Mauro Carvalho Chehab d7b0631eb2 [media] drx-j: remove some ugly bindings from drx39xxj_dummy.c
This file does an ugly binding between drxj and DVB frontend.

Remove most of the functions there. We still need to get rid of
get_frequency and set_frequency, but such patch is a little more
complex, as it should also remove some previous tuner bindings.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:36:26 -03:00
Mauro Carvalho Chehab 74c8794a8f [media] drx-j: comment or remove unused code
In order to avoid warnings and to remove dead code, remove
the functions that don't make sense to happen, while commenting
the others that might still be useful some day.

That reduced a lot the text size:

Before:

   text	   data	    bss	    dec	    hex	filename
  58419	   2916	      4	  61339	   ef9b	drivers/media/dvb-frontends/drx39xyj/drx39xyj.ko

After:
   text	   data	    bss	    dec	    hex	filename
  78331	   2916	      4	  81251	  13d63	drivers/media/dvb-frontends/drx39xyj/drx39xyj.ko

Without any functional changes.

It could be make sense latter to remove those drivers or to
move them into an analog-specific part of the driver.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:36:10 -03:00
Mauro Carvalho Chehab b0baeb494e [media] drx-j: get rid of drxj_ctrl()
With this change, we finally got rid of all abstraction
layers on this driver.

This patch also fixes the LNA GPIO settings, as the original
code were using a wrong control name for it.

This patch exposes the several functions that aren't used.
Some of them are related to analog demod that might be
used some day, but others will likely never be needed, as
they don't fit on Linux media APIs.

Latter patches will clean up this mess.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:35:57 -03:00
Mauro Carvalho Chehab 190137478f [media] drx-j: move drx39xxj into drxj.c
While drxj is already too big, moving the code there will
make easier to get rid of the drxj_ctrl function.

It will also help to detect and remove the unused functions,
helping to remove lots of dead code there.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:35:43 -03:00
Mauro Carvalho Chehab b78359a689 [media] drx-j: get rid of the remaining drx generic functions
Get rid of drx_open and drx_close, as those are just wrapper
functions to drxj_open/drxj_close.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:35:31 -03:00
Mauro Carvalho Chehab dc5a91d49d [media] drx-j: get rid of drx_ctrl
This function is used only as an abstraction layer to call the
two firmware functions. Remove it.

As a bonus, the drx_ctrl_function is now unused and can be
removed.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:35:18 -03:00