]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/log
mirror_ubuntu-bionic-kernel.git
6 years agodrm/atomic-helper: check that drivers call drm_crtc_vblank_off
Daniel Vetter [Tue, 17 Oct 2017 15:27:14 +0000 (17:27 +0200)]
drm/atomic-helper: check that drivers call drm_crtc_vblank_off

At least when they have vblank support they need to call this, or the
vblank core will happily call into their crtc->enable_vblank callback
even when the crtc is off. Which leads to a boom when the clocks are
off on most hardware (besides the inevitable confusion in the
book-keeping).

The consistency checks in drm_vblank.c will then make sure that
vblank_off/on calls are balanced, and if drivers forget to re-enable
it all the commits will stall, so I think we're covered.

It'd be nice to be able to place this check outside of commit helpers,
but tha's not really possible (due to nonblocking commits and all
that). Placing it into atomic helpers should at least cover most
drivers.

Also note that vblank support is still optional (for virtual drivers,
which tend to not have this), check for that.

v2: Fixup the handling for vblank_put (Rob).

Cc: Rob Clark <robdclark@gmail.com>
Tested-by: Rob Clark <robdclark@gmail.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171017152714.6849-1-daniel.vetter@ffwll.ch
6 years agodrm: some KMS todo ideas
Daniel Vetter [Tue, 17 Oct 2017 16:29:18 +0000 (18:29 +0200)]
drm: some KMS todo ideas

Inspired by discussions with Keith and Ville.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Keith Packard <keithp@keithp.com>
Acked-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171017162918.8380-1-daniel.vetter@ffwll.ch
6 years agovgaarb: Factor out EFI and fallback default device selection
Bjorn Helgaas [Fri, 13 Oct 2017 03:47:29 +0000 (22:47 -0500)]
vgaarb: Factor out EFI and fallback default device selection

The default VGA device is normally set in vga_arbiter_add_pci_device() when
we call it for the first enabled device that can be accessed with the
legacy VGA resources ([mem 0xa0000-0xbffff], etc.)

That default device can be overridden by an EFI device that owns the boot
framebuffer.  As a fallback, we can also select a VGA device that can't be
accessed via legacy VGA resources, or a VGA device that isn't even enabled.

Factor out this EFI and fallback selection from vga_arb_device_init() into
a separate vga_arb_select_default_device() function.  This doesn't change
any behavior, but it untangles the "bridge control possible" checking and
messages from the default device selection.

Tested-by: Zhou Wang <wangzhou1@hisilicon.com> # D05 Hisi Hip07, Hip08
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20171013034729.14630.30419.stgit@bhelgaas-glaptop.roam.corp.google.com
6 years agovgaarb: Select a default VGA device even if there's no legacy VGA
Bjorn Helgaas [Fri, 13 Oct 2017 03:47:22 +0000 (22:47 -0500)]
vgaarb: Select a default VGA device even if there's no legacy VGA

Daniel Axtens reported that on the HiSilicon D05 board, the VGA device is
behind a bridge that doesn't support PCI_BRIDGE_CTL_VGA, so the VGA arbiter
never selects it as the default, which means Xorg auto-detection doesn't
work.

VGA is a legacy PCI feature: a VGA device can respond to addresses, e.g.,
[mem 0xa0000-0xbffff], [io 0x3b0-0x3bb], [io 0x3c0-0x3df], etc., that are
not configurable by BARs.  Consequently, multiple VGA devices can conflict
with each other.  The VGA arbiter avoids conflicts by ensuring that those
legacy resources are only routed to one VGA device at a time.

The arbiter identifies the "default VGA" device, i.e., a legacy VGA device
that was used by boot firmware.  It selects the first device that:

  - is of PCI_CLASS_DISPLAY_VGA,
  - has both PCI_COMMAND_IO and PCI_COMMAND_MEMORY enabled, and
  - has PCI_BRIDGE_CTL_VGA set in all upstream bridges.

Some systems don't have such a device.  For example, if a host bridge
doesn't support I/O space, PCI_COMMAND_IO probably won't be enabled for any
devices below it.  Or, as on the HiSilicon D05, the VGA device may be
behind a bridge that doesn't support PCI_BRIDGE_CTL_VGA, so accesses to the
legacy VGA resources will never reach the device.

This patch extends the arbiter so that if it doesn't find a device that
meets all the above criteria, it selects the first device that:

  - is of PCI_CLASS_DISPLAY_VGA and
  - has PCI_COMMAND_IO or PCI_COMMAND_MEMORY enabled

If it doesn't find even that, it selects the first device that:

  - is of class PCI_CLASS_DISPLAY_VGA.

Such a device may not be able to use the legacy VGA resources, but most
drivers can operate the device without those.  Setting it as the default
device means its "boot_vga" sysfs file will contain "1", which Xorg (via
libpciaccess) uses to help select its default output device.

This fixes Xorg auto-detection on some arm64 systems (HiSilicon D05 in
particular; see the link below).

It also replaces the powerpc fixup_vga() quirk, albeit with slightly
different semantics: the quirk selected the first VGA device we found, and
overrode that selection with any enabled VGA device we found.  If there
were several enabled VGA devices, the *last* one we found would become the
default.

The code here instead selects the *first* enabled VGA device we find, and
if none are enabled, the first VGA device we find.

Link: http://lkml.kernel.org/r/20170901072744.2409-1-dja@axtens.net
Tested-by: Daniel Axtens <dja@axtens.net> # arm64, ppc64-qemu-tcg
Tested-by: Zhou Wang <wangzhou1@hisilicon.com> # D05 Hisi Hip07, Hip08
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20171013034721.14630.65913.stgit@bhelgaas-glaptop.roam.corp.google.com
6 years agodrm/bridge: adv7511: Fix a use after free
Dan Carpenter [Tue, 17 Oct 2017 20:43:43 +0000 (23:43 +0300)]
drm/bridge: adv7511: Fix a use after free

We free "edid", then use it again on the next line.

