[media] au0828: make sure video standard is setup in tuner-core
If the user performs a tuning attempt without explicitly calling the
s_std ioctl(), a value of zero is sent from tuner-core to xc5000. This
causes the xc5000 driver to leave the standard unchanged. The problem
was masked by the fact that the xc5000 driver defaulted to NTSC, but if
you happened to perform an ATSC/ClearQAM tuning attempt and then do an
analog tune, the net effect is an analog tune with the standard still
set to DTV6.
Keep track of whether the standard has ever been sent to tuner-core. We
don't make an s_std subdev call explicitly during probe because that
will cause a firmware load (which is very time consuming on the 950q).
With the logic in this patch, the s_std call will occur automatically on
the s_freq call if it hasn't already been set.
[media] au0828: fix race condition that causes xc5000 to not bind for digital
In some cases users would see the xc5000_attach() call failing for the
digital side of the tuner on initialization. This is because of udev
running v4l-id while the digital side of the board is still coming up.
This is the exact same race condition which was present in em28xx (not
surprising since I copied all the locking logic from that driver when I
added analog support). Reproduce Mauro's fix from the em28xx driver in
au0828.
The logic as written would *never* actually return an error condition,
since the loop would run until the counter hit zero but the check was
for a value less than zero.
[media] xc5000: properly show quality register values
The quality register only has relevant data in bits 2-0, so discard the
other bits (which results in a value being printed that is consistent
with the expected 0-7 range).
[media] au0828: Make the s_reg and g_reg advanced debug calls work against the bridge
The g_reg and s_reg calls worked properly if acting on subdev registers
(such as the au8522), but didn't work against the au0828 itself. Copy
the logic over from em28xx.
[media] au8522: properly recover from the au8522 delivering misaligned TS streams
There is an apparent bug in the au8522 TS clocking which can result in
it delivering a TS payload to the au0828 that is shifted by some number
of bits. For example, the device will announce a packet containing "FA
38 FF F8" which if you shift left one bit is "1F 47 1F FF F0..."
This presents itself as no TS stream being delivered from the kernel to
userland, since the kernel demux will drop every packet.
In the event that this condition occurs, restart the DVB stream.
Also, this patch includes a couple of lines of cleanup to not change the
FIFO configuration while the FIFO is running (which can screw up the
state machine), and dequeue the buffers before turning off the FIFO.
This puts the logic in sync with the Windows driver.
[media] au8522: Fix off-by-one in SNR table for QAM256
The table of valid SNR values for QAM 256 is off by one, and as a result
if the SNR is oscillating between 40.0 and 39.9 dB, tools like azap show
it going back and forth between 40.0 and 0 (misleading some people,
including myself, to think signal lock is being lost or there is a
problem with register reads).
Fix the table so that 40.0 dB is properly represented.
[media] au8522: fix intermittent lockup of analog video decoder
It turns up the autodetection for the video standard in the au8522 is
prone to hanging the chip until a reset is performed. This condition is
trivial to reproduce simply by tuning to a station and then rapidly
unplugging/ replugging the coax feed.
Because we've never claimed to support anything other than NTSC-M, just
disable the video-standard autodetection logic and force it to always be
NTSC-M.
Hans Verkuil [Sat, 23 Jun 2012 10:47:14 +0000 (07:47 -0300)]
[media] saa7146: remove V4L2_FL_LOCK_ALL_FOPS
Add proper locking to the file operations, allowing for the removal
of the V4L2_FL_LOCK_ALL_FOPS flag.
I also removed some dead code in the form of the saa7146_devices list and
saa7146_devices_lock mutex: these were used once but that was a long time
ago.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
The dvb-usb-v2 core doesn't know anything about CI. So, the
driver needs to handle it by hand. This patch stops CI just
before stopping URB's/RC, and restarts it before URB/RC start.
It should be noticed that suspend/resume is not yet working properly,
as the PM model requires the implementation of reset_resume:
dvb_usb_az6007 1-6:1.0: no reset_resume for driver dvb_usb_az6007?
But this is not implemented there at dvb-usb-v2 yet.
Cc: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] dvb-usb-v2: Don't ask user to select Cypress firmware module
The dvb-usb-v2 cypress firmware module is not optional, as drivers
won't work without it. So, instead of opening a menu for the user to
manually select, let the drivers that need it to select, hiding this
option from the Kconfig menu.
Acked-by: Antti Palosaari <crope@iki.fi> Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/m2m-deinterlace.c: In function ‘deinterlace_issue_dma’:
drivers/media/video/m2m-deinterlace.c:363:3: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘dma_addr_t’ [-Wformat]
drivers/media/video/m2m-deinterlace.c:363:3: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 5 has type ‘dma_addr_t’ [-Wformat]
Cc: Javier Martin <javier.martin@vista-silicon.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Javier Martin [Thu, 26 Jul 2012 08:55:18 +0000 (05:55 -0300)]
[media] media: Add mem2mem deinterlacing driver
Some video decoders such as tvp5150 provide separate
video fields (V4L2_FIELD_SEQ_TB/BT). This driver uses
dmaengine to convert this format to V4L2_FIELD_INTERLACED_TB/BT
(weaving) or V4L2_FIELD_NONE (line doubling) so that the
image can be displayed or processed.
Of course there will be combing effect in the image but this
can be accepted for some low quality applications.
Currently only YUV420 and YUYV formats are supported but
it can be extended later.
Signed-off-by: Javier Martin <javier.martin@vista-silicon.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Javier Martin [Thu, 26 Jul 2012 08:53:35 +0000 (05:53 -0300)]
[media] media: coda: Add driver for Coda video codec
Coda is a range of video codecs from Chips&Media that
support H.264, H.263, MPEG4 and other video standards.
Currently only support for the codadx6 included in the
i.MX27 SoC is added. H.264 and MPEG4 video encoding
are the only supported capabilities by now.
[mchehab@redhat.com: Add missing include linux/of.h] Signed-off-by: Javier Martin <javier.martin@vista-silicon.com> Reviewed-by: Philipp Zabel<p.zabel@pengutronix.de> Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Antti Palosaari [Wed, 25 Jul 2012 00:21:04 +0000 (21:21 -0300)]
[media] af9015: remote controller fixes
1)
AF9015 remote controller query will fail rarely due to register
access failures and dvb_usb_v2 will stop rc polling when error
returned. Add logic to allow errors until two consecutive errors
occurs.
2)
Remote controller key map was not loaded in case of key map was set as
a device property. Fix it.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Antti Palosaari [Thu, 5 Jul 2012 22:57:07 +0000 (19:57 -0300)]
[media] dvb_usb_v2: register device even no remote keymap defined
It failed to register device when remote keymap was not set.
Fix it to register device even keymap is NULL. In that case
just skip remote registration.
Driver should set RC_MAP_EMPTY to enable remote in case of
there is remote receiver but default keymap is unknown.
It is nice to have this debug, but as it generates very huge amount
of traffic, better to make it conditional. Use define macro to disable
it as I did not find out how to use dynamic debugs to dump variable
length buffers like that.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Antti Palosaari [Tue, 19 Jun 2012 02:42:53 +0000 (23:42 -0300)]
[media] dvb_usb_v2: use identify_state() to resolve firmware name
Merge get_firmware_name() to identify_state().
It is wise to resolve firmware name in that routine as it does
decision wether or not to load firmware at all. It is one very
rarely needed callback less.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Antti Palosaari [Tue, 19 Jun 2012 01:54:16 +0000 (22:54 -0300)]
[media] dvb_usb_v2: merge get_ts_config() to get_usb_stream_config()
Piggypag TS type callback to USB stream callback and change
callback name slightly to fit better.
Both of those are rather rare callback and has a relation. Transport
Stream, TS, is input stream and USB stream is output stream of
DVB USB bridge.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Antti Palosaari [Sun, 17 Jun 2012 03:27:00 +0000 (00:27 -0300)]
[media] dvb_usb_v2: use lock to sync feed and frontend control
There was synchronization problem when streaming was stopped.
Frontend was ran down before stream which causes problems.
Use mutex to synchronization. Now it looks like that:
LOCK
start frontend
UNLOCK
LOCK
start streaming
[...]
stop streaming
UNLOCK
LOCK
stop frontend
UNLOCK
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Antti Palosaari [Sat, 16 Jun 2012 19:02:57 +0000 (16:02 -0300)]
[media] dvb_usb_v2: change USB stream config logic
Initial / default USB stream configuration is now set always as a
dvb_usb_device_properties. Dynamic configuration is done top of
that if callback .get_usb_stream_config() exists. Default values
are set when callback is called so callback needs only change
values that are different than default.
In addition of that define two macros DVB_USB_STREAM_BULK() and
DVB_USB_STREAM_ISOC() for filling struct usb_data_stream_properties
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Give DVB adapter as a parameter for callback. MAC address is
adapter property and it could be (at least in theory) there
is devices having multiple adapters and all has own MAC.
Also add error handling. If callback fails error is returned
which leads device unregister.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Antti Palosaari [Fri, 15 Jun 2012 03:29:36 +0000 (00:29 -0300)]
[media] dvb_usb_v2: try to remove all adapters on exit
It did not removed adapter on error case as .num_adapters_initialized
was set after success adapter initialization. It should be safe to
try remove all possible adapters in any-case.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Antti Palosaari [Thu, 14 Jun 2012 23:07:02 +0000 (20:07 -0300)]
[media] dvb_usb_v2: do not release USB interface when device reconnects
USB core will call disconnect and remove driver for us as device
will disconnect itself. After that it is loaded again as a new
device but it is warm and no firmware loading needed.
[media] dvb_usb_v2: return the download ret in dvb_usb_download_firmware
The first being this patch, no return value from dvb_usb_download_firmware
causes system wide dead lock with COLD disconnect as system attempts to continue
to warm state.
Antti Palosaari [Thu, 14 Jun 2012 05:44:47 +0000 (02:44 -0300)]
[media] dvb_usb_v2: attach tuners later
It is more than nice to have all those frontend pointers when
attaching tuner to the frontend in question. Make that possible
attaching tuners after dvb_register_frontend()
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>