Dan Carpenter [Sun, 15 Jan 2012 10:32:19 +0000 (07:32 -0300)]
[media] tlg2300: fix up check_firmware() return
The caller doesn't check the return value of check_firmware() but static
checkers complain. It currently returns negative error codes, or zero
or greater on success but since the return type is boolean the values
are truncated to one or zero. I've changed it to return an int,
negative on error and zero on success.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Miroslav Slugen [Wed, 21 Dec 2011 00:18:38 +0000 (21:18 -0300)]
[media] xc4000: add support for signal strength measures
In xc4000 chipsets real signal and noise level is stored in register
0x0A and 0x0B,so we can use those registers to monitor signal strength.
I tested this patch on 2 different cards Leadtek DVR3200 and DTV2000H
Plus, both with same results, I used special antenna hubs (toner 4x, 6x,
8x and 12x) with mesured signal lost, both registers are in dB value,
first represent signal with limit value -113.5dB (should be -114dB) and
exactly match with test results. Second represents noise level also in
dB and there is no maximum value, but from tests we can drop everything
above 32dB which tuner realy can't use, signal was usable till 20dB
noise level.
In digital mode we can take signal strength but sadly noise level is not
relevant and real value is stored in demodulator for now just zl10353,
also digital mode is just for testing, because it needs changing other
parts of code which reads data only from demodulator.
In analog mode I was able to test only FM radio, signal level is not
important, it says something about cable and hub losts, but nothing
about real quality of reception, so even if we have signal level at
minimum 113dB we can still here radio, because of that it is displaied
only in debug mode, but for real signal level is used noise register
which is again very accurate, radio noise level was betwen 6-20dB for
good signal, 20-25dB for medium signal, and above 25dB signal is
unusable.
For now real benefit of this patch is only for FM radio mode.
Signed-off-by: Miroslav Slugen <thunder.mmm@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Miroslav Slugen [Sun, 11 Dec 2011 22:00:06 +0000 (19:00 -0300)]
[media] cx88: fix: don't duplicate xc4000 entry for radio
All radio tuners in cx88 driver using same address for radio and tuner,
so there is no need to probe it twice for same tuner and we can use
radio_type UNSET, this also fix broken radio since kernel 2.6.39-rc1
for those tuners.
Miroslav Slugen [Sun, 11 Dec 2011 23:19:34 +0000 (20:19 -0300)]
[media] cx23885: Don't duplicate xc4000 entry for radio
All radio tuners in cx23885 driver using same address for radio and
tuner, so there is no need to probe it twice for same tuner and we can
use radio_type UNSET.
Be aware radio support in cx23885 is not yet committed, so this is only
minor fix for future support.
Signed-off-by: Miroslav Slugen <thunder.mmm@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans de Goede [Tue, 10 Jan 2012 20:47:25 +0000 (17:47 -0300)]
[media] pwc: Remove dev_hint module parameter
The code for this is rather crufty, and being able to tie a device
to a specific minor is not really something we want to support in
a modern udev based world.
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans de Goede [Tue, 10 Jan 2012 20:02:04 +0000 (17:02 -0300)]
[media] pwc: Use one shared usb command buffer
The pwc driver used to:
1. kmalloc a buffer
2. memcpy data to send over usb there
3. do the usb_control_msg call (which does not work with data on the stack)
4. free the buffer
For every usb command send. This patch changes the code to instead malloc
a buffer for this purpose once and use it everywhere.
[mchehab@redhat.com: Fix a compilation breakage with allyesconfig:
drivers/media/video/pwc/pwc-ctrl.c: In function ‘pwc_get_cmos_sensor’:
drivers/media/video/pwc/pwc-ctrl.c:546:3: warning: passing argument 4 of ‘recv_control_msg’ makes integer from pointer without a cast [en$
drivers/media/video/pwc/pwc-ctrl.c:107:12: note: expected ‘int’ but argument is of type ‘unsigned char *’
drivers/media/video/pwc/pwc-ctrl.c:546:3: error: too many arguments to function ‘recv_control_msg’
drivers/media/video/pwc/pwc-ctrl.c:107:12: note: declared here]
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans de Goede [Tue, 10 Jan 2012 16:14:46 +0000 (13:14 -0300)]
[media] pwc: Avoid sending mode info to the camera when it is not needed
Since we always do a set_video_mode on stream start, there is no need
to actually send the mode info to the device on a s_fmt / s_parm ioctl.
Not doing this saves us doing (slow) usb io.
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans de Goede [Tue, 10 Jan 2012 16:01:41 +0000 (13:01 -0300)]
[media] pwc: Fix pixfmt handling
Before this patch various code in the mode setting patch checked
pdev->pixfmt, but that was not set until the mode setting succeeded, so
it was looking at the old pixfmt! This patch fixes this by making the
pixfmt a parameter to set_video_mode, and setting it from set_video_mode
on success.
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans Verkuil [Tue, 11 Oct 2011 08:12:52 +0000 (05:12 -0300)]
[media] v4l2-ioctl: make tuner 'type' check more strict for S_FREQUENCY
As per the feature removal document, make the tuner type check more strict
so that it is no longer possible to set the radio frequency through a video
node or the TV frequency through a radio node.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
As reported by Lawrence[1], MythTV 0.24.1 does the wrong thing
with a DVBv5 call: it fills the delivery system with
SYS_UNDEFINED, expecting that the DVB core would work with that.
This used to work by accident, as the DVB core were missing the
check for the supported delivery systems. Yet, fixing it
is easy, so let's add a logic to handle this case, to
provide backward compatibility.
I added it by mistake. It is useless as no real hardware.
It even uses even Cypress FX2, general USB bridge chip, default IDs
that makes driver load all FX2 devices having default ID...
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
mb86a20s: Add a few more register settings at the init seq
Some time ago, Manoel sent us a patch adding more stuff
to the init sequence. However, his patch were also doing
non-related stuff, by changing the init logic without
any good reason. So, it was asked for him to submit a
patch with just the data that has changed, in order to
allow us to better analyze it.
As he didn't what it was requested, I finally found some
time to dig into his init sequence and add it here.
Basically, new stuff is added there. There are a few changes:
1) The removal of the extra (duplicated) logic that puts
the chip into the serial mode;
2) Some Viterbi VBER measurement init data was changed from
0x00 to 0xff for layer A, to match what was done for
layers B and C.
None of those caused any regressions and both make sense
on my eyes.
The other parameters additions actually increased the
tuning quality for some channels. Yet, some channels that
were previously discovered with scan disappered, while
others appeared instead. This were tested in Brasilia,
with an external antena.
At the overall, it is now a little better. So, better to
add these, and then try to figure out a configuration that
would get even better scanning results.
[media] [PATCH] don't reset the delivery system on DTV_CLEAR
As a DVBv3 application may be relying on the delivery system,
don't reset it at DTV_CLEAR. For DVBv5 applications, the
delivery system should be set anyway.
Add driver for the JPEG codec IP block available in Samsung Exynos SoC series.
The driver is implemented as a V4L2 mem-to-mem device. It exposes two video
nodes to user space, one for the encoding part, and one for the decoding part.
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Sakari Ailus <sakari.ailus@iki.fi> Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Reviewed-by: Tomasz Stanislawski <t.stanislaws@samsung.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] v4l: s5p-tv: mixer: fix setup of VP scaling
Adjusting of Video Processor's scaling factors was flawed. It bounded scaling
to range 1/16 to 1/1. The correct range should be 1/4 to 4/1. This patch fixes
this bug.
Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] v4l: s5p-tv: mixer: add support for selection API
This patch add support for V4L2 selection API to s5p-tv driver. Moreover it
removes old API for cropping. Old applications would still work because the
crop ioctls are emulated using the selection API.
Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] v4l: emulate old crop API using extended crop/compose API
This patch allows new video drivers to work correctly with applications that
use the old-style crop API. The old crop ioctl is emulated by using selection
callbacks.
Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] doc: v4l: add documentation for selection API
This patch adds a documentation for VIDIOC_{G/S}_SELECTION ioctl. Moreover, the
patch adds the description of modeling of composing, cropping and scaling
features in V4L2. Finally, some examples are presented.
Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This patch introduces new api for a precise control of cropping and composing
features for video devices. The new ioctls are VIDIOC_S_SELECTION and
VIDIOC_G_SELECTION.
Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Sascha Sommer [Sun, 8 Jan 2012 19:41:22 +0000 (16:41 -0300)]
[media] em28xx: Fix tuner_type for Terratec Cinergy 200 USB
The card definition of the Terratec Cinergy 200 USB uses the
wrong tuner type. Therefore some channels are currently missing.
Attached patch fixes this problem.
Signed-off-by: Sascha Sommer <saschasommer@freenet.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Sascha Sommer [Sun, 8 Jan 2012 19:54:28 +0000 (16:54 -0300)]
[media] em28xx: increase maxwidth for em2800
The MaxPacketSize for em2800 based devices is too small to capture at full resolution.
Therefore scale down when the maximum frame size is selected.
The previous workaround that simply reduced the X resolution cannot be used
because it crops a part of the input as
the em2800 can only scale down with a factor of 0.5.
Sascha Sommer [Sun, 8 Jan 2012 19:32:09 +0000 (16:32 -0300)]
[media] em28xx: Do not modify EM28XX_R06_I2C_CLK for em2800
writing the EM28XX_R06_I2C_CLK register leads to the problem that the
i2c bus on the Terratec Cinergy 200 USB is no longer usable when the
system is rebooted.
The device needs to be unplugged in order to bring it back to life.
Attached patch conditionally disables the write in
em28xx_pre_card_setup() like it is already done in em28xx_card_setup().
Signed-off-by: Sascha Sommer <saschasommer@freenet.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] em28xx: simplify argument passing to em28xx_init_dev()
The 'struct em28xx *' pointer was passed by reference to the
em28xx_init_dev() function, for no reason. Instead, just pass it by
value, which is much more logical and simple.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Jonathan Nieder [Sat, 7 Jan 2012 07:11:27 +0000 (04:11 -0300)]
[media] af9005, af9015: use symbolic names for USB id table indices
The af9005_properties and af9015_properties tables make use of USB ids
from the USB id tables with hardcoded indices, as in
"&af9015_usb_table[30]". Adding new entries before the end breaks
such references, so everyone has had to carefully tiptoe to only add
entries at the end of the list.
In the spirit of "dw2102: use symbolic names for dw2102_table
indices", use C99-style initializers with symbolic names for each
index to avoid this. In the new regime, properties tables referring
to the USB ids have names like "&af9015_usb_table[CINERGY_T_STICK_RC]"
that do not change meaning when items in the USB id table are
reordered.
[media] cx231xx: use URB_NO_TRANSFER_DMA_MAP on URBs allocated with usb_alloc_urb()
URBs allocated with usb_alloc_urb() are allocated from DMA-coherent
areas, and therefore it is not necessary to call dma_map_single() on
such buffers. Worst, on ARM, calling dma_map_single() on a
DMA-coherent buffer will trigger a BUG_ON() in
arch/arm/mm/dma-mapping.c.
Therefore, we mark all URBs allocated with usb_alloc_urb() with the
URB_NO_TRANSFER_DMA_MAP transfer_flags, so that the USB core does not
do dma_map_single()/dma_unmap_single() on those buffers.
This is similar to 882787ff8fdeb0be790547ee9b22b281095e95da for the
gspca driver, and has already been discussed on the linux-media list
in the past:
http://www.mail-archive.com/linux-media@vger.kernel.org/msg37086.html.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] cx231xx: simplify argument passing to cx231xx_init_dev()
The 'struct cx231xx *' pointer was passed by reference to the
cx231xx_init_dev() function, for no reason. Instead, just pass it by
value, which is much more logical and simple.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
The driver were using DEV_MISCONFIGURED on some places, and
DEV_DISCONNECTED on others. In a matter of fact, DEV_MISCONFIGURED
were set only during the usb disconnect callback, with
was confusing.
Also, the alsa driver never checks if the device is present,
before doing some dangerous things.
Remove DEV_MISCONFIGURED, replacing it by DEV_DISCONNECTED.
Also, fixes the other usecases for DEV_DISCONNECTED.
There are several weirdness at the unregister logic.
First of all, IR has a poll thread. This thread needs to be
removed, as it uses some resources associated to the main driver.
So, the driver needs to explicitly unregister the I2C client for
ir-kbd-i2c.
If, for some reason, the driver needs to wait for a close()
to happen, not all memories will be freed, because the free
logic were in the wrong place.
Also, v4l2_device_unregister() seems to be called too early,
as devices are still using it.
Finally, even with the device disconnected, there is one
USB function call that will still try to talk with it.
[media] cx231xx-input: stop polling if the device got removed.
If the device got removed, stops polling it. Also, un-registers
it at input/evdev, as it won't work anymore. We can't free the
IR structure yet, as the ir_remove method will be called later.
The problem was that cx231xx_usb_disconnect() was not doing anything
because the test:
if (!dev->udev)
return;
was reached (i.e, dev->udev was NULL).
This is due to the fact that the 'dev' pointer placed as intfdata into
the usb_interface structure had the wrong value, because
cx231xx_probe() was doing the usb_set_intfdata() on the wrong
usb_interface structure. For some reason, cx231xx_probe() was doing
the following:
static int cx231xx_usb_probe(struct usb_interface *interface,
const struct usb_device_id *id)
{
struct usb_interface *lif = NULL;
[...]
/* store the current interface */
lif = interface;
[...]
/* store the interface 0 back */
lif = udev->actconfig->interface[0];
[...]
usb_set_intfdata(lif, dev);
[...]
retval = v4l2_device_register(&interface->dev, &dev->v4l2_dev);
[...]
}
So, the usb_set_intfdata() was done on udev->actconfig->interface[0]
and not on the 'interface' passed as argument to the ->probe() and
->disconnect() hooks. Later on, v4l2_device_register() was
initializing the intfdata of the correct usb_interface structure as a
pointer to the v4l2_device structure.
Upon unregistration, the ->disconnect() hook was getting the intfdata
of the usb_interface passed as argument... and casted it to a 'struct
cx231xx *' while it was in fact a 'struct v4l2_device *'.
The correct fix seems to just be to set the intfdata on the proper
interface from the beginning. Now, loading/unloading/reloading the
driver allows to use the device properly.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
the build failed with :
CC [M] drivers/media/dvb/dvb-core/dvb_ca_en50221.o
In file included from arch/x86/include/asm/uaccess.h:573:0,
from include/linux/poll.h:14,
from drivers/media/dvb/dvb-core/dvbdev.h:27,
from drivers/media/dvb/dvb-core/dvb_ca_en50221.h:27,
from drivers/media/dvb/dvb-core/dvb_ca_en50221.c:41:
In function "copy_from_user", inlined from "dvb_ca_en50221_io_write" at drivers/media/dvb/dvb-core/dvb_ca_en50221.c:1314:26: arch/x86/include/asm/uaccess_32.h:211:26: error: call to "copy_from_user_overflow" declared with attribute error: copy_from_user() buffer size is not provably correct
Jonathan Nieder [Fri, 6 Jan 2012 17:40:26 +0000 (14:40 -0300)]
[media] dm1105: release dvbnet on frontend attachment failure
The patch "dm1105: handle errors from dvb_net_init" moved the
initialization of dvbnet to before frontend attachment but forgot
to adjust the error handling when frontend attachment fails.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Jonathan Nieder [Fri, 6 Jan 2012 17:26:41 +0000 (14:26 -0300)]
[media] dvb-bt8xx: convert printks to pr_err()
This module does some printks with the loglevel missing.
pr_err() takes care of adding the KERN_ERR tag and the module name.
So we can simplify the code and add the missing printk loglevel by
using it.
Also add a #define pr_fmt() to make this work, and remove a few
unnecessary periods at the end of messages and bump the loglevel of
"Unknown bttv card type" from KERN_WARNING to KERN_ERR while at it.
This code is wrong as I should have coded it as SYS_DVBC, instead of
SYS_DVBS & friends. Anyway, this check has other problems
1) it does some "magic" by assuming that all QAM modulations are below
QAM_AUTO;
2) it checks modulation parameters only for one delivery system.
Or the core should check invalid parameters for all delivery
systems, or it should let the frontend drivers do it;
3) frontend drivers should already be checking for invalid parameters
(most of them do it, anyway);
4) not all modulations are mapped at fe->ops.info.caps, so it is not
even possible to check for the valid modulations inside the core
for some delivery systems;
5) The core check is incomplete anyway: it only checks for a few
parameters. If moved into the core other parameters like bandwidth
and fec should also be checked;
6) 2nd gen DVB-C uses OFDM. So, that test would fail for it.
Dan Carpenter [Thu, 5 Jan 2012 05:27:57 +0000 (02:27 -0300)]
[media] V4L/DVB: v4l2-ioctl: integer overflow in video_usercopy()
If ctrls->count is too high the multiplication could overflow and
array_size would be lower than expected. Mauro and Hans Verkuil
suggested that we cap it at 1024. That comes from the maximum
number of controls with lots of room for expantion.
Dan Carpenter [Thu, 5 Jan 2012 05:24:00 +0000 (02:24 -0300)]
[media] saa7134: use correct array offset
Smatch complains that i can be one passed the end of the array if we
don't hit the break statement. We should be using the "audio" here like
we do in the other places.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] xc3028: fix center frequency calculation for DTV78 firmware
This patch replaces the previous one proposed in the thread "xc3028:
force reload of DTV7 firmware in VHF band with Zarlink demodulator",
at the linux-media@vger.kernel.org ML.
The problem is that the firmware DTV78 works fine in UHF band (8 MHz
bandwidth) but is not working at all in VHF band (7 MHz bandwidth).
Reading the comments inside the code, I figured out that the real
problem could be connected to the formula used to calculate the center
frequency offset in VHF band.
In fact, removing this adjustment fixes the problem:
[media] it913x changed firmware loader for chip version 2 types
On Thu, 2011-12-15 at 16:42 +0000, Malcolm Priestley wrote:
> > [ 1103.536156] it913x: Chip Version=ec Chip Type=5830
> > [ 1104.336178] it913x: Dual mode=92 Remote=92 Tuner Type=92
> > [ 1106.248116] dvb-usb: found a 'ITE 9135(9006) Generic' in cold state,
> > will try to load a firmware
> > [ 1106.253773] dvb-usb: downloading firmware from file
> > 'dvb-usb-it9135-02.fw'
> > [ 1106.452123] it913x: FRM Starting Firmware Download
> > [ 1130.756039] it913x: FRM Firmware Download Failed (ffffff92)
> > [ 1130.956168] it913x: Chip Version=79 Chip Type=5823
> > [ 1131.592192] it913x: DEV it913x Error
> > [ 1131.592271] usbcore: registered new interface driver it913x
> >
> > No frontend is generated anyway.
>
> Looks like the the firmware is not at all compatible with your device.
>
> Have you applied the patch cleanly to the latest media_build?
>
> These appear to be new version of the 9006. A supplier is sending me one
> of these devices.
>
> As a last resort see if the device works with dvb-usb-it9137-01.fw
>
> You will have force to use this firmware
> dvb-usb-it913x firmware=1
Here is a modified firmware loader for version 2 types.
The firmware must be as in original
./dvb_get_firmware it9135
Don Kramer [Mon, 2 Jan 2012 19:15:44 +0000 (16:15 -0300)]
[media] [resend] em28xx: Add Plextor ConvertX PX-AV100U to em28xx-cards.c
Adds support for the Plextor ConvertX PX-AV100U, which uses the
eMPIA EM2820 chip. The device has a device_id of '0x093b, 0xa003'. I
am using the existing EM2820_BOARD_PINNACLE_DVC_90 board profile, as
the Pinnacle Dazzle DVC 90/100/101/107, Kaiser Baas Video to DVD
maker, and Kworld DVD Maker 2 were already mapped to it. Some more
background on the device and my testing can be found at
http://www.donkramer.net/plextor_122710.pdf
Signed-off-by: Don Kramer <dgkramer@comcast.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] [BUG] it913x ver 1.20. PID filter problems
Fixes issues with PID filter
Stalling of some channels when PID is on.
PID filter not turning off fully.
PID filter can now turn on and off each index.
Removed PID_RST from it913x_pid_filter_ctrl.
Replaced with PID_EN removed from it913x_pid_filter
[media] v4l: Add VIDIOC_LOG_STATUS support for sub-device nodes
The VIDIOC_LOG_STATUS ioctl allows to dump the current status of a driver
to the kernel log. Currently this ioctl is only available at video device
nodes and the subdevs rely on the host driver to expose their core.log_status
operation to user space.
This patch adds VIDIOC_LOG_STATUS support at the sub-device nodes,
for standalone subdevs that expose their own /dev entry.