Fixes: 3b1b975003e4 ("drm: adv7511/33: add HDMI CEC support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20171017204343.zctliubjkq7imudi@mwanda
6 years agodrm/sun4i: Add support for A20 display pipeline components
Jonathan Liu [Tue, 17 Oct 2017 12:18:02 +0000 (20:18 +0800)]
drm/sun4i: Add support for A20 display pipeline components

The A20 display pipeline has 2 frontends, 2 backends, and 2 TCONs.
This patch adds support (or a compatible string in the frontend's
case) for these components.

The TCONs support directly outputting to CPU/RGB/LVDS LCD panels,
or it can output to HDMI via an on-chip HDMI controller, or
CVBS/YPbPr/VGA signals via on-chip TV encoders. These additional
encoders are not covered in this patch.

Signed-off-by: Jonathan Liu <net147@gmail.com>
[wens@csie.org: Expand commit message]
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171017121807.2994-6-wens@csie.org
6 years agodrm/sun4i: Add support for A10 display pipeline components
Chen-Yu Tsai [Tue, 17 Oct 2017 12:18:01 +0000 (20:18 +0800)]
drm/sun4i: Add support for A10 display pipeline components

The A10 display pipeline has 2 frontends, 2 backends, and 2 TCONs.
This patch adds support (or a compatible string in the frontend's
case) for these components.

The TCONs support directly outputting to CPU/RGB/LVDS LCD panels,
or it can output to HDMI via an on-chip HDMI controller, or
CVBS/YPbPr/VGA signals via on-chip TV encoders. These additional
encoders are not covered in this patch.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171017121807.2994-5-wens@csie.org
6 years agodrm/sun4i: hdmi: Support HDMI controller on A10
Chen-Yu Tsai [Tue, 17 Oct 2017 12:18:00 +0000 (20:18 +0800)]
drm/sun4i: hdmi: Support HDMI controller on A10

The HDMI controller in the A10 SoC is the same as the one currently
supported in the A10s. It has slightly different setup parameters.
Since these parameters are not thoroughly understood, we add support
for this variant by copying these parameters verbatim.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171017121807.2994-4-wens@csie.org
6 years agodrm/sun4i: tcon: Add support for A10 TCON
Jonathan Liu [Tue, 17 Oct 2017 12:17:59 +0000 (20:17 +0800)]
drm/sun4i: tcon: Add support for A10 TCON

The A10 has two TCONs that are similar to the ones found on other SoCs.
Like the A31, TCON0 has a register used to mux the TCON outputs to the
downstream encoders. The bit fields are slightly different.

Signed-off-by: Jonathan Liu <net147@gmail.com>
[wens@csie.org: Reworked for A10 and fixed up commit message]
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171017121807.2994-3-wens@csie.org
6 years agodrm/sun4i: backend: Support output muxing
Chen-Yu Tsai [Tue, 17 Oct 2017 12:17:58 +0000 (20:17 +0800)]
drm/sun4i: backend: Support output muxing

The backend has a mux to select the destination of the data to output
to. It can select the TCON or the frontends. On the A20, it includes
an option to output to the second TCON. This is not documented in the
user manual, but the vendor kernel uses it nevertheless, so the second
backend outputs to the second TCON.

Although the muxing can be changed on the fly, DRM needs to be able to
group a bunch of layers such that they get switched to another crtc
together. This is because the display backend does the layer compositing,
while the TCON generates the display timings. This constraint is not
supported by DRM.

Here we simply pair up backends and TCONs with the same ID.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171017121807.2994-2-wens@csie.org
6 years agodrm/sun4i: tcon: Move out the tcon0 common setup
Maxime Ripard [Tue, 17 Oct 2017 09:06:14 +0000 (11:06 +0200)]
drm/sun4i: tcon: Move out the tcon0 common setup

Some channel0 setup has to be done, no matter what the output interface is
(RGB, CPU, LVDS). Move that code into a common function in order to avoid
duplication.

Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/183100/
6 years agodrm/sun4i: tcon: Don't rely on encoders to set the TCON mode
Maxime Ripard [Tue, 17 Oct 2017 09:06:13 +0000 (11:06 +0200)]
drm/sun4i: tcon: Don't rely on encoders to set the TCON mode

Just like we did for the TCON enable and disable, for historical reasons we
used to rely on the encoders calling the TCON mode_set function, while the
CRTC has a callback for that.

Let's implement it in order to reduce the boilerplate code.

Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/faa3a4d511039af1d116270dfef3a8b60ca3591e.1508231063.git-series.maxime.ripard@free-electrons.com
6 years agodrm/sun4i: tcon: Don't rely on encoders to enable the TCON
Maxime Ripard [Tue, 17 Oct 2017 09:06:12 +0000 (11:06 +0200)]
drm/sun4i: tcon: Don't rely on encoders to enable the TCON

So far, we've required all the TCON-connected encoders to call the TCON
enable and disable functions.

This was made this way because in the RGB/LVDS case, the TCON is the CRTC
and the encoder. However, in all the other cases (HDMI, TV, DSI, etc.), we
have another encoder down the road that needs to be programmed.

We also needed to know which channel the encoder is connected to, which is
encoder-specific.

The CRTC's enable and disable callbacks can work just fine for our use
case, and we can get the channel to use just by looking at the type of
encoder, since that is fixed. Implement those callbacks, which will
remove some of the encoder boilerplate.

Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/90b4396e19b3eca61b2ebfdae0672074b88ad74d.1508231063.git-series.maxime.ripard@free-electrons.com
6 years agodrm/sun4i: tcon: Make tcon_get_clk_delay mode argument const
Maxime Ripard [Tue, 17 Oct 2017 09:06:11 +0000 (11:06 +0200)]
drm/sun4i: tcon: Make tcon_get_clk_delay mode argument const

The drm_display_mode pointer can be mark const, so let's do it.

Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/e6f92f126640aa6de639386f9b4677db3d8bb37b.1508231063.git-series.maxime.ripard@free-electrons.com
6 years agodrm/sun4i: tcon: Make tcon_set_mux mode argument const
Maxime Ripard [Tue, 17 Oct 2017 09:06:10 +0000 (11:06 +0200)]
drm/sun4i: tcon: Make tcon_set_mux mode argument const

The drm_display_mode pointer can be mark const, so let's do it.

Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/b0cce5a43fc3b56953d21a54fc3c14672f755f42.1508231063.git-series.maxime.ripard@free-electrons.com
6 years agodrm/sun4i: Realign Makefile padding and reorder it
Maxime Ripard [Tue, 17 Oct 2017 09:06:09 +0000 (11:06 +0200)]
drm/sun4i: Realign Makefile padding and reorder it

Some options were not padded as they should, and the order in the Makefile
was chaotic. Fix that.

Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/9410b284ec97453fa692537dffaaa4fb4833347c.1508231063.git-series.maxime.ripard@free-electrons.com
6 years agodrm/sun4i: Implement endpoint parsing using kfifo
Maxime Ripard [Tue, 17 Oct 2017 09:06:08 +0000 (11:06 +0200)]
drm/sun4i: Implement endpoint parsing using kfifo

The commit da82b8785eeb ("drm/sun4i: add components in breadth first
traversal order") implemented a breadth first traversal of our device tree
nodes graph. However, it was relying on the kernel linked lists, and those
are not really safe for addition.

Indeed, in a single pipeline stage, your first stage (ie, the mixer or
fronted) will be queued, and it will be the final iteration of that list as
far as list_for_each_entry_safe is concerned. Then, during that final
iteration, we'll queue another element (the TCON or the backend) that
list_for_each_entry_safe will not account for, and we will leave the loop
without having iterated over all the elements. And since we won't have
built our components list properly, the DRM driver will be left
non-functional.

We can instead use a kfifo to queue and enqueue components in-order, as was
the original intention. This also has the benefit of removing any dynamic
allocation, making the error handling path simpler too. The only thing
we're losing is the ability to tell whether an element has already been
queued, but that was only needed to remove spurious logs, and therefore
purely cosmetic.

This means that this commit effectively reverses e8afb7b67fba ("drm/sun4i:
don't add components that are already in the queue").

Fixes: da82b8785eeb ("drm/sun4i: add components in breadth first traversal order")
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/4ecb323e787918208f6a5d9f0ebba12c62583c98.1508231063.git-series.maxime.ripard@free-electrons.com
6 years agodrm/sun4i: backend: Offset layer buffer address by DRAM starting address
Chen-Yu Tsai [Tue, 17 Oct 2017 04:23:47 +0000 (12:23 +0800)]
drm/sun4i: backend: Offset layer buffer address by DRAM starting address

The display backend, as well as other peripherals that have a DRAM
clock gate and access DRAM directly, bypassing the system bus,
address the DRAM starting from 0x0, while physical addresses the
system uses starts from 0x40000000 (or 0x20000000 in A80's case).

This issue was witnessed on the Cubietruck, which has 2GB of RAM.

Devices with less RAM function normally due to the DRAM address
wrapping around. CMA seems to always allocate its buffer at a
very high address, close to the end of DRAM.

On a 1GB RAM device, the physical address would be something like
0x78000000. The DRAM address 0x78000000 would access the same DRAM
region as 0x38000000 on a system, as the DRAM address would only
span 0x0 ~ 0x3fffffff. The bit 0x40000000 is non-functional in this
case.

However on the Cubietruck, the DRAM is 2GB. The physical address
is 0x40000000 ~ 0xbfffffff. The buffer would be something like
0xb8000000. But the DRAM address span 0x0 ~ 0x7fffffff, meaning
the buffer address wraps around to 0x38000000, which is wrong.
The correct DRAM address for it should be 0x78000000.

Correct the address configured into the backend layer registers
by PHYS_OFFSET to account for this.

Fixes: 9026e0d122ac ("drm: Add Allwinner A10 Display Engine support")
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171017042349.31743-6-wens@csie.org
6 years agodrm/atomic: Check for busy planes/connectors before setting the commit
Maarten Lankhorst [Mon, 16 Oct 2017 13:29:28 +0000 (15:29 +0200)]
drm/atomic: Check for busy planes/connectors before setting the commit

We still want to fail with -EBUSY if a plane or connector is part of
a commit, even if it will be assigned to a new commit.

This closes a small hole left open where we should return -EBUSY.
It's not severe, because wait_for_dependencies and swap_state helpers
still block. But it should return -EBUSY and not stall.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Fixes: 21a01abbe32a ("drm/atomic: Fix freeing connector/plane state too early by tracking commits, v3.")
Link: https://patchwork.freedesktop.org/patch/msgid/20171016132928.6498-2-maarten.lankhorst@linux.intel.com
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
6 years agodrm/atomic: Make atomic helper track newly assigned planes correctly, v2.
Maarten Lankhorst [Tue, 17 Oct 2017 05:20:47 +0000 (07:20 +0200)]
drm/atomic: Make atomic helper track newly assigned planes correctly, v2.

Commit 669c9215afea ("drm/atomic: Make async plane update checks work as
intended, v2.") forced planes to always be tracked, but forgot to
explicitly get the crtc commit from the new crtc when available.

This broke plane commit tracking, and caused kms_atomic_transitions
to randomly fail with -EBUSY.

Changes since v1:
- Prefer new_crtc_state->crtc above old_crtc_state->crtc.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Fixes: 669c9215afea ("drm/atomic: Make async plane update checks work as intended, v2.")
Cc: Gustavo Padovan <gustavo.padovan@collabora.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102671
Testcase: kms_atomic_transitions
Link: https://patchwork.freedesktop.org/patch/msgid/20171017052047.8983-1-maarten.lankhorst@linux.intel.com
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
6 years agodrm/udl: Reading all edid blocks in DRM/UDL driver
Robert Tarasov [Fri, 13 Oct 2017 00:13:50 +0000 (17:13 -0700)]
drm/udl: Reading all edid blocks in DRM/UDL driver

Now DRM/UDL driver retreives all edid data blocks instead of only base one.
Previous approch could lead to improper initialization of video mode with
certain monitors.

Signed-off-by: Robert Tarasov <tutankhamen@chromium.org>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171013001350.172155-2-tutankhamen@chromium.org
6 years agodrm/udl: Fixed problem with UDL adpater reconnection
Robert Tarasov [Fri, 13 Oct 2017 00:13:49 +0000 (17:13 -0700)]
drm/udl: Fixed problem with UDL adpater reconnection

Fixed problem with DisplayLink and DisplayLink certified adapers in drm/udl
driver when adapter doesn't want to work if it was initialized with
disconnected DVI cable by enabling drm connectot polling and updating
current connector's state.

Signed-off-by: Robert Tarasov <tutankhamen@chromium.org>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171013001350.172155-1-tutankhamen@chromium.org
6 years agodrm/armada: Replace drm_framebuffer_reference/unreference() with _get/put()
Haneen Mohammed [Wed, 20 Sep 2017 18:57:16 +0000 (12:57 -0600)]
drm/armada: Replace drm_framebuffer_reference/unreference() with _get/put()

This patch replace instances of drm_framebuffer_reference/unreference with
*_get/put() suffixes, because get/put is shorter and consistent with the
kernel use of *_get/put suffixes.
This was done with the following Coccinelle script:

@r1@
expression e;
@@

(
-drm_framebuffer_reference(e);
+drm_framebuffer_get(e);
|
-drm_framebuffer_unreference(e);
+drm_framebuffer_put(e);
)

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/e1df1b3375faa819029559b11c32e10501c5c5d6.1505932812.git.hamohammed.sa@gmail.com
6 years agodrm/armada: Replace drm_gem_object_reference/unreference() with _get/put()
Haneen Mohammed [Wed, 20 Sep 2017 18:54:48 +0000 (12:54 -0600)]
drm/armada: Replace drm_gem_object_reference/unreference() with _get/put()

This patch replace instances of drm_gem_object_reference/unreference with
*_get/put() suffixes, because get/put is shorter and consistent with the
kernel use of *_get/put() suffixes.
This was done with the following Coccinelle script:

@r1@
expression e;
@@

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

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
[resolved small conflict with removed armada_gem_dumb_map_offset]
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/a59ef1ed109ade897bcffcb01b33214262db8942.1505932812.git.hamohammed.sa@gmail.com
6 years agodrm/gem-cma-helper: Change the level of the allocation failure message
Boris BREZILLON [Thu, 5 Oct 2017 11:29:17 +0000 (13:29 +0200)]
drm/gem-cma-helper: Change the level of the allocation failure message

drm_gem_cma_create() prints an error message when dma_alloc_wc() fails to
allocate the amount of memory we requested. This can lead to annoying
error messages when CMA is only one possible source of memory for the BO
allocation. Turn this error message into a debug one.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20171005112917.15949-1-boris.brezillon@free-electrons.com
6 years agodrm/via: use ARRAY_SIZE
Jérémy Lefaure [Mon, 16 Oct 2017 02:33:56 +0000 (22:33 -0400)]
drm/via: use ARRAY_SIZE

Using the ARRAY_SIZE macro improves the readability of the code.

Found with Coccinelle with the following semantic patch:
@r depends on (org || report)@
type T;
T[] E;
position p;
@@
(
 (sizeof(E)@p /sizeof(*E))
|
 (sizeof(E)@p /sizeof(E[...]))
|
 (sizeof(E)@p /sizeof(T))
)

Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Jérémy Lefaure <jeremy.lefaure@lse.epita.fr>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20171016023357.20174-1-jeremy.lefaure@lse.epita.fr
6 years agodrm/gma500: use ARRAY_SIZE
Jérémy Lefaure [Mon, 16 Oct 2017 02:30:46 +0000 (22:30 -0400)]
drm/gma500: use ARRAY_SIZE

Using the ARRAY_SIZE macro improves the readability of the code. Also,
it is useless to re-invent it.

Found with Coccinelle with the following semantic patch:
@r depends on (org || report)@
type T;
T[] E;
position p;
@@
(
 (sizeof(E)@p /sizeof(*E))
|
 (sizeof(E)@p /sizeof(E[...]))
|
 (sizeof(E)@p /sizeof(T))
)

Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Jérémy Lefaure <jeremy.lefaure@lse.epita.fr>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20171016023047.19145-1-jeremy.lefaure@lse.epita.fr
6 years agodrm/sun4i: hdmi: Move PAD_CTRL1 setting to mode_set function
Chen-Yu Tsai [Sat, 14 Oct 2017 04:02:52 +0000 (12:02 +0800)]
drm/sun4i: hdmi: Move PAD_CTRL1 setting to mode_set function

Initially we configured the PAD_CTRL1 register at probe/bind time.
However it seems the HDMI controller will modify some of the bits
in this register by itself. On the A10 it is particularly annoying
as it toggles the output invert bits, which inverts the colors on
the display output.

The U-boot driver this driver is based on sets this register twice,
though it seems it's only needed for actual display output. Hence
we move it to the mode_set function.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171014040252.9621-8-wens@csie.org
6 years agodrm/sun4i: hdmi: Document PAD_CTRL1 output invert bits
Chen-Yu Tsai [Sat, 14 Oct 2017 04:02:51 +0000 (12:02 +0800)]
drm/sun4i: hdmi: Document PAD_CTRL1 output invert bits

While debugging inverted color from the HDMI output on the A10, I
found that the lowest 3 bits were set. These were cleared on A20
boards that had normal display output. By manually toggling these
bits the mapping of the color components to these bits was found.

While these are not used anywhere, it would be nice to document
them somewhere.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171014040252.9621-7-wens@csie.org
6 years agodrm/sun4i: backend: Add comment explaining why registers are cleared
Chen-Yu Tsai [Sat, 14 Oct 2017 04:02:49 +0000 (12:02 +0800)]
drm/sun4i: backend: Add comment explaining why registers are cleared

Many of the backend's layer configuration registers have undefined
default values. This poses a risk as we use regmap_update_bits in
some places, and don't overwrite the whole register.

At probe/bind time we explicitly clear all the control registers
by writing 0 to them. This patch adds a more detailed explanation
on why we're doing this.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171014040252.9621-5-wens@csie.org
6 years agodrm/sun4i: backend: Use drm_fb_cma_get_gem_addr() to get display memory
Chen-Yu Tsai [Sat, 14 Oct 2017 04:02:48 +0000 (12:02 +0800)]
drm/sun4i: backend: Use drm_fb_cma_get_gem_addr() to get display memory

Commit 4636ce93d5b2 ("drm/fb-cma-helper: Add drm_fb_cma_get_gem_addr()")
adds a new helper, which covers fetching a drm_framebuffer's GEM object
and calculating the buffer address for a given plane.

This patch uses this helper to replace our own open coded version of the
same function.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171014040252.9621-4-wens@csie.org
6 years agodrm/sun4i: backend: Create regmap after access is possible
Chen-Yu Tsai [Sat, 14 Oct 2017 04:02:47 +0000 (12:02 +0800)]
drm/sun4i: backend: Create regmap after access is possible

The backend has various clocks and reset controls that need to be
enabled and deasserted before register access is possible.

Move the creation of the regmap to after the clocks and reset controls
have been configured where it makes more sense.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171014040252.9621-3-wens@csie.org
6 years agodrm/sun4i: don't add components that are already in the queue
Chen-Yu Tsai [Sat, 14 Oct 2017 04:02:46 +0000 (12:02 +0800)]
drm/sun4i: don't add components that are already in the queue

Even though the components framework can handle duplicate entries,
the extra entries cause a lot more debug messages to be generated,
which would be confusing to developers not familiar with our driver
and the framework in general.

Instead, we can scan the relatively small queue and check if the
component to be added is already queued up. Since the display
pipelines are symmetrical (not considering the third display
pipeline on the A80), and we add components level by level, when
we get to the second instance at the same level, any shared downstream
components would already be in the queue.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171014040252.9621-2-wens@csie.org
6 years agodrm/vc4: Fix pitch setup for T-format scanout.
Eric Anholt [Wed, 27 Sep 2017 19:32:09 +0000 (12:32 -0700)]
drm/vc4: Fix pitch setup for T-format scanout.

The documentation said to use src_w here, and I didn't consider that
we actually needed to be using pitch somewhere in our setup.  Fixes
scanout on my DSI panel when X11 does initial setup with 1920x1080
HDMI and 800x480 DSI both at 0,0 of the same framebuffer.

v2: Add some comments requested by Boris

Signed-off-by: Eric Anholt <eric@anholt.net>
Fixes: 98830d91da08 ("drm/vc4: Add T-format scanout support.")
Link: https://patchwork.freedesktop.org/patch/msgid/20170927193209.11870-1-eric@anholt.net
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agodrm/vc4: Move the DSI clock divider workaround closer to the clock call.
Eric Anholt [Tue, 15 Aug 2017 23:47:18 +0000 (16:47 -0700)]
drm/vc4: Move the DSI clock divider workaround closer to the clock call.

We want the adjusted_mode->clock to be the actual clock we're
expecting to program, so that consumers see the right values for clock
and vrefresh.

Signed-off-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20170815234722.20700-1-eric@anholt.net
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agodrm: Replace kzalloc with kcalloc
Harsha Sharma [Fri, 13 Oct 2017 07:37:47 +0000 (13:07 +0530)]
drm: Replace kzalloc with kcalloc

Prefer kcalloc over kzalloc to allocate an array.
This patch fixes checkcpatch issue.

Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20171013073747.29877-1-harshasharmaiitr@gmail.com
Link: https://patchwork.freedesktop.org/patch/msgid/20171013073747.29877-1-harshasharmaiitr@gmail.com
6 years agodrm/tinydrm: Remove explicit .best_encoder assignment
Haneen Mohammed [Tue, 10 Oct 2017 20:58:58 +0000 (14:58 -0600)]
drm/tinydrm: Remove explicit .best_encoder assignment

Since the driver is relying on the atomic helpers, remove the explicit
.best_encoder assignment and let the core call
drm_atomic_helper_best_encoder().

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20171010205858.GA4806@Haneen
6 years agodrm/tinydrm: Replace dev_error with DRM_DEV_ERROR
Harsha Sharma [Fri, 6 Oct 2017 22:17:38 +0000 (03:47 +0530)]
drm/tinydrm: Replace dev_error with DRM_DEV_ERROR

Convert instances of dev_error to DRM_DEV_ERROR as we have
DRM_DEV_ERROR variants of drm print macros.

Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20171006221738.30200-1-harshasharmaiitr@gmail.com
6 years agodrm/drm_of: Move drm_of_panel_bridge_remove_function into header.
Maarten Lankhorst [Fri, 13 Oct 2017 14:08:53 +0000 (16:08 +0200)]
drm/drm_of: Move drm_of_panel_bridge_remove_function into header.

Core drm shouldn't depend on anything in drm-kms-helper, or the drm
module will fail to load.

insmod drm fails with
[ 6087.674390] drm: Unknown symbol drm_panel_bridge_remove (err 0)

which is defined in drm_kms_helper.ko

This call was added by commit c70087e8f16f ("drm/drm_of: add
drm_of_panel_bridge_remove function"), and the fix is defining it in the
drm_of.h header, to break the circular dependency.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/8f95e623-9480-97dc-2414-77086d8aa49d@linux.intel.com
Reviewed-by: Daniel Vetter <daniel.vetter@intel.com> #irc
Fixes: c70087e8f16f ("drm/drm_of: add drm_of_panel_bridge_remove function")
Acked-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
6 years agodrm/atomic-helper: Fix reference to drm_crtc_send_vblank_event()
Thierry Reding [Thu, 12 Oct 2017 14:08:57 +0000 (16:08 +0200)]
drm/atomic-helper: Fix reference to drm_crtc_send_vblank_event()

Fix up this reference so that the proper link is generated in the
documentation and so that people don't go chasing after the wrong
function for an embarrassingly long time.

Acked-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171012140857.9559-1-thierry.reding@gmail.com
6 years agodrm/atomic-helper: Fix typo
Thierry Reding [Thu, 12 Oct 2017 14:06:16 +0000 (16:06 +0200)]
drm/atomic-helper: Fix typo

Fix "esay-to-use" to "easy-to-use" typo.

Acked-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171012140616.9002-1-thierry.reding@gmail.com
6 years agodrm: Add missing __user annotation to drm_syncobj_array_find()
Ville Syrjälä [Fri, 1 Sep 2017 16:53:26 +0000 (19:53 +0300)]
drm: Add missing __user annotation to drm_syncobj_array_find()

'user_handles' needs a __user annotation for fix the following sparse
warning:
drm_syncobj.c:813:37: warning: incorrect type in argument 2 (different address spaces)
drm_syncobj.c:813:37:    expected void const [noderef] <asn:1>*from
drm_syncobj.c:813:37:    got void *user_handles
drm_syncobj.c:875:38: warning: incorrect type in argument 2 (different address spaces)
drm_syncobj.c:875:38:    expected void *user_handles
drm_syncobj.c:875:38:    got void [noderef] <asn:1>*<noident>
drm_syncobj.c:908:38: warning: incorrect type in argument 2 (different address spaces)
drm_syncobj.c:908:38:    expected void *user_handles
drm_syncobj.c:908:38:    got void [noderef] <asn:1>*<noident>
drm_syncobj.c:941:38: warning: incorrect type in argument 2 (different address spaces)
drm_syncobj.c:941:38:    expected void *user_handles
drm_syncobj.c:941:38:    got void [noderef] <asn:1>*<noident>

Cc: Jason Ekstrand <jason@jlekstrand.net>
Fixes: 3e6fb72d6cef ("drm/syncobj: Add a syncobj_array_find helper")
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20170901165328.24459-2-ville.syrjala@linux.intel.com
Reviewed-by: Thierry Reding <treding@nvidia.com>
6 years agodrm/rockchip: add PINCTRL dependency for LVDS
Arnd Bergmann [Thu, 5 Oct 2017 12:09:39 +0000 (14:09 +0200)]
drm/rockchip: add PINCTRL dependency for LVDS

The new driver fails to build when CONFIG_PINCTRL is disabled:

drivers/gpu/drm/rockchip/rockchip_lvds.c: In function 'rockchip_lvds_grf_config':
drivers/gpu/drm/rockchip/rockchip_lvds.c:229:39: error: dereferencing pointer to incomplete type 'struct dev_pin_info'
   if (lvds->pins && !IS_ERR(lvds->pins->default_state))

This adds the respective Kconfig dependency.

Fixes: 34cc0aa25456 ("drm/rockchip: Add support for Rockchip Soc LVDS")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Mark Yao <mark.yao@rock-chips.com>
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171005120957.485433-1-arnd@arndb.de
6 years agodrm/kirin: Checking for IS_ERR() instead of NULL
Dan Carpenter [Thu, 5 Oct 2017 12:57:51 +0000 (15:57 +0300)]
drm/kirin: Checking for IS_ERR() instead of NULL

The of_graph_get_remote_node() function doesn't return error pointers,
it returns NULL on error so I've updated the check.

Fixes: 86418f90a4c1 ("drm: convert drivers to use of_graph_get_remote_node")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20171005125751.jvtjms62vbtxuvak@mwanda
6 years agodriver:gpu: return -ENOMEM on allocation failure.
Allen Pais [Wed, 13 Sep 2017 07:32:12 +0000 (13:02 +0530)]
driver:gpu: return -ENOMEM on allocation failure.

Signed-off-by: Allen Pais <allen.lkml@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/1505287939-14106-3-git-send-email-allen.lkml@gmail.com
6 years agodrm/vblank: Fix flip event vblank count
Ville Syrjälä [Tue, 10 Oct 2017 13:33:22 +0000 (16:33 +0300)]
drm/vblank: Fix flip event vblank count

On machines where the vblank interrupt fires some time after the start
of vblank (or we just manage to race with the vblank interrupt handler)
we will currently stuff a stale vblank counter value into the flip event,
and thus we'll prematurely complete the flip.

Switch over to drm_crtc_accurate_vblank_count() to make sure we have an
up to date counter value, crucially also remember to add the +1 so that
the delayed vblank interrupt won't complete the flip prematurely.

Cc: stable@vger.kernel.org
Cc: Daniel Vetter <daniel@ffwll.ch>
Suggested-by: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171010133322.24029-1-ville.syrjala@linux.intel.com
Reviewed-by: Daniel Vetter <daniel@ffwll.ch> #irc
6 years agodrm/dp: WARN about invalid/unknown link rates and bw codes
Jani Nikula [Mon, 9 Oct 2017 09:29:57 +0000 (12:29 +0300)]
drm/dp: WARN about invalid/unknown link rates and bw codes

Falling back to the lowest value is likely the only thing we can do, but
doing it silently seems like a bad thing to do. Catch it early and make
loud noises.

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Thierry Reding <treding@nvidia.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: Manasi Navare <manasi.d.navare@intel.com>
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Manasi Navare <manasi.d.navare@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171009092959.29021-1-jani.nikula@intel.com
6 years agoMerge tag 'regmap-poll-field' of git://git.kernel.org/pub/scm/linux/kernel/git/brooni...
Daniel Vetter [Wed, 11 Oct 2017 11:22:50 +0000 (13:22 +0200)]
Merge tag 'regmap-poll-field' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap into drm-misc-next

regmap: Add field polling macro

Requested by Maxime Ripard to make sun4i compile again (next time
the other way round is better).

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20171004104732.jkps4ufekfizcrkz@sirena.co.uk
6 years agodrm/msm/mdp5: remove less than 0 comparison for unsigned value
Aishwarya Pant [Tue, 10 Oct 2017 18:42:07 +0000 (00:12 +0530)]
drm/msm/mdp5: remove less than 0 comparison for unsigned value

pipe is an unsigned int and less than zero comparison for unsigned
values is always false.

Detected using the following cocci script:

@@
unsigned int i;
@@
* i < 0

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20171010184207.iv3dinrtwvbv7fei@aishwarya
6 years agodrm/bridge/sii8620: add remote control support
Maciej Purski [Thu, 24 Aug 2017 08:58:07 +0000 (10:58 +0200)]
drm/bridge/sii8620: add remote control support

MHL specification defines Remote Control Protocol(RCP) to
send input events between MHL devices.
The driver now recognizes RCP messages and reacts to them
by reporting key events to input subsystem, allowing
a user to control a device using TV remote control.

Signed-off-by: Maciej Purski <m.purski@samsung.com>
Acked-by: Sean Young <sean@mess.org>
Acked-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1503565087-19730-1-git-send-email-m.purski@samsung.com
6 years agodrm/sun4i: hdmi: Add support for A31's HDMI controller
Chen-Yu Tsai [Tue, 10 Oct 2017 03:20:06 +0000 (11:20 +0800)]
drm/sun4i: hdmi: Add support for A31's HDMI controller

The HDMI controller found in the A31 SoCs is slightly different
from the one already supported, which is found in the A10s:

  - Need different initial values for the PLL related registers

  - Different behavior of the DDC and TMDS clocks

  - Different register layout for the DDC portion

  - Separate DDC parent clock

This patch adds support for it.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171010032008.682-10-wens@csie.org
6 years agodrm/sun4i: hdmi: Add A31 specific DDC register definitions
Chen-Yu Tsai [Tue, 10 Oct 2017 03:20:05 +0000 (11:20 +0800)]
drm/sun4i: hdmi: Add A31 specific DDC register definitions

The DDC block for the HDMI controller is different on the A31.

This patch adds the register definitions.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171010032008.682-9-wens@csie.org
6 years agodrm/sun4i: hdmi: Add support for controller hardware variants
Chen-Yu Tsai [Tue, 10 Oct 2017 03:20:04 +0000 (11:20 +0800)]
drm/sun4i: hdmi: Add support for controller hardware variants

The HDMI controller found in earlier Allwinner SoCs have slight
differences between the A10, A10s, and the A31:

  - Need different initial values for the PLL related registers

  - Different behavior of the DDC and TMDS clocks

  - Different register layout for the DDC portion

  - Separate DDC parent clock on the A31

  - Explicit reset control

For the A31, the HDMI TMDS clock has a different value offset for
the divider. The HDMI DDC block is different from the one in the
other SoCs. As far as the DDC clock goes, it has no pre-divider,
as it is clocked from a slower parent clock, not the TMDS clock.
The divider offset from the register value is different. And the
clock control register is at a different offset.

A new variant data structure is created to store pointers to the
above functions, structures, and the different initial values.
Another flag notates whether there is a separate DDC parent clock.
If not, the TMDS clock is passed to the DDC clock create function,
as before.

Regmap fields are used to deal with the different register layout
of the DDC block.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171010032008.682-8-wens@csie.org
6 years agodt-bindings: display: sun4i: Add binding for A31 HDMI controller
Chen-Yu Tsai [Tue, 10 Oct 2017 03:20:03 +0000 (11:20 +0800)]
dt-bindings: display: sun4i: Add binding for A31 HDMI controller

The HDMI controller in the A31 SoC is slightly different from the
earlier version. In addition to the TMDS clock and DDC controls,
this version now takes a second DDC clock input.

Add a compatible string for it, and add the DDC clock input to the
list of clocks required.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171010032008.682-7-wens@csie.org
6 years agodrm/sun4i: hdmi: Allow using second PLL as TMDS clk parent
Chen-Yu Tsai [Tue, 10 Oct 2017 03:20:02 +0000 (11:20 +0800)]
drm/sun4i: hdmi: Allow using second PLL as TMDS clk parent

On SoCs with two display pipelines, it is possible that the two
pipelines are active at the same time, with potentially incompatible
dot clocks.

Let the HDMI encoder's TMDS clock go through all of its parents when
calculating possible clock rates. This allows usage of the second video
PLL as its parent.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171010032008.682-6-wens@csie.org
6 years agodrm/sun4i: hdmi: create a regmap for later use
Chen-Yu Tsai [Tue, 10 Oct 2017 03:20:01 +0000 (11:20 +0800)]
drm/sun4i: hdmi: create a regmap for later use

The HDMI driver is written with readl/writel I/O to the registers.
However, to support the A31 variant, which has a different layout
for the DDC registers, it was recommended to use regfields to have
a cleaner implementation. To use regfields, we need to create an
underlying regmap.

This patch only adds the regmap. It does not convert the existing
driver accesses to use regmap.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171010032008.682-5-wens@csie.org
6 years agodrm/sun4i: hdmi: Disable clks in bind function error path and unbind function
Chen-Yu Tsai [Tue, 10 Oct 2017 03:20:00 +0000 (11:20 +0800)]
drm/sun4i: hdmi: Disable clks in bind function error path and unbind function

The HDMI driver enables the bus and mod clocks in the bind function, but
does not disable them if it then bails our due to any errors. Neither
does it disable the clocks in the unbind function.

Fix this by adding a proper error path to the bind function, and
clk_disable_unprepare calls to the unbind function.

Also rename the err_cleanup_connector label to err_cleanup_encoder,
since it is the encoder that gets cleaned up.

Fixes: 9c5681011a0c ("drm/sun4i: Add HDMI support")
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171010032008.682-4-wens@csie.org
6 years agodrm/sun4i: tcon: Add support for demuxing TCON output on A31
Chen-Yu Tsai [Tue, 10 Oct 2017 03:19:59 +0000 (11:19 +0800)]
drm/sun4i: tcon: Add support for demuxing TCON output on A31

On systems with 2 TCONs such as the A31, it is possible to demux the
output of the TCONs to one encoder.

Add support for this for the A31.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171010032008.682-3-wens@csie.org
6 years agodrm/sun4i: tcon: Add variant callback for TCON output muxing
Chen-Yu Tsai [Tue, 10 Oct 2017 03:19:58 +0000 (11:19 +0800)]
drm/sun4i: tcon: Add variant callback for TCON output muxing

Different SoCs have different muxing options and values for the TCON
outputs. Instead of stuffing every possibility in sun4i_tcon_set_mux(),
add a callback pointer to sun4i_tcon_quirks that each TCON variant
can use to provide muxing support.

The current muxing options in sun4i_tcon_set_mux() for sun5i-a13 are
moved to a new sun5i-specific callback function.

Since the new callback replaces what the .has_unknown_mux field in
tcon quirks did in the past, the field is removed.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171010032008.682-2-wens@csie.org
6 years agodrm/bridge/synopsys: dsi :remove is_panel_bridge
benjamin.gaignard@linaro.org [Mon, 2 Oct 2017 09:34:48 +0000 (11:34 +0200)]
drm/bridge/synopsys: dsi :remove is_panel_bridge

When using drm_of_panel_bridge_remove() we can simplify the
code and remove is_panel_bridge from dw_mipi_dsi structure.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Reviewed-by: Philippe Cornu <philippe.cornu@st.com>
Tested-by: Philippe Cornu <philippe.cornu@st.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1506936888-23844-6-git-send-email-benjamin.gaignard@linaro.org
6 years agodrm/vc4: remove bridge from driver internal structure
benjamin.gaignard@linaro.org [Mon, 2 Oct 2017 09:34:47 +0000 (11:34 +0200)]
drm/vc4: remove bridge from driver internal structure

With a call to drm_of_panel_bridge_remove() we could remove
the bridge without store it in vc4_dpi internal driver structure.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/1506936888-23844-5-git-send-email-benjamin.gaignard@linaro.org
6 years agodrm/stm: ltdc: remove bridge from driver internal structure
benjamin.gaignard@linaro.org [Mon, 2 Oct 2017 09:34:46 +0000 (11:34 +0200)]
drm/stm: ltdc: remove bridge from driver internal structure

With a call to drm_of_panel_bridge_remove() we could remove the bridge
without store it in ldtc internal driver structure.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Reviewed-by: Philippe Cornu <philippe.cornu@st.com>
Tested-by: Philippe Cornu <philippe.cornu@st.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1506936888-23844-4-git-send-email-benjamin.gaignard@linaro.org
6 years agodrm/drm_of: add drm_of_panel_bridge_remove function
benjamin.gaignard@linaro.org [Mon, 2 Oct 2017 09:34:45 +0000 (11:34 +0200)]
drm/drm_of: add drm_of_panel_bridge_remove function

This function is the pendant of drm_of_find_panel_or_bridge()
to remove a previously allocated panel_bridge.
Given a specific port and endpoint it remove the panel bridge.
Since drm_panel_bridge_remove() will check that bridge parameter
is not NULL and is a real drm_panel_bridge and no a simple bridge
it is safe to call it directly.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Reviewed-by: Philippe Cornu <philippe.cornu@st.com>
Tested-by: Philippe Cornu <philippe.cornu@st.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1506936888-23844-3-git-send-email-benjamin.gaignard@linaro.org
6 years agodrm/bridge: make drm_panel_bridge_remove more robust
benjamin.gaignard@linaro.org [Mon, 2 Oct 2017 09:32:31 +0000 (11:32 +0200)]
drm/bridge: make drm_panel_bridge_remove more robust

Make sure that bridge parameter is not NULL and can be safely
cast into a panel_bridge structure.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Reviewed-by: Philippe Cornu <philippe.cornu@st.com>
Tested-by: Philippe Cornu <philippe.cornu@st.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1506936755-23625-2-git-send-email-benjamin.gaignard@linaro.org
6 years agodma-fence: fix dma_fence_get_rcu_safe v2
Christian König [Fri, 15 Sep 2017 09:53:07 +0000 (11:53 +0200)]
dma-fence: fix dma_fence_get_rcu_safe v2

When dma_fence_get_rcu() fails to acquire a reference it doesn't necessary
mean that there is no fence at all.

It usually mean that the fence was replaced by a new one and in this situation
we certainly want to have the new one as result and *NOT* NULL.

v2: Keep extra check after dma_fence_get_rcu().

Signed-off-by: Christian König <christian.koenig@amd.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: linux-media@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: linaro-mm-sig@lists.linaro.org
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1505469187-3565-1-git-send-email-deathsimple@vodafone.de
6 years agodma-buf: make reservation_object_copy_fences rcu save
Christian König [Mon, 4 Sep 2017 19:02:45 +0000 (21:02 +0200)]
dma-buf: make reservation_object_copy_fences rcu save

Stop requiring that the src reservation object is locked for this operation.

Acked-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1504551766-5093-1-git-send-email-deathsimple@vodafone.de
6 years agodrm/atomic: Unref duplicated drm_atomic_state in drm_atomic_helper_resume()
Jeffy Chen [Mon, 9 Oct 2017 06:46:41 +0000 (14:46 +0800)]
drm/atomic: Unref duplicated drm_atomic_state in drm_atomic_helper_resume()

Kmemleak reported memory leak after suspend and resume:
unreferenced object 0xffffffc0e31d8880 (size 128):
  comm "bash", pid 181, jiffies 4294763583 (age 24.694s)
  hex dump (first 32 bytes):
    01 00 00 00 00 00 00 00 00 20 a2 eb c0 ff ff ff  ......... ......
    01 00 00 00 00 00 00 00 80 87 1d e3 c0 ff ff ff  ................
  backtrace:
    [<ffffffc00034bb64>] __save_stack_trace+0x48/0x6c
    [<ffffffc00034c244>] create_object+0x138/0x254
    [<ffffffc0009dd218>] kmemleak_alloc+0x58/0x8c
    [<ffffffc000346de4>] kmem_cache_alloc_trace+0x188/0x254
    [<ffffffc0005af4c0>] drm_atomic_state_alloc+0x3c/0x88
    [<ffffffc000591f0c>] drm_atomic_helper_duplicate_state+0x28/0x158
    [<ffffffc000592098>] drm_atomic_helper_suspend+0x5c/0xf0

Problem here is that we are duplicating the drm_atomic_state in
drm_atomic_helper_suspend(), but not unreference it in the resume path.

Fixes: 1494276000db ("drm/atomic-helper: Implement subsystem-level suspend/resume")
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171009064641.15174-1-jeffy.chen@rock-chips.com
Fixes: 0853695c3ba4 ("drm: Add reference counting to drm_atomic_state")
Cc: <stable@vger.kernel.org> # v4.10+
6 years agodrm: adv7511/33: add HDMI CEC support
Hans Verkuil [Sat, 7 Oct 2017 10:46:58 +0000 (12:46 +0200)]
drm: adv7511/33: add HDMI CEC support

Add support for HDMI CEC to the drm adv7511/adv7533 drivers.

The CEC registers that we need to use are identical for both drivers,
but they appear at different offsets in the register map.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20171007104658.14528-3-hverkuil@xs4all.nl
6 years agodt-bindings: adi,adv7511.txt: document cec clock
Hans Verkuil [Sat, 7 Oct 2017 10:46:57 +0000 (12:46 +0200)]
dt-bindings: adi,adv7511.txt: document cec clock

Document the cec clock binding.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20171007104658.14528-2-hverkuil@xs4all.nl
6 years agodrm/gem-fb-helper: Improve documentation
Noralf Trønnes [Fri, 22 Sep 2017 15:47:44 +0000 (17:47 +0200)]
drm/gem-fb-helper: Improve documentation

Make the docs read a little better.

Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/1506095264-41622-1-git-send-email-noralf@tronnes.org
6 years agodrm/panel: Add support for the Raspberry Pi 7" Touchscreen.
Eric Anholt [Wed, 27 Sep 2017 19:36:54 +0000 (12:36 -0700)]
drm/panel: Add support for the Raspberry Pi 7" Touchscreen.

This driver communicates with the Atmel microcontroller for sequencing
the poweron of the TC358762 DSI-DPI bridge and controlling the
backlight PWM.

v2: Set the same default orientation as the closed source firmware
    used, which is the best for viewing angle.
v3: Rewrite as an i2c client driver after bridge driver rejection.
v4: Finish probe without the DSI host, using the new delayed
    registration, and attach to the host during mipi_dsi_driver probe.
v5: Rework to drop the "probe without DSI host" mode again, now that
    vc4 will create the host early on.
v6: Drop unused brightness #define (noticed by Thierry)

Signed-off-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20170927193654.12609-4-eric@anholt.net
Reviewed-by: Archit Taneja <architt@codeaurora.org>
Acked-by: Thierry Reding <treding@nvidia.com>
6 years agodt-bindings: Document the Raspberry Pi Touchscreen nodes.
Eric Anholt [Wed, 27 Sep 2017 19:36:53 +0000 (12:36 -0700)]
dt-bindings: Document the Raspberry Pi Touchscreen nodes.

This doesn't yet cover input, but the driver does get the display
working when the firmware is disabled from talking to our I2C lines.

Signed-off-by: Eric Anholt <eric@anholt.net>
Acked-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20170927193654.12609-3-eric@anholt.net
6 years agodrm/bridge: add Silicon Image SiI9234 driver
Maciej Purski [Thu, 5 Oct 2017 14:07:10 +0000 (16:07 +0200)]
drm/bridge: add Silicon Image SiI9234 driver

SiI9234 transmitter converts eTMDS/HDMI signal to MHL 1.0.
It is controlled via I2C bus. Its interaction with other
devices in video pipeline is performed mainly on HW level.
The only interaction it does on device driver level is
filtering-out unsupported video modes, it exposes drm_bridge
interface to perform this operation.

This patch is based on the code refactored by Tomasz Stanislawski
<t.stanislaws@samsung.com>, which was initially developed by:
Adam Hampson <ahampson@sta.samsung.com>
Erik Gilling <konkers@android.com>
Shankar Bandal <shankar.b@samsung.com>
Dharam Kumar <dharam.kr@samsung.com>

Signed-off-by: Maciej Purski <m.purski@samsung.com>
Acked-by: Rob Herring <robh@kernel.org> [for dt bindings]
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1507212431-5801-2-git-send-email-m.purski@samsung.com
6 years agodrm/atomic: Make atomic iterators less surprising
Maarten Lankhorst [Wed, 27 Sep 2017 08:35:32 +0000 (10:35 +0200)]
drm/atomic: Make atomic iterators less surprising

Commit 669c9215afea ("drm/atomic: Make async plane update checks work as
intended, v2.") assumed incorrectly that if only 1 plane is matched in
the loop, the variables will be set to that plane. In reality we reset
them to NULL every time a new plane was iterated. This behavior is
surprising, so fix this by making the for loops only assign the
variables on a match.

When we have not added all the planes/crtc/connector to the state, and
there's a few NULL ones after the last one we iterated, te assumption
is broken that the pointers will hold the values from the last loop
iteration, which holds true for all other for_each macros we're using.
Except of course the iterator pointer itself, but that one really is
entirely internal.

Cc: Dmitry Osipenko <digetx@gmail.com>
Fixes: 669c9215afea ("drm/atomic: Make async plane update checks work as intended, v2.")
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20170927083532.5756-2-maarten.lankhorst@linux.intel.com
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Tested-by: Dmitry Osipenko <digetx@gmail.com>
6 years agodrm/atomic: Remove unneeded null check for private objects
Maarten Lankhorst [Wed, 27 Sep 2017 08:35:31 +0000 (10:35 +0200)]
drm/atomic: Remove unneeded null check for private objects

It can be seen in drm_atomic_get_private_obj_state() that
ptr will never be NULL, so skip the check for that case.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20170927083532.5756-1-maarten.lankhorst@linux.intel.com
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
6 years agoMerge tag 'drm-misc-next-2017-10-05' of git://anongit.freedesktop.org/git/drm-misc...
Dave Airlie [Fri, 6 Oct 2017 01:10:25 +0000 (11:10 +1000)]
Merge tag 'drm-misc-next-2017-10-05' of git://anongit.freedesktop.org/git/drm-misc into drm-next

More drm-misc for 4.15:

Cross-subsystem Changes:
- bunch more simple outreachy patches (Meghana Madhyastha, Aishwarya
  Pant, Haneen Mohammed)
- Quite a pile of static checker/cocci/spelling fixups all over.
- Final driver patches+core cleanup of Noralf's new drm_gem_fb_create
  helper.

Core Changes:
- legacy DPMS docs improved
- add dri-devel m-l to fbdev to catch people who try to fix
  fbcon-on-kms bugs in the wrong place

Driver Changes:
- vc4: prep for dsi panels (Eric)

* tag 'drm-misc-next-2017-10-05' of git://anongit.freedesktop.org/git/drm-misc: (34 commits)
  drm: fix typo in drm_gem_get_pages() comment
  MAINTAINERS: Add dri-devel as a mailing list for anything fbdev
  drm/virtio: Replace instances of reference/unreference with get/put
  drm/fb-cma-helper: Remove unused functions
  drm/tve200: Use drm_gem_fb_create() and drm_gem_fb_prepare_fb()
  drm/sun4i: Use drm_gem_fb_create()
  drm/shmobile: Use drm_gem_fb_create()
  drm/rcar-du: Use drm_gem_fb_create()
  drm/mxsfb: Use drm_gem_fb_create() and drm_gem_fb_prepare_fb()
  drm/meson: Use drm_gem_fb_create()
  drm/hisilicon/kirin: Use drm_gem_fb_create()
  drm/fsl-dcu: Use drm_gem_fb_create()
  drm/tinydrm: Use drm_gem_framebuffer_helper
  drm: of: always initialize panel in drm_of_find_panel_or_bridge()
  drm/tve200: Check for IS_ERR instead of NULL in probe
  drm/tve200: make two functions static
  drm/armada: Remove unused #include <drmP.h>
  drm/rockchip: Rely on the default best_encoder() behavior
  drm/vc4: Set up the DSI host at pdev probe time, not component bind.
  drm/vc4: Avoid using vrefresh==0 mode in DSI htotal math.
  ...

6 years agodrm: fix typo in drm_gem_get_pages() comment
Jordan Crouse [Tue, 3 Oct 2017 15:38:10 +0000 (09:38 -0600)]
drm: fix typo in drm_gem_get_pages() comment

I spent an embarrassingly long time looking for drm_gem_init_object()
before I realized I was actually looking for drm_gem_object_init().
Fix the typo to keep other poor developers from suffering the same
fate.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/1507045091-6550-1-git-send-email-jcrouse@codeaurora.org
6 years agoregmap: add iopoll-like polling macro for regmap_field
Chen-Yu Tsai [Fri, 29 Sep 2017 08:23:01 +0000 (16:23 +0800)]
regmap: add iopoll-like polling macro for regmap_field

This patch adds a macro regmap_field_read_poll_timeout that works
similar to the readx_poll_timeout defined in linux/iopoll.h, except
that this can also return the error value returned by a failed
regmap_field_read.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoMAINTAINERS: Add dri-devel as a mailing list for anything fbdev
Daniel Vetter [Fri, 8 Sep 2017 15:35:28 +0000 (17:35 +0200)]
MAINTAINERS: Add dri-devel as a mailing list for anything fbdev

fbdev is in maintenance only, except that it's still used by drm
through the drm fbdev emulation, to be able to use fbcon. And people
might want to sometimes extend fbcon to enable new features for drm
drivers, e.g. Hans' panel orientation work.

The problem is that when those patches only touch fbdev code they'll
never show up on drm developer's radar, which means we end up with
designs that don't really fit whell into the full stack. That happened
a bit with the panel orientation work, where an fbcon patch made it
into 4.14, implementing a design that won't really work on the drm
side. Which means we now have to redo things, and on top coordinate 2
subsystem trees.

Since fbdev is super low-volume we can prevent this in the future by
simply adding the dri-devel mailing list to the fbdev subsystem.

Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: linux-fbdev@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: Sean Paul <seanpaul@chromium.org>
Cc: David Airlie <airlied@linux.ie>
Acked-by: Sean Paul <seanpaul@chromium.org>
Acked-by: Dave Airlie <airlied@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20170908153528.17528-1-daniel.vetter@ffwll.ch
6 years agoMerge airlied/drm-next into drm-misc-next
Daniel Vetter [Tue, 3 Oct 2017 09:09:16 +0000 (11:09 +0200)]
Merge airlied/drm-next into drm-misc-next

Just catching up with upstream.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
6 years agoBackMerge tag 'v4.14-rc3' into drm-next
Dave Airlie [Mon, 2 Oct 2017 23:35:04 +0000 (09:35 +1000)]
BackMerge tag 'v4.14-rc3' into drm-next

Linux 4.14-rc3

Requested by Daniel for the tracing build fix in fixes.

6 years agodrm/virtio: Replace instances of reference/unreference with get/put
Srishti Sharma [Fri, 29 Sep 2017 10:03:39 +0000 (15:33 +0530)]
drm/virtio: Replace instances of reference/unreference with get/put

Replace reference/unreference with get/put as it is consistent
with the kernel coding style. Done using the following semantic
patch by coccinelle.

@r@
expression e;
@@

-drm_gem_object_unreference_unlocked(e);
+drm_gem_object_put_unlocked(e);

Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/1506679419-7130-1-git-send-email-srishtishar@gmail.com
6 years agoLinux 4.14-rc3
Linus Torvalds [Sun, 1 Oct 2017 21:54:54 +0000 (14:54 -0700)]
Linux 4.14-rc3

6 years agoMerge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 1 Oct 2017 20:55:32 +0000 (13:55 -0700)]
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Thomas Gleixner:
 "This contains the following fixes and improvements:

   - Avoid dereferencing an unprotected VMA pointer in the fault signal
     generation code

   - Fix inline asm call constraints for GCC 4.4

   - Use existing register variable to retrieve the stack pointer
     instead of forcing the compiler to create another indirect access
     which results in excessive extra 'mov %rsp, %<dst>' instructions

   - Disable branch profiling for the memory encryption code to prevent
     an early boot crash

   - Fix a sparse warning caused by casting the __user annotation in
     __get_user_asm_u64() away

   - Fix an off by one error in the loop termination of the error patch
     in the x86 sysfs init code

   - Add missing CPU IDs to various Intel specific drivers to enable the
     functionality on recent hardware

   - More (init) constification in the numachip code"

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/asm: Use register variable to get stack pointer value
  x86/mm: Disable branch profiling in mem_encrypt.c
  x86/asm: Fix inline asm call constraints for GCC 4.4
  perf/x86/intel/uncore: Correct num_boxes for IIO and IRP
  perf/x86/intel/rapl: Add missing CPU IDs
  perf/x86/msr: Add missing CPU IDs
  perf/x86/intel/cstate: Add missing CPU IDs
  x86: Don't cast away the __user in __get_user_asm_u64()
  x86/sysfs: Fix off-by-one error in loop termination
  x86/mm: Fix fault error path using unsafe vma pointer
  x86/numachip: Add const and __initconst to numachip2_clockevent

6 years agoMerge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 1 Oct 2017 20:03:16 +0000 (13:03 -0700)]
Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull timer fixes from Thomas Gleixner:
 "This adds a new timer wheel function which is required for the
  conversion of the timer callback function from the 'unsigned long
  data' argument to 'struct timer_list *timer'. This conversion has two
  benefits:

   1) It makes struct timer_list smaller

   2) Many callers hand in a pointer to the timer or to the structure
      containing the timer, which happens via type casting both at setup
      and in the callback. This change gets rid of the typecasts.

  Once the conversion is complete, which is planned for 4.15, the old
  setup function and the intermediate typecast in the new setup function
  go away along with the data field in struct timer_list.

  Merging this now into mainline allows a smooth queueing of the actual
  conversion in the affected maintainer trees without creating
  dependencies"

* 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  um/time: Fixup namespace collision
  timer: Prepare to change timer callback argument type

6 years agoMerge branch 'smp-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 1 Oct 2017 19:34:42 +0000 (12:34 -0700)]
Merge branch 'smp-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull smp/hotplug fixes from Thomas Gleixner:
 "This addresses the fallout of the new lockdep mechanism which covers
  completions in the CPU hotplug code.

  The lockdep splats are false positives, but there is no way to
  annotate that reliably. The solution is to split the completions for
  CPU up and down, which requires some reshuffling of the failure
  rollback handling as well"

* 'smp-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  smp/hotplug: Hotplug state fail injection
  smp/hotplug: Differentiate the AP completion between up and down
  smp/hotplug: Differentiate the AP-work lockdep class between up and down
  smp/hotplug: Callback vs state-machine consistency
  smp/hotplug: Rewrite AP state machine core
  smp/hotplug: Allow external multi-instance rollback
  smp/hotplug: Add state diagram

6 years agoMerge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 1 Oct 2017 19:10:02 +0000 (12:10 -0700)]
Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull scheduler fixes from Thomas Gleixner:
 "The scheduler pull request comes with the following updates:

   - Prevent a divide by zero issue by validating the input value of
     sysctl_sched_time_avg

   - Make task state printing consistent all over the place and have
     explicit state characters for IDLE and PARKED so they wont be
     displayed as 'D' state which confuses tools"

* 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  sched/sysctl: Check user input value of sysctl_sched_time_avg
  sched/debug: Add explicit TASK_PARKED printing
  sched/debug: Ignore TASK_IDLE for SysRq-W
  sched/debug: Add explicit TASK_IDLE printing
  sched/tracing: Use common task-state helpers
  sched/tracing: Fix trace_sched_switch task-state printing
  sched/debug: Remove unused variable
  sched/debug: Convert TASK_state to hex
  sched/debug: Implement consistent task-state printing

6 years agoMerge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 1 Oct 2017 19:06:31 +0000 (12:06 -0700)]
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull perf fixes from Thomas Gleixner:

 - Prevent a division by zero in the perf aux buffer handling

 - Sync kernel headers with perf tool headers

 - Fix a build failure in the syscalltbl code

 - Make the debug messages of perf report --call-graph work correctly

 - Make sure that all required perf files are in the MANIFEST for
   container builds

 - Fix the atrr.exclude kernel handling so it respects the
   perf_event_paranoid and the user permissions

 - Make perf test on s390x work correctly

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf/aux: Only update ->aux_wakeup in non-overwrite mode
  perf test: Fix vmlinux failure on s390x part 2
  perf test: Fix vmlinux failure on s390x
  perf tools: Fix syscalltbl build failure
  perf report: Fix debug messages with --call-graph option
  perf evsel: Fix attr.exclude_kernel setting for default cycles:p
  tools include: Sync kernel ABI headers with tooling headers
  perf tools: Get all of tools/{arch,include}/ in the MANIFEST

6 years agoMerge branch 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 1 Oct 2017 19:02:47 +0000 (12:02 -0700)]
Merge branch 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull  locking fixes from Thomas Gleixner:
 "Two fixes for locking:

   - Plug a hole the pi_stat->owner serialization which was changed
     recently and failed to fixup two usage sites.

   - Prevent reordering of the rwsem_has_spinner() check vs the
     decrement of rwsem count in up_write() which causes a missed
     wakeup"

