Andrew Morton [Tue, 12 Jul 2016 22:30:55 +0000 (15:30 -0700)]
[media] cec-adap.c: work around gcc-4.4.4 anon union initializer bug
drivers/staging/media/cec/cec-adap.c: In function 'cec_queue_msg_fh':
drivers/staging/media/cec/cec-adap.c:141: error: unknown field 'lost_msgs' specified in initializer
Stephen Backway [Sat, 2 Jul 2016 09:46:23 +0000 (06:46 -0300)]
[media] cx23885: Add support for Hauppauge WinTV quadHD DVB version
Add support fo the Hauppauge WinTV quadHD DVB version.
IR support has not been provided, all 4 tuners, demodulators etc are working.
Further documentation can be found on Linux TV wiki.
Signed-off-by: Stephen Backway <stev391@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Hans Verkuil [Sun, 10 Jul 2016 13:11:17 +0000 (10:11 -0300)]
[media] cec: add check if adapter is unregistered
CEC USB dongles can be unplugged at any time, and at that point they will
be unregistered. Make sure that any attempt afterwards to set the physical
or logical addresses will be ignored.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Hans Verkuil [Tue, 28 Jun 2016 14:43:01 +0000 (11:43 -0300)]
[media] adv7604/adv7842: fix quantization range handling
Fix a number of bugs that appeared when support for mediabus formats was
added:
- Support for V4L2_DV_RGB_RANGE_FULL/LIMITED should only be enabled
for HDMI RGB formats, not for YCbCr formats. Since, as the name
says, this setting is for RGB only. So read the InfoFrame to check
the format.
- the quantization range for the pixelport depends on whether the
mediabus code is RGB or not: if it is RGB, then produce full range
RGB values, otherwise produce limited range YCbCr values.
This means that the op_656_range and alt_data_sat fields of the
platform data are no longer used and these will be removed in a
following patch.
- when setting up a new format the RGB quantization range settings
were never updated. Do so, since this depends on the format.
- fix the log_status output which was confusing and incorrect.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Hans Verkuil [Tue, 28 Jun 2016 14:32:36 +0000 (11:32 -0300)]
[media] adv7511: fix quantization range handling
Commit 1fb69bfd29e4b2e5e93922105326dd6cbd5ef6eb (adv7511: improve
colorspace handling) introduced a number of bugs, specifically with
regards to YCbCr output and quantization range handling:
- if the output is not RGB, then disable the full-to-limited range
CSC matrix since that is meant for RGB formats. YCbCr formats are
always limited range, so there is nothing to convert. (OK, full
range YCbCr is possible, but we don't support that right now).
- the mediabus code that was passed to adv7511_set_fmt was always cleared
by the memset in adv7511_fill_format. This made it effectively impossible
to select YCbCr output.
- adv7511_set_fmt never updated the rgb quantization range.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Hans Verkuil [Tue, 28 Jun 2016 14:30:35 +0000 (11:30 -0300)]
[media] adv7511: drop adv7511_set_IT_content_AVI_InfoFrame
The IT Content bit has nothing to do with CE vs IT timings.
Delete this code. This will also fix a bug where this could
override the 'content type' control, which is actually the
correct place to set/clear the ITC bit.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Hans Verkuil [Mon, 11 Jul 2016 03:23:11 +0000 (00:23 -0300)]
[media] af9033: fix compiler warnings
Fix two warnings:
af9033.c: In function 'af9033_read_status':
af9033.c:883:25: warning: 'snr_lut' may be used uninitialized in this function [-Wmaybe-uninitialized]
const struct val_snr *snr_lut;
^
af9033.c:952:25: warning: 'tmp' may be used uninitialized in this function [-Wmaybe-uninitialized]
c->cnr.stat[0].svalue = tmp;
^
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
In practice, devices sometimes return frames larger than current buffer
size, leading to failure in solo_send_desc().
It is not clear which minimal increase in buffer size would be enough,
so this patch doubles it, this should be safely assumed as sufficient.
Matthew Leach [Fri, 8 Jul 2016 12:04:27 +0000 (09:04 -0300)]
[media] media: usbtv: prevent access to free'd resources
When disconnecting the usbtv device, the sound card is unregistered
from ALSA and the snd member of the usbtv struct is set to NULL. If
the usbtv snd_trigger work is running, this can cause a race condition
where the kernel will attempt to access free'd resources, shown in
[1].
This patch fixes the disconnection code by cancelling any snd_trigger
work before unregistering the sound card from ALSA and checking that
the snd member still exists in the work function.
[media] Convert Wideview WT220 DVB USB driver to rc-core
Converts the dtt200u DVB USB driver over to the rc-core
infrastructure for its handling of IR remotes. This device can receive
generic NEC / NEC Extended signals and the switch to the newer core
enables the easy use of tools such as ir-keytable to modify the active
key map.
Signed-off-by: Jonathan McDowell <noodles@earth.li> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Commit e87b540be2dd02552fb9244d50ae8b4e4619a34b tightened up the RC5
decoding by adding a check for trailing silence to ensure a valid RC5
command had been received. Unfortunately the trailer length checked was
10 units and the Fintek CIR device does not want to provide details of a
space longer than 6350us. This meant that RC5 remotes working on a
Fintek setup on 3.16 failed on 3.17 and later. Fix this by shortening
the trailer check to 6 units (allowing for a previous space in the
received remote command).
Implement memory barriers according to Documentation/circular-buffers.txt:
- use smp_store_release() to update ringbuffer read/write pointers
- use smp_load_acquire() to load write pointer on reader side
- use ACCESS_ONCE() to load read pointer on writer side
This fixes data stream corruptions observed e.g. on an ARM Cortex-A9
quad core system with different types (PCI, USB) of DVB tuners.
Hans Verkuil [Sat, 9 Jul 2016 07:32:58 +0000 (04:32 -0300)]
[media] mtk-vcodec: fix compiler warning
mtk-vcodec/venc_vpu_if.c:40:30: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
struct venc_vpu_inst *vpu = (struct venc_vpu_inst *)msg->venc_inst;
^
Note: venc_inst is u64.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
The workqueue "work_thread" is involved in updating parameters for
transfers. It has a single work item(&sd->work) and hence
doesn't require ordering. Also, it is not being used on a memory
reclaim path. Hence, the singlethreaded workqueue has been replaced with
the use of system_wq.
System workqueues have been able to handle high level of concurrency
for a long time now and hence it's not required to have a singlethreaded
workqueue just to gain concurrency. Unlike a dedicated per-cpu workqueue
created with create_singlethread_workqueue(), system_wq allows multiple
work items to overlap executions even on the same CPU; however, a
per-cpu workqueue doesn't have any CPU locality or global ordering
guarantee unless the target CPU is explicitly specified and thus the
increase of local concurrency shouldn't make any difference.
Work item has been flushed in sd_stop0() to ensure that there are no
pending tasks while disconnecting the driver.
Hans Verkuil [Sat, 9 Jul 2016 07:32:57 +0000 (04:32 -0300)]
[media] mtk-vcodec: fix two compiler warnings
mtk-vcodec/mtk_vcodec_enc.c: In function 'mtk_venc_worker':
mtk-vcodec/mtk_vcodec_enc.c:1030:43: warning: format '%lx' expects argument of type 'long unsigned int', but argument 7 has type 'size_t {aka unsigned int}' [-Wformat=]
mtk-vcodec/mtk_vcodec_enc.c:1030:43: warning: format '%lx' expects argument of type 'long unsigned int', but argument 10 has type 'size_t {aka unsigned int}' [-Wformat=]
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
[media] cxd2841er: don't expose a dvbv5 stats to userspace if not available
The current code will expose a zero value if one of the stats is
not available, but this is not what userspace expects. Instead,
if something goes wrong on providing some stats, it should be
changing the scale to FE_SCALE_NOT_AVAILABLE.
[media] cxd2841er: Fix signal strengh for DVB-T/T2 and show it in dBm
The signal strength value is reversed: the bigger the number,
the weaker is the signal.
Fix the logic and present it in dBm. Please notice that the
dBm measure is actually an estimation, as the ratio is not
fully linear. It also varies with the frequency.
Yet, the estimation should be good enough for programs like
Kaffeine to indicate when the signal is good or bad.
[media] cxd2841er: Do some changes at the dvbv5 stats logic
It is a good idea to measure the signal strength while
tuning, as this helps to identify if the antenna is ok.
Also, such measure helps to identify the quality of the
signal.
Do some changes to enable it before signal lock. While
here, optimize the code to only initialize the stats
length once, and make sure that, just after set_frontend,
any reading for the stats that depends on lock to return
FE_SCALE_NOT_AVAILABLE.
Hans Verkuil [Fri, 8 Jul 2016 08:52:34 +0000 (05:52 -0300)]
[media] cec-funcs.h: add missing 'reply' for short audio descriptor
The cec_msg_request_short_audio_descriptor function was missing the reply
argument. That's needed if you want the framework to wait for the reply
message.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Hans Verkuil [Fri, 1 Jul 2016 10:33:10 +0000 (07:33 -0300)]
[media] cec: fix Kconfig dependency problems
- Use IS_REACHABLE(RC_CORE) instead of IS_ENABLED: if cec is built-in and
RC_CORE is a module, then CEC can't reach the RC symbols.
- Both cec and cec-edid should be bool and use the same build 'mode' as
MEDIA_SUPPORT (just as is done for the media controller code).
- Add a note to staging that this should be changed once the cec framework
is moved out of staging.
Arnd Bergmann [Wed, 29 Jun 2016 14:26:34 +0000 (11:26 -0300)]
[media] s5p_cec: mark suspend/resume as __maybe_unused
The suspend/resume functions in the s5p-cec driver are only
referenced when CONFIG_PM is enabled, so we get a warning
about unused functions otherwise:
drivers/staging/media/s5p-cec/s5p_cec.c:260:12: error: 's5p_cec_resume' defined but not used [-Werror=unused-function]
static int s5p_cec_resume(struct device *dev)
^~~~~~~~~~~~~~
drivers/staging/media/s5p-cec/s5p_cec.c:253:12: error: 's5p_cec_suspend' defined but not used [-Werror=unused-function]
static int s5p_cec_suspend(struct device *dev)
This marks them as __maybe_unused to avoid the warning without
having to introduce an extra #ifdef.
Hans Verkuil [Thu, 30 Jun 2016 10:08:53 +0000 (07:08 -0300)]
[media] cec-adap: prevent write to out-of-bounds array index
CEC_MSG_REPORT_PHYSICAL_ADDR can theoretically be received from
an unregistered device, but in that case the code should not attempt
to write the received physical address to the phys_addrs array.
That would be pointless since there can be multiple unregistered
devices that report a physical address. We just ignore those.
While at it, improve the dprintk since it would attempt to read
from that array as well with the same out-of-bounds problem.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Hans Verkuil [Sun, 26 Jun 2016 09:57:56 +0000 (06:57 -0300)]
[media] cec-adap: on reply, restore the tx_status value from the transmit
When a reply to an earlier transmit is received, the tx_status of that
transmit needs to be restored. Otherwise the status that the transmit
was successful would be lost.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* tag 'v4.7-rc6': (1245 commits)
Linux 4.7-rc6
ovl: warn instead of error if d_type is not supported
MIPS: Fix possible corruption of cache mode by mprotect.
locks: use file_inode()
usb: dwc3: st: Use explicit reset_control_get_exclusive() API
phy: phy-stih407-usb: Use explicit reset_control_get_exclusive() API
phy: miphy28lp: Inform the reset framework that our reset line may be shared
namespace: update event counter when umounting a deleted dentry
9p: use file_dentry()
lockd: unregister notifier blocks if the service fails to come up completely
ACPI,PCI,IRQ: correct operator precedence
fuse: serialize dirops by default
drm/i915: Fix missing unlock on error in i915_ppgtt_info()
powerpc: Initialise pci_io_base as early as possible
mfd: da9053: Fix compiler warning message for uninitialised variable
mfd: max77620: Fix FPS switch statements
phy: phy-stih407-usb: Inform the reset framework that our reset line may be shared
usb: dwc3: st: Inform the reset framework that our reset line may be shared
usb: host: ehci-st: Inform the reset framework that our reset line may be shared
usb: host: ohci-st: Inform the reset framework that our reset line may be shared
...
Heiner Kallweit [Fri, 24 Jun 2016 05:38:54 +0000 (02:38 -0300)]
[media] media: rc: nuvoton: remove interrupt handling for wakeup
There is a rudimentary ISR for handling interrupts generated by the
wakeup part of the chip. Interrupts however have never been enabled
in the wakeup part.
Also, now that we can set the wakeup sequence via sysfs, there's in
general no need to enable interrupts in the wakeup part.
To detect a rx fifo overrun it's checked whether the number of elements
in the chip fifo exceeds the fifo size. This check can never return true
and is wrong.
Instead we should generate an interrupt if the fifo overruns.
Antti Palosaari [Wed, 29 Jun 2016 23:40:56 +0000 (20:40 -0300)]
[media] rtl2830: move statistics to read_status()
Move statistics polling to read_status() in order to avoid use of
kernel work. Also replace home made sign extension used for
statistics with kernel sign_extend32().
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Antti Palosaari [Wed, 29 Jun 2016 23:39:48 +0000 (20:39 -0300)]
[media] m88ds3103: refactor firmware download
* remove some unneeded variable initialization
* rename variables
* use min() macro to calc max i2c xfer len
* change bad firmware error code from EFAULT to EINVAL
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Antti Palosaari [Wed, 29 Jun 2016 23:39:47 +0000 (20:39 -0300)]
[media] m88ds3103: use Hz instead of kHz on calculations
There was some calculations where was kHz used in order to keep
calculation withing 32-bit. Convert all to Hz and use 64-bit
division helpers where needed.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Antti Palosaari [Wed, 29 Jun 2016 23:39:45 +0000 (20:39 -0300)]
[media] m88ds3103: calculate DiSEqC message sending time
DiSEqC message sending takes 13.5 ms per byte, which is 54 ms total
when typical 4 byte message is sent. Don't hard-code time limit to
54 ms, but calculate it. Time limit is only used to determine when to
start poll "DiSEqC Tx ready" status from the chip.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Antti Palosaari [Wed, 29 Jun 2016 23:38:17 +0000 (20:38 -0300)]
[media] si2168: add support for newer firmwares
Si2168-B40 firmware API has changed somewhere between 4.0-11 and
4.0-19 so that sleep will lose firmware upgrade from the chip. Due
to that firmware re-upload is needed when newer firmwares are used.
Rewrote firmware handling logic partly at the same.
Signed-off-by: Antti Palosaari <crope@iki.fi> Cc: Olli Salonen <olli.salonen@iki.fi> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Hans Verkuil [Fri, 1 Jul 2016 14:37:27 +0000 (11:37 -0300)]
[media] tw686x: make const structs static
Fix sparse warnings:
tw686x-video.c:148:29: warning: symbol 'memcpy_dma_ops' was not declared. Should it be static?
tw686x-video.c:195:29: warning: symbol 'contig_dma_ops' was not declared. Should it be static?
tw686x-video.c:361:29: warning: symbol 'sg_dma_ops' was not declared. Should it be static?
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Dragos Bogdan [Wed, 22 Jun 2016 11:30:42 +0000 (08:30 -0300)]
[media] adv7604: Add support for hardware reset
The part can be reset by a low pulse on the RESET pin (i.e. a hardware
reset) with a minimum width of 5 ms. It is recommended to wait 5 ms
after the low pulse before an I2C write is performed to the part.
For safety reasons, the delays will be between 5 and 10 ms.
The RESET pin can be tied high, so the GPIO is optional.
Arnd Bergmann [Fri, 17 Jun 2016 20:46:28 +0000 (17:46 -0300)]
[media] dvb: use ktime_t for internal timeout
The dvb demuxer code uses a 'struct timespec' to pass a timeout
as absolute time. This will cause problems on 32-bit architectures
in 2038 when time_t overflows, and it is racy with a concurrent
settimeofday() call.
This patch changes the code to use ktime_get() instead, using
the monotonic time base to avoid both the race and the overflow.
Lubomir Rintel [Wed, 1 Jun 2016 13:04:07 +0000 (10:04 -0300)]
[media] usbtv: improve a comment
Patrick Keshishian improved the explanation of the protocol when porting
the driver to OpenBSD. Given it's a reverse engineering one and there's
no documetnation it might be helpful to whoever hacks on the driver.
Signed-off-by: Patrick Keshishian <sidster@boxsoft.com> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Florian Echtler [Tue, 31 May 2016 20:15:33 +0000 (17:15 -0300)]
[media] sur40: fix occasional oopses on device close
Closing the V4L2 device sometimes triggers a kernel oops.
Present patch fixes this.
Signed-off-by: Martin Kaltenbrunner <modin@yuri.at> Signed-off-by: Florian Echtler <floe@butterbrot.org> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Cc: <stable@vger.kernel.org> # for v4.2 and up Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Florian Echtler [Tue, 31 May 2016 20:15:32 +0000 (17:15 -0300)]
[media] sur40: lower poll interval to fix occasional FPS drops to ~56 FPS
The framerate sometimes drops below 60 Hz if the poll interval is too high.
Lowering it to the minimum of 1 ms fixes this.
Signed-off-by: Martin Kaltenbrunner <modin@yuri.at> Signed-off-by: Florian Echtler <floe@butterbrot.org> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Cc: <stable@vger.kernel.org> # for v4.2 and up Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
[media] DocBook: mention the memory type to be set for all streaming I/O
The DMA buffer importing streaming I/O section mentions the memory type
value that has to be set when calling the VIDIOC_REQBUFS ioctl but this
isn't mentioned in neither the Memory Mapping nor User Pointer sections.
A user can know the values by looking at the examples but it's better
to explicitly mention in the documentation, and also makes all sections
about streaming I/O methods more consistent.
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
[media] DocBook: add dmabuf as streaming I/O in VIDIOC_REQBUFS description
Commit 4b9c1cb641c46 ("[media] Documentation: media: description of DMABUF
importing in V4L2") documented the V4L2 dma-buf importing support but did
not update the VIDIOC_REQBUFS description, so only the Memory Mapping and
User Pointer I/O methods are mentioned.
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>