platform/kernel/linux-rpi.git
9 years ago[media] mn88472: One function call less in mn88472_init() after error detection
Markus Elfring [Sun, 1 Feb 2015 18:34:37 +0000 (15:34 -0300)]
[media] mn88472: One function call less in mn88472_init() after error detection

The release_firmware() function was called in three cases by the mn88472_init()
function during error handling even if the passed variable "fw" contained still
a null pointer.

This implementation detail could be improved by the introduction of another
jump label.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] mn88472: Deletion of an unnecessary check before the function call "release_f...
Markus Elfring [Sun, 1 Feb 2015 18:12:56 +0000 (15:12 -0300)]
[media] mn88472: Deletion of an unnecessary check before the function call "release_firmware"

The release_firmware() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] si2157: extend frequency range for ATSC
Olli Salonen [Tue, 3 Mar 2015 16:28:35 +0000 (13:28 -0300)]
[media] si2157: extend frequency range for ATSC

The Si2157 tuner supports ATSC in addition to DVB-T and DVB-C. Extend
minimum frequency range to cover the complete ATSC/QAM-B range.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] v4l2-subdev: remove enum_framesizes/intervals
Hans Verkuil [Wed, 4 Mar 2015 09:48:01 +0000 (01:48 -0800)]
[media] v4l2-subdev: remove enum_framesizes/intervals

The video and pad ops are duplicates, so get rid of the more limited video op.

The whole point of the subdev API is to allow reuse of subdev drivers by
bridge drivers. Having duplicate ops makes that much harder. We should never
have allowed duplicate ops in the first place. A lesson for the future.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] v4l2-subdev: add support for the new enum_frame_interval 'which' field
Hans Verkuil [Wed, 4 Mar 2015 09:48:00 +0000 (01:48 -0800)]
[media] v4l2-subdev: add support for the new enum_frame_interval 'which' field

Support the new 'which' field in the enum_frame_interval ops. Most drivers do not
need to be changed since they always returns the same enumeration regardless
of the 'which' field.

Tested for ov7670 and marvell-ccic on a OLPC XO-1 laptop.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] DocBook media: document the new 'which' field
Hans Verkuil [Wed, 4 Mar 2015 09:47:59 +0000 (01:47 -0800)]
[media] DocBook media: document the new 'which' field

The subdev enum ioctls now have a new 'which' field. Document this.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] v4l2-subdev: add support for the new enum_frame_size 'which' field
Hans Verkuil [Wed, 4 Mar 2015 09:47:58 +0000 (01:47 -0800)]
[media] v4l2-subdev: add support for the new enum_frame_size 'which' field

Support the new 'which' field in the enum_frame_size ops. Most drivers do not
need to be changed since they always returns the same enumeration regardless
of the 'which' field.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Tested-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] v4l2-subdev: support new 'which' field in enum_mbus_code
Hans Verkuil [Wed, 4 Mar 2015 09:47:57 +0000 (01:47 -0800)]
[media] v4l2-subdev: support new 'which' field in enum_mbus_code

Support the new 'which' field in the enum_mbus_code ops. Most drivers do not
need to be changed since they always return the same enumeration regardless
of the 'which' field.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] v4l2-subdev.c: add 'which' checks for enum ops
Hans Verkuil [Wed, 4 Mar 2015 09:47:56 +0000 (01:47 -0800)]
[media] v4l2-subdev.c: add 'which' checks for enum ops

Return an error if an invalid 'which' valid is passed in.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Tested-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] v4l2-subdev.h: add 'which' field for the enum structs
Hans Verkuil [Wed, 4 Mar 2015 09:47:55 +0000 (01:47 -0800)]
[media] v4l2-subdev.h: add 'which' field for the enum structs

While all other pad ops allow you to select whether to use the 'try' or
the 'active' formats, the enum ops didn't have that option and always used
'try'.

However, this will fail if a simple (e.g. PCI) bridge driver wants to use
the enum pad op of a subdev that's also used in a complex platform driver
like the omap3. Such a bridge driver generally wants to enum formats based
on the active format.

So add a new 'which' field to these structs. Note that V4L2_SUBDEV_FORMAT_TRY
is 0, so the default remains TRY (applications need to set reserved to 0).

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Tested-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] v4l2-subdev: replace v4l2_subdev_fh by v4l2_subdev_pad_config
Hans Verkuil [Wed, 4 Mar 2015 09:47:54 +0000 (01:47 -0800)]
[media] v4l2-subdev: replace v4l2_subdev_fh by v4l2_subdev_pad_config

If a subdevice pad op is called from a bridge driver, then there is
no v4l2_subdev_fh struct that can be passed to the subdevice. This
made it hard to use such subdevs from a bridge driver.

This patch replaces the v4l2_subdev_fh pointer by a v4l2_subdev_pad_config
pointer in the pad ops. This allows bridge drivers to use the various
try_ pad ops by creating a v4l2_subdev_pad_config struct and passing it
along to the pad op.

The v4l2_subdev_get_try_* macros had to be changed because of this, so
I also took the opportunity to use the full name of the v4l2_subdev_get_try_*
functions in the __V4L2_SUBDEV_MK_GET_TRY macro arguments: if you now do
'git grep v4l2_subdev_get_try_format' you will actually find the header
where it is defined.

One remark regarding the drivers/staging/media/davinci_vpfe patches: the
*_init_formats() functions assumed that fh could be NULL. However, that's
not true for this driver, it's always set. This is almost certainly a copy
and paste from the omap3isp driver. I've updated the code to reflect the
fact that fh is never NULL.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Tested-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] mn88473: simplify bandwidth registers setting code
Benjamin Larsson [Mon, 12 Jan 2015 23:23:26 +0000 (20:23 -0300)]
[media] mn88473: simplify bandwidth registers setting code

Signed-off-by: Benjamin Larsson <benjamin@southpole.se>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] mn88473: calculate the IF register values
Benjamin Larsson [Mon, 12 Jan 2015 23:23:25 +0000 (20:23 -0300)]
[media] mn88473: calculate the IF register values