* 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  locking/rwsem-xadd: Fix missed wakeup due to reordering of load
  futex: Fix pi_state->owner serialization

6 years agoMerge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 1 Oct 2017 19:00:56 +0000 (12:00 -0700)]
Merge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull irq fixes from Thomas Gleixner:

 - Add a missing NULL pointer check in free_irq()

 - Fix a memory leak/memory corruption in the generic irq chip

 - Add missing rcu annotations for radix tree access

 - Use ffs instead of fls when extracting data from a chip register in
   the MIPS GIC irq driver

 - Fix the unmasking of IPI interrupts in the MIPS GIC driver so they
   end up at the target CPU and not at CPU0

* 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  irq/generic-chip: Don't replace domain's name
  irqdomain: Add __rcu annotations to radix tree accessors
  irqchip/mips-gic: Use effective affinity to unmask
  irqchip/mips-gic: Fix shifts to extract register fields
  genirq: Check __free_irq() return value for NULL

6 years agoMerge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 1 Oct 2017 18:12:29 +0000 (11:12 -0700)]
Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull objtool fixes from Thomas Gleixner:
 "Two small fixes for objtool:

   - Support frame pointer setup via 'lea (%rsp), %rbp' which was not
     yet supported and caused build warnings

   - Disable unreacahble warnings for GCC4.4 and older to avoid false
     positives caused by the compiler itself"

