[media] au0828: explicitly identify boards with analog TV
Right now, the au0828 driver uses .tuner to detect if analog
tv is being used or not. By not filling .tuner fields at the
board struct, the I2C core can't do decisions based on it.
So, add a field to explicitly tell when analog TV is supported.
[media] au0828-cards: remove a comment about i2c clock stretching
This comment is already at the au0828-i2c where it belongs.
So, remove it from a board's entry. It doesn't make any sense
there, as we're setting the clock to 250kHz there, slowing it
down only at the au0828-i2c.
cab_state->modulation is initialized with a wrong value:
drivers/media/dvb-frontends/stv0367.c:3000:42: warning: mixing different enum types
drivers/media/dvb-frontends/stv0367.c:3000:42: int enum fe_modulation versus
drivers/media/dvb-frontends/stv0367.c:3000:42: int enum stv0367cab_mod
as it was declared as "enum stv0367cab_mod". While it could be fixed,
there's no value on it, as this is never used.
So, just remove the modulation from cab_state structure.
Frank Schaefer [Fri, 15 Aug 2014 18:16:58 +0000 (15:16 -0300)]
[media] em28xx-input: i2c IR decoders: improve i2c_client handling
Instead of using a temporary stack allocated i2c_client in em28xx_i2c_ir_handle_key(),
allocate/free the i2c_client at module init/uninit and hook it into struct em28xx_IR
(if the device has an i2c IR decoder).
This reduces the frame size of function em28xx_i2c_ir_handle_key() and speeds
it up a bit.
Also make sure that all fields of struct i2c_client are initialized properly.
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Wennborg [Thu, 7 Aug 2014 05:42:04 +0000 (02:42 -0300)]
[media] dvb: return the error from i2c_transfer if negative
Just returns whatever error that was returned by the i2c core,
in the case of errors, only returning -EREMOTEIO if the transfer size
is not what it was expected.
Signed-off-by: Hans Wennborg <hans@hanshq.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Morgan Phillips [Mon, 8 Sep 2014 12:49:47 +0000 (09:49 -0300)]
[media] sn9c20x: fix checkpatch warning: sizeof cmatrix should be sizeof(cmatrix)
Signed-off-by: Morgan Phillips <winter2718@gmail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Morgan Phillips [Mon, 8 Sep 2014 12:32:22 +0000 (09:32 -0300)]
[media] sn9c20x.c: fix checkpatch error: that open brace { should be on the previous line
Signed-off-by: Morgan Phillips <winter2718@gmail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Verkuil [Sat, 20 Sep 2014 13:19:33 +0000 (10:19 -0300)]
[media] cx23885: fix size helper functions
The norm_swidth function was unused and is dropped. It's not clear
what the purpose of that function was.
The norm_maxh function was changed so it tests for 60 Hz standards
rather than for 50 Hz standards. The is the preferred order.
The norm_maxw function was poorly written and used: it gives the maximum
allowed line width for the given standard. For 60 Hz that's 720, but
for 50 Hz that's 768 which allows for 768x576 which gives you square
pixels. For 60 Hz formats it is 640x480 that gives square pixels, so
there is no need to go beyond 720.
The initial width was set using norm_maxh(), which was wrong. Just set
to 720, that's what you normally use. Since the initial standard was
NTSC anyway the initial width was always 720 anyway.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Verkuil [Sat, 20 Sep 2014 13:19:32 +0000 (10:19 -0300)]
[media] cx23885: fix VBI support
Tested VBI support and discovered that the wrong offset was used.
After this change it is now working. Verified with CC/XDS for NTSC
and WSS/Teletext on PAL.
It also reported the wrong start lines for the second field. That's
now fixed as well.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Verkuil [Sat, 20 Sep 2014 10:36:39 +0000 (07:36 -0300)]
[media] adv7604/adv7842: fix il_vbackporch typo and zero the struct
Both adv7604 and adv7842 had the same typo in the code that sets
the vertical backporch for the second interlaced field: it was
assigned to vbackporch instead of il_vbackporch.
In addition, the timings struct wasn't zeroed in the adv7842 driver,
leaving several fields to undefined values causing the timing match
function to fail.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Verkuil [Sat, 20 Sep 2014 10:36:38 +0000 (07:36 -0300)]
[media] v4l2-dv-timings: only check standards if non-zero
If one or both of the timings being compared have the standards field
with value 0, then accept that. Only check for matching standards if
both timings have actually filled in that field.
Otherwise no match will ever be found since when timings are detected
the standards field will typically be set to 0 by the driver.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Verkuil [Sat, 20 Sep 2014 09:11:44 +0000 (06:11 -0300)]
[media] vivid: add teletext support to VBI capture
This is useful to test teletext capture applications like alevt and mtt.
It also fixes a previously undetected bug where the PAL VBI start line
of the second field was off by one. Using the new field start defines
helps a lot fixing such bugs.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
[media] v4l2: uvcvideo: Allow using larger buffers
A test in uvc_video_decode_isoc() checks whether an image has been
received from the camera completely. For this the data amount is compared
to the buffer length, which, however, doesn't have to be equal to the
image size. Switch to using formats .sizeimage field for an exact
expected image size.
drivers/media/usb/hackrf/hackrf.c:64:3: warning: this decimal constant is unsigned only in ISO C90 [enabled by default]
.rangehigh = 4294967294, /* max u32, hw goes over 7GHz */
^
[media] v4l: Add ARGB555X and XRGB555X pixel formats
The existing RGB555X pixel format is ill-defined in respect to its alpha
bit and its meaning is driver dependent. Create new standard ARGB555X
and XRGB555X variants with clearly defined meanings and make the
existing variant deprecated.
The new pixel formats 4CC values have been selected to match the DRM
4CCs for the same in-memory formats.
William Manley [Thu, 13 Mar 2014 12:38:48 +0000 (09:38 -0300)]
[media] uvcvideo: Work around buggy Logitech C920 firmware
The uvcvideo webcam driver exposes the v4l2 control "Exposure (Absolute)"
which allows the user to control the exposure time of the webcam,
essentially controlling the brightness of the received image. By default
the webcam automatically adjusts the exposure time automatically but the
if you set the control "Exposure, Auto"="Manual Mode" the user can fix
the exposure time.
Unfortunately it seems that the Logitech C920 has a firmware bug where
it will forget that it's in manual mode temporarily during initialisation.
This means that the camera doesn't respect the exposure time that the user
requested if they request it before starting to stream video. They end up
with a video stream which is either too bright or too dark and must reset
the controls after video starts streaming.
This patch introduces the quirk UVC_QUIRK_RESTORE_CTRLS_ON_INIT which
causes the cached controls to be re-uploaded to the camera immediately
after initialising the camera. This quirk is applied to the C920 to work
around this camera bug.
Vincent Palatin [Thu, 4 Sep 2014 00:47:48 +0000 (21:47 -0300)]
[media] v4l: uvcvideo: Add support for pan/tilt speed controls
Map V4L2_CID_TILT_SPEED and V4L2_CID_PAN_SPEED to the standard UVC
CT_PANTILT_RELATIVE_CONTROL terminal control request.
Tested by plugging a Logitech ConferenceCam C3000e USB camera
and controlling pan/tilt from the userspace using the VIDIOC_S_CTRL ioctl.
Verified that it can pan and tilt at the same time in both directions.
this patch removes unneeded dependency of ARCH_OMAP3
on VIDEO_DM6446_CCDC.
Also the top level platform Makefile descended into
davinci/ without any dependency so just drop the
dependency obj-y, as obj-$(CONFIG_ARCH_DAVINCI)
already exists.
Reported-by: Andreas Ruprecht <rupran@einserver.de> Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
[media] media: davinci: vpif_capture: fix the check on suspend/resume callbacks
It is possible to call STREAMON without having any buffers queued.
So vb2_is_streaming() can return true without start_streaming()
having been called. Only after at least one buffer has been
queued will start_streaming be called.
The check vb2_is_streaming() is incorrect as this would start
the DMA without having proper DMA pointers set up. this patch
uses vb2_start_streaming_called() instead to check is streaming
was called.
[media] media: davinci: vpif_display: fix the check on suspend/resume callbacks
It is possible to call STREAMON without having any buffers queued.
So vb2_is_streaming() can return true without start_streaming()
having been called. Only after at least one buffer has been
queued will start_streaming be called.
The check vb2_is_streaming() is incorrect as this would start
the DMA without having proper DMA pointers set up. this patch
uses vb2_start_streaming_called() instead to check is streaming
was called.
Hans de Goede [Sun, 31 Aug 2014 10:19:21 +0000 (07:19 -0300)]
[media] videobuf: Allow reqbufs(0) to free current buffers
All the infrastructure for this is already there, and despite our desires for
the old videobuf code to go away, it is currently still in use in 18 drivers.
Allowing reqbufs(0) makes these drivers behave consistent with modern drivers,
making live easier for userspace, see e.g. :
https://bugzilla.gnome.org/show_bug.cgi?id=735660
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Verkuil [Mon, 25 Aug 2014 11:57:59 +0000 (08:57 -0300)]
[media] videobuf2-core: take mmap_sem before calling __qbuf_userptr
(Changes since v2: dropped local variable as suggested by Laurent)
Commit f035eb4e976ef5a059e30bc91cfd310ff030a7d3 (videobuf2: fix lockdep warning)
unfortunately removed the mmap_sem lock that is needed around the call to
__qbuf_userptr. Amazingly nobody noticed this (especially me as the author)
until Jan Kara pointed this out to me.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reported-by: Jan Kara <jack@suse.cz> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Antti Palosaari [Mon, 4 Aug 2014 02:40:23 +0000 (23:40 -0300)]
[media] tda18212: rename state from 'priv' to 'dev'
foo_dev seems to be most correct term for the structure holding data
of each device instance. It is most used term in Kernel codebase and also
examples from book Linux Device Drivers, Third Edition, uses it.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Antti Palosaari [Mon, 4 Aug 2014 02:26:27 +0000 (23:26 -0300)]
[media] tda18212: clean logging
There is no need to print module name nor function name as those
are done by kernel logging system when dev_xxx logging is used and
driver is proper I2C driver.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Antti Palosaari [Mon, 4 Aug 2014 01:43:26 +0000 (22:43 -0300)]
[media] tda18212: prepare for I2C client conversion
We need carry pointer to frontend via config struct
(I2C platform_data ptr) when I2C model is used. Add that pointer
first in order to keep build unbreakable during conversion.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Antti Palosaari [Thu, 4 Sep 2014 21:35:59 +0000 (18:35 -0300)]
[media] af9035: remove I2C client differently
It crash kernel when device was removed while it was streaming.
That is because we removed driver and frontend thread was still
running. Use new callback which allows I2C driver removal just
after frontend is unregistered.
V2: fixed by reported by Daniel
Reported-by: Daniel Glöckner <daniel-gl@gmx.net> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Antti Palosaari [Thu, 4 Sep 2014 21:31:40 +0000 (18:31 -0300)]
[media] dvb-usb-v2: add tuner_detach callback
Add tuner_detach callback in order to allow custom detach. It is
needed when tuner driver is implemented I2C client or some other
kernel bus, but not proprietary dvb_attach / dvb_detach.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Antti Palosaari [Thu, 4 Sep 2014 20:04:44 +0000 (17:04 -0300)]
[media] dvb-usb-v2: add frontend_detach callback
Add frontend_detach callback in order to allow custom detach. It is
needed when demod driver is implemented I2C client or some other
kernel bus, but not proprietary dvb_attach / dvb_detach.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Antti Palosaari [Thu, 4 Sep 2014 02:30:44 +0000 (23:30 -0300)]
[media] af9033: remove all DVBv3 stat calculation logic
Statistics are now calculated for DVBv5 and those DVBv5 values are
returned for legacy DVBv3 calls also. So we could remove all old
statistics calculation logic.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Antti Palosaari [Tue, 2 Sep 2014 06:55:21 +0000 (03:55 -0300)]
[media] af9033: implement DVBv5 statistics for signal strength
Let the demod firmware estimate RF signal strength and return it
to the app as a dBm. To handle that, use thread which reads signal
strengths from firmware in 2 sec intervals when device is active.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Antti Palosaari [Mon, 1 Sep 2014 00:08:09 +0000 (21:08 -0300)]
[media] af9033: clean up logging
It uses I2C client so logging system prints module name
automatically. Function name is also added automatically, if it is
requested from dynamic debug by setting proper format.
Because of that, we could simplify logging in our driver.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Antti Palosaari [Sun, 31 Aug 2014 05:18:34 +0000 (02:18 -0300)]
[media] af9033: rename 'state' to 'dev'
foo_dev seems to be most correct term for the structure holding data
of each device instance. It is most used term in Kernel codebase and also
examples from book Linux Device Drivers, Third Edition, uses it.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Antti Palosaari [Sun, 31 Aug 2014 03:29:33 +0000 (00:29 -0300)]
[media] it913x: replace udelay polling with jiffies
udelay based I/O polling loop is a bad idea, especially system
performance point of view. Kernel jiffies are preferred solution
for such situations. Use it instead.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Antti Palosaari [Thu, 28 Aug 2014 05:07:08 +0000 (02:07 -0300)]
[media] it913x: get rid of script loader and and private header file
Used script loader is quite useless and hides register numbers
making code hard to understand. Get rid of it and use standard
RegMap register write functions directly.
it913x_priv.h file leaves empty after that change and is also
removed.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Antti Palosaari [Tue, 26 Aug 2014 23:11:08 +0000 (20:11 -0300)]
[media] it913x: rename 'state' to 'dev'
foo_dev seems to be most correct term for the structure holding data
of each device instance. It is most used term in Kernel and also
examples from book Linux Device Drivers, Third Edition, uses it.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Antti Palosaari [Tue, 26 Aug 2014 21:56:46 +0000 (18:56 -0300)]
[media] it913x: change reg read/write routines more common
Change register write and read routines to similar which are
typically used. We have to add processor core as a part of register
address in order to simplify register access. Chip has two cores,
called link and ofdm. As for now, use address bit 24 to address used
core. Bits 15:0 are register address in given core.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Antti Palosaari [Tue, 26 Aug 2014 20:14:16 +0000 (17:14 -0300)]
[media] it913x: convert to I2C driver
Change the it913x driver to use the I2C high lever tuner
binding model. As af9035 depends on it, add a code there
to do the binding.
[mchehab@osg.samsung.com: Merge 3 patches into one, because
we don't want to break bisect due to the conversion] Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Antti Palosaari [Tue, 26 Aug 2014 03:08:16 +0000 (00:08 -0300)]
[media] it913x: rename tuner_it913x => it913x
Remove tuner_ prefix from module name and file names. Prefix was
added due to file name conflict on media out-tree build system.
Demodulator having same name does not exists anymore. So lets
remove dumb prefix.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Original commit itself is correct, but it was replaced by more
general solution (commit 1cbbf90d0406913ad4b44194b07f4f41bde84e54).
This old solution was committed by a accident and is not needed
anymore.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Antti Palosaari [Sat, 9 Aug 2014 16:39:16 +0000 (13:39 -0300)]
[media] it913x: fix IT9135 AX sleep
Old IT9135 AX needs a little bit different register settings for
sleep than newer IT9135 BX. This has been broken always, as power
management of the whole driver, but it started to be problem as I
fixed clock. Earlier clock was disabled very first on sleep and
rest of the commands were skipped by the chip as no clock, leaving
tuner full power state. When I fixed clocks these PM bugs started
raising out as I/O errors.
Antti Palosaari [Sat, 9 Aug 2014 03:15:05 +0000 (00:15 -0300)]
[media] it913x: fix tuner sleep power leak
IT913x tuner driver disables own clock, provided by demod core, as
very a first operation when tuner is put on *sleep*. That likely
causes failure of all the rest commands on sleep sequence, which
leads situation where tuner is not actually on sleep, but consuming
a lot of power.
I measured 102mA current consumption from the USB before change
and after change it was only 32mA. Used device was single tuner
IT9135 BX.
Second reason to remove that register from tuner driver is reason
it is simply on wrong driver (demod vs. tuner), breaking the
principle of correct driver.
Clock is now provided more correctly af9033 demod driver as a
config option.
Antti Palosaari [Sat, 9 Aug 2014 03:08:57 +0000 (00:08 -0300)]
[media] af9035: enable AF9033 demod clock source for IT9135
Integrated RF tuner of IT9135 is connected to demod clock source
named dyn0_clk. Enable that clock source in order to provide stable
clock early enough.
Antti Palosaari [Sat, 9 Aug 2014 02:56:49 +0000 (23:56 -0300)]
[media] af9033: provide dyn0_clk clock source
AF903x/IT913x demod provides clock source(s). It seems that this
clock source is used for integrated RF tuner of IT913x. It is
enabled by default, but firmware disables it automatically when
suspend is requested (suspend_flag (0x004c) + trigger_ofsm
(0x0000)). Automatic disable behavior seems to be similar for both
AF903x and IT913x I tested, though there is no likely any real
clock user in a case of AF903x.
coda-bit uses kmalloc/kfree functions, so the slab header needs to be included
in order to fix the following build errors:
drivers/media/platform/coda/coda-bit.c: In function 'coda_fill_bitstream':
drivers/media/platform/coda/coda-bit.c:231:4: error: implicit declaration of function 'kmalloc' [-Werror=implicit-function-declaration]
drivers/media/platform/coda/coda-bit.c: In function 'coda_alloc_framebuffers':
drivers/media/platform/coda/coda-bit.c:312:3: error: implicit declaration of function 'kfree' [-Werror=implicit-function-declaration]
Antti Palosaari [Thu, 31 Jul 2014 19:35:56 +0000 (16:35 -0300)]
[media] tda18212: add support for slave chip version
There is 2 different versions of that chip available, master and
slave. Slave is used only on dual tuner devices with master tuner.
Laser printing top of chip is 18212/M or 18212/S according to chip
version.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Olli Salonen [Mon, 25 Aug 2014 18:07:04 +0000 (15:07 -0300)]
[media] si2168: avoid firmware loading if it has been loaded previously
Add a variable to keep track if firmware is loaded or not and skip parts of the
initialization if fw is already loaded. Resume from sleep with a different
command compared to initial power up and run command 85 after resume command.
This behaviour is observed when using manufacturer provided binary-only si2168
driver for TechnoTrend CT2-4400.
Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Olli Salonen [Mon, 25 Aug 2014 18:07:02 +0000 (15:07 -0300)]
[media] si2157: change command for sleep
Instead of sending command 13 to the tuner, send command 16 when sleeping. This
behaviour is observed when using manufacturer provided binary-only Linux driver
for TechnoTrend CT2-4400 (Windows driver does not do power management).
The issue with command 13 is that firmware loading is necessary after that.
This is not an issue with tuners that do not require firmware, but starting
streaming after sleep on an Si2158 takes noticeable time as firmware is
loaded on resume.
Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Sample rate calculation gives a little bit too large results because
in real life there was around one milliseconds (~one usb packet) too
much data for given time. Calculate time more accurate in order to
provide better results.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>