openwrt/staging/blogic.git
8 years agoMerge branch 'exynos-drm-next' of git://git.kernel.org/pub/scm/linux/kernel/git/daein...
Dave Airlie [Wed, 2 Mar 2016 07:51:22 +0000 (17:51 +1000)]
Merge branch 'exynos-drm-next' of git://git./linux/kernel/git/daeinki/drm-exynos into drm-next

   Summary:
   - Add Exynos5420 SoC support to FIMD driver.
     . This patch makes MIC(Mobile Image Compressor) IP to be bypassed in default
       in case of Exynos5420 and later. The Display pipe line configuraion for
       Exynos DRM driver will be considered through of graph concept later.
   - Add Exynos5422 SoC support to MIPI-DSI driver.
     . Exynos5422 SoC is similar to Exynos5433 SoC but software reset is different
       each other so this patch consideres the difference.
   - Get more precise clock divider value of FIMD controller.
     . This patch changes DIV_ROUND_CLOSEST macro to be used instead of DIV_ROUND_UP.
   - Refactor Exynos DRM device and driver registeration.
     . This patch makes Exynos DRM driver to be easy-to-read and at the same time,
       cleans it up by removing #ifdef ~ #endif things.
   - Configure DMA-mapping address space common to Exynos DRM devices in more generic
     without any hacks.
   - some fixups and cleanups.

* 'exynos-drm-next' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos: (26 commits)
  drm/exynos/dsi: use core helper to create DSI packet
  drm/exynos: use real device for DMA-mapping operations
  drm/exynos: refactor driver and device registration code
  drm/exynos: use arch independent types in uapi header
  drm/exynos: remove platform data structures and include/drm/exynos_drm.h
  drm/exynos/fimc: remove unused camera interface polarization code
  drm/exynos: remove struct exynos_drm_panel_info
  drm/exynos: add exynos5420 support for fimd
  drm/exynos: use DIV_ROUND_CLOSEST to find the closest div
  drm/exynos: remove incorrect ccflags from Makefile
  drm/exynos/decon: make irq handler static
  drm/exynos/hdmi: remove unused variable
  drm/exynos/dsi: constify read only structures
  drm/exynos/dsi: replace registry access macros with functions
  drm/exynos: support exynos5422 mipi-dsi
  drm/exynos/decon: fix disable clocks order
  drm/exynos: fix incorrect cpu address for dma_mmap_attrs()
  drm/exynos: exynos5433_decon: fix wrong state in decon_vblank_enable
  drm/exynos: exynos5433_decon: fix wrong state assignment in decon_enable
  drm/exynos: dsi: restore support for drm bridge
  ...

8 years agodrm/exynos/dsi: use core helper to create DSI packet
Andrzej Hajda [Wed, 17 Feb 2016 13:33:08 +0000 (14:33 +0100)]
drm/exynos/dsi: use core helper to create DSI packet

Core provides generic helper to create DSI packet, use it instead of
custom code.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/exynos: use real device for DMA-mapping operations
Marek Szyprowski [Mon, 29 Feb 2016 08:50:53 +0000 (17:50 +0900)]
drm/exynos: use real device for DMA-mapping operations

This patch changes device pointer provided to all calls to DMA-mapping
subsystem from the virtual exynos-drm 'device' to the real device pointer
of one of the CRTC devices (decon, fimd or mixer). This way no more hacks
will be needed to configure proper DMA-mapping address space on the common
virtual exynos-drm device. This change also removes the need for some
hacks in IOMMU related code. It also finally solves the problem of Exynos
DRM driver not working on ARM64 architecture, which provides noop-based
DMA-mapping operations for virtual platform devices.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/exynos: refactor driver and device registration code
Marek Szyprowski [Thu, 18 Feb 2016 13:34:16 +0000 (14:34 +0100)]
drm/exynos: refactor driver and device registration code

This patch refactors driver and device registration by moving all drivers
to the common array. This way additional flags can be added later for
new features. #ifdef-based code has been replaced by IS_ENABLED() macro
usage.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/exynos: use arch independent types in uapi header
Andrzej Hajda [Fri, 12 Feb 2016 12:13:59 +0000 (13:13 +0100)]
drm/exynos: use arch independent types in uapi header

User API structs should not use types which size/alignment/padding depends
on architecture. The patch fixes it for all structures except
drm_exynos_g2d_userptr, as g2d related stuff seems to be more complicated
and will be reviewed/adjusted later.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/exynos: remove platform data structures and include/drm/exynos_drm.h
Andrzej Hajda [Fri, 12 Feb 2016 12:13:58 +0000 (13:13 +0100)]
drm/exynos: remove platform data structures and include/drm/exynos_drm.h

Platform data structures are not used for long time so the whole header
file can be safely removed.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/exynos/fimc: remove unused camera interface polarization code
Andrzej Hajda [Fri, 12 Feb 2016 12:13:57 +0000 (13:13 +0100)]
drm/exynos/fimc: remove unused camera interface polarization code

Polarization was never configured for DRM-FIMC device, so fimc_set_polarity
function did nothing. In fact DRM does not use camera interface so there
is no point in configuring it.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/exynos: remove struct exynos_drm_panel_info
Andrzej Hajda [Fri, 12 Feb 2016 12:13:56 +0000 (13:13 +0100)]
drm/exynos: remove struct exynos_drm_panel_info

struct exynos_drm_panel_info is not used anymore, except exynos_dp,
which can integrate useful fields directly into its context.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/exynos: add exynos5420 support for fimd
Chanho Park [Fri, 12 Feb 2016 13:31:39 +0000 (22:31 +0900)]
drm/exynos: add exynos5420 support for fimd

This patch adds a exynos5420 driver data to support mic_bypass
option to bypass the mic from display out path.
The mic(Mobile image compressor) compresses RGB data from fimd
and send the compressed data to the mipi dsi.
The bypass option can be founded from system register and the bit
is 11. The option bit has been introduced since exynos5420. The
only difference between exynos5250 and exynos5420/exynos5422 is
existence of the bit. Until the MIC is defined and enabled from
device tree, the bypass mic will be default option.

