platform/kernel/linux-rpi.git
5 years agomedia: camss: csiphy: Ensure clock mux config is done before the rest
Todor Tomov [Wed, 25 Jul 2018 16:38:16 +0000 (12:38 -0400)]
media: camss: csiphy: Ensure clock mux config is done before the rest

Add a write memory barier after clock mux config and before the rest
of the csiphy config.

Signed-off-by: Todor Tomov <todor.tomov@linaro.org>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: camss: Fix OF node usage
Todor Tomov [Wed, 25 Jul 2018 16:38:15 +0000 (12:38 -0400)]
media: camss: Fix OF node usage

of_graph_get_next_endpoint increases the refcount of the returned
node and decreases the refcount of the passed node. Take this into
account and use of_node_put properly.

Signed-off-by: Todor Tomov <todor.tomov@linaro.org>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: camss: Use SPDX license headers
Todor Tomov [Wed, 25 Jul 2018 16:38:14 +0000 (12:38 -0400)]
media: camss: Use SPDX license headers

Use SPDX license headers for all files of the Qualcomm CAMSS driver.

Signed-off-by: Todor Tomov <todor.tomov@linaro.org>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: Rename CAMSS driver path
Todor Tomov [Wed, 25 Jul 2018 16:38:13 +0000 (12:38 -0400)]
media: Rename CAMSS driver path

Support for camera subsystem on QComm MSM8996/APQ8096 is to be added
so remove hardware version from CAMSS driver's path.

Signed-off-by: Todor Tomov <todor.tomov@linaro.org>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l: Add new 10-bit packed grayscale format
Todor Tomov [Wed, 25 Jul 2018 16:38:12 +0000 (12:38 -0400)]
media: v4l: Add new 10-bit packed grayscale format

The new format will be called V4L2_PIX_FMT_Y10P.
It is similar to the V4L2_PIX_FMT_SBGGR10P family formats
but V4L2_PIX_FMT_Y10P is a grayscale format.

Signed-off-by: Todor Tomov <todor.tomov@linaro.org>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l: Add new 2X8 10-bit grayscale media bus code
Todor Tomov [Wed, 25 Jul 2018 16:38:11 +0000 (12:38 -0400)]
media: v4l: Add new 2X8 10-bit grayscale media bus code

The code will be called MEDIA_BUS_FMT_Y10_2X8_PADHI_LE.
It is similar to MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE
but MEDIA_BUS_FMT_Y10_2X8_PADHI_LE describes grayscale
data.

Signed-off-by: Todor Tomov <todor.tomov@linaro.org>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: doc-rst: Add packed Bayer raw14 pixel formats
Sakari Ailus [Wed, 25 Jul 2018 16:38:10 +0000 (12:38 -0400)]
media: doc-rst: Add packed Bayer raw14 pixel formats

These formats are compressed 14-bit raw bayer formats with four different
pixel orders. They are similar to 10-bit variants. The formats added by
this patch are

V4L2_PIX_FMT_SBGGR14P
V4L2_PIX_FMT_SGBRG14P
V4L2_PIX_FMT_SGRBG14P
V4L2_PIX_FMT_SRGGB14P

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Todor Tomov <todor.tomov@linaro.org>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: em28xx: disable null packet filter for WinTVdualHD
Robert Schlabbach [Mon, 25 Jun 2018 10:33:58 +0000 (06:33 -0400)]
media: em28xx: disable null packet filter for WinTVdualHD

This patch disables the null packet filter for the Hauppauge
WinTV-dualHD. There are applications which require the unfiltered
transport stream (e.g. DOCSIS segment load analyzers).

Tests showed that the device is capable of delivering two unfiltered
EuroDOCSIS 3.0 transport streams simultaneously, i.e. over 100 Mbit/s
worth of data, without any losses.

Signed-off-by: Robert Schlabbach <Robert.Schlabbach@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: dvb-frontends/tda18271c2dd: fix handling of DVB-T parameters
Daniel Scheller [Sun, 24 Jun 2018 13:42:50 +0000 (09:42 -0400)]
media: dvb-frontends/tda18271c2dd: fix handling of DVB-T parameters

Add a break statement in set_params() for the SYS_DVBT(2).

As reported by gcc:

    drivers/media/dvb-frontends/tda18271c2dd.c:1144:3: warning: this statement may fall through [-Wimplicit-fallthrough=]

There is a nested switch() inside the code with sets the tuner to
the right standard. Without the break, the code will always set to
DVB-C mode, with can be sub-optimal for DVB-T.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ddbridge/mci: add SX8 I/Q mode remark and remove DIAG CMD defines
Daniel Scheller [Sat, 23 Jun 2018 15:36:15 +0000 (11:36 -0400)]
media: ddbridge/mci: add SX8 I/Q mode remark and remove DIAG CMD defines

Take note that the SX8 IQ mode is only available on a single tuner, and
remove the MCI/SX8 DIAG CMD defines.

Picked up from the upstream dddvb GIT.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ddbridge/sx8: enable modulation selection in set_parameters()
Daniel Scheller [Sat, 23 Jun 2018 15:36:14 +0000 (11:36 -0400)]
media: ddbridge/sx8: enable modulation selection in set_parameters()

Allow for tuning to transponders with specific modulations in
set_parameters(). Setting a specific modulation will also enable lower
modulations.

Picked up from the upstream dddvb GIT. Upstream also has support for
APSK64/128/256 modulations which aren't supported yet by the DVB
API, so comment them out until support for them is added.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ddbridge/sx8: disable automatic PLS code search
Daniel Scheller [Sat, 23 Jun 2018 15:36:13 +0000 (11:36 -0400)]
media: ddbridge/sx8: disable automatic PLS code search

The SX8 cards by default do an automatic search for the PLS code. This
is not necessarily wanted as this can eventually be detected wrong, so
disable this.

Picked up from the upstream dddvb GIT.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ddbridge/mci: add more MCI status codes, improve MCI_SUCCESS macro
Daniel Scheller [Sat, 23 Jun 2018 15:36:12 +0000 (11:36 -0400)]
media: ddbridge/mci: add more MCI status codes, improve MCI_SUCCESS macro

The MCI can report the command status more finegrained, so, add more
status code defines and update the MCI_SUCCESS macro.

Picked up from the upstream dddvb GIT.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ddbridge/mci: split MaxSX8 specific code off to ddbridge-sx8.c
Daniel Scheller [Sat, 23 Jun 2018 15:36:11 +0000 (11:36 -0400)]
media: ddbridge/mci: split MaxSX8 specific code off to ddbridge-sx8.c

Split off all code specific to the MaxSX8 cards to a separate ddbridge-sx8
module and hook it up in the Makefile. This also adds evaluation of the
mci_type to allow for using different attach handling for different cards.
As different cards can implement things differently (ie. support differing
frontend_ops, and have different base structs being put ontop of the
common mci_base struct), this introduces the mci_cfg struct which is
initially used to hold a few specifics to the -sx8 submodule. While at it,
the handling of the i/q mode is adjusted slightly. Besides this and
handling mci_base and sx8_base struct pointers where needed, all code
is copied unmodified from ddbridge-mci.c.

