platform/kernel/linux-starfive.git
7 years agoamdgpu/dc: make opp construct void.
Dave Airlie [Fri, 29 Sep 2017 03:15:58 +0000 (13:15 +1000)]
amdgpu/dc: make opp construct void.

This doesn't return anything except true.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agoamdgpu/dc: make link encoder construct void.
Dave Airlie [Fri, 29 Sep 2017 03:15:57 +0000 (13:15 +1000)]
amdgpu/dc: make link encoder construct void.

This only ever returned true.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agoamdgpu/dc: make stream encoder constructor return void.
Dave Airlie [Fri, 29 Sep 2017 03:15:56 +0000 (13:15 +1000)]
amdgpu/dc: make stream encoder constructor return void.

The checks weren't useful here really.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agoamdgpu/dc: make timing generator constructor return void.
Dave Airlie [Fri, 29 Sep 2017 03:15:55 +0000 (13:15 +1000)]
amdgpu/dc: make timing generator constructor return void.

This can't fail as is.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agoamdgpu/dc: constify a bunch of dc structs.
Dave Airlie [Fri, 29 Sep 2017 00:39:29 +0000 (10:39 +1000)]
amdgpu/dc: constify a bunch of dc structs.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agoamdgpu/dm: constify rgb formats.
Dave Airlie [Fri, 29 Sep 2017 00:32:24 +0000 (10:32 +1000)]
amdgpu/dm: constify rgb formats.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agoamdgpu/dm: constify plane type.
Dave Airlie [Fri, 29 Sep 2017 00:32:23 +0000 (10:32 +1000)]
amdgpu/dm: constify plane type.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agoamdgpu/dm: constify yuv_formats.
Dave Airlie [Fri, 29 Sep 2017 00:27:41 +0000 (10:27 +1000)]
amdgpu/dm: constify yuv_formats.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agoamdgpu/dc: static constify update_surface_trace_level
Dave Airlie [Fri, 29 Sep 2017 00:23:15 +0000 (10:23 +1000)]
amdgpu/dc: static constify update_surface_trace_level

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agoamdgpu/dc: drop dc_ver char
Dave Airlie [Fri, 29 Sep 2017 00:20:39 +0000 (10:20 +1000)]
amdgpu/dc: drop dc_ver char

This isn't referenced anywhere, and if it was it should be const.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Remove DWB
Harry Wentland [Thu, 28 Sep 2017 19:39:41 +0000 (15:39 -0400)]
drm/amd/display: Remove DWB

It's not in a good shape and currently completely unused.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agoamdgpu/dc: remove wait_reg/wait_reg_func interfaces.
Dave Airlie [Thu, 28 Sep 2017 03:29:32 +0000 (13:29 +1000)]
amdgpu/dc: remove wait_reg/wait_reg_func interfaces.

These aren't used in the tree anywhere, and there is a TODO.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agoamdgpu/dc: don't check for 0 on register read/writes always.
Dave Airlie [Thu, 28 Sep 2017 02:42:01 +0000 (12:42 +1000)]
amdgpu/dc: don't check for 0 on register read/writes always.

This adds ~50k to the driver text segment, and 10k to data segment.

   text    data     bss     dec     hex filename
2385556   39681    1045 2426282  2505aa drivers/gpu/drm/amd/amdgpu/amdgpu.o
  text    data     bss     dec     hex filename
2336593   28857    1045 2366495  241c1f drivers/gpu/drm/amd/amdgpu/amdgpu.o

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agoamdgpu/dc: drop dml display_mode_support.c (v2)
Dave Airlie [Thu, 28 Sep 2017 02:29:53 +0000 (12:29 +1000)]
amdgpu/dc: drop dml display_mode_support.c (v2)

This code isn't used, and this function is huge, reimport later if
going to be used.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agoamdgpu/dc: separate out some common code from bios parsers.
Dave Airlie [Thu, 28 Sep 2017 01:24:06 +0000 (11:24 +1000)]
amdgpu/dc: separate out some common code from bios parsers.

This extracts the bios parser object id handling into a common file.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agoamdgpu/dc: drop dml_util_is_420
Dave Airlie [Thu, 28 Sep 2017 00:55:25 +0000 (10:55 +1000)]
amdgpu/dc: drop dml_util_is_420

This is unused code.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agoamdgpu/dc: inline a bunch of the dml wrappers.
Dave Airlie [Thu, 28 Sep 2017 00:45:26 +0000 (10:45 +1000)]
amdgpu/dc: inline a bunch of the dml wrappers.