* 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  objtool: Support unoptimized frame pointer setup
  objtool: Skip unreachable warnings for GCC 4.4 and older

6 years agodrm/fb-cma-helper: Remove unused functions
Noralf Trønnes [Sun, 24 Sep 2017 12:26:25 +0000 (14:26 +0200)]
drm/fb-cma-helper: Remove unused functions

The cma drivers use the drm_gem_framebuffer_helper functions now,
so remove drm_fb_cma_destroy, drm_fb_cma_create_handle,
drm_fb_cma_create_with_funcs, drm_fb_cma_create and
drm_fb_cma_prepare_fb.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1506255985-61113-11-git-send-email-noralf@tronnes.org
6 years agodrm/tve200: Use drm_gem_fb_create() and drm_gem_fb_prepare_fb()
Noralf Trønnes [Sun, 24 Sep 2017 12:26:24 +0000 (14:26 +0200)]
drm/tve200: Use drm_gem_fb_create() and drm_gem_fb_prepare_fb()

drm_fb_cma_create() and drm_fb_cma_prepare_fb() are just wrappers now,
use drm_gem_fb_create() and drm_gem_fb_prepare_fb() directly.

Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/1506255985-61113-10-git-send-email-noralf@tronnes.org
6 years agodrm/sun4i: Use drm_gem_fb_create()
Noralf Trønnes [Sun, 24 Sep 2017 12:26:23 +0000 (14:26 +0200)]
drm/sun4i: Use drm_gem_fb_create()