Add xtal as a configuration parameter so it can be used
in the IF register value calculation. If not set in the
configuration then use a default value.

Signed-off-by: Benjamin Larsson <benjamin@southpole.se>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: adv7604: improve usage of gpiod API
Uwe Kleine-König [Mon, 2 Mar 2015 07:00:44 +0000 (04:00 -0300)]
[media] media: adv7604: improve usage of gpiod API

Since 39b2bbe3d715 (gpio: add flags argument to gpiod_get*() functions)
which appeared in v3.17-rc1, the gpiod_get* functions take an additional
parameter that allows to specify direction and initial value for output.
Simplify accordingly.

Moreover use devm_gpiod_get_index_optional instead of
devm_gpiod_get_index with ignoring all errors.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] cx18: Fix bytes_per_line
Simon Farnsworth [Wed, 25 Feb 2015 16:47:34 +0000 (13:47 -0300)]
[media] cx18: Fix bytes_per_line

Current GStreamer userspace respects the bytes_per_line from the driver. Set
it to something reasonable for the format chosen.

Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: omap/omap_vout: fix type of input members to omap_vout_setup_vrfb_bufs()
Lad, Prabhakar [Tue, 24 Feb 2015 18:25:00 +0000 (15:25 -0300)]
[media] media: omap/omap_vout: fix type of input members to omap_vout_setup_vrfb_bufs()

the declaration for omap_vout_setup_vrfb_bufs() said it
needed 'u32 static_vrfb_allocation' but definition
took 'bool static_vrfb_allocation', this patch fixes the
declaration so that it matches with the definition and
pass a bool instead of int to the call, also included
omap_vout_vrfb.h in omap_vout_vrfb.c file so that sparse doesn't
complain of making omap_vout_setup_vrfb_bufs() as static function.

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>
9 years ago[media] DocBook media: fix typos in YUV420M description
Hans Verkuil [Tue, 3 Mar 2015 08:47:29 +0000 (05:47 -0300)]
[media] DocBook media: fix typos in YUV420M description

NV12M -> YUV420M
YVU420M -> YUV420M

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: i2c: ths7303: drop module param debug
Lad, Prabhakar [Mon, 2 Mar 2015 15:22:19 +0000 (12:22 -0300)]
[media] media: i2c: ths7303: drop module param debug

this patch drops module param 'debug' as it was never used.

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>
9 years ago[media] media: drop call to v4l2_device_unregister_subdev()
Lad, Prabhakar [Mon, 2 Mar 2015 14:54:07 +0000 (11:54 -0300)]
[media] media: drop call to v4l2_device_unregister_subdev()

These drivers are moved to support asynchronous probing,
v4l2_async_unregister_subdev() unregisters the subdev so
there isn't a need to explicitly call v4l2_device_unregister_subdev().

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>
9 years ago[media] Basic support for the Elgato EyeTV Hybrid INT 2008 USB Stick
Gilles Risch [Sun, 1 Mar 2015 20:11:05 +0000 (17:11 -0300)]
[media] Basic support for the Elgato EyeTV Hybrid INT 2008 USB Stick

This patch will add basic support for the Elgato EyeTV Hybrid INT
2008 USB Stick.

Signed-off-by: Gilles Risch <gilles.risch@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] v4l2: remove unused including <linux/version.h>
Wei Yongjun [Fri, 27 Feb 2015 11:42:23 +0000 (08:42 -0300)]
[media] v4l2: remove unused including <linux/version.h>

Remove including <linux/version.h> that don't need it.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: au0828 - embed vdev and vbi_dev structs in au0828_dev
Shuah Khan [Thu, 26 Feb 2015 22:33:13 +0000 (19:33 -0300)]
[media] media: au0828 - embed vdev and vbi_dev structs in au0828_dev

Embed video_device structs vdev and vbi_dev in au0828_dev.
With this change, dynamic allocation and error path logic
in au0828_analog_register() is removed as it doesn't need
to allocate and handle allocation errors. Unregister path
doesn't need to free the now static video_device structures,
hence, changed video_device.release in au0828_video_template
to point to video_device_release_empty.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: au0828: drop vbi_buffer_filled() and re-use buffer_filled()
Lad, Prabhakar [Tue, 24 Feb 2015 13:00:29 +0000 (10:00 -0300)]
[media] media: au0828: drop vbi_buffer_filled() and re-use buffer_filled()

The vbi_buffer_filled() and buffer_filled() did the same functionality
except for incrementing the buffer sequence, this patch drops the
vbi_buffer_filled() and re-uses buffer_filled() for vbi buffers
as well by adding the check for vb2-queue type while incrementing
the sequence numbers. Along side this patch aligns the input parameters
of buffer_filled() function appropriately.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Acked-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] drivers: media: i2c : s5c73m3: Replace dev_err with pr_err
Tapasweni Pathak [Tue, 24 Feb 2015 04:47:32 +0000 (01:47 -0300)]
[media] drivers: media: i2c : s5c73m3: Replace dev_err with pr_err

Replace dev_err statement with pr_err to fix null dereference.

Found by Coccinelle.

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] saa7164: free_irq before pci_disable_device
Olli Salonen [Sat, 21 Feb 2015 21:45:26 +0000 (18:45 -0300)]
[media] saa7164: free_irq before pci_disable_device

Free the IRQ before disabling the device. Otherwise errors like this when unloading the module:

[21135.458560] ------------[ cut here ]------------
[21135.458569] WARNING: CPU: 4 PID: 1696 at /home/apw/COD/linux/fs/proc/generic.c:521 remove_proc_entry+0x1a1/0x1b0()
[21135.458572] remove_proc_entry: removing non-empty directory 'irq/47', leaking at least 'saa7164[0]'

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] saa7146: replace current->state by set_current_state()
Fabian Frederick [Fri, 20 Feb 2015 18:12:54 +0000 (15:12 -0300)]
[media] saa7146: replace current->state by set_current_state()