This reduces code size.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agoamdgpu/dc: inline a bunch of float operations.
Dave Airlie [Thu, 28 Sep 2017 00:45:25 +0000 (10:45 +1000)]
amdgpu/dc: inline a bunch of float operations.

This reduces code size for the bw calcs code.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agoamdgpu/dc: drop display_pipe_clocks.c.
Dave Airlie [Thu, 28 Sep 2017 00:10:22 +0000 (10:10 +1000)]
amdgpu/dc: drop display_pipe_clocks.c.

This code isn't used at all in the kernel tree, perhaps it can wait to
be imported when it is. It also does a lot of floating point calcs,
so probably good to drop it until it's needed and we can ensure
proper fpu accessors.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agoamdgpu/dc: move filter taps to being static const data (v2)
Dave Airlie [Thu, 28 Sep 2017 00:22:48 +0000 (10:22 +1000)]
amdgpu/dc: move filter taps to being static const data (v2)

This just adds two accessor methods, and moves all the data
to static const.

v2: fix dcn build.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agoamdgpu/dc: add static to construct function
Dave Airlie [Wed, 27 Sep 2017 23:21:33 +0000 (09:21 +1000)]
amdgpu/dc: add static to construct function

There was a global construct symbol in the module symbols, kill it.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/doc: Reference AMD DC todos
Harry Wentland [Thu, 28 Sep 2017 15:53:19 +0000 (11:53 -0400)]
drm/doc: Reference AMD DC todos

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: DC I2C review
Harry Wentland [Wed, 27 Sep 2017 19:36:11 +0000 (15:36 -0400)]
drm/amd/display: DC I2C review

While reviewing I2C in DC identified a few places. Added a couple to the
TODO list.

1) Connector info read

See get_ext_display_connection_info

On some boards the connector information has to be read through a
special I2C channel. This line is only used for this purpose and only on
driver init.

2) SCDC stuff

This should all be reworked to go through DRM's SCDC code. When this is
done some unnecessary I2C code can be retired as well.

3) Max TMDS clock read

See dal_ddc_service_i2c_query_dp_dual_mode_adaptor

This should happen in DRM as well. I haven't checked if there's
currently functionality in DRM. If not we can propose something.

4) HDMI retimer programming

Some boards have an HDMI retimer that we need to program to pass PHY
compliance.

1 & 3 might be a good exercise if someone is looking for things to do.

v2: Merge dp_dual_mode_adaptor TODO

Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Use kernel alloc/free
Harry Wentland [Wed, 27 Sep 2017 14:53:50 +0000 (10:53 -0400)]
drm/amd/display: Use kernel alloc/free

Abstractions are frowned upon.

cocci script:
virtual context
virtual patch
virtual org
virtual report

@@
expression ptr;
@@

- dm_alloc(ptr)
+ kzalloc(ptr, GFP_KERNEL)

@@
expression ptr, size;
@@

- dm_realloc(ptr, size)
+ krealloc(ptr, size, GFP_KERNEL)

@@
expression ptr;
@@

- dm_free(ptr)
+ kfree(ptr)

v2: use GFP_KERNEL, not GFP_ATOMIC. add cocci script

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd: DC pull request review
Daniel Vetter [Wed, 27 Sep 2017 10:15:50 +0000 (12:15 +0200)]
drm/amd: DC pull request review

Ok, here's one more attempt at scrolling through 130k diff.

Overall verdict from me is that DC is big project, and like any big
project it's never done. So at least for me the goal isn't to make
things perfect, becaue if that's the hoop to jump through we wouldn't
have any gpu drivers at all. More important is whether merging a new
driver base will benefit the overall subsystem, and here this
primarily means whether the DC team understands how upstream works and
is designed, and whether the code is largely aligned with upstream
(especially the atomic modeset) architecture.

Looking back over the last two years I think that's the case now, so

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
for merging this pull.

While scrolling through the pull I spotted a bunch more things that
should be refactored, but most of these will be a real pain with DC
is out of tree, and much easier in tree since in many of these areas
the in-tree helpers aren't up to snuff yet for what DC needs. That
kind of work is best done when there's one tree with everything
integrated.

That's also why I think we should merge DC into drm-next directly, so
we can get started on the integration polish right away. That has a
bit higher risk of Linus having a spazz, so here's my recommendation
for merging:

- There's a few additions to drm_dp_helper.h sprinkled all over the
  pull. I think those should be put into a patch of it's own, and
  merged first. No need to rebase DC, git merge will dtrt and not end
  up with duplicates.

