]> git.baikalelectronics.ru Git - kernel.git/log
kernel.git
6 years agodrm/tegra: Let core take care of normalizing the zpos
Peter Ujfalusi [Wed, 21 Mar 2018 10:20:26 +0000 (12:20 +0200)]
drm/tegra: Let core take care of normalizing the zpos

Set the drm_mode_config->normalize_zpos and call the generic
drm_atomic_helper_check() instead of duplicating it within
tegra_atomic_check().

Call tegra_display_hub_atomic_check() after the drm_atomic_helpre_check()
returned without error.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
CC: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180321102029.15248-4-peter.ujfalusi@ti.com
6 years agodrm/exynos: Let core take care of normalizing the zpos
Peter Ujfalusi [Wed, 21 Mar 2018 10:20:25 +0000 (12:20 +0200)]
drm/exynos: Let core take care of normalizing the zpos

Instead of re-implementing the drm_atomic_helper_check() locally with just
adding drm_atomic_normalize_zpos() into it, set the
drm_mode_config->normalize_zpos.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
CC: Inki Dae <inki.dae@samsung.com>
CC: Joonyoung Shim <jy0922.shim@samsung.com>
CC: Seung-Woo Kim <sw0312.kim@samsung.com>
CC: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180321102029.15248-3-peter.ujfalusi@ti.com
6 years agodrm: Add drm_mode_config->normalize_zpos boolean
Peter Ujfalusi [Wed, 21 Mar 2018 10:20:24 +0000 (12:20 +0200)]
drm: Add drm_mode_config->normalize_zpos boolean

Instead of drivers duplicating the drm_atomic_helper_check() code to be
able to normalize the zpos they can use the normalize_zpos flag to let the
drm core to do it.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180321102029.15248-2-peter.ujfalusi@ti.com
6 years agodrm: make drm_core_check_feature() bool that it is
Jani Nikula [Tue, 27 Mar 2018 20:47:22 +0000 (23:47 +0300)]
drm: make drm_core_check_feature() bool that it is

Bool is the more appropriate return type here, use it.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180327204722.31246-3-jani.nikula@intel.com
6 years agodrm: remove old documentation comment cruft from drmP.h
Jani Nikula [Tue, 27 Mar 2018 20:47:21 +0000 (23:47 +0300)]
drm: remove old documentation comment cruft from drmP.h

Throw out the leftovers.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180327204722.31246-2-jani.nikula@intel.com
6 years agodrm: prefer inline over __inline__
Jani Nikula [Tue, 27 Mar 2018 20:47:20 +0000 (23:47 +0300)]
drm: prefer inline over __inline__

Remove last users of __inline__.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180327204722.31246-1-jani.nikula@intel.com
6 years agodrm/dp/mst: Fix off-by-one typo when dump payload table
Andy Shevchenko [Mon, 19 Mar 2018 14:19:32 +0000 (16:19 +0200)]
drm/dp/mst: Fix off-by-one typo when dump payload table

It seems there is a classical off-by-one typo from the beginning
when commit

  6fa9de008283 ("drm/helper: add Displayport multi-stream helper (v0.6)")

introduced a new helper.

Fix a typo by introducing a macro constant.

Cc: Dave Airlie <airlied@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180319141932.37290-1-andriy.shevchenko@linux.intel.com
6 years agodrm/tinydrm: Use gem_free_object_unlocked
Daniel Vetter [Thu, 22 Mar 2018 10:51:28 +0000 (11:51 +0100)]
drm/tinydrm: Use gem_free_object_unlocked

tinydrm doesn't use dev->struct_mutex and therefore has no need to use
gem_free_object.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: "Noralf Trønnes" <noralf@tronnes.org>
Acked-by: Noralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180322105133.11211-2-daniel.vetter@ffwll.ch
6 years agodrm/scdc-helper: Convert errors into debug messages
Ville Syrjälä [Fri, 23 Mar 2018 18:25:37 +0000 (20:25 +0200)]
drm/scdc-helper: Convert errors into debug messages

Since we may attempt to reconfigure SCDC when the sink has already been
disconnected we probably shouldn't scare the user with errors in dmesg
that are 100% expected in that case. Just leave it up to the caller
whether to print an error message or not, and just output debug
messages from the helper itself.

Cc: Shashank Sharma <shashank.sharma@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180323182537.30784-1-ville.syrjala@linux.intel.com
Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
6 years agodrm/gem: Document that handle_create must be the last step
Daniel Vetter [Thu, 22 Mar 2018 08:02:33 +0000 (09:02 +0100)]
drm/gem: Document that handle_create must be the last step

