Commit graph

18898 commits

Author SHA1 Message Date
Sonic Zhang 7ba3c21c17 [media] v4l2: bfin: Ensure delete and reinit list entry on NOMMU architecture
On NOMMU architecture page fault is not triggered if a deleted list entry is
accessed without reinit.

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Acked-by: Scott Jiang <scott.jiang.linux@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 17:14:14 -03:00
Sonic Zhang f7d0e6d67f [media] media: blackfin: ppi: Pass device pointer to request peripheral pins
if the pinctrl driver is enabled.

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Acked-by: Scott Jiang <scott.jiang.linux@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 17:12:30 -03:00
Frank Schaefer 3d3a41098e [media] em28xx-v4l: fix disabling ioctl VIDIOC_S_PARM for vbi devices
Fixes an old copy+paste bug that has survived all recent code
changes in this code area.

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

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

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

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

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

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

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

Signed-off-by: Raimonds Cicans <ray@apollo.lv>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 15:09:47 -03:00
Christopher Reimer 93961435d0 [media] ddbridge: Add IDs for several newer Digital Devices cards
This patch adds the necessary IDs for the following dvb cards:

Digital Devices Octopus Mini
Digital Devices Cine S2 V6.5
Digital Devices DVBCT V6.1
Digital Devices Octopus V3
Mystique SaTiX-S2 V3

All these changes are taken from the official driver package by Digital
Devices.
http://download.digital-devices.de/download/linux/

[m.chehab@samsung.com: Fixed whitespace mangling]
Signed-off-by: Christopher Reimer <mail@creimer.net>
Tested-by: "D. Herrendoerfer" <d.herrendoerfer@herrendoerfer.name>

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

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 14:55:00 -03:00
Heinrich Schuchardt 40feb52fb6 [media] media: saa7134: remove if based on uninitialized variable
Variable b is not initialized.
Only with a small chance it has random value 0xFF.
Remove if statement based on this value.

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

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 12:04:10 -03:00
Mauro Carvalho Chehab 60ecb71a72 [media] remove some new warnings on drxj
changeset b601fe5688 did some cleanup, but didn't remove some
now unused vars:
	drivers/media/dvb-frontends/drx39xyj/drxj.c: In function 'drx39xxj_set_frontend':
	drivers/media/dvb-frontends/drx39xyj/drxj.c:12072:21: warning: unused variable 'uio_data' [-Wunused-variable]
	drivers/media/dvb-frontends/drx39xyj/drxj.c: In function 'drx39xxj_set_lna':
	drivers/media/dvb-frontends/drx39xyj/drxj.c:12230:21: warning: unused variable 'uio_data' [-Wunused-variable]
	drivers/media/dvb-frontends/drx39xyj/drxj.c:12229:20: warning: unused variable 'uio_cfg' [-Wunused-variable]
	drivers/media/dvb-frontends/drx39xyj/drxj.c:12224:6: warning: unused variable 'result' [-Wunused-variable]

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:57:09 -03:00
Mauro Carvalho Chehab b862b3736e [media] cx23885-dvb: remove previously overriden value
drivers/media/pci/cx23885/cx23885-dvb.c:768:2: warning: initialized field overwritten [-Woverride-init]
  .freq_offset_khz_vhf = 550,
  ^
drivers/media/pci/cx23885/cx23885-dvb.c:768:2: warning: (near initialization for 'dib7070p_dib0070_config.freq_offset_khz_vhf') [-Woverride-init]

Cc: James Harper <james.harper@ejbdigital.com.au>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:55:11 -03:00
Mauro Carvalho Chehab a39e2866e5 [media] cx23885 now needs to select dib0070
Due to DViCO FusionHDTV DVB-T Dual Express2, we also need to
autoselect this tuner.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:55:10 -03:00
James Harper 46b21bbaa8 [media] Add support for DViCO FusionHDTV DVB-T Dual Express2
DViCO FusionHDTV DVB-T Dual Express2 is cx23885 + dib7070

[m.chehab@samsung.com: fix conflicts and make checkpatch happy]

Signed-off-by: James Harper <james.harper@ejbdigital.com.au>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:55:03 -03:00
James Harper 7b4eeed174 [media] vmalloc_sg: make sure all pages in vmalloc area are really DMA-ready
Patch originally written by Konrad. Rebased on current linux media tree.