- dm_alloc/realloc/free is something Dave Airlie noticed, and I agree
  it's an easy red flag that might upset Linus. cocci can fix this
  easy, so no real problem I think to patch up in one big patch (I
  thought we've had a "remove malloc wrappers" todo item in the very
  first review, apparently there was more than one such wrapper).

- The history is huge, but AMD folks want to keep it if possible, and
  I see the value in that. Would be good to get an ack from Linus for
  that (but shouldn't be an issue, not the first time we've merged the
  full history of out-of-tree work).

Short&longer term TODO items are still tracked, might be a good idea
to integrate those the overall drm todo in our gpu documentation, for
more visibility.

So in a way this is kinda like staging, except not with the horribly
broken process of having an entirely separate tree for staging drivers
which just makes refactoring needlessly painful (which defeats the
point of staging really). So staging-within-the-subsystem. We've had
that before, with early nouveau.

And yes some of the files are utterly horrible to read and not
anything close to kernel coding style standards. But that's the point,
they're essentially gospel from hw engineers that happens to be
parseable by gcc.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: drop experimental flag for vega10
Alex Deucher [Fri, 2 Jun 2017 18:38:03 +0000 (14:38 -0400)]
drm/amdgpu: drop experimental flag for vega10

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: fix pflip irq registor for raven
Bhawanpreet Lakha [Mon, 18 Sep 2017 19:19:31 +0000 (15:19 -0400)]
drm/amd/display: fix pflip irq registor for raven

The pflip registor index was incorrect, this was overriding the macro
and caused a dummy irq call.

Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: don't clean-up bottom pipe plane_state
Shirish S [Tue, 26 Sep 2017 06:56:41 +0000 (12:26 +0530)]
drm/amd/display: don't clean-up bottom pipe plane_state

In the scenario of setting underlay, dc_validate_global_state()
is called after constructing the context with all
relevant bottom_pipe related configurations in dm_update_planes_state().

Currently, in dc_validate_global_state(), without checking for bottom_pipe's
existence, the pipe_ctx structure is initialised to 0, hence
nullyfying the plane_state of bottom_pipe which shall be accessed
in populate_initial_data() called from bw_calcs().

Due to this null pointer access kernel panics and leads to reboot
when underlay is tried to set.

This patch fixes the issue by no longer clearing the top_pipe. This
workaround is no longer required.

Signed-off-by: Shirish S <shirish.s@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Remove unused dc_validate_guaranteed function
Harry Wentland [Sun, 24 Sep 2017 18:31:51 +0000 (14:31 -0400)]
drm/amd/display: Remove unused dc_validate_guaranteed function

It got refactored away and was never cleaned.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Reduce DC chattiness
Harry Wentland [Wed, 13 Sep 2017 00:04:48 +0000 (20:04 -0400)]
drm/amd/display: Reduce DC chattiness

Log DC init but default log level to 0 (default for
amdgpu_dc_log) otherwise. Bug reporters can still make
DC more chatty by using the dc_log module param.
    amdgpu.dc_log = 1

v2: Only provide runtime option, no compile time config

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Pass log_mask from DM
Harry Wentland [Tue, 12 Sep 2017 23:33:40 +0000 (19:33 -0400)]
drm/amd/display: Pass log_mask from DM

Linux and Windows often desire different log levels.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: Add dc_log module parameter
Harry Wentland [Wed, 13 Sep 2017 00:02:11 +0000 (20:02 -0400)]
drm/amdgpu: Add dc_log module parameter

We want to make DC less chatty but still allow bug reporters to
provide more detailed logs.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Clean Kconfig formatting
Harry Wentland [Mon, 11 Sep 2017 22:48:27 +0000 (18:48 -0400)]
drm/amd/display: Clean Kconfig formatting

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Update include to bring in line with internal tree
Harry Wentland [Fri, 8 Sep 2017 14:25:25 +0000 (10:25 -0400)]
drm/amd/display: Update include to bring in line with internal tree

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Change comments to bring in line with internal tree
Harry Wentland [Fri, 8 Sep 2017 14:24:21 +0000 (10:24 -0400)]
drm/amd/display: Change comments to bring in line with internal tree

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Format changes to bring in line with internal tree
Harry Wentland [Fri, 8 Sep 2017 14:23:42 +0000 (10:23 -0400)]
drm/amd/display: Format changes to bring in line with internal tree

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Disable FBC for linear tiling
Roman Li [Tue, 5 Sep 2017 22:23:46 +0000 (18:23 -0400)]
drm/amd/display: Disable FBC for linear tiling