Use helper functions to access current->state.
Direct assignments are prone to races and therefore buggy.

current->state = TASK_RUNNING can be replaced by __set_current_state()

Thanks to Peter Zijlstra for the exact definition of the problem.

Suggested-By: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] cx231xx: Hauppauge HVR-955Q ATSC/QAM tuner
Olli Salonen [Sat, 28 Feb 2015 15:25:24 +0000 (12:25 -0300)]
[media] cx231xx: Hauppauge HVR-955Q ATSC/QAM tuner

Hauppauge HVR-955Q is a ATSC/QAM USB tuner with LGDT3306A demodulator and SiLabs Si2157-A30 tuner.

Only digital TV has been tested (both ATSC and QAM256).

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] si2157: IF frequency for ATSC and QAM
Olli Salonen [Sat, 28 Feb 2015 15:25:23 +0000 (12:25 -0300)]
[media] si2157: IF frequency for ATSC and QAM

For supporting ATSC and QAM modes the driver should use a smaller IF frequency than 5 MHz.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] lgdt3306a: Minor source code cleanups
Mauro Carvalho Chehab [Tue, 28 Oct 2014 14:40:20 +0000 (12:40 -0200)]
[media] lgdt3306a: Minor source code cleanups

Fix a few minor CodingStyle issues at the source code:
- Use proper multi-line comments;
- Align the log tables;
- Remove the .type from dvb_frontend_ops, since this is not
  needed anymore (since the drivers conversion to DVBv5);
- Remove emacs format macro.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] lgdt3306a: Break long lines
Mauro Carvalho Chehab [Tue, 28 Oct 2014 14:35:18 +0000 (12:35 -0200)]
[media] lgdt3306a: Break long lines

Fix most of checkpatch warnings like:
WARNING: line over 80 characters

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] lgdt3306a: constify log tables
Mauro Carvalho Chehab [Tue, 28 Oct 2014 14:30:44 +0000 (12:30 -0200)]
[media] lgdt3306a: constify log tables

Ideally, we should be replacing this function by intlog10().

While we don't do that, let's at least constify the tables,
in order to remove its code footfrint, and get rid of nelems.

This also fixes a few 80-cols CodingStyle warnings.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] lbdt3306a: remove uneeded braces
Mauro Carvalho Chehab [Tue, 28 Oct 2014 14:07:52 +0000 (12:07 -0200)]
[media] lbdt3306a: remove uneeded braces

WARNING: braces {} are not necessary for any arm of this statement
+ if (ret == 0) {
[...]
+ } else {
[...]

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] lgdt3306a: Don't use else were not needed
Mauro Carvalho Chehab [Tue, 28 Oct 2014 14:05:35 +0000 (12:05 -0200)]
[media] lgdt3306a: Don't use else were not needed

Get rid of the remaining checkpatch.pl warnings:
WARNING: braces {} are not necessary for any arm of this statement

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] lbdt3306a: simplify the lock status check
Mauro Carvalho Chehab [Tue, 28 Oct 2014 14:00:48 +0000 (12:00 -0200)]
[media] lbdt3306a: simplify the lock status check

The logic there is too complex and it looks like an inifite
loop.

So, simplify the logic and implement it as a for loop.

This gets rid of the following checkpatch.pl warnings:

WARNING: else is not generally useful after a break or return
+ return LG3306_UNLOCK;
+ } else {

WARNING: else is not generally useful after a break or return
+ return LG3306_UNLOCK;
+ } else {

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] lbdt3306a: rework at printk macros
Mauro Carvalho Chehab [Tue, 28 Oct 2014 13:35:16 +0000 (11:35 -0200)]
[media] lbdt3306a: rework at printk macros

Use pr_foo() where there's a direct replacement. For debug, use
custom-made macros, for now, as there are 3 different debug levels.

We should get rid of those some day, specially since several such
macros can be just removed, as Kernel trace would provide about
the same output.

This gets rid of some checkpatch errors:

WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(...  to printk(KERN_INFO ...
+#define lg_info(fmt, arg...) printk(KERN_INFO "lgdt3306a: " fmt, ##arg)

ERROR: Macros with complex values should be enclosed in parentheses
+#define lg_dbg(fmt, arg...) if (debug & DBG_INFO) \
+ lg_printk(KERN_DEBUG,         fmt, ##arg)

ERROR: Macros with complex values should be enclosed in parentheses
+#define lg_reg(fmt, arg...) if (debug & DBG_REG) \
+ lg_printk(KERN_DEBUG,         fmt, ##arg)

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] lgdt3306a: Remove FSF address
Mauro Carvalho Chehab [Tue, 28 Oct 2014 13:27:34 +0000 (11:27 -0200)]
[media] lgdt3306a: Remove FSF address

Fix this CodingStyle error:

ERROR: Do not include the paragraph about writing to the Free Software Foundation's mailing address from the sample GPL notice. The FSF has changed addresses in the past, and may do so ag$
#56: FILE: drivers/media/dvb-frontends/lgdt3306a.c:19:
+ *    along with this program; if not, write to the Free Software$

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] lgdt3306a: properly handle I/O errors
Mauro Carvalho Chehab [Tue, 28 Oct 2014 13:21:48 +0000 (11:21 -0200)]
[media] lgdt3306a: properly handle I/O errors

Fixes the following smatch errors:

drivers/media/dvb-frontends/lgdt3306a.c: In function 'lgdt3306a_set_if':
drivers/media/dvb-frontends/lgdt3306a.c:695:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
  int ret;
      ^
drivers/media/dvb-frontends/lgdt3306a.c: In function 'lgdt3306a_monitor_vsb':
drivers/media/dvb-frontends/lgdt3306a.c:1033:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
  int ret;
      ^
drivers/media/dvb-frontends/lgdt3306a.c: In function 'lgdt3306a_check_oper_mode':
drivers/media/dvb-frontends/lgdt3306a.c:1082:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
  int ret;
      ^
drivers/media/dvb-frontends/lgdt3306a.c: In function 'lgdt3306a_check_lock_status':
drivers/media/dvb-frontends/lgdt3306a.c:1109:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
  int ret;
      ^
drivers/media/dvb-frontends/lgdt3306a.c: In function 'lgdt3306a_check_neverlock_status':
drivers/media/dvb-frontends/lgdt3306a.c:1185:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
  int ret;
      ^
drivers/media/dvb-frontends/lgdt3306a.c: In function 'lgdt3306a_pre_monitoring':
drivers/media/dvb-frontends/lgdt3306a.c:1199:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
  int ret;
      ^
drivers/media/dvb-frontends/lgdt3306a.c: In function 'lgdt3306a_get_packet_error':
drivers/media/dvb-frontends/lgdt3306a.c:1310:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
  int ret;
      ^

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] lgdt3306a: don't go past the buffer
Mauro Carvalho Chehab [Tue, 28 Oct 2014 13:07:03 +0000 (11:07 -0200)]
[media] lgdt3306a: don't go past the buffer

As warned by smatch:
drivers/media/dvb-frontends/lgdt3306a.c:1354 log10_x1000() error: buffer overflow 'valx_x10' 14 <= 14
drivers/media/dvb-frontends/lgdt3306a.c:1355 log10_x1000() error: buffer overflow 'log10x_x1000' 14 <= 14

There's a potential of returning a value out of the buffer. Fix it.

While here, remove the ugly braced block.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] lgdt3306a: one bit fields should be unsigned
Mauro Carvalho Chehab [Tue, 28 Oct 2014 13:02:13 +0000 (11:02 -0200)]
[media] lgdt3306a: one bit fields should be unsigned