drm_fb_cma_create() is just a wrapper around drm_gem_fb_create() now,
so use the function directly.

Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/1506255985-61113-9-git-send-email-noralf@tronnes.org
6 years agodrm/shmobile: Use drm_gem_fb_create()
Noralf Trønnes [Sun, 24 Sep 2017 12:26:22 +0000 (14:26 +0200)]
drm/shmobile: Use drm_gem_fb_create()

drm_fb_cma_create() is just a wrapper around drm_gem_fb_create() now,
so use the function directly.

Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/1506255985-61113-8-git-send-email-noralf@tronnes.org
6 years agodrm/rcar-du: Use drm_gem_fb_create()
Noralf Trønnes [Sun, 24 Sep 2017 12:26:21 +0000 (14:26 +0200)]
drm/rcar-du: Use drm_gem_fb_create()

drm_fb_cma_create() is just a wrapper around drm_gem_fb_create() now,
so use the function directly.

Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/1506255985-61113-7-git-send-email-noralf@tronnes.org
6 years agodrm/mxsfb: Use drm_gem_fb_create() and drm_gem_fb_prepare_fb()
Noralf Trønnes [Sun, 24 Sep 2017 12:26:20 +0000 (14:26 +0200)]
drm/mxsfb: Use drm_gem_fb_create() and drm_gem_fb_prepare_fb()