Signed-off-by: Chanho Park <chanho61.park@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/exynos: use DIV_ROUND_CLOSEST to find the closest div
Chanho Park [Thu, 11 Feb 2016 14:11:20 +0000 (23:11 +0900)]
drm/exynos: use DIV_ROUND_CLOSEST to find the closest div

This patch uses DIV_ROUND_CLOSEST instead of DIV_ROUND_UP
The DIV_ROUND_CLOSEST can be used to find the closest integer
value when we divide some integers.

Signed-off-by: Chanho Park <chanho61.park@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/exynos: remove incorrect ccflags from Makefile
Andrzej Hajda [Wed, 24 Feb 2016 14:15:22 +0000 (15:15 +0100)]
drm/exynos: remove incorrect ccflags from Makefile

Include directories are provided by core already, adding them in driver
is redundand and causes warnings in case of out-of-tree build.

v2:
    - fixed include in exynos_drm_iommu.c
    - typo in commit message

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/exynos/decon: make irq handler static
Andrzej Hajda [Thu, 11 Feb 2016 11:55:46 +0000 (12:55 +0100)]
drm/exynos/decon: make irq handler static

The function is used only locally.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/exynos/hdmi: remove unused variable
Andrzej Hajda [Thu, 11 Feb 2016 11:55:45 +0000 (12:55 +0100)]
drm/exynos/hdmi: remove unused variable

The variable is unused for long time.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/exynos/dsi: constify read only structures
Andrzej Hajda [Thu, 11 Feb 2016 11:55:44 +0000 (12:55 +0100)]
drm/exynos/dsi: constify read only structures

All global variables are read only.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/exynos/dsi: replace registry access macros with functions
Andrzej Hajda [Thu, 11 Feb 2016 11:55:43 +0000 (12:55 +0100)]
drm/exynos/dsi: replace registry access macros with functions

Functions are preferred over macros as more type-safe.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/exynos: support exynos5422 mipi-dsi
Chanho Park [Sat, 30 Jan 2016 14:11:50 +0000 (23:11 +0900)]
drm/exynos: support exynos5422 mipi-dsi

This patch supports mipi dsi for exynos5422. The dsi register
offsets of the exynos5422 are similar with exynos5433. However,
the values of the registers are quite different from the
exynos5433. For example, the exynos5422 uses sw reset like
previous chips.

Signed-off-by: Chanho Park <chanho61.park@samsung.com>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/exynos/decon: fix disable clocks order
Andrzej Hajda [Thu, 11 Feb 2016 11:25:04 +0000 (12:25 +0100)]
drm/exynos/decon: fix disable clocks order

Decon requires that clocks should be disabled in reverse order. Otherwise
system hangs.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/exynos: fix incorrect cpu address for dma_mmap_attrs()
Marek Szyprowski [Thu, 11 Feb 2016 11:32:07 +0000 (12:32 +0100)]
drm/exynos: fix incorrect cpu address for dma_mmap_attrs()

dma_mmap_attrs() should be called with cpu address returned by
dma_alloc_attrs(). Existing code however passed pages array base as cpu
address. This worked only by a pure luck on ARM architecture. This patch
fixes this issue.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/exynos: exynos5433_decon: fix wrong state in decon_vblank_enable
Marek Szyprowski [Wed, 3 Feb 2016 12:42:54 +0000 (13:42 +0100)]
drm/exynos: exynos5433_decon: fix wrong state in decon_vblank_enable

BIT_IRQS_ENABLED was never set because of incorrect test in
decon_vlank_enable() function, what resulted in lack of enabling vblank
support. This patch fixes this issue.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/exynos: exynos5433_decon: fix wrong state assignment in decon_enable
Marek Szyprowski [Wed, 3 Feb 2016 12:42:53 +0000 (13:42 +0100)]
drm/exynos: exynos5433_decon: fix wrong state assignment in decon_enable