Picked up from the upstream dddvb GIT.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ddbridge/mci: make ddb_mci_cmd() and ddb_mci_config() public
Daniel Scheller [Sat, 23 Jun 2018 15:36:10 +0000 (11:36 -0400)]
media: ddbridge/mci: make ddb_mci_cmd() and ddb_mci_config() public

In preparation for splitting all MaxSX8 related code parts from the common
MCI code, prefix both mci_cmd() and mci_config() functions with ddb_,
remove the static marking and add matching function prototypes to
ddbridge-mci.h so these functions can be reused from other files within
the ddbridge driver. As this requires the mci-related structs to be
defined in ddbridge-mci.h, move struct mci and struct mci_base there and
clean them up.

Picked up from the upstream dddvb GIT.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ddbridge/mci: store mci type and number of ports in the hwinfo
Daniel Scheller [Sat, 23 Jun 2018 15:36:09 +0000 (11:36 -0400)]
media: ddbridge/mci: store mci type and number of ports in the hwinfo

For better support for future MCI based cards, rename the mci struct
member to mci_ports to carry the number of ports on the cards, and add a
mci_type member to identify the card type to handle differing hardware.

Picked up from the upstream dddvb GIT.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ddbridge/mci: extend mci_command and mci_result structs
Daniel Scheller [Sat, 23 Jun 2018 15:36:08 +0000 (11:36 -0400)]
media: ddbridge/mci: extend mci_command and mci_result structs

Recent FPGA firmware reports more data and values in sent command
responses. Adjust the mci_command and mci_result structs including it's
unions to match these changes and add a few comments explaining things.

Picked up from the upstream dddvb GIT.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ddbridge/mci: rename defines and fix i/q var types
Daniel Scheller [Sat, 23 Jun 2018 15:36:07 +0000 (11:36 -0400)]
media: ddbridge/mci: rename defines and fix i/q var types

Adjustments to match the FPGA firmware, and the signal I/Q values are
reported as s16 types from the card firmware.

Picked up from the upstream dddvb GIT.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ddbridge/mci: read and report signal strength and SNR
Daniel Scheller [Sat, 23 Jun 2018 15:36:06 +0000 (11:36 -0400)]
media: ddbridge/mci: read and report signal strength and SNR

Implement querying signal statistics from the MCI and report this data
in read_status() as DVBv5 statistics.

Picked up from the upstream dddvb GIT.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ddbridge/mci: update copyright year in headers
Daniel Scheller [Sat, 23 Jun 2018 15:36:05 +0000 (11:36 -0400)]
media: ddbridge/mci: update copyright year in headers

Update the copyright year information in the MCI headers to 2017-2018.

Picked up from the upstream dddvb GIT.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ddbridge: change MCI base ID and define a SX8 ID
Daniel Scheller [Sat, 23 Jun 2018 15:36:04 +0000 (11:36 -0400)]
media: ddbridge: change MCI base ID and define a SX8 ID

Change the start of the MCI ID range (internally used only) to 48 and
define an ID for the SX8 card type. Use this new ID to handle device
attachment.

This change is done in preparation for support of more MCI based cards.

Picked up from the upstream dddvb GIT.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ddbridge: link structure access cosmetics in ddb_port_probe()
Daniel Scheller [Sat, 23 Jun 2018 15:36:03 +0000 (11:36 -0400)]
media: ddbridge: link structure access cosmetics in ddb_port_probe()

Throughout the function, dev->link[l] is used several times. Unclutter
this a bit by declaring a ddb_link var at the top of the function, assign
the address of dev->link[l] to it and use that var to access the link[]
struct member.

Picked up from the upstream dddvb GIT.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ddbridge: remove unused MDIO defines and hwinfo member
Daniel Scheller [Sat, 23 Jun 2018 15:36:02 +0000 (11:36 -0400)]
media: ddbridge: remove unused MDIO defines and hwinfo member

ddbridge has a few MDIO related remainders (defines, hwinfo struct) which
aren't of any use for the in-kernel driver at all (they're only used in
conjunction with the OctoNet SAT>IP boxes which the kernel driver doesn't
have any support for), so clean this up.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ddbridge: report I2C bus errors
Daniel Scheller [Sat, 23 Jun 2018 15:36:01 +0000 (11:36 -0400)]
media: ddbridge: report I2C bus errors

The I2C_COMMAND response reports an error in the I2C bus communication
using bit 17. Evaluate the response more thoroughly and log an error
if an I2C problem was detected.

Picked up from the upstream dddvb GIT.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ddbridge: evaluate the actual link when setting up the dummy tuner
Daniel Scheller [Sat, 23 Jun 2018 15:36:00 +0000 (11:36 -0400)]
media: ddbridge: evaluate the actual link when setting up the dummy tuner

Devices supporting dummy tuner operation can exist on any link, not only
on link 0, so fix this accordingly.

Picked up from the upstream dddvb GIT.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ddbridge: probe for LNBH25 chips before attaching
Daniel Scheller [Sat, 23 Jun 2018 15:35:59 +0000 (11:35 -0400)]
media: ddbridge: probe for LNBH25 chips before attaching

In demod_attach_stv0910(), the LNBH25 IC is being blindly attached and,
if the result is bad, blindly attached on another possible I2C address.
The LNBH25 uses it's set_voltage function to test for the IC and will
print an error to the kernel log on failure. Prevent this by probing
the possible I2C address and use this (and only this) to attach the
LNBH25 I2C driver. This also allows the stv0910 attach function to be
a bit cleaner.

Picked up from the upstream dddvb GIT and adapted for the LNBH25 driver
variant from the kernel tree.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: dvb-frontends/stv0910: cast the BER denominator shift exp to ULL
Daniel Scheller [Sat, 23 Jun 2018 15:35:58 +0000 (11:35 -0400)]
media: dvb-frontends/stv0910: cast the BER denominator shift exp to ULL

To avoid miscalculations related to the BER denominator, the shift
expression needs to be casted as ULL.

Picked up from the upstream dddvb GIT.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: dvb/audio.h: get rid of unused APIs
Mauro Carvalho Chehab [Wed, 30 May 2018 15:07:04 +0000 (11:07 -0400)]
media: dvb/audio.h: get rid of unused APIs

There are a number of other ioctls that aren't used anywhere
inside the Kernel tree.

Get rid of them.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: dvb/video.h: get rid of unused APIs
Mauro Carvalho Chehab [Wed, 30 May 2018 15:07:03 +0000 (11:07 -0400)]
media: dvb/video.h: get rid of unused APIs

There are a number of other ioctls that aren't used anywhere
inside the Kernel tree.

Get rid of them.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: videodev2: get rid of VIDIOC_RESERVED
Mauro Carvalho Chehab [Wed, 30 May 2018 15:07:05 +0000 (11:07 -0400)]
media: videodev2: get rid of VIDIOC_RESERVED