Fix two smatch warnings:
drivers/media/dvb-frontends/lgdt3306a.h:53:28: error: dubious one-bit signed bitfield
drivers/media/dvb-frontends/lgdt3306a.h:56:33: error: dubious one-bit signed bitfield

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] lgdt3306a: Use IS_ENABLED() for attach function
Mauro Carvalho Chehab [Tue, 28 Oct 2014 12:56:10 +0000 (10:56 -0200)]
[media] lgdt3306a: Use IS_ENABLED() for attach function

Simplify the check if CONFIG_DVB_LGDT3306A is enabled, use the
IS_ENABLED() macro, just like the other frontend modules.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] lgdt3306a: Use hexadecimal values in lowercase
Mauro Carvalho Chehab [Tue, 28 Oct 2014 12:50:36 +0000 (10:50 -0200)]
[media] lgdt3306a: Use hexadecimal values in lowercase

While this is not a mandatory rule at the CodingStyle, we prefer
hexadecimal values in lowercase. Currently, there's a mix of lowercase
and uppercase ons at lgdt3306a. So, convert all to lowercase with this
small script:

perl -ne 'if (m,0x([\dA-F]+),) { $o=$1; $n=lc $1; s,0x($o),0x$n, } print $_'

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] lgdt3306a: more small whitespace cleanups
Michael Ira Krufky [Sat, 25 Oct 2014 14:26:15 +0000 (11:26 -0300)]
[media] lgdt3306a: more small whitespace cleanups

Just CodingStyle. No functional changes.

Signed-off-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] lgdt3306a: typo fix
Michael Ira Krufky [Sat, 25 Oct 2014 14:20:57 +0000 (11:20 -0300)]
[media] lgdt3306a: typo fix

fix WARNING: 'supress' may be misspelled - perhaps 'suppress'?

Signed-off-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] lgdt3306a: fix WARNING: please, no spaces at the start of a line
Michael Ira Krufky [Sat, 25 Oct 2014 14:12:25 +0000 (11:12 -0300)]
[media] lgdt3306a: fix WARNING: please, no spaces at the start of a line

Properly indent register initialization tables.

Signed-off-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] lgdt3306a: fix ERROR: do not use C99 // comments
Michael Ira Krufky [Sat, 25 Oct 2014 14:05:05 +0000 (11:05 -0300)]
[media] lgdt3306a: fix ERROR: do not use C99 // comments

Replace C99 comments by /* */ blocks.

Signed-off-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] lgdt3306a: do not add new typedefs
Michael Ira Krufky [Sun, 3 Aug 2014 18:29:04 +0000 (15:29 -0300)]
[media] lgdt3306a: do not add new typedefs

We should not be using typedefs at the Kernel, as this makes harder
for reviewers to understand the code.

Signed-off-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] lgdt3306a: fix ERROR: do not use assignment in if condition
Michael Ira Krufky [Sun, 3 Aug 2014 18:18:23 +0000 (15:18 -0300)]
[media] lgdt3306a: fix ERROR: do not use assignment in if condition

Just CodingStyle fix.

Signed-off-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] lgdt3306a: move EXPORT_SYMBOL to be just after function
Michael Ira Krufky [Sun, 3 Aug 2014 18:05:59 +0000 (15:05 -0300)]
[media] lgdt3306a: move EXPORT_SYMBOL to be just after function

Fixes CodingStyle error:
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable.

Signed-off-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] lgdt3306a: remove unnecessary 'else'
Michael Ira Krufky [Sun, 3 Aug 2014 17:51:49 +0000 (14:51 -0300)]
[media] lgdt3306a: remove unnecessary 'else'

No need for an else, as the previous if will return.

Signed-off-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] lgdt3306a: clean up whitespace & unneeded brackets
Michael Ira Krufky [Sun, 27 Jul 2014 22:24:24 +0000 (19:24 -0300)]
[media] lgdt3306a: clean up whitespace & unneeded brackets

No functional changes.

Signed-off-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] DVB: add support for LG Electronics LGDT3306A ATSC/QAM-B Demodulator
Fred Richter [Mon, 24 Mar 2014 22:56:00 +0000 (19:56 -0300)]
[media] DVB: add support for LG Electronics LGDT3306A ATSC/QAM-B Demodulator