- Fixing text console on FBC-enabled builds

Signed-off-by: Roman Li <Roman.Li@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Update DPP registers
Vitaly Prosyak [Tue, 5 Sep 2017 20:58:37 +0000 (15:58 -0500)]
drm/amd/display: Update DPP registers

Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Reviewed-by: Charlene Liu <Charlene.Liu@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Create fake sink if needed when commit stream
Harry Wentland [Thu, 17 Aug 2017 18:58:07 +0000 (14:58 -0400)]
drm/amd/display: Create fake sink if needed when commit stream

The problem we're trying to fix is this (and similar):
1) X Desktop with single display
2) VT switch
3) Unplug display
4) VT switch back to X
5) re-plug same display

Before this we'd fail at step 4 when trying to create a dc_stream_state
because of a missing sink. This change will fake a sink in this case.

The same scenario applies to S3 resume.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Break out amdgpu_dm_connector
Harry Wentland [Tue, 5 Sep 2017 18:16:09 +0000 (14:16 -0400)]
drm/amd/display: Break out amdgpu_dm_connector

Stop using amdgpu_connector and roll our own. There is no overlap
with amdgpu.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Add 2X Cursor Magnification Code
pana [Fri, 1 Sep 2017 07:43:22 +0000 (15:43 +0800)]
drm/amd/display: Add 2X Cursor Magnification Code

Signed-off-by: Pandey, Arun <Arun.Pandey@amd.com>
Reviewed-by: Charlene Liu <Charlene.Liu@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: No need to keep track of unreffed clk sources
Harry Wentland [Tue, 5 Sep 2017 19:50:48 +0000 (15:50 -0400)]
drm/amd/display: No need to keep track of unreffed clk sources

This simplifies clock source reprogramming a bit.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: move dwb registers to header file
Yue Hin Lau [Tue, 5 Sep 2017 15:50:34 +0000 (11:50 -0400)]
drm/amd/display: move dwb registers to header file

Signed-off-by: Yue Hin Lau <Yuehin.Lau@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: remove output_format from ipp_setup
Eric Bernstein [Thu, 31 Aug 2017 20:04:24 +0000 (16:04 -0400)]
drm/amd/display: remove output_format from ipp_setup

Signed-off-by: Eric Bernstein <eric.bernstein@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Remove switching of clk sources at end of commit
Harry Wentland [Mon, 28 Aug 2017 23:44:38 +0000 (19:44 -0400)]
drm/amd/display: Remove switching of clk sources at end of commit

This should be taken care of in validate now.

All of timing sync is quite broken at the moment anyways. Will submit
another patch set to address that.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Power down clock source at commit
Harry Wentland [Mon, 28 Aug 2017 23:05:17 +0000 (19:05 -0400)]
drm/amd/display: Power down clock source at commit

Still one more in dc_validate_global

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Don't reset clock source at unref
Harry Wentland [Mon, 28 Aug 2017 22:43:45 +0000 (18:43 -0400)]
drm/amd/display: Don't reset clock source at unref

Powering down the clock source during unref is unsafe as we might want
to unref during atomic_check

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: seperate dpp_cm_helper functions into new file
Yue Hin Lau [Tue, 29 Aug 2017 20:54:39 +0000 (16:54 -0400)]
drm/amd/display: seperate dpp_cm_helper functions into new file

Signed-off-by: Yue Hin Lau <Yuehin.Lau@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Fix context alloc failed logging
Andrew Jiang [Fri, 1 Sep 2017 20:03:16 +0000 (16:03 -0400)]
drm/amd/display: Fix context alloc failed logging

Since there was no return statement in the fail block immediately
preceding the context_alloc_fail block, any failure within the
function caused a context alloc failed error message to be printed.
Since the context_alloc_fail block is only used once, move it to
where the goto is directly and accompany it with a return statement.

Signed-off-by: Andrew Jiang <Andrew.Jiang@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: fix default dithering
Tony Cheng [Fri, 1 Sep 2017 20:14:01 +0000 (16:14 -0400)]
drm/amd/display: fix default dithering

bug: default is mapped to no dithering.

default to spatial dithering based on color depth

Signed-off-by: Tony Cheng <tony.cheng@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Enable dcn10_power_on_fe log by default
Harry Wentland [Thu, 31 Aug 2017 20:08:51 +0000 (16:08 -0400)]
drm/amd/display: Enable dcn10_power_on_fe log by default

