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.
[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.
James Harper [Mon, 9 Jun 2014 00:24:20 +0000 (21:24 -0300)]
[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>
Arnd Bergmann [Thu, 5 Jun 2014 20:48:11 +0000 (17:48 -0300)]
[media] staging: lirc: remove sa1100 support
The LIRC support for sa1100 appears to have never worked
because it relies on header files that have never been
present in git history. Actually trying to build the
driver on an ARM sa1100 kernel fails, so let's just remove
the broken support.
Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Jarod Wilson <jarod@wilsonet.com> Cc: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
George Spelvin [Sun, 11 May 2014 11:19:01 +0000 (08:19 -0300)]
[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>
George Spelvin [Sun, 11 May 2014 11:17:37 +0000 (08:17 -0300)]
[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>
George Spelvin [Sun, 11 May 2014 11:14:18 +0000 (08:14 -0300)]
[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>
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>
George Spelvin [Sun, 11 May 2014 11:12:09 +0000 (08:12 -0300)]
[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>
[media] rc-core: don't use dynamic_pr_debug for IR_dprintk()
The hole point of IR_dprintk() is that, once a level is
given at debug parameter, all enabled IR parsers will show their
debug messages.
While converting it to dynamic_printk might be a good idea,
right now it just makes very hard to debug the drivers, as
one needs to both pass debug=1 or debug=2 to rc-core and
to use the dynamic printk to enable all the desired lines.
That doesn't make sense!
So, revert to the old way, as a single line is changed,
and the debug parameter will now work as expected.
[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.
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>
Hans Verkuil [Mon, 21 Jul 2014 13:45:43 +0000 (10:45 -0300)]
[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>
Hans Verkuil [Mon, 21 Jul 2014 13:45:37 +0000 (10:45 -0300)]
[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.
Hans Verkuil [Thu, 24 Jul 2014 12:19:37 +0000 (09:19 -0300)]
[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>
Hans Verkuil [Wed, 23 Jul 2014 06:17:06 +0000 (03:17 -0300)]
[media] vb2: fix videobuf2-core.h comments
A lot of work was done in vb2 to regulate how drivers and the vb2 core handle
buffer ownership, but inexplicably the videobuf2-core.h comments were never
updated. Do so now. The same was true for the replacement of the -ENOBUFS
mechanism by the min_buffers_needed field.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Hans Verkuil [Mon, 21 Jul 2014 13:45:42 +0000 (10:45 -0300)]
[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>
David Härdeman [Thu, 3 Apr 2014 23:32:31 +0000 (20:32 -0300)]
[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>
David Härdeman [Thu, 3 Apr 2014 23:32:01 +0000 (20:32 -0300)]
[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>
David Härdeman [Thu, 3 Apr 2014 23:31:30 +0000 (20:31 -0300)]
[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>
David Härdeman [Thu, 3 Apr 2014 23:31:20 +0000 (20:31 -0300)]
[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>
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>
The DocBook documentation is incorrect: on ISDB-T, interleaving
time is always a power of 2. Fix it and provides a table showing
the actual interleaving length for each mode.
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 6fe1099c7aec, the frequency drift is taken into account at
dib7000p driver.
This broke support for PCTV 340e, with uses dib7000p demod and
xc4000 tuner.
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.
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:
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.
Emil Goode [Tue, 24 Jun 2014 21:42:27 +0000 (18:42 -0300)]
[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>
[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>
Hans Verkuil [Tue, 22 Jul 2014 04:21:37 +0000 (06:21 +0200)]
[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>
Philipp Zabel [Fri, 11 Jul 2014 09:36:40 +0000 (06:36 -0300)]
[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.
Philipp Zabel [Fri, 11 Jul 2014 09:36:39 +0000 (06:36 -0300)]
[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.
Philipp Zabel [Fri, 11 Jul 2014 09:36:37 +0000 (06:36 -0300)]
[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.
Philipp Zabel [Fri, 11 Jul 2014 09:36:35 +0000 (06:36 -0300)]
[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.
Philipp Zabel [Fri, 11 Jul 2014 09:36:34 +0000 (06:36 -0300)]
[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.
Philipp Zabel [Fri, 11 Jul 2014 09:36:33 +0000 (06:36 -0300)]
[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.
Philipp Zabel [Fri, 11 Jul 2014 09:36:31 +0000 (06:36 -0300)]
[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.
Some drivers might allow to decode remaining frames from an internal ringbuffer
after a decoder stop command. Allow those to call v4l2_m2m_try_schedule
directly.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Philipp Zabel [Fri, 11 Jul 2014 09:36:26 +0000 (06:36 -0300)]
[media] coda: add h.264 min/max qp controls
If the bitrate control is set, the encoder works in CBR mode, dynamically
changing the quantization parameters to achieve a constant bitrate.
With the min/max QP controls the quantization parameters can be limited
to a given range.
Philipp Zabel [Fri, 11 Jul 2014 09:36:24 +0000 (06:36 -0300)]
[media] coda: split firmware version check out of coda_hw_init
This adds a new function coda_check_firmware that does the firmware
version checks so that this can be done only once from coda_probe
instead of every time the runtime pm framework resumes the coda.
Philipp Zabel [Fri, 11 Jul 2014 09:36:23 +0000 (06:36 -0300)]
[media] coda: Add runtime pm support
This patch allows to use the runtime pm and generic pm domain frameworks
to completely gate power to the VPU if it is unused. This functionality
is available on i.MX6.
Philipp Zabel [Fri, 11 Jul 2014 09:36:20 +0000 (06:36 -0300)]
[media] coda: add workqueue to serialize hardware commands
Using the coda_mutex lock to serialize hardware access would cause
"INFO: possible circular locking dependency detected" lockdep warnings.
Since the possible locking paths are hard to follow, serialize hardware
access with a single workqueue thread. Ultimately the workqueue could
be converted to only do register setup and readout for per-command work
items.
Using the initialized context property, SEQ_END is only queued in
coda_release when needed.
Philipp Zabel [Fri, 11 Jul 2014 09:36:19 +0000 (06:36 -0300)]
[media] coda: add selection API support for h.264 decoder
The h.264 decoder produces capture frames that are a multiple of the macroblock
size (16 pixels). To inform userspace about invalid pixel data at the edges,
use the active and padded composing rectangles on the capture queue.
The cropping information is obtained from the h.264 sequence parameter set.
Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com> 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>
Philipp Zabel [Fri, 11 Jul 2014 09:36:17 +0000 (06:36 -0300)]
[media] coda: Add encoder/decoder support for CODA960
This patch adds support for the CODA960 VPU in Freescale i.MX6 SoCs.
It enables h.264 and MPEG4 encoding and decoding support. Besides the usual
register shifting, the CODA960 gains frame memory control and GDI registers
that are set up for linear mapping right now, needs ENC_PIC_SRC_INDEX to be
set beyond the number of internal buffers for some reason, and has subsampling
buffers that need to be set up. Also, the work buffer size is increased to
80 KiB.
The CODA960 firmware spins if there is not enough input data in the bitstream
buffer. To make it continue, buffers need to be copied into the bitstream as
soon as they are queued. As the bitstream fifo is written into from two places,
it must be protected with a mutex. For that, using a threaded interrupt handler
is necessary.
Arun Kumar K [Wed, 21 May 2014 09:29:31 +0000 (06:29 -0300)]
[media] s5p-mfc: Add init buffer cmd to MFCV6
Latest MFC v6 firmware requires tile mode and loop filter
setting to be done as part of Init buffer command, in sync
with v7. This patch adds this support for new v6 firmware.