This ATSC/QAM-B demodulator is used by several new devices.

Add support for it. Other patches will fix CodingStyle issues.

Signed-off-by: Fred Richter <frichter@hauppauge.com>
Signed-off-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] DocBook media: fix xvYCC601 documentation
Hans Verkuil [Thu, 19 Feb 2015 13:49:40 +0000 (10:49 -0300)]
[media] DocBook media: fix xvYCC601 documentation

The documentation of the xvYCC601 Y'CbCr encoding was part of the SMPTE 170M
(SDTV) colorspace, but it should have been part of the Rec. 709 (HDTV) colorspace
as per the xvYCC standard.

This change only affects the documentation and not any code.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] v4l2-core: drop g/s_priority ops
Hans Verkuil [Tue, 3 Feb 2015 13:46:56 +0000 (10:46 -0300)]
[media] v4l2-core: drop g/s_priority ops

The handling of VIDIOC_G/S_PRIORITY is now entirely done by the V4L2
core, so we can drop the g/s_priority ioctl ops.

We do have to make sure though that when S_PRIORITY is called we check
that the driver used struct v4l2_fh. This check can be removed once all
drivers are converted to that structure.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] pvrusb2: use struct v4l2_fh
Hans Verkuil [Tue, 3 Feb 2015 13:46:55 +0000 (10:46 -0300)]
[media] pvrusb2: use struct v4l2_fh

By using struct v4l2_fh both the prio handling and the linked list
implementation in pvrusb2 can be removed since both are now done in
the v4l2 core if you use struct v4l2_fh.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] v4l2-core: remove the old .ioctl BKL replacement
Hans Verkuil [Tue, 17 Feb 2015 08:44:09 +0000 (05:44 -0300)]
[media] v4l2-core: remove the old .ioctl BKL replacement

To keep V4L2 drivers that did not yet convert to unlocked_ioctl happy,
the v4l2 core had a .ioctl file operation that took a V4L2 lock.

The last drivers are now converted to unlocked_ioctl, so all this
old code can now be removed.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] uvc gadget: set device_caps in querycap
Hans Verkuil [Tue, 17 Feb 2015 08:44:08 +0000 (05:44 -0300)]
[media] uvc gadget: set device_caps in querycap

The V4L2 core will warn if this is not done. Unfortunately this driver
wasn't updated.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] uvc gadget: switch to unlocked_ioctl
Hans Verkuil [Tue, 17 Feb 2015 08:44:07 +0000 (05:44 -0300)]
[media] uvc gadget: switch to unlocked_ioctl

Instead of .ioctl use unlocked_ioctl. This allows us to finally remove
the old .ioctl op.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] uvc gadget: switch to v4l2 core locking
Hans Verkuil [Tue, 17 Feb 2015 08:44:06 +0000 (05:44 -0300)]
[media] uvc gadget: switch to v4l2 core locking

Switch this driver over to the V4L2 core locking mechanism in preparation
for switching to unlocked_ioctl. Suggested by Laurent Pinchart.

This patch introduces a new mutex at the struct uvc_video level and
drops the old mutex at the queue level. The new lock is now used for all
ioctl locking and in the release file operation (the driver always has
to take care of locking in file operations, the core only serializes
ioctls).

Note that the mmap and get_unmapped_area file operations no longer take
a lock. Commit f035eb4e976ef5a059e30bc91cfd310ff030a7d3 fixed a AB-BA
deadlock by moving all the locking down into vb2, so the mmap and
get_unmapped_area file operations should no longer do any locking before
calling into vb2.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] radio-bcm2048: use unlocked_ioctl instead of ioctl
Hans Verkuil [Tue, 17 Feb 2015 08:44:05 +0000 (05:44 -0300)]
[media] radio-bcm2048: use unlocked_ioctl instead of ioctl

This driver does its own locking, so there is no need to use
ioctl instead of unlocked_ioctl.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] pvrusb2: replace .ioctl by .unlocked_ioctl
Hans Verkuil [Tue, 17 Feb 2015 08:44:04 +0000 (05:44 -0300)]
[media] pvrusb2: replace .ioctl by .unlocked_ioctl

As far as I can tell pvrusb2 does its own locking, so there is
no need to use .ioctl.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: i2c: ADV7604: Rename adv7604 prefixes
Pablo Anton [Tue, 3 Feb 2015 17:13:18 +0000 (14:13 -0300)]
[media] media: i2c: ADV7604: Rename adv7604 prefixes

It is confusing which parts of the driver are adv7604 specific, adv7611
specific or common for both. This patch renames any adv7604 prefixes (both
for functions and defines) to adv76xx whenever they are common.

Signed-off-by: Pablo Anton <pablo.anton@vodalys-labs.com>
Signed-off-by: Jean-Michel Hautbois <jean-michel.hautbois@vodalys.com>
[hans.verkuil@cisco.com: rebased and renamed ADV76xx_fsc to ADV76XX_FSC]
[hans.verkuil@cisco.com: kept the existing adv7604 driver name]
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: radio: handle timeouts
Nicholas Mc Guire [Thu, 5 Feb 2015 08:56:42 +0000 (05:56 -0300)]
[media] media: radio: handle timeouts

Add handling for timeout case.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: radio: assign wait_for_completion_timeout to appropriately typed var
Nicholas Mc Guire [Thu, 5 Feb 2015 07:58:48 +0000 (04:58 -0300)]
[media] media: radio: assign wait_for_completion_timeout to appropriately typed var

wait_for_completion_timeout() returns unsigned long not int. This assigns
the return value to an appropriately typed variable (also helps keep
static code checkers happy).

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: adv7604: CP CSC uses a different register on adv7604 and adv7611
jean-michel.hautbois@vodalys.com [Wed, 4 Feb 2015 14:16:00 +0000 (11:16 -0300)]
[media] media: adv7604: CP CSC uses a different register on adv7604 and adv7611

The bits are the same, but register is 0xf4 on ADV7611 instead of 0xfc.
When reading back the value in log_status, differentiate both.

