platform/kernel/linux-rpi.git
7 years agomedia: ov5640: Remove unneeded gpiod NULL check
Fabio Estevam [Thu, 20 Jul 2017 02:41:20 +0000 (22:41 -0400)]
media: ov5640: Remove unneeded gpiod NULL check

The gpiod API checks for NULL descriptors, so there is no need to
duplicate the check in the driver.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: v4l: omap3isp: Get the parallel bus type from DT
Laurent Pinchart [Tue, 18 Jul 2017 15:51:35 +0000 (11:51 -0400)]
media: v4l: omap3isp: Get the parallel bus type from DT

The OMAP3 ISP supports both external and embedded BT.656 synchronization
for parallel buses. It currently gets the bus type information from the
source subdev through the .g_mbus_config() operation, but should instead
get it from DT as that's the authoritative source of bus configuration
information.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: v4l2-flash: Flash ops aren't mandatory
Sakari Ailus [Thu, 8 Jun 2017 11:19:49 +0000 (07:19 -0400)]
media: v4l2-flash: Flash ops aren't mandatory

None of the flash operations are mandatory and therefore there should be
no need for the flash ops structure either. Accept NULL.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Reviewed-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: v4l2-flash: Use led_classdev instead of led_classdev_flash for indicator
Sakari Ailus [Fri, 2 Jun 2017 09:30:02 +0000 (05:30 -0400)]
media: v4l2-flash: Use led_classdev instead of led_classdev_flash for indicator

The V4L2 flash class initialisation expects struct led_classdev_flash that
describes an indicator but only uses struct led_classdev which is a field
iled_cdev in the struct. Use struct iled_cdev only.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: v4l2-fwnode: link_frequency is an optional property
Sakari Ailus [Tue, 20 Jun 2017 13:14:43 +0000 (09:14 -0400)]
media: v4l2-fwnode: link_frequency is an optional property

v4l2_fwnode_endpoint_alloc_parse() is intended as a replacement for
v4l2_fwnode_endpoint_parse(). It parses the "link-frequency" property and
if the property isn't found, it returns an error. However,
"link-frequency" is an optional property and if it does not exist is not
an error. Instead, the number of link frequencies is simply zero in that
case.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: exynos4-is: fimc-is-i2c: constify dev_pm_ops structures
Arvind Yadav [Thu, 29 Jun 2017 08:21:35 +0000 (04:21 -0400)]
media: exynos4-is: fimc-is-i2c: constify dev_pm_ops structures

dev_pm_ops are not supposed to change at runtime. All functions
working with dev_pm_ops provided by <linux/device.h> work with
const dev_pm_ops. So mark the non-const structs as const.

File size before:
   text    data     bss     dec     hex filename
   1195     376       0    1571     623 fimc-is-i2c.o

File size After adding 'const':
   text    data     bss     dec     hex filename
   1403     176       0    1579     62b fimc-is-i2c.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: s5k5baf: remove unnecessary static in s5k5baf_get_selection()
Gustavo A. R. Silva [Wed, 5 Jul 2017 18:07:29 +0000 (14:07 -0400)]
media: s5k5baf: remove unnecessary static in s5k5baf_get_selection()

Remove unnecessary static on local variable rtype. Such variable
is initialized before being used, on every execution path throughout
the function. The static has no benefit and, removing it reduces
the code size.

This issue was detected using Coccinelle and the following semantic patch:

@bad exists@
position p;
identifier x;
type T;
@@

static T x@p;
...
x = <+...x...+>

@@
identifier x;
expression e;
type T;
position p != bad.p;
@@

-static
 T x@p;
 ... when != x
     when strict
?x = e;

In the following log you can see the difference in the code size. Also,
there is a significant difference in the bss segment. This log is the
output of the size command, before and after the code change:

before:
   text    data     bss     dec     hex filename
  27765    5656     320   33741    83cd drivers/media/i2c/s5k5baf.o

after:
   text    data     bss     dec     hex filename
  27733    5600     256   33589    8335 drivers/media/i2c/s5k5baf.o

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: s5p-jpeg: Add stream error handling for Exynos5420
henryhsu [Fri, 30 Jun 2017 14:15:47 +0000 (10:15 -0400)]
media: s5p-jpeg: Add stream error handling for Exynos5420

On Exynos5420, the STREAM_STAT bit raised on the JPGINTST register means
there is a syntax error or an unrecoverable error on compressed file
when ERR_INT_EN is set to 1.

Fix this case and report BUF_STATE_ERROR to videobuf2.

Signed-off-by: Henry-Ruey Hsu <henryhsu@chromium.org>
Signed-off-by: Thierry Escande <thierry.escande@collabora.com>
Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: s5p-jpeg: Add support for resolution change event
henryhsu [Fri, 30 Jun 2017 14:15:46 +0000 (10:15 -0400)]
media: s5p-jpeg: Add support for resolution change event

This patch adds support for resolution change event to notify clients so
they can prepare correct output buffer. When resolution change happened,
G_FMT for CAPTURE should return old resolution and format before CAPTURE
queues streamoff.

This event is used in the Chromium browser project by the V4L2 JPEG
Decode Accelerator (V4L2JDA) to allocate output buffer.

Signed-off-by: Henry-Ruey Hsu <henryhsu@chromium.org>
Signed-off-by: Thierry Escande <thierry.escande@collabora.com>
Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: s5p-jpeg: Decode 4:1:1 chroma subsampling format
Tony K Nadackal [Fri, 30 Jun 2017 14:15:45 +0000 (10:15 -0400)]
media: s5p-jpeg: Decode 4:1:1 chroma subsampling format

This patch adds support for decoding 4:1:1 chroma subsampling in the
JPEG header parsing function.

Signed-off-by: Tony K Nadackal <tony.kn@samsung.com>
Signed-off-by: Thierry Escande <thierry.escande@collabora.com>
Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: s5p-jpeg: Split s5p_jpeg_parse_hdr()
Thierry Escande [Fri, 30 Jun 2017 14:15:44 +0000 (10:15 -0400)]
media: s5p-jpeg: Split s5p_jpeg_parse_hdr()

This patch moves the subsampling value decoding read from the JPEG
header into its own function. This new function is called
s5p_jpeg_subsampling_decode() and returns true if it successfully
decodes the subsampling value, false otherwise.

Signed-off-by: Thierry Escande <thierry.escande@collabora.com>
Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: s5p-jpeg: Don't use temporary structure in s5p_jpeg_buf_queue
Thierry Escande [Fri, 30 Jun 2017 14:15:43 +0000 (10:15 -0400)]
media: s5p-jpeg: Don't use temporary structure in s5p_jpeg_buf_queue

If s5p_jpeg_parse_hdr() fails to parse the JPEG header, the passed
s5p_jpeg_q_data structure is not modified so there is no need to use a
temporary structure and the field-by-field copy can be avoided.

Signed-off-by: Thierry Escande <thierry.escande@collabora.com>
Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: s5p-jpeg: Handle parsing error in s5p_jpeg_parse_hdr()
Thierry Escande [Fri, 30 Jun 2017 14:15:42 +0000 (10:15 -0400)]
media: s5p-jpeg: Handle parsing error in s5p_jpeg_parse_hdr()

This patch modifies the s5p_jpeg_parse_hdr() function so it only
modifies the passed s5p_jpeg_q_data structure if the jpeg header parsing
is successful.

Signed-off-by: Thierry Escande <thierry.escande@collabora.com>
Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: s5p-jpeg: Correct WARN_ON statement for checking subsampling
Tony K Nadackal [Fri, 30 Jun 2017 14:15:41 +0000 (10:15 -0400)]
media: s5p-jpeg: Correct WARN_ON statement for checking subsampling

Correct the WARN_ON statement for subsampling based on the
JPEG hardware version.