Under Xen, vmalloc_32() isn't guaranteed to return pages which are really
under 4G in machine physical addresses (only in virtual pseudo-physical
addresses).  To work around this, implement a vmalloc variant which
allocates each page with dma_alloc_coherent() to guarantee that each
page is suitable for the device in question.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: James Harper <james.harper@ejbdigital.com.au>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:33:15 -03:00
Shuah Khan b601fe5688 [media] media: drx39xyj - use drxj_set_lna_state() and remove duplicate LNA code
drx39xxj_set_lna() and drx39xxj_set_frontend() set LNA. Instead of
duplicating LNA configure code, change to use drxj_set_lna_state()
which sets LNA to the caller requested state (on or off).

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:22:51 -03:00
Shuah Khan 3074187111 [media] media: drx39xyj - fix to return actual error codes instead of -EIO
Several functions ignore the return values in error legs and always
return -EIO. This makes it hard to debug and take proper action in
calling routines.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:22:30 -03:00
Shuah Khan 998819d271 [media] media: drx39xyj - add resume support
drx39xyj driver lacks resume support. Add support by changing
its fe ops init interface to detect the resume status by checking
fe exit flag and do the necessary initialization. With this change,
driver resume correctly in both dvb adapter is not in use and in use
by an application cases.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:22:05 -03:00
Shuah Khan 87cd0fa811 [media] media: dvb-core add new flag exit flag value for resume
Some fe drivers will have to do additional initialization
in their fe ops.init interfaces when called during resume.
Without the additional initialization, fe and tuner driver
resume fails. A new fe exit flag value DVB_FE_DEVICE_RESUME
is necessary to detect resume case. This patch adds a new
define and changes dvb_frontend_resume() to set it prior to
calling fe init and tuner init calls and resets it back to
DVB_FE_NO_EXIT once fe and tuner init is done.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:20:10 -03:00
Shuah Khan 5b22b1a4f7 [media] media: drx39xyj driver change to check fe exit flag from release
Change drx39xyj_release() to check fe exit flag to detect the
device disconnect state and avoid accessing the device after
it has been removed.

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

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:18:57 -03:00
Shuah Khan 18ed2860cb [media] media: dvb-core move fe exit flag from fepriv to fe for driver access
Some fe drivers attempt to access the device for power control from
their release routines. When release routines are called after device
is disconnected, the attempts fail. fe drivers should avoid accessing
the device, from their release interfaces when called from disconnect
path. dvb-frontend maintains exit flag to keep track when fe device is
disconnected in its private data structures. Export the flag in fe to
enable drivers to check the device status from their release interfaces.

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

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

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

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

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

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

Signed-off-by: James Harper <james.harper@ejbdigital.com.au>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 00:51:02 -03:00
Fabio Estevam 08c8d14e75 [media] coda: Propagate the correct error on devm_request_threaded_irq()
If devm_request_threaded_irq() fails, we should better propagate the real error.

Also, print out the error code in the dev_err message.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 00:38:27 -03:00
Fabio Estevam 7d37743a3e [media] coda: Return the real error on platform_get_irq()
No need to return a 'fake' return value on platform_get_irq() failure.

Propagate the real error instead.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 00:37:26 -03:00
George Spelvin 356237d67a [media] ati_remote: Better default keycodes
This tries to make them more like other remotes, and/or
the button labels.

Notably, the (>>) button is made KEY_FASTFORWARD, which is the
correct opposite of (<<)'s KEY_REVERSE.  (It was KEY_FORWARD,
something else entirely.)

Likewise, KEY_STOP is the Sun keyboard "interrupt program" key;
the media key is KEY_STOPCD.

A restriction is that I try to avoid keycodes above 255, as the X11
client/server protocol is limited to 8-bit key codes.  If not for
this, I would have used the KEY_NUMERIC_x codes for the numbers.

Signed-off-by: George Spelvin <linux@horizon.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-25 23:59:06 -03:00
George Spelvin 220edfb0f7 [media] ati_remote: Add comments to keycode table
A more detailed description of what the buttons look like and
their intended function makes it easier for people to maintain
this code without access to the hardware.

