openwrt/staging/blogic.git
4 years agodrm/tegra: gem: Remove premature import restrictions
Thierry Reding [Tue, 3 Dec 2019 16:19:08 +0000 (17:19 +0100)]
drm/tegra: gem: Remove premature import restrictions

All the display related blocks on Tegra require contiguous memory. Using
the DMA API, there is no knowing at import time which device will end up
using the buffer, so it's not known whether or not an IOMMU will be used
to map the buffer.

Move the check for non-contiguous buffers/mappings to the tegra_dc_pin()
function which is now the earliest point where it is known if a DMA BUF
can be used by the given device or not.

v2: add check for contiguous buffer/mapping in tegra_dc_pin()

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Thierry Reding <treding@nvidia.com>
4 years agodrm/tegra: gem: Properly pin imported buffers
Thierry Reding [Tue, 3 Dec 2019 16:19:07 +0000 (17:19 +0100)]
drm/tegra: gem: Properly pin imported buffers

Buffers that are imported from a DMA-BUF don't have pages allocated with
them. At the same time an SG table for them can't be derived using the
DMA API helpers because the necessary information doesn't exist. However
there's already an SG table that was created during import, so this can
simply be duplicated.

Signed-off-by: Thierry Reding <treding@nvidia.com>
4 years agodrm/tegra: hub: Remove bogus connection mutex check
Thierry Reding [Tue, 3 Dec 2019 16:19:06 +0000 (17:19 +0100)]
drm/tegra: hub: Remove bogus connection mutex check

The Tegra DRM never actually took that lock, so the driver was broken
until generic locking was added in commit:

commit b962a12050a387e4bbf3a48745afe1d29d396b0d
Author: Rob Clark <robdclark@gmail.com>
Date:   Mon Oct 22 14:31:22 2018 +0200

    drm/atomic: integrate modeset lock with private objects

It's now no longer necessary to take that lock, so drop the check.

v2: add rationale for why it is now safe to drop the check (Daniel)

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: Unconditionally select IOMMU_IOVA
Thierry Reding [Thu, 29 Aug 2019 15:52:42 +0000 (17:52 +0200)]
drm/tegra: Unconditionally select IOMMU_IOVA

Currently configurations can be generated where IOMMU_SUPPORT is
disabled but IOMMU_IOVA is built as a module and DRM_TEGRA as built-in.
In such a case, the symbols guarded by IOMMU_IOVA will not be available
when linking the Tegra DRM driver and cause a linking failure.

Simplify this by unconditionally selecting IOMMU_IOVA, which makes sure
that it will be forced to =y if DRM_TEGRA=y. Technically we can now get
IOMMU_IOVA code built-in even if we don't use it (Tegra DRM only uses it
when IOMMU_SUPPORT is also enabled), but such configuration are of a
mostly academic nature. In all practical configurations we want IOMMU
support anyway.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agogpu: host1x: Unconditionally select IOMMU_IOVA
Thierry Reding [Thu, 29 Aug 2019 15:56:53 +0000 (17:56 +0200)]
gpu: host1x: Unconditionally select IOMMU_IOVA

Currently configurations can be generated where IOMMU_SUPPORT is
disabled but IOMMU_IOVA is built as a module and HOST1X as built-in. In
such a case, the symbols guarded by IOMMU_IOVA will not be available
when linking the host1x driver and cause a linking failure.

Simplify this by unconditionally selecting IOMMU_IOVA, which makes sure
that it will be forced to =y if HOST1X=y. Technically we can now get
IOMMU_IOVA code built-in even if we don't use it (host1x only uses it
when IOMMU_SUPPORT is also enabled), but such configuration are of a
mostly academic nature. In all practical configurations we want IOMMU
support anyway.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: Optionally attach clients to the IOMMU
Thierry Reding [Mon, 28 Oct 2019 12:37:18 +0000 (13:37 +0100)]
drm/tegra: Optionally attach clients to the IOMMU

If a client is already attached to an IOMMU domain that is not the
shared domain, don't try to attach it again. This allows using the
IOMMU-backed DMA API.

Since the IOMMU-backed DMA API is now supported and there's no way
to detach from it on 64-bit ARM, don't bother to detach from it on
32-bit ARM either.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: Support DMA API for display controllers
Thierry Reding [Mon, 28 Oct 2019 12:37:17 +0000 (13:37 +0100)]
drm/tegra: Support DMA API for display controllers

If a display controller is not attached to an explicit IOMMU domain,
which usually means that it's connected to an IOMMU domain controlled by
the DMA API, make sure to map the framebuffer to the display controller
address space. This allows us to transparently handle setups where the
display controller is attached to an IOMMU or setups where it isn't. It
also allows the driver to work with a DMA API that is backed by an
IOMMU.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: falcon: Clarify address usage
Thierry Reding [Mon, 28 Oct 2019 12:37:16 +0000 (13:37 +0100)]
drm/tegra: falcon: Clarify address usage