Signed-off-by: Tony K Nadackal <tony.kn@samsung.com>
Signed-off-by: Thierry Escande <thierry.escande@collabora.com>
Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: s5p-jpeg: Call jpeg_bound_align_image after qbuf
Tony K Nadackal [Fri, 30 Jun 2017 14:15:40 +0000 (10:15 -0400)]
media: s5p-jpeg: Call jpeg_bound_align_image after qbuf

When queuing an OUTPUT buffer for decoder, s5p_jpeg_parse_hdr()
function parses the input jpeg file and takes the width and height
parameters from its header. These new width/height values will be used
for the calculation of stride. HX_JPEG Hardware needs the width and
height values aligned on a 16 bits boundary. This width/height alignment
is handled in the s5p_jpeg_s_fmt_vid_cap() function during the S_FMT
ioctl call.

But if user space calls the QBUF of OUTPUT buffer after the S_FMT of
CAPTURE buffer, these aligned values will be replaced by the values in
jpeg header. If the width/height values of jpeg are not aligned, the
decoder output will be corrupted. So in this patch we call
jpeg_bound_align_image() to align the width/height values of Capture
buffer in s5p_jpeg_buf_queue().

Signed-off-by: Tony K Nadackal <tony.kn@samsung.com>
Signed-off-by: Thierry Escande <thierry.escande@collabora.com>
Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: get rid of a new bogus Sphinx 1.5 warning
Mauro Carvalho Chehab [Fri, 21 Jul 2017 12:15:56 +0000 (08:15 -0400)]
media: get rid of a new bogus Sphinx 1.5 warning

Documentation/media/uapi/cec/cec-api.rst:17: WARNING: uapi/cec/cec-funcs is already assigned section numbers (nested numbered toctree?)

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: v4l2-fwnode: fix a Sphinx warning
Mauro Carvalho Chehab [Fri, 21 Jul 2017 12:03:24 +0000 (08:03 -0400)]
media: v4l2-fwnode: fix a Sphinx warning

The kernel-doc tag is wrong there, causing this warning:
./include/media/v4l2-fwnode.h:66: warning: bad line:     index (1)

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb-core/demux.h: fix kernel-doc warning
Hans Verkuil [Sun, 16 Jul 2017 08:07:59 +0000 (04:07 -0400)]
media: dvb-core/demux.h: fix kernel-doc warning

Fix this kernel-doc warning:

WARNING: kernel-doc 'media-git/scripts/kernel-doc -rst -enable-lineno media-git/drivers/media/dvb-core/demux.h' processing failed with: 'ascii' codec can't decode byte 0xe2 in position 6368: ordinal
not in range(128)

Caused by using fancy quotes instead of regular quotes.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: Make parameter of media_entity_remote_pad() const
Todor Tomov [Mon, 3 Jul 2017 12:08:11 +0000 (08:08 -0400)]
media: Make parameter of media_entity_remote_pad() const

The local pad parameter in media_entity_remote_pad() is not modified.
Make that explicit by adding a const modifier.

Signed-off-by: Todor Tomov <todor.tomov@linaro.org>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: Added support for the TerraTec T1 DVB-T USB tuner [IT9135 chipset]
Nuno Henriques [Thu, 29 Jun 2017 17:55:54 +0000 (13:55 -0400)]
media: Added support for the TerraTec T1 DVB-T USB tuner [IT9135 chipset]

Signed-off-by: Nuno Henriques <nuno.amhenriques@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: : usb: add const to v4l2_file_operations structures
Bhumika Goyal [Thu, 29 Jun 2017 06:55:23 +0000 (02:55 -0400)]
media: : usb: add const to v4l2_file_operations structures

Declare v4l2_file_operations structures as const as they are only stored
in the fops field of video_device structures. This field is of type
const, so declare v4l2_file_operations structures with similar properties
as const.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb-frontends: mb86a16: remove useless variables in signal_det()
Gustavo A. R. Silva [Mon, 26 Jun 2017 23:50:16 +0000 (19:50 -0400)]
media: dvb-frontends: mb86a16: remove useless variables in signal_det()

Remove useless variables wait_t and wait_sym and code related.

Also, fix some coding style issues.

Addresses-Coverity-ID: 1226947

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: v4l2-fwnode: make v4l2_fwnode_endpoint_parse_csi1_bus static
Mauro Carvalho Chehab [Thu, 20 Jul 2017 20:27:27 +0000 (16:27 -0400)]
media: v4l2-fwnode: make v4l2_fwnode_endpoint_parse_csi1_bus static

This function is used only internally. So, make it static.
Shuts up this warning:

drivers/media/v4l2-core/v4l2-fwnode.c:153:6: warning: no previous prototype for 'v4l2_fwnode_endpoint_parse_csi1_bus' [-Wmissing-prototypes]
 void v4l2_fwnode_endpoint_parse_csi1_bus(struct fwnode_handle *fwnode,
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: v4l2-fwnode: suppress a warning at OF parsing logic
Mauro Carvalho Chehab [Mon, 26 Jun 2017 18:07:54 +0000 (14:07 -0400)]
media: v4l2-fwnode: suppress a warning at OF parsing logic

smatch produce this warning:
drivers/media/v4l2-core/v4l2-fwnode.c:76 v4l2_fwnode_endpoint_parse_csi_bus() error: buffer overflow 'array' 5 <= u16max

That's because, in thesis, the routine might have called with
some value at bus->num_data_lanes. That's not the current
case.

Yet, better to shut up this warning, and make the code more
reliable if some future changes might cause a bug.

While here, simplify the code a little bit by reading only
once from lanes-properties array.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: pvrusb2: fix the retry logic
Mauro Carvalho Chehab [Mon, 26 Jun 2017 12:33:56 +0000 (08:33 -0400)]
media: pvrusb2: fix the retry logic

As reported by this warning:
drivers/media/usb/pvrusb2/pvrusb2-encoder.c:263 pvr2_encoder_cmd() warn: continue to end of do { ... } while(0); loop

There's an issue at the retry logic there: the current logic is:

do {
if (need_to_retry)
continue;

some_code();
} while (0);

Well, that won't work, as continue will make it test for zero, and
abort the loop. So, change the loop to:

while (1) {
if (need_to_retry)
continue;

some_code();
break;
};

With seems to be what's actually expected there.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: atomisp: use LINUX_VERSION_CODE for driver version
Mauro Carvalho Chehab [Sat, 24 Jun 2017 20:40:27 +0000 (16:40 -0400)]
media: atomisp: use LINUX_VERSION_CODE for driver version

The atomisp subdev driver hardcodes its version to
ATOMISP_CSS_VERSION_21. Yet, it has several tests for versions
below 21 internally, with sounds really odd.

On all other media drivers, we're just keeping version set to
LINUX_VERSION_CODE.

So, do the same here, simplifying the code a little bit.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: cx25821: get rid of CX25821_VERSION_CODE
Mauro Carvalho Chehab [Sat, 24 Jun 2017 20:40:24 +0000 (16:40 -0400)]
media: cx25821: get rid of CX25821_VERSION_CODE

This is used just for printing a version number. As this is
never incremented, it makes no sense to keep it :-)

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: radio-bcm2048: get rid of BCM2048_DRIVER_VERSION
Mauro Carvalho Chehab [Sat, 24 Jun 2017 20:40:26 +0000 (16:40 -0400)]
media: radio-bcm2048: get rid of BCM2048_DRIVER_VERSION

This macro is never used. Get rid of it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: s3c-camif: use LINUX_VERSION_CODE for driver's version
Mauro Carvalho Chehab [Sat, 24 Jun 2017 20:40:25 +0000 (16:40 -0400)]
media: s3c-camif: use LINUX_VERSION_CODE for driver's version

We seldomly increment version numbers on drivers, because... we
usually forget ;-)