This should only happen on full update. If this ever happens
on regular pageflips it needs to be debugged.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: fix crc_source_select use hardcoded color depth
Charlene Liu [Fri, 1 Sep 2017 16:51:47 +0000 (12:51 -0400)]
drm/amd/display: fix crc_source_select use hardcoded color depth

Signed-off-by: Charlene Liu <charlene.liu@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: set CP2520 Test pattern to use DP_TEST_PATTERN_HBR2_COMPLIANCE_EYE
Wenjing Liu [Thu, 31 Aug 2017 20:49:56 +0000 (16:49 -0400)]
drm/amd/display: set CP2520 Test pattern to use DP_TEST_PATTERN_HBR2_COMPLIANCE_EYE

Signed-off-by: Wenjing Liu <Wenjing.Liu@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: USB-C to HDMI dongle not light
Hersen Wu [Mon, 11 Sep 2017 20:42:14 +0000 (16:42 -0400)]
drm/amd/display: USB-C to HDMI dongle not light

RV1 support only USB-C active DP-2-HDMI dongle. HPD short pulse is
generated only for DP signal.

When processing HPD short pulse, it must be DP active dongle. No need
for I2C-Over-AUX detection.

v2: Add description

Signed-off-by: Hersen Wu <hersenxs.wu@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: dce110: fix plane validation
Shirish S [Mon, 21 Aug 2017 08:32:17 +0000 (14:02 +0530)]
drm/amd/display: dce110: fix plane validation

For MPO to work with per surface rendering and flipping,
the previous logic of restricting plane[1] only as underlay
needs to be removed.
validate_surface_sets() now checks only the width and height
bounds in case of underlay rather than checking format.

Without this patch one cannot set underlay only.

Signed-off-by: Shirish S <shirish.s@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Request to have DCN RV pipe Harvesting
Hersen Wu [Mon, 28 Aug 2017 21:15:34 +0000 (17:15 -0400)]
drm/amd/display: Request to have DCN RV pipe Harvesting

TODO: Current change only work for sucessive last fused pipe,
like p3, or p3,p2. It does not work for fused p1,p2.

Signed-off-by: Hersen Wu <hersenxs.wu@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Use TPS4 instead of CP2520_3 for phy pattern 7
Wenjing Liu [Wed, 30 Aug 2017 21:49:39 +0000 (17:49 -0400)]
drm/amd/display: Use TPS4 instead of CP2520_3 for phy pattern 7

[Description]
We originally use TPS4 phy test pattern for test pattern 7.
On RV we switched to a new method to use CP2520.
CP2520 should produce the same result.
However in reality, it fails DP PHY automation test.
We use the original method instead.

Signed-off-by: Wenjing Liu <Wenjing.Liu@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Remove sanity check.
Yongqiang Sun [Wed, 30 Aug 2017 18:29:40 +0000 (14:29 -0400)]
drm/amd/display: Remove sanity check.

Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Added negative check for vertical line start.
Yongqiang Sun [Wed, 30 Aug 2017 15:55:40 +0000 (11:55 -0400)]
drm/amd/display: Added negative check for vertical line start.

In case of vstartup happens before vsync, set vertical line
start to 0.

Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Get OTG info if OTG master enabled
Logatharshan Thothiralingam [Fri, 18 Aug 2017 23:09:57 +0000 (19:09 -0400)]
drm/amd/display: Get OTG info if OTG master enabled

Signed-off-by: Logatharshan Thothiralingam <logatharshan.thothiralingam@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: Remove unused flip_flags from amdgpu_crtc
Harry Wentland [Fri, 1 Sep 2017 01:17:05 +0000 (21:17 -0400)]
drm/amdgpu: Remove unused flip_flags from amdgpu_crtc

No more need since Andrey's change to use drm_crtc's version

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: clean up cm register programming functions
Yue Hin Lau [Tue, 29 Aug 2017 19:01:06 +0000 (15:01 -0400)]
drm/amd/display: clean up cm register programming functions

Signed-off-by: Yue Hin Lau <Yuehin.Lau@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: delete dead code
Tony Cheng [Mon, 28 Aug 2017 13:51:03 +0000 (09:51 -0400)]
drm/amd/display: delete dead code

Signed-off-by: Tony Cheng <tony.cheng@amd.com>
Reviewed-by: Yongqiang Sun <yongqiang.sun@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Don't spam log with failed validation
Harry Wentland [Mon, 28 Aug 2017 14:59:39 +0000 (10:59 -0400)]
drm/amd/display: Don't spam log with failed validation