drm_fb_cma_create() and drm_fb_cma_prepare_fb() are just wrappers now,
use drm_gem_fb_create() and drm_gem_fb_prepare_fb() directly.

Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/1506255985-61113-6-git-send-email-noralf@tronnes.org
6 years agodrm/meson: Use drm_gem_fb_create()
Noralf Trønnes [Sun, 24 Sep 2017 12:26:19 +0000 (14:26 +0200)]
drm/meson: Use drm_gem_fb_create()

drm_fb_cma_create() is just a wrapper around drm_gem_fb_create() now,
so use the function directly.

Cc: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/1506255985-61113-5-git-send-email-noralf@tronnes.org
6 years agodrm/hisilicon/kirin: Use drm_gem_fb_create()
Noralf Trønnes [Sun, 24 Sep 2017 12:26:18 +0000 (14:26 +0200)]
drm/hisilicon/kirin: Use drm_gem_fb_create()

drm_fb_cma_create() is just a wrapper around drm_gem_fb_create() now,
so use the function directly.

Cc: Xinliang Liu <z.liuxinliang@hisilicon.com>
Cc: Rongrong Zou <zourongrong@gmail.com>
Cc: Xinwei Kong <kong.kongxinwei@hisilicon.com>
Cc: Chen Feng <puck.chen@hisilicon.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Xinliang Liu <z.liuxinliang@hisilicon.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/1506255985-61113-4-git-send-email-noralf@tronnes.org
6 years agodrm/fsl-dcu: Use drm_gem_fb_create()
Noralf Trønnes [Sun, 24 Sep 2017 12:26:17 +0000 (14:26 +0200)]
drm/fsl-dcu: Use drm_gem_fb_create()

drm_fb_cma_create() is just a wrapper around drm_gem_fb_create() now,
so use the function directly.

Cc: Stefan Agner <stefan@agner.ch>
Cc: Alison Wang <alison.wang@freescale.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/1506255985-61113-3-git-send-email-noralf@tronnes.org