So, instead, just make it identical to the Kernel version, as what
we do on all other drivers.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Acked-by: Sylwester Nawrocki <snawrocki@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: platform: davinci: drop VPFE_CMD_S_CCDC_RAW_PARAMS
Prabhakar Lad [Thu, 20 Jul 2017 08:56:31 +0000 (04:56 -0400)]
media: platform: davinci: drop VPFE_CMD_S_CCDC_RAW_PARAMS

drop VPFE_CMD_S_CCDC_RAW_PARAMS ioctl from dm355/dm644x following reasons:

- This ioctl was never in public api and was only defined in kernel header.
- The function set_params constantly mixes up pointers and phys_addr_t
  numbers.
- This is part of a 'VPFE_CMD_S_CCDC_RAW_PARAMS' ioctl command that is
  described as an 'experimental ioctl that will change in future kernels'.
- The code to allocate the table never gets called after we copy_from_user
  the user input over the kernel settings, and then compare them
  for inequality.
- We then go on to use an address provided by user space as both the
  __user pointer for input and pass it through phys_to_virt to come up
  with a kernel pointer to copy the data to. This looks like a trivially
  exploitable root hole.

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@s-opensource.com>
7 years agomedia: platform: davinci: return -EINVAL for VPFE_CMD_S_CCDC_RAW_PARAMS ioctl
Prabhakar Lad [Thu, 20 Jul 2017 12:02:09 +0000 (08:02 -0400)]
media: platform: davinci: return -EINVAL for VPFE_CMD_S_CCDC_RAW_PARAMS ioctl

this patch makes sure VPFE_CMD_S_CCDC_RAW_PARAMS ioctl no longer works
for vpfe_capture driver with a minimal patch suitable for backporting.

- This ioctl was never in public api and was only defined in kernel header.
- The function set_params constantly mixes up pointers and phys_addr_t
  numbers.
- This is part of a 'VPFE_CMD_S_CCDC_RAW_PARAMS' ioctl command that is
  described as an 'experimental ioctl that will change in future kernels'.
- The code to allocate the table never gets called after we copy_from_user
  the user input over the kernel settings, and then compare them
  for inequality.
- We then go on to use an address provided by user space as both the
  __user pointer for input and pass it through phys_to_virt to come up
  with a kernel pointer to copy the data to. This looks like a trivially
  exploitable root hole.

Due to these reasons we make sure this ioctl now returns -EINVAL and backport
this patch as far as possible.

Fixes: 5f15fbb68fd7 ("V4L/DVB (12251): v4l: dm644x ccdc module for vpfe capture driver")

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Cc: <stable@vger.kernel.org> # for v3.7 and up
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: venus: don't abuse dma_alloc for non-DMA allocations
Stanimir Varbanov [Wed, 19 Jul 2017 11:51:37 +0000 (07:51 -0400)]
media: venus: don't abuse dma_alloc for non-DMA allocations

In venus_boot(), we pass a pointer to a phys_addr_t
into dmam_alloc_coherent, which the compiler warns about:

platform/qcom/venus/firmware.c: In function 'venus_boot':
platform/qcom/venus/firmware.c:63:49: error: passing argument 3 of 'dmam_alloc_coherent' from incompatible pointer type [-Werror=incompatible-pointer-types]

To avoid the error refactor venus_boot function by discard
dma_alloc_coherent invocation because we don't want to map the
memory for the device.  Something more, the usage of
DMA mapping API is actually wrong and the current
implementation relies on several bugs in DMA mapping code.
When these bugs are fixed that will break firmware loading,
so fix this now to avoid future troubles.

The meaning of venus_boot is to copy the content of the
firmware buffer into reserved (and memblock removed)
block of memory and pass that physical address to the
trusted zone for authentication and mapping through iommu
form the secure world. After iommu mapping is done the iova
is passed as ane entry point to the remote processor.

After this change memory-region property is parsed manually
and the physical address is memremap to CPU, call mdt_load to
load firmware segments into proper places and unmap
reserved memory.

Fixes: af2c3834c8ca ("[media] media: venus: adding core part and helper functions")

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: venus: hfi: fix error handling in hfi_sys_init_done()
Rob Clark [Mon, 17 Jul 2017 08:56:50 +0000 (04:56 -0400)]
media: venus: hfi: fix error handling in hfi_sys_init_done()

