platform/kernel/linux-starfive.git
6 years agomedia: dvbsky: use just one mutex for serializing device R/W ops
Mauro Carvalho Chehab [Fri, 27 Apr 2018 16:33:11 +0000 (12:33 -0400)]
media: dvbsky: use just one mutex for serializing device R/W ops

Right now, there are two mutexes serializing r/w ops: one "generic"
and another one specifically for stream on/off.

Clean it a little bit, getting rid of one of the mutexes.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agoqm1d1b0004: fix a warning about an unused default_cfg var
Mauro Carvalho Chehab [Thu, 10 May 2018 10:55:15 +0000 (06:55 -0400)]
qm1d1b0004: fix a warning about an unused default_cfg var

As warned by gcc:

drivers/media/tuners/qm1d1b0004.c:62:39: warning: 'default_cfg' defined but not used [-Wunused-const-variable=]
 static const struct qm1d1b0004_config default_cfg = {
                                       ^~~~~~~~~~~

This var is currently unused. So, comment it out.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: omap3isp: Don't use GFP_DMA
Sakari Ailus [Mon, 7 May 2018 12:41:58 +0000 (08:41 -0400)]
media: omap3isp: Don't use GFP_DMA

The isp stat driver allocates memory for DMA and uses GFP_DMA flag for
dev_alloc_coherent. The flag is no longer needed as the DMA mask is used
for the purpose. Remove it.

Reported-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: omap3isp: Remove useless NULL check in omap3isp_stat_config
Sakari Ailus [Mon, 7 May 2018 12:37:48 +0000 (08:37 -0400)]
media: omap3isp: Remove useless NULL check in omap3isp_stat_config

The omap3isp driver checked whether the second argument (the new
configuration) to the ISP statistics is NULL. This is the pointer to the
user-given argument and is never NULL. Remove the check.

Reported-by: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: omap3isp: support 64-bit version of omap3isp_stat_data
Arnd Bergmann [Wed, 25 Apr 2018 21:30:10 +0000 (17:30 -0400)]
media: omap3isp: support 64-bit version of omap3isp_stat_data

C libraries with 64-bit time_t use an incompatible format for
struct omap3isp_stat_data. This changes the kernel code to
support either version, by moving over the normal handling
to the 64-bit variant, and adding compatiblity code to handle
the old binary format with the existing ioctl command code.

Fortunately, the command code includes the size of the structure,
so the difference gets handled automatically. In the process of
eliminating the references to 'struct timeval' from the kernel,
I also change the way the timestamp is generated internally,
basically by open-coding the v4l2_get_timestamp() call.

[Sakari Ailus: Alphabetical order of headers, clean up compat code]

Cc: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: media-device: fix ioctl function types
Sami Tolvanen [Mon, 7 May 2018 18:09:46 +0000 (14:09 -0400)]
media: media-device: fix ioctl function types

This change fixes function types for media device ioctls to avoid
indirect call mismatches with Control-Flow Integrity checking.

Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: imx-csi: fix burst size for 16 bit
Jan Luebbe [Thu, 3 May 2018 16:32:00 +0000 (12:32 -0400)]
media: imx-csi: fix burst size for 16 bit

A burst_size of 4 does not work for the 16 bit passthrough formats, so
we use 8 instead.

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: imx: add 16-bit grayscale support
Philipp Zabel [Thu, 3 May 2018 15:06:06 +0000 (11:06 -0400)]
media: imx: add 16-bit grayscale support

Since commit 50b0f0aee839 ("gpu: ipu-csi: add 10/12-bit grayscale
support to mbus_code_to_bus_cfg") the IPU CSI can be configured to
capture 10-bit and 12-bit grayscale formats, expanded to 16-bit
grayscale, in bayer/generic data mode.
This patch adds support for V4L2_PIX_FMT_Y16 captured from sensors
that provide MEDIA_BUS_FMT_Y10_1X10 or MEDIA_BUS_FMT_Y12_1X12 data.

Cc: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: Revert cleanup ktime_set() usage
Jasmin Jessich [Sat, 28 Apr 2018 07:45:51 +0000 (03:45 -0400)]
media: Revert cleanup ktime_set() usage

This reverts 8b0e195314fa, because media-tree drivers should use the
API functions to initialize variables of type ktime_t.

Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: Use ktime_set() in pt1.c
Jasmin Jessich [Sun, 6 May 2018 10:44:22 +0000 (06:44 -0400)]
media: Use ktime_set() in pt1.c

In commit 20a63349b142 a new variable ktime_t delay has been added.
We decided to use the API functions to initialize ktime_t variables
within media-tree. Thus variable delay needs to be initialized with
ktime_set() instead of setting it directly.

Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: pvrusb2: delete unneeded include
Julia Lawall [Sun, 6 May 2018 08:33:14 +0000 (04:33 -0400)]
media: pvrusb2: delete unneeded include

pvrusb2-video-v4l.h only declares pvr2_saa7115_subdev_update and
includes pvrusb2-hdw-internal.h.  pvrusb2-cx2584x-v4l.c does not
use pvr2_saa7115_subdev_update and it explicitly includes
pvrusb2-hdw-internal.h.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: saa7164: Fix driver name in debug output
Brad Love [Fri, 4 May 2018 21:53:35 +0000 (17:53 -0400)]
media: saa7164: Fix driver name in debug output

This issue was reported by a user who downloaded a corrupt saa7164
firmware, then went looking for a valid xc5000 firmware to fix the
error displayed...but the device in question has no xc5000, thus after
much effort, the wild goose chase eventually led to a support call.

The xc5000 has nothing to do with saa7164 (as far as I can tell),
so replace the string with saa7164 as well as give a meaningful
hint on the firmware mismatch.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: renesas-ceu: Set mbus_fmt on subdev operations
Jacopo Mondi [Fri, 4 May 2018 09:32:17 +0000 (05:32 -0400)]
media: renesas-ceu: Set mbus_fmt on subdev operations

The renesas-ceu driver intializes the desired mbus_format at 'complete'
time, inspecting the supported subdevice ones, and tuning some
parameters to produce the requested memory format from what the sensor
can produce. Although, the initially selected mbus_format was not
provided to the subdevice during set_fmt and try_fmt operations,
providing instead a '0' mbus format code.

As long as the sensor defaults to a compatible mbus_format when an
invalid code as '0' is provided, capture operations work correctly. If
the subdevice defaults to an unsupported format (eg. some RGB
permutations) capture does not work properly due to a mismatch on the
expected and received image format on the wire.

Fix that by re-using the initially selected mbus_format code during
set_fmt and try_fmt subdevice operation calls.

Tested by printing out the format selection procedure with ov7670
sensor.

Before this patch:
[    0.866001] ov7670_try_fmt_internal -- Looking for mbus_code 0x0000
[    0.870882] ov7670_try_fmt_internal -- Try mbus_code 0x2008
[    0.876336] ov7670_try_fmt_internal -- Try mbus_code 0x1002
[    0.881387] ov7670_try_fmt_internal -- Try mbus_code 0x1008
[    0.886537] ov7670_try_fmt_internal -- Try mbus_code 0x3001
[    0.891584] ov7670_try_fmt_internal -- mbus_code defaulted to 0x2008

With this patch applied:
[    0.867015] ov7670_try_fmt_internal -- Looking for mbus_code 0x2008
[    0.873205] ov7670_try_fmt_internal -- Try mbus_code 0x2008: match

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: cec: Kconfig coding style issue
Brad Love [Wed, 2 May 2018 23:19:30 +0000 (19:19 -0400)]
media: cec: Kconfig coding style issue

Use tabs instead of spaces and help is two-spaced after single tab.

The incorrect spacing breaks menuconfig on older kernels.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: intel-ipu3: Kconfig coding style issue
Brad Love [Wed, 2 May 2018 23:19:29 +0000 (19:19 -0400)]
media: intel-ipu3: Kconfig coding style issue

Kconfig Help statements are two-spaced after a single tab.

The incorrect spacing breaks menuconfig on older kernels.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: em28xx: Fix DualHD broken second tuner
Brad Love [Wed, 2 May 2018 21:46:18 +0000 (17:46 -0400)]
media: em28xx: Fix DualHD broken second tuner

The use of a hard coded i2c address breaks the creation of the
second tuner in DualHD 01595 models. The issue is compounded
by lack of any error message stating that a driver failed
initialization. Use addr, which contains the correct address
for each tuner.

Fixes: ad32495b1513 ("media: em28xx-dvb: simplify DVB module probing logic")

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: videobuf-dma-sg: Fix dma_{sync,unmap}_sg() calls
Robin Murphy [Mon, 30 Apr 2018 16:56:28 +0000 (12:56 -0400)]
media: videobuf-dma-sg: Fix dma_{sync,unmap}_sg() calls

This reverts commit fc7f8fd42c2b934ac348995e0c530c917fc277d5.

Whilst the rationale for the above commit was in general correct, i.e.
that users *consuming* the DMA addresses should rely on sglen rather
than num_pages, it has always been the case that the DMA API itself
still requires that dma_{sync,unmap}_sg() are called with the original
number of entries as passed to dma_map_sg(), not the number of mapped
entries it returned. Thus the particular changes made in that patch
were erroneous.

At worst this might lead to data loss at the tail end of mapped buffers
on non-coherent hardware, while at best it's an example of incorrect
DMA API usage which has proven to mislead readers.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: media/usbvision: fix spelling mistake: "compresion" -> "compression"
Colin Ian King [Sat, 28 Apr 2018 22:11:34 +0000 (18:11 -0400)]
media: media/usbvision: fix spelling mistake: "compresion" -> "compression"

Trivial fix to spelling mistake in proc text string

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: coda: set colorimetry on coded queue
Philipp Zabel [Fri, 27 Apr 2018 16:19:17 +0000 (12:19 -0400)]
media: coda: set colorimetry on coded queue

Do not set context colorimetry on the raw (OUTPUT) queue for encoders.
Always set colorimetry on the coded queue (CAPTURE for encoders, OUTPUT
for decoders).
This also skips propagation of capture queue format and selection
rectangle on S_FMT(OUTPUT) to the CAPTURE queue for encoders.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: coda: do not try to propagate format if capture queue busy
Philipp Zabel [Fri, 27 Apr 2018 16:19:16 +0000 (12:19 -0400)]
media: coda: do not try to propagate format if capture queue busy

The driver helpfully resets the capture queue format and selection
rectangle whenever output format is changed. This only works while
the capture queue is not busy.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: coda: reuse coda_s_fmt_vid_cap to propagate format in coda_s_fmt_vid_out
Philipp Zabel [Fri, 27 Apr 2018 16:19:15 +0000 (12:19 -0400)]
media: coda: reuse coda_s_fmt_vid_cap to propagate format in coda_s_fmt_vid_out

Instead of duplicating the same code, call into coda_s_fmt_vid_out to
propagate the output format to the capture queue.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: sta2x11: Use gpio_is_valid() and remove unnecessary check
Arvind Yadav [Fri, 27 Apr 2018 11:44:01 +0000 (07:44 -0400)]
media: sta2x11: Use gpio_is_valid() and remove unnecessary check

Replace the manual validity checks for the GPIO with the
gpio_is_valid().

In vip_gpio_reserve(), Error checking for gpio pin is not correct.
If pwr_pin = -1, It will return 0. This should be return an error.

In sta2x11_vip_init_one(), Error checking for gpio 'reset_pin'
is unnecessary. Because vip_gpio_reserve() is also checking for
valid gpio pin. So removed extra error checking for gpio 'reset_pin'.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: platform: Use gpio_is_valid()
Arvind Yadav [Fri, 27 Apr 2018 11:44:00 +0000 (07:44 -0400)]
media: platform: Use gpio_is_valid()

Replace the manual validity checks for the GPIO with the
gpio_is_valid().

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: v4l2-dev.h: fix doc warning
Hans Verkuil [Thu, 3 May 2018 12:47:10 +0000 (08:47 -0400)]
media: v4l2-dev.h: fix doc warning

Fix this warning when building the docs:

include/media/v4l2-dev.h:42: warning: Enum value 'VFL_TYPE_MAX' not described in enum 'vfl_devnode_type'

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: vpbe_venc: potential uninitialized variable in ven_sub_dev_init()
Dan Carpenter [Fri, 20 Apr 2018 10:13:52 +0000 (06:13 -0400)]
media: vpbe_venc: potential uninitialized variable in ven_sub_dev_init()

Smatch complains that "venc" could be uninitialized.  There are a couple
of error paths where it looks like maybe that could happen.  I don't know
if it's really a bug, but it's reasonable to set "venc" to NULL and
silence the warning.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: cec-gpio: use GPIOD_OUT_HIGH_OPEN_DRAIN
Hans Verkuil [Fri, 20 Apr 2018 08:13:53 +0000 (04:13 -0400)]
media: cec-gpio: use GPIOD_OUT_HIGH_OPEN_DRAIN

This driver needs a pull up output GPIO, but devm_gpiod_get() is called
with GPIOD_IN. This apparently works fine for the RPi3 where the DT
correctly specifies a pull up GPIO, but on the i.MX6 it also needs to
be specified with devm_gpiod_get().

Reported-by: Henrik Mau <Henrik.Mau@linn.co.uk>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: platform: am437x: simplify getting .drvdata
Wolfram Sang [Thu, 19 Apr 2018 14:05:55 +0000 (10:05 -0400)]
media: platform: am437x: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: videobuf: Change return type to vm_fault_t
Souptick Joarder [Wed, 18 Apr 2018 18:47:16 +0000 (14:47 -0400)]
media: videobuf: Change return type to vm_fault_t

Use new return type vm_fault_t for fault handler. For
now, this is just documenting that the function returns
a VM_FAULT value rather than an errno. Once all instances
are converted, vm_fault_t will become a distinct type.

Reference id -> 1c8f422059ae ("mm: change return type to
vm_fault_t")

Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: vcodec: fix ptr_ret.cocci warnings
Fengguang Wu [Wed, 11 Apr 2018 21:14:39 +0000 (17:14 -0400)]
media: vcodec: fix ptr_ret.cocci warnings

drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c:1087:1-3: WARNING: PTR_ERR_OR_ZERO can be used

 Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Generated by: scripts/coccinelle/api/ptr_ret.cocci

Fixes: 648a9576932a ("media: vcodec: fix error return value from mtk_jpeg_clk_init()")

CC: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: v4l2-core: Rename array 'video_driver' to 'video_drivers'
Simon Que [Mon, 9 Apr 2018 19:47:38 +0000 (15:47 -0400)]
media: v4l2-core: Rename array 'video_driver' to 'video_drivers'

Improves code clarity in two ways:
1. The plural name makes it more clear that it is an array.
2. The name of the array is now no longer identical to the struct type
name, so it is easier to find in the code.

Signed-off-by: Simon Que <sque@chromium.org>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: entity: fix spelling for media_entity_get_fwnode_pad()
Niklas Söderlund [Sun, 8 Apr 2018 16:11:52 +0000 (12:11 -0400)]
media: entity: fix spelling for media_entity_get_fwnode_pad()

s/dose/does/

Fixes: d295c6a460cd2ac6 ("[media] media: entity: Add media_entity_get_fwnode_pad() function")

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: intel-ipu3: cio2: Handle IRQs until INT_STS is cleared
Bingbu Cao [Mon, 30 Apr 2018 14:30:40 +0000 (10:30 -0400)]
media: intel-ipu3: cio2: Handle IRQs until INT_STS is cleared

Interrupt behavior shows that some time the frame end and frame start of
next frame is unstable and can range from several to hundreds of
micro-sec. In the case of ~10us, isr may not clear next sof interrupt
status in single handling, which prevents new interrupts from coming.

Fix this by handling all pending IRQs before exiting isr, so any abnormal
behavior results from very short interrupt status changes is protected.

Signed-off-by: Bingbu Cao <bingbu.cao@intel.com>
Signed-off-by: Andy Yeh <andy.yeh@intel.com>
Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: include/video/omapfb_dss.h: use IS_ENABLED()
Mauro Carvalho Chehab [Fri, 4 May 2018 20:49:32 +0000 (16:49 -0400)]
media: include/video/omapfb_dss.h: use IS_ENABLED()

Just checking for ifdefs cause build issues as reported by
kernel test:

config: openrisc-allmodconfig (attached as .config)
compiler: or1k-linux-gcc (GCC) 6.0.0 20160327 (experimental)

All errors (new ones prefixed by >>):

   drivers/video/fbdev/omap2/omapfb/omapfb-main.c: In function 'omapfb_init_connections':
>> drivers/video/fbdev/omap2/omapfb/omapfb-main.c:2396:8: error: implicit declaration of function 'omapdss_find_mgr_from_display' [-Werror=implicit-function-declaration]
     mgr = omapdss_find_mgr_from_display(def_dssdev);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/video/fbdev/omap2/omapfb/omapfb-main.c:2396:6: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     mgr = omapdss_find_mgr_from_display(def_dssdev);
         ^
   drivers/video/fbdev/omap2/omapfb/omapfb-main.c: In function 'omapfb_find_default_display':
>> drivers/video/fbdev/omap2/omapfb/omapfb-main.c:2430:13: error: implicit declaration of function 'omapdss_get_default_display_name' [-Werror=implicit-function-declaration]
     def_name = omapdss_get_default_display_name();
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/video/fbdev/omap2/omapfb/omapfb-main.c:2430:11: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     def_name = omapdss_get_default_display_name();
              ^

So, use IS_ENABLED() instead.

Fixes: 771f7be87ff9 ("media: omapfb: omapfb_dss.h: add stubs to build with COMPILE_TEST && DRM_OMAP")

Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: tomi.valkeinen@ti.com
Cc: linux-omap@vger.kernel.org
Cc: linux-fbdev@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: cx231xx: Fix recursive dependency
Brad Love [Sat, 5 May 2018 15:07:53 +0000 (11:07 -0400)]
media: cx231xx: Fix recursive dependency

0day build bot reported an unnoticed recursive dependency, fix it
by removing the select statement.

fixes: c66d4d99a8fb ("cx231xx: Add I2C_MUX dependency")

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: gspca: Stop using GFP_DMA for buffers for USB bulk transfers
Hans de Goede [Sat, 5 May 2018 08:22:08 +0000 (04:22 -0400)]
media: gspca: Stop using GFP_DMA for buffers for USB bulk transfers

The recent "x86 ZONE_DMA love" discussion at LSF/MM pointed out that some
gspca sub-drivvers are using GFP_DMA to allocate buffers which are used
for USB bulk transfers, there is absolutely no need for this, drop it.

Cc: "Luis R. Rodriguez" <mcgrof@kernel.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: meye: allow building it with COMPILE_TEST on non-x86
Mauro Carvalho Chehab [Fri, 20 Apr 2018 15:55:13 +0000 (11:55 -0400)]
media: meye: allow building it with COMPILE_TEST on non-x86

This driver depends on sony-laptop driver, but this is available
only for x86. So, add a stub function, in order to allow building
it on non-x86 too.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: cxd2880: Changed version information
Yasunari Takiguchi [Thu, 26 Apr 2018 06:42:52 +0000 (02:42 -0400)]
media: cxd2880: Changed version information

This is the version update for this cxd2880 driver changing.

Signed-off-by: Yasunari Takiguchi <Yasunari.Takiguchi@sony.com>
Signed-off-by: Masayuki Yamamoto <Masayuki.Yamamoto@sony.com>
Signed-off-by: Hideki Nozawa <Hideki.Nozawa@sony.com>
Signed-off-by: Kota Yonezawa <Kota.Yonezawa@sony.com>
Signed-off-by: Toshihiko Matsumoto <Toshihiko.Matsumoto@sony.com>
Signed-off-by: Satoshi Watanabe <Satoshi.C.Watanabe@sony.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: cxd2880:Optimized spi drive current and BER/PER set/get condition
Yasunari Takiguchi [Thu, 26 Apr 2018 06:41:29 +0000 (02:41 -0400)]
media: cxd2880:Optimized spi drive current and BER/PER set/get condition

This is the optimization for SPI drive current and
signal lock condition check part for BER/PER measure
to ensure BER/PER are stable

Signed-off-by: Yasunari Takiguchi <Yasunari.Takiguchi@sony.com>
Signed-off-by: Masayuki Yamamoto <Masayuki.Yamamoto@sony.com>
Signed-off-by: Hideki Nozawa <Hideki.Nozawa@sony.com>
Signed-off-by: Kota Yonezawa <Kota.Yonezawa@sony.com>
Signed-off-by: Toshihiko Matsumoto <Toshihiko.Matsumoto@sony.com>
Signed-off-by: Satoshi Watanabe <Satoshi.C.Watanabe@sony.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: cxd2880-spi: Modified how to declare structure
Yasunari Takiguchi [Thu, 26 Apr 2018 06:39:17 +0000 (02:39 -0400)]
media: cxd2880-spi: Modified how to declare structure

This is the modification of structure declaration for spi_transfer.

Signed-off-by: Yasunari Takiguchi <Yasunari.Takiguchi@sony.com>
Signed-off-by: Masayuki Yamamoto <Masayuki.Yamamoto@sony.com>
Signed-off-by: Hideki Nozawa <Hideki.Nozawa@sony.com>
Signed-off-by: Kota Yonezawa <Kota.Yonezawa@sony.com>
Signed-off-by: Toshihiko Matsumoto <Toshihiko.Matsumoto@sony.com>
Signed-off-by: Satoshi Watanabe <Satoshi.C.Watanabe@sony.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: docs: update em28xx and cx23885 cardlists
Mauro Carvalho Chehab [Sat, 5 May 2018 14:35:22 +0000 (10:35 -0400)]
media: docs: update em28xx and cx23885 cardlists

As newer boards got added, update the cardlists.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: em28xx: Add new dvb-t board ":Zolid Hybrid Tv Stick"
Marcel Stork [Thu, 26 Apr 2018 19:17:02 +0000 (15:17 -0400)]
media: em28xx: Add new dvb-t board ":Zolid Hybrid Tv Stick"

Extra code to be able to use this stick, only digital, not analog
nor remote-control.

Signed-off-by: Marcel Stork <mjstork@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: em28xx: merge two identical cases inside a switch()
Marcel Stork [Wed, 25 Apr 2018 17:34:20 +0000 (13:34 -0400)]
media: em28xx: merge two identical cases inside a switch()

A cosmetic change by combining two sets of boards into one set because
having the same arguments.

Signed-off-by: Marcel Stork <mjstork@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: rcar-vin: enable field toggle after a set number of lines for Gen3
Niklas Söderlund [Tue, 24 Apr 2018 23:56:52 +0000 (19:56 -0400)]
media: rcar-vin: enable field toggle after a set number of lines for Gen3

The VIN Gen3 hardware don't have Line Post-Clip capabilities as VIN Gen2
hardware have. To protect against writing outside the capture window
enable field toggle after a set number of lines have been captured.

Capturing outside the allocated capture buffer where observed on R-Car
Gen3 Salvator-XS H3 from the CVBS input if the standard is
misconfigured. That is if a PAL source is connected to the system but
the adv748x standard is set to NTSC. In this case the format reported by
the adv748x is 720x480 and that is what is used for the media pipeline.
The PAL source generates frames in the format of 720x576 and the field
is not toggled until the VSYNC is detected and at that time data have
already been written outside the allocated capture buffer.

With this change the capture in the situation described above results in
garbage frames but that is far better then writing outside the capture
buffer.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: rcar-vin: add support for MEDIA_BUS_FMT_UYVY8_1X16
Niklas Söderlund [Tue, 24 Apr 2018 23:46:07 +0000 (19:46 -0400)]
media: rcar-vin: add support for MEDIA_BUS_FMT_UYVY8_1X16

By setting VNMC_YCAL rcar-vin can support input video in
MEDIA_BUS_FMT_UYVY8_1X16 format.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: rcar-vin: fix null pointer dereference in rvin_group_get()
Niklas Söderlund [Tue, 24 Apr 2018 23:45:06 +0000 (19:45 -0400)]
media: rcar-vin: fix null pointer dereference in rvin_group_get()

Store the group pointer before disassociating the VIN from the group.

Fixes: 3bb4c3bc85bf77a7 ("media: rcar-vin: add group allocator functions")

Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: rcar-vin: remove generic gen3 compatible string
Niklas Söderlund [Tue, 24 Apr 2018 23:43:21 +0000 (19:43 -0400)]
media: rcar-vin: remove generic gen3 compatible string

The compatible string "renesas,rcar-gen3-vin" was added before the
Gen3 driver code was added but it's not possible to use. Each SoC in the
Gen3 series require SoC specific knowledge in the driver to function.
Remove it before it is added to any device tree descriptions.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: cx88: Get rid of spurious call to cx8800_start_vbi_dma()
Devin Heitmueller [Tue, 24 Apr 2018 23:12:52 +0000 (19:12 -0400)]
media: cx88: Get rid of spurious call to cx8800_start_vbi_dma()

This was left over from the conversion to VB2, where the call was
getting invoked both in buffer_queue and start_streaming, which
was intermittently causing invalid opcodes on the VBI RISC queue.

This change effectively mirrors the exact same change Hans Verkuil
made in cx88-video.c in commit 389208e1173e ("[media] cx88:
remove leftover start_video_dma() call").

Thanks to Daniel Glöckner for spotting the actual bug after I spent
several days trying to chase down the issue.

Fixes: 389208e1173e ("[media] cx88: remove leftover start_video_dma() call")

Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Thanks-to: Daniel Glöckner <daniel-gl@gmx.net>
Cc: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: dvb_net: fix dvb_net_tx()'s return type
Luc Van Oostenryck [Tue, 24 Apr 2018 13:15:51 +0000 (09:15 -0400)]
media: dvb_net: fix dvb_net_tx()'s return type

The method ndo_start_xmit() is defined as returning an 'netdev_tx_t',
which is a typedef for an enum type, but the implementation in this
driver returns an 'int'.

Fix this by returning 'netdev_tx_t' in this driver too.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: lgdt3306a: fix lgdt3306a_search()'s return type
Luc Van Oostenryck [Tue, 24 Apr 2018 13:19:04 +0000 (09:19 -0400)]
media: lgdt3306a: fix lgdt3306a_search()'s return type

The method dvb_frontend_ops::search() is defined as
returning an 'enum dvbfe_search', but the implementation in this
driver returns an 'int'.

Fix this by returning 'enum dvbfe_search' in this driver too.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Acked-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: frontends: fix ops get_algo()'s return type
Luc Van Oostenryck [Tue, 24 Apr 2018 13:19:18 +0000 (09:19 -0400)]
media: frontends: fix ops get_algo()'s return type

The method dvb_frontend_ops::get_frontend_algo() is defined as
returning an 'enum dvbfe_algo', but the implementation in this
driver returns an 'int'.

Fix this by returning 'enum dvbfe_algo' on drivers.

[mchehab+samsung@kernel.org: merge similar patches and patch
 ddbridge-mci.c the same way]
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: drivers: media: platform: make VIDEO_VIU depend on I2C
Anders Roxell [Mon, 23 Apr 2018 19:31:39 +0000 (15:31 -0400)]
media: drivers: media: platform: make VIDEO_VIU depend on I2C

Commit 7378f1149884 ("media: omap2: omapfb: allow building it with
COMPILE_TEST") broke compilation without CONFIG_I2C selected.
drivers/media/platform/fsl-viu.c: In function â€˜viu_of_probe’:
drivers/media/platform/fsl-viu.c:1452:7: error: implicit declaration of function â€˜i2c_get_adapter’; did you mean â€˜i2c_lock_adapter’? [-Werror=implicit-function-declaration]
  ad = i2c_get_adapter(0);
       ^~~~~~~~~~~~~~~
       i2c_lock_adapter
drivers/media/platform/fsl-viu.c:1452:5: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
  ad = i2c_get_adapter(0);
     ^
drivers/media/platform/fsl-viu.c:1534:2: error: implicit declaration of function â€˜i2c_put_adapter’; did you mean â€˜i2c_lock_adapter’? [-Werror=implicit-function-declaration]
  i2c_put_adapter(ad);
  ^~~~~~~~~~~~~~~
  i2c_lock_adapter

Added I2C dependency in order to make all configurations work again.

Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: ngene: fix ci_tsfix modparam description typo
Daniel Scheller [Sun, 22 Apr 2018 16:06:52 +0000 (12:06 -0400)]
media: ngene: fix ci_tsfix modparam description typo

s/shifs/shifts/

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: ngene: cleanup superfluous I2C adapter evaluation
Daniel Scheller [Sun, 22 Apr 2018 16:06:51 +0000 (12:06 -0400)]
media: ngene: cleanup superfluous I2C adapter evaluation

Commit ee93340e98bc ("media: ngene: deduplicate I2C adapter evaluation")
added a helper to evaluate the I2C adapter to be used for demod/tuner
attachment based on the given ngene_channel, and that helper is used in
many attach functions to initialise the i2c_adapter variable. However,
for some reason in tuner_attach_stv6110() and demod_attach_stv0900(), the
adapter evaluation wasn't removed as in all other functions. Fix (or
finalize, even) the helper use by cleaning up the superfluous I2C adapter
evaluation leftover in these two functions.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: pt1: use #ifdef CONFIG_PM_SLEEP instead of #if
Mauro Carvalho Chehab [Sat, 5 May 2018 13:23:21 +0000 (09:23 -0400)]
media: pt1: use #ifdef CONFIG_PM_SLEEP instead of #if

As pointed by ktest:

>> drivers/media//pci/pt1/pt1.c:1433:5: warning: "CONFIG_PM_SLEEP" is not defined, evaluates to 0 [-Wundef]
    #if CONFIG_PM_SLEEP
        ^~~~~~~~~~~~~~~

Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: include/media: fix missing | operator when setting cfg
Colin Ian King [Wed, 18 Apr 2018 15:06:17 +0000 (11:06 -0400)]
media: include/media: fix missing | operator when setting cfg

The value from a readl is being masked with ITE_REG_CIOCAN_MASK however
this is not being used and cfg is being re-assigned.  I believe the
assignment operator should actually be instead the |= operator.

Detected by CoverityScan, CID#1467987 ("Unused value")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: cx231xx: remove a now unused var
Mauro Carvalho Chehab [Sat, 5 May 2018 12:27:48 +0000 (08:27 -0400)]
media: cx231xx: remove a now unused var

drivers/media/usb/cx231xx/cx231xx-dvb.c: In function 'unregister_dvb':
drivers/media/usb/cx231xx/cx231xx-dvb.c:607:21: warning: unused variable 'client' [-Wunused-variable]
  struct i2c_client *client;
                     ^~~~~~

Fixes: a12481354656 ("media: cx231xx: Switch to using new dvb i2c helpers")
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: cx231xx: Add I2C_MUX dependency
Brad Love [Thu, 3 May 2018 21:20:15 +0000 (17:20 -0400)]
media: cx231xx: Add I2C_MUX dependency

cx231xx requires i2c mux adapter capability.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: cx231xx: Remove RC_CORE dependency
Brad Love [Thu, 3 May 2018 21:20:14 +0000 (17:20 -0400)]
media: cx231xx: Remove RC_CORE dependency

VIDEO_CX231XX_RC requires RC_CORE, but VIDEO_CX231XX
does not require RC to compile or function.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: cx231xx: Remove unnecessary parameter clear
Brad Love [Thu, 3 May 2018 21:20:13 +0000 (17:20 -0400)]
media: cx231xx: Remove unnecessary parameter clear

The default is now 0, no need to override

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: cx231xx: Update 955Q from dvb attach to i2c device
Brad Love [Thu, 3 May 2018 21:20:12 +0000 (17:20 -0400)]
media: cx231xx: Update 955Q from dvb attach to i2c device

Trim out some unused config params. Use the i2c mux
adapter returned by frontend with the tuner.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: cx231xx: Switch to using new dvb i2c helpers
Brad Love [Thu, 3 May 2018 21:20:11 +0000 (17:20 -0400)]
media: cx231xx: Switch to using new dvb i2c helpers

Mostly very straight forward replace of blocks with equivalent code.

Cleanup added at end of dvb_init in case of failure.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: cx231xx: Ignore an i2c mux adapter
Brad Love [Thu, 3 May 2018 21:20:10 +0000 (17:20 -0400)]
media: cx231xx: Ignore an i2c mux adapter

Hauppauge 935C cannot communicate with the si2157
when using the mux adapter returned by the si2168,
so disable it to fix the device.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: cx231xx: Style fix for struct zero init
Brad Love [Thu, 3 May 2018 21:20:09 +0000 (17:20 -0400)]
media: cx231xx: Style fix for struct zero init

Replace zero fill memset inits with
equivalent {} in declaration

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: cx231xx: Use board profile values for addresses
Brad Love [Thu, 3 May 2018 21:20:08 +0000 (17:20 -0400)]
media: cx231xx: Use board profile values for addresses

Replace all usage of hard coded values with
the proper field from the board profile.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: cx231xx: Fix several incorrect demod addresses
Brad Love [Thu, 3 May 2018 21:20:07 +0000 (17:20 -0400)]
media: cx231xx: Fix several incorrect demod addresses

Now the board values match the hard coded
constants used in the dvb initialization.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: dvb-usb: Replace GFP_ATOMIC with GFP_KERNEL
Jia-Ju Bai [Wed, 11 Apr 2018 03:23:49 +0000 (23:23 -0400)]
media: dvb-usb: Replace GFP_ATOMIC with GFP_KERNEL

Despite never getting called from atomic context,
usb URB memory allocations use GFP_ATOMIC, which does not sleep
for allocation.

GFP_ATOMIC is not necessary and can be replaced with GFP_KERNEL,
which can sleep and improve the possibility of sucessful allocation.

This is found by a static analysis tool named DCNS written by myself.
And I also manually check it.

[mchehab+samsung@kernel.org: merged 3 similar patches into one]
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: pt1: fix strncmp() size warning
Mauro Carvalho Chehab [Sat, 5 May 2018 11:32:27 +0000 (07:32 -0400)]
media: pt1: fix strncmp() size warning

As warned by smatch:
drivers/media/pci/pt1/pt1.c:213 config_demod() error: strncmp() '"tc90522sat"' too small (11 vs 20)

Use the same strncmp() syntax as pt1_init_frontends() does.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: dvb: earth-pt1: replace schedule_timeout with usleep_range
Akihiro Tsukada [Sun, 8 Apr 2018 17:39:53 +0000 (13:39 -0400)]
media: dvb: earth-pt1: replace schedule_timeout with usleep_range

As described in Document/timers/timers-howto.txt,
hrtimer-based delay should be used for small sleeps.

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: dvb: earth-pt1: add support for suspend/resume
Akihiro Tsukada [Sun, 8 Apr 2018 17:39:52 +0000 (13:39 -0400)]
media: dvb: earth-pt1: add support for suspend/resume

Without this patch, re-loading of the module was required after resume.

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: dvb: earth-pt1: decompose pt1 driver into sub drivers
Akihiro Tsukada [Sun, 8 Apr 2018 17:39:51 +0000 (13:39 -0400)]
media: dvb: earth-pt1: decompose pt1 driver into sub drivers

earth-pt1 was a monolithic module and included demod/tuner drivers.
This patch removes those FE parts and  attach demod/tuner i2c drivers.

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: tuners: add new i2c driver for Sharp qm1d1b0004 ISDB-S tuner
Akihiro Tsukada [Sun, 8 Apr 2018 17:39:50 +0000 (13:39 -0400)]
media: tuners: add new i2c driver for Sharp qm1d1b0004 ISDB-S tuner

The tuner is used in Earthsoft PT1/PT2 DVB boards,
and  the driver was extraced from (the former) va1j5jf8007s.c of PT1.
it might contain PT1 specific configs.

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: dvb-frontends/dvb-pll: add tda6651 ISDB-T pll_desc
Akihiro Tsukada [Sun, 8 Apr 2018 17:39:49 +0000 (13:39 -0400)]
media: dvb-frontends/dvb-pll: add tda6651 ISDB-T pll_desc

This patch adds a PLL "description" of Philips TDA6651 for ISDB-T.
It was extracted from (the former) va1j5jf8007t.c of EarthSoft PT1,
thus the desc might include PT1 specific configs.

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: dvb-usb-v2/gl861: ensure USB message buffers DMA'able
Akihiro Tsukada [Sun, 8 Apr 2018 17:21:38 +0000 (13:21 -0400)]
media: dvb-usb-v2/gl861: ensure USB message buffers DMA'able

i2c message buf might be on stack.

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: dvb-usb-v2/gl861: use usleep_range() for short delay
Akihiro Tsukada [Sun, 8 Apr 2018 17:21:37 +0000 (13:21 -0400)]
media: dvb-usb-v2/gl861: use usleep_range() for short delay

As the kernel doc "timers-howto.txt" reads,
short delay with msleep() can take much longer.
In a case of raspbery-pi platform where CONFIG_HZ_100 was set,
it actually affected the init of Friio devices
since it issues lots of i2c transactions with short delay.

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: dvb-frontends/dvb-pll: add tua6034 ISDB-T tuner used in Friio
Akihiro Tsukada [Sun, 8 Apr 2018 17:21:35 +0000 (13:21 -0400)]
media: dvb-frontends/dvb-pll: add tua6034 ISDB-T tuner used in Friio

This driver already contains tua6034-based device settings,
but they are not for ISDB-T and have different parameters.

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: dvb-frontends/dvb-pll: add i2c driver support
Akihiro Tsukada [Sun, 8 Apr 2018 17:21:34 +0000 (13:21 -0400)]
media: dvb-frontends/dvb-pll: add i2c driver support

registers the module as an i2c driver,
but keeps dvb_pll_attach() untouched for compatibility.

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: v4l2-dev: use pr_foo() for printing messages
Mauro Carvalho Chehab [Thu, 5 Apr 2018 10:34:39 +0000 (06:34 -0400)]
media: v4l2-dev: use pr_foo() for printing messages

Instead of using printk() directly, use the pr_foo()
macros.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: platform: video-mux: propagate format from sink to source
Chris Lesiak [Tue, 3 Apr 2018 19:50:22 +0000 (15:50 -0400)]
media: platform: video-mux: propagate format from sink to source

Propagate the v4l2_mbus_framefmt to the source pad when either a sink
pad is activated or when the format of the active sink pad changes.

Signed-off-by: Chris Lesiak <chris.lesiak@licor.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: i2c: tvp5150: Fix open brace placement codding style
Nasser Afshin [Mon, 2 Apr 2018 22:23:19 +0000 (18:23 -0400)]
media: i2c: tvp5150: Fix open brace placement codding style

This patch resolves the following checkpatch.pl error:
    ERROR: that open brace { should be on the previous line

Signed-off-by: Nasser Afshin <Afshin.Nasser@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: i2c: tvp5150: Use the correct comment style
Nasser Afshin [Mon, 2 Apr 2018 22:23:18 +0000 (18:23 -0400)]
media: i2c: tvp5150: Use the correct comment style

This patch resolves checkpatch.pl warnings:
    WARNING: Block comments use * on subsequent lines
    WARNING: Block comments use a trailing */ on a separate line

Signed-off-by: Nasser Afshin <Afshin.Nasser@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: i2c: tvp5150: Add a space after commas
Nasser Afshin [Mon, 2 Apr 2018 22:23:17 +0000 (18:23 -0400)]
media: i2c: tvp5150: Add a space after commas

This patch resolves checkpatch.pl errors:
    ERROR: space required after that ',' (ctx:VxV)

Signed-off-by: Nasser Afshin <Afshin.Nasser@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: i2c: tvp5150: Use parentheses for sizeof
Nasser Afshin [Mon, 2 Apr 2018 22:23:20 +0000 (18:23 -0400)]
media: i2c: tvp5150: Use parentheses for sizeof

This patch resolves a checkpatch.pl warning:
    WARNING: sizeof *cap should be sizeof(*cap)

Signed-off-by: Nasser Afshin <Afshin.Nasser@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: bttv: Fixed oops error when capturing at yuv410p
Samuel Williams [Sun, 1 Apr 2018 15:00:27 +0000 (11:00 -0400)]
media: bttv: Fixed oops error when capturing at yuv410p

When capturing at yuv410p, sg_next was called too many times when chroma is
false, eventually returning NULL. This patch does fix this for my hardware.

Signed-off-by: Samuel Williams <sam8641@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: tuners/qm1d1c0042: use SPDX License Identifier
Akihiro Tsukada [Tue, 27 Mar 2018 17:08:22 +0000 (13:08 -0400)]
media: tuners/qm1d1c0042: use SPDX License Identifier

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: tuners/mxl301rf: use SPDX License Identifier
Akihiro Tsukada [Tue, 27 Mar 2018 17:08:21 +0000 (13:08 -0400)]
media: tuners/mxl301rf: use SPDX License Identifier

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: dvb/pci/pt3: use SPDX License Identifier
Akihiro Tsukada [Tue, 27 Mar 2018 17:08:20 +0000 (13:08 -0400)]
media: dvb/pci/pt3: use SPDX License Identifier

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: dvb-frontends/tc90522: use SPDX License Identifier
Akihiro Tsukada [Tue, 27 Mar 2018 17:08:19 +0000 (13:08 -0400)]
media: dvb-frontends/tc90522: use SPDX License Identifier

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: dvb-core/dvb_frontend: set better default for ISDB-T
Akihiro Tsukada [Tue, 27 Mar 2018 16:56:58 +0000 (12:56 -0400)]
media: dvb-core/dvb_frontend: set better default for ISDB-T

DTV_ISDBT_LAYER_ENABLED parameter should be set to "All" by default,
instead of "None", as described in the API document.

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: dvb-frontends/tc90522: fix bit shift mistakes
Akihiro Tsukada [Tue, 27 Mar 2018 15:51:21 +0000 (11:51 -0400)]
media: dvb-frontends/tc90522: fix bit shift mistakes

GIT_AUTHOR_NAME=Akihiro TSUKADA
GIT_AUTHOR_EMAIL=tskd08@gmail.com

they were obviously wrong.

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: ov13858: Remove owner assignment from i2c_driver
Fabio Estevam [Sat, 24 Mar 2018 14:01:34 +0000 (10:01 -0400)]
media: ov13858: Remove owner assignment from i2c_driver

Structure i2c_driver does not need to set the owner field, as this will
be populated by the driver core.

Generated by scripts/coccinelle/api/platform_no_drv_owner.cocci.

Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: ov5695: Remove owner assignment from i2c_driver
Fabio Estevam [Sat, 24 Mar 2018 14:01:33 +0000 (10:01 -0400)]
media: ov5695: Remove owner assignment from i2c_driver

Structure i2c_driver does not need to set the owner field, as this will
be populated by the driver core.

Generated by scripts/coccinelle/api/platform_no_drv_owner.cocci.

Cc: Shunqian Zheng <zhengsq@rock-chips.com>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: em28xx-cards: output regular messages as info
Chris Mayo [Fri, 23 Mar 2018 19:47:13 +0000 (15:47 -0400)]
media: em28xx-cards: output regular messages as info

Messages expected during device probe were being marked as errors.

Signed-off-by: Chris Mayo <aklhfex@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: pt3: no need to check if null for dvb_module_release()
Mauro Carvalho Chehab [Fri, 4 May 2018 18:23:43 +0000 (14:23 -0400)]
media: pt3: no need to check if null for dvb_module_release()

Such check is already there at the routine. So, no need to
repeat it outside.

Cc: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: media/dvb: earth-pt3: use the new i2c binding helper
Akihiro Tsukada [Mon, 19 Mar 2018 16:00:23 +0000 (12:00 -0400)]
media: media/dvb: earth-pt3: use the new i2c binding helper

This patch slightly simplifies the binding code by introducing commit
8f569c0b4e6b ("media: dvb-core: add helper functions for I2C binding").

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: dvb: add alternative USB PID for Hauppauge WinTV-soloHD
Rainer Keller [Sun, 18 Mar 2018 12:40:16 +0000 (08:40 -0400)]
media: dvb: add alternative USB PID for Hauppauge WinTV-soloHD

Newer DVB receivers of this type have a different USB PID.

Signed-off-by: Rainer Keller <mail@rainerkeller.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: ddbridge, cxd2099: include guard, fix unneeded NULL init, strings
Daniel Scheller [Sat, 17 Mar 2018 14:55:32 +0000 (10:55 -0400)]
media: ddbridge, cxd2099: include guard, fix unneeded NULL init, strings

Three really tiny minors in this single commit which all on their own
would just clutter up the commit history unnecessarily:

* ddbridge-regs.h is lacking an include guard. Add it.
* Fix an unnecessary NULL initialisation in ddbridge-ci. The declaration
  of the ci struct ptr is immediately followed by kzalloc().
* Clarify that the CXD2099AR is a Sony device in the cxd2099 driver at a
  few places including Kconfig.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Acked-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: cxd2880-spi: avoid out-of-bounds access warning
Arnd Bergmann [Tue, 13 Mar 2018 12:09:11 +0000 (08:09 -0400)]
media: cxd2880-spi: avoid out-of-bounds access warning

The -Warray-bounds warning in gcc-8 triggers for a newly added file:

drivers/media/spi/cxd2880-spi.c: In function 'cxd2880_write_reg':
drivers/media/spi/cxd2880-spi.c:111:3: error: 'memcpy' forming offset [133, 258] is out of the bounds [0, 132] of object 'send_data' with type 'u8[132]' {aka 'unsigned char[132]'} [-Werror=array-bounds]

The problem appears to be that we have two range checks in this function,
first comparing against BURST_WRITE_MAX (128) and then comparing against
a literal '255'. The logic checking the buffer size looks at the second
one and decides that this might be the actual maximum data length.

This is understandable behavior from the compiler, but the code is actually
safe. Since the first check is already shorter, we can remove the loop
and only leave that. To be on the safe side in case BURST_WRITE_MAX might
be increased, I'm leaving the check against U8_MAX.

Fixes: bd24fcddf6b8 ("media: cxd2880-spi: Add support for CXD2880 SPI interface")

Cc: Martin Sebor <msebor@gmail.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Yasunari Takiguchi <Yasunari.Takiguchi@sony.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: lgdt330x: don't use an uninitialized state
Mauro Carvalho Chehab [Fri, 4 May 2018 15:16:49 +0000 (11:16 -0400)]
media: lgdt330x: don't use an uninitialized state

If state is not initialized or is freed, we can't use it:
drivers/media/dvb-frontends/lgdt330x.c:920 lgdt330x_probe() error: potential null dereference 'state'.  (kzalloc returns null)
drivers/media/dvb-frontends/lgdt330x.c:920 lgdt330x_probe() error: we previously assumed 'state' could be null (see line 878)
drivers/media/dvb-frontends/lgdt330x.c:920 lgdt330x_probe() error: dereferencing freed memory 'state'

Fixes: 23ba635d45f5 ("media: lgdt330x: convert it to the new I2C binding way")
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: lgdt330x: add block error counts via DVBv5
Mauro Carvalho Chehab [Fri, 9 Mar 2018 16:15:41 +0000 (11:15 -0500)]
media: lgdt330x: add block error counts via DVBv5

Show the UCB error counts via DVBv5.

Please notice that there's no scale indication at the driver.
As we don't have the datasheet, let's assume that it is receiving
data at a rate of 10.000 packets per second. Ideally, this should
be read or estimated.

In order to avoid flooding I2C bus with data, the maximum
polling rate for those stats was set to 1 second.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: lgdt330x: get rid of read_ber stub
Mauro Carvalho Chehab [Fri, 9 Mar 2018 15:53:35 +0000 (10:53 -0500)]
media: lgdt330x: get rid of read_ber stub

This routine does nothing. Remove it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>