While this ioctl is there at least since Kernel 2.6.12-rc2, it
was never used by any upstream driver.

Get rid of it.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: em28xx: explicitly disable TS packet filter
Robert Schlabbach [Sat, 16 Jun 2018 19:04:22 +0000 (15:04 -0400)]
media: em28xx: explicitly disable TS packet filter

The em28xx driver never touched the EM2874 register bits that control
the transport stream packet filters, leaving them at whatever default
the firmware has set. E.g. the Pinnacle 290e disables them by default,
while the Hauppauge WinTV dualHD enables discarding NULL packets by
default.

However, some applications require NULL packets, e.g. to determine the
load in DOCSIS segments, so discarding NULL packets is undesired for
such applications.

This patch simply extends the bit mask when starting or stopping the
transport stream packet capture, so that the filter bits are cleared.
It has been verified that this makes the Hauppauge WinTV dualHD pass
an unfiltered DVB-C stream including NULL packets, which it didn't
before.

Signed-off-by: Robert Schlabbach <Robert.Schlabbach@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agoMAINTAINERS: add entries for several media drivers
Akihiro Tsukada [Sun, 10 Jun 2018 14:59:31 +0000 (10:59 -0400)]
MAINTAINERS: add entries for several media drivers

add entries for the following drivers:
- earth_pt{1,3} DVB adapter drivers
- mxl301rf DVB tuner drivers
- qm1d1{b0004, c0042} DVB tuner drivers
- tc90522 DVB demod driver

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: pci/pt1: suppress compiler warning in xtensa arch
Akihiro Tsukada [Sun, 10 Jun 2018 14:58:02 +0000 (10:58 -0400)]
media: pci/pt1: suppress compiler warning in xtensa arch

Found and reported by kbuild test robot:
Message ID: <201805052003.MC007f9h%fengguang.wu@intel.com>
and holding an address of an empty struct in .driver.pm does no harm
when CONFIG_PM_SLEEP is not defined.

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: dvb-frontends/dvb-pll: fix module ref-counting
Akihiro Tsukada [Sun, 10 Jun 2018 14:49:15 +0000 (10:49 -0400)]
media: dvb-frontends/dvb-pll: fix module ref-counting

dvb-pll module was 'put' twice on exit:
once by dvb_frontend_detach() and another by dvb_module_release().

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: dvb-usb/friio, dvb-usb-v2/gl861: decompose friio and merge with gl861
Akihiro Tsukada [Sun, 10 Jun 2018 14:45:31 +0000 (10:45 -0400)]
media: dvb-usb/friio, dvb-usb-v2/gl861: decompose friio and merge with gl861

Friio device contains "gl861" bridge and "tc90522" demod,
for which the separate drivers are already in the kernel.
But friio driver was monolithic and did not use them,
practically copying those features.
This patch decomposes friio driver into sub drivers and
re-uses existing ones, thus reduces some code.

It adds some features to gl861,
to support the friio-specific init/config of the devices
and implement i2c communications to the tuner via demod
with USB vendor requests.

[mchehab+samsung@kernel.org: fix merge conflicts]
Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: sii9234: remove unused header
Corentin Labbe [Thu, 7 Jun 2018 19:55:25 +0000 (15:55 -0400)]
media: sii9234: remove unused header

The include/linux/platform_data/media/sii9234.h header file is unused,
let's remove it.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: s5p-mfc: Fix buffer look up in s5p_mfc_handle_frame_{new, copy_time} functions
Sylwester Nawrocki [Tue, 5 Jun 2018 13:33:59 +0000 (09:33 -0400)]
media: s5p-mfc: Fix buffer look up in s5p_mfc_handle_frame_{new, copy_time} functions

Look up of buffers in s5p_mfc_handle_frame_new, s5p_mfc_handle_frame_copy_time
functions is not working properly for DMA addresses above 2 GiB. As a result
flags and timestamp of returned buffers are not set correctly and it breaks
operation of GStreamer/OMX plugins which rely on the CAPTURE buffer queue
flags.

Due to improper return type of the get_dec_y_adr, get_dspl_y_adr callbacks
and sign bit extension these callbacks return incorrect address values,
e.g. 0xfffffffffefc0000 instead of 0x00000000fefc0000. Then the statement:

"if (vb2_dma_contig_plane_dma_addr(&dst_buf->b->vb2_buf, 0) == dec_y_addr)"

is always false, which breaks looking up capture queue buffers.

To ensure proper matching by address u32 type is used for the DMA
addresses. This should work on all related SoCs, since the MFC DMA
address width is not larger than 32-bit.

Changes done in this patch are minimal as there is a larger patch series
pending refactoring the whole driver.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l2-mem2mem: Fix missing v4l2_m2m_try_run call
Ezequiel Garcia [Wed, 25 Jul 2018 17:15:12 +0000 (13:15 -0400)]
media: v4l2-mem2mem: Fix missing v4l2_m2m_try_run call

Commit 34dbb848d5e4 ("media: mem2mem: Remove excessive try_run call")
removed a redundant call to v4l2_m2m_try_run but instead introduced
a bug. Consider the following case:

 1) Context A schedules, queues and runs job A.
 2) While the m2m device is running, context B schedules
    and queues job B. Job B cannot run, because it has to
    wait for job A.
 3) Job A completes, calls v4l2_m2m_job_finish, and tries
    to queue a job for context A, but since the context is
    empty it won't do anything.

In this scenario, queued job B will never run. Fix this by calling
v4l2_m2m_try_run from v4l2_m2m_try_schedule.

While here, add more documentation to these functions.

Fixes: 34dbb848d5e4 ("media: mem2mem: Remove excessive try_run call")

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
[hans.verkuil@cisco.com: split >80 cols line]
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: imx274: add cropping support via SELECTION API
Luca Ceresoli [Wed, 25 Jul 2018 16:24:55 +0000 (12:24 -0400)]
media: imx274: add cropping support via SELECTION API

Currently this driver does not support cropping. The supported modes
are the following, all capturing the entire area:

 - 3840x2160, 1:1 binning (native sensor resolution)
 - 1920x1080, 2:1 binning
 - 1280x720,  3:1 binning

The VIDIOC_SUBDEV_S_FMT ioctl chooses among these 3 configurations the
one that matches the requested format.

Add cropping support via VIDIOC_SUBDEV_S_SELECTION: with target
V4L2_SEL_TGT_CROP to choose the captured area, with
V4L2_SEL_TGT_COMPOSE to choose the output resolution.

To maintain backward compatibility we also allow setting the compose
format via VIDIOC_SUBDEV_S_FMT. To obtain this, compose rect and
output format are computed in the common helper function
__imx274_change_compose(), which sets both to the same width/height
values.

Cropping also calls __imx274_change_compose() whenever cropping rect
size changes in order to reset the compose rect (and output format
size) for 1:1 binning.