Signed-off-by: Jean-Michel Hautbois <jean-michel.hautbois@vodalys.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] si470x: fixup wait_for_completion_timeout return handling
Nicholas Mc Guire [Wed, 11 Feb 2015 14:20:54 +0000 (11:20 -0300)]
[media] si470x: fixup wait_for_completion_timeout return handling

return type of wait_for_completion_timeout is unsigned long not int. A
appropriately named variable of type unsigned long is added and the
assignments fixed up.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: bcm2048: remove unused return of function
Luis de Bethencourt [Sun, 8 Feb 2015 22:29:11 +0000 (19:29 -0300)]
[media] media: bcm2048: remove unused return of function

Integer return of bcm2048_parse_rds_rt () is never used, changing the return
type to void.

Signed-off-by: Luis de Bethencourt <luis.bg@samsung.com>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: i2c: ADV7604: In free run mode, signal is locked
jean-michel.hautbois@vodalys.com [Fri, 6 Feb 2015 14:37:58 +0000 (11:37 -0300)]
[media] media: i2c: ADV7604: In free run mode, signal is locked

The CP_NON_STD_VIDEO bit indicates an input not aligned with DV timings.
If there is no input, and chip is in free run mode, consider we are locked.

Signed-off-by: Jean-Michel Hautbois <jean-michel.hautbois@vodalys.com>
[hans.verkuil@cisco.com: put both conditions in one 'if']
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] au0828: Delete unnecessary checks before the function call "video_unregister_...
Markus Elfring [Tue, 3 Feb 2015 18:00:25 +0000 (15:00 -0300)]
[media] au0828: Delete unnecessary checks before the function call "video_unregister_device"

The video_unregister_device() function tests whether its argument is NULL
and then returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] stk-webcam: Delete an unnecessary check before the function call "vfree"
Markus Elfring [Tue, 3 Feb 2015 17:36:35 +0000 (14:36 -0300)]
[media] stk-webcam: Delete an unnecessary check before the function call "vfree"

The vfree() function performs also input parameter validation.
Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vivid sdr: fix broken sine tone generated for sdr FM
Prashant Laddha [Wed, 4 Feb 2015 09:07:32 +0000 (06:07 -0300)]
[media] vivid sdr: fix broken sine tone generated for sdr FM

FM (frequency modulated) signal for SDR is generated by varying the
phase, where phase variation is proportional to input signal. It is
seen that, the larger phase increments leads to discontinuities in
the signal recovered after demodulation. Reducing the extent of phase
variation with respect to input signal, equivalent to reducing the
modulation index.

Tested using FM receiver flow graph in gnuradio-companion.

Cc: Antti Palosaari <crope@iki.fi>
Signed-off-by: Prashant Laddha <prladdha@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vivid sdr: Use LUT based implementation for sin/cos()
Prashant Laddha [Wed, 4 Feb 2015 09:07:31 +0000 (06:07 -0300)]
[media] vivid sdr: Use LUT based implementation for sin/cos()

The common implementation for sin/cos in include/linux/fixp-arith.h
has been improved recently to provide higher precision.

Replacing native implementation of sin/cos in vivid sdr with common
implementation. This serves two purposes:

1. Improved accuracy: the native implementation based on the Taylor
   series is more prone to rounding errors.
2. Reuse of common function: this is better compared to maintaining
   native versions for each driver.

Suggested by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Cc: Antti Palosaari <crope@iki.fi>
Signed-off-by: Prashant Laddha <prladdha@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] fixp-arith: replace sin/cos table by a better precision one
Mauro Carvalho Chehab [Wed, 4 Feb 2015 09:07:30 +0000 (06:07 -0300)]
[media] fixp-arith: replace sin/cos table by a better precision one

The cos table used at fixp-arith.h has only 8 bits of precision.
That causes problems if it is reused on other drivers.

As some media drivers require a higher precision sin/cos
implementation, replace the current implementation by one that
will provide 32 bits precision.

The values generated by the new implementation matches the
32 bit precision of glibc's sin for an angle measured in
integer degrees.

It also provides support for fractional angles via linear
interpolation. On experimental calculus, when used a table
with a 0.001 degree angle, the maximum error for sin is
0.000038, which is likely good enough for practical purposes.

There are some logic there that seems to be specific to the
usage inside ff-memless.c. Move those logic to there, as they're
not needed elsewhere.

Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Prashant Laddha <prladdha@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] cx88: Fix possible leak in cx8802_probe()
Christian Engelmayer [Sat, 14 Feb 2015 23:12:56 +0000 (20:12 -0300)]
[media] cx88: Fix possible leak in cx8802_probe()

In case allocation vb2_dma_sg_init_ctx() fails during cx8802_probe(), the
already allocated cx8802 device structure memory is not freed in the used
exit path. Thus adapt the cleanup handling accordingly. Detected by Coverity
CID 1260065.

Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] sh_vou: fix memory leak on error paths in sh_vou_open()
Alexey Khoroshilov [Fri, 13 Feb 2015 22:39:03 +0000 (19:39 -0300)]
[media] sh_vou: fix memory leak on error paths in sh_vou_open()

Memory allocated for sh_vou_file is not deallocated
on error paths in sh_vou_open().

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] DocBook media: fix validation error
Hans Verkuil [Fri, 13 Feb 2015 10:32:16 +0000 (07:32 -0300)]
[media] DocBook media: fix validation error

<tgroup> doesn't understand the 'border' attribute.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] staging: dt3155v4l: Switch to using managed resource with devm_
Kiran Padwal [Fri, 13 Feb 2015 08:52:10 +0000 (05:52 -0300)]
[media] staging: dt3155v4l: Switch to using managed resource with devm_

This patch uses managed resource APIs to allocate memory
in order to simplify the driver unload or failure cases

Signed-off-by: Kiran Padwal <kiran.padwal@smartplayin.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] timberdale: VIDEO_TIMBERDALE should depend on HAS_DMA
Geert Uytterhoeven [Thu, 12 Feb 2015 14:11:40 +0000 (11:11 -0300)]
[media] timberdale: VIDEO_TIMBERDALE should depend on HAS_DMA