In a lot of case we fail validation of timings for legitimate
reasons. No need to print an error.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Restore missing DCE8 xfm regs
Harry Wentland [Sat, 26 Aug 2017 02:34:51 +0000 (22:34 -0400)]
drm/amd/display: Restore missing DCE8 xfm regs

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Roman Li <Roman.Li@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Set add_stream_ctx for CZ, Hawaii and others
Harry Wentland [Fri, 25 Aug 2017 20:33:40 +0000 (16:33 -0400)]
drm/amd/display: Set add_stream_ctx for CZ, Hawaii and others

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Disable OTG double buffer.
Yongqiang Sun [Tue, 29 Aug 2017 19:27:20 +0000 (15:27 -0400)]
drm/amd/display: Disable OTG double buffer.

Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Program reg for vertical interrupt.
Yongqiang Sun [Tue, 29 Aug 2017 16:50:21 +0000 (12:50 -0400)]
drm/amd/display: Program reg for vertical interrupt.

Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: program fbc for scatter/gather
Roman Li [Fri, 25 Aug 2017 20:44:20 +0000 (16:44 -0400)]
drm/amd/display: program fbc for scatter/gather

Fixing screen flickering when FBC enabled on Stoney

Signed-off-by: Roman Li <Roman.Li@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: add backlight control in blankstream.
Charlene Liu [Mon, 28 Aug 2017 23:35:25 +0000 (19:35 -0400)]
drm/amd/display: add backlight control in blankstream.

Signed-off-by: Charlene Liu <charlene.liu@amd.com>
Reviewed-by: Krunoslav Kovac <Krunoslav.Kovac@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: not override the FMT setting set by VBIOS for eDP
Charlene Liu [Mon, 28 Aug 2017 23:33:23 +0000 (19:33 -0400)]
drm/amd/display: not override the FMT setting set by VBIOS for eDP

Signed-off-by: Charlene Liu <charlene.liu@amd.com>
Reviewed-by: Krunoslav Kovac <Krunoslav.Kovac@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: clean up functions in dcn10_dpp_cm
Yue Hin Lau [Mon, 28 Aug 2017 18:05:17 +0000 (14:05 -0400)]
drm/amd/display: clean up functions in dcn10_dpp_cm

Signed-off-by: Yue Hin Lau <Yuehin.Lau@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: only polling VSync Phase within VSync peroroid
Charlene Liu [Mon, 28 Aug 2017 20:28:34 +0000 (16:28 -0400)]
drm/amd/display: only polling VSync Phase within VSync peroroid

Signed-off-by: Charlene Liu <charlene.liu@amd.com>
Reviewed-by: Yongqiang Sun <yongqiang.sun@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Fix time out on boot
Eric Yang [Mon, 28 Aug 2017 20:50:17 +0000 (16:50 -0400)]
drm/amd/display: Fix time out on boot

On boot, hubp 0 is powergated during enable accel mode, so we time out
when we try to blank in undo wa.

Fix: Check power gate status before set blank

Signed-off-by: Eric Yang <Eric.Yang2@amd.com>
Reviewed-by: Hersen Wu <hersenxs.wu@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Move dis_clk into dc_state.
Andrey Grodzovsky [Mon, 28 Aug 2017 18:25:01 +0000 (14:25 -0400)]
drm/amd/display: Move dis_clk into dc_state.

dis_clk is single instance across pipes.

Signed-off-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: add aux arbitration logic
Charlene Liu [Thu, 24 Aug 2017 21:12:48 +0000 (17:12 -0400)]
drm/amd/display: add aux arbitration logic

Signed-off-by: Charlene Liu <charlene.liu@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Add a clock source to a sharing pipe
Mikita Lipski [Wed, 23 Aug 2017 19:29:18 +0000 (15:29 -0400)]
drm/amd/display: Add a clock source to a sharing pipe

Fix to allow DVI displays to share the same clock source

Signed-off-by: Mikita Lipski <mikita.lipski@amd.com>
Reviewed-by: Roman Li <Roman.Li@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Rename dc resource_validate_ctx methods
Bhawanpreet Lakha [Mon, 28 Aug 2017 16:04:23 +0000 (12:04 -0400)]
drm/amd/display: Rename dc resource_validate_ctx methods

Rename dc_resource methods from validate_ctx to state

Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Rename dc validate_context and current_context
Jerry Zuo [Fri, 25 Aug 2017 20:16:10 +0000 (16:16 -0400)]
drm/amd/display: Rename dc validate_context and current_context

Rename all the dc validate_context to dc_state and
dc current_context to current_state.