Also rename enum imx274_mode to imx274_binning (and its values from
IMX274_MODE_BINNING_* to IMX274_BINNING_*). Without cropping, the two
naming are equivalent. With cropping, the resolution could be
different, e.g. using 2:1 binning mode to crop 1200x960 and output a
600x480 format. Using binning in the names avoids any
misunderstanding. For the same reason, replace the 'size' field in
struct imx274_frmfmt with 'bin_ratio'.

[Sakari Ailus: Remove leftover condition in imx274_apply_trimming]

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: imx274: use regmap_bulk_write to write multybyte registers
Luca Ceresoli [Wed, 25 Jul 2018 16:24:54 +0000 (12:24 -0400)]
media: imx274: use regmap_bulk_write to write multybyte registers

Currently 2-bytes and 3-bytes registers are set by very similar
functions doing the needed shift & mask manipulation, followed by very
similar for loops setting one byte at a time over I2C.

Replace all of this code by a unique helper function that calls
regmap_bulk_write(), which has two advantages:
 - sets all the bytes in a unique I2C transaction
 - removes lots of now unused code.

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ov2680: Add Omnivision OV2680 sensor driver
Rui Miguel Silva [Tue, 3 Jul 2018 14:08:03 +0000 (10:08 -0400)]
media: ov2680: Add Omnivision OV2680 sensor driver

This patch adds V4L2 sub-device driver for OV2680 image sensor.
The OV2680 is a 1/5" CMOS color sensor from Omnivision.
Supports output format: 10-bit Raw RGB.
The OV2680 has a single lane MIPI interface.

The driver exposes following V4L2 controls:
- auto/manual exposure,
- exposure,
- auto/manual gain,
- gain,
- horizontal/vertical flip,
- test pattern menu.
Supported resolution are only: QUXGA, 720P, UXGA.

[Sakari Ailus: Drop "-level" from Kconfig help text]

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ov2680: dt: Add bindings for OV2680
Rui Miguel Silva [Tue, 3 Jul 2018 14:08:02 +0000 (10:08 -0400)]
media: ov2680: dt: Add bindings for OV2680

Add device tree binding documentation for the OV2680 camera sensor.

[Sakari Ailus: Squash MAINTAINERS entry from Rui]

CC: devicetree@vger.kernel.org
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: i2c: Add driver for Aptina MT9V111
Jacopo Mondi [Wed, 25 Jul 2018 13:44:31 +0000 (09:44 -0400)]
media: i2c: Add driver for Aptina MT9V111

Add V4L2 sensor driver for Aptina MT9V111 CMOS image sensor.

The MT9V111 is a 1/4-Inch CMOS image sensor based on MT9V011 with an
integrated Image Flow Processor.

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: dt-bindings: media: i2c: Document MT9V111 bindings
Jacopo Mondi [Wed, 25 Jul 2018 13:44:30 +0000 (09:44 -0400)]
media: dt-bindings: media: i2c: Document MT9V111 bindings

Add documentation for Aptina MT9V111 image sensor.

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: dw9807-vcm: Recognise this is just the VCM bit of the device
Sakari Ailus [Fri, 20 Jul 2018 21:07:15 +0000 (17:07 -0400)]
media: dw9807-vcm: Recognise this is just the VCM bit of the device

The dw9807 contains a voice coil lens driver as well as an EEPROM. This
driver is just for the VCM. Reflect this in the driver's name --- this is
already the case for the compatible string, for instance.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: rcar-csi2: update stream start for V3M
Niklas Söderlund [Thu, 26 Jul 2018 22:36:57 +0000 (18:36 -0400)]
media: rcar-csi2: update stream start for V3M

Latest errata document updates the start procedure for V3M. This change
in addition to adhering to the datasheet update fixes capture on early
revisions of V3M.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-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>
5 years agomedia: pci: ivtv: Replace GFP_ATOMIC with GFP_KERNEL
Jia-Ju Bai [Fri, 27 Jul 2018 03:44:24 +0000 (23:44 -0400)]
media: pci: ivtv: Replace GFP_ATOMIC with GFP_KERNEL

ivtv_probe() and ivtvfb_init_card() are never called in atomic context.
They call kzalloc() with GFP_ATOMIC, which is not necessary.
GFP_ATOMIC can be replaced with GFP_KERNEL.

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: pci: cx88: Replace mdelay() with msleep() in dvb_register()
Jia-Ju Bai [Fri, 27 Jul 2018 03:41:50 +0000 (23:41 -0400)]
media: pci: cx88: Replace mdelay() with msleep() in dvb_register()

dvb_register() is never called in atomic context.
It calls mdelay() to busily wait, which is not necessary.
mdelay() can be replaced with msleep().

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: pci: cx88: Replace mdelay() with msleep() in cx88_card_setup_pre_i2c()
Jia-Ju Bai [Fri, 27 Jul 2018 03:38:23 +0000 (23:38 -0400)]
media: pci: cx88: Replace mdelay() with msleep() in cx88_card_setup_pre_i2c()

cx88_card_setup_pre_i2c() is never called in atomic context.
It calls mdelay() to busily wait, which is not necessary.
mdelay() can be replaced with msleep().

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: pci: cx25821: Replace mdelay() with msleep()
Jia-Ju Bai [Fri, 27 Jul 2018 03:22:09 +0000 (23:22 -0400)]
media: pci: cx25821: Replace mdelay() with msleep()

cx25821_gpio_init(), cx25821_initialize() and cx25821_registers_init()
are never called in atomic context.
They call mdelay() to busily wait, which is not necessary.
mdelay() can be replaced with msleep().

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: pci: cx23885: Replace mdelay() with msleep() in cx23885_reset()
Jia-Ju Bai [Fri, 27 Jul 2018 03:18:46 +0000 (23:18 -0400)]
media: pci: cx23885: Replace mdelay() with msleep() in cx23885_reset()

cx23885_reset() is never called in atomic context.
It calls mdelay() to busily wait, which is not necessary.
mdelay() can be replaced with msleep().

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: pci: cx23885: Replace mdelay() with msleep() and usleep_range() in cx23885_gpi...
Jia-Ju Bai [Fri, 27 Jul 2018 03:15:34 +0000 (23:15 -0400)]
media: pci: cx23885: Replace mdelay() with msleep() and usleep_range() in cx23885_gpio_setup()

cx23885_gpio_setup() is never called in atomic context.
It calls mdelay() to busily wait, which is not necessary.
mdelay() can be replaced with msleep() and usleep_range().

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: pci: cx23885: Replace mdelay() with msleep() and usleep_range() in altera_ci_s...
Jia-Ju Bai [Fri, 27 Jul 2018 03:09:46 +0000 (23:09 -0400)]
media: pci: cx23885: Replace mdelay() with msleep() and usleep_range() in altera_ci_slot_reset()