If NO_DMA=y:

    warning: (VIDEO_OMAP2_VOUT && VIDEO_VIU && VIDEO_TIMBERDALE) selects VIDEOBUF_DMA_CONTIG which has unmet direct dependencies (MEDIA_SUPPORT && HAS_DMA)

    drivers/built-in.o: In function `__videobuf_dc_free':
    videobuf-dma-contig.c:(.text+0x6f4d32): undefined reference to `dma_free_coherent'
    drivers/built-in.o: In function `__videobuf_dc_alloc':
    videobuf-dma-contig.c:(.text+0x6f4fe6): undefined reference to `dma_alloc_coherent'
    drivers/built-in.o: In function `__videobuf_mmap_mapper':
    videobuf-dma-contig.c:(.text+0x6f518e): undefined reference to `dma_free_coherent'

Commit 244829226f47ffb4 ("[media] timberdale: do not select TIMB_DMA")
dropped the dependency of VIDEO_TIMBERDALE on DMADEVICES, and thus the
implicit dependency on HAS_DMA.  VIDEO_TIMBERDALE selects
VIDEOBUF_DMA_CONTIG, which bypasses its dependency on HAS_DMA.  Make
VIDEO_TIMBERDALE depend on HAS_DMA to fix this.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] am437x: VIDEO_AM437X_VPFE should depend on HAS_DMA
Geert Uytterhoeven [Thu, 12 Feb 2015 14:11:39 +0000 (11:11 -0300)]
[media] am437x: VIDEO_AM437X_VPFE should depend on HAS_DMA

If NO_DMA=y:

    warning: (VIDEO_AM437X_VPFE && VIDEO_DM365_VPFE && VIDEO_DT3155 && VIDEO_OMAP4) selects VIDEOBUF2_DMA_CONTIG which has unmet direct dependencies (MEDIA_SUPPORT && HAS_DMA)

    drivers/media/v4l2-core/videobuf2-dma-contig.c: In function ‘vb2_dc_mmap’:
    drivers/media/v4l2-core/videobuf2-dma-contig.c:207: error: implicit declaration of function ‘dma_mmap_coherent’
    drivers/media/v4l2-core/videobuf2-dma-contig.c: In function ‘vb2_dc_get_base_sgt’:
    drivers/media/v4l2-core/videobuf2-dma-contig.c:390: error: implicit declaration of function ‘dma_get_sgtable’

VIDEO_AM437X_VPFE selects VIDEOBUF2_DMA_CONTIG, which bypasses its
dependency on HAS_DMA.  Make VIDEO_AM437X_VPFE depend on HAS_DMA to fix
this.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-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>
9 years ago[media] cx231xx: drop condition with no effect
Nicholas Mc Guire [Wed, 4 Feb 2015 13:03:11 +0000 (10:03 -0300)]
[media] cx231xx: drop condition with no effect

The if and the else code are identical - so the condition has no effect
on the effective code.
This patch removes the condition and the duplicated code.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] siano: avoid a linkedit error if !MC
Mauro Carvalho Chehab [Mon, 2 Mar 2015 17:17:01 +0000 (14:17 -0300)]
[media] siano: avoid a linkedit error if !MC

If the media controller (MC) is not enabled, it will compile
fine, but will fail at the linkedition:

 ERROR: "media_device_unregister" [drivers/media/usb/siano/smsusb.ko] undefined!

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] use a function for DVB media controller register
Mauro Carvalho Chehab [Mon, 2 Mar 2015 14:26:14 +0000 (11:26 -0300)]
[media] use a function for DVB media controller register

This is really a simple function, but using it avoids to have
if's inside the drivers.

Also, the kABI becomes a little more clearer.

This shouldn't generate any overhead, and the type check
will happen when compiling with MC DVB enabled.

So, let's do it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] dvb: Avoid warnings when compiled without the media controller
Mauro Carvalho Chehab [Mon, 2 Mar 2015 13:53:46 +0000 (10:53 -0300)]
[media] dvb: Avoid warnings when compiled without the media controller

drivers/media/usb/dvb-usb-v2/dvb_usb_core.c: In function ‘dvb_usbv2_adapter_dvb_exit’:
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c:531:25: warning: unused variable ‘d’ [-Wunused-variable]
  struct dvb_usb_device *d = adap_to_d(adap);
                         ^
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c:403:13: warning: ‘dvb_usbv2_media_device_register’ defined but not used [-Wunused-function]
 static void dvb_usbv2_media_device_register(struct dvb_usb_adapter *adap)

drivers/media/usb/dvb-usb/dvb-usb-dvb.c:97:13: warning: ‘dvb_usb_media_device_register’ defined but not used [-Wunused-function]
 static void dvb_usb_media_device_register(struct dvb_usb_adapter *adap)
             ^

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] dvbdev: use adapter arg for dvb_create_media_graph()
Mauro Carvalho Chehab [Mon, 2 Mar 2015 13:49:04 +0000 (10:49 -0300)]
[media] dvbdev: use adapter arg for dvb_create_media_graph()

Instead of using media_dev argument for dvb_create_media_graph(),
use the adapter.

That allows to create a stub for this function, if compiled
without DVB support, avoiding to add extra if's at the drivers.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] dvb-usb: create one media_dev per adapter
Mauro Carvalho Chehab [Fri, 13 Feb 2015 13:08:17 +0000 (10:08 -0300)]
[media] dvb-usb: create one media_dev per adapter

Instead of assuming just one adapter, change the code to store
one media controller per adapter.

This works fine for dvb-usb, as, on all drivers here, it is not
possible to write a media graph that would mix resources between
the two different adapters.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] dvb-usb: add support for the media controller at USB driver
Rafael Lourenço de Lima Chehab [Fri, 13 Feb 2015 21:29:14 +0000 (18:29 -0300)]
[media] dvb-usb: add support for the media controller at USB driver