Patch ebf3fd403b79ba6561bd1a4bb5a7cacc99da08e5 ("drm/exynos: add
pm_runtime to DECON 5433") removed some code from decon_enable()
function, but it left set_bit(BIT_SUSPENDED, &ctx->flags) call, which
was earlier called only in error path. This patch removes it, what
finally lets driver to go out of suspended state.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/exynos: dsi: restore support for drm bridge
Marek Szyprowski [Wed, 3 Feb 2016 12:42:51 +0000 (13:42 +0100)]
drm/exynos: dsi: restore support for drm bridge

This patch fixes issue introduced by commit
cf67cc9a29ac19c98bc4fa0e6d14b0c1f592d322 ("drm/exynos: remove struct
exynos_drm_display"), which removed assigning of drm bridge to drm
encoder. Lack of it caused that no bridge callbacks were called on
encoder enable/disable actions.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/exynos: mic: make all functions static
Marek Szyprowski [Wed, 3 Feb 2016 12:42:50 +0000 (13:42 +0100)]
drm/exynos: mic: make all functions static

There is no point exposing all internal functions to global kernel name
space, so make all internals functions static.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/exynos: mic: convert to component framework
Marek Szyprowski [Wed, 3 Feb 2016 12:42:49 +0000 (13:42 +0100)]
drm/exynos: mic: convert to component framework

MIC is SoC component and important part of kms pipeline on Exynos5433,
so convert it to use component framework like other KMS/CRTC drivers.
MIC driver is already listed on KMS component driver list in Exynos DRM
core, so without this conversion, initialization of Exynos DRM core
fails on Exynos 5433 SoC.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/exynos: mic: use devm_clk interface
Marek Szyprowski [Wed, 3 Feb 2016 12:42:48 +0000 (13:42 +0100)]
drm/exynos: mic: use devm_clk interface

Drivers should use devm_clk* interface instead of of_clk* functions.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/exynos: fix types for compilation on 64bit architectures
Marek Szyprowski [Wed, 3 Feb 2016 12:42:47 +0000 (13:42 +0100)]
drm/exynos: fix types for compilation on 64bit architectures

This patch fixes compilation warnings (on 64bit architectures) and bugs
related to casting pointers through 32bit integers.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/exynos: ipp: fix incorrect format specifiers in debug messages
Marek Szyprowski [Wed, 3 Feb 2016 12:42:46 +0000 (13:42 +0100)]
drm/exynos: ipp: fix incorrect format specifiers in debug messages

Drivers should use %p for printing pointers instead of hardcoding them
as hexadecimal integers. This patch fixes compilation warnings on 64bit
architectures.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/exynos: depend on ARCH_EXYNOS for DRM_EXYNOS
Joonyoung Shim [Wed, 3 Feb 2016 12:42:45 +0000 (13:42 +0100)]
drm/exynos: depend on ARCH_EXYNOS for DRM_EXYNOS

Because PLAT_SAMSUNG isn't include exynos SoCs for arm64, but
ARCH_EXYNOS can do it. And it also needs to add ARCH_S3C64XX instead of
PLAT_SAMSUNG.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agoMerge tag 'drm-intel-next-2016-02-14' of git://anongit.freedesktop.org/drm-intel...
Dave Airlie [Tue, 1 Mar 2016 03:06:44 +0000 (13:06 +1000)]
Merge tag 'drm-intel-next-2016-02-14' of git://anongit.freedesktop.org/drm-intel into drm-next

- lots and lots of fbc work from Paulo
- max pixel clock checks from Mika Kahola
- prep work for nv12 offset handling from Ville
- piles of small fixes and refactorings all around

* tag 'drm-intel-next-2016-02-14' of git://anongit.freedesktop.org/drm-intel: (113 commits)
  drm/i915: Update DRIVER_DATE to 20160214
  drm/i915: edp resume/On time optimization.
  agp/intel-gtt: Only register fake agp driver for gen1
  drm/i915: TV pixel clock check
  drm/i915: CRT pixel clock check
  drm/i915: SDVO pixel clock check
  drm/i915: DisplayPort-MST pixel clock check
  drm/i915: HDMI pixel clock check
  drm/i915: DisplayPort pixel clock check
  drm/i915: check that rpm ref is held when accessing ringbuf in stolen mem
  drm/i915: fix error path in intel_setup_gmbus()
  drm/i915: Stop depending upon CONFIG_AGP_INTEL
  agp/intel-gtt: Don't leak the scratch page
  drm/i915: Capture PCI revision and subsytem details in error state
  drm/i915: fix context/engine cleanup order
  drm/i915: Handle PipeC fused off on IVB/HSW/BDW
  drm/i915/skl: Fix typo in DPLL_CFGCR1 definition
  drm/i915: Skip DDI PLL selection for DSI
  drm/i915/skl: Explicitly check for eDP in skl_ddi_pll_select()
  drm/i915/skl: Don't skip mst encoders in skl_ddi_pll_select()
  ...

8 years agoMerge tag 'drm-amdkfd-next-2016-02-27' of git://people.freedesktop.org/~gabbayo/linux...
Dave Airlie [Tue, 1 Mar 2016 02:33:33 +0000 (12:33 +1000)]
Merge tag 'drm-amdkfd-next-2016-02-27' of git://people.freedesktop.org/~gabbayo/linux into drm-next

Here are a few amdkfd patches for 4.6.
These patches defer radeon/amdgpu loading in case amdkfd is not yet loaded,
by returning -EPROBE_DEFER during their probing stage.

* tag 'drm-amdkfd-next-2016-02-27' of git://people.freedesktop.org/~gabbayo/linux:
  drm/amdgpu: Return -EPROBE_DEFER when amdkfd not loaded
  drm/radeon: Return -EPROBE_DEFER when amdkfd not loaded
  drm/amdkfd: Track when module's init is complete

8 years agodrm/amdgpu: Return -EPROBE_DEFER when amdkfd not loaded
Oded Gabbay [Tue, 9 Feb 2016 11:30:12 +0000 (13:30 +0200)]
drm/amdgpu: Return -EPROBE_DEFER when amdkfd not loaded

amdgpu must load only after amdkfd's loading has been completed. If that
is not enforced, then amdgpu's call into amdkfd's functions will cause a
kernel BUG.

When amdgpu and amdkfd are built as kernel modules, that rule is enforced
by the kernel's modules loading mechanism. When amdgpu and amdkfd are
built inside the kernel image, that rule is enforced by ordering in the
drm Makefile (amdkfd before amdgpu).

Instead of using drm Makefile ordering, we can now use deferred loading
as amdkfd now returns -EPROBE_DEFER in kgd2kfd_init() when it is not yet
loaded.

This patch defers amdgpu loading by propagating -EPROBE_DEFER to the
kernel's drivers loading infrastructure. That will put amdgpu into the
pending drivers list (see description in dd.c). Once amdkfd is loaded,
a call to kgd2kfd_init() will return successfully and amdgpu will be able
to load.

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/radeon: Return -EPROBE_DEFER when amdkfd not loaded
Oded Gabbay [Tue, 9 Feb 2016 11:30:04 +0000 (13:30 +0200)]
drm/radeon: Return -EPROBE_DEFER when amdkfd not loaded

radeon must load only after amdkfd's loading has been completed. If that
is not enforced, then radeon's call into amdkfd's functions will cause a
kernel BUG.

When radeon and amdkfd are built as kernel modules, that rule is
enforced by the kernel's modules loading mechanism. When radeon and
amdkfd are built inside the kernel image, that rule is enforced by
ordering in the drm Makefile (amdkfd before radeon).

Instead of using drm Makefile ordering, we can now use deferred
loading as amdkfd now returns -EPROBE_DEFER in kgd2kfd_init() when it is
not yet loaded.

This patch defers radeon loading by propagating -EPROBE_DEFER to the
kernel's drivers loading infrastructure. That will put radeon into the
pending drivers list (see description in dd.c). Once amdkfd is loaded,
a call to kgd2kfd_init() will return successfully and radeon will be
able to load.

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdkfd: Track when module's init is complete
Oded Gabbay [Sat, 13 Feb 2016 08:14:07 +0000 (10:14 +0200)]
drm/amdkfd: Track when module's init is complete

Current dependencies between amdkfd and radeon/amdgpu force the loading
of amdkfd _before_ radeon and/or amdgpu are loaded. When all these kernel
drivers are built as modules, this ordering is enforced by the kernel
built-in mechanism of loading dependent modules.

However, there is no such mechanism in case where all these drivers are
compiled inside the kernel image (not as modules). The current way to
enforce loading of amdkfd before radeon/amdgpu, is to put amdkfd before
radeon/amdgpu in the drm Makefile, but that method is way too fragile.

In addition, there is no kernel mechanism to check whether a kernel
driver that is built inside the kernel image, has already been loaded.

To solve this, this patch adds to kfd_module.c a new static variable,
amdkfd_init_completed, that is set to 1 only when amdkfd's
module initialization function has been completed (successfully).

kgd2kfd_init(), which is the initialization function of the
kgd-->kfd interface, and which is the first function in amdkfd called by
radeon/amdgpu, will return successfully only if amdkfd_init_completed is
equal 1.

If amdkfd_init_completed is not equal to 1, kgd2kfd_init() will
return -EPROBE_DEFER to signal radeon/amdgpu they need to defer
their loading until amdkfd is loaded.

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoMerge branch 'for-next' of http://git.agner.ch/git/linux-drm-fsl-dcu into drm-next
Dave Airlie [Fri, 26 Feb 2016 03:02:57 +0000 (13:02 +1000)]
Merge branch 'for-next' of git.agner.ch/git/linux-drm-fsl-dcu into drm-next

As previously discussed, this is my first pull request for the DCU DRM
driver along with the change in MAINTAINERS.
https://lkml.org/lkml/2016/1/7/26

The pull contains some code cleanup changes (e.g. removing all error
handling for the regmap calls) and several fixes.

* 'for-next' of http://git.agner.ch/git/linux-drm-fsl-dcu:
  drm/fsl-dcu: fix register initialization
  drm/fsl-dcu: use mode flags for hsync/vsync polarity
  drm/fsl-dcu: fix alpha blending
  drm/fsl-dcu: mask all interrupts on initialization
  drm/fsl-dcu: handle initialization errors properly
  drm/fsl-dcu: avoid memory leak on errors
  drm/fsl-dcu: remove regmap return value checks
  drm/fsl-dcu: specify volatile registers
  drm: fsl-dcu: Fix no fb check bug
  MAINTAINERS: update for Freescale DCU DRM driver

8 years agodrm/fsl-dcu: fix register initialization
Stefan Agner [Fri, 15 Jan 2016 01:24:29 +0000 (17:24 -0800)]
drm/fsl-dcu: fix register initialization

The layer enumeration start with 0 (0-15 for LS1021a and 0-63 for
Vybrid) whereas the register enumeration start from 1 (1-10 for
LS1021a and 1-9 for Vybrid). The loop started off from 0 for both
iterations and initialized the number of layers inclusive, which
is one layer too many.

All extensively written registers seem to be unassigned, it seems
that the write to those registers did not do any harm in practice.

Signed-off-by: Stefan Agner <stefan@agner.ch>
8 years agodrm/fsl-dcu: use mode flags for hsync/vsync polarity
Stefan Agner [Wed, 18 Nov 2015 03:10:29 +0000 (19:10 -0800)]
drm/fsl-dcu: use mode flags for hsync/vsync polarity

The current default configuration is as follows:
- Invert VSYNC signal (active LOW)
- Invert HSYNC signal (active LOW)

The mode flags allow to specify the required polarity per
mode. Furthermore, none of the current driver settings is
actually a standard polarity.

This patch applies the current driver default polarities as
explicit flags to the display which has been introduced with
the driver (NEC WQVGA "nec,nl4827hc19-05b"). The driver now
also parses the flags field and applies the configuration
accordingly, by using the following values as standard
polarities: (e.g. when no flags are specified):
- VSYNC signal not inverted (active HIGH)
- HSYNC signal not inverted (active HIGH)

Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Stefan Agner <stefan@agner.ch>
8 years agodrm/fsl-dcu: fix alpha blending
Stefan Agner [Wed, 18 Nov 2015 22:47:35 +0000 (14:47 -0800)]
drm/fsl-dcu: fix alpha blending

Fix alpha blending by enabling alpha blending for the whole frame if
a color mode with alpha channel is selected (DRM_FORMAT_ARGB*). Also
support color modes without alpha channel (DRM_FORMAT_XRGB*) by just
not enabling alpha blending on layer level.

Signed-off-by: Stefan Agner <stefan@agner.ch>
8 years agodrm/fsl-dcu: mask all interrupts on initialization
Stefan Agner [Thu, 19 Nov 2015 01:27:04 +0000 (17:27 -0800)]
drm/fsl-dcu: mask all interrupts on initialization

The state of the interrupt mask register on initialization is
unknown, e.g. U-Boot could already used the DCU. So depending on
the boot loader, the outcome of the interrupt mask register could
be different. A defined state is much more preferable. Also, there
is no value in keeping interrupts enabled which we don't need.
Therefor, mask all interrupts on initialization.

Signed-off-by: Stefan Agner <stefan@agner.ch>
8 years agodrm/fsl-dcu: handle initialization errors properly
Stefan Agner [Tue, 17 Nov 2015 00:25:17 +0000 (16:25 -0800)]
drm/fsl-dcu: handle initialization errors properly

If initialization fails (e.g. due to missing panel node or deferred
probe) make sure to roll-back all operations and return the error
code.

Signed-off-by: Stefan Agner <stefan@agner.ch>
8 years agodrm/fsl-dcu: avoid memory leak on errors
Stefan Agner [Mon, 16 Nov 2015 23:43:34 +0000 (15:43 -0800)]
drm/fsl-dcu: avoid memory leak on errors

Improve error handling during CRTC initialization. Especially avoid
memory leaks in the primary plane initialization error path.

Signed-off-by: Stefan Agner <stefan@agner.ch>
8 years agodrm/fsl-dcu: remove regmap return value checks
Stefan Agner [Thu, 19 Nov 2015 00:50:55 +0000 (16:50 -0800)]
drm/fsl-dcu: remove regmap return value checks

It is not common to do regmap return value checks, especially not
for memory mapped device. We can rule out most error returns since
the conditions are static and we know they are ok (e.g. offset
aligned to register stride). Also without proper error handling
they are not really valuable for the user. Hence remove most of
them.

The check in the interrupt handler is worth keeping since a
volatile register won't be readable in case register caching is
still enabled.

Signed-off-by: Stefan Agner <stefan@agner.ch>
8 years agodrm/fsl-dcu: specify volatile registers
Stefan Agner [Wed, 18 Nov 2015 02:05:25 +0000 (18:05 -0800)]
drm/fsl-dcu: specify volatile registers

Since we are using cached registers, we need to specify volatile
registers explicitly to avoid reading their value from the cache.
This allows to read the correct interrupt status in fsl_dcu_drm_irq
and clear the asserted bits only.

Signed-off-by: Stefan Agner <stefan@agner.ch>
8 years agodrm: fsl-dcu: Fix no fb check bug
Meng Yi [Wed, 6 Jan 2016 04:12:05 +0000 (12:12 +0800)]
drm: fsl-dcu: Fix no fb check bug

For state->fb or state->crtc may be NULL in fsl_dcu_drm_plane_atomic_check
function, if so, return 0.

Signed-off-by: Meng Yi <meng.yi@nxp.com>
Signed-off-by: Jianwei Wang <jianwei.wang.chn@gmail.com>
Signed-off-by: Stefan Agner <stefan@agner.ch>
8 years agoMAINTAINERS: update for Freescale DCU DRM driver
Stefan Agner [Thu, 7 Jan 2016 06:02:46 +0000 (22:02 -0800)]
MAINTAINERS: update for Freescale DCU DRM driver

Promote myself as new maintainer of the Freescale DCU DRM driver.

Acked-by: Jianwei Wang <jianwei.wang.chn@gmail.com>
Signed-off-by: Stefan Agner <stefan@agner.ch>
8 years agoMerge branch 'drm/next/du' of git://linuxtv.org/pinchartl/fbdev into drm-next
Dave Airlie [Thu, 25 Feb 2016 00:30:59 +0000 (10:30 +1000)]
Merge branch 'drm/next/du' of git://linuxtv.org/pinchartl/fbdev into drm-next

rcar-du updates.

* 'drm/next/du' of git://linuxtv.org/pinchartl/fbdev: (281 commits)
  drm: rcar-du: Add tri-planar memory formats support
  drm: rcar-du: Add probe deferral debug messages
  drm: rcar-du: lvds: Add R-Car Gen3 support
  drm: rcar-du: lvds: Rename PLLEN bit to PLLON
  drm: rcar-du: lvds: Fix PLL frequency-related configuration
  drm: rcar-du: lvds: Avoid duplication of clock clamp code
  drm: rcar-du: Add R8A7795 device support
  drm: rcar-du: Output the DISP signal on the ODDF pin
  drm: rcar-du: Output the DISP signal on the DISP pin
  drm: rcar-du: Support up to 4 CRTCs
  drm: rcar-du: Drop LVDS double dependency on OF
  drm: rcar-du: Enable compilation on ARM64
  drm: rcar-du: Fix compile warning on 64-bit platforms
  drm: rcar-du: Expose the VSP1 compositor through KMS planes
  drm: rcar-du: Move plane allocator to rcar_du_plane.c
  drm: rcar-du: Restart the DU group when a plane source changes
  drm: rcar-du: Add VSP1 compositor support
  drm: rcar-du: Add VSP1 support to the planes allocator
  drm: rcar-du: Refactor plane setup
  drm: rcar-du: Compute plane DDCR4 register value directly
  ...

8 years agodrm: rcar-du: Add tri-planar memory formats support
Laurent Pinchart [Thu, 12 Nov 2015 00:03:47 +0000 (02:03 +0200)]
drm: rcar-du: Add tri-planar memory formats support

Those formats are supported on Gen3 only.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Add probe deferral debug messages
Laurent Pinchart [Wed, 21 Oct 2015 22:09:30 +0000 (01:09 +0300)]
drm: rcar-du: Add probe deferral debug messages

Print a message when the HDMI I2C slave encoder can't be found to help
debugging probe deferral issues.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: lvds: Add R-Car Gen3 support
Koji Matsuoka [Tue, 28 Jul 2015 11:12:43 +0000 (20:12 +0900)]
drm: rcar-du: lvds: Add R-Car Gen3 support

The LVDS encoder differs slightly in Gen3 SoCs in its PLL configuration.
Add support for the Gen3 LVDS PLL parameters and startup procedure.

Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: lvds: Rename PLLEN bit to PLLON
Laurent Pinchart [Mon, 7 Sep 2015 12:28:17 +0000 (15:28 +0300)]
drm: rcar-du: lvds: Rename PLLEN bit to PLLON

The bit is named PLLON in the datasheet, rename it.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: lvds: Fix PLL frequency-related configuration
Laurent Pinchart [Mon, 7 Sep 2015 13:03:25 +0000 (16:03 +0300)]
drm: rcar-du: lvds: Fix PLL frequency-related configuration

The frequency checks don't match the datasheet, fix them.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: lvds: Avoid duplication of clock clamp code
Laurent Pinchart [Mon, 7 Sep 2015 12:44:44 +0000 (15:44 +0300)]
drm: rcar-du: lvds: Avoid duplication of clock clamp code

Replace the duplicate code by a single central function.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Add R8A7795 device support
Laurent Pinchart [Mon, 7 Sep 2015 14:34:26 +0000 (17:34 +0300)]
drm: rcar-du: Add R8A7795 device support

Document the R8A7795-specific DT bindings and support them in the
driver. The HDMI and LVDS outputs are currently not supported.

Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Output the DISP signal on the ODDF pin
Laurent Pinchart [Mon, 7 Sep 2015 15:09:55 +0000 (18:09 +0300)]
drm: rcar-du: Output the DISP signal on the ODDF pin

The ODDF signal, output by default on the ODDF pin, isn't used on any
board supported in the kernel. As the Gen3 Salvator-X board uses the
ODDF pin as a DISP signal, hardcode that configuration in the driver.

Use of the ODDF signal will be implemented later through proper DT-based
configuration of the DU pins.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Output the DISP signal on the DISP pin
Laurent Pinchart [Mon, 7 Sep 2015 19:02:14 +0000 (22:02 +0300)]
drm: rcar-du: Output the DISP signal on the DISP pin

The DE signal is currently configured to be identical to the DISP
signal and is used for the same purpose. To make it clearer that the
DISP pin outputs the DISP signal, select it explicitly.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Support up to 4 CRTCs
Koji Matsuoka [Fri, 4 Sep 2015 10:49:05 +0000 (19:49 +0900)]
drm: rcar-du: Support up to 4 CRTCs

The Gen3 R8A7795 DU has 4 CRTCs, support them all.

Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Drop LVDS double dependency on OF
Laurent Pinchart [Mon, 7 Sep 2015 11:47:01 +0000 (14:47 +0300)]
drm: rcar-du: Drop LVDS double dependency on OF

LVDS support depends on DRM_RCAR_DU which already depends on OF. Drop
the explicit dependency.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Enable compilation on ARM64
Koji Matsuoka [Fri, 7 Aug 2015 12:22:24 +0000 (21:22 +0900)]
drm: rcar-du: Enable compilation on ARM64

The R8A7795 SoC is ARM64-based and include a DU. Enable driver
compilation on ARM64.

Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Fix compile warning on 64-bit platforms
Koji Matsuoka [Wed, 26 Aug 2015 00:37:08 +0000 (09:37 +0900)]
drm: rcar-du: Fix compile warning on 64-bit platforms

Use %tu instead of %u to print difference between pointers.

Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Expose the VSP1 compositor through KMS planes
Laurent Pinchart [Mon, 7 Sep 2015 14:14:58 +0000 (17:14 +0300)]
drm: rcar-du: Expose the VSP1 compositor through KMS planes

On R-Car Gen3 SoCs the DU lost its ability to access memory directly and
needs to work in conjunction with the VSP to do so. This commit handles
the VSP internally to hide it from the user.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Move plane allocator to rcar_du_plane.c
Laurent Pinchart [Mon, 27 Jul 2015 12:34:18 +0000 (15:34 +0300)]
drm: rcar-du: Move plane allocator to rcar_du_plane.c

The plane allocator is specific to DU planes and won't be used for
VSP-based planes, move it with the rest of the DU planes code where it
belongs.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Restart the DU group when a plane source changes
Laurent Pinchart [Sat, 24 Aug 2013 00:17:03 +0000 (02:17 +0200)]
drm: rcar-du: Restart the DU group when a plane source changes

Plane sources are configured by the VSPS bit in the PnDDCR4 register.
Although the datasheet states that the bit is updated during vertical
blanking, it seems that updates only occur when the DU group is held in
reset through the DSYSR.DRES bit. Restart the group if the source
changes.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Add VSP1 compositor support
Laurent Pinchart [Fri, 21 Jun 2013 15:54:50 +0000 (17:54 +0200)]
drm: rcar-du: Add VSP1 compositor support

Configure the plane source at plane setup time to source frames from
memory or from the VSP1.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Add VSP1 support to the planes allocator
Laurent Pinchart [Fri, 21 Jun 2013 15:36:15 +0000 (17:36 +0200)]
drm: rcar-du: Add VSP1 support to the planes allocator

The R8A7790 DU can source frames directly from the VSP1 devices VSPD0
and VSPD1. VSPD0 feeds DU0/1 plane 0, and VSPD1 feeds either DU2 plane 0
or DU0/1 plane 1.

Allocate the correct fixed plane when sourcing frames from VSPD0 or
VSPD1, and allocate planes in reverse index order otherwise to ensure
maximum availability of planes 0 and 1.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Refactor plane setup
Laurent Pinchart [Mon, 27 Jul 2015 10:43:09 +0000 (13:43 +0300)]
drm: rcar-du: Refactor plane setup

Rename plane setup functions using more explicit names, and use local
variables to store intermediate values to increase readability. This
also prepares for VSP compositor support.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Compute plane DDCR4 register value directly
Laurent Pinchart [Mon, 27 Jul 2015 09:46:44 +0000 (12:46 +0300)]
drm: rcar-du: Compute plane DDCR4 register value directly

There's no need for a read-modify-write pattern, all register bits can
be set explicitly.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Don't update planes on disabled CRTCs
Laurent Pinchart [Thu, 10 Sep 2015 15:52:55 +0000 (18:52 +0300)]
drm: rcar-du: Don't update planes on disabled CRTCs

A disabled CRTC can't display planes, the driver shouldn't try to
configure it when updating planes. The DRM core will store the plane
state for us, and the plane will be configured appropriately the next
time the CRTC is enabled.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Remove local CRTC enabled state
Laurent Pinchart [Sun, 24 Jan 2016 22:28:11 +0000 (00:28 +0200)]
drm: rcar-du: Remove local CRTC enabled state

The atomic framework guarantees that the CRTC enable and disable
functions will only be called when needed, there's no need to duplicate
the CRTC state check. By replacing the local CRTC enabled state check at
resume time with the CRTC active state we can remove the local CRTC
enabled state altogether.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
8 years agodrm: rcar-du: Perform initialization/cleanup at probe/remove time
Laurent Pinchart [Mon, 28 Sep 2015 15:39:53 +0000 (18:39 +0300)]
drm: rcar-du: Perform initialization/cleanup at probe/remove time

The drm driver .load() operation is prone to race conditions as it
initializes the driver after registering the device nodes. Its usage is
deprecated, inline it in the probe function and call drm_dev_alloc() and
drm_dev_register() explicitly.

For consistency inline the .unload() handler in the remove function as
well.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
8 years agoMerge remote-tracking branch 'linuxtv/vsp1' into HEAD
Laurent Pinchart [Sat, 20 Feb 2016 00:58:43 +0000 (02:58 +0200)]
Merge remote-tracking branch 'linuxtv/vsp1' into HEAD

8 years ago[media] vsp1_drm.h: add missing prototypes
Mauro Carvalho Chehab [Fri, 19 Feb 2016 12:02:53 +0000 (10:02 -0200)]
[media] vsp1_drm.h: add missing prototypes

drivers/media/platform/vsp1/vsp1_drm.c:47:5: warning: no previous prototype for 'vsp1_du_init' [-Wmissing-prototypes]
 int vsp1_du_init(struct device *dev)
     ^
drivers/media/platform/vsp1/vsp1_drm.c:76:5: warning: no previous prototype for 'vsp1_du_setup_lif' [-Wmissing-prototypes]
 int vsp1_du_setup_lif(struct device *dev, unsigned int width,
     ^
drivers/media/platform/vsp1/vsp1_drm.c:221:6: warning: no previous prototype for 'vsp1_du_atomic_begin' [-Wmissing-prototypes]
 void vsp1_du_atomic_begin(struct device *dev)
      ^
drivers/media/platform/vsp1/vsp1_drm.c:273:5: warning: no previous prototype for 'vsp1_du_atomic_update' [-Wmissing-prototypes]
 int vsp1_du_atomic_update(struct device *dev, unsigned int rpf_index,
     ^
drivers/media/platform/vsp1/vsp1_drm.c:451:6: warning: no previous prototype for 'vsp1_du_atomic_flush' [-Wmissing-prototypes]
 void vsp1_du_atomic_flush(struct device *dev)
      ^

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Configure device based on IP version
Laurent Pinchart [Sat, 5 Dec 2015 22:17:10 +0000 (20:17 -0200)]
[media] v4l: vsp1: Configure device based on IP version

The IP version number carries enough information to identify the exact
device instance features. Drop the related DT properties and use the IP
version instead.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Add display list support
Takashi Saito [Mon, 7 Sep 2015 04:40:25 +0000 (01:40 -0300)]
[media] v4l: vsp1: Add display list support

Display lists contain lists of registers and associated values to be
applied atomically by the hardware. They lower the pressure on interrupt
processing delays when reprogramming the device as settings can be
prepared well in advance and queued to the hardware without waiting for
the end of the current frame.

Display list support is currently limited to the DRM pipeline.

Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Add support for the R-Car Gen3 VSP2
Laurent Pinchart [Mon, 7 Sep 2015 11:05:39 +0000 (08:05 -0300)]
[media] v4l: vsp1: Add support for the R-Car Gen3 VSP2

Add DT compatible strings for the VSP2 instances found in the R-Car Gen3
SoCs and support them in the vsp1 driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Implement atomic update for the DRM driver
Laurent Pinchart [Thu, 10 Sep 2015 12:28:39 +0000 (09:28 -0300)]
[media] v4l: vsp1: Implement atomic update for the DRM driver

Add two API functions named vsp1_du_atomic_begin() and
vsp1_du_atomic_flush() to signal the start and end of an atomic update.
The vsp1_du_setup_rpf() function is renamed to vsp1_du_atomic_update()
for consistency.

With this new API, the driver will reprogram all modified inputs
atomically before restarting the video stream.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Disconnect unused RPFs from the DRM pipeline
Laurent Pinchart [Thu, 10 Sep 2015 18:56:29 +0000 (15:56 -0300)]
[media] v4l: vsp1: Disconnect unused RPFs from the DRM pipeline

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Add VSP+DU support
Laurent Pinchart [Sun, 2 Aug 2015 21:37:01 +0000 (18:37 -0300)]
[media] v4l: vsp1: Add VSP+DU support

Implement internal control of the VSP pipeline to be used by the DU
DRM/KMS driver when using the VSP as an internal composer handled
through DRM/KMS only.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Don't validate links when the userspace API is disabled
Laurent Pinchart [Wed, 5 Aug 2015 20:14:41 +0000 (17:14 -0300)]
[media] v4l: vsp1: Don't validate links when the userspace API is disabled

As the pipeline is configured internally by the driver when the
userspace API is disabled its configuration can be trusted and link
validation isn't needed.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Set the alpha value manually in RPF and WPF s_stream handlers
Laurent Pinchart [Wed, 5 Aug 2015 19:57:35 +0000 (16:57 -0300)]
[media] v4l: vsp1: Set the alpha value manually in RPF and WPF s_stream handlers

The RPF and WPF alpha values are set through V4L2 controls and applied
when starting the video stream by a call to v4l2_ctrl_handler_setup().
As that function uses the control handler mutex it can't be called in
interrupt context, where the VSP+DU pipeline handler might need to
reconfigure the pipeline.

Set the alpha value manually in the RPF and WPF s_stream handler to
ensure that the hardware is properly configured even when controlled
without the userspace API. If the userspace API is enabled protect that
with the control lock to avoid race conditions with userspace.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Make pipeline inputs array index by RPF index
Laurent Pinchart [Wed, 5 Aug 2015 19:40:31 +0000 (16:40 -0300)]
[media] v4l: vsp1: Make pipeline inputs array index by RPF index

The pipeline inputs array stores pointers to all RPFs contained in the
pipeline. It's currently indexed contiguously by adding RPFs in the
order they are found during graph walk. This can't easily support
dynamic addition and removal of RPFs while streaming, which will be
required for combined VSP+DU support.

Make the array indexed by RPF index instead and skip NULL elements when
iterating over RPFs.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Make the userspace API optional
Laurent Pinchart [Tue, 28 Jul 2015 19:16:05 +0000 (16:16 -0300)]
[media] v4l: vsp1: Make the userspace API optional

The R-Car Gen3 SoCs include VSP instances dedicated to the DU that will
be controlled entirely by the rcar-du-drm driver through the KMS API. To
support that use case make the userspace V4L2 API optional.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Move format info to vsp1_pipe.c
Laurent Pinchart [Mon, 3 Aug 2015 13:21:49 +0000 (10:21 -0300)]
[media] v4l: vsp1: Move format info to vsp1_pipe.c

Format information and the related helper function are not specific to
the V4L2 API, move them from vsp1_video.c to vsp1_pipe.c.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Make the BRU optional
Laurent Pinchart [Fri, 14 Aug 2015 16:53:45 +0000 (13:53 -0300)]
[media] v4l: vsp1: Make the BRU optional

Not all VSP instances have a BRU on R-Car Gen3, make it optional. Set
the feature unconditionally for now, this will be fixed when adding Gen3
support.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Make number of BRU inputs configurable
Laurent Pinchart [Mon, 3 Aug 2015 12:46:26 +0000 (09:46 -0300)]
[media] v4l: vsp1: Make number of BRU inputs configurable

The R-Car Gen3 family has 5-inputs BRUs, support them by making the
number of BRU inputs configurable.

As the driver assumes that the number of BRU inputs is equal to the
number of RPFs, replace the BRU_MAX_INPUTS macro with VSP1_MAX_RPF to
make the assumption apparent.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Move entity route setup function to vsp1_entity.c
Laurent Pinchart [Sun, 2 Aug 2015 21:58:31 +0000 (18:58 -0300)]
[media] v4l: vsp1: Move entity route setup function to vsp1_entity.c

The function will be used by the DU code, move it out of vsp1_video.c.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Remove unused module read functions
Laurent Pinchart [Wed, 9 Sep 2015 14:32:06 +0000 (11:32 -0300)]
[media] v4l: vsp1: Remove unused module read functions

Several module read functions are not used, remove them.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Set the SRU CTRL0 register when starting the stream
Laurent Pinchart [Wed, 9 Sep 2015 14:38:56 +0000 (11:38 -0300)]
[media] v4l: vsp1: Set the SRU CTRL0 register when starting the stream

Commit 58f896d859ce ("[media] v4l: vsp1: sru: Make the intensity
controllable during streaming") refactored the stream start code and
removed the SRU CTRL0 register write by mistake. Add it back.

Fixes: 58f896d859ce ("[media] v4l: vsp1: sru: Make the intensity controllable during streaming")
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Fix typo in VI6_DISP_IRQ_STA_DST register bit name
Laurent Pinchart [Thu, 10 Sep 2015 07:55:46 +0000 (04:55 -0300)]
[media] v4l: vsp1: Fix typo in VI6_DISP_IRQ_STA_DST register bit name

Rename the VI6_DISP_IRQ_STA_DSE register bit to VI6_DISP_IRQ_STA_DST to
fix a typo and match the datasheet.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Document the vsp1_pipeline structure
Laurent Pinchart [Sun, 2 Aug 2015 21:24:55 +0000 (18:24 -0300)]
[media] v4l: vsp1: Document the vsp1_pipeline structure

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Extract link creation to separate function
Laurent Pinchart [Sun, 2 Aug 2015 21:21:12 +0000 (18:21 -0300)]
[media] v4l: vsp1: Extract link creation to separate function

Link creation will be handled differently for the DU pipeline.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Reuse local variable instead of recomputing it
Laurent Pinchart [Sun, 2 Aug 2015 20:43:36 +0000 (17:43 -0300)]
[media] v4l: vsp1: Reuse local variable instead of recomputing it

No need to waste CPU cycles when the value we need is already available.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Extract pipeline initialization code into a function
Laurent Pinchart [Sun, 2 Aug 2015 20:32:13 +0000 (17:32 -0300)]
[media] v4l: vsp1: Extract pipeline initialization code into a function

The code will be reused outside of vsp1_video.c.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Rename video pipeline functions to use vsp1_video prefix
Laurent Pinchart [Sun, 2 Aug 2015 20:29:03 +0000 (17:29 -0300)]
[media] v4l: vsp1: Rename video pipeline functions to use vsp1_video prefix

Those functions are specific to video nodes, rename them for
consistency.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Split pipeline management code from vsp1_video.c
Laurent Pinchart [Sun, 2 Aug 2015 17:15:23 +0000 (14:15 -0300)]
[media] v4l: vsp1: Split pipeline management code from vsp1_video.c

The code will be used to control the vsp1 driver from the DU driver
without using video nodes.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Decouple pipeline end of frame processing from vsp1_video
Laurent Pinchart [Sun, 2 Aug 2015 19:37:11 +0000 (16:37 -0300)]
[media] v4l: vsp1: Decouple pipeline end of frame processing from vsp1_video

To make the pipeline structure and operations usable without video
devices the frame end processing must be decoupled from struct
vsp1_video. Implement this by calling the video frame end function
indirectly through a function pointer in struct vsp1_pipeline.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Remove struct vsp1_pipeline num_video field
Laurent Pinchart [Sun, 2 Aug 2015 20:17:15 +0000 (17:17 -0300)]
[media] v4l: vsp1: Remove struct vsp1_pipeline num_video field

The field is always equal to the num_inputs field plus one, remove the
duplicate.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Move vsp1_video pointer from vsp1_entity to vsp1_rwpf
Laurent Pinchart [Sun, 2 Aug 2015 17:58:43 +0000 (14:58 -0300)]
[media] v4l: vsp1: Move vsp1_video pointer from vsp1_entity to vsp1_rwpf

Only RPFs and WPFs can be associated with video nodes, don't waste
memory by storing the video pointer in all entities.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Support VSP1 instances without any UDS
Laurent Pinchart [Tue, 28 Jul 2015 19:13:27 +0000 (16:13 -0300)]
[media] v4l: vsp1: Support VSP1 instances without any UDS

Not all VSP1 instances include a UDS. Make the renesas,#uds DT property
optional and accept a number of UDS equal to 0 as valid.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Make rwpf operations independent of video device
Laurent Pinchart [Tue, 28 Jul 2015 19:04:47 +0000 (16:04 -0300)]
[media] v4l: vsp1: Make rwpf operations independent of video device

The rwpf queue operation doesn't queue a buffer but sets the memory
address for the next run. Rename it to set_memory and pass it a new
structure independent of the video buffer than only contains memory
information.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Move video device out of struct vsp1_rwpf
Laurent Pinchart [Tue, 28 Jul 2015 18:46:00 +0000 (15:46 -0300)]
[media] v4l: vsp1: Move video device out of struct vsp1_rwpf

To make the video device nodes optional we need to decouple the [rw]pf
instances from the video devices. Move video devices out of struct
vsp1_rwpf and instantiate them dynamically in the core driver code.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Rename vsp1_video_buffer to vsp1_vb2_buffer
Laurent Pinchart [Tue, 28 Jul 2015 17:17:07 +0000 (14:17 -0300)]
[media] v4l: vsp1: Rename vsp1_video_buffer to vsp1_vb2_buffer

The structure represent a vsp1 videobuf2 buffer, name it accordingly.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Move video operations to vsp1_rwpf
Laurent Pinchart [Tue, 28 Jul 2015 17:05:56 +0000 (14:05 -0300)]
[media] v4l: vsp1: Move video operations to vsp1_rwpf

This removes the dependency of vsp1_rpf and vsp1_wpf on vsp1_video,
making it possible to reuse the operations without a V4L2 video device
node.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>