altera_ci_slot_reset() is never called in atomic context.
It calls mdelay() to busily wait, which is not necessary.
mdelay() can be replaced with msleep().

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: pci: cobalt: Replace GFP_ATOMIC with GFP_KERNEL in cobalt_probe()
Jia-Ju Bai [Fri, 27 Jul 2018 03:07:04 +0000 (23:07 -0400)]
media: pci: cobalt: Replace GFP_ATOMIC with GFP_KERNEL in cobalt_probe()

cobalt_probe() is never called in atomic context.
It calls kzalloc() with GFP_ATOMIC, which is not necessary.
GFP_ATOMIC can be replaced with GFP_KERNEL.

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: i2c: vs6624: Replace mdelay() with msleep() and usleep_range() in vs6624_probe()
Jia-Ju Bai [Fri, 27 Jul 2018 03:02:40 +0000 (23:02 -0400)]
media: i2c: vs6624: Replace mdelay() with msleep() and usleep_range() in vs6624_probe()

vs6624_probe() is never called in atomic context.
It calls mdelay() to busily wait, which is not necessary.
mdelay() can be replaced with msleep() and usleep_range().

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: i2c: adv7842: Replace mdelay() with msleep() and usleep_range() in adv7842_ddr...
Jia-Ju Bai [Fri, 27 Jul 2018 02:58:43 +0000 (22:58 -0400)]
media: i2c: adv7842: Replace mdelay() with msleep() and usleep_range() in adv7842_ddr_ram_test()

adv7842_ddr_ram_test() is never called in atomic context.
It only calls from:
adv7842_ddr_ram_test() <- adv7842_command_ram_test() <- adv7842_ioctl()

adv7842_ddr_ram_test() calls mdelay() to busily wait,
which is not necessary.
mdelay() can be replaced with msleep() and usleep_range().

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: video-i2c: hwmon: fix return value from amg88xx_hwmon_init()
Matt Ranostay [Fri, 27 Jul 2018 01:47:24 +0000 (21:47 -0400)]
media: video-i2c: hwmon: fix return value from amg88xx_hwmon_init()

PTR_ERR was making any pointer passed an error pointer, and should be
replaced with PTR_ERR_OR_ZERO which checks if is an actual error condition.

Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: adv7180: add g_frame_interval support
Niklas Söderlund [Thu, 26 Jul 2018 10:27:16 +0000 (06:27 -0400)]
media: adv7180: add g_frame_interval support

Implement g_frame_interval to return the current standard's frame
interval.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: adv7180: fix field type to V4L2_FIELD_ALTERNATE
Niklas Söderlund [Thu, 26 Jul 2018 10:27:15 +0000 (06:27 -0400)]
media: adv7180: fix field type to V4L2_FIELD_ALTERNATE

The ADV7180 and ADV7182 transmit whole fields, bottom field followed
by top (or vice-versa, depending on detected video standard). So
for chips that do not have support for explicitly setting the field
mode via I2P, set the field mode to V4L2_FIELD_ALTERNATE.

I2P converts fields into frames using an edge adaptive algorithm. The
frame rate is the same as the 'field rate': e.g. X fields per second
are now X frames per second.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: rockchip/rga: Fix bad dma_free_attrs() parameter
Ezequiel Garcia [Wed, 25 Jul 2018 21:01:23 +0000 (17:01 -0400)]
media: rockchip/rga: Fix bad dma_free_attrs() parameter

In rga_remove(), dma_free_attrs is being passed the wrong
cpu address, which triggers an exception if the driver is
removed. Fix it.

Tested on a RK3399 platform, with a bind/unbind cycle.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: media.h: remove linux/version.h include
Hans Verkuil [Wed, 25 Jul 2018 12:51:39 +0000 (08:51 -0400)]
media: media.h: remove linux/version.h include

The media.h public header is one of only three public headers that include
linux/version.h. Drop it from media.h. It was only used for an obsolete
define.

It has to be added to media-device.c, since that source relied on media.h
to include it.

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>
5 years agomedia: vivid: Fix V4L2_FIELD_ALTERNATE new frame check
Nicolas Dufresne [Fri, 20 Jul 2018 14:09:16 +0000 (10:09 -0400)]
media: vivid: Fix V4L2_FIELD_ALTERNATE new frame check

The vivid driver will overlay stream time on generated frames. Though,
in interlacing mode V4L2_FIELD_ALTERNATE, each field is separate and
must have the same time to ensure proper render. Though, this time was
only updated every 2 frames as the code was checking against the wrong
counter (frame counter rather then field counter).

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: media.h.rst.exceptions: ignore MEDIA-ENT-F-DTV-DECODER
Mauro Carvalho Chehab [Fri, 27 Jul 2018 11:01:03 +0000 (07:01 -0400)]
media: media.h.rst.exceptions: ignore MEDIA-ENT-F-DTV-DECODER

This was kept just for backward compatibility. Solves this warning:
media.h.rst:6: WARNING: undefined label: media-ent-f-dtv-decoder (if the link has no caption the label must precede a section header)

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: coda: add SPS fixup code for frame sizes that are not multiples of 16
Philipp Zabel [Thu, 19 Jul 2018 10:45:10 +0000 (06:45 -0400)]
media: coda: add SPS fixup code for frame sizes that are not multiples of 16

The CODA7541 firmware does not set the SPS frame cropping fields to
properly describe coded h.264 streams with frame sizes that are not a
multiple of the macroblock size.
This adds RBSP parsing code and a SPS fixup routine to manually replace
the cropping information in the headers produced by the firmware with
the correct values.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
[hans.verkuil@cisco.com: added explanation of SPS RBSP to comment]
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: coda: let CODA960 firmware set frame cropping in SPS header
Philipp Zabel [Thu, 19 Jul 2018 10:42:28 +0000 (06:42 -0400)]
media: coda: let CODA960 firmware set frame cropping in SPS header

When encoding h.264, if visible resolution is not aligned to macroblock
size, frame cropping has to be set in the SPS header to produce correct
streams. The CODA960 firmware can do this on its own if asked to.

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>
5 years agomedia: media-types.rst: fix doc warnings
Hans Verkuil [Fri, 27 Jul 2018 10:40:45 +0000 (06:40 -0400)]
media: media-types.rst: fix doc warnings

Fix these warnings when building the documentation:

media.h.rst:6: WARNING: undefined label: media-ent-f-dv-decoder (if the link has no caption the label must precede a section header)
media.h.rst:6: WARNING: undefined label: media-ent-f-dv-encoder (if the link has no caption the label must precede a section header)
media.h.rst:6: WARNING: undefined label: media-ent-f-dv-decoder (if the link has no caption the label must precede a section header)

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: helene: fix xtal frequency setting at power on
Katsuhiro Suzuki [Tue, 29 May 2018 01:09:20 +0000 (21:09 -0400)]
media: helene: fix xtal frequency setting at power on

This patch fixes crystal frequency setting when power on this device.

Signed-off-by: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
Acked-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: vsp1: Document vsp1_dl_body refcnt
Kieran Bingham [Mon, 28 May 2018 10:24:20 +0000 (06:24 -0400)]
media: vsp1: Document vsp1_dl_body refcnt