Create a struct media_device and add it to the dvb adapter.

Please notice that the tuner is not mapped yet by the dvb core.

[mchehab@osg.samsung.com: use config option MEDIA_CONTROLLER_DVB]
Signed-off-by: Rafael Lourenço de Lima Chehab <chehabrafael@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] dvb-usb-v2: create one media_dev per adapter
Mauro Carvalho Chehab [Wed, 25 Feb 2015 17:07:42 +0000 (14:07 -0300)]
[media] dvb-usb-v2: create one media_dev per adapter

Instead of assuming just one adapter, change the code to store
one media controller per adapter.

This works fine for dvb-usb, as, on all drivers here, it is not
possible to write a media graph that would mix resources between
the two different adapters.

Acked-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] dvb-usb-v2: add support for the media controller at USB driver
Rafael Lourenço de Lima Chehab [Thu, 12 Feb 2015 11:37:25 +0000 (08:37 -0300)]
[media] dvb-usb-v2: add support for the media controller at USB driver

Create a struct media_device and add it to the dvb adapter.

Please notice that the tuner is not mapped yet by the dvb core.

[mchehab@osg.samsung.com: use config option MEDIA_CONTROLLER_DVB due to a rebase]
Signed-off-by: Rafael Lourenço de Lima Chehab <chehabrafael@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] siano: register media controller earlier
Mauro Carvalho Chehab [Sun, 22 Feb 2015 15:29:23 +0000 (12:29 -0300)]
[media] siano: register media controller earlier

We need to initialize the media controller earlier, as the core
will call the smsdvb hotplug during register time. Ok, this is
an async operation, so, when the module is not loaded, the media
controller works.

However, if the module is already loaded, nothing will be
registered at the media controller, as it will load too late.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] siano: print a message if DVB register succeeds
Mauro Carvalho Chehab [Sun, 22 Feb 2015 15:00:45 +0000 (12:00 -0300)]
[media] siano: print a message if DVB register succeeds

Right now, this is a debug message, misplaced. Promote it
to an info message, as it helps to discover if something
bad happened during device init.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] siano: get rid of sms_dbg parameter
Mauro Carvalho Chehab [Sun, 22 Feb 2015 14:51:41 +0000 (11:51 -0300)]
[media] siano: get rid of sms_dbg parameter

All siano modules have a sms_dbg parameter. Now that we're using
the standard pr_debug() macro, we can get rid of it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] siano: get rid of sms_info()
Mauro Carvalho Chehab [Sun, 22 Feb 2015 14:49:28 +0000 (11:49 -0300)]
[media] siano: get rid of sms_info()

On most cases, sms_info() should actually be pr_debug(), but,
on other places, it should be pr_info().

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] siano: replace sms_debug() by pr_debug()
Mauro Carvalho Chehab [Sun, 22 Feb 2015 14:33:37 +0000 (11:33 -0300)]
[media] siano: replace sms_debug() by pr_debug()

There's no reason to use a macro here. Just replace everything,
and let those debug messages to be activated via dynamic printk.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] siano: replace sms_log() by pr_debug()
Mauro Carvalho Chehab [Sun, 22 Feb 2015 14:33:09 +0000 (11:33 -0300)]
[media] siano: replace sms_log() by pr_debug()

Despite its name, those functions are acutally debug
prints for the IR part of the driver. So, properly
map them using pr_debug()

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] siano: replace sms_err by pr_err
Mauro Carvalho Chehab [Sun, 22 Feb 2015 14:04:35 +0000 (11:04 -0300)]
[media] siano: replace sms_err by pr_err

Originally, sms_err() would be also displaying the line where
the error occurs, but the messages are clear enough. Also,
the function is always printed. So, no need for it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] siano: replace sms_warn() by pr_warn()
Mauro Carvalho Chehab [Sun, 22 Feb 2015 13:55:55 +0000 (10:55 -0300)]
[media] siano: replace sms_warn() by pr_warn()

There's no reason for a sms' own sms_warn macro. Just replace
it by the standard pr_warn().

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] siano: use pr_* print functions
Mauro Carvalho Chehab [Sun, 22 Feb 2015 13:46:56 +0000 (10:46 -0300)]
[media] siano: use pr_* print functions

Instead of defining its own set of printk functions, let's
use the common Kernel debug logic provided by pr_foo functions.

As a first step, let's just define the existing macros as the
Kernel ones.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] siano: add support for the media controller at USB driver
Mauro Carvalho Chehab [Wed, 7 Jan 2015 11:03:03 +0000 (08:03 -0300)]
[media] siano: add support for the media controller at USB driver

Adding support for the media controller for a pure DVB device
is simple: just create a struct media_device and add it to the
dvb adapter. After creating all DVB devices, we need to call
the DVB core, for it to create the media graph.

More work is needed for pure DVB tuners, but this is hidden
at the Siano driver, just like several others non-hybrid
devices. So, this is streight forward.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] cx25840: better document the media pads
Mauro Carvalho Chehab [Thu, 19 Feb 2015 21:44:51 +0000 (18:44 -0300)]
[media] cx25840: better document the media pads

Use an enum to better document the media pads.

No functional changes.

Suggested-by: Prabhakar Lad <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] cx25840: fix return logic when media entity init fails
Mauro Carvalho Chehab [Thu, 19 Feb 2015 19:47:07 +0000 (16:47 -0300)]
[media] cx25840: fix return logic when media entity init fails

There's no need to free state, as it was allocated via devm_kzalloc().

Also, let's return the error code, instead of something else.

Reported-by: Prabhakar Lad <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] cx231xx: enable the analog tuner at buffer setup
Mauro Carvalho Chehab [Wed, 18 Feb 2015 15:22:27 +0000 (12:22 -0300)]
[media] cx231xx: enable the analog tuner at buffer setup

buf_prepare callback is called for every queued buffer. This is
an overkill. Call it at buf_setup, as this should be enough.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>