Rename paddr -> iova and vaddr -> virt to make it clearer how these
addresses are used. This is important for a subsequent patch that makes
a distinction between the physical address (physical address of the
system memory from the CPU's point of view) and the IOVA (physical
address of the system memory from the device's point of view).

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: Remove memory allocation from Falcon library
Thierry Reding [Mon, 28 Oct 2019 12:37:15 +0000 (13:37 +0100)]
drm/tegra: Remove memory allocation from Falcon library

Having to provide allocator hooks to the Falcon library is somewhat
cumbersome and it doesn't give the users of the library a lot of
flexibility to deal with allocations. Instead, remove the notion of
Falcon "operations" and let drivers deal with the memory allocations
themselves.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agogpu: host1x: Set DMA mask based on IOMMU setup
Thierry Reding [Mon, 28 Oct 2019 12:37:14 +0000 (13:37 +0100)]
gpu: host1x: Set DMA mask based on IOMMU setup

If the Tegra DRM clients are backed by an IOMMU, push buffers are likely
to be allocated beyond the 32-bit boundary if sufficient system memory
is available. This is problematic on earlier generations of Tegra where
host1x supports a maximum of 32 address bits for the GATHER opcode. More
recent versions of Tegra (Tegra186 and later) have a wide variant of the
GATHER opcode, which allows addressing up to 64 bits of memory.

If host1x itself is behind an IOMMU as well this doesn't matter because
the IOMMU's input address space is restricted to 32 bits on generations
without support for wide GATHER opcodes.

However, if host1x is not behind an IOMMU, it won't be able to process
push buffers beyond the 32-bit boundary on Tegra generations that don't
support wide GATHER opcodes. Restrict the DMA mask to 32 bits on these
generations prevents buffers from being allocated from beyond the 32-bit
boundary.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agogpu: host1x: Support DMA mapping of buffers
Thierry Reding [Mon, 28 Oct 2019 12:37:13 +0000 (13:37 +0100)]
gpu: host1x: Support DMA mapping of buffers

If host1x_bo_pin() returns an SG table, create a DMA mapping for the
buffer. For buffers that the host1x client has already mapped itself,
host1x_bo_pin() returns NULL and the existing DMA address is used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agogpu: host1x: Allocate gather copy for host1x
Thierry Reding [Mon, 28 Oct 2019 12:37:12 +0000 (13:37 +0100)]
gpu: host1x: Allocate gather copy for host1x

Currently when the gather buffers are copied, they are copied to a
buffer that is allocated for the host1x client that wants to execute the
command streams in the buffers. However, the gather buffers will be read
by the host1x device, which causes SMMU faults if the DMA API is backed
by an IOMMU.

Fix this by allocating the gather buffer copy for the host1x device,
which makes sure that it will be mapped into the host1x's IOVA space if
the DMA API is backed by an IOMMU.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agogpu: host1x: Add direction flags to relocations
Thierry Reding [Mon, 28 Oct 2019 12:37:11 +0000 (13:37 +0100)]
gpu: host1x: Add direction flags to relocations

Add direction flags to host1x relocations performed during job pinning.
These flags indicate the kinds of accesses that hardware is allowed to
perform on the relocated buffers.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agogpu: host1x: Clean up debugfs on removal
Thierry Reding [Mon, 28 Oct 2019 12:37:10 +0000 (13:37 +0100)]
gpu: host1x: Clean up debugfs on removal

The debugfs files created for host1x are never removed, causing these
files to be left dangling in debugfs. This results in a crash when any
of these files are accessed after the host1x driver has been removed,
as well as a failure to create the debugfs entries when they are added
again on driver probe.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agogpu: host1x: Overhaul host1x_bo_{pin,unpin}() API
Thierry Reding [Mon, 28 Oct 2019 12:37:09 +0000 (13:37 +0100)]
gpu: host1x: Overhaul host1x_bo_{pin,unpin}() API

The host1x_bo_pin() and host1x_bo_unpin() APIs are used to pin and unpin
buffers during host1x job submission. Pinning currently returns the SG
table and the DMA address (an IOVA if an IOMMU is used or a physical
address if no IOMMU is used) of the buffer. The DMA address is only used
for buffers that are relocated, whereas the host1x driver will map
gather buffers into its own IOVA space so that they can be processed by
the CDMA engine.

This approach has a couple of issues. On one hand it's not very useful
to return a DMA address for the buffer if host1x doesn't need it. On the
other hand, returning the SG table of the buffer is suboptimal because a
single SG table cannot be shared for multiple mappings, because the DMA
address is stored within the SG table, and the DMA address may be
different for different devices.

Subsequent patches will move the host1x driver over to the DMA API which
doesn't work with a single shared SG table. Fix this by returning a new
SG table each time a buffer is pinned. This allows the buffer to be
referenced by multiple jobs for different engines.

Change the prototypes of host1x_bo_pin() and host1x_bo_unpin() to take a
struct device *, specifying the device for which the buffer should be
pinned. This is required in order to be able to properly construct the
SG table. While at it, make host1x_bo_pin() return the SG table because
that allows us to return an ERR_PTR()-encoded error code if we need to,
or return NULL to signal that we don't need the SG table to be remapped
and can simply use the DMA address as-is. At the same time, returning
the DMA address is made optional because in the example of command
buffers, host1x doesn't need to know the DMA address since it will have
to create its own mapping anyway.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: Simplify IOMMU group selection
Thierry Reding [Mon, 28 Oct 2019 12:37:08 +0000 (13:37 +0100)]
drm/tegra: Simplify IOMMU group selection

All the devices that make up the DRM device are now part of the same
IOMMU group. This simplifies the handling of the IOMMU attachment and
also avoids exhausting the number of IOMMUs available on early Tegra
SoC generations.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: Do not use ->load() and ->unload() callbacks
Thierry Reding [Mon, 28 Oct 2019 12:16:10 +0000 (13:16 +0100)]
drm/tegra: Do not use ->load() and ->unload() callbacks

The ->load() and ->unload() drivers are midlayers and should be avoided
in modern drivers. Fix this by moving the code into the driver ->probe()
and ->remove() implementations, respectively.

v2: kick out conflicting framebuffers before initializing fbdev
v3: rebase onto drm/tegra/for-next

Tested-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: sor: Introduce audio enable/disable callbacks
Thierry Reding [Mon, 24 Jun 2019 13:15:39 +0000 (15:15 +0200)]
drm/tegra: sor: Introduce audio enable/disable callbacks

In order to support different modes (DP in addition to HDMI), split out
the audio setup/teardown into callbacks.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: sor: Extract common audio enabling code
Thierry Reding [Mon, 24 Jun 2019 13:13:16 +0000 (15:13 +0200)]
drm/tegra: sor: Extract common audio enabling code

The code to enable audio support is split into two parts, one being
generic for the SOR and another part that is specific whether the SOR is
in HDMI mode or in DP mode. Split out the common part in preparation for
reusing the code in DP mode.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: sor: Avoid timeouts on unplug events
Thierry Reding [Thu, 25 Jul 2019 13:41:36 +0000 (15:41 +0200)]
drm/tegra: sor: Avoid timeouts on unplug events

When the SOR is disabled in DP mode as part of an unplug event, do not
attempt to power the DP link down. Powering down the link requires the
DPAUX to transmit AUX messages which only works if there's a connected
sink.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: sor: Unify eDP and DP support
Thierry Reding [Thu, 27 Jun 2019 10:34:57 +0000 (12:34 +0200)]
drm/tegra: sor: Unify eDP and DP support

The SOR0 on Tegra210 does, contrary to what was previously assumed, in
fact support DisplayPort. The difference between SOR0 and SOR1 is that
the latter supports audio and HDCP over DP, whereas the former doesn't.

The code for eDP and DP is now almost identical and the differences can
easily be parameterized based on the presence of a panel. There is no
need any longer to duplicate the code.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: sor: Use correct I/O pad for DP
Thierry Reding [Wed, 24 Jul 2019 15:10:31 +0000 (17:10 +0200)]
drm/tegra: sor: Use correct I/O pad for DP

The correct I/O pad needs to be powered up before DP can be used. Make
sure the correct default is set for Tegra generations where the I/O pad
cannot be derived from the SOR instance.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: sor: Unify clock setup for eDP, HDMI and DP
Thierry Reding [Wed, 24 Jul 2019 14:59:04 +0000 (16:59 +0200)]
drm/tegra: sor: Unify clock setup for eDP, HDMI and DP

With the clocks modelled consistently across SoC generations, the clock
setup for eDP, HDMI and DP can now be unified.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: sor: Support DisplayPort on Tegra194
Thierry Reding [Thu, 27 Jun 2019 10:32:16 +0000 (12:32 +0200)]
drm/tegra: sor: Support DisplayPort on Tegra194

Reuse parameters from earlier generations to support DisplayPort on
Tegra194.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: sor: Deduplicate connector type detection code
Thierry Reding [Thu, 27 Jun 2019 10:29:56 +0000 (12:29 +0200)]
drm/tegra: sor: Deduplicate connector type detection code

The connector type detection code is duplicated in two places. Keeping
both places in sync is an extra maintenance burden that can be avoided
by comparing the connector type operations that are set upon the first
detection.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: sor: Implement pad clock for all SOR instances
Thierry Reding [Mon, 24 Jun 2019 15:06:34 +0000 (17:06 +0200)]
drm/tegra: sor: Implement pad clock for all SOR instances

So far the pad clock was only needed on the second SOR instance. The
clock does exist for all SOR instances, though, so make sure it is
always implemented. This prepares for further unification of the code
in subsequent patches.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: sor: Use correct SOR index on Tegra210
Thierry Reding [Wed, 24 Jul 2019 15:06:17 +0000 (17:06 +0200)]
drm/tegra: sor: Use correct SOR index on Tegra210

The device tree bindings for the Tegra210 SOR don't require the
controller instance to be defined, since the instance can be derived
from the compatible string. The index is never used on Tegra210, so we
got away with it not getting set. However, subsequent patches will
change that, so make sure the proper index is used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: sor: Remove tegra186-sor1 support
Thierry Reding [Mon, 19 Mar 2018 09:30:37 +0000 (10:30 +0100)]
drm/tegra: sor: Remove tegra186-sor1 support

It turns out that SOR1 is just another instance of the same block as the
SOR0, so there is no need to distinguish them.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: sor: Add DisplayPort support
Thierry Reding [Tue, 15 Oct 2019 12:59:37 +0000 (14:59 +0200)]
drm/tegra: sor: Add DisplayPort support

Add support for regular DisplayPort on Tegra210 and Tegra186.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: sor: Filter eDP rates
Thierry Reding [Thu, 1 Feb 2018 16:47:07 +0000 (17:47 +0100)]
drm/tegra: sor: Filter eDP rates

The SOR found on Tegra SoCs does not support all the rates potentially
advertised by eDP 1.4. Make sure that the rates that are not supported
are filtered out.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: sor: Stabilize eDP
Thierry Reding [Mon, 3 Aug 2015 13:53:08 +0000 (15:53 +0200)]
drm/tegra: sor: Stabilize eDP

Rework eDP code to correspond more closely to what's documented. This
also improves the reliability of modesets.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: sor: Hook up I2C-over-AUX to output
Thierry Reding [Tue, 21 Jul 2015 14:59:28 +0000 (16:59 +0200)]
drm/tegra: sor: Hook up I2C-over-AUX to output

This is necessary for the output abstraction to retrieve a list of valid
modes from the EDID of a connected panel/monitor. This will be useful in
conjunction with DisplayPort support that will be added in a subsequent
patch, so that the driver can read EDID via the AUX channel.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: sor: Use DP link training helpers
Thierry Reding [Tue, 15 Oct 2019 12:57:42 +0000 (14:57 +0200)]
drm/tegra: sor: Use DP link training helpers

Make use of the DP link training helpers to implement full and fast link
training. While at it, refactor some of the code and remove various code
sequences that are not necessary.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: dp: Add DisplayPort link training helper
Thierry Reding [Tue, 7 Jul 2015 19:21:48 +0000 (21:21 +0200)]
drm/tegra: dp: Add DisplayPort link training helper

Add a helper that will perform link training as described in the
DisplayPort specification.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: dp: Add support for eDP link rates
Thierry Reding [Thu, 1 Feb 2018 16:46:42 +0000 (17:46 +0100)]
drm/tegra: dp: Add support for eDP link rates

Parses additional link rates from DPCD if the sink supports eDP 1.4.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: dp: Add drm_dp_link_choose() helper
Thierry Reding [Tue, 21 Jul 2015 14:38:11 +0000 (16:38 +0200)]
drm/tegra: dp: Add drm_dp_link_choose() helper

This helper chooses an appropriate configuration, according to the
bitrate requirements of the video mode and the capabilities of the
DisplayPort sink.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: dp: Enable alternate scrambler reset when supported
Thierry Reding [Tue, 7 Jul 2015 19:14:12 +0000 (21:14 +0200)]
drm/tegra: dp: Enable alternate scrambler reset when supported

If the sink is eDP and supports the alternate scrambler reset, enable
it.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: dp: Set channel coding on link configuration
Thierry Reding [Wed, 10 Jun 2015 14:35:44 +0000 (16:35 +0200)]
drm/tegra: dp: Set channel coding on link configuration

Make use of ANSI 8B/10B channel coding if the DisplayPort sink supports
it.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: dp: Read AUX read interval from DPCD
Thierry Reding [Tue, 7 Jul 2015 19:01:26 +0000 (21:01 +0200)]
drm/tegra: dp: Read AUX read interval from DPCD

Store the AUX read interval from DPCD, so that it can be used to wait
for the durations given in the specification during link training.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: dp: Read eDP version from DPCD
Thierry Reding [Tue, 7 Jul 2015 18:59:22 +0000 (20:59 +0200)]
drm/tegra: dp: Read eDP version from DPCD

If the sink supports eDP, read the eDP revision from it's DPCD.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: dp: Read alternate scrambler reset capability from sink
Thierry Reding [Mon, 5 Feb 2018 14:16:18 +0000 (15:16 +0100)]
drm/tegra: dp: Read alternate scrambler reset capability from sink

Parse from the sink capabilities whether or not the eDP alternate
scrambler reset value of 0xfffe is supported.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: dp: Read channel coding capability from sink
Thierry Reding [Mon, 5 Feb 2018 13:07:57 +0000 (14:07 +0100)]
drm/tegra: dp: Read channel coding capability from sink

Parse from the sink capabilities whether or not it supports ANSI 8B/10B
channel coding as specified in ANSI X3.230-1994, clause 11.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: dp: Read TPS3 capability from sink
Thierry Reding [Tue, 7 Jul 2015 18:52:07 +0000 (20:52 +0200)]
drm/tegra: dp: Read TPS3 capability from sink

The TPS3 capability can be exposed by DP 1.2 and later sinks if they
support the alternative training pattern for channel equalization.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: dp: Read fast training capability from link
Thierry Reding [Thu, 3 Dec 2015 12:07:43 +0000 (13:07 +0100)]
drm/tegra: dp: Read fast training capability from link

While probing the DisplayPort link, query the fast training capability.
If supported, drivers can use the fast link training sequence instead of
the more involved full link training sequence.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: dp: Probe link using existing parsing helpers
Thierry Reding [Thu, 3 Dec 2015 12:02:52 +0000 (13:02 +0100)]
drm/tegra: dp: Probe link using existing parsing helpers

Use existing parsing helpers to probe a DisplayPort link.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: dp: Turn link capabilities into booleans
Thierry Reding [Thu, 3 Dec 2015 11:45:45 +0000 (12:45 +0100)]
drm/tegra: dp: Turn link capabilities into booleans

Rather than storing capabilities as flags in an integer, use a separate
boolean per capability. This simplifies the code that checks for these
capabilities.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: dp: Track link capabilities alongside settings
Thierry Reding [Tue, 21 Jul 2015 14:33:48 +0000 (16:33 +0200)]
drm/tegra: dp: Track link capabilities alongside settings

Store capabilities in max_* fields and add separate fields for the
currently selected settings.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: dp: Add drm_dp_link_reset() implementation
Thierry Reding [Thu, 3 Dec 2015 10:44:17 +0000 (11:44 +0100)]
drm/tegra: dp: Add drm_dp_link_reset() implementation

Subsequent patches will add non-volatile fields to struct drm_dp_link,
so introduce a function to zero out only the volatile fields.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: Add missing kerneldoc for struct drm_dp_link
Thierry Reding [Mon, 5 Feb 2018 13:31:27 +0000 (14:31 +0100)]
drm/tegra: Add missing kerneldoc for struct drm_dp_link

The drm_dp_link structure tracks capabilities on the DP link. Add some
kerneldoc to explain what each of its fields means.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: dpaux: Parameterize CMH, DRVZ and DRVI
Thierry Reding [Thu, 27 Jun 2019 10:24:41 +0000 (12:24 +0200)]
drm/tegra: dpaux: Parameterize CMH, DRVZ and DRVI

The CMH, DRVZ and DRVI values vary depending on the SoC generation. Move
them into SoC specific structures so that DT compatible string matching
can be used to select the right parameters and write them to hardware at
the right time.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: dpaux: Fix crash if VDD supply is absent
Thierry Reding [Mon, 24 Jun 2019 11:30:24 +0000 (13:30 +0200)]
drm/tegra: dpaux: Fix crash if VDD supply is absent

In order to properly make the VDD supply optional, all accesses to the
regulator need to be ignored, because the regulator core doesn't treat
NULL special.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: dpaux: Retry on transfer size mismatch
Thierry Reding [Thu, 3 Mar 2016 14:32:13 +0000 (15:32 +0100)]
drm/tegra: dpaux: Retry on transfer size mismatch

When a transfer didn't complete transmission of the requested number of
bytes, signal that the transaction should be retried.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: dpaux: Support monitor hotplugging
Thierry Reding [Mon, 3 Aug 2015 12:08:34 +0000 (14:08 +0200)]
drm/tegra: dpaux: Support monitor hotplugging

The dpaux driver has a quirk built-in that will delay initialization of
the display driver for a short while, trying to detect an eDP panel. The
reason for this quirk is that the panel may not report as connected
until after the display driver has initialized, at which point the fbdev
emulation will have fallen back to 1024x768 as default resolution, which
will likely not be the eDP panel's native resolution.

With upcoming DisplayPort support, the code needs to be able to cope
with hotpluggable monitors as well. Waiting for a panel to show up is no
longer going to work because the monitor may not be attached on boot. If
the output runs in DisplayPort mode, skip waiting for the panel to show
up.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: gem: Use sg_alloc_table_from_pages()
Thierry Reding [Fri, 8 Jun 2018 13:00:05 +0000 (15:00 +0200)]
drm/tegra: gem: Use sg_alloc_table_from_pages()

Instead of manually creating the SG table for a discontiguous buffer,
use the existing sg_alloc_table_from_pages(). Note that this is not safe
to be used with the ARM DMA/IOMMU integration code because that will not
ensure that the whole buffer is mapped contiguously. Depending on the
size of the individual entries the mapping may end up containing holes
to ensure alignment.

However, we only ever use these buffers with explicit IOMMU API usage
and know how to avoid these holes.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: gem: Always map SG tables for DMA-BUFs
Thierry Reding [Fri, 8 Jun 2018 12:59:13 +0000 (14:59 +0200)]
drm/tegra: gem: Always map SG tables for DMA-BUFs

When an importer wants to map a DMA-BUF, make sure to always actually
map it, irrespective of whether the buffer is contiguous or not.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: gem: Use dma_get_sgtable()
Thierry Reding [Fri, 8 Jun 2018 12:56:04 +0000 (14:56 +0200)]
drm/tegra: gem: Use dma_get_sgtable()

Rather than manually creating an SG table in an incorrect way, let the
standard dma_get_sgtable() function do it.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: gem: Rename paddr -> iova
Thierry Reding [Mon, 4 Jun 2018 15:36:50 +0000 (17:36 +0200)]
drm/tegra: gem: Rename paddr -> iova

The address can refer to either physical memory or IO virtual memory.
If referring to IO virtual memory, there will always be an associated
physical memory address. Rename this variable to "iova" to clarify in
all cases that this is the IO virtual memory, which in the absence of
an IOMMU is identical to the physical address.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: Move IOMMU group into host1x client
Thierry Reding [Fri, 8 Feb 2019 13:35:13 +0000 (14:35 +0100)]
drm/tegra: Move IOMMU group into host1x client

Handling of the IOMMU group attachment is common to all clients, so move
the group into the client to simplify code.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: vic: Use common IOMMU attach/detach code
Thierry Reding [Fri, 8 Feb 2019 13:15:44 +0000 (14:15 +0100)]
drm/tegra: vic: Use common IOMMU attach/detach code

Reuse common code to attach to or detach from an IOMMU domain.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: vic: Inherit DMA mask from host1x
Thierry Reding [Fri, 8 Feb 2019 12:10:41 +0000 (13:10 +0100)]
drm/tegra: vic: Inherit DMA mask from host1x

VIC, just like all other host1x clients, has the same addressing range
as its parent host1x device. Inherit the DMA mask to reflect that.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: vic: Skip stream ID programming without IOMMU
Thierry Reding [Fri, 8 Feb 2019 12:09:49 +0000 (13:09 +0100)]
drm/tegra: vic: Skip stream ID programming without IOMMU

If VIC is not behind an IOMMU, don't touch any of the registers related
to stream ID programming.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: Use DRM_DEBUG_DRIVER for driver messages
Thierry Reding [Wed, 4 Sep 2019 11:00:30 +0000 (13:00 +0200)]
drm/tegra: Use DRM_DEBUG_DRIVER for driver messages

The driver-specific messages should use the DRM_UT_DRIVER category so
that they can be properly filtered.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: Inherit device DMA parameters from host1x
Thierry Reding [Mon, 9 Sep 2019 12:25:45 +0000 (14:25 +0200)]
drm/tegra: Inherit device DMA parameters from host1x

The display controllers and VIC don't have any limitations on the
DMA segment size. Inherit the DMA parameters from the parent device,
which also doesn't have any such limitations.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agogpu: host1x: Make host1x_cdma_wait_pushbuffer_space() static
Ben Dooks (Codethink) [Thu, 17 Oct 2019 11:04:27 +0000 (12:04 +0100)]
gpu: host1x: Make host1x_cdma_wait_pushbuffer_space() static

The host1x_cdma_wait_pushbuffer_space() function is not declared or
directly called from outside the file it is in, so make it static.

Fixes the following sparse warning:

    drivers/gpu/host1x/cdma.c:235:5: warning: symbol 'host1x_cdma_wait_pushbuffer_space' was not declared. Should it be static?

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agogpu: host1x: Request channels for clients, not devices
Thierry Reding [Mon, 18 Jun 2018 12:01:51 +0000 (14:01 +0200)]
gpu: host1x: Request channels for clients, not devices

A struct device doesn't carry much information that a channel might be
interested in, but the client very much does. Request channels for the
clients rather than their parent devices and store a pointer to them
in order to have that information available when needed.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agogpu: host1x: Explicitly initialize host1x_info structures
Thierry Reding [Thu, 5 Sep 2019 09:39:05 +0000 (11:39 +0200)]
gpu: host1x: Explicitly initialize host1x_info structures

It's technically not required to explicitly initialize the fields that
will be zero by default, but it's easier to read these structures if
they are all initialized uniformly.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agogpu: host1x: Remove gratuitous blank line
Thierry Reding [Mon, 18 Jun 2018 12:01:10 +0000 (14:01 +0200)]
gpu: host1x: Remove gratuitous blank line

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agogpu: host1x: Do not limit DMA segment size
Thierry Reding [Mon, 9 Sep 2019 12:28:46 +0000 (14:28 +0200)]
gpu: host1x: Do not limit DMA segment size

host1x nor any its clients have any limitations on the DMA segment size,
so don't pretend that they do.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: Use cec_notifier_conn_(un)register()
Dariusz Marcinkiewicz [Wed, 14 Aug 2019 10:45:05 +0000 (12:45 +0200)]
drm/tegra: Use cec_notifier_conn_(un)register()

Use the new cec_notifier_conn_(un)register() functions to
(un)register the notifier for the HDMI connector, and fill in
the cec_connector_info.

Signed-off-by: Dariusz Marcinkiewicz <darekm@google.com>
Tested-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: Fix ordering of cleanup code
Thierry Reding [Wed, 25 Sep 2019 11:26:59 +0000 (13:26 +0200)]
drm/tegra: Fix ordering of cleanup code

Commit Fixes: b9f8b09ce256 ("drm/tegra: Setup shared IOMMU domain after
initialization") changed the initialization order of the IOMMU related
bits but didn't update the cleanup path accordingly. This asymmetry can
cause failures during error recovery.

Fixes: b9f8b09ce256 ("drm/tegra: Setup shared IOMMU domain after initialization")
Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Tested-by: Dmitry Osipenko <digetx@gmail.com>
5 years agodrm/tegra: sor: Move register programming out of ->init()
Thierry Reding [Wed, 20 Feb 2019 09:03:46 +0000 (10:03 +0100)]
drm/tegra: sor: Move register programming out of ->init()

The hardware is not guaranteed to be enabled during execution of the
tegra_sor_init() function, which can lead to a crash on some Tegra SoCs.
Fix this by moving all register programming into code that is guaranteed
to only be executed when the hardware is enabled.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodrm/tegra: Move drm_dp_link helpers to Tegra DRM
Thierry Reding [Mon, 21 Oct 2019 14:34:37 +0000 (16:34 +0200)]
drm/tegra: Move drm_dp_link helpers to Tegra DRM

During the discussion of patches that enhance the drm_dp_link helpers it
was concluded that these helpers aren't very useful to begin with. After
all other drivers have been converted not to use these helpers anymore,
move these helpers into the last remaining user: Tegra DRM.

If at some point these helpers are deemed more widely useful, they can
be moved out into the DRM DP helpers again.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20191021143437.1477719-14-thierry.reding@gmail.com
5 years agodrm/rockchip: Avoid drm_dp_link helpers
Thierry Reding [Mon, 21 Oct 2019 14:34:36 +0000 (16:34 +0200)]
drm/rockchip: Avoid drm_dp_link helpers

During the discussion of patches that enhance the drm_dp_link helpers it
was concluded that these helpers aren't very useful to begin with. Start
pushing the equivalent code into individual drivers to ultimately remove
them.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20191021143437.1477719-13-thierry.reding@gmail.com
5 years agodrm/msm: edp: Avoid drm_dp_link helpers
Thierry Reding [Mon, 21 Oct 2019 14:34:35 +0000 (16:34 +0200)]
drm/msm: edp: Avoid drm_dp_link helpers

During the discussion of patches that enhance the drm_dp_link helpers it
was concluded that these helpers aren't very useful to begin with. Start
pushing the equivalent code into individual drivers to ultimately remove
them.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20191021143437.1477719-12-thierry.reding@gmail.com
5 years agodrm/bridge: tc358767: Use DP nomenclature
Thierry Reding [Mon, 21 Oct 2019 14:34:34 +0000 (16:34 +0200)]
drm/bridge: tc358767: Use DP nomenclature

The DP specification uses the term "default framing" instead of "non-
enhanced framing".

Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191021143437.1477719-11-thierry.reding@gmail.com
5 years agodrm/bridge: tc358767: Avoid drm_dp_link helpers
Thierry Reding [Mon, 21 Oct 2019 14:34:33 +0000 (16:34 +0200)]
drm/bridge: tc358767: Avoid drm_dp_link helpers

During the discussion of patches that enhance the drm_dp_link helpers it
was concluded that these helpers aren't very useful to begin with. Start
pushing the equivalent code into individual drivers to ultimately remove
them.

v3: make link rate unsigned int to avoid overflow

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20191021143437.1477719-10-thierry.reding@gmail.com
5 years agodrm/bridge: analogix-anx78xx: Avoid drm_dp_link helpers
Thierry Reding [Tue, 22 Oct 2019 14:52:11 +0000 (16:52 +0200)]
drm/bridge: analogix-anx78xx: Avoid drm_dp_link helpers

During the discussion of patches that enhance the drm_dp_link helpers it
was concluded that these helpers aren't very useful to begin with. Start
pushing the equivalent code into individual drivers to ultimately remove
them.

v4: use bulk DPCD writes if possible (Daniel Vetter)

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20191022145211.2258525-1-thierry.reding@gmail.com
5 years agodrm/dp: Add helper to get post-cursor adjustments
Thierry Reding [Mon, 21 Oct 2019 14:34:31 +0000 (16:34 +0200)]
drm/dp: Add helper to get post-cursor adjustments

If the transmitter supports pre-emphasis post cursor2 the sink will
request adjustments in a similar way to how it requests adjustments to
the voltage swing and pre-emphasis settings.

Add a helper to extract these adjustments on a per-lane basis from the
DPCD link status.

Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191021143437.1477719-8-thierry.reding@gmail.com
5 years agodrm/dp: Do not busy-loop during link training
Thierry Reding [Mon, 21 Oct 2019 14:34:30 +0000 (16:34 +0200)]
drm/dp: Do not busy-loop during link training

Use microsecond sleeps for the clock recovery and channel equalization
delays during link training. The duration of these delays can be from
100 us up to 16 ms. It is rude to busy-loop for that amount of time.

While at it, also convert to standard coding style by putting the
opening braces in a function definition on a new line. Also switch to
using an unsigned int for the AUX read interval to match the data type
of the parameters to usleep_range().

v2: use correct multiplier for training delays (Philipp Zabel)
v3: clarify data type change in commit message

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20191021143437.1477719-7-thierry.reding@gmail.com
5 years agodrm/dp: Add drm_dp_alternate_scrambler_reset_cap() helper
Thierry Reding [Mon, 21 Oct 2019 14:34:29 +0000 (16:34 +0200)]
drm/dp: Add drm_dp_alternate_scrambler_reset_cap() helper

Add a helper to check if the sink supports the eDP alternate scrambler
reset value of 0xfffe.

Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191021143437.1477719-6-thierry.reding@gmail.com
5 years agodrm/dp: Add drm_dp_channel_coding_supported() helper
Thierry Reding [Mon, 21 Oct 2019 14:34:28 +0000 (16:34 +0200)]
drm/dp: Add drm_dp_channel_coding_supported() helper

Add a helper to check whether the sink supports ANSI 8B/10B channel
coding capability as specified in ANSI X3.230-1994, clause 11.

Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191021143437.1477719-5-thierry.reding@gmail.com
5 years agodrm/dp: Add drm_dp_fast_training_cap() helper
Thierry Reding [Mon, 21 Oct 2019 14:34:27 +0000 (16:34 +0200)]
drm/dp: Add drm_dp_fast_training_cap() helper

Add a helper that checks for the fast training capability given the DPCD
receiver capabilities blob.

Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191021143437.1477719-4-thierry.reding@gmail.com
5 years agodrm/dp: Remove a gratuituous blank line
Thierry Reding [Mon, 21 Oct 2019 14:34:26 +0000 (16:34 +0200)]
drm/dp: Remove a gratuituous blank line

It's idiomatic to check the return value of a function call immediately
after the function call, without any blank lines in between, to make it
more obvious that the two lines belong together.

Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191021143437.1477719-3-thierry.reding@gmail.com
5 years agodrm/dp: Sort includes alphabetically
Thierry Reding [Mon, 21 Oct 2019 14:34:25 +0000 (16:34 +0200)]
drm/dp: Sort includes alphabetically

Keeping the list sorted alphabetically makes it much easier to determine
where to add new includes.

Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191021143437.1477719-2-thierry.reding@gmail.com
5 years agoMerge drm/drm-next into drm-misc-next
Sean Paul [Wed, 23 Oct 2019 15:14:11 +0000 (11:14 -0400)]
Merge drm/drm-next into drm-misc-next

Parroting Daniel's backmerge justification from
2e79e22e092acd55da0b2db066e4826d7d152c41:

Thierry needs fd70c7755bf0 ("drm/bridge: tc358767: fix max_tu_symbol
value") to be able to merge his dp_link patch series.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
5 years agoRevert "drm/omap: add OMAP_BO flags to affect buffer allocation"
Sean Paul [Tue, 22 Oct 2019 20:47:29 +0000 (16:47 -0400)]
Revert "drm/omap: add OMAP_BO flags to affect buffer allocation"

This reverts commit 23b482252836ab3c5e6b3b20ed3038449cbc7679.

This patch does not have an acceptable open source userspace
implementation, and as such it does not meet the requirements for adding
new UAPI.

Discussion is in the Link.

Link: https://lists.freedesktop.org/archives/dri-devel/2019-October/240586.html
Fixes: 23b482252836 ("drm/omap: add OMAP_BO flags to affect buffer allocation")
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Jean-Jacques Hiblot <jjhiblot@ti.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Acked-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20191022204733.235801-1-sean@poorly.run
5 years agoMerge v5.4-rc4 into drm-next
Daniel Vetter [Wed, 23 Oct 2019 10:02:47 +0000 (12:02 +0200)]
Merge v5.4-rc4 into drm-next

Thierry needs fd70c7755bf0 ("drm/bridge: tc358767: fix max_tu_symbol
value") to be able to merge his dp_link patch series.

Some adjacent changes conflicts, plus some clashes in i915 due to
cherry-picking and git trying to be helpful and leaving both versions
in.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
5 years agodrm/todo: Add levels
Daniel Vetter [Tue, 22 Oct 2019 15:25:30 +0000 (17:25 +0200)]
drm/todo: Add levels

Should help new people pick suitable tasks.

Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Cc: Manasi Navare <manasi.d.navare@intel.com>
Cc: Sean Paul <sean@poorly.run>
Reviewed-by: Sean Paul <sean@poorly.run>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191022152530.22038-2-daniel.vetter@ffwll.ch
5 years agodrm/todo: Remove i915 device_link task
Daniel Vetter [Tue, 22 Oct 2019 15:25:29 +0000 (17:25 +0200)]
drm/todo: Remove i915 device_link task

Done with

commit aef9f33b7658a7489f71df5d6e6ecb47f2521e8a
Author: Imre Deak <imre.deak@intel.com>
Date:   Tue Oct 23 17:43:10 2018 +0300

    drm/i915: Ensure proper HDA suspend/resume ordering with a device link

Cc: Imre Deak <imre.deak@intel.com>
Reviewed-by: Sean Paul <sean@poorly.run>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20191022152530.22038-1-daniel.vetter@ffwll.ch
5 years agodrm/doc: Drop misleading comment on drm_mode_config_cleanup
Daniel Vetter [Tue, 22 Oct 2019 16:37:17 +0000 (18:37 +0200)]
drm/doc: Drop misleading comment on drm_mode_config_cleanup

This is not something we'll fix, because failing to clean up stuff (or
doing it in the wrong order) is a driver bug. The offending FIXME goes
all the way back to the original modeset merge.

We've added a WARN_ON in

commit 2b677e8c08eed11e4ebe66a7c334f03e389a19a3
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Mon Dec 10 21:16:05 2012 +0100

    drm: reference framebuffers which are on the idr

including a comment blaming drivers on this. Right thing to do is most
likely drm_atomic_helper_shutdown plus making sure that
drm_mode_config_cleanup is not called too early (i.e. not in driver
unload, but only in the final drm_device release callback).

Cc: Mihail Atanassov <Mihail.Atanassov@arm.com>
Reported-by: Mihail Atanassov <Mihail.Atanassov@arm.com>
Reviewed-by: Mihail Atanassov <mihail.atanassov@arm.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191022163717.1064-1-daniel.vetter@ffwll.ch
5 years agodrm/vc4: Use drm_hdmi_avi_infoframe_bars()
Ville Syrjälä [Tue, 8 Oct 2019 16:48:14 +0000 (19:48 +0300)]
drm/vc4: Use drm_hdmi_avi_infoframe_bars()

Use the new drm_hdmi_avi_infoframe_bars() helper instead
of hand rolling it.

Cc: Eric Anholt <eric@anholt.net>
Cc: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191008164814.5894-2-ville.syrjala@linux.intel.com
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
5 years agodrm/edid: Add drm_hdmi_avi_infoframe_bars()
Ville Syrjälä [Tue, 8 Oct 2019 16:48:13 +0000 (19:48 +0300)]
drm/edid: Add drm_hdmi_avi_infoframe_bars()

Add a function to fill the AVI infoframe bar information from
the standard tv margin properties.

Cc: Eric Anholt <eric@anholt.net>
Cc: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191008164814.5894-1-ville.syrjala@linux.intel.com
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
5 years agoMAINTAINERS: Add Mihail to Komeda DRM driver
Mihail Atanassov [Mon, 21 Oct 2019 15:01:56 +0000 (15:01 +0000)]
MAINTAINERS: Add Mihail to Komeda DRM driver

I'll be the main point of contact.

Cc: James Qian Wang (Arm Technology China) <james.qian.wang@arm.com>
Cc: Liviu Dudau <liviu.dudau@arm.com>
Acked-by: Sean Paul <sean@poorly.run>
Reviewed-by: James Qian Wang (Arm Technology China) <james.qian.wang@arm.com>
Signed-off-by: Mihail Atanassov <mihail.atanassov@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191021150123.19570-1-mihail.atanassov@arm.com
5 years agodrm/mipi_dbi: Use simple right shift instead of double negation
Andy Shevchenko [Thu, 17 Oct 2019 11:49:12 +0000 (14:49 +0300)]
drm/mipi_dbi: Use simple right shift instead of double negation

GCC complains about dubious bitwise OR operand:

drivers/gpu/drm/drm_mipi_dbi.c:1024:49: warning: dubious: x | !y
  CC [M]  drivers/gpu/drm/drm_mipi_dbi.o

As long as buffer is consist of byte (u8) values, we may use
simple right shift and satisfy compiler. It also reduces amount of
operations needed.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Noralf Trønnes <noralf@tronnes.org>
Tested-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20191017114912.61522-1-andriy.shevchenko@linux.intel.com
5 years agodrm/virtio: move byteorder handling into virtio_gpu_cmd_transfer_to_host_2d function
Gerd Hoffmann [Fri, 18 Oct 2019 12:23:52 +0000 (14:23 +0200)]
drm/virtio: move byteorder handling into virtio_gpu_cmd_transfer_to_host_2d function

Be consistent with the rest of the code base.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20191018122352.17019-1-kraxel@redhat.com
5 years agodrm/virtio: print a single line with device features
Gerd Hoffmann [Fri, 18 Oct 2019 11:38:32 +0000 (13:38 +0200)]
drm/virtio: print a single line with device features

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20191018113832.5460-1-kraxel@redhat.com
5 years agodrm/qxl: allocate small objects top-down
Gerd Hoffmann [Thu, 17 Oct 2019 13:26:38 +0000 (15:26 +0200)]
drm/qxl: allocate small objects top-down

qxl uses small buffer objects for qxl commands.
Allocate them top-down to reduce fragmentation.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20191017132638.9693-6-kraxel@redhat.com
5 years agodrm/qxl: use DEFINE_DRM_GEM_FOPS()
Gerd Hoffmann [Thu, 17 Oct 2019 13:26:37 +0000 (15:26 +0200)]
drm/qxl: use DEFINE_DRM_GEM_FOPS()

We have no qxl-specific fops any more.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20191017132638.9693-5-kraxel@redhat.com
5 years agodrm/qxl: drop verify_access
Gerd Hoffmann [Thu, 17 Oct 2019 13:26:36 +0000 (15:26 +0200)]
drm/qxl: drop verify_access

Not needed any more.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20191017132638.9693-4-kraxel@redhat.com
5 years agodrm/qxl: switch qxl to &drm_gem_object_funcs.mmap
Gerd Hoffmann [Thu, 17 Oct 2019 13:26:35 +0000 (15:26 +0200)]
drm/qxl: switch qxl to &drm_gem_object_funcs.mmap

Wire up the new drm_gem_ttm_mmap() helper function.
Use generic drm_gem_mmap() and remove qxl_mmap().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20191017132638.9693-3-kraxel@redhat.com