In commit 2d9445db0ee9 ("media: vsp1: Use reference counting for
bodies"), a new field was introduced to the vsp1_dl_body structure to
account for usage tracking of the body.

Document the newly added field in the kerneldoc.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: dvb: get rid of VIDEO_SET_SPU_PALETTE
Mauro Carvalho Chehab [Mon, 28 May 2018 14:32:41 +0000 (10:32 -0400)]
media: dvb: get rid of VIDEO_SET_SPU_PALETTE

No upstream drivers use it. It doesn't make any sense to have
a compat32 code for something that nobody uses upstream.

Reported-by: Alexander Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: uvcvideo: Send a control event when a Control Change interrupt arrives
Guennadi Liakhovetski [Thu, 26 Jul 2018 08:17:53 +0000 (04:17 -0400)]
media: uvcvideo: Send a control event when a Control Change interrupt arrives

UVC defines a method of handling asynchronous controls, which sends a
USB packet over the interrupt pipe. This patch implements support for
such packets by sending a control event to the user. Since this can
involve USB traffic and, therefore, scheduling, this has to be done
in a work queue.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@intel.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: uvcvideo: Handle control pipe protocol STALLs
Guennadi Liakhovetski [Tue, 8 May 2018 15:07:44 +0000 (11:07 -0400)]
media: uvcvideo: Handle control pipe protocol STALLs

When a command ends up in a STALL on the control pipe, use the Request
Error Code control to provide a more precise error information to the
user. For example, if a camera is still busy processing a control,
when the same or an interrelated control set request arrives, the
camera can react with a STALL and then return the "Not ready" status
in response to a UVC_VC_REQUEST_ERROR_CODE_CONTROL command. With this
patch the user would then get an EBUSY error code instead of a
generic EPIPE.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@intel.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: uvcvideo: Remove a redundant check
Guennadi Liakhovetski [Tue, 8 May 2018 15:07:42 +0000 (11:07 -0400)]
media: uvcvideo: Remove a redundant check

Event subscribers cannot have a NULL file handle. They are only added
at a single location in the code, and the .fh pointer is used without
checking there.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@intel.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: uvcvideo: Also validate buffers in BULK mode
Nicolas Dufresne [Tue, 5 Jun 2018 00:24:15 +0000 (20:24 -0400)]
media: uvcvideo: Also validate buffers in BULK mode

Just like for ISOC, validate the decoded BULK buffer size when possible.
This avoids sending corrupted or partial buffers to userspace, which may
lead to application crash or run-time failure.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
[laurent.pinchart@ideasonboard.com: Move uvc_video_validate_buffer() call to uvc_video_next_buffers()]
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: uvcvideo: Add KSMedia 8-bit IR format support
Laurent Pinchart [Wed, 21 Mar 2018 09:16:40 +0000 (05:16 -0400)]
media: uvcvideo: Add KSMedia 8-bit IR format support

Add support for the 8-bit IR format GUID defined in the Microsoft Kernel
Streaming Media API.

Reported-by: Paul Menzel <pmenzel+linux-media@molgen.mpg.de>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Paul Menzel <pmenzel+linux-media@molgen.mpg.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: uvcvideo: Fix minor spelling
Kieran Bingham [Tue, 20 Mar 2018 15:43:08 +0000 (11:43 -0400)]
media: uvcvideo: Fix minor spelling

Provide the missing 't' from straightforward.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: em28xx-cards: disable V4L2 mode for dual tuners
Mauro Carvalho Chehab [Thu, 28 Jun 2018 18:43:21 +0000 (14:43 -0400)]
media: em28xx-cards: disable V4L2 mode for dual tuners

Right now, the code that calculates alternate modes is not ready
for devices with dual tuners. That's ok, as we currently don't
have any such devices, but better to add a warning for such
case, as, if anyone adds such device, the logic will need to
be reviewed.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Acked-by: Brad Love <brad@nextdimension.cc>
Reviewed-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: em28xx: Remove duplicate PID
Brad Love [Wed, 27 Jun 2018 15:32:00 +0000 (11:32 -0400)]
media: em28xx: Remove duplicate PID

Half-revert: commit 5b1a270d224b ("media: dvb: add alternative USB PID for Hauppauge WinTV-soloHD")'

The PID already exists on the line above.

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Michael Ira Krufky <mkrufky@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: em28xx: Fix DualHD disconnect oops
Brad Love [Wed, 27 Jun 2018 15:32:01 +0000 (11:32 -0400)]
media: em28xx: Fix DualHD disconnect oops

During the duplication of em28xx state for the second tuner pair
a pointer to alt_max_pkt_size_isoc is copied. During tear down
the second tuner is destroyed first and kfrees alt_max_pkt_size_isoc,
then the first tuner is destroyed and kfrees it again. The property
should only be kfree'd if the tuner is PRIMARY_TS.

[  354.888560] ------------[ cut here ]------------
[  354.888562] kernel BUG at mm/slub.c:296!
[  354.888574] invalid opcode: 0000 [#1] SMP NOPTI
[  354.888869] CPU: 1 PID: 19 Comm: kworker/1:0 Not tainted 4.18.0-rc1+ #20
[  354.889140] Hardware name: MSI MS-7A39/B350M GAMING PRO (MS-7A39), BIOS 2.G0 04/27/2018
[  354.889408] Workqueue: usb_hub_wq hub_event
[  354.889679] RIP: 0010:__slab_free+0x217/0x370
[  354.889942] Code: bb c0 e8 07 41 38 c7 72 39 48 83 c4 70 5b 41 5a 41 5c 41 5d 41 5e 41 5f 5d 49 8d 62 f8 c3 f3 90 49 8b 04 24 a8 01 75 f6 eb 82 <0f> 0b 44 89 45 80 48 89 4d 88 e8 aa fa ff ff 85 c0 74 cc e9 b7 fe
[  354.890598] RSP: 0018:ffffb84c41a4fad0 EFLAGS: 00010246
[  354.890934] RAX: ffff948646e85150 RBX: ffff948646e85150 RCX: ffff948646e85150
[  354.891280] RDX: 00000000820001d9 RSI: fffffa8fd01ba140 RDI: ffff94865e807c00
[  354.891649] RBP: ffffb84c41a4fb70 R08: 0000000000000001 R09: ffffffffc059ce21
[  354.892025] R10: ffff948646e85150 R11: 0000000000000001 R12: fffffa8fd01ba140
[  354.892403] R13: ffff948646e85150 R14: ffff94865e807c00 R15: ffff94864c92e0a0
[  354.892780] FS:  0000000000000000(0000) GS:ffff94865ec40000(0000) knlGS:0000000000000000
[  354.893150] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  354.893530] CR2: 00007f4e476da950 CR3: 000000040112c000 CR4: 00000000003406e0
[  354.893917] Call Trace:
[  354.894315]  ? __dev_printk+0x3c/0x80
[  354.894695]  ? _dev_info+0x64/0x80
[  354.895082]  ? em28xx_free_device+0x41/0x50 [em28xx]
[  354.895464]  kfree+0x17a/0x190
[  354.895852]  ? kfree+0x17a/0x190
[  354.896310]  em28xx_free_device+0x41/0x50 [em28xx]
[  354.896698]  em28xx_usb_disconnect+0xfa/0x110 [em28xx]
[  354.897083]  usb_unbind_interface+0x7a/0x270
[  354.897475]  device_release_driver_internal+0x17c/0x250
[  354.897864]  device_release_driver+0x12/0x20
[  354.898252]  bus_remove_device+0xec/0x160
[  354.898639]  device_del+0x13d/0x320
[  354.899018]  ? usb_remove_ep_devs+0x1f/0x30
[  354.899392]  usb_disable_device+0x9e/0x270
[  354.899772]  usb_disconnect+0x92/0x2a0
[  354.900149]  hub_event+0x98e/0x1650
[  354.900519]  ? sched_clock_cpu+0x11/0xa0
[  354.900890]  process_one_work+0x167/0x3f0
[  354.901251]  worker_thread+0x4d/0x460
[  354.901610]  kthread+0x105/0x140
[  354.901964]  ? rescuer_thread+0x360/0x360
[  354.902318]  ? kthread_associate_blkcg+0xa0/0xa0
[  354.902672]  ret_from_fork+0x22/0x40
[  354.903024] Modules linked in: rc_hauppauge em28xx_rc rc_core si2157 lgdt3306a i2c_mux em28xx_dvb dvb_core videobuf2_vmalloc videobuf2_memops videobuf2_common snd_hda_codec_hdmi nls_iso8859_1 edac_mce_amd kvm crct10dif_pclmul crc32_pclmul ghash_clmulni_intel pcbc snd_hda_intel snd_hda_codec snd_hda_core snd_hwdep snd_pcm snd_seq_midi aesni_intel snd_seq_midi_event aes_x86_64 snd_rawmidi crypto_simd em28xx cryptd glue_helper asix tveeprom usbnet snd_seq v4l2_common mii videodev snd_seq_device media input_leds snd_timer joydev ccp k10temp wmi_bmof snd soundcore mac_hid sch_fq_codel parport_pc ppdev lp parport ip_tables x_tables vfio_pci vfio_virqfd irqbypass vfio_iommu_type1 vfio nouveau mxm_wmi video i2c_algo_bit ttm drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops i2c_piix4 drm ahci libahci
[  354.905129]  wmi gpio_amdpt gpio_generic hid_generic usbhid hid
[  354.908140] ---[ end trace c230d02716298c34 ]---
[  354.908145] RIP: 0010:__slab_free+0x217/0x370
[  354.908147] Code: bb c0 e8 07 41 38 c7 72 39 48 83 c4 70 5b 41 5a 41 5c 41 5d 41 5e 41 5f 5d 49 8d 62 f8 c3 f3 90 49 8b 04 24 a8 01 75 f6 eb 82 <0f> 0b 44 89 45 80 48 89 4d 88 e8 aa fa ff ff 85 c0 74 cc e9 b7 fe
[  354.908183] RSP: 0018:ffffb84c41a4fad0 EFLAGS: 00010246
[  354.908186] RAX: ffff948646e85150 RBX: ffff948646e85150 RCX: ffff948646e85150
[  354.908189] RDX: 00000000820001d9 RSI: fffffa8fd01ba140 RDI: ffff94865e807c00
[  354.908191] RBP: ffffb84c41a4fb70 R08: 0000000000000001 R09: ffffffffc059ce21
[  354.908193] R10: ffff948646e85150 R11: 0000000000000001 R12: fffffa8fd01ba140
[  354.908195] R13: ffff948646e85150 R14: ffff94865e807c00 R15: ffff94864c92e0a0
[  354.908198] FS:  0000000000000000(0000) GS:ffff94865ec40000(0000) knlGS:0000000000000000
[  354.908201] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  354.908203] CR2: 00007f4e476da950 CR3: 000000016b20a000 CR4: 00000000003406e0

Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Michael Ira Krufky <mkrufky@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: em28xx: Fix dual transport stream operation
Brad Love [Thu, 28 Jun 2018 17:29:09 +0000 (13:29 -0400)]
media: em28xx: Fix dual transport stream operation