Signed-off-by: Jerry Zuo <Jerry.Zuo@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: clean up header file includes
Yue Hin Lau [Fri, 25 Aug 2017 20:13:55 +0000 (16:13 -0400)]
drm/amd/display: clean up header file includes

Signed-off-by: Yue Hin Lau <Yuehin.Lau@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Remove mpc from bios left over, keep double buffer disabled.
Yongqiang Sun [Tue, 22 Aug 2017 19:03:06 +0000 (15:03 -0400)]
drm/amd/display: Remove mpc from bios left over, keep double buffer disabled.

Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: DF C-state entry blocked when DPMS
Hersen Wu [Thu, 24 Aug 2017 21:40:00 +0000 (17:40 -0400)]
drm/amd/display: DF C-state entry blocked when DPMS

Signed-off-by: Hersen Wu <hersenxs.wu@amd.com>
Reviewed-by: Hersen Wu <hersenxs.wu@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: move cm registers from ipp to dpp_cm
Yue Hin Lau [Sat, 19 Aug 2017 20:34:36 +0000 (16:34 -0400)]
drm/amd/display: move cm registers from ipp to dpp_cm

Signed-off-by: Yue Hin Lau <Yuehin.Lau@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Update DSCL
Eric Bernstein [Thu, 24 Aug 2017 20:16:50 +0000 (16:16 -0400)]
drm/amd/display: Update DSCL

Signed-off-by: Eric Bernstein <eric.bernstein@amd.com>
Signed-off-by: Tony Cheng <tony.cheng@amd.com>
Reviewed-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Fix MST downstream display not light up regression
Jerry Zuo [Thu, 24 Aug 2017 20:03:02 +0000 (16:03 -0400)]
drm/amd/display: Fix MST downstream display not light up regression

The fix is for the scenario: MST+SST chain together, and hook up
to the card.

Regression: Per stream validate_context build v2
Before dc_add_stream_to_ctx(), need to update/reset
stream signal type to SIGNAL_TYPE_DISPLAY_PORT_MST. Otherwise,
downstream device cannot be added to ctx due to the lack of signal
type info (SIGNAL_TYPE_NONE).
update_stream_signal() needs to be done after stream is created.

Signed-off-by: Jerry Zuo <Jerry.Zuo@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Use DRM provided page flip flag.
Andrey Grodzovsky [Wed, 23 Aug 2017 20:54:03 +0000 (16:54 -0400)]
drm/amd/display: Use DRM provided page flip flag.

Starting with 4.12 kernel DRM provides page flip flags so we
don't need to have our own copy.

Signed-off-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: work around for 8k sleep crash
Yongqiang Sun [Thu, 24 Aug 2017 21:29:24 +0000 (17:29 -0400)]
drm/amd/display: work around for 8k sleep crash

Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: do not reset lane count in EQ fallback
Wenjing Liu [Wed, 23 Aug 2017 21:02:34 +0000 (17:02 -0400)]
drm/amd/display: do not reset lane count in EQ fallback

[Description]
According to DP1.4 specs we should not reset lane count back
when falling back in failing EQ training.
This causes PHY test pattern compliance to fail as infinite LT
when LT fails EQ to 4 RBR and fails CR in a loop.

Signed-off-by: Wenjing Liu <Wenjing.Liu@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Clean up flattening core_dc to dc
Bhawanpreet Lakha [Wed, 23 Aug 2017 19:44:42 +0000 (15:44 -0400)]
drm/amd/display: Clean up flattening core_dc to dc

Clean up some code related to flattening core_dc commit
(Remove redundent dc = dc, which was the result of removing
DC_TO_CORE() macro)

Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Don't leak dc_stream_state.
Darren Salt [Tue, 12 Sep 2017 16:10:25 +0000 (17:10 +0100)]
drm/amd/display: Don't leak dc_stream_state.

