Some of the SOCs hold the IRB IP in softreset state by default.
For this IP to work driver needs to bring it out of softreset.
This patch adds support to reset the IP via reset framework.
Without this patch the driver can not work with SoCs which holds the IP
in softreset.
Wei Yongjun [Wed, 15 Jan 2014 02:46:06 +0000 (23:46 -0300)]
[media] radio-usb-si4713: fix sparse non static symbol warnings
Fixes the following sparse warnings:
drivers/media/radio/si4713/radio-usb-si4713.c:226:31: warning:
symbol 'start_seq' was not declared. Should it be static?
drivers/media/radio/si4713/radio-usb-si4713.c:291:29: warning:
symbol 'command_table' was not declared. Should it be static?
Frank Schaefer [Mon, 13 Jan 2014 22:02:07 +0000 (19:02 -0300)]
[media] em28xx: fix check for audio only usb interfaces when changing the usb alternate setting
Previously, we've been assuming that the video endpoints are always at usb
interface 0. Hence, if vendor audio endpoints are provided at a separate
interface, they were supposed to be at interface number > 0.
Instead of checking for (interface number > 0) to determine if an interface
is a pure audio interface, dev->is_audio_only should be checked.
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Frank Schaefer [Mon, 13 Jan 2014 22:02:06 +0000 (19:02 -0300)]
[media] em28xx: fix usb alternate setting for analog and digital video endpoints > 0
The current code assumes that the analog + digital video endpoints are always at
interface number 0 when changing the alternate setting.
This seems to work fine for most existing devices.
However, at least the SpeedLink VAD Laplace webcam has the video endpoint on
interface number 3 (which fortunately doesn't cause any trouble because ist uses
bulk transfers only).
We already consider the actual interface number for audio endpoints, so
rename the the audio_ifnum variable and use it for all device types.
Also get get rid of a pointless (ifnum < 0) in em28xx-audio.
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
[media] drxk: remove the option to load firmware asynchronously
The option to load firmware asynchronously were added due to
a requirement with a few versions of udev. It turns that this was
a bad idea and caused regressions on drxk-based devices.
So, we end by only letting the firmware to be loaded syncronously
everywhere.
So, let's remove the bad code.
This patch partially reverts the changeset 8e30783b0b3.
While the current hardcoded period is ok for the current values,
we may latter change the driver to work with different bit rates
or with different latencies than 64ms.
[media] em28xx: push mutex down to extensions on .fini callback
Avoid circular mutex lock by pushing the dev->lock to the .fini
callback on each extension.
As em28xx-dvb, em28xx-alsa and em28xx-rc have their own data
structures, and don't touch at the common structure during .fini,
only em28xx-v4l needs to be locked.
Frank Schaefer [Sun, 12 Jan 2014 16:24:22 +0000 (13:24 -0300)]
[media] em28xx-v4l: move v4l2_ctrl_handler freeing and v4l2_device unregistration to em28xx_v4l2_fini
v4l2_ctrl_handler_free() and v4l2_device_unregister() are currently only called
when the last user closes the device and the device is already disconnected.
But that's wrong, we need to call these functions whenever the em28xx-v4l
extension is closed and we can already do this if the device is still opened
by some users.
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Frank Schaefer [Sun, 12 Jan 2014 16:24:18 +0000 (13:24 -0300)]
[media] em28xx-v4l: fix device initialization in em28xx_v4l2_open() for radio and VBI mode
- bail out on unsupported VFL_TYPE
- em28xx_set_mode() needs to be called for VBI and radio mode, too
- em28xx_wake_i2c() needs to be called for VBI and radio mode, too
- em28xx_resolution_set() also needs to be called for VBI
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
In file included from /devel/v4l/temp/include/asm-generic/page.h:23:0,
from /devel/v4l/temp/arch/c6x/include/asm/page.h:9,
from /devel/v4l/temp/include/asm-generic/io.h:14,
from arch/c6x/include/generated/asm/io.h:1,
from /devel/v4l/temp/drivers/media/radio/tea575x.c:23:
/devel/v4l/temp/arch/c6x/include/asm/setup.h:17:27: error: unknown type name ‘phys_addr_t’
extern int c6x_add_memory(phys_addr_t start, unsigned long size);
It seems that, on such arch, the includes from asm/ should be
after the ones from linux/.
The proper fix would be to patch the arch files, but, as
this fix is trivial, apply it. Also, we generally put the
asm includes after the linux ones, anyway.
[media] lirc_parallel: avoid name conflict on mn10300 arch
The "irq_handler" name is already defined there on a header
file:
/devel/v4l/temp/drivers/staging/media/lirc/lirc_parallel.c:223:13: error: conflicting types for ‘irq_handler’
static void irq_handler(void *blah)
^
In file included from /devel/v4l/temp/arch/mn10300/include/asm/reset-regs.h:16:0,
from /devel/v4l/temp/arch/mn10300/include/asm/irq.h:18,
from /devel/v4l/temp/include/linux/irq.h:24,
from /devel/v4l/temp/arch/mn10300/include/asm/hardirq.h:16,
from /devel/v4l/temp/include/linux/preempt_mask.h:5,
from /devel/v4l/temp/include/linux/sched.h:25,
from /devel/v4l/temp/include/linux/utsname.h:5,
from /devel/v4l/temp/arch/mn10300/include/asm/elf.h:15,
from /devel/v4l/temp/include/linux/elf.h:4,
from /devel/v4l/temp/include/linux/module.h:14,
from /devel/v4l/temp/drivers/staging/media/lirc/lirc_parallel.c:29:
/devel/v4l/temp/arch/mn10300/include/asm/exceptions.h:107:24: note: previous declaration of ‘irq_handler’ was here
extern asmlinkage void irq_handler(void);
/devel/v4l/patchwork/drivers/staging/media/lirc/lirc_serial.c:653:20: error: conflicting types for ‘irq_handler’
static irqreturn_t irq_handler(int i, void *blah)
^
In file included from /devel/v4l/patchwork/arch/mn10300/include/asm/reset-regs.h:16:0,
from /devel/v4l/patchwork/arch/mn10300/include/asm/irq.h:18,
from /devel/v4l/patchwork/include/linux/irq.h:24,
from /devel/v4l/patchwork/arch/mn10300/include/asm/hardirq.h:16,
from /devel/v4l/patchwork/include/linux/preempt_mask.h:5,
from /devel/v4l/patchwork/include/linux/sched.h:25,
from /devel/v4l/patchwork/include/linux/utsname.h:5,
from /devel/v4l/patchwork/arch/mn10300/include/asm/elf.h:15,
from /devel/v4l/patchwork/include/linux/elf.h:4,
from /devel/v4l/patchwork/include/linux/module.h:14,
from /devel/v4l/patchwork/drivers/staging/media/lirc/lirc_serial.c:53:
/devel/v4l/patchwork/arch/mn10300/include/asm/exceptions.h:107:24: note: previous declaration of ‘irq_handler’ was here
extern asmlinkage void irq_handler(void);
So, rename it, to avoid namespace conflicts.
This patch fixes building media drivers with allyesconfig/almodconfig on
mn10300 arch.
[media] go7007-usb: only use go->dev after allocated
Fixes those warnings:
drivers/staging/media/go7007/go7007-usb.c: In function 'go7007_usb_probe':
drivers/staging/media/go7007/go7007-usb.c:1060: warning: 'go' is used uninitialized in this function
[media] dib8000: Fix a few warnings when compiled for avr32
drivers/media/dvb-frontends/dib8000.c: In function 'dib8000_get_time_us':
drivers/media/dvb-frontends/dib8000.c:3957: warning: 'interleaving' may be used uninitialized in this function
drivers/media/dvb-frontends/dib8000.c:3956: warning: 'rate_denum' may be used uninitialized in this function
Those are actually false positives, but it doesn't hurt cleaning them.
[media] dib8000: Properly represent long long integers
When compiling with avr32, it gets those errors:
drivers/media/dvb-frontends/dib8000.c: In function 'dib8000_get_stats':
drivers/media/dvb-frontends/dib8000.c:4121: warning: integer constant is too large for 'long' type
[media] radio-usb-si4713: make si4713_register_i2c_adapter static
This function isn't used nowhere outside the same .c file.
Fixes this warning:
drivers/media/radio/si4713/radio-usb-si4713.c:418:5: warning: no previous prototype for 'si4713_register_i2c_adapter' [-Wmissing-prototypes]
int si4713_register_i2c_adapter(struct si4713_usb_device *radio)
^
Cc: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Fix two warns below, by commenting the unused code:
drivers/media/platform/sh_vou.c: In function 'sh_vou_configure_geometry':
drivers/media/platform/sh_vou.c:446:49: warning: variable 'height_max' set but not used [-Wunused-but-set-variable]
unsigned int black_left, black_top, width_max, height_max,
^
drivers/media/platform/sh_vou.c: In function 'sh_vou_isr':
drivers/media/platform/sh_vou.c:1056:13: warning: variable 'side' set but not used [-Wunused-but-set-variable]
static int side;
^
Tim Mester [Tue, 7 Jan 2014 04:29:25 +0000 (01:29 -0300)]
[media] au0828: Add option to preallocate digital transfer buffers
Added command line parameter preallocate_big_buffers so that the digital
transfer buffers can be allocated when the driver is registered. They
do not have to be allocated every time a feed is started.
Signed-off-by: Tim Mester <tmester@ieee.org> Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Tim Mester [Tue, 7 Jan 2014 04:29:24 +0000 (01:29 -0300)]
[media] au8028: Fix cleanup on kzalloc fail
Free what was allocated if there is a failure allocating
transfer buffers.
Stop the feed on a start feed error. The stop feed is not always called
if start feed fails. If the feed is not stopped on error, then the driver
will be stuck so that it can never start feeding again.
[m.chehab@samsung.com: CodingStyle cleanup] Signed-off-by: Tim Mester <tmester@ieee.org> Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
[media] media: s5p_mfc: remove s5p_mfc_get_node_type() function
s5p_mfc_get_node_type() relies on get_index() helper function, which in
turn relies on video_device index numbers assigned on driver
registration. All this code is not really needed, because there is
already access to respective video_device structures via common
s5p_mfc_dev structure. This fixes the issues introduced by patch 1056e4388b0454917a512618c8416a98628fc9ce ("v4l2-dev: Fix race condition
on __video_register_device"), which has been merged in v3.12-rc1.
The URB calculus code may eventually be moved to some other
place, like at pcm open, if it ends by needing more setups, like
working with different bit rates, or different audio latency.
So, move it into a separate routine. That also makes the code
more readable.
[media] em28xx-audio: don't wait for lock in non-block mode
Pulseaudio has the bad habit of stopping a streaming audio if
a device, opened in non-block mode, waits.
It is impossible to avoid em28xx to wait, as it will send commands
via I2C, and other I2C operations may be happening (firmware
transfers, Remote Controller polling, etc). Yet, as each em28xx
subdriver locks em28xx-dev to protect the access to the hardware,
it is possible to minimize the audio glitches by returning -EAGAIN
to pulseaudio, if the lock is already taken by another subdriver.
Reported-by: Antti Palosaari <crope@iki.fi> Tested-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
[media] em28xx-audio: fix the period size in bytes
If the period size is wrong, userspace will assume a wrong delay
any may negociate an inadequate value.
The em28xx devices use 8 for URB interval, in microframes,
and the driver programs it to have 64 packets.
That means that the IRQ sampling period is 125 * 8 * 64,
with is equal to 64 ms.
So, that's the minimal latency with the current settings. It is
possible to program a lower latency, by using less than 64 packets,
but that increases the amount of bandwitdh used, and the number of
IRQ events per second.
In any case, in order to support it, the driver logic should be
changed to fill those parameters in realtime.
The current code hardcodes the number of audio URBs, the number
of packets per URB and the maximum URB size.
This is not a good idea, as it:
- wastes more bandwidth than necessary, by using a very
large number of packets;
- those constants are bound to an specific scenario, with
a bandwidth of 48 kHz;
- don't take the maximum endpoint size into account;
- with urb->interval = 1 on xHCI, those constraints cause a "funny"
setup: URBs with 64 packets inside, with only 24 bytes total. E. g.
a complete waste of space.
Change the code to do dynamic URB audio calculus and allocation.
For now, use the same constraints as used before this patch, to
avoid regressions.
A good scenario (tested) seems to use those defines, instead:
The I2C output messages is too polluted. Clean it a little
bit, by:
- use the proper core support for memory dumps;
- hide most stuff under the i2c_debug umbrella;
- add the missing KERN_CONT where needed;
- use 2 levels or verbosity. Only the second one
will show the I2C transfer data.
[media] em28xx-i2c: Fix error code for I2C error transfers
Follow the error codes for I2C as described at Documentation/i2c/fault-codes.
In the case of the I2C status register (0x05), this is mapped into:
- ENXIO - when reg 05 returns 0x10
- ETIMEDOUT - when the device is not temporarily not responding
(e. g. reg 05 returning something not 0x10 or 0x00)
- EIO - for generic I/O errors that don't fit into the above.
In the specific case of 0-byte reads, used only during I2C device
probing, it keeps returning -ENODEV.
TODO: return EBUSY when reg 05 returns 0x20 on em2874 and upper.
The comment incorrectly explains that the code verifies information
provided by userspace, while verification has been performed earlier in
reality. Fix it.
Hans Verkuil [Tue, 24 Dec 2013 15:42:19 +0000 (12:42 -0300)]
[media] [for,v3.14] sn9c102: fix build dependency
This driver should only build if MEDIA_USB_SUPPORT is set.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reported-by: Jim Davis <jim.epost@gmail.com> Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Sachin Kamat [Tue, 24 Dec 2013 11:42:03 +0000 (08:42 -0300)]
[media] s5k5baf: Fix build warning
Fixes the following warnings:
drivers/media/i2c/s5k5baf.c: In function 's5k5baf_fw_parse':
drivers/media/i2c/s5k5baf.c:362:3: warning:
format '%d' expects argument of type 'int', but argument 3 has type 'size_t' [-Wformat=]
drivers/media/i2c/s5k5baf.c:383:4: warning:
format '%d' expects argument of type 'int', but argument 4 has type 'size_t' [-Wformat=]
[media] cx231xx: Add missing KERN_CONT to i2c debug prints
Fix continuation lines.
[m.chehab@samsung.com: This was actually part of a v2 patch meant to
fix i2c debug prints. As version 1 was already applied, I'm applying
here the diff and fixing the patch subject/description]
Frank Schaefer [Sun, 22 Dec 2013 14:17:46 +0000 (11:17 -0300)]
[media] em28xx: fix I2S audio sample rate definitions and info output
The audio configuration in chip config register 0x00 and eeprom are always
consistent. But currently the audio configuration #defines for the chip config
register say 0x20 means 3 sample rates and 0x30 5 sample rates, while the eeprom
info output says 0x20 means 1 sample rate and 0x30 3 sample rates.
I've checked the datasheet excerpts I have and it seems that the meaning of
these bits is different for em2820/40 (1 and 3 sample rates) and em2860+
(3 and 5 smaple rates).
I have also checked my Hauppauge WinTV USB 2 (em2840) and the chip/eeprom
audio config 0x20 matches the sample rates reproted by the USB device
descriptor (32k only).
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
[media] omap3isp: ccdc: Don't hang when the SBL fails to become idle
Under abnormal conditions (such as glitches on the HSYNC/VSYNC signals)
the CCDC output SBL can fail to become idle. The driver currently logs
this condition to the kernel log and doesn't restart the CCDC. This
results in CCDC video capture hanging without any notification to
userspace.
Cancel the pipeline and mark the CCDC as crashed instead of hanging.
Userspace will be notified of the problem and will then be able to close
and reopen the device to trigger a reset of the ISP.
Modules failing to stop are fatal errors for the preview engine only.
Flag that condition separately from the other stop failures to prepare
support for more fatal errors.
[media] omap3isp: Cancel streaming when a fatal error occurs
When a fatal error that prevents any further video streaming occurs in a
pipeline, all queued buffers must be marked as erroneous and new buffers
must be prevented from being queued. Implement this behaviour with a new
omap3isp_pipeline_cancel_stream() function that can be used by
submodules to cancel streaming.