[m.chehab@samsung.com: Fixed a typo "Mdeia" instead of "Media"]
Signed-off-by: George Spelvin <linux@horizon.com>

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-25 23:54:32 -03:00
George Spelvin d701c8318b [media] ati_remote: Sort buttons in top-to-bottom order
Since numerical order corresponds to top-left-to-bottom-right
order on the remote, this makes the table easier to read.

Signed-off-by: George Spelvin <linux@horizon.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-25 23:52:59 -03:00
George Spelvin 1e182708c2 [media] ati_remote: Use non-alomic __set_bit
There's no reason to use a LOCK prefix here.

Signed-off-by: George Spelvin <linux@horizon.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-25 23:52:15 -03:00
George Spelvin 89b0c0d277 [media] ati_remote: Merge some duplicate code
The KIND_FILTERED assignment of old_jiffies can't be merged, because
it must precede repeat handling.

Signed-off-by: George Spelvin <linux@horizon.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-25 23:51:51 -03:00
George Spelvin 3f245b9cb4 [media] ati_remote: Shrink the ati_remote_tbl even more
Get rid of the unnecessary "type" and "value" fields.

Signed-off-by: George Spelvin <linux@horizon.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-25 23:50:58 -03:00
George Spelvin 8ecd5e32d8 [media] ati_remote: Generalize KIND_ACCEL to accept diagonals
Rather than having special code cases for diagonal mouse
movements, extend the general purpose code used for the
cardinal directions to handle arbitrary (x,y) deltas.

The deltas themselves are stored in translation table's "code"
field; this is also progress toward the goal of eliminating
the "value" element entirely.

Signed-off-by: George Spelvin <linux@horizon.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-25 23:48:41 -03:00
George Spelvin f95589cc41 [media] ati_remote: Delete superfluous input_sync()
It's not necessary, and since both events happen "at the same time"
in response to a single input event, the input device framework prefers
not to have it there.

(It's not a big deal one way or the other, but deleting cruft
is generally a good thing.)

Signed-off-by: George Spelvin <linux@horizon.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-25 23:46:56 -03:00
George Spelvin 528abb9888 [media] ati_remote: Shrink ati_remote_tbl structure
The variable types are simply larger than they need to be.
Shrink to signed and unsigned chars.

Signed-off-by: George Spelvin <linux@horizon.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-25 23:46:32 -03:00
George Spelvin 20d7e3ca1b [media] ati_remote: Check the checksum
An input report is 4 bytes long, but there are only 12 bits
of actual payload.  The 4 bytes are:
data[0] = 0x14
data[1] = data[2] + data[3] + 0xd5 (a checksum byte)
data[2] = the raw scancode (plus toggle bit in msbit)
data[3] = channel << 4 (the low 4 bits must be zero)

Ignore reports with a bad checksum.