It published the gem object to userspace, by that point other threads
can guess the id and start using it. And gem IDs are _very_ easy to
guess (it's just an idr).

Since gem objects is the only thing we allow drivers to create
themselves (all the kms/prime/syncobj stuff is handled by the core) no
other functions seem to be in need of this clarification.

Motivated by reviewing the xen-front kms driver.

Cc: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180322080233.17266-1-daniel.vetter@ffwll.ch
6 years agogpu: drm: nouveau: Use list_{next/prev}_entry instead of list_entry
Arushi Singhal [Sun, 25 Mar 2018 18:01:33 +0000 (23:31 +0530)]
gpu: drm: nouveau: Use list_{next/prev}_entry instead of list_entry

It's better to use list_entry instead of list_{next/prev}_entry
as it makes the code more clear to read.
This patch replace list_entry with list_{next/prev}_entry.

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/1522000893-5331-3-git-send-email-arushisinghal19971997@gmail.com
6 years agogpu: drm/lease:: Use list_{next/prev}_entry instead of list_entry
Arushi Singhal [Sun, 25 Mar 2018 18:01:32 +0000 (23:31 +0530)]
gpu: drm/lease:: Use list_{next/prev}_entry instead of list_entry

It's better to use list_entry instead of list_{next/prev}_entry
as it makes the code more clear to read.
This patch replace list_entry with list_{next/prev}_entry.

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/1522000893-5331-2-git-send-email-arushisinghal19971997@gmail.com
6 years agodrm: Remove drm_property_{un/reference}_blob aliases
Haneen Mohammed [Tue, 20 Mar 2018 13:37:49 +0000 (09:37 -0400)]
drm: Remove drm_property_{un/reference}_blob aliases

This patch remove the compatibility aliases
drm_property_{reference/unreference}_blob of
drm_property_blob_{get/put} since all callers have been converted to the
prefered _{get/put}.

Remove the helpers from the semantic patch drm-get-put-cocci.

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180320133749.GA11695@haneen-VirtualBox
6 years agoMerge airlied/drm-next into drm-misc-next
Sean Paul [Wed, 21 Mar 2018 13:40:55 +0000 (09:40 -0400)]
Merge airlied/drm-next into drm-misc-next

Refresh -misc-next

Signed-off-by: Sean Paul <seanpaul@chromium.org>
6 years agodrm/qxl: Replace drm_gem_object_reference/unreference() with _get/put()
Santha Meena Ramamoorthy [Tue, 20 Mar 2018 18:29:27 +0000 (11:29 -0700)]
drm/qxl: Replace drm_gem_object_reference/unreference() with _get/put()

Replace drm_gem_object_reference/unreference function with *_get/put()
suffixes, because it is shorter and consistent with the kernel
kref_get/put() functions. The following Coccinelle script was used:

@@
expression e;
@@

(
-drm_gem_object_reference(e);
+drm_gem_object_get(e);
|
-drm_gem_object_unreference(e);
+drm_gem_object_put(e);
|
-drm_gem_object_unreference_unlocked(e);
+drm_gem_object_put_unlocked(e);
)

Signed-off-by: Santha Meena Ramamoorthy <santhameena13@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/1521570567-22519-1-git-send-email-santhameena13@gmail.com
6 years agoMerge tag 'omapdrm-4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux...
Dave Airlie [Wed, 21 Mar 2018 04:07:03 +0000 (14:07 +1000)]
Merge tag 'omapdrm-4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux into drm-next

omapdrm patches for v4.17

* Fix sparse warnings from omapdrm
* HPD support for DVI connector
* Big cleanup to remove static variables

* tag 'omapdrm-4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux: (69 commits)
  drm/omap: fix compile error when DPI is disabled
  drm/omap: fix compile error when debugfs is disabled
  drm: omapdrm: displays: panel-dsi-cm: Fix field access before set
  drm/omap: cleanup color space conversion
  drm/omap: Allow HDMI audio setup even if we do not have video configured
  drm/omap: fix maximum sizes
  drm/omap: add writeback funcs to dispc_ops
  drm/omap: fix scaling limits for WB
  drm/omap: fix WB height with interlace
  drm/omap: fix WBDELAYCOUNT with interlace
  drm/omap: fix WBDELAYCOUNT for HDMI
  drm/omap: set WB channel-in in wb_setup()
  drm/omap: Add pclk setting case when channel is DSS_WB
  drm/omap: dispc: disp_wb_setup to check return code
  drm/omap: remove leftover enums
  dt-bindings: display: add HPD gpio to DVI connector
  drm/omap: add HPD support to connector-dvi
  drm/omap: Init fbdev emulation only when we have displays
  drm/omap: cleanup fbdev init/free
  drm/omap: fix omap_fbdev_free() when omap_fbdev_create() wasn't called
  ...

6 years agoMerge tag 'drm-msm-next-2018-03-20' of git://people.freedesktop.org/~robclark/linux...
Dave Airlie [Wed, 21 Mar 2018 04:06:00 +0000 (14:06 +1000)]
Merge tag 'drm-msm-next-2018-03-20' of git://people.freedesktop.org/~robclark/linux into drm-next

Updates for 4.17.  Sorry, running a bit late on this, didn't have a
chance to send pull-req before heading to linaro.  But it has all been
in linux-next for a while.  Main updates:

 + DSI updates from 10nm / SDM845
 + fix for race condition with a3xx/a4xx fence completion irq
 + some refactoring/prep work for eventual a6xx support (ie. when we have
   a userspace)
 + a5xx debugfs enhancements
 + some mdp5 fixes/cleanups to prepare for eventually merging writeback
   support (ie. when we have a userspace)

* tag 'drm-msm-next-2018-03-20' of git://people.freedesktop.org/~robclark/linux: (36 commits)
  drm/msm: fix building without debugfs
  drm/msm/mdp5: don't pre-reserve LM's if no dual-dsi
  drm/msm/mdp5: add missing LM flush bits
  drm/msm/mdp5: print a bit more of the atomic state
  drm/msm/mdp5: rework CTL START signal handling
  drm/msm: Trigger fence completion from GPU
  drm/msm/dsi: fix direct caller of msm_gem_free_object()
  drm/msm: strip out msm_fence_cb
  drm/msm: rename mdp->disp
  drm/msm/dsi: Fix potential NULL pointer dereference in msm_dsi_modeset_init
  drm/msm/adreno/a5xx_debugfs: fix potential NULL pointer dereference
  drm/msm/dsi: Get byte_intf_clk only for versions that need it
  drm/msm/adreno: Use generic function to load firmware to a buffer object
  drm/msm/adreno: Define a list of firmware files to load per target
  drm/msm/adreno: Rename gpmufw to powerfw
  drm/msm: Pass the correct aperture end to drm_mm_init
  drm/msm/gpu: Set number of clocks to 0 if the list allocation fails
  drm/msm: Replace gem_object deprecated functions
  drm/msm/hdmi: fix semicolon.cocci warnings
  drm/msm/mdp5: Fix trailing semicolon
  ...

6 years agoMerge tag 'drm/tegra/for-4.17-rc1' of git://anongit.freedesktop.org/tegra/linux into...
Dave Airlie [Wed, 21 Mar 2018 04:04:38 +0000 (14:04 +1000)]
Merge tag 'drm/tegra/for-4.17-rc1' of git://anongit.freedesktop.org/tegra/linux into drm-next

drm/tegra: Changes for v4.17-rc1

This fixes mmap() for fbdev devices by providing a custom implementation
based on the KMS variant. This is a fairly exotic case these days, hence
why it is not flagged for stable.

There is also support for dedicating one of the overlay planes to serve
as a hardware cursor on older Tegra that did support hardware cursors
but not RGBA formats for it.

Planes will now also export the IN_FORMATS property by supporting the
various block-linear tiling modifiers for RGBA pixel formats.

Other than that, there's a bit of cleanup of DMA API abuse, use of the
private object infrastructure for global state (rather than subclassing
atomic state objects) and an implementation of ->{begin,end}_cpu_access
callbacks for PRIME exported buffers, which allow users to perform cache
maintenance on these buffers.

* tag 'drm/tegra/for-4.17-rc1' of git://anongit.freedesktop.org/tegra/linux:
  drm/tegra: prime: Implement ->{begin,end}_cpu_access()
  drm/tegra: gem: Map pages via the DMA API
  drm/tegra: hub: Use private object for global state
  drm/tegra: fb: Properly support linear modifier
  drm/tegra: plane: Support format modifiers
  drm/tegra: dc: Dedicate overlay plane to cursor on older Tegra's
  drm/tegra: plane: Make tegra_plane_get_overlap_index() static
  drm/tegra: fb: Implement ->fb_mmap() callback
  drm/tegra: gem: Make __tegra_gem_mmap() available more widely
  drm/tegra: gem: Reshuffle declarations

6 years agoMerge branch 'for-upstream/mali-dp' of git://linux-arm.org/linux-ld into drm-next
Dave Airlie [Wed, 21 Mar 2018 03:58:43 +0000 (13:58 +1000)]
Merge branch 'for-upstream/mali-dp' of git://linux-arm.org/linux-ld into drm-next

I have accumulated some patches as we went through some internal testing
for mali-dp and I was waiting for the YUV2RGB patches to land in your
tree.

* 'for-upstream/mali-dp' of git://linux-arm.org/linux-ld:
  drm: mali-dp: Add YUV->RGB conversion support for video layers
  drm: mali-dp: Turn off CRTC vblank when removing module.
  drm: arm: malidp: Use drm_atomic_helper_shutdown() to disable planes on removal
  drm: arm: malidp: Don't destroy planes manually in error handlers
  drm/mali-dp: Fix malidp_atomic_commit_hw_done() for event sending.
  drm/arm/malidp: Disable pixel alpha blending for colors that do not have alpha
  drm: mali-dp: Fix bug on scaling with rotation
  drm/mali-dp: Don't enable scaling engine for planes that only rotate.
  drm: mali-dp: Uninitialized variable in malidp_se_check_scaling()
  drm/mali-dp: Align pitch size to be multiple of bus burst read size.
  drm/mali-dp: Rotated planes need a larger pitch size.

6 years agoMerge branch 'drm-next-4.17' of git://people.freedesktop.org/~agd5f/linux into drm...
Dave Airlie [Wed, 21 Mar 2018 01:46:05 +0000 (11:46 +1000)]
Merge branch 'drm-next-4.17' of git://people.freedesktop.org/~agd5f/linux into drm-next

- Continued cleanup and restructuring of powerplay
- Fetch VRAM type from vbios rather than hardcoding for SOC15 asics
- Allow ttm to drop its backing store when drivers don't need it
- DC bandwidth calc updates
- Enable DC backlight control pre-DCE11 asics
- Enable DC on all supported asics
- DC Fixes for planes due to the way our hw is ordered vs what drm expects
- DC CTM/regamma fixes
- Misc cleanup and bug fixes

* 'drm-next-4.17' of git://people.freedesktop.org/~agd5f/linux: (89 commits)
  amdgpu/dm: Default PRE_VEGA ASIC support to 'y'
  drm/amd/pp: Remove the cgs wrapper for notify smu version on APU
  drm/amd/display: fix dereferencing possible ERR_PTR()
  drm/amd/display: Refine disable VGA
  drm/amdgpu: Improve documentation of bo_ptr in amdgpu_bo_create_kernel
  drm/radeon: Don't turn off DP sink when disconnected
  drm/amd/pp: Rename file name cz_* to smu8_*
  drm/amd/pp: Replace function/struct name cz_* with smu8_*
  drm/amd/pp: Remove unneeded void * casts in cz_hwmgr.c/cz_smumgr.c
  drm/amd/pp: Mv cz uvd/vce pg/dpm functions to cz_hwmgr.c
  drm/amd/pp: Remove dead header file pp_asicblocks.h
  drm/amd/pp: Delete dead code on cz_clockpowergating.c
  drm/amdgpu: Call amdgpu_ucode_fini_bo in amd_powerplay.c
  drm/amdgpu: Remove wrapper layer of smu ip functions
  drm/amdgpu: Don't compared ip_block_type with ip_block_index
  drm/amdgpu: Plus NULL function pointer check
  drm/amd/pp: Move helper functions to smu_help.c
  drm/amd/pp: Replace rv_* with smu10_*
  drm/amd/pp: Fix function parameter not correct
  drm/amd/pp: Add rv_copy_table_from/to_smc to smu backend function table
  ...

6 years agodrm/meson: Fix potential NULL dereference in meson_drv_bind_master()
Wei Yongjun [Tue, 20 Mar 2018 14:20:30 +0000 (14:20 +0000)]
drm/meson: Fix potential NULL dereference in meson_drv_bind_master()

platform_get_resource_byname() may fail and return NULL, so we should
better check it's return value to avoid a NULL pointer dereference
a bit later in the code.

This is detected by Coccinelle semantic patch.

@@
expression pdev, res, n, t, e, e1, e2;
@@

res = platform_get_resource_byname(pdev, t, n);
+ if (!res)
+   return -EINVAL;
... when != res == NULL
e = devm_ioremap(e1, res->start, e2);

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1521555630-29284-1-git-send-email-weiyongjun1@huawei.com
6 years agodrm/sun4i: backend: Support YUV planes
Maxime Ripard [Thu, 1 Mar 2018 19:18:46 +0000 (20:18 +0100)]
drm/sun4i: backend: Support YUV planes

Now that we have the guarantee that we will have only a single YUV plane,
actually support them. The way it works is not really straightforward,
since we first need to enable the YUV mode in the plane that we want to
setup, and then we have a few registers to setup the YUV buffer and
parameters.

We also need to setup the color correction to actually have something
displayed.

Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/66088c1398bd3189123f28a89a7ccc669fe9f296.1519931807.git-series.maxime.ripard@bootlin.com
6 years agodrm/sun4i: backend: Check that we only have a single YUV plane
Maxime Ripard [Thu, 1 Mar 2018 19:18:45 +0000 (20:18 +0100)]
drm/sun4i: backend: Check that we only have a single YUV plane

Just like for the frontend, a single plane can use a YUV format. Make sure
we have that constraint covered in our atomic_check.

This is preliminary to the actual YUV support to make sure we don't end up
in an impossible to support situation.

Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/2f8586493d9139b12efe7e94f65e9a149f818e0e.1519931807.git-series.maxime.ripard@bootlin.com
6 years agodrm/sun4i: Add driver support for A80 display pipeline
Chen-Yu Tsai [Thu, 15 Mar 2018 11:41:33 +0000 (19:41 +0800)]
drm/sun4i: Add driver support for A80 display pipeline

This patch adds support for the compatible strings of the A80 display
pipeline.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180315114136.24747-6-wens@csie.org
6 years agodrm/sun4i: Add compatible strings for the A80 display pipeline
Chen-Yu Tsai [Thu, 15 Mar 2018 11:41:32 +0000 (19:41 +0800)]
drm/sun4i: Add compatible strings for the A80 display pipeline

This patch adds compatible strings for the remaining documented
components of the Allwinner A80 display pipeline.

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180315114136.24747-5-wens@csie.org
6 years agodrm/sun4i: Add support for A80 TCONs
Chen-Yu Tsai [Thu, 15 Mar 2018 11:41:31 +0000 (19:41 +0800)]
drm/sun4i: Add support for A80 TCONs

The Allwinner A80 SoC has 2 documented TCONs. The display pipeline
diagram from the user manual shows a third TCON, but it's missing
an interrupt line, and its registers are not explained either.
It's also not used in Allwinner's vendor BSP.

The first TCON only has channel 0, for LCD panel output. The TCON
hardware setup is peculiar in that the eDP reset must also be
deasserted to allow access to the TCON. How the eDP module is wired
in the SoC itself is never explained.

The second TCON only has channel 1, and its output is connected to
the HDMI encoder block.

This patch adds a "needs_edp_reset" field to the tcon quirks structure,
and adds quirks and compatible strings for the 2 documented TCONs.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180315114136.24747-4-wens@csie.org
6 years agodrm/sun4i: Add DT binding for Detail Enhancement Unit in Allwinner A80 SoC
Chen-Yu Tsai [Thu, 15 Mar 2018 11:41:30 +0000 (19:41 +0800)]
drm/sun4i: Add DT binding for Detail Enhancement Unit in Allwinner A80 SoC

The display pipeline on the A80 SoC has what is called the Detail
Enhancement Unit, or DEU for short, block in between the display
frontend and backend. This unit can sharpen images in both luma
and chroma channels. It seems to also do colorspace conversion.

This patch adds the device tree binding for this hardware block.

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180315114136.24747-3-wens@csie.org
6 years agodrm/sun4i: Add compatible strings for A80 TCONs
Chen-Yu Tsai [Thu, 15 Mar 2018 11:41:29 +0000 (19:41 +0800)]
drm/sun4i: Add compatible strings for A80 TCONs

The A80 has 2 or 3 TCONs. The documentation and vendor kernel are very
vague about the third TCON, to the point that it might not exist.

In the documentation, the first TCON is missing channel 1, and the
second is missing channel 0. However the vendor kernel seems to be
able to use them regardless. Here we model them like the old TCONs.

An oddity is that TCON0 requires the reset control for the eDP block
to be deasserted, for any register access to stick.

This patch adds compatible strings for TCON0 and TCON1, with TCON0
requiring an extra "edp" reset control.

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180315114136.24747-2-wens@csie.org
6 years agodrm: Reduce object size of DRM_DEV_<LEVEL> uses
Joe Perches [Fri, 16 Mar 2018 20:56:27 +0000 (13:56 -0700)]
drm: Reduce object size of DRM_DEV_<LEVEL> uses

These macros are similar to the DRM_<LEVEL> with the addition
of a struct device * to the arguments.

Convert the single drm_dev_printk function into 2 separate functions.
drm_dev_printk with a KERN_<LEVEL> * for generic use and drm_dev_dbg
for conditional masked use.

Remove the __func__ argument and use __builtin_return_address(0) to be
similar to the DRM_<LEVEL> macros uses.

Convert the DRM_DEV_<LEVEL> macros to remove now unnecessary arguments
and use a consistent style.

These macros are rarely used in the generic gpu/drm code so the code
size does not change much for a defconfig, but when more drivers are
enabled, there is ~4k savings.

Many of these macros have no existing use at all.

$ size -t drivers/gpu/drm/built-in.a | tail -1
1877530   44651     995 1923176  1d5868 (TOTALS)

$ size -t drivers/gpu/drm/built-in.a | tail -1
1877527   44651     995 1923173  1d5865 (TOTALS)

$ size -t drivers/gpu/drm/built-in.a | tail -1
17166750 2689238  108352 19964340 130a1b4 (TOTALS)

$ size -t drivers/gpu/drm/built-in.a | tail -1
17168888 2691734  108352 19968974 130b3ce (TOTALS)

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/e5c164946e15375ac71b69b75f296efdf0b76e6d.1521233717.git.joe@perches.com
6 years agodrm/doc: Put all driver docs into a separate chapter
Daniel Vetter [Fri, 16 Mar 2018 07:59:26 +0000 (08:59 +0100)]
drm/doc: Put all driver docs into a separate chapter

We have quite a few driver docs now, which is great, but having them
all in the top-level gpu documentation chapter makes it harder to spot
the core/shared bits.

Stuff them into a separate chapter and ecourage people to add even
more!

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180316075926.13584-1-daniel.vetter@ffwll.ch
6 years agodrm: dma_bufs: Fixed checkpatch issues
Paul McQuade [Mon, 19 Mar 2018 00:52:22 +0000 (00:52 +0000)]
drm: dma_bufs: Fixed checkpatch issues

Fix a couple of checkpatch issues

Signed-off-by: Paul McQuade <paulmcquad@gmail.com>
[seanpaul squashed series of 4 into one patch, and changed commit msg]
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180319005225.1545-1-paulmcquad@gmail.com
6 years agodrm: remove drm_mode_object_{un/reference} aliases
Haneen Mohammed [Mon, 19 Mar 2018 05:58:20 +0000 (01:58 -0400)]
drm: remove drm_mode_object_{un/reference} aliases

This patch remove the compatibility aliases
drm_mode_object_{reference/unreference} of drm_mode_object_{get/put}
since all callers have been converted to the prefered _{get/put}.

Remove the helpers from the semantic patch drm-get-put-cocci.

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180319055820.GA17502@haneen-VirtualBox
6 years agodrm/msm: fix building without debugfs
Arnd Bergmann [Mon, 26 Feb 2018 09:49:26 +0000 (10:49 +0100)]
drm/msm: fix building without debugfs

The adreno driver stopped building when CONFIG_DEBUGFS is disabled:

drivers/gpu/drm/msm/adreno/adreno_device.c: In function 'adreno_load_gpu':
drivers/gpu/drm/msm/adreno/adreno_device.c:153:16: error: 'const struct msm_gpu_funcs' has no member named 'debugfs_init'
  if (gpu->funcs->debugfs_init) {
                ^~
drivers/gpu/drm/msm/adreno/adreno_device.c:154:13: error: 'const struct msm_gpu_funcs' has no member named 'debugfs_init'
   gpu->funcs->debugfs_init(gpu, dev->primary);
             ^~

This adds an #ifdef around the code that references the hidden
pointer.

Fixes: 7de5027226c6 ("drm/msm: add a5xx specific debugfs")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm/mdp5: don't pre-reserve LM's if no dual-dsi
Rob Clark [Mon, 19 Feb 2018 13:31:29 +0000 (08:31 -0500)]
drm/msm/mdp5: don't pre-reserve LM's if no dual-dsi

If there is only a single DSI interface, don't reserve the first two
layer-mixers for the dual-DSI use-case.

This was causing problems for WB, not being able to assign a LM, on
8x16, which has only two LM's and a single DSI.

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm/mdp5: add missing LM flush bits
Rob Clark [Mon, 19 Feb 2018 13:29:33 +0000 (08:29 -0500)]
drm/msm/mdp5: add missing LM flush bits

For some reason, layer-mixer 3 and 4 were missing.  LM3 is used for
writeback on 8x16.

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm/mdp5: print a bit more of the atomic state
Rob Clark [Mon, 19 Feb 2018 13:27:13 +0000 (08:27 -0500)]
drm/msm/mdp5: print a bit more of the atomic state

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm/mdp5: rework CTL START signal handling
Rob Clark [Mon, 19 Feb 2018 13:17:06 +0000 (08:17 -0500)]
drm/msm/mdp5: rework CTL START signal handling

For DSI cmd-mode and writeback, we need to write the CTL's START
register to kick things off, but we only want to do that once both
the encoder and the crtc have a chance to write their corresponding
flush bits.  The difficulty is that when there is a full modeset
(ie. encoder state has changed) we want to defer the start until
encoder->enable().  But if only plane's have changed, we want to do
this from crtc->commit().

The start_mask was a previous attempt to handle this, but it didn't
really do the right thing since atomic conversion.

Instead track in the crtc state that the start should be deferred,
set to try from encoder's (or in future writeback's) atomic_check().
This way the state is part of the atomic state, and rollback can
work properly if an atomic test fails.

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm: Trigger fence completion from GPU
Bjorn Andersson [Wed, 14 Feb 2018 06:46:58 +0000 (22:46 -0800)]
drm/msm: Trigger fence completion from GPU

Interrupt commands causes the CP to trigger an interrupt as the command
is processed, regardless of the GPU being done processing previous
commands. This is seen by the interrupt being delivered before the
fence is written on 8974 and is likely the cause of the additional
CP_WAIT_FOR_IDLE workaround found for a306, which would cause the CP to
wait for the GPU to go idle before triggering the interrupt.

Instead we can set the (undocumented) BIT(31) of the CACHE_FLUSH_TS
which will cause a special CACHE_FLUSH_TS interrupt to be triggered from
the GPU as the write event is processed.

Add CACHE_FLUSH_TS to the IRQ masks of A3xx and A4xx and remove the
workaround for A306.

Suggested-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm/dsi: fix direct caller of msm_gem_free_object()
Rob Clark [Wed, 14 Feb 2018 16:14:23 +0000 (11:14 -0500)]
drm/msm/dsi: fix direct caller of msm_gem_free_object()

This should be using drm_gem_object_put().  Also since this is done only
in driver unload path, we don't need to synchronize setting tx_gem_obj
to NULL, so juse use the _unlocked() variant.

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm: strip out msm_fence_cb
Rob Clark [Wed, 14 Feb 2018 15:46:19 +0000 (10:46 -0500)]
drm/msm: strip out msm_fence_cb

Remnants of pre-dma_fence fencing which got left behind by mistake.

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm: rename mdp->disp
Rob Clark [Mon, 12 Feb 2018 13:18:27 +0000 (08:18 -0500)]
drm/msm: rename mdp->disp

Since new display controller is called "dpu" instead of "mdp".  Lets
make the name of the toplevel directory for the display controllers a
bit more generic.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
6 years agodrm/msm/dsi: Fix potential NULL pointer dereference in msm_dsi_modeset_init
Gustavo A. R. Silva [Fri, 2 Feb 2018 12:42:33 +0000 (06:42 -0600)]
drm/msm/dsi: Fix potential NULL pointer dereference in msm_dsi_modeset_init

_dev_ is being dereferenced before it is null checked, hence there
is a potential null pointer dereference.

Fix this by moving the pointer dereference after _dev_ has been
null checked.

Fixes: d4e7f38d70ef ("drm/msm/dsi: check msm_dsi and dsi pointers before use")
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm/msm/adreno/a5xx_debugfs: fix potential NULL pointer dereference
Gustavo A. R. Silva [Fri, 2 Feb 2018 12:32:23 +0000 (06:32 -0600)]
drm/msm/adreno/a5xx_debugfs: fix potential NULL pointer dereference

_minor_ is being dereferenced before it is null checked, hence there
is a potential null pointer dereference. Fix this by moving the pointer
dereference after _minor_ has been null checked.

Fixes: 024ad8df763f ("drm/msm: add a5xx specific debugfs")
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agodrm: Add PSR version 3 macro
José Roberto de Souza [Sat, 17 Mar 2018 01:38:28 +0000 (18:38 -0700)]
drm: Add PSR version 3 macro

eDP 1.4a specification defines PSR version 3, it PSR2 with the
addition of Y-coordinate support when doing selective update.

Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180317013828.24182-1-jose.souza@intel.com
6 years agodrm/tegra: prime: Implement ->{begin,end}_cpu_access()
Thierry Reding [Wed, 13 Dec 2017 11:25:14 +0000 (12:25 +0100)]
drm/tegra: prime: Implement ->{begin,end}_cpu_access()

These callbacks allow the exporter to swap in and pin the backing
storage for buffers as well as invalidate the cache in preparation for
accessing the buffer from the CPU, and flush the cache and unpin the
backing storage when the CPU is done modifying the buffer.

Signed-off-by: Thierry Reding <treding@nvidia.com>
6 years agodrm/tegra: gem: Map pages via the DMA API
Thierry Reding [Wed, 13 Dec 2017 11:22:48 +0000 (12:22 +0100)]
drm/tegra: gem: Map pages via the DMA API

When allocating pages, map them with the DMA API in order to invalidate
caches. This is the correct usage of the API and works just as well as
faking up the SG table and using the dma_sync_sg_for_device() function.

Signed-off-by: Thierry Reding <treding@nvidia.com>
6 years agodrm/tegra: hub: Use private object for global state
Thierry Reding [Tue, 28 Nov 2017 10:20:40 +0000 (11:20 +0100)]
drm/tegra: hub: Use private object for global state

Rather than subclass the global atomic state to store the hub display
clock and rate, create a private object and store this data in its
state.

Signed-off-by: Thierry Reding <treding@nvidia.com>
6 years agodrm/vc4_validate: Remove VLA usage
Gustavo A. R. Silva [Tue, 13 Mar 2018 14:31:51 +0000 (09:31 -0500)]
drm/vc4_validate: Remove VLA usage

In preparation to enabling -Wvla, remove VLA. In this particular
case use macro ARRAY_SIZE so the length of array _bo_ can be
computed at preprocessing time.

The use of stack Variable Length Arrays needs to be avoided, as they
can be a vector for stack exhaustion, which can be both a runtime bug
or a security flaw. Also, in general, as code evolves it is easy to
lose track of how big a VLA can get. Thus, we can end up having runtime
failures that are hard to debug.

Also, fixed as part of the directive to remove all VLAs from
the kernel: https://lkml.org/lkml/2018/3/7/621

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20180313143151.GA27486@embeddedgus
6 years agoamdgpu/dm: Default PRE_VEGA ASIC support to 'y'
Harry Wentland [Wed, 8 Nov 2017 20:58:25 +0000 (15:58 -0500)]
amdgpu/dm: Default PRE_VEGA ASIC support to 'y'

Even though we default PRE_VEGA support to 'n' upstream in amd-staging
we want to keep it enabled by default.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Remove the cgs wrapper for notify smu version on APU
Rex Zhu [Thu, 15 Mar 2018 06:45:04 +0000 (14:45 +0800)]
drm/amd/pp: Remove the cgs wrapper for notify smu version on APU

Refine commit 2ffd44d470bb ("drm/amd/pp: Get and save Rv smu version")

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: fix dereferencing possible ERR_PTR()
Shirish S [Thu, 15 Mar 2018 10:31:00 +0000 (16:01 +0530)]
drm/amd/display: fix dereferencing possible ERR_PTR()

This patch fixes static checker warning caused by
"3edcc787174b: "drm/amd/display: disable CRTCs with
NULL FB on their primary plane (V2)"

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Shirish S <shirish.s@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Refine disable VGA
Clark Zheng [Thu, 15 Mar 2018 06:02:06 +0000 (14:02 +0800)]
drm/amd/display: Refine disable VGA

bad case won't follow normal sense, it will not enable vga1 as usual, but vga2,3,4 is on.

Signed-off-by: Clark Zheng <clark.zheng@amd.com>
Reviewed-by: Tony Cheng <tony.cheng@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm: Make drm_mode_vrefresh() a bit more accurate
Ville Syrjälä [Tue, 13 Mar 2018 15:07:58 +0000 (17:07 +0200)]
drm: Make drm_mode_vrefresh() a bit more accurate

Do the refresh rate calculation with a single division. This gives
us slightly more accurate results, especially for interlaced since
we don't just double the final truncated result.

We do lose one bit compared to the old way, so with an interlaced
mode the new code can only handle ~2GHz instead of the ~4GHz the
old code handeled.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180313150759.27620-2-ville.syrjala@linux.intel.com
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
6 years agodrm: Nuke the useless 'ret' variable from drm_mode_convert_umode()
Ville Syrjälä [Tue, 13 Mar 2018 15:07:57 +0000 (17:07 +0200)]
drm: Nuke the useless 'ret' variable from drm_mode_convert_umode()

No need to store the return value in a variable since we don't have to
do any unwinding.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180313150759.27620-1-ville.syrjala@linux.intel.com
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
6 years agodrm/i915: Use drm_color_lut_size()
Ville Syrjälä [Fri, 23 Feb 2018 19:25:06 +0000 (21:25 +0200)]
drm/i915: Use drm_color_lut_size()

Avoid all the sizeof(drm_color_lut) business by using
drm_color_lut_size() to convert the blob length into
number of LUT entries.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180223192506.29992-6-ville.syrjala@linux.intel.com
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
6 years agodrm/i915: Remove the blob->data casts
Ville Syrjälä [Fri, 23 Feb 2018 19:25:05 +0000 (21:25 +0200)]
drm/i915: Remove the blob->data casts

Now that blob->data is void* again we don't need to cast it.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180223192506.29992-5-ville.syrjala@linux.intel.com
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
6 years agodrm: Introduce drm_color_lut_size()
Ville Syrjälä [Thu, 15 Mar 2018 15:23:38 +0000 (17:23 +0200)]
drm: Introduce drm_color_lut_size()

Provide a small helper to convert the blob length in bytes
to the number of LUT entries.

v2: Add kerneldoc (Daniel)

Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180315152338.7248-1-ville.syrjala@linux.intel.com
6 years agodrm: Verify gamma/degamma LUT size
Ville Syrjälä [Thu, 15 Mar 2018 15:22:41 +0000 (17:22 +0200)]
drm: Verify gamma/degamma LUT size

While we want to potentially support multiple different gamma/degamma
LUT sizes we can (and should) at least check that the blob length
is a multiple of the LUT entry size.

v2: s/expected_size_mod/expected_elem_size/ (Daniel)
    Add kernel doc (Daniel)
v3: s/we/were/ typo in the docs

Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180315152241.7113-1-ville.syrjala@linux.intel.com
6 years agodrm: Remove now pointelss blob->data casts
Ville Syrjälä [Fri, 23 Feb 2018 19:25:02 +0000 (21:25 +0200)]
drm: Remove now pointelss blob->data casts

Now that blob->data is void* again we don't need the casts anymore.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180223192506.29992-2-ville.syrjala@linux.intel.com
Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
6 years agoRevert "drm: Use a flexible array member for blob property data"
Ville Syrjälä [Fri, 23 Feb 2018 19:25:01 +0000 (21:25 +0200)]
Revert "drm: Use a flexible array member for blob property data"

Using a flexible array for the blob data was a mistake by me. It
forces all users of the blob data to cast blob->data to something
else. void* is clearly superior so let's go back to the original
scheme.

Not a clean revert as the code has moved.

This reverts commit 8feefe2ab3c6a4e16367ee745cab8eabd74bbb6c.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180223192506.29992-1-ville.syrjala@linux.intel.com
Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
6 years agodrm/rockchip: cdn-dp: remove the DP phy switch
Chris Zhong [Fri, 16 Feb 2018 12:09:56 +0000 (13:09 +0100)]
drm/rockchip: cdn-dp: remove the DP phy switch

There are 2 Type-c PHYs in RK3399, but only one DP controller. Hence
only one PHY can connect to DP controller at one time, the other should
be disconnected. The GRF_SOC_CON26 register has a switch bit to do it,
set this bit means enable PHY 1, clear this bit means enable PHY 0.

If the board has 2 Type-C ports, the DP driver get the phy id from
devm_of_phy_get_by_index, and then control this switch according to
this id. But some others board only has one Type-C port, it may be PHY 0
or PHY 1. The dts node id can not tell us the correct PHY id. Hence move
this switch to PHY driver, the PHY driver can distinguish between PHY 0
and PHY 1, and then write the correct register bit.

Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
[The phy-changes are in the phy-tree now and the cdn-dp wasn't
 enabled at all so far, so this change can go through drm-misc
 alone without causing issues when testing drm-misc]
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20180216120956.19034-6-enric.balletbo@collabora.com
6 years agodrm: Reduce object size of DRM_ERROR and DRM_DEBUG uses
Joe Perches [Tue, 13 Mar 2018 22:02:15 +0000 (15:02 -0700)]
drm: Reduce object size of DRM_ERROR and DRM_DEBUG uses

drm_printk is used for both DRM_ERROR and DRM_DEBUG with unnecessary
arguments that can be removed by creating separate functins.

Create specific functions for these calls to reduce x86/64 defconfig
size by ~20k.

Modify the existing macros to use the specific calls.

new:
$ size -t drivers/gpu/drm/built-in.a | tail -1
1876562   44542     995 3b67233  1d5433 (TOTALS)

old:
$ size -t drivers/gpu/drm/built-in.a | tail -1
1897565   44542     995 1943102  1da63e (TOTALS)

Miscellanea:

o intel_display requires a change to use the specific calls.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/016b5cb84cede20fd0f91ed6965421d99fd5f2ce.1520978414.git.joe@perches.com
6 years agodrm/amdgpu: Improve documentation of bo_ptr in amdgpu_bo_create_kernel
Andrey Grodzovsky [Wed, 14 Mar 2018 15:45:22 +0000 (11:45 -0400)]
drm/amdgpu: Improve documentation of bo_ptr in amdgpu_bo_create_kernel

and amdgpu_bo_create_reserved.

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/tegra: fb: Properly support linear modifier
Thierry Reding [Thu, 15 Mar 2018 15:45:45 +0000 (16:45 +0100)]
drm/tegra: fb: Properly support linear modifier

Instead of relying on the tiling attached to a buffer object, make sure
to set the proper tiling for linear buffers.

Signed-off-by: Thierry Reding <treding@nvidia.com>
6 years agodrm/tegra: plane: Support format modifiers
Thierry Reding [Thu, 15 Mar 2018 15:44:04 +0000 (16:44 +0100)]
drm/tegra: plane: Support format modifiers

Pass the list of valid format modifiers to planes upon initialization
and implement the ->format_mod_supported() callback so that userspace
can query for the valid combinations of formats and modifiers.

Signed-off-by: Thierry Reding <treding@nvidia.com>
6 years agodrm/radeon: Don't turn off DP sink when disconnected
Michel Dänzer [Wed, 14 Mar 2018 17:14:04 +0000 (18:14 +0100)]
drm/radeon: Don't turn off DP sink when disconnected

Turning off the sink in this case causes various issues, because
userspace expects it to stay on until it turns it off explicitly.

Instead, turn the sink off and back on when a display is connected
again. This dance seems necessary for link training to work correctly.

Bugzilla: https://bugs.freedesktop.org/105308
Cc: stable@vger.kernel.org
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Rename file name cz_* to smu8_*
Rex Zhu [Wed, 14 Mar 2018 12:05:12 +0000 (20:05 +0800)]
drm/amd/pp: Rename file name cz_* to smu8_*

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Replace function/struct name cz_* with smu8_*
Rex Zhu [Wed, 14 Mar 2018 09:29:54 +0000 (17:29 +0800)]
drm/amd/pp: Replace function/struct name cz_* with smu8_*

hw ip smu8 was used on CZ/ST,
so use smu8 as the prefix of the function/struct name in powerplay.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Remove unneeded void * casts in cz_hwmgr.c/cz_smumgr.c
Rex Zhu [Tue, 13 Mar 2018 08:50:44 +0000 (16:50 +0800)]
drm/amd/pp: Remove unneeded void * casts in cz_hwmgr.c/cz_smumgr.c

Removes unneeded void * casts for the following pointers:
hwmgr->backend
hwmgr->smu_backend

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Mv cz uvd/vce pg/dpm functions to cz_hwmgr.c
Rex Zhu [Tue, 13 Mar 2018 07:44:42 +0000 (15:44 +0800)]
drm/amd/pp: Mv cz uvd/vce pg/dpm functions to cz_hwmgr.c

1. delete cz_clockpowergating.c/.h files
2. mark uvd/vce dpm/pg functions static

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Remove dead header file pp_asicblocks.h
Rex Zhu [Tue, 13 Mar 2018 07:35:17 +0000 (15:35 +0800)]
drm/amd/pp: Remove dead header file pp_asicblocks.h

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Delete dead code on cz_clockpowergating.c
Rex Zhu [Tue, 13 Mar 2018 07:27:06 +0000 (15:27 +0800)]
drm/amd/pp: Delete dead code on cz_clockpowergating.c

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Call amdgpu_ucode_fini_bo in amd_powerplay.c
Rex Zhu [Mon, 12 Mar 2018 11:53:01 +0000 (19:53 +0800)]
drm/amdgpu: Call amdgpu_ucode_fini_bo in amd_powerplay.c

make it symmetric with amdgpu_ucode_init_bo in amd_powerplay.c

refine the "commit b22558bb4ff8fc9fe925222f90297d7a03a5fb20"

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Remove wrapper layer of smu ip functions
Rex Zhu [Mon, 12 Mar 2018 11:52:23 +0000 (19:52 +0800)]
drm/amdgpu: Remove wrapper layer of smu ip functions

1. delete amdgpu_powerplay.c used for wrapping smu ip functions
2. delete struct pp_instance,
3. make struct hwmgr as the smu hw handle.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Don't compared ip_block_type with ip_block_index
Rex Zhu [Wed, 14 Mar 2018 07:38:48 +0000 (15:38 +0800)]
drm/amdgpu: Don't compared ip_block_type with ip_block_index

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Plus NULL function pointer check
Rex Zhu [Mon, 12 Mar 2018 11:50:38 +0000 (19:50 +0800)]
drm/amdgpu: Plus NULL function pointer check

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Move helper functions to smu_help.c
Rex Zhu [Fri, 9 Mar 2018 11:52:26 +0000 (19:52 +0800)]
drm/amd/pp: Move helper functions to smu_help.c

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Replace rv_* with smu10_*
Rex Zhu [Tue, 6 Mar 2018 09:28:38 +0000 (17:28 +0800)]
drm/amd/pp: Replace rv_* with smu10_*

Powerplay is for the hw ip smu, for RV, smu10 is used,
so use smu10 as the prefix of the files name/function name.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Fix function parameter not correct
Rex Zhu [Tue, 13 Mar 2018 05:40:00 +0000 (13:40 +0800)]
drm/amd/pp: Fix function parameter not correct

caused by "commit dcefb7668e5b4fb56099b16d1790cd3056322b03"

Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Add rv_copy_table_from/to_smc to smu backend function table
Rex Zhu [Wed, 7 Mar 2018 08:14:38 +0000 (16:14 +0800)]
drm/amd/pp: Add rv_copy_table_from/to_smc to smu backend function table

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Add new smu backend function smc_table_manager
Rex Zhu [Wed, 7 Mar 2018 08:12:05 +0000 (16:12 +0800)]
drm/amd/pp: Add new smu backend function smc_table_manager

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Mark internal functions as static in rv_smumgr.c
Rex Zhu [Fri, 9 Mar 2018 11:00:14 +0000 (19:00 +0800)]
drm/amd/pp: Mark internal functions as static in rv_smumgr.c

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Add rv_read_arg_from_smc to smu backend function table
Rex Zhu [Fri, 9 Mar 2018 10:57:37 +0000 (18:57 +0800)]
drm/amd/pp: Add rv_read_arg_from_smc to smu backend function table

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Remove meanless return value check in RV
Rex Zhu [Wed, 7 Mar 2018 05:49:03 +0000 (13:49 +0800)]
drm/amd/pp: Remove meanless return value check in RV

In send_message_to_smu helper functions,
Print out the error code for debug if smu failed to response.

The helper functions always return true, so no need to
check their return value.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Delete is_smc_ram_running function on RV
Rex Zhu [Wed, 7 Mar 2018 05:32:45 +0000 (13:32 +0800)]
drm/amd/pp: Delete is_smc_ram_running function on RV

1. There is a race condition when another ip also use same register pairs
2. check once at boot up by GetDriverIfVersion message is sufficient
   to check SMU health. so delete is_smc_ram_running check.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Clean up header file include
Rex Zhu [Wed, 7 Mar 2018 08:40:21 +0000 (16:40 +0800)]
drm/amd/pp: Clean up header file include

smu7_smumgr.h should not be included in rv and vega, The common functions
for all smu7 asics are put in smu_smumgr.c.

Not include cgs interface in smumgr.c. the code used cgs interface has been
deleted.

Not include smu_ucode_xfer_vi.h in rv/vega

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Fix memory leak in error path in smumgr
Rex Zhu [Wed, 14 Mar 2018 08:14:59 +0000 (16:14 +0800)]
drm/amd/pp: Fix memory leak in error path in smumgr

Free the backend structure if we fail to allocate device memory.

Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Simplified the avfs btc state on smu7
Rex Zhu [Fri, 9 Mar 2018 10:07:59 +0000 (18:07 +0800)]
drm/amd/pp: Simplified the avfs btc state on smu7

AVFS feature support/not support is enough to driver.

so remove the complex define of the avfs btc state.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/powerplay: Fix KASAN user after free on driver unload.
Andrey Grodzovsky [Wed, 14 Mar 2018 18:07:49 +0000 (14:07 -0400)]
drm/amd/powerplay: Fix KASAN user after free on driver unload.

Reusing local handle to initialize BO without resetting it to
NULL is wrong since it causes amdgpu_bo_create_reserved to skip
new BO creation and just reuse the given pointer for pinning.

Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/tegra: dc: Dedicate overlay plane to cursor on older Tegra's
Dmitry Osipenko [Thu, 15 Mar 2018 01:00:25 +0000 (04:00 +0300)]
drm/tegra: dc: Dedicate overlay plane to cursor on older Tegra's

Older Tegra's do not support RGBA format for the cursor, but instead
overlay plane could be used for it. Since there is no much use for the
overlays on a regular desktop and HW-accelerated cursor is much better
than a SW cursor, let's dedicate one overlay plane to the mouse cursor.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
6 years agodrm/tegra: plane: Make tegra_plane_get_overlap_index() static
Dmitry Osipenko [Thu, 15 Mar 2018 10:37:05 +0000 (11:37 +0100)]
drm/tegra: plane: Make tegra_plane_get_overlap_index() static

This function is not used outside of the file and can be static.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
6 years agodrm/bridge: dw-hdmi: Remove unused hdmi_enable_overflow_interrupts()
Fabio Estevam [Fri, 16 Feb 2018 20:16:10 +0000 (18:16 -0200)]
drm/bridge: dw-hdmi: Remove unused hdmi_enable_overflow_interrupts()

The cable_plugin member never receives an assignment, so it is always
false, which causes hdmi_enable_overflow_interrupts() to never
be called as per the logic below:

if (hdmi->cable_plugin && hdmi->sink_is_hdmi)
hdmi_enable_overflow_interrupts(hdmi);

This has been the case since the driver was originally introduced
in commit 99ac5faf9164 ("imx-drm: Add mx6 hdmi transmitter support").

Remove the cable_plugin element and the hdmi_enable_overflow_interrupts()
function that is never called.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> # On R-Car H3
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1518812170-22687-1-git-send-email-festevam@gmail.com
6 years agodrm/amdgpu/sdma4: Remove unused header file from sdma_v4_0.c
Feifei Xu [Wed, 7 Mar 2018 03:42:33 +0000 (22:42 -0500)]
drm/amdgpu/sdma4: Remove unused header file from sdma_v4_0.c

Remove mmhub header files inclusion which not used.

Signed-off-by: Feifei Xu <Feifei.Xu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu/sdma4: use num_instances for clock/powergating config
Alex Deucher [Fri, 1 Sep 2017 20:47:54 +0000 (16:47 -0400)]
drm/amdgpu/sdma4: use num_instances for clock/powergating config

Rather then relying on the asic type for the second instance.
Makes it more consistent with the rest of the code.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
6 years agodrm/amdgpu: remove trailing whitespace from soc15ip.h
Alex Deucher [Wed, 7 Mar 2018 04:01:46 +0000 (23:01 -0500)]
drm/amdgpu: remove trailing whitespace from soc15ip.h

no intended functional change.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu/powerplay/vega10: fix memory leak in error path
Alex Deucher [Wed, 14 Mar 2018 01:43:00 +0000 (20:43 -0500)]
drm/amdgpu/powerplay/vega10: fix memory leak in error path

Free the backend structure if we fail to allocate device
memory.

Reviewed-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu/dce: Don't turn off DP sink when disconnected
Michel Dänzer [Fri, 9 Mar 2018 17:26:18 +0000 (18:26 +0100)]
drm/amdgpu/dce: Don't turn off DP sink when disconnected

Turning off the sink in this case causes various issues, because
userspace expects it to stay on until it turns it off explicitly.

Instead, turn the sink off and back on when a display is connected
again. This dance seems necessary for link training to work correctly.

Bugzilla: https://bugs.freedesktop.org/105308
Cc: stable@vger.kernel.org
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: remove redundant pointer internal_buf
Colin Ian King [Tue, 13 Mar 2018 13:22:17 +0000 (13:22 +0000)]
drm/amd/pp: remove redundant pointer internal_buf

The pointer internal_buf is assigned a value but the pointer is never
read, hence it is redundant and can be removed.

Cleans up clang warning:
drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/smu7_smumgr.c:630:2:
warning: Value stored to 'internal_buf' is never read

Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: move getting pcie info to common code
Alex Deucher [Fri, 9 Mar 2018 20:14:11 +0000 (15:14 -0500)]
drm/amdgpu: move getting pcie info to common code

No need to replicate it in several places.

Reviewed-by: Rex Zhu <rezhu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu/soc15: always load the psp module
Alex Deucher [Fri, 9 Mar 2018 20:22:28 +0000 (15:22 -0500)]
drm/amdgpu/soc15: always load the psp module

Regardless of whether the user has selected psp fw loading or
not.  It's still needed for GPU reset among other things.
There are already guards in place to avoid setting up the full
psp if PSP fw loading is not enabled.

Reviewed-by: Rex Zhu <rezhu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>