Addresses the following, which introduced a regression itself:

Commit 509f89652f83 ("media: em28xx: fix a regression with HVR-950")

The regression fix breaks dual transport stream support. Currently,
when a tuner starts streaming it sets alt mode on the USB interface.
The problem is, in a dual tuner model, both tuners share the same
USB interface, so when the second tuner becomes active and sets alt
mode on the interface it kills streaming on the other port.

This patch addresses the regression by only setting alt mode
on the USB interface during em28xx_start_streaming, if the
device is not a dual tuner model. This allows all older and
single tuner devices to explicitly set alt mode during stream
startup. Testers report both isoc and bulk DualHD models work
correctly with the alt mode set only once, in em28xx_dvb_init.

Fixes: 509f89652f83 ("media: em28xx: fix a regression with HVR-950")
Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Michael Ira Krufky <mkrufky@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: vicodec: current -> cur
Hans Verkuil [Thu, 26 Jul 2018 07:11:01 +0000 (03:11 -0400)]
media: vicodec: current -> cur

'current' is also defined in asm-generic/current.h.

When compiling this driver for older kernels with the media_build system,
this header is included via compat.h and it no longer compiles. Rename
current to cur.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: dib0700: add code comment
Gustavo A. R. Silva [Tue, 22 May 2018 16:20:01 +0000 (12:20 -0400)]
media: dib0700: add code comment

Add FIXME code comment:
/* FIXME: check if it is fe_adap[1] */

It is likely that it should be adap->fe_adap[1].fe in the second clause,
but this has never been verified.

Suggested-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: dvb-bt8xx: remove duplicate code
Gustavo A. R. Silva [Tue, 22 May 2018 16:04:59 +0000 (12:04 -0400)]
media: dvb-bt8xx: remove duplicate code

The same code is executed regardless of whether c->frequency < 600000000
or c->frequency < 730000000 is true.

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: cx231xx: don't check number of messages in the driver
Wolfram Sang [Sun, 20 May 2018 06:50:34 +0000 (02:50 -0400)]
media: cx231xx: don't check number of messages in the driver