Signed-off-by: George Spelvin <linux@horizon.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-25 23:44:23 -03:00
David Härdeman d6740d86de [media] rc-core: fix various sparse warnings
Fix various sparse warnings under drivers/media/rc/*.c, mostly
by making functions static.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-25 20:07:39 -03:00
David Härdeman 4924a311a6 [media] rc-core: rename ir-raw.c
Better to be coherent and prefix this file with rc-, in order to
help to identify to what subsystem it belongs.

This is in preparaton for a latter patch that will transform the
raw handling into a separate module.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-25 20:01:25 -03:00
Mauro Carvalho Chehab 9c46c7facd [media] radio-miropcm20: fix a compilation warning
drivers/media/radio/radio-miropcm20.c: In function 'sanitize':
drivers/media/radio/radio-miropcm20.c:216:3: warning: comparison is always false due to limited range of data type [-Wtype-limits]
   if (p[i] < 32 || p[i] >= 128) {
   ^

As p is declared as a char array, it is signed. So, it can never
be bigger than 127.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-25 19:35:16 -03:00
Antti Palosaari 69cc4bfab9 [media] Kconfig: rtl2832_sdr must depend on USB
Fixes error:
[next:master 7435/8702] ERROR: "usb_alloc_urb
[drivers/media/dvb-frontends/rtl2832_sdr.ko] undefined!

rtl2832_sdr driver implements own USB streaming for SDR data.
Logically that functionality belongs to USB interface driver, but
currently it is implemented here.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-25 19:32:04 -03:00
Antti Palosaari f5b44da1ac [media] Kconfig: fix tuners build warnings
[next:master 7472/8702] warning: (USB_MSI2500) selects
MEDIA_TUNER_MSI001 which has unmet direct dependencies
((MEDIA_ANALOG_TV_SUPPORT || ..) && ..)

[next:master 7698/8702] warning: (MEDIA_TUNER && ..) selects
MEDIA_TUNER_XC5000 which has unmet direct dependencies
((MEDIA_ANALOG_TV_SUPPORT || ..) && ..)

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-25 19:30:41 -03:00
Hans Verkuil fdcfd4e704 [media] radio-miropcm20: add RDS support
Once upon a time the radio-miropcm20 driver had RDS support. However, after
some internal kernel changes that support was removed. Now that we have a
nice RDS API I have been working on adding back this support. It has been
tested with the si4713 RDS transmitter and it is working quite nicely.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-25 19:29:47 -03:00
Hans Verkuil 9570a14847 [media] v4l2-ctrls: add RX RDS controls
The radio-miropcm20 driver has firmware that decodes the RDS signals. So in that
case the RDS data becomes available in the form of controls.

Add support for these controls to the control framework, allowing the miro driver
to use them.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-25 19:27:51 -03:00
Hans Verkuil 1abba28cf1 [media] si4713: add the missing RDS functionality
Not all the RDS features of the si4713 were supported. Add
the missing bits to fully support the hardware capabilities.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Eduardo Valentin <edubezval@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-25 19:27:29 -03:00
Hans Verkuil 811c508104 [media] v4l2-ctrls: add new RDS TX controls
The si4713 supports several RDS features not yet implemented in the driver.

This patch adds the missing RDS functionality to the list of RDS controls.

The ALT_FREQS control is a compound control containing an array of up
to 25 (the maximum according to the RDS standard) frequencies. To support
that the V4L2_CTRL_TYPE_U32 was added.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Eduardo Valentin <edubezval@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-25 19:26:14 -03:00
Hans Verkuil 1612f20ea0 [media] vb2: fix vb2_poll for output streams
vb2_poll should always return POLLOUT | POLLWRNORM as long as there
are fewer buffers queued than there are buffers available. Poll for
an output stream should only wait if all buffers are queued and nobody
is dequeuing them.

Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-25 19:20:04 -03:00
Hans Verkuil 5d0360a4f0 [media] v4l2-ctrls: add support for setting string controls
Rather than always having to use a v4l2_ext_control struct to set
a control value from within a driver, switch to just setting the
new value. This is faster and it makes it possible to set more
complex types such as a string control as is added by this
patch.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-25 19:18:51 -03:00
David Härdeman e87b540be2 [media] rc-core: merge rc5 and streamzap decoders
Now that the protocol is part of the scancode, it is pretty easy to merge
the rc5 and streamzap decoders. An additional advantage is that the decoder
is now stricter as it waits for the trailing silence before determining that
a command is a valid rc5/streamzap command (which avoids collisions that I've
seen with e.g. Sony protocols).

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-25 19:10:44 -03:00
David Härdeman 9d2f1d3cde [media] rc-core: rename dev->scanmask to dev->scancode_mask
We already have dev->scancode_filter and dev->scancode_wakeup_filter
so rename dev->scanmask to dev->scancode_mask for consistency.

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

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

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

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

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

[m.chehab@samsung.com: added missing changes at some files]
Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-25 19:10:43 -03:00
David Härdeman da6e162d6a [media] rc-core: simplify sysfs code
Simplify and cleanup the sysfs code a bit.

[m.chehab@samsung.com: rebased and fixed a CodingStyle issue]
Signed-off-by: David Härdeman <david@hardeman.nu>

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-23 22:01:35 -03:00
David Härdeman 0bc56cbef9 [media] saa7134: NEC scancode fix
This driver codes the two address bytes in reverse order when compared to the
other drivers, so make it consistent (and update the keymap, note that the
result is a prefix change from 0x6b86 -> 0x866b, and the latter is pretty
common among the NECX keymaps. While not conclusive, it's still a strong hint
that the change is correct).

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

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

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

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

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

Note that the code defines the NEC extended scancode as:

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

i.e.

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

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

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

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

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

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

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

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-23 20:05:56 -03:00
David Härdeman 2886f013c3 [media] bt8xx: fixup RC5 decoding
The bt8xx driver does RC5 decoding for Nebula digi hardware, but includes
some pointless limitations (both start bits must be one, the
device/address/system must be 0x00). Remove those limitations and update
the keymap to use the full RC5 scancode (fortunately the 0x00 address
means that this is perfectly backwards compatible).

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

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

Reported-by: Vincent McIntyre <vincent.mcintyre@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 21:58:23 -03:00
Mauro Carvalho Chehab 4c07e32884 [media] xc4000: Fix get_frequency()
The programmed frequency on xc4000 is not the middle
frequency, but the initial frequency on the bandwidth range.
However, the DVB API works with the middle frequency.

This works fine on set_frontend, as the device calculates
the needed offset. However, at get_frequency(), the returned
value is the initial frequency. That's generally not a big
problem on most drivers, however, starting with changeset
6fe1099c7a, the frequency drift is taken into account at
dib7000p driver.

This broke support for PCTV 340e, with uses dib7000p demod and
xc4000 tuner.

Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 21:44:42 -03:00
Mauro Carvalho Chehab a3eec916cb [media] xc5000: Fix get_frequency()
The programmed frequency on xc5000 is not the middle
frequency, but the initial frequency on the bandwidth range.
However, the DVB API works with the middle frequency.

Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 21:43:39 -03:00
Mauro Carvalho Chehab 612ae142ac [media] xc4000: add module meta-tag with the firmware names
This meta-tag is used by some distros to help them package
the firmware and generate proper initrd images.

So, add the firmware names there.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 21:43:00 -03:00
Mauro Carvalho Chehab da7bfa2c5d [media] xc4000: Update firmware name
The firmware name at:
   http://www.kernellabs.com/firmware/xc4000/

Is different from the one at the Kernel. Update it
try first the new name, falling back to the previous one
if the new name can't be found.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 21:42:48 -03:00
Himangi Saraogi 157a5fe90a [media] dib7000m: Remove unnecessary null test
This patch removes the null test on ch. ch is initialized at the
beginning of the function to &demod->dtv_property_cache. Since demod
is dereferenced prior to the null test, demod must be a valid pointer,
and &demod->dtv_property_cache cannot be null.

The following Coccinelle script is used for detecting the change:

@r@
expression e,f;
identifier g,y;
statement S1,S2;
@@

*e = &f->g
<+...
 f->y
 ...+>
*if (e != NULL || ...)
 S1 else S2

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 21:42:23 -03:00
Mauro Carvalho Chehab 277bfd2f4d [media] mb86a20s: Fix the code that estimates the measurement interval
Instead of looking at the guard interval field, it was using
the interval length, with is wrong. Fix it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 21:34:03 -03:00
Mauro Carvalho Chehab 4247368bf7 [media] mb86a20s: Fix Interleaving
Interleaving code was wrong at mb86a20s: instead, it was looking
at the Guard Interval. Fix it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 21:33:41 -03:00
Mauro Carvalho Chehab 276dfc4b99 [media] mb86a20s: fix ISDB-T mode handling
The driver was reporting an incorrect mode, when mode 2
is selected.

While testing it, noticed that neither mode 1 or guard
interval 1/32 is supported by this device. Document it,
and ensure that it will report _AUTO when it doesn't lock,
in order to not report a wrong detection to userspace.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 21:33:25 -03:00
Antti Palosaari 4423a2ba80 [media] m88ds3103: implement BER
Implement read_ber for BER estimate.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 21:30:58 -03:00
Antti Palosaari 3ae266f80c [media] m88ds3103: fix SNR reporting on 32-bit arch
There was 32-bit calculation overflow. Use div_u64.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 21:28:26 -03:00
Fabian Frederick 5cb4e2276c [media] xc4000: remove unnecessary break after goto
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 21:27:27 -03:00
Fabian Frederick 2442b6afd0 [media] xc5000: remove unnecessary break after goto
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 21:27:13 -03:00
Fabian Frederick 045655a94d [media] dvb-frontends: remove unnecessary break after goto
Cc: Antti Palosaari <crope@iki.fi>
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 21:26:57 -03:00
Fabian Frederick 435fce1b6c [media] xc2028: remove unnecessary break after goto
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 21:26:39 -03:00
Fabian Frederick d616bec6b9 [media] r820t: remove unnecessary break after goto
Cc: Antti Palosaari <crope@iki.fi>
Cc: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 21:26:23 -03:00
Emil Goode 8f73b481b9 [media] Cleanup line > 80 character violations
This cleans up some line over 80 character violations.

Signed-off-by: Emil Goode <emilgoode@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 21:24:24 -03:00
Emil Goode 20721185c9 [media] Remove checks of struct member addresses
This removes checks of struct member addresses since they likely result
in the condition always being true. Also in the stb6100_get_bandwidth
and tda8261_get_bandwidth functions the pointers frontend_ops and
tuner_ops are assigned the same addresses twice.

Signed-off-by: Emil Goode <emilgoode@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 21:23:53 -03:00
Heinrich Schuchardt 18d75a09e9 [media] media: dib9000: avoid out of bound access
This updated patch also fixes out of bound access to b[].

In dib9000_risc_apb_access_write() an out of bound access to mb[].

The current test to avoid out of bound access to mb[] is insufficient.
For len = 19 non-existent mb[10] will be accessed.

For odd values of len b[] is accessed out of bounds.

For large values of len an of bound access to mb[] may occur in
dib9000_mbx_send_attr.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 21:15:41 -03:00
Dan Carpenter 58632818ab [media] dvb-frontends: decimal vs hex typo in ChannelConfiguration()
>From the context this should be hex 0x80 instead of decimal 80.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 21:00:54 -03:00
Mauro Carvalho Chehab fcb388ce6c [media] si2168: Fix a badly solved merge conflict
changeset a733291d69 didn't merge the fixes well. It ended by
restoring some bad logic removed there.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Acked-by: Antti Palosaari <crope@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 20:38:13 -03:00
Mauro Carvalho Chehab e23cf7f358 [media] tuners/Kconfig: fix build when just DTV or SDR is enabled
As reported by Kbuildtest:
	warning: (VIDEO_PVRUSB2 && VIDEO_TLG2300 && VIDEO_USBVISION && VIDEO_GO7007 && VIDEO_AU0828_V4L2 && VIDEO_CX231XX && VIDEO_TM6000 && VIDEO_EM28XX && VIDEO_IVTV && VIDEO_MXB && VIDEO_CX18 && VIDEO_CX23885 && VIDEO_CX88 && VIDEO_BT848 && VIDEO_SAA7134 && VIDEO_SAA7164) selects VIDEO_TUNER which has unmet direct dependencies (MEDIA_SUPPORT && MEDIA_TUNER)

That happens when:

	# CONFIG_MEDIA_ANALOG_TV_SUPPORT is not set
	CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y
	# CONFIG_MEDIA_RADIO_SUPPORT is not set
	# CONFIG_MEDIA_SDR_SUPPORT is not set
	CONFIG_VIDEO_AU0828_V4L2=y
	CONFIG_VIDEO_CX231XX=y
	CONFIG_VIDEO_TM6000=y
	CONFIG_VIDEO_EM28XX=y
	CONFIG_VIDEO_TUNER=y
	CONFIG_MEDIA_SUPPORT=y

With means that we need to enable MEDIA_TUNER also when DTV
is enabled. While the above config doesn't cover, if we enable
SDR, the same error can also happen.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 14:24:46 -03:00
Hans Verkuil 7955f03d18 [media] go7007: move out of staging into drivers/media/usb.
Now that the custom motion detection API in this driver has been
replaced with a standard API there is no reason anymore to keep it
in staging. So (finally!) move it to drivers/media/usb.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 12:53:33 -03:00
Hans Verkuil 28cae868cd [media] solo6x10: move out of staging into drivers/media/pci.
Now that the custom motion detection API has been replaced with a
standard API there is no reason anymore to keep it in staging.

So (finally!) move it to drivers/media/pci.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 12:53:00 -03:00
Philipp Zabel 401e972fae [media] coda: store IRAM size in struct coda_devtype
Similarly to workbuf_size and tempbuf_size, store iram_size in the
coda_devtype structure. This also decreases the IRAM used on i.MX6DL
to 128 KiB.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 12:16:58 -03:00
Philipp Zabel 5d73fad1eb [media] coda: store global temporary buffer size in struct coda_devtype
Similarly to the work buffer size, store the temporary buffer size in the
coda_devtype structure.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 12:16:31 -03:00
Philipp Zabel e5b0d1c60f [media] coda: store per-context work buffer size in struct coda_devtype
We had the workbuf_size field since the beginning.
Use it to tighten the code a little bit.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 12:15:59 -03:00
Philipp Zabel f61c0b148c [media] coda: export auxiliary buffers via debugfs
This patch exports all auxiliary buffers, including SRAM, as debugfs binary
blobs for debugging purposes. It shows, for example, that psbuf currently
doesn't seem to be used at all on CODA7541, and that slicebuf and workbuf
usage is far from the maximum. It can also be used to validate SRAM size
allocation.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 12:14:52 -03:00
Philipp Zabel 451dfe5d85 [media] coda: increase frame stride to 16 for h.264
When encoding into h.264, the input frame stride needs to be a multiple of 16.
During allocation of the input buffers, it may not be known yet whether the
encoder should create h.264 or not. Assume the worst and always use a frame
stride that is a multiple of 16.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 12:13:08 -03:00
Philipp Zabel 7c3df78953 [media] coda: round up internal frames to multiples of macroblock size for h.264
CODA7541 only supports encoding h.264 frames with width and height that are
multiples of the macroblock size.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 12:12:47 -03:00
Philipp Zabel 1b0ed7be67 [media] coda: allow odd width, but still round up bytesperline
Even though the CODA h.264 decoder always decodes complete macroblocks, we can
set the stride to the corresponding multiple of 16 and use a value smaller than
that as real width. Unfortunately the same doesn't work for height, as there
is no vertical linesperframe stride for discontiguous planar YUV frames.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 12:11:48 -03:00
Philipp Zabel 2fd6a3709e [media] coda: add bytesperline to queue data
bytesperline is calculated in multiple places, store it in the coda_q_data
structure. This will be more useful later when adding JPEG support.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 12:11:15 -03:00
Philipp Zabel 8f45284c4e [media] coda: add reset control support
On i.MX53 and i.MX6, the CODA VPU can be reset by the System Reset Controller.
We can use this to get out of dire situations, for example after a picture
run timeout.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 12:10:33 -03:00
Philipp Zabel 84e2365d7d [media] coda: rename prescan_failed to hold and stop stream after timeout
Rename the per-context prescan_failed variable to hold, as this is what the
flag  does: it temporarily keeps the coda from running until new data is fed
into the bitstream buffer or stop_streaming is called on the input side.
A prescan failure on i.MX5 is one possible reason to enter this state, another
one is a picture run timeout on i.MX6.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 12:09:37 -03:00
Philipp Zabel cb2c02821c [media] coda: add sequence counter offset
The coda h.264 decoder also counts PIC_RUNs where no frame was decoded but
a frame was rotated out / marked as ready to be displayed. This causes an
offset between the incoming encoded frame's sequence number and the decode
sequence number returned by the coda. This patch introduces a sequence
counter offset variable to keep track of the difference.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 12:09:01 -03:00
Philipp Zabel 410e5e4938 [media] coda: alert userspace about macroblock errors
If the CODA reports macroblock errors, also set the VB2_BUF_STATE_ERROR flag
to alert userspace.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 12:08:43 -03:00
Philipp Zabel 846ced9c0e [media] coda: add decoder timestamp queue
The coda driver advertises timestamp_type V4L2_BUF_FLAG_TIMESTAMP_COPY on
both queues, so we have to copy timestamps from input v4l2 buffers to the
corresponding destination v4l2 buffers. Since the h.264 decoder can reorder
frames, a timestamp queue is needed to keep track of and assign the correct
timestamp to destination buffers.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 12:08:15 -03:00
Michael Olbrich f3497dad92 [media] coda: try to schedule a decode run after a stop command
In case no further buffers are queued after the stop command, restart
job scheduling explicitly.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22 12:07:27 -03:00