Not entirely sure what triggers it, but with venus build as kernel
module and in initrd, we hit this crash:

  Unable to handle kernel paging request at virtual address ffff80003c039000
  pgd = ffff00000a14f000
  [ffff80003c039000] *pgd=00000000bd9f7003, *pud=00000000bd9f6003, *pmd=00000000bd9f0003, *pte=0000000000000000
  Internal error: Oops: 96000007 [#1] SMP
  Modules linked in: qcom_wcnss_pil(E+) crc32_ce(E) qcom_common(E) venus_core(E+) remoteproc(E) snd_soc_msm8916_digital(E) virtio_ring(E) cdc_ether(E) snd_soc_lpass_apq8016(E) snd_soc_lpass_cpu(E) snd_soc_apq8016_sbc(E) snd_soc_lpass_platform(E) v4l2_mem2mem(E) virtio(E) snd_soc_core(E) ac97_bus(E) snd_pcm_dmaengine(E) snd_seq(E) leds_gpio(E) videobuf2_v4l2(E) videobuf2_core(E) snd_seq_device(E) snd_pcm(E) videodev(E) media(E) nvmem_qfprom(E) msm(E) snd_timer(E) snd(E) soundcore(E) spi_qup(E) mdt_loader(E) qcom_tsens(E) qcom_spmi_temp_alarm(E) nvmem_core(E) msm_rng(E) uas(E) usb_storage(E) dm9601(E) usbnet(E) mii(E) mmc_block(E) adv7511(E) drm_kms_helper(E) syscopyarea(E) sysfillrect(E) sysimgblt(E) fb_sys_fops(E) qcom_spmi_vadc(E) qcom_vadc_common(PE) industrialio(E) pinctrl_spmi_mpp(E)
   pinctrl_spmi_gpio(E) rtc_pm8xxx(E) clk_smd_rpm(E) sdhci_msm(E) sdhci_pltfm(E) qcom_smd_regulator(E) drm(E) smd_rpm(E) qcom_spmi_pmic(E) regmap_spmi(E) ci_hdrc_msm(E) ci_hdrc(E) usb3503(E) extcon_usb_gpio(E) phy_msm_usb(E) udc_core(E) qcom_hwspinlock(E) extcon_core(E) ehci_msm(E) i2c_qup(E) sdhci(E) mmc_core(E) spmi_pmic_arb(E) spmi(E) qcom_smd(E) smsm(E) rpmsg_core(E) smp2p(E) smem(E) hwspinlock_core(E) gpio_keys(E)
  CPU: 2 PID: 551 Comm: irq/150-venus Tainted: P            E   4.12.0+ #1625
  Hardware name: qualcomm dragonboard410c/dragonboard410c, BIOS 2017.07-rc2-00144-ga97bdbdf72-dirty 07/08/2017
  task: ffff800037338000 task.stack: ffff800038e00000
  PC is at hfi_sys_init_done+0x64/0x140 [venus_core]
  LR is at hfi_process_msg_packet+0xcc/0x1e8 [venus_core]
  pc : [<ffff00000118b384>] lr : [<ffff00000118c11c>] pstate: 20400145
  sp : ffff800038e03c60
  x29: ffff800038e03c60 x28: 0000000000000000
  x27: 00000000000df018 x26: ffff00000118f4d0
  x25: 0000000000020003 x24: ffff80003a8d3010
  x23: ffff00000118f760 x22: ffff800037b40028
  x21: ffff8000382981f0 x20: ffff800037b40028
  x19: ffff80003c039000 x18: 0000000000000020
  x17: 0000000000000000 x16: ffff800037338000
  x15: ffffffffffffffff x14: 0000001000000014
  x13: 0000000100001007 x12: 0000000100000020
  x11: 0000100e00000000 x10: 0000000000000001
  x9 : 0000000200000000 x8 : 0000001400000001
  x7 : 0000000000001010 x6 : 0000000000000148
  x5 : 0000000000001009 x4 : ffff80003c039000
  x3 : 00000000cd770abb x2 : 0000000000000042
  x1 : 0000000000000788 x0 : 0000000000000002
  Process irq/150-venus (pid: 551, stack limit = 0xffff800038e00000)
  Call trace:
  [<ffff00000118b384>] hfi_sys_init_done+0x64/0x140 [venus_core]
  [<ffff00000118c11c>] hfi_process_msg_packet+0xcc/0x1e8 [venus_core]
  [<ffff00000118a2b4>] venus_isr_thread+0x1b4/0x208 [venus_core]
  [<ffff00000118e750>] hfi_isr_thread+0x28/0x38 [venus_core]
  [<ffff000008161550>] irq_thread_fn+0x30/0x70
  [<ffff0000081617fc>] irq_thread+0x14c/0x1c8
  [<ffff000008105e68>] kthread+0x138/0x140
  [<ffff000008083590>] ret_from_fork+0x10/0x40
  Code: 52820125 52820207 7a431820 54000249 (b9400263)
  ---[ end trace c963460f20a984b6 ]---

The problem is that in the error case, we've incremented the data ptr
but not decremented rem_bytes, and keep reading (presumably garbage)
until eventually we go beyond the end of the buffer.

Instead, on first error, we should probably just bail out.  Other
option is to increment read_bytes by sizeof(u32) before the switch,
rather than only accounting for the ptype header in the non-error
case.  Note that in this case it is HFI_ERR_SYS_INVALID_PARAMETER,
ie. an unrecognized/unsupported parameter, so interpreting the next
word as a property type would be bogus.  The other error cases are
due to truncated buffer, so there isn't likely to be anything valid
to interpret in the remainder of the buffer.  So just bailing seems
like a reasonable solution.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: venus: fix compile-test build on non-qcom ARM platform
Arnd Bergmann [Mon, 17 Jul 2017 08:56:49 +0000 (04:56 -0400)]
media: venus: fix compile-test build on non-qcom ARM platform

If QCOM_MDT_LOADER is enabled, but ARCH_QCOM is not, we run into
a build error:

ERROR: "qcom_mdt_load" [drivers/media/platform/qcom/venus/venus-core.ko] undefined!
ERROR: "qcom_mdt_get_size" [drivers/media/platform/qcom/venus/venus-core.ko] undefined!

This changes the 'select' statement again, so we only try to enable
those symbols when the drivers will actually get built, and explicitly
test for QCOM_MDT_LOADER to be enabled before calling into it.

Fixes: 76724b30f222 ("[media] media: venus: enable building with COMPILE_TEST")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: venus: mark PM functions as __maybe_unused
Arnd Bergmann [Mon, 17 Jul 2017 08:56:47 +0000 (04:56 -0400)]
media: venus: mark PM functions as __maybe_unused

Without PM support, gcc warns about two unused functions:

platform/qcom/venus/core.c:146:13: error: 'venus_clks_disable' defined but not used [-Werror=unused-function]
platform/qcom/venus/core.c:126:12: error: 'venus_clks_enable' defined but not used [-Werror=unused-function]

The problem as usual are incorrect #ifdefs, so the easiest fix
is to do away with the #ifdef completely and mark the suspend/resume
handlers as __maybe_unused, which they are.

Fixes: af2c3834c8ca ("[media] media: venus: adding core part and helper functions")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb_ca_en50221.h: fix checkpatch strict warnings
Mauro Carvalho Chehab [Thu, 20 Jul 2017 19:46:10 +0000 (15:46 -0400)]
media: dvb_ca_en50221.h: fix checkpatch strict warnings

As we're already touching on dvb_ca_en50221 to cleanup
checkpatch issues, do that also for its header file, with:

$ ./scripts/checkpatch.pl --strict --fix-inplace -f drivers/media/dvb-core/dvb_ca_en50221.h

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb_ca_en50221: Fixed multiple blank lines
Jasmin Jessich [Sun, 16 Jul 2017 00:43:17 +0000 (20:43 -0400)]
media: dvb_ca_en50221: Fixed multiple blank lines

- Running "checkpatch.pl -strict -f ..." complained
  * Please don't use multiple blank lines

Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb_ca_en50221: Fixed style issues on the whole file
Jasmin Jessich [Sun, 16 Jul 2017 00:43:16 +0000 (20:43 -0400)]
media: dvb_ca_en50221: Fixed style issues on the whole file

- Running "checkpatch.pl -strict -f ..." gave more checks to fix.
  * Blank lines aren't necessary after an open brace '{'
  * Comparison to NULL written as "!<var>"
  * CHECK: Blank lines aren't necessary before a close brace '}'

Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb_ca_en50221: Fixed remaining block comments
Jasmin Jessich [Sun, 16 Jul 2017 00:43:15 +0000 (20:43 -0400)]
media: dvb_ca_en50221: Fixed remaining block comments

- Added the missing opening empty comment line.

Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb_ca_en50221: Fix again wrong EXPORT_SYMBOL order
Jasmin Jessich [Sun, 16 Jul 2017 00:43:14 +0000 (20:43 -0400)]
media: dvb_ca_en50221: Fix again wrong EXPORT_SYMBOL order

Some EXPORT_SYMBOL() on this file don't match the name of functions
that precedes them.

Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb_ca_en50221: Fixed typo
Jasmin Jessich [Sun, 16 Jul 2017 00:43:13 +0000 (20:43 -0400)]
media: dvb_ca_en50221: Fixed typo

- "dont" -> "don't"

Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb_ca_en50221: Fixed 80 char limit
Jasmin Jessich [Sun, 16 Jul 2017 00:43:12 +0000 (20:43 -0400)]
media: dvb_ca_en50221: Fixed 80 char limit

Fixed most of:
  WARNING: line over 80 characters
The remaining lines are printk strings, which should not be split and
lines where I thing they should stay as they are.

Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb_ca_en50221: Fixed C++ comments
Jasmin Jessich [Sun, 16 Jul 2017 00:43:11 +0000 (20:43 -0400)]
media: dvb_ca_en50221: Fixed C++ comments

- Changed all C++ style comments ("// ..") to C style ones ("/* .. */").

Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb_ca_en50221: Removed unused symbol
Jasmin Jessich [Sun, 16 Jul 2017 00:43:10 +0000 (20:43 -0400)]
media: dvb_ca_en50221: Removed unused symbol

- The STATUSREG_TXERR definition is not used and it has style
  problems, too.  Removing it seems to solve both issues.

Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb_ca_en50221: Removed useless braces
Jasmin Jessich [Sun, 16 Jul 2017 00:43:09 +0000 (20:43 -0400)]
media: dvb_ca_en50221: Removed useless braces

Fixed all:
  WARNING: braces {} are not necessary for single statement blocks

Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb_ca_en50221: Added line breaks
Jasmin Jessich [Sun, 16 Jul 2017 00:43:08 +0000 (20:43 -0400)]
media: dvb_ca_en50221: Added line breaks

Fixed all:
  WARNING: Missing a blank line after declarations

Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb_ca_en50221: Used a helper variable
Jasmin Jessich [Sun, 16 Jul 2017 00:43:07 +0000 (20:43 -0400)]
media: dvb_ca_en50221: Used a helper variable

Used a helper variable "struct dvb_ca_slot *sl" instead of
"ca->slot_info[slot]". This reduces the line length and simplifies
code reading.

Fixed also "-strict" checks in this patch:
- Comparison to NULL written as "!<var>".

Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb_ca_en50221: Avoid assignments in ifs
Jasmin Jessich [Sun, 16 Jul 2017 00:43:06 +0000 (20:43 -0400)]
media: dvb_ca_en50221: Avoid assignments in ifs

Fixed all:
  ERROR: do not use assignment in if condition

Fixed also "-strict" checks in this patch:
- Changed "if (ret != 0)" to "if (ret)".
- Camel case variables have been converted to kernel_case.
- Comparison to NULL written as "!<var>".
- No space is necessary after a cast.

Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb_ca_en50221: Fixed block comments
Jasmin Jessich [Sun, 16 Jul 2017 00:43:05 +0000 (20:43 -0400)]
media: dvb_ca_en50221: Fixed block comments

Fixed all:
  WARNING: Block comments use * on subsequent lines
Added also the missing opening empty comment line.

Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb_ca_en50221: use usleep_range
Jasmin Jessich [Sun, 16 Jul 2017 00:43:04 +0000 (20:43 -0400)]
media: dvb_ca_en50221: use usleep_range

Fixed all:
  WARNING: msleep < 20ms can sleep for up to 20ms
by using usleep_range.

Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb_ca_en50221: New function dvb_ca_en50221_poll_cam_gone
Jasmin Jessich [Sun, 16 Jul 2017 00:43:03 +0000 (20:43 -0400)]
media: dvb_ca_en50221: New function dvb_ca_en50221_poll_cam_gone

The CAM poll code for the budget-av is exactly the same on several
places. Extracting the code to a new function improves maintainability.

Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb_ca_en50221: Refactored dvb_ca_en50221_thread
Jasmin Jessich [Sun, 16 Jul 2017 00:43:02 +0000 (20:43 -0400)]
media: dvb_ca_en50221: Refactored dvb_ca_en50221_thread

Refactored "dvb_ca_en50221_thread" by moving the state machine into the
new function "dvb_ca_en50221_thread_state_machine". This reduces the
thread function size and reduces the structural complexity and of course
gives us more space to meet the line length goal in the new function.

Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb-frontends/stv0367: improve QAM fe_status
Daniel Scheller [Fri, 14 Jul 2017 21:23:36 +0000 (17:23 -0400)]
media: dvb-frontends/stv0367: improve QAM fe_status

While cab_state->state gives a quite accurate indication of the demod
signal status, it might be incorrect if cab_algo() wasn't able to
determine the exact status, with cab_algo() being the only place where
this status was updated from, and it is only called upon tuning to new
parameters passed to set_frontend(). Thus, the status will be wrong
until the demod is retuned. With the cab_signal_type parsing in
read_status(), this results in unusual fe_states like FE_HAS_SIGNAL |
FE_HAS_CARRIER | FE_HAS_LOCK, which, while userspace applications check
for FE_HAS_LOCK and work fine, leads to missing CNR or UCB stats.

Fix this by re-reading CAB_FSM_STATUS and updating cab_state->state() in
read_status(). While at it, refactor the fsm/qamfeclock and the
fsm->signaltype parsing into separate functions to make things cleaner
and deduplicate code. Also, assume full QAM FEC lock equals full
FE_STATUS.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: devnode: Rename mdev argument as devnode
Sakari Ailus [Thu, 13 Jul 2017 15:23:49 +0000 (11:23 -0400)]
media: devnode: Rename mdev argument as devnode

Historically, mdev argument name was being used on both struct
media_device and struct media_devnode. Recently most occurrences of mdev
referring to struct media_devnode were replaced by devnode, which makes
more sense. Fix the last remaining occurrence.

Fixes: 163f1e93e9950 ("[media] media-devnode: fix namespace mess")

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: Remove useless curly braces and parentheses
Sakari Ailus [Thu, 13 Jul 2017 15:23:48 +0000 (11:23 -0400)]
media: Remove useless curly braces and parentheses

Simplify the code to satisfy Linux coding style.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dib0090: make const array dib0090_tuning_table_cband_7090e_aci static
Colin Ian King [Thu, 13 Jul 2017 12:00:20 +0000 (08:00 -0400)]
media: dib0090: make const array dib0090_tuning_table_cband_7090e_aci static

Don't populate array dib0090_tuning_table_cband_7090e_aci on the stack but
instead make it static. Makes the object code smaller by over 180 bytes:

Before:
   text    data     bss     dec     hex filename
  40052    7320     192   47564    b9cc dib0090.o

After:
   text    data     bss     dec     hex filename
  39780    7408     192   47380    b914 dib0090.o

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: drxj: make several const arrays static
Colin Ian King [Thu, 13 Jul 2017 11:44:03 +0000 (07:44 -0400)]
media: drxj: make several const arrays static

Don't populate const arrays on the stack but instead make them static.
Makes the object code smaller by over 1800 bytes:

Before:
   text    data     bss     dec     hex filename
  94100    9160       0  103260   1935c drxj.o

After:
   text    data     bss     dec     hex filename
  91044   10400       0  101444   18c44 drxj.o

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: drxd: make const arrays slowIncrDecLUT and fastIncrDecLUT static
Colin Ian King [Thu, 13 Jul 2017 11:34:28 +0000 (07:34 -0400)]
media: drxd: make const arrays slowIncrDecLUT and fastIncrDecLUT static

Don't populate arrays slowIncrDecLUT and fastIncrDecLUT on the stack but
instead make them static. Makes the object code smaller by over 100 bytes:

   text    data     bss     dec     hex filename
  27776     832      64   28672    7000 drxd_hard.o

   text    data     bss     dec     hex filename
  27530     976      64   28570    6f9a drxd_hard.o

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb-frontends/cxd2841er: do sleep on delivery system change
Daniel Scheller [Tue, 11 Jul 2017 21:06:05 +0000 (17:06 -0400)]
media: dvb-frontends/cxd2841er: do sleep on delivery system change

Discovered using w_scan when scanning DVB-T/T2: When w_scan goes from -T
to -T2, it does so without stopping the frontend using .sleep. Due to
this, the demod operation mode isn't re-setup, but as it still is in
STATE_ACTIVE_TC, PLP and T2 Profile are set up, but only retune_active()
is called, leaving the demod in T mode, thus not operable on any T2
frequency.

Fix this by putting the demod to sleep if priv->system isn't equal to
p->delsys. To properly accomplish this, sleep_tc() is split into
sleep_tc() and shutdown_tc(), where sleep_tc() will only perform the
sleep operation, while shutdown_tc() additionally performs the full
demod shutdown (to keep the behaviour when the .sleep FE_OP is called).

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: staging: fbtft: make const array gamma_par_mask static
Colin Ian King [Tue, 11 Jul 2017 17:20:02 +0000 (13:20 -0400)]
media: staging: fbtft: make const array gamma_par_mask static

Don't populate array gamma_par_mask on the stack but instead make it
static.  Makes the object code smaller by 148 bytes:

Before:
   text    data     bss     dec     hex filename
   2993    1104       0    4097    1001 drivers/staging/fbtft/fb_st7789v.o

After:
   text    data     bss     dec     hex filename
   2757    1192       0    3949     f6d drivers/staging/fbtft/fb_st7789v.o

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb-frontends/cxd2841er: make several arrays static
Colin Ian King [Mon, 10 Jul 2017 13:54:27 +0000 (09:54 -0400)]
media: dvb-frontends/cxd2841er: make several arrays static

Don't populate arrays on the stack but make them static.  Makes
the object code smaller:

Before:
   text    data     bss     dec     hex filename
  89299   21704      64  111067   1b1db cxd2841er.o

After:
   text    data     bss     dec     hex filename
  85823   23432      64  109319   1ab07 cxd2841er.o

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: media/dvb: earth-pt3: fix hang-up in a rare case
Akihiro Tsukada [Mon, 10 Jul 2017 08:40:13 +0000 (04:40 -0400)]
media: media/dvb: earth-pt3: fix hang-up in a rare case

When a user starts and stops filtering at a demux device too quickly
in a very short interval, the user process hangs in uninterruptible sleep,
due to an inconsistency of kthread status in the driver.
The kthread can be stopped before it starts running its thread function,
but the invocation status was partly managed in the kthread function,
which resulted in a double kthread_stop() of one kthread.

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: ngene: constify i2c_algorithm structure
Gustavo A. R. Silva [Mon, 10 Jul 2017 01:12:37 +0000 (21:12 -0400)]
media: ngene: constify i2c_algorithm structure

Check for i2c_algorithm structures that are only stored in
the algo field of an i2c_adapter structure. This field is
declared const, so i2c_algorithm structures that have this
property can be declared as const also.

This issue was identified using Coccinelle and the following
semantic patch:

@r disable optional_qualifier@
identifier i;
position p;
@@
static struct i2c_algorithm i@p = { ... };

@ok@
identifier r.i;
struct i2c_adapter e;
position p;
@@
e.algo = &i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct i2c_algorithm i = { ... };

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: mantis: constify i2c_algorithm structure
Gustavo A. R. Silva [Mon, 10 Jul 2017 01:10:00 +0000 (21:10 -0400)]
media: mantis: constify i2c_algorithm structure

Check for i2c_algorithm structures that are only stored in
the algo field of an i2c_adapter structure. This field is
declared const, so i2c_algorithm structures that have this
property can be declared as const also.

This issue was identified using Coccinelle and the following
semantic patch:

@r disable optional_qualifier@
identifier i;
position p;
@@
static struct i2c_algorithm i@p = { ... };

@ok@
identifier r.i;
struct i2c_adapter e;
position p;
@@
e.algo = &i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct i2c_algorithm i = { ... };

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dm1105: constify i2c_algorithm structure
Gustavo A. R. Silva [Mon, 10 Jul 2017 01:19:36 +0000 (21:19 -0400)]
media: dm1105: constify i2c_algorithm structure

Check for i2c_algorithm structures that are only stored in
the algo field of an i2c_adapter structure. This field is
declared const, so i2c_algorithm structures that have this
property can be declared as const also.

This issue was identified using Coccinelle and the following
semantic patch:

@r disable optional_qualifier@
identifier i;
position p;
@@
static struct i2c_algorithm i@p = { ... };

@ok@
identifier r.i;
struct i2c_adapter e;
position p;
@@
e.algo = &i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct i2c_algorithm i = { ... };

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: ddbridge: constify i2c_algorithm structure
Gustavo A. R. Silva [Mon, 10 Jul 2017 01:15:36 +0000 (21:15 -0400)]
media: ddbridge: constify i2c_algorithm structure

Check for i2c_algorithm structures that are only stored in
the algo field of an i2c_adapter structure. This field is
declared const, so i2c_algorithm structures that have this
property can be declared as const also.

This issue was identified using Coccinelle and the following
semantic patch:

@r disable optional_qualifier@
identifier i;
position p;
@@
static struct i2c_algorithm i@p = { ... };

@ok@
identifier r.i;
struct i2c_adapter e;
position p;
@@
e.algo = &i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct i2c_algorithm i = { ... };

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: cx24123: constify i2c_algorithm structure
Gustavo A. R. Silva [Mon, 10 Jul 2017 01:06:51 +0000 (21:06 -0400)]
media: cx24123: constify i2c_algorithm structure

Check for i2c_algorithm structures that are only stored in
the algo field of an i2c_adapter structure. This field is
declared const, so i2c_algorithm structures that have this
property can be declared as const also.

This issue was identified using Coccinelle and the following
semantic patch:

@r disable optional_qualifier@
identifier i;
position p;
@@
static struct i2c_algorithm i@p = { ... };

@ok@
identifier r.i;
struct i2c_adapter e;
position p;
@@
e.algo = &i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct i2c_algorithm i = { ... };

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: zd1301_demod: constify i2c_algorithm structure
Gustavo A. R. Silva [Mon, 10 Jul 2017 01:03:52 +0000 (21:03 -0400)]
media: zd1301_demod: constify i2c_algorithm structure

Check for i2c_algorithm structures that are only stored in
the algo field of an i2c_adapter structure. This field is
declared const, so i2c_algorithm structures that have this
property can be declared as const also.

This issue was identified using Coccinelle and the following
semantic patch:

@r disable optional_qualifier@
identifier i;
position p;
@@
static struct i2c_algorithm i@p = { ... };

@ok@
identifier r.i;
struct i2c_adapter e;
position p;
@@
e.algo = &i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct i2c_algorithm i = { ... };

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dib8000: constify i2c_algorithm structure
Gustavo A. R. Silva [Mon, 10 Jul 2017 01:00:33 +0000 (21:00 -0400)]
media: dib8000: constify i2c_algorithm structure

Check for i2c_algorithm structures that are only stored in
the algo field of an i2c_adapter structure. This field is
declared const, so i2c_algorithm structures that have this
property can be declared as const also.

This issue was identified using Coccinelle and the following
semantic patch:

@r disable optional_qualifier@
identifier i;
position p;
@@
static struct i2c_algorithm i@p = { ... };

@ok@
identifier r.i;
struct i2c_adapter e;
position p;
@@
e.algo = &i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct i2c_algorithm i = { ... };

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: s5h1420: constify i2c_algorithm structure
Gustavo A. R. Silva [Mon, 10 Jul 2017 00:57:06 +0000 (20:57 -0400)]
media: s5h1420: constify i2c_algorithm structure

Check for i2c_algorithm structures that are only stored in
the algo field of an i2c_adapter structure. This field is
declared const, so i2c_algorithm structures that have this
property can be declared as const also.

This issue was identified using Coccinelle and the following
semantic patch:

@r disable optional_qualifier@
identifier i;
position p;
@@
static struct i2c_algorithm i@p = { ... };

@ok@
identifier r.i;
struct i2c_adapter e;
position p;
@@
e.algo = &i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct i2c_algorithm i = { ... };

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dib7000p: constify i2c_algorithm structure
Gustavo A. R. Silva [Sun, 9 Jul 2017 22:18:15 +0000 (18:18 -0400)]
media: dib7000p: constify i2c_algorithm structure

Check for i2c_algorithm structures that are only stored in
the algo field of an i2c_adapter structure. This field is
declared const, so i2c_algorithm structures that have this
property can be declared as const also.

This issue was identified using Coccinelle and the following
semantic patch:

@r disable optional_qualifier@
identifier i;
position p;
@@
static struct i2c_algorithm i@p = { ... };

@ok@
identifier r.i;
struct i2c_adapter e;
position p;
@@
e.algo = &i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct i2c_algorithm i = { ... };

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: marvell-ccic: constify i2c_algorithm structure
Gustavo A. R. Silva [Sun, 9 Jul 2017 22:14:38 +0000 (18:14 -0400)]
media: marvell-ccic: constify i2c_algorithm structure

Check for i2c_algorithm structures that are only stored in
the algo field of an i2c_adapter structure. This field is
declared const, so i2c_algorithm structures that have this
property can be declared as const also.

This issue was identified using Coccinelle and the following
semantic patch:

@r disable optional_qualifier@
identifier i;
position p;
@@
static struct i2c_algorithm i@p = { ... };

@ok@
identifier r.i;
struct i2c_adapter e;
position p;
@@
e.algo = &i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct i2c_algorithm i = { ... };

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: saa7146: constify i2c_algorithm structure
Gustavo A. R. Silva [Sun, 9 Jul 2017 22:09:16 +0000 (18:09 -0400)]
media: saa7146: constify i2c_algorithm structure

Check for i2c_algorithm structures that are only stored in
the algo field of an i2c_adapter structure. This field is
declared const, so i2c_algorithm structures that have this
property can be declared as const also.

This issue was identified using Coccinelle and the following
semantic patch:

@r disable optional_qualifier@
identifier i;
position p;
@@
static struct i2c_algorithm i@p = { ... };

@ok@
identifier r.i;
struct i2c_adapter e;
position p;
@@
e.algo = &i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct i2c_algorithm i = { ... };

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dib9000: constify i2c_algorithm structure
Gustavo A. R. Silva [Sun, 9 Jul 2017 22:24:19 +0000 (18:24 -0400)]
media: dib9000: constify i2c_algorithm structure

Check for i2c_algorithm structures that are only stored in
the algo field of an i2c_adapter structure. This field is
declared const, so i2c_algorithm structures that have this
property can be declared as const also.

This issue was identified using Coccinelle and the following
semantic patch:

@r disable optional_qualifier@
identifier i;
position p;
@@
static struct i2c_algorithm i@p = { ... };

@ok@
identifier r.i;
struct i2c_adapter e;
position p;
@@
e.algo = &i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct i2c_algorithm i = { ... };

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: usbvision: constify i2c_algorithm structure
Gustavo A. R. Silva [Sun, 9 Jul 2017 22:04:24 +0000 (18:04 -0400)]
media: usbvision: constify i2c_algorithm structure

Check for i2c_algorithm structures that are only stored in
the algo field of an i2c_adapter structure. This field is
declared const, so i2c_algorithm structures that have this
property can be declared as const also.

This issue was identified using Coccinelle and the following
semantic patch:

@r disable optional_qualifier@
identifier i;
position p;
@@
static struct i2c_algorithm i@p = { ... };

@ok@
identifier r.i;
struct i2c_adapter e;
position p;
@@
e.algo = &i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct i2c_algorithm i = { ... };

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb-ttusb-budget: constify i2c_algorithm structure
Gustavo A. R. Silva [Sun, 9 Jul 2017 21:41:08 +0000 (17:41 -0400)]
media: dvb-ttusb-budget: constify i2c_algorithm structure

Check for i2c_algorithm structures that are only stored in
the algo field of an i2c_adapter structure. This field is
declared const, so i2c_algorithm structures that have this
property can be declared as const also.

This issue was identified using Coccinelle and the following
semantic patch:

@r disable optional_qualifier@
identifier i;
position p;
@@
static struct i2c_algorithm i@p = { ... };

@ok@
identifier r.i;
struct i2c_adapter e;
position p;
@@
e.algo = &i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct i2c_algorithm i = { ... };

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb-frontends/stv0367: DDB frontend status inquiry fixup
Daniel Scheller [Sun, 9 Jul 2017 16:36:45 +0000 (12:36 -0400)]
media: dvb-frontends/stv0367: DDB frontend status inquiry fixup

Return 0 instead of -EINVAL in get_frontend if no demod mode is active.
This fixes ie. dvb-fe-tool getting confused and assuming a DVBv3 FE on idle
frontends when the FE has been put to sleep using sleep().

Also, in read_status(), don't immediately return when no demod is active,
so the remaining code has a chance to clear the signal statistics.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: MAINTAINERS: add entries for stv0910 and stv6111
Daniel Scheller [Mon, 3 Jul 2017 17:21:03 +0000 (13:21 -0400)]
media: MAINTAINERS: add entries for stv0910 and stv6111

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: ddbridge: stv0910 single demod mode module option
Daniel Scheller [Mon, 3 Jul 2017 17:21:02 +0000 (13:21 -0400)]
media: ddbridge: stv0910 single demod mode module option

Adds a stv0910_single modparm which, when set, configures the stv0910 to
run in single demodulator mode, currently intended for high bit rate
testing.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Tested-by: Richard Scobie <r.scobie@clear.net.nz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: ddbridge: support for CineS2 V7(A) and DuoFlex S2 V4 hardware
Daniel Scheller [Mon, 3 Jul 2017 17:21:01 +0000 (13:21 -0400)]
media: ddbridge: support for CineS2 V7(A) and DuoFlex S2 V4 hardware

This adds all required glue code to support - in conjunction with the new
stv0910 and stv6111 demod/tuner drivers and additionally the lnbh25 LNB
controller driver - all current DVB-S/S2 hardware (bridges and flex
modules) from Digital Devices like the DD CineS2 V7 and V7A, current
S2 V4 DuoFlex modules, and probably all upcoming devices based on this
STV0910/STV6111/LNBH25 hardware stack.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Tested-by: Richard Scobie <r.scobie@clear.net.nz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: ddbridge: return stv09xx id in port_has_stv0900_aa()
Daniel Scheller [Mon, 3 Jul 2017 17:21:00 +0000 (13:21 -0400)]
media: ddbridge: return stv09xx id in port_has_stv0900_aa()

The returned value is required for further evaluation of the exact
demodulator chip (stv090x or stv0910).

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Tested-by: Richard Scobie <r.scobie@clear.net.nz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb-frontends: add ST STV6111 DVB-S/S2 tuner frontend driver
Daniel Scheller [Mon, 3 Jul 2017 17:20:59 +0000 (13:20 -0400)]
media: dvb-frontends: add ST STV6111 DVB-S/S2 tuner frontend driver

This adds a frontend driver for the ST STV6111 DVB-S/S2 tuners. Like the
stv0910 demod frontend driver, this driver originates from the Digital
Devices' dddvb vendor driver package as of version 0.9.29, and was cleaned
up aswell. No functionality had to be removed though. Any camel case has
been converted to kernel_case, fixup patch has been proposed upstream.

Permission to reuse and mainline the driver code was formally granted by
Ralph Metzler <rjkm@metzlerbros.de>.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Tested-by: Richard Scobie <r.scobie@clear.net.nz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb-frontends/stv0910: Add missing set_frontend fe-op
Daniel Scheller [Mon, 3 Jul 2017 17:20:58 +0000 (13:20 -0400)]
media: dvb-frontends/stv0910: Add missing set_frontend fe-op

This was missing from the frontend_ops.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Tested-by: Richard Scobie <r.scobie@clear.net.nz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb-frontends/stv0910: Add demod-only signal strength reporting
Daniel Scheller [Mon, 3 Jul 2017 17:20:57 +0000 (13:20 -0400)]
media: dvb-frontends/stv0910: Add demod-only signal strength reporting

Original code at least has some signed/unsigned issues, resulting in
values like 32dBm. Implement signal strength readout to work without
asking the attached tuner, and use a lookup table instead of log calc.
Values reported appear plausible, gathered from feedback from several
testers.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Tested-by: Richard Scobie <r.scobie@clear.net.nz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb-frontends/stv0910: add multistream (ISI) and PLS capabilities
Daniel Scheller [Mon, 3 Jul 2017 17:20:56 +0000 (13:20 -0400)]
media: dvb-frontends/stv0910: add multistream (ISI) and PLS capabilities

Implements stream_id filter and scrambling code setup in start() and also
sets FE_CAN_MULTISTREAM in frontend_ops. This enables the driver to
properly receive and handle multistream transponders, functionality has
been reported working fine by testers with access to such streams, in
conjunction with VDR on the userspace side.

The code snippet originates from the original vendor's dddvb driver
package and has been made working properly with the current in-kernel
DVB core API.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Tested-by: Richard Scobie <r.scobie@clear.net.nz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb-frontends/stv0910: Fix possible buffer overflow
Daniel Scheller [Mon, 3 Jul 2017 17:20:55 +0000 (13:20 -0400)]
media: dvb-frontends/stv0910: Fix possible buffer overflow

Fixes smatch error:

  drivers/media/dvb-frontends/stv0910.c:715 dvbs2_nbch() error: buffer overflow 'nbch[fectype]' 2 <= 28

Also, fixes the nbch array table by adding the DUMMY_PLF element at the top
to match the enums (table element order was off by one before).

Patch sent upstream aswell.

Cc: Ralph Metzler <rjkm@metzlerbros.de>
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Tested-by: Richard Scobie <r.scobie@clear.net.nz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb-frontends: add ST STV0910 DVB-S/S2 demodulator frontend driver
Daniel Scheller [Mon, 3 Jul 2017 17:20:54 +0000 (13:20 -0400)]
media: dvb-frontends: add ST STV0910 DVB-S/S2 demodulator frontend driver

This adds a multi frontend driver for the ST STV0910 DVB-S/S2 demodulator
frontends. The driver code originates from the Digital Devices' dddvb
vendor driver package as of version 0.9.29, and has been cleaned up from
core API usage which isn't supported yet in the kernel, and additionally
all obvious style issues have been resolved. All camel case and allcaps
have been converted to kernel_case and lowercase. Patches have been sent
to the vendor package maintainers to fix this aswell. Signal statistics
acquisition has been refactored to comply with standards.

Permission to reuse and mainline the driver code was formally granted by
Ralph Metzler <rjkm@metzlerbros.de>.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Tested-by: Richard Scobie <r.scobie@clear.net.nz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: platform: video-mux: convert to multiplexer framework
Philipp Zabel [Tue, 18 Jul 2017 13:26:00 +0000 (09:26 -0400)]
media: platform: video-mux: convert to multiplexer framework

Now that the multiplexer framework is merged, drop the temporary
mmio-mux implementation from the video-mux driver and convert it to use
the multiplexer API.

[mchehab@s-opensource.com: fix a merge conflict at Kconfig]
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@s-opensource.com>
7 years agomedia: usbvision-i2c: fix format overflow warning
Arnd Bergmann [Mon, 17 Jul 2017 14:29:58 +0000 (10:29 -0400)]
media: usbvision-i2c: fix format overflow warning

gcc-7 notices that we copy a fixed length string into another
string of the same size, with additional characters:

drivers/media/usb/usbvision/usbvision-i2c.c: In function 'usbvision_i2c_register':
drivers/media/usb/usbvision/usbvision-i2c.c:190:36: error: '%d' directive writing between 1 and 11 bytes into a region of size between 0 and 47 [-Werror=format-overflow=]
  sprintf(usbvision->i2c_adap.name, "%s-%d-%s", i2c_adap_template.name,
                                    ^~~~~~~~~~
drivers/media/usb/usbvision/usbvision-i2c.c:190:2: note: 'sprintf' output between 4 and 76 bytes into a destination of size 48

Using snprintf() makes the code more robust in general, but will still
trigger a possible warning about truncation in the string.
We know this won't happen as the template name is always "usbvision", so
we can easily avoid the warning as well by using this as the format string
directly.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: v4l2-mediabus: Add helper functions
Todor Tomov [Fri, 7 Jul 2017 08:48:47 +0000 (04:48 -0400)]
media: v4l2-mediabus: Add helper functions

Add helper functions for mbus to/from mplane pixel format conversion.

Signed-off-by: Todor Tomov <todor.tomov@linaro.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: adv7180: add missing adv7180cp, adv7180st i2c device IDs
Ulrich Hecht [Mon, 3 Jul 2017 08:43:33 +0000 (04:43 -0400)]
media: adv7180: add missing adv7180cp, adv7180st i2c device IDs

Fixes a crash on Renesas R8A7793 Gose board that uses these "compatible"
entries.

Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: solo6x10: fix detection of TW2864B chips
Anton Sviridenko [Sat, 1 Jul 2017 11:26:01 +0000 (07:26 -0400)]
media: solo6x10: fix detection of TW2864B chips

This patch enables support for non-Bluecherry labeled solo6110
based PCI cards which have 3 x TW2864B chips and one TW2865.
These cards are displayed by lspci -nn as

"Softlogic Co., Ltd. SOLO6110 H.264 Video encoder/decoder [9413:6110]"

Bluecherry cards have 4 x TW2864A. According to datasheet register 0xFF
of TW2864B chips contains value 0x6A or 0x6B depending on revision
which being shifted 3 bits right gives value 0x0d.
Existing version of solo6x10 fails on these cards with

[276582.344942] solo6x10 0000:07:00.0: Probing Softlogic 6110
[276582.402151] solo6x10 0000:07:00.0: Could not initialize any techwell chips
[276582.402781] solo6x10: probe of 0000:07:00.0 failed with error -22

Signed-off-by: Anton Sviridenko <anton@corp.bluecherry.net>
Acked-by: Andrey Utkin <andrey_utkin@fastmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dt-bindings: media: Add r8a7796 DRIF bindings
Ramesh Shanmugasundaram [Fri, 23 Jun 2017 09:25:02 +0000 (05:25 -0400)]
media: dt-bindings: media: Add r8a7796 DRIF bindings

Add r8a7796 DRIF bindings.

Signed-off-by: Ramesh Shanmugasundaram <ramesh.shanmugasundaram@bp.renesas.com>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: adv748x: get rid of unused var
Mauro Carvalho Chehab [Wed, 19 Jul 2017 20:51:01 +0000 (16:51 -0400)]
media: adv748x: get rid of unused var

drivers/media/i2c/adv748x/adv748x-csi2.c: In function 'adv748x_csi2_init_controls':
drivers/media/i2c/adv748x/adv748x-csi2.c:251:20: warning: variable 'ctrl' set but not used [-Wunused-but-set-variable]
  struct v4l2_ctrl *ctrl;
                    ^~~~

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: MAINTAINERS: Add ADV748x driver
Kieran Bingham [Thu, 6 Jul 2017 11:01:17 +0000 (07:01 -0400)]
media: MAINTAINERS: Add ADV748x driver

The ADV7481 is an integrated video decoder and combined HDMI/MHL
receiver.

Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: i2c: adv748x: add adv748x driver
Kieran Bingham [Thu, 6 Jul 2017 11:01:16 +0000 (07:01 -0400)]
media: i2c: adv748x: add adv748x driver

Provide support for the ADV7481 and ADV7482.

The driver is modelled with 4 subdevices to allow simultaneous streaming
from the AFE (Analog front end) and HDMI inputs though two CSI TX
entities.

The HDMI entity is linked to the TXA CSI bus, whilst the AFE is linked
to the TXB CSI bus.

The driver is based on a prototype by Koji Matsuoka in the Renesas BSP,
and an earlier rework by Niklas Söderlund.

Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: adv748x: Add adv7481, adv7482 bindings
Kieran Bingham [Thu, 6 Jul 2017 11:01:15 +0000 (07:01 -0400)]
media: adv748x: Add adv7481, adv7482 bindings

Create device tree bindings documentation for the ADV748x.
The ADV748x supports both the ADV7481 and ADV7482 chips which
provide analogue decoding and HDMI receiving capabilities

Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: staging: atomisp: fixed trivial coding style issue
Shy More [Mon, 17 Jul 2017 04:10:57 +0000 (00:10 -0400)]
media: staging: atomisp: fixed trivial coding style issue

Below was the trival error flagged by checkpatch.pl:
ERROR: space prohibited after that open parenthesis '('

Signed-off-by: Shy More <smklearn@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: staging: atomisp: fixed trivial coding style warning
Shy More [Sun, 16 Jul 2017 23:35:34 +0000 (19:35 -0400)]
media: staging: atomisp: fixed trivial coding style warning

Below was the trivial wanrning flagged by checkpatch.pl
WARNING: Block comments use * on subsequent lines

Signed-off-by: Shy More <smklearn@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: staging: atomisp: hmm: Alignment code (rebased)
Philipp Guendisch [Thu, 13 Jul 2017 06:55:43 +0000 (02:55 -0400)]
media: staging: atomisp: hmm: Alignment code (rebased)

This patch fixed code alignment to open paranthesis.
Semantic should not be affected by this patch.

It has been rebased on top of media_tree atomisp branch

Signed-off-by: Philipp Guendisch <philipp.guendisch@fau.de>
Signed-off-by: Chris Baller <chris.baller@gmx.de>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>