Noticed while playing “Valley”, which was causing some 8MB of leakage per
second. kmemleak listed many entries looking like this:

    unreferenced object 0xffff8802c2951800 (size 1024):
      comm "Xorg", pid 2982, jiffies 4297410155 (age 392.787s)
      hex dump (first 32 bytes):
        00 50 f9 0c 04 88 ff ff 98 08 00 00 00 00 00 00  .P..............
        80 07 00 00 00 00 00 00 58 00 00 00 2c 00 00 00  ........X...,...
      backtrace:
        [<ffffffff810cd4c3>] create_object+0x13c/0x261
        [<ffffffff815abdc2>] kmemleak_alloc+0x20/0x3c
        [<ffffffff810cad1d>] slab_post_alloc_hook+0x42/0x52
        [<ffffffff810cb8e0>] kmem_cache_alloc+0x67/0x76
        [<ffffffff813bbb54>] dc_create_stream_for_sink+0x24/0x1cf
        [<ffffffff81373aaa>] create_stream_for_sink+0x6f/0x295
        [<ffffffff81373dc2>] dm_update_crtcs_state+0xa6/0x268
        [<ffffffff8137401e>] amdgpu_dm_atomic_check+0x9a/0x314
        [<ffffffff812ac3dd>] drm_atomic_check_only+0x17a/0x42d
        [<ffffffff812ac6a3>] drm_atomic_commit+0x13/0x4b
        [<ffffffff812ad1a5>] drm_atomic_connector_commit_dpms+0xcb/0xe8
        [<ffffffff812b1238>] drm_mode_obj_set_property_ioctl+0xe6/0x1e3
        [<ffffffff812b027b>] drm_mode_connector_property_set_ioctl+0x2b/0x2d
        [<ffffffff8129f427>] drm_ioctl_kernel+0x64/0x9d
        [<ffffffff8129f6a2>] drm_ioctl+0x230/0x316
        [<ffffffff812ca4d3>] amdgpu_drm_ioctl+0x4b/0x7d

v2: also handle break statements.

Signed-off-by: Darren Salt <devspam@moreofthesa.me.uk>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Refactor atomic check.
Andrey Grodzovsky [Fri, 18 Aug 2017 14:52:20 +0000 (10:52 -0400)]
drm/amd/display: Refactor atomic check.

Split into update crtcs and update plane functions.

Signed-off-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Per plane validation context build.
Andrey Grodzovsky [Fri, 11 Aug 2017 14:43:45 +0000 (10:43 -0400)]
drm/amd/display: Per plane validation context build.

Introduce add/remove plane to/from context.
Make DC wrapper to use them in WIndows/Diags.
Use them in dc_update_surface_to_stream.
Call add/remove plane from Linux DM.

Remove dc_validation_set from dc_validate_global_state interface
and by this remove clean Linux DM from using it.

Signed-off-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Block 6Ghz timing if SBIOS set HDMI_6G_en to 0
Charlene Liu [Wed, 23 Aug 2017 00:15:28 +0000 (20:15 -0400)]
drm/amd/display: Block 6Ghz timing if SBIOS set HDMI_6G_en to 0

Signed-off-by: Charlene Liu <charlene.liu@amd.com>
Reviewed-by: Charlene Liu <Charlene.Liu@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Safe stream encoder id in stream_status
Wenjing Liu [Tue, 22 Aug 2017 22:42:51 +0000 (18:42 -0400)]
drm/amd/display: Safe stream encoder id in stream_status

Signed-off-by: Wenjing Liu <Wenjing.Liu@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Fix return value from rx irq handler on up request
Wenjing Liu [Tue, 22 Aug 2017 19:49:57 +0000 (15:49 -0400)]
drm/amd/display: Fix return value from rx irq handler on up request

Signed-off-by: Wenjing Liu <Wenjing.Liu@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Stop including atomfimrwareid.h directly
Harry Wentland [Tue, 22 Aug 2017 13:35:41 +0000 (09:35 -0400)]
drm/amd/display: Stop including atomfimrwareid.h directly

It's already included in atomfirmware.h

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Roman Li <Roman.Li@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Remove old, misleading comment
Harry Wentland [Tue, 22 Aug 2017 14:29:40 +0000 (10:29 -0400)]
drm/amd/display: Remove old, misleading comment

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Roman Li <Roman.Li@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Remove unneeded code
Bhawanpreet Lakha [Mon, 21 Aug 2017 20:28:39 +0000 (16:28 -0400)]
drm/amd/display: Remove unneeded code

Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: retry LT on failing LT in automated request
Wenjing Liu [Mon, 21 Aug 2017 20:43:08 +0000 (16:43 -0400)]
drm/amd/display: retry LT on failing LT in automated request

[Description]
Link training is not retried in automated link training request.
In case link training is occasionally failing, there is not way to retry
so the requested lane settings will not set.

Signed-off-by: Wenjing Liu <Wenjing.Liu@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/display: Change log level for DCN powergatting
Bhawanpreet Lakha [Mon, 21 Aug 2017 15:46:17 +0000 (11:46 -0400)]
drm/amd/display: Change log level for DCN powergatting

Change log level from LOG_DC to LOG_DEBUG
LOG_DC spams dmesg on linux when hotpluging

Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>