Since commit 1eace8344c02 ("i2c: add param sanity check to
i2c_transfer()"), the I2C core does this check now. We can remove it
from drivers.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: si4713: don't check number of messages in the driver
Wolfram Sang [Sun, 20 May 2018 06:50:33 +0000 (02:50 -0400)]
media: si4713: don't check number of messages in the driver

Since commit 1eace8344c02 ("i2c: add param sanity check to
i2c_transfer()"), the I2C core does this check now. We can remove it
from drivers.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: em28xx: don't check number of messages in the driver
Wolfram Sang [Sun, 20 May 2018 06:50:35 +0000 (02:50 -0400)]
media: em28xx: don't check number of messages in the driver

Since commit 1eace8344c02 ("i2c: add param sanity check to
i2c_transfer()"), the I2C core does this check now. We can remove it
from drivers.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: hdpvr: don't check number of messages in the driver
Wolfram Sang [Sun, 20 May 2018 06:50:36 +0000 (02:50 -0400)]
media: hdpvr: don't check number of messages in the driver

Since commit 1eace8344c02 ("i2c: add param sanity check to
i2c_transfer()"), the I2C core does this check now. We can remove it
from drivers.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: dvb-usb: don't check number of messages in the driver
Wolfram Sang [Sun, 20 May 2018 06:50:38 +0000 (02:50 -0400)]
media: dvb-usb: don't check number of messages in the driver

Since commit 1eace8344c02 ("i2c: add param sanity check to
i2c_transfer()"), the I2C core does this check now. We can remove it
from drivers.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: tm6000: don't check number of messages in the driver
Wolfram Sang [Sun, 20 May 2018 06:50:37 +0000 (02:50 -0400)]
media: tm6000: don't check number of messages in the driver

Since commit 1eace8344c02 ("i2c: add param sanity check to
i2c_transfer()"), the I2C core does this check now. We can remove it
from drivers.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: netup_unidvb: don't check number of messages in the driver
Wolfram Sang [Sun, 20 May 2018 06:50:32 +0000 (02:50 -0400)]
media: netup_unidvb: don't check number of messages in the driver

Since commit 1eace8344c02 ("i2c: add param sanity check to
i2c_transfer()"), the I2C core does this check now. We can remove it
from drivers.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: gl861: fix probe of dvb_usb_gl861
Mika Båtsman [Wed, 16 May 2018 20:32:19 +0000 (16:32 -0400)]
media: gl861: fix probe of dvb_usb_gl861

Probe of dvb_usb_gl861 was working at least with v4.4. Noticed the issue
with v4.13 but according to similar issues the problem started with v4.9.

[   15.288065] transfer buffer not dma capable
[   15.288090] WARNING: CPU: 2 PID: 493 at drivers/usb/core/hcd.c:1595 usb_hcd_map_urb_for_dma+0x4e2/0x640
...CUT...
[   15.288791] dvb_usb_gl861: probe of 3-7:1.0 failed with error -5

Tested with MSI Mega Sky 580 DVB-T Tuner [GL861]

[mchehab+samsung@kernel.org: rebased on the top of upstream]
Cc: stable@vger.kernel.org
Signed-off-by: Mika Båtsman <mika.batsman@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: media-types.rst: codec entities can have more than one source pad
Hans Verkuil [Wed, 25 Jul 2018 13:26:04 +0000 (09:26 -0400)]
media: media-types.rst: codec entities can have more than one source pad

Some decoders and encoders can potentially have more than one source pad,
so update the description to say 'at least one source pad'.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: venus: add HEVC codec support
Stanimir Varbanov [Thu, 5 Jul 2018 13:04:01 +0000 (09:04 -0400)]
media: venus: add HEVC codec support

This add HEVC codec support for venus versions 3xx and 4xx.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: venus: core: add sdm845 DT compatible and resource data
Stanimir Varbanov [Thu, 5 Jul 2018 13:04:00 +0000 (09:04 -0400)]
media: venus: core: add sdm845 DT compatible and resource data

This adds sdm845 DT compatible string with it's resource
data table.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: venus: implementing multi-stream support
Stanimir Varbanov [Thu, 5 Jul 2018 13:03:59 +0000 (09:03 -0400)]
media: venus: implementing multi-stream support

This is implementing multi-stream decoder support. The multi-stream
will be used to enable/disable the primary/secondary decoder
outputs. Depending on formats on both decoder outputs we could
implement downscale, dithering and supporting UBWC (universal
bandwidth compression) formats. The UBWC compressed raw format is
used to optimize interconnect bandwidth for bigger resolutions
like 4K and hence we will get some power-saving benefits as well.

Both decoder outputs are distinguished by buffer_type field in
the HFI packets. For example HFI_BUFFER_OUTPUT is the buffer type
for primary decoder output and HFI_BUFFER_OUTPUT2 is for secondary
decoder output.

Starting from Venus 4xx the DPB buffers format must be UBWC, so
the multi-stream becomes mandatory for this Venus version. That
means that we need to allocate internally in the driver a set of
DPB buffers (with UBWC NV12 format) and give them to the firmware.
The other decoder output (we called it OPB) format will be NV12
linear format and with the same resolution (or smaller in case
the user wants to downscale).

The DPB buffers are used for decoder reference frames and those
have to be in a specific format (UBWC). So one decoder output is
used to fill those reference buffers while the other output is
used to fill the userspace buffers with the user requested format.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: venus: helpers: move frame size calculations on common place
Stanimir Varbanov [Thu, 5 Jul 2018 13:03:58 +0000 (09:03 -0400)]
media: venus: helpers: move frame size calculations on common place

This move the calculations of raw and compressed buffer sizes
on common helper and make it identical for encoder and decoder.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: venus: vdec: a new function for output configuration
Stanimir Varbanov [Thu, 5 Jul 2018 13:03:57 +0000 (09:03 -0400)]
media: venus: vdec: a new function for output configuration

Make a new function vdec_output_conf() for decoder output
configuration. vdec_output_conf() will set properties via
HFI interface related to the output configuration, and
keep vdec_set_properties() which will set properties
related to decoding parameters.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: venus: vdec: get required input buffers as well
Stanimir Varbanov [Thu, 5 Jul 2018 13:03:56 +0000 (09:03 -0400)]
media: venus: vdec: get required input buffers as well

Rework and rename vdec_cap_num_buffers() to get the number of
input buffers too.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: venus: helpers: add a helper to return opb buffer sizes
Stanimir Varbanov [Thu, 5 Jul 2018 13:03:55 +0000 (09:03 -0400)]
media: venus: helpers: add a helper to return opb buffer sizes

Add a helper function to return current output picture buffer size.
OPB sizes can vary depending on the selected decoder output(s).

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: venus: helpers: extend set_num_bufs helper with one more argument
Stanimir Varbanov [Thu, 5 Jul 2018 13:03:54 +0000 (09:03 -0400)]
media: venus: helpers: extend set_num_bufs helper with one more argument

Extend venus_helper_set_num_bufs() helper function with one more
argument to set number of output buffers for the secondary decoder
output.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 years agomedia: venus: helpers, vdec, venc: add helpers to set work mode and core usage
Stanimir Varbanov [Thu, 5 Jul 2018 13:03:53 +0000 (09:03 -0400)]
media: venus: helpers, vdec, venc: add helpers to set work mode and core usage

These are new properties applicable to Venus version 4xx. Add the
helpers and call them from decoder and encoder drivers.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>