platform/kernel/linux-rpi.git
3 years agodrm/stm: Don't set allow_fb_modifiers explicitly
Daniel Vetter [Tue, 27 Apr 2021 09:20:17 +0000 (11:20 +0200)]
drm/stm: Don't set allow_fb_modifiers explicitly

Since

commit 890880ddfdbe256083170866e49c87618b706ac7
Author: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Date:   Fri Jan 4 09:56:10 2019 +0100

    drm: Auto-set allow_fb_modifiers when given modifiers at plane init

this is done automatically as part of plane init, if drivers set the
modifier list correctly. Which is the case here.

Acked-by: Philippe Cornu <philippe.cornu@st.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Yannick Fertre <yannick.fertre@foss.st.com>
Cc: Philippe Cornu <philippe.cornu@foss.st.com>
Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>
Cc: linux-stm32@st-md-mailman.stormreply.com
Cc: linux-arm-kernel@lists.infradead.org
Link: https://patchwork.freedesktop.org/patch/msgid/20210427092018.832258-7-daniel.vetter@ffwll.ch
3 years agodrm/arm/malidp: Always list modifiers
Daniel Vetter [Tue, 27 Apr 2021 09:20:12 +0000 (11:20 +0200)]
drm/arm/malidp: Always list modifiers

Even when all we support is linear, make that explicit. Otherwise the
uapi is rather confusing.

Acked-by: Liviu Dudau <liviu.dudau@arm.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Cc: stable@vger.kernel.org
Cc: Pekka Paalanen <pekka.paalanen@collabora.com>
Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Brian Starkey <brian.starkey@arm.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210427092018.832258-2-daniel.vetter@ffwll.ch
3 years agodrm/arm: Don't set allow_fb_modifiers explicitly
Daniel Vetter [Tue, 27 Apr 2021 09:20:11 +0000 (11:20 +0200)]
drm/arm: Don't set allow_fb_modifiers explicitly

Since

commit 890880ddfdbe256083170866e49c87618b706ac7
Author: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Date:   Fri Jan 4 09:56:10 2019 +0100

    drm: Auto-set allow_fb_modifiers when given modifiers at plane init

this is done automatically as part of plane init, if drivers set the
modifier list correctly. Which is the case here for both komeda and
malidp.

Acked-by: Liviu Dudau <liviu.dudau@arm.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: "James (Qian) Wang" <james.qian.wang@arm.com>
Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Mihail Atanassov <mihail.atanassov@arm.com>
Cc: Brian Starkey <brian.starkey@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210427092018.832258-1-daniel.vetter@ffwll.ch
3 years agodrm: Use drm_mode_is_420_only() instead of open coding it
Ville Syrjälä [Tue, 4 May 2021 10:27:42 +0000 (13:27 +0300)]
drm: Use drm_mode_is_420_only() instead of open coding it

Replace the open coded drm_mode_is_420_only() with the real thing.

No functional changes.

Cc: Werner Sembach <wse@tuxedocomputers.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210504102742.7005-1-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
3 years agodrm/bridge: fix LONTIUM_LT8912B dependencies
Adrien Grassein [Tue, 4 May 2021 22:02:07 +0000 (00:02 +0200)]
drm/bridge: fix LONTIUM_LT8912B dependencies

LONTIUM_LT8912B uses "drm_display_mode_to_videomode" from
DRM framework that needs VIDEOMODE_HELPERS to be enabled.

Fixes: 30e2ae943c26 ("drm/bridge: Introduce LT8912B DSI to HDMI bridge")
Reported-by: Michal Suchánek <msuchanek@suse.de>
Signed-off-by: Adrien Grassein <adrien.grassein@gmail.com>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Signed-off-by: Robert Foss <robert.foss@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210504220207.4004511-1-adrien.grassein@gmail.com
3 years agodrm/amdgpu: Add show_fdinfo() interface
Roy Sun [Mon, 26 Apr 2021 06:27:01 +0000 (14:27 +0800)]
drm/amdgpu: Add show_fdinfo() interface

Tracking devices, process info and fence info using
/proc/pid/fdinfo

Signed-off-by: David M Nieto <David.Nieto@amd.com>
Signed-off-by: Roy Sun <Roy.Sun@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210426062701.39732-2-Roy.Sun@amd.com
3 years agodrm/scheduler: Change scheduled fence track v2
Roy Sun [Mon, 26 Apr 2021 06:27:00 +0000 (14:27 +0800)]
drm/scheduler: Change scheduled fence track v2

Update the timestamp of scheduled fence on HW
completion of the previous fences

This allow more accurate tracking of the fence
execution in HW

v2 (chk): drop the flag check and improve the comment

Signed-off-by: David M Nieto <david.nieto@amd.com>
Signed-off-by: Roy Sun <Roy.Sun@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210426062701.39732-1-Roy.Sun@amd.com
3 years agoMAINTAINERS: Fix TTM tree
Alex Deucher [Mon, 3 May 2021 13:47:35 +0000 (09:47 -0400)]
MAINTAINERS: Fix TTM tree

TTM uses drm-misc now.  Update the tree.

Cc: David Ward <david.ward@gatech.edu>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210503134736.1467003-1-alexander.deucher@amd.com
3 years agodrm/bridge: ti-sn65dsi86: Remove __exit from GPIO sub-driver remove helper
Douglas Anderson [Tue, 4 May 2021 14:38:54 +0000 (07:38 -0700)]
drm/bridge: ti-sn65dsi86: Remove __exit from GPIO sub-driver remove helper

The ti_sn_gpio_unregister() is not just called from the remove path
but also from the error handling of the init path. That means it can't
have the __exit annotation.

Fixes: bf73537f411b ("drm/bridge: ti-sn65dsi86: Break GPIO and MIPI-to-eDP bridge into sub-drivers")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Signed-off-by: Robert Foss <robert.foss@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210504073845.1.Ibf4194f4252846edaa0c6a6c7b86588f75ad5529@changeid
3 years agodrm/ttm: fix warning in new sys man
Christian König [Mon, 3 May 2021 14:25:31 +0000 (16:25 +0200)]
drm/ttm: fix warning in new sys man

Include the header for the prototype.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210503142710.153369-1-christian.koenig@amd.com
3 years agodrm/panel: panel-simple: Cache the EDID as long as we retain power
Douglas Anderson [Fri, 23 Apr 2021 16:59:04 +0000 (09:59 -0700)]
drm/panel: panel-simple: Cache the EDID as long as we retain power

It doesn't make sense to go out to the bus and read the EDID over and
over again. Let's cache it and throw away the cache when we turn power
off from the panel. Autosuspend means that even if there are several
calls to read the EDID before we officially turn the power on then we
should get good use out of this cache.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423095743.v5.18.If050957eaa85cf45b10bcf61e6f7fa61c9750ebf@changeid
3 years agodrm/panel: panel-simple: Power the panel when reading the EDID
Douglas Anderson [Fri, 23 Apr 2021 16:59:03 +0000 (09:59 -0700)]
drm/panel: panel-simple: Power the panel when reading the EDID

I don't believe that it ever makes sense to read the EDID when a panel
is not powered and the powering on of the panel is the job of
prepare(). Let's make sure that this happens before we try to read the
EDID. We use the pm_runtime functions directly rather than directly
calling the normal prepare() function because the pm_runtime functions
are definitely refcounted whereas it's less clear if the prepare() one
is.

NOTE: I'm not 100% sure how EDID reading was working for folks in the
past, but I can only assume that it was failing on the initial attempt
and then working only later. This patch, presumably, will fix that. If
some panel out there really can read the EDID without powering up and
it's a big advantage to preserve the old behavior we can add a
per-panel flag. It appears that providing the DDC bus to the panel in
the past was somewhat uncommon in any case.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423095743.v5.17.Ibd31b8f7c73255d68c5c9f5b611b4bfaa036f727@changeid
3 years agodrm/panel: panel-simple: Remove extra call: drm_connector_update_edid_property()
Douglas Anderson [Fri, 23 Apr 2021 16:59:02 +0000 (09:59 -0700)]
drm/panel: panel-simple: Remove extra call: drm_connector_update_edid_property()

As of commit 5186421cbfe2 ("drm: Introduce epoch counter to
drm_connector") the drm_get_edid() function calls
drm_connector_update_edid_property() for us. There's no reason for us
to call it again.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423095743.v5.16.Icb581b0273d95cc33ca38676c61ae6d7d2e75357@changeid
3 years agodrm/bridge: ti-sn65dsi86: If refclk, DP AUX can happen w/out pre-enable
Douglas Anderson [Fri, 23 Apr 2021 16:58:59 +0000 (09:58 -0700)]
drm/bridge: ti-sn65dsi86: If refclk, DP AUX can happen w/out pre-enable

Let's reorganize how we init and turn on the reference clock in the
code to allow us to turn it on early (even before pre_enable()) so
that we can read the EDID early. This is handy for eDP because:
- We always assume that a panel is there.
- Once we report that a panel is there we get asked to read the EDID.
- Pre-enable isn't called until we know what pixel clock we want to
  use and we're ready to turn everything on. That's _after_ we get
  asked to read the EDID.

NOTE: the above only works out OK if we "refclk" is provided. Though I
don't have access to any hardware that uses ti-sn65dsi86 and _doesn't_
provide a "refclk", I believe that we'll have trouble reading the EDID
at bootup in that case. Specifically I believe that if there's no
"refclk" we need the MIPI source clock to be active before we can
successfully read the EDID. My evidence here is that, in testing, I
couldn't read the EDID until I turned on the DPPLL in the bridge chip
and that the DPPLL needs the input clock to be active.

Since this is hard to support, let's punt trying to handle this case
if there's no "refclk". In that case we'll enable comms in
pre_enable() like we always did.

I don't believe there are any users of the ti-sn65dsi86 bridge chip
that _don't_ use "refclk". The bridge chip is _very_ inflexible in
that mode. The only time I've seen that mode used was for some really
early prototype hardware that was thrown in the e-waste bin years ago
when we realized how inflexible it was.

Even if someone is using the bridge chip without the "refclk" they're
in no worse shape than they were before the (fairly recent) commit
58074b08c04a ("drm/bridge: ti-sn65dsi86: Read EDID blob over DDC").

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423095743.v5.13.Ie8cf556114953c6e7634564cc0d3ddbd103cb96c@changeid
3 years agodrm/bridge: ti-sn65dsi86: Code motion of refclk management functions
Douglas Anderson [Fri, 23 Apr 2021 16:58:58 +0000 (09:58 -0700)]
drm/bridge: ti-sn65dsi86: Code motion of refclk management functions

No functional changes--this just makes the diffstat of a future change
easier to understand.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423095743.v5.12.I047b8c7c6a3fc60eaca473da7a374f171fb021c2@changeid
3 years agodrm/bridge: ti-sn65dsi86: Use pm_runtime autosuspend
Douglas Anderson [Fri, 23 Apr 2021 16:58:57 +0000 (09:58 -0700)]
drm/bridge: ti-sn65dsi86: Use pm_runtime autosuspend

Let's make the bridge use autosuspend with a 500ms delay. This is in
preparation for promoting DP AUX transfers to their own sub-driver so
that we're not constantly powering up and down the device as we
transfer all the chunks.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423095743.v5.11.I4c0b4a87e4dc19e5023b4d0a21bbfa6d9c09ebd8@changeid
3 years agodrm/panel: panel-simple: Get rid of hacky HPD chicken-and-egg code
Douglas Anderson [Fri, 23 Apr 2021 16:58:56 +0000 (09:58 -0700)]
drm/panel: panel-simple: Get rid of hacky HPD chicken-and-egg code

When I added support for the hpd-gpio to simple-panel in commit
48834e6084f1 ("drm/panel-simple: Support hpd-gpios for delaying
prepare()"), I added a special case to handle a circular dependency I
was running into on the ti-sn65dsi86 bridge chip. On my board the
hpd-gpio is actually provided by the bridge chip. That was causing
some circular dependency problems that I had to work around by getting
the hpd-gpio late.

I've now reorganized the ti-sn65dsi86 bridge chip driver to be a
collection of sub-drivers. Now the GPIO part can probe separately and
that breaks the chain. Let's get rid of the old code to clean things
up.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423095743.v5.10.I40eeedc23459d1e3fc96fa6cdad775d88c6e706c@changeid
3 years agodrm/bridge: ti-sn65dsi86: Break GPIO and MIPI-to-eDP bridge into sub-drivers
Douglas Anderson [Fri, 23 Apr 2021 16:58:55 +0000 (09:58 -0700)]
drm/bridge: ti-sn65dsi86: Break GPIO and MIPI-to-eDP bridge into sub-drivers

Let's use the newly minted aux bus to break up the driver into sub
drivers. We're not doing a full breakup here: all the code is still in
the same file and remains largely untouched. The big goal here of
using sub-drivers is to allow part of our code to finish probing even
if some other code needs to defer. This can solve some chicken-and-egg
problems. Specifically:
- In commit 48834e6084f1 ("drm/panel-simple: Support hpd-gpios for
  delaying prepare()") we had to add a bit of a hack to simpel-panel
  to support HPD showing up late. We can get rid of that hack now
  since the GPIO part of our driver can finish probing early.
- We have a desire to expose our DDC bus to simple-panel (and perhaps
  to a backlight driver?). That will end up with the same
  chicken-and-egg problem. A future patch to move this to a sub-driver
  will fix it.
- If/when we support the PWM functionality present in the bridge chip
  for a backlight we'll end up with another chicken-and-egg
  problem. If we allow the PWM to be a sub-driver too then it solves
  this problem.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423095743.v5.9.I3e68fa38c4ccbdbdf145cad2b01e83a1e5eac302@changeid
3 years agodrm/bridge: ti-sn65dsi86: Move all the chip-related init to the start
Douglas Anderson [Fri, 23 Apr 2021 16:58:54 +0000 (09:58 -0700)]
drm/bridge: ti-sn65dsi86: Move all the chip-related init to the start

This is just code motion of the probe routine to move all the things
that are for the "whole chip" (instead of the GPIO parts or the
MIPI-to-eDP parts) together at the start of probe. This is in
preparation for breaking the driver into sub-drivers.

Since we're using devm for all of the "whole chip" stuff this is
actually quite easy now.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423095743.v5.8.Ide8ba40feb2e43bc98a11edbb08d696d62dcd83e@changeid
3 years agodrm/bridge: ti-sn65dsi86: Cleanup managing of drvdata
Douglas Anderson [Fri, 23 Apr 2021 16:58:53 +0000 (09:58 -0700)]
drm/bridge: ti-sn65dsi86: Cleanup managing of drvdata

Let's:
- Set the drvdata as soon as it's allocated. This just sets up a
  pointer so there's no downside here.
- Remove the useless call to i2c_set_clientdata() which is literally
  the same thing as dev_set_drvdata().

No functional changes intended.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423095743.v5.7.If5d4d4e22e97bebcd493b76765c1759527705620@changeid
3 years agodrm/bridge: ti-sn65dsi86: Add local var for "dev" to simplify probe
Douglas Anderson [Fri, 23 Apr 2021 16:58:52 +0000 (09:58 -0700)]
drm/bridge: ti-sn65dsi86: Add local var for "dev" to simplify probe

Tiny cleanup for probe so we don't keep having to specify
"&client->dev" or "pdata->dev". No functional changes intended.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423095743.v5.6.I83925d8ca228bdc5f55b17854c90754efc6a470e@changeid
3 years agodrm/bridge: ti-sn65dsi86: Clean debugfs code
Douglas Anderson [Fri, 23 Apr 2021 16:58:51 +0000 (09:58 -0700)]
drm/bridge: ti-sn65dsi86: Clean debugfs code

Let's cleanup the debugfs code to:
- Check for errors.
- Use devm to manage freeing, which also means we don't need to store
  a pointer in our structure.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423095743.v5.5.I5fe072753290c6a77eda736ebd5778e17b7cb0fb@changeid
3 years agodrm/bridge: ti-sn65dsi86: Use devm to do our runtime_disable
Douglas Anderson [Fri, 23 Apr 2021 16:58:50 +0000 (09:58 -0700)]
drm/bridge: ti-sn65dsi86: Use devm to do our runtime_disable

There's no devm_runtime_enable(), but it's easy to use
devm_add_action_or_reset() and means we don't need to worry about the
disable in our remove() routine or in error paths.

No functional changes intended by this change.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423095743.v5.4.I1e627eb5f316c0cf6595b120e6e262f5bf890300@changeid
3 years agodrm/bridge: ti-sn65dsi86: More renames in prep for sub-devices
Douglas Anderson [Fri, 23 Apr 2021 16:58:49 +0000 (09:58 -0700)]
drm/bridge: ti-sn65dsi86: More renames in prep for sub-devices

Like the previous patch ("drm/bridge: ti-sn65dsi86: Rename the main
driver data structure") this is just a no-op rename in preparation for
splitting the driver up a bit.

Here I've attempted to rename functions / structures making sure that
anything applicable to the whole chip (instead of just the MIPI to eDP
bridge part) included "sn65dsi86" somewhere in the name instead of
just "ti_sn_bridge".

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423095743.v5.3.I4b28c737933a44548662df42ccd37db89ec739c1@changeid
3 years agodrm/bridge: ti-sn65dsi86: Rename the main driver data structure
Douglas Anderson [Fri, 23 Apr 2021 16:58:48 +0000 (09:58 -0700)]
drm/bridge: ti-sn65dsi86: Rename the main driver data structure

In preparation for splitting this driver into sub-drivers, let's
rename the main data structure so it's clear that it's holding data
for the whole device and not just the MIPI-eDP bridge part.

This is a no-op change.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423095743.v5.2.Ib03e88304a9ea1c503f1b9567be5cbf8b7c5761c@changeid
3 years agodrm: Remove pdev field from struct drm_device
Thomas Zimmermann [Sun, 2 May 2021 10:49:53 +0000 (12:49 +0200)]
drm: Remove pdev field from struct drm_device

The field pdev in struct drm_device is unused. Remove it. The
value can be obtained by upcasting from the structure's dev field.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20210502104953.21768-8-tzimmermann@suse.de
3 years agodrm/via: Remove references to drm_device.pdev
Thomas Zimmermann [Sun, 2 May 2021 10:49:52 +0000 (12:49 +0200)]
drm/via: Remove references to drm_device.pdev

Replace all references to struct drm_device's pdev field with
an upcast from dev.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20210502104953.21768-7-tzimmermann@suse.de
3 years agodrm/sis: Remove references to struct drm_device.pdev
Thomas Zimmermann [Sun, 2 May 2021 10:49:51 +0000 (12:49 +0200)]
drm/sis: Remove references to struct drm_device.pdev

Replace all references to struct drm_device's pdev field with
an upcast from dev.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20210502104953.21768-6-tzimmermann@suse.de
3 years agodrm/savage: Remove references to struct drm_device.pdev
Thomas Zimmermann [Sun, 2 May 2021 10:49:50 +0000 (12:49 +0200)]
drm/savage: Remove references to struct drm_device.pdev

Replace all references to struct drm_device's pdev field with
an upcast from dev.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20210502104953.21768-5-tzimmermann@suse.de
3 years agodrm/r128: Remove references to struct drm_device.pdev
Thomas Zimmermann [Sun, 2 May 2021 10:49:49 +0000 (12:49 +0200)]
drm/r128: Remove references to struct drm_device.pdev

Replace all references to struct drm_device's pdev field with
an upcast from dev.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20210502104953.21768-4-tzimmermann@suse.de
3 years agodrm/mga: Remove references to struct drm_device.pdev
Thomas Zimmermann [Sun, 2 May 2021 10:49:48 +0000 (12:49 +0200)]
drm/mga: Remove references to struct drm_device.pdev

Replace all references to struct drm_device's pdev field with
an upcast from dev.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20210502104953.21768-3-tzimmermann@suse.de
3 years agodrm/i810: Remove references to struct drm_device.pdev
Thomas Zimmermann [Sun, 2 May 2021 10:49:47 +0000 (12:49 +0200)]
drm/i810: Remove references to struct drm_device.pdev

Replace all references to struct drm_device's pdev field with
an upcast from dev.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20210502104953.21768-2-tzimmermann@suse.de
3 years agodrm/ttm: properly allocate sys resource during swapout
Christian König [Tue, 13 Apr 2021 18:17:51 +0000 (20:17 +0200)]
drm/ttm: properly allocate sys resource during swapout

Drop the special handling here.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210430092508.60710-3-christian.koenig@amd.com
3 years agodrm/ttm: always initialize the full ttm_resource v2
Christian König [Tue, 16 Feb 2021 18:03:52 +0000 (19:03 +0100)]
drm/ttm: always initialize the full ttm_resource v2

Init all fields in ttm_resource_alloc() when we create a new resource.

v2: use place->mem_type instead of res->mem_type

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210430092508.60710-2-christian.koenig@amd.com
3 years agodrm/ttm: add ttm_sys_manager v3
Christian König [Fri, 5 Feb 2021 14:58:56 +0000 (15:58 +0100)]
drm/ttm: add ttm_sys_manager v3

Add a separate manager for the system domain and make function tables
mandatory.

v2: debug is still optional
v3: return void during init

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210430092508.60710-1-christian.koenig@amd.com
3 years agodrm/ttm: cleanup ttm_agp_backend
Christian König [Mon, 26 Apr 2021 17:20:55 +0000 (19:20 +0200)]
drm/ttm: cleanup ttm_agp_backend

Audit the includes and stop accessing the internal drm_mm_node.

The ttm_resource::start is the same value as the drm_mm_node::start.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210426175824.122557-1-christian.koenig@amd.com
3 years agodrm/connector: demote connector force-probes for non-master clients
Simon Ser [Fri, 2 Apr 2021 11:22:12 +0000 (13:22 +0200)]
drm/connector: demote connector force-probes for non-master clients

Force-probing a connector can be slow and cause flickering. As this
affects the global KMS state, let's make it so only the DRM master
can force-probe a connector.

Non-master DRM clients won't be able to force-probe a connector
anymore. Instead, KMS will perform a regular read-only connector
query.

Signed-off-by: Simon Ser <contact@emersion.fr>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20210402112212.5625-1-contact@emersion.fr
3 years agodrm/simpledrm: Acquire memory aperture for framebuffer
Thomas Zimmermann [Fri, 30 Apr 2021 10:58:40 +0000 (12:58 +0200)]
drm/simpledrm: Acquire memory aperture for framebuffer

We register the simplekms device with the DRM platform helpers. A
native driver for the graphics hardware will kick-out the simpledrm
driver before taking over the device.

The original generic platform device from the simple-framebuffer boot
code will be unregistered. The native driver will use whatever native
hardware device it received.

v4:
* convert to drm_aperture_acquire_from_firmware()
v3:
* use platform_device_unregister() and handle detachment
  like hot-unplug event (Daniel)
v2:
* adapt to aperture changes
* use drm_dev_unplug() and drm_dev_enter/exit()
* don't split error string

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Maxime Ripard <maxime@cerno.tech>
Tested-by: nerdopolis <bluescreen_avenger@verizon.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20210430105840.30515-10-tzimmermann@suse.de
3 years agodrm: Add simpledrm driver
Thomas Zimmermann [Fri, 30 Apr 2021 10:58:35 +0000 (12:58 +0200)]
drm: Add simpledrm driver

The simpledrm driver is a DRM driver for simple-framebuffer framebuffers
as provided by the kernel's boot code. This driver enables basic
graphical output on many different graphics devices that are provided
by the platform (e.g., EFI, VESA, embedded framebuffers).

With the kernel's simple-framebuffer infrastructure, the kernel receives
a pre-configured framebuffer from the system (i.e., firmware, boot
loader). It creates a platform device to which simpledrm attaches.
The system's framebuffer consists of a memory range, size and format.
Based on these values, simpledrm creates a DRM devices. No actual
modesetting is possible.

A firmware framebuffer might also be specified via device-tree files. If
no device platform data is given, try the DT device node.

Make sure required hardware clocks and regulators are enabled while the
firmware framebuffer is in use. The basic code has been taken from the
simplefb driver and adapted to DRM. Clocks are released automatically
via devres helpers.

The drivers displays a console on simpledrm's framebuffer. The default
framebuffer format is being used.

v4:
* disable simplefb if simpledrm has been selected (Maxime)
v3:
* add disable function that clears screen to black (Daniel)
* set shadow buffering only for fbdev emulation
* set platform-driver data during device creation
v2:
* rename driver to simpledrm
* add dri-devel to MAINTAINERS entry
* put native format first in primary-plane format list (Daniel)
* inline simplekms_device_cleanup() (Daniel)
* use helpers for shadow-buffered planes
* fix whitespace errors
* add Device Tree match table
* clean-up parser wrappers
* use strscpy()

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> # fbdev support
Acked-by: Maxime Ripard <maxime@cerno.tech>
Tested-by: nerdopolis <bluescreen_avenger@verizon.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20210430105840.30515-5-tzimmermann@suse.de
Link: https://patchwork.freedesktop.org/patch/msgid/20210430105840.30515-6-tzimmermann@suse.de
Link: https://patchwork.freedesktop.org/patch/msgid/20210430105840.30515-7-tzimmermann@suse.de
Link: https://patchwork.freedesktop.org/patch/msgid/20210430105840.30515-8-tzimmermann@suse.de
Link: https://patchwork.freedesktop.org/patch/msgid/20210430105840.30515-9-tzimmermann@suse.de
3 years agodrm/aperture: Add infrastructure for aperture ownership
Thomas Zimmermann [Fri, 30 Apr 2021 10:58:34 +0000 (12:58 +0200)]
drm/aperture: Add infrastructure for aperture ownership

Platform devices might operate on firmware framebuffers, such as VESA or
EFI. Before a native driver for the graphics hardware can take over the
device, it has to remove any platform driver that operates on the firmware
framebuffer. Aperture helpers provide the infrastructure for platform
drivers to acquire firmware framebuffers, and for native drivers to remove
them later on.

It works similar to the related fbdev mechanism. During initialization, the
platform driver acquires the firmware framebuffer's I/O memory and provides
a callback to be removed. The native driver later uses this information to
remove any platform driver for it's framebuffer I/O memory.

The aperture removal code is integrated into the existing code for removing
conflicting framebuffers, so native drivers use it automatically.

v5:
* fix build error introduced by rebasing v4
* fix typo in documentation
v4:
* hide detach callback in implementation (Daniel)
* documentation fixes
v3:
* rebase onto existing aperture infrastructure
* release aperture from list during detach; fix dangling apertures
* don't export struct drm_aperture
* document struct drm_aperture_funcs
v2:
* rename plaform helpers to aperture helpers
* tie to device lifetime with devm_ functions
* removed unsued remove() callback
* rename kickout to detach
* make struct drm_aperture private
* rebase onto existing drm_aperture.h header file
* use MIT license only for simplicity
* documentation

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Maxime Ripard <maxime@cerno.tech>
Tested-by: nerdopolis <bluescreen_avenger@verizon.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20210430105840.30515-4-tzimmermann@suse.de
3 years agodrm/format-helper: Add blitter functions
Thomas Zimmermann [Fri, 30 Apr 2021 10:58:33 +0000 (12:58 +0200)]
drm/format-helper: Add blitter functions

The blitter functions copy a framebuffer to I/O memory using one of
the existing conversion functions.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Maxime Ripard <maxime@cerno.tech>
Tested-by: nerdopolis <bluescreen_avenger@verizon.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20210430105840.30515-3-tzimmermann@suse.de
3 years agodrm/format-helper: Pass destination pitch to drm_fb_memcpy_dstclip()
Thomas Zimmermann [Fri, 30 Apr 2021 10:58:32 +0000 (12:58 +0200)]
drm/format-helper: Pass destination pitch to drm_fb_memcpy_dstclip()

The memcpy's destination buffer might have a different pitch than the
source. Support different pitches as function argument.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Maxime Ripard <maxime@cerno.tech>
Tested-by: nerdopolis <bluescreen_avenger@verizon.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20210430105840.30515-2-tzimmermann@suse.de
3 years agodrm/i915: Use the correct max source link rate for MST
Nikola Cornij [Fri, 30 Apr 2021 21:45:31 +0000 (17:45 -0400)]
drm/i915: Use the correct max source link rate for MST

[why]
Previously used value was not safe to provide the correct value, i.e. it
could be 0 if not not configured, leading to no MST on this platform.

[how]
Do not use the value from BIOS, but from the structure populated at
encoder initialization time.

Fixes: 98025a62cb00 ("drm/dp_mst: Use Extended Base Receiver Capability DPCD space")
Signed-off-by: Nikola Cornij <nikola.cornij@amd.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
[fixed open coded drm_dp_link_rate_to_bw_code()]
Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210430214531.24565-2-nikola.cornij@amd.com
3 years agodrm/panel: panel-simple: Add missing pm_runtime_disable() calls
Douglas Anderson [Fri, 23 Apr 2021 16:58:47 +0000 (09:58 -0700)]
drm/panel: panel-simple: Add missing pm_runtime_disable() calls

In commit 3235b0f20a0a ("drm/panel: panel-simple: Use runtime pm to
avoid excessive unprepare / prepare") we started using pm_runtime, but
my patch neglected to add the proper pm_runtime_disable(). Doh! Add
them now.

Fixes: 3235b0f20a0a ("drm/panel: panel-simple: Use runtime pm to avoid excessive unprepare / prepare")
Reported-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423095743.v5.1.I9e6af2529d6c61e5daf86a15a1211121c5223b9a@changeid
3 years agodrm/bridge: nwl-dsi: Get MIPI DSI controller and PHY ready in ->mode_set()
Liu Ying [Fri, 23 Apr 2021 09:26:43 +0000 (17:26 +0800)]
drm/bridge: nwl-dsi: Get MIPI DSI controller and PHY ready in ->mode_set()

Some MIPI DSI panel drivers like 'raydium,rm68200' send
MIPI_DCS_SET_DISPLAY_ON commands in panel_funcs->prepare(), which
requires the MIPI DSI controller and PHY to be ready beforehand.
Without this patch, the nwl-dsi driver gets the MIPI DSI controller
and PHY ready in bridge_funcs->atomic_pre_enable(), which happens after
the panel_funcs->prepare().  So, this patch shifts the bridge operation
ealier from bridge_funcs->atomic_pre_enable() to bridge_funcs->mode_set().
This way, more MIPI DSI panels can connect to this nwl-dsi bridge.

Cc: Andrzej Hajda <a.hajda@samsung.com>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Robert Foss <robert.foss@linaro.org>
Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
Cc: Jonas Karlman <jonas@kwiboo.se>
Cc: Jernej Skrabec <jernej.skrabec@siol.net>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Guido Günther <agx@sigxcpu.org>
Cc: Robert Chiras <robert.chiras@nxp.com>
Cc: NXP Linux Team <linux-imx@nxp.com>
Signed-off-by: Liu Ying <victor.liu@nxp.com>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1619170003-4817-4-git-send-email-victor.liu@nxp.com
3 years agodrm/bridge: nwl-dsi: Remove a check on unchanged HS clock rate from ->mode_set()
Liu Ying [Fri, 23 Apr 2021 09:26:42 +0000 (17:26 +0800)]
drm/bridge: nwl-dsi: Remove a check on unchanged HS clock rate from ->mode_set()

The check on unchanged HS clock rate in ->mode_set() improves
the callback's performance a bit by early return.  However,
the up-coming patch would get MIPI DSI controller and PHY ready
in ->mode_set() after that check, thus likely skipped.
So, this patch removes that check to make sure MIPI DSI controller
and PHY will be brought up and taken down from ->mode_set() and
->atomic_disable() respectively in pairs.

Cc: Andrzej Hajda <a.hajda@samsung.com>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Robert Foss <robert.foss@linaro.org>
Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
Cc: Jonas Karlman <jonas@kwiboo.se>
Cc: Jernej Skrabec <jernej.skrabec@siol.net>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Guido Günther <agx@sigxcpu.org>
Cc: Robert Chiras <robert.chiras@nxp.com>
Cc: NXP Linux Team <linux-imx@nxp.com>
Signed-off-by: Liu Ying <victor.liu@nxp.com>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1619170003-4817-3-git-send-email-victor.liu@nxp.com
3 years agodrm/bridge: nwl-dsi: Force a full modeset when crtc_state->active is changed to be...
Liu Ying [Fri, 23 Apr 2021 09:26:41 +0000 (17:26 +0800)]
drm/bridge: nwl-dsi: Force a full modeset when crtc_state->active is changed to be true

This patch replaces ->mode_fixup() with ->atomic_check() so that
a full modeset can be requested from there when crtc_state->active
is changed to be true(which implies only connector's DPMS is brought
out of "Off" status, though not necessarily).  Bridge functions are
added or changed to accommodate the ->atomic_check() callback.  That
full modeset is needed by the up-coming patch which gets MIPI DSI
controller and PHY ready in ->mode_set(), because it makes sure
->mode_set() and ->atomic_disable() are called in pairs.

Cc: Andrzej Hajda <a.hajda@samsung.com>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Robert Foss <robert.foss@linaro.org>
Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
Cc: Jonas Karlman <jonas@kwiboo.se>
Cc: Jernej Skrabec <jernej.skrabec@siol.net>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Guido Günther <agx@sigxcpu.org>
Cc: Robert Chiras <robert.chiras@nxp.com>
Cc: NXP Linux Team <linux-imx@nxp.com>
Signed-off-by: Liu Ying <victor.liu@nxp.com>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1619170003-4817-2-git-send-email-victor.liu@nxp.com
3 years agodrm/panel: Add DT bindings for Samsung LMS397KF04
Linus Walleij [Mon, 5 Apr 2021 23:47:12 +0000 (01:47 +0200)]
drm/panel: Add DT bindings for Samsung LMS397KF04

This adds device tree bindings for the Samsung LMS397KF04
RGB DPI display panel.

Cc: devicetree@vger.kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210405234713.3190693-1-linus.walleij@linaro.org
3 years agodrm/dp_mst: Use Extended Base Receiver Capability DPCD space
Nikola Cornij [Thu, 29 Apr 2021 22:11:51 +0000 (18:11 -0400)]
drm/dp_mst: Use Extended Base Receiver Capability DPCD space

[why]
DP 1.4a spec mandates that if DP_EXTENDED_RECEIVER_CAP_FIELD_PRESENT is
set, Extended Base Receiver Capability DPCD space must be used. Without
doing that, the three DPCD values that differ will be wrong, leading to
incorrect or limited functionality. MST link rate, for example, could
have a lower value. Also, Synaptics quirk wouldn't work out well when
Extended DPCD was not read, resulting in no DSC for such hubs.

[how]
Modify MST topology manager to use the values from Extended DPCD where
applicable.

To prevent regression on the sources that have a lower maximum link rate
capability than MAX_LINK_RATE from Extended DPCD, have the drivers
supply maximum lane count and rate at initialization time.

This also reverts commit 2dcab875e763 ("Revert drm/dp_mst: Retrieve
extended DPCD caps for topology manager"), brining the change back to the
original commit ad44c03208e4 ("drm/dp_mst: Retrieve extended DPCD caps for
topology manager").

Signed-off-by: Nikola Cornij <nikola.cornij@amd.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210429221151.22020-2-nikola.cornij@amd.com
3 years agodrm/vkms: add overlay support
Melissa Wen [Sat, 24 Apr 2021 08:26:10 +0000 (05:26 -0300)]
drm/vkms: add overlay support

Add support to overlay plane, in addition to primary and cursor
planes. In this approach, the plane composition still requires an
active primary plane and planes are composed associatively in the
order: (primary <- overlay) <- cursor

It enables to run the following IGT tests successfully:
- kms_plane_cursor:
  - pipe-A-[overlay, primary, viewport]-size-[64, 128, 256]
- kms_atomic:
  - plane-overlay-legacy
and preserves the successful execution of kms_cursor_crc,
kms_writeback and kms_flip

Signed-off-by: Melissa Wen <melissa.srw@gmail.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/8261bf93d8a0e3ffaf81d8e7c9b3e9c229116be3.1619250933.git.melissa.srw@gmail.com
3 years agodrm/vkms: add XRGB planes composition
Melissa Wen [Sat, 24 Apr 2021 08:25:31 +0000 (05:25 -0300)]
drm/vkms: add XRGB planes composition

Add support for composing XRGB888 planes in addition to the ARGB8888
format. In the case of an XRGB plane at the top, the composition consists
of copying the RGB values of a pixel from src to dst and clearing alpha
channel, without the need for alpha blending operations for each pixel.

Blend equations assume a completely opaque background, i.e., primary plane
is not cleared before pixel blending but alpha channel is explicitly
opaque (a = 0xff). Also, there is room for performance evaluation in
switching pixel blend operation according to the plane format.

v4:
- clear alpha channel (0xff) after blend color values by pixel
- improve comments on blend ops to reflect the current state
- describe in the commit message future improvements for plane composition

Signed-off-by: Melissa Wen <melissa.srw@gmail.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/07bcf4643d11da9480599fe1b165e478bff58b25.1619250933.git.melissa.srw@gmail.com
3 years agodrm/vkms: rename cursor to plane on ops of planes composition
Melissa Wen [Sat, 24 Apr 2021 08:24:44 +0000 (05:24 -0300)]
drm/vkms: rename cursor to plane on ops of planes composition

Generalize variables and function names used for planes composition
(from cursor to plane), since we will reuse the operations for both
cursor and overlay types.

No functional change.

v4:
- use better names for functions of plane composition (Daniel)

Signed-off-by: Melissa Wen <melissa.srw@gmail.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/ef3249c9ac3a08b7079894f9f1ccf70960194ec7.1619250933.git.melissa.srw@gmail.com
3 years agodrm/vkms: init plane using drmm_universal_plane_alloc
Melissa Wen [Sat, 24 Apr 2021 08:23:27 +0000 (05:23 -0300)]
drm/vkms: init plane using drmm_universal_plane_alloc

By using drmm_universal_plane_alloc instead of
drm_universal_plane_init, we let the DRM infrastructure handles
resource allocation and cleanup. We can also get rid of some
code repetitions for plane cleanup, improving code maintainability
in vkms.

Signed-off-by: Melissa Wen <melissa.srw@gmail.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/3bbdabed0274d2d0917d1b829dd16f13d7b495f5.1619250933.git.melissa.srw@gmail.com
3 years agodrm: Move struct drm_device.pdev to legacy section
Thomas Zimmermann [Thu, 29 Apr 2021 10:51:01 +0000 (12:51 +0200)]
drm: Move struct drm_device.pdev to legacy section

Struct drm_device.pdev is being moved to legacy status as only legacy
DRM drivers use it. A possible follow-up patchset could remove pdev
entirely.

v4:
* rebased

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210429105101.25667-6-tzimmermann@suse.de
3 years agodrm/i915: Don't assign to struct drm_device.pdev
Thomas Zimmermann [Thu, 29 Apr 2021 10:51:00 +0000 (12:51 +0200)]
drm/i915: Don't assign to struct drm_device.pdev

Using struct drm_device.pdev is deprecated. Don't assign it. Users
should upcast from struct drm_device.dev.

v6:
* also fix the assignment in selftests in this patch (Chris)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210429105101.25667-5-tzimmermann@suse.de
3 years agodrm/i915: Remove reference to struct drm_device.pdev
Thomas Zimmermann [Thu, 29 Apr 2021 10:50:59 +0000 (12:50 +0200)]
drm/i915: Remove reference to struct drm_device.pdev

References to struct drm_device.pdev should not be used any longer as
the field will be moved into the struct's legacy section. Fix a rsp
comment.

v8:
* fix commit message (Michael)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210429105101.25667-4-tzimmermann@suse.de
3 years agodrm/i915/gt: Remove reference to struct drm_device.pdev
Thomas Zimmermann [Thu, 29 Apr 2021 10:50:58 +0000 (12:50 +0200)]
drm/i915/gt: Remove reference to struct drm_device.pdev

References to struct drm_device.pdev should not be used any longer as
the field will be moved into the struct's legacy section. Add a fix
for the rsp commit.

v8:
* fix commit message (Michael)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Fixes: a50ca39fbd01 ("drm/i915: setup the LMEM region")
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Venkata Sandeep Dhanalakota <venkata.s.dhanalakota@intel.com>
Cc: "Michał Winiarski" <michal.winiarski@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210429105101.25667-3-tzimmermann@suse.de
3 years agodrm/ast: Remove reference to struct drm_device.pdev
Thomas Zimmermann [Thu, 29 Apr 2021 10:50:57 +0000 (12:50 +0200)]
drm/ast: Remove reference to struct drm_device.pdev

Using struct drm_device.pdev is deprecated. Upcast with to_pci_dev()
from struct drm_device.dev to get the PCI device structure.

v9:
* fix remaining pdev references

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Fixes: ba4e0339a6a3 ("drm/ast: Fixed CVE for DP501")
Cc: KuoHsiang Chou <kuohsiang_chou@aspeedtech.com>
Cc: kernel test robot <lkp@intel.com>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Dave Airlie <airlied@redhat.com>
Cc: dri-devel@lists.freedesktop.org
Link: https://patchwork.freedesktop.org/patch/msgid/20210429105101.25667-2-tzimmermann@suse.de
3 years agodrm/vmwgfx: replace idr_init() by idr_init_base()
Deepak R Varma [Thu, 5 Nov 2020 19:07:18 +0000 (00:37 +0530)]
drm/vmwgfx: replace idr_init() by idr_init_base()

idr_init() uses base 0 which is an invalid identifier for this driver.
The idr_alloc for this driver uses 1 as start value for ID range. The
new function idr_init_base allows IDR to set the ID lookup from base 1.
This avoids all lookups that otherwise starts from 0 since 0 is always
unused / available.

References: commit 6ce711f27500 ("idr: Make 1-based IDRs more efficient")

Signed-off-by: Deepak R Varma <mh12gx2825@gmail.com>
Signed-off-by: Zack Rusin <zackr@vmware.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201105190718.GA89863@localhost
3 years agodrm/vmwgfx: use min_t to replace min
Bernard Zhao [Thu, 19 Nov 2020 01:11:46 +0000 (17:11 -0800)]
drm/vmwgfx: use min_t to replace min

Use min_t to replace min, min_t is a bit fast because min use
twice typeof.
This patch also fix check_patch.pl warning:
WARNING: min() should probably be min_t(unsigned long, num_pages,
VMW_PPN_PER_REMAP)
+unsigned long nr = min(num_pages, (unsigned long)
VMW_PPN_PER_REMAP);

Signed-off-by: Bernard Zhao <bernard@vivo.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Zack Rusin <zackr@vmware.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201119011146.107587-1-bernard@vivo.com
3 years agogpu: drm: vmwgfx: convert comma to semicolon
Zheng Yongjun [Fri, 11 Dec 2020 08:57:51 +0000 (16:57 +0800)]
gpu: drm: vmwgfx: convert comma to semicolon

Replace a comma between expression statements by a semicolon.

Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Signed-off-by: Zack Rusin <zackr@vmware.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201211085751.3089-1-zhengyongjun3@huawei.com
3 years agodrm/vmwgfx/vmwgfx_validation: Use flexible-array member instead of zero-length array
Zou Wei [Tue, 23 Mar 2021 13:02:04 +0000 (13:02 +0000)]
drm/vmwgfx/vmwgfx_validation: Use flexible-array member instead of zero-length array

Suppresses the following coccinelle warning:

drivers/gpu/drm/vmwgfx/vmwgfx_validation.c:85:15-22: WARNING use flexible-array member instead

Signed-off-by: Zou Wei <zou_wei@huawei.com>
Signed-off-by: Zack Rusin <zackr@vmware.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210323130204.45439-1-zou_wei@huawei.com
3 years agodrm/vmwgfx: Fix a typo
Bhaskar Chowdhury [Sat, 20 Mar 2021 21:16:17 +0000 (02:46 +0530)]
drm/vmwgfx: Fix a typo

s/particuar/particular/

Signed-off-by: Bhaskar Chowdhury <unixbhaskar@gmail.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Reviewed-by: Zack Rusin <zackr@vmware.com>
Signed-off-by: Zack Rusin <zackr@vmware.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210320211617.30746-1-unixbhaskar@gmail.com
3 years agodrm/vc4: fix argument ordering in vc4_crtc_get_margins()
Dan Carpenter [Wed, 21 Apr 2021 10:18:03 +0000 (13:18 +0300)]
drm/vc4: fix argument ordering in vc4_crtc_get_margins()

Cppcheck complains that the declaration doesn't match the function
definition.  Obviously "left" should come before "right".  The caller
and the function implementation are done this way, it's just the
declaration which is wrong so this doesn't affect runtime.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/YH/720FD978TPhHp@mwanda
3 years agodrm/bridge: anx7625: Fix power on delay
Hsin-Yi Wang [Wed, 28 Apr 2021 11:51:16 +0000 (19:51 +0800)]
drm/bridge: anx7625: Fix power on delay

>From anx7625 spec, the delay between powering on power supplies and gpio
should be larger than 10ms.

Fixes: 6c744983004e ("drm/bridge: anx7625: disable regulators when power off")
Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Robert Foss <robert.foss@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210428115116.931328-1-hsinyi@chromium.org
3 years agodrm: bridge: add missing word in Analogix help text
Randy Dunlap [Sat, 24 Apr 2021 06:18:17 +0000 (23:18 -0700)]
drm: bridge: add missing word in Analogix help text

Insert a missing word "power" in Kconfig help text.

Fixes: 6aa192698089 ("drm/bridge: Add Analogix anx6345 support")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Andrzej Hajda <a.hajda@samsung.com>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Robert Foss <robert.foss@linaro.org>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Cc: Icenowy Zheng <icenowy@aosc.io>
Cc: Vasily Khoruzhick <anarsoul@gmail.com>
Cc: Torsten Duwe <duwe@suse.de>
Cc: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Robert Foss <robert.foss@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210424061817.7339-1-rdunlap@infradead.org
3 years agodrm/dp_mst: Convert drm_dp_mst_topology.c to drm_err()/drm_dbg*()
Lyude Paul [Fri, 23 Apr 2021 18:43:09 +0000 (14:43 -0400)]
drm/dp_mst: Convert drm_dp_mst_topology.c to drm_err()/drm_dbg*()

And finally, convert all of the code in drm_dp_mst_topology.c over to using
drm_err() and drm_dbg*(). Note that this refactor would have been a lot
more complicated to have tried writing a coccinelle script for, so this
whole thing was done by hand.

v2:
* Fix line-wrapping in drm_dp_mst_atomic_check_mstb_bw_limit()

Signed-off-by: Lyude Paul <lyude@redhat.com>
Cc: Robert Foss <robert.foss@linaro.org>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423184309.207645-18-lyude@redhat.com
Reviewed-by: Dave Airlie <airlied@redhat.com>
3 years agodrm/dp_dual_mode: Convert drm_dp_dual_mode_helper.c to using drm_err/drm_dbg_kms()
Lyude Paul [Fri, 23 Apr 2021 18:43:08 +0000 (14:43 -0400)]
drm/dp_dual_mode: Convert drm_dp_dual_mode_helper.c to using drm_err/drm_dbg_kms()

Next step in the conversion, move everything in drm_dp_dual_mode_helper.c
over to using drm_err() and drm_dbg_kms(). This was done using the
following cocci script:

  @@
  expression list expr;
  @@

  (
  - DRM_DEBUG_KMS(expr);
  + drm_dbg_kms(dev, expr);
  |
  - DRM_ERROR(expr);
  + drm_err(dev, expr);
  )

And correcting the indentation of the resulting code by hand.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423184309.207645-17-lyude@redhat.com
Reviewed-by: Dave Airlie <airlied@redhat.com>
3 years agodrm/dp: Convert drm_dp_helper.c to using drm_err/drm_dbg_*()
Lyude Paul [Fri, 23 Apr 2021 18:43:07 +0000 (14:43 -0400)]
drm/dp: Convert drm_dp_helper.c to using drm_err/drm_dbg_*()

Now that we've added a back-pointer to drm_device to drm_dp_aux, made
drm_dp_aux available to any functions in drm_dp_helper.c which need to
print to the kernel log, and ensured all of our logging uses a consistent
format, let's do the final step of the conversion and actually move
everything over to using drm_err() and drm_dbg_*().

This was done by using the following cocci script:

  @@
  expression list expr;
  @@

  (
  - DRM_DEBUG_KMS(expr);
  + drm_dbg_kms(aux->drm_dev, expr);
  |
  - DRM_DEBUG_DP(expr);
  + drm_dbg_dp(aux->drm_dev, expr);
  |
  - DRM_DEBUG_ATOMIC(expr);
  + drm_dbg_atomic(aux->drm_dev, expr);
  |
  - DRM_DEBUG_KMS_RATELIMITED(expr);
  + drm_dbg_kms_ratelimited(aux->drm_dev, expr);
  |
  - DRM_ERROR(expr);
  + drm_err(aux->drm_dev, expr);
  )

Followed by correcting the resulting line-wrapping in the results by hand.

v2:
* Fix indenting in drm_dp_dump_access

Signed-off-by: Lyude Paul <lyude@redhat.com>
Cc: Robert Foss <robert.foss@linaro.org>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423184309.207645-16-lyude@redhat.com
Reviewed-by: Dave Airlie <airlied@redhat.com>
3 years agodrm/print: Handle potentially NULL drm_devices in drm_dbg_*
Lyude Paul [Fri, 23 Apr 2021 18:43:06 +0000 (14:43 -0400)]
drm/print: Handle potentially NULL drm_devices in drm_dbg_*

While this shouldn't really be something that happens all that often, since
we're going to be using the drm_dbg_* log helpers in DRM helpers it's
technically possible that a driver could use an AUX adapter before it's
been associated with it's respective drm_device. While drivers should take
care to avoid this, there's likely going to be situations where it's
difficult to workaround. And since other logging helpers in the kernel tend
to be OK with NULL pointers (for instance, passing a NULL pointer to a "%s"
argument for a printk-like function in the kernel doesn't break anything),
we should do the same for ours.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423184309.207645-15-lyude@redhat.com
Reviewed-by: Dave Airlie <airlied@redhat.com>
3 years agodrm/dp_mst: Pass drm_dp_mst_topology_mgr to drm_dp_get_vc_payload_bw()
Lyude Paul [Fri, 23 Apr 2021 18:43:05 +0000 (14:43 -0400)]
drm/dp_mst: Pass drm_dp_mst_topology_mgr to drm_dp_get_vc_payload_bw()

Since this is one of the few functions in drm_dp_mst_topology.c that
doesn't have any way of getting access to a drm_device, let's pass the
drm_dp_mst_topology_mgr down to this function so that it can use
drm_dbg_kms().

Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423184309.207645-14-lyude@redhat.com
Reviewed-by: Dave Airlie <airlied@redhat.com>
3 years agodrm/dp_dual_mode: Pass drm_device to drm_lspcon_(get|set)_mode()
Lyude Paul [Fri, 23 Apr 2021 18:43:04 +0000 (14:43 -0400)]
drm/dp_dual_mode: Pass drm_device to drm_lspcon_(get|set)_mode()

So that we can start using drm_dbg_*() throughout the DRM DP helpers.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423184309.207645-13-lyude@redhat.com
Reviewed-by: Dave Airlie <airlied@redhat.com>
3 years agodrm/dp_dual_mode: Pass drm_device to drm_dp_dual_mode_get_tmds_output()
Lyude Paul [Fri, 23 Apr 2021 18:43:03 +0000 (14:43 -0400)]
drm/dp_dual_mode: Pass drm_device to drm_dp_dual_mode_get_tmds_output()

Another function to pass drm_device * down to so we can start using the
drm_dbg_*() in the DRM DP helpers.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423184309.207645-12-lyude@redhat.com
Reviewed-by: Dave Airlie <airlied@redhat.com>
3 years agodrm/dp_dual_mode: Pass drm_device to drm_dp_dual_mode_max_tmds_clock()
Lyude Paul [Fri, 23 Apr 2021 18:43:02 +0000 (14:43 -0400)]
drm/dp_dual_mode: Pass drm_device to drm_dp_dual_mode_max_tmds_clock()

Another function we need to pass drm_device down to in order to start using
drm_dbg_*().

Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423184309.207645-11-lyude@redhat.com
Reviewed-by: Dave Airlie <airlied@redhat.com>
3 years agodrm/dp_dual_mode: Pass drm_device to drm_dp_dual_mode_set_tmds_output()
Lyude Paul [Fri, 23 Apr 2021 18:43:01 +0000 (14:43 -0400)]
drm/dp_dual_mode: Pass drm_device to drm_dp_dual_mode_set_tmds_output()

Another function that we'll need to pass a drm_device (and not drm_dp_aux)
down to so that we can move over to using drm_dbg_*().

Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423184309.207645-10-lyude@redhat.com
Reviewed-by: Dave Airlie <airlied@redhat.com>
3 years agodrm/dp_dual_mode: Pass drm_device to drm_dp_dual_mode_detect()
Lyude Paul [Fri, 23 Apr 2021 18:43:00 +0000 (14:43 -0400)]
drm/dp_dual_mode: Pass drm_device to drm_dp_dual_mode_detect()

Since we're about to be using drm_dbg_*() throughout the DP helpers, we'll
need to be able to access the DRM device in the dual mode DP helpers as
well. Note however that since drm_dp_dual_mode_detect() can be called with
DDC adapters that aren't part of a drm_dp_aux struct, we need to pass down
the drm_device to these functions instead of using drm_dp_aux.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423184309.207645-9-lyude@redhat.com
Reviewed-by: Dave Airlie <airlied@redhat.com>
3 years agodrm/dp: Always print aux channel name in logs
Lyude Paul [Fri, 23 Apr 2021 18:42:59 +0000 (14:42 -0400)]
drm/dp: Always print aux channel name in logs

Since we're about to convert everything in drm_dp_helper.c over to using
drm_dbg_*(), let's also make our logging more consistent in drm_dp_helper.c
while we're at it to ensure that we always print the name of the AUX
channel in question.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423184309.207645-8-lyude@redhat.com
Reviewed-by: Dave Airlie <airlied@redhat.com>
3 years agodrm/dp: Pass drm_dp_aux to drm_dp*_link_train_channel_eq_delay()
Lyude Paul [Fri, 23 Apr 2021 18:42:58 +0000 (14:42 -0400)]
drm/dp: Pass drm_dp_aux to drm_dp*_link_train_channel_eq_delay()

So that we can start using drm_dbg_*() for
drm_dp_link_train_channel_eq_delay() and
drm_dp_lttpr_link_train_channel_eq_delay().

Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423184309.207645-7-lyude@redhat.com
Reviewed-by: Dave Airlie <airlied@redhat.com>
3 years agodrm/dp: Pass drm_dp_aux to drm_dp_link_train_clock_recovery_delay()
Lyude Paul [Fri, 23 Apr 2021 18:42:57 +0000 (14:42 -0400)]
drm/dp: Pass drm_dp_aux to drm_dp_link_train_clock_recovery_delay()

So that we can start using drm_dbg_*() in
drm_dp_link_train_clock_recovery_delay().

Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423184309.207645-6-lyude@redhat.com
Reviewed-by: Dave Airlie <airlied@redhat.com>
3 years agodrm/dp: Clarify DP AUX registration time
Lyude Paul [Fri, 23 Apr 2021 18:42:56 +0000 (14:42 -0400)]
drm/dp: Clarify DP AUX registration time

The docs we had for drm_dp_aux_init() and drm_dp_aux_register() were mostly
correct, except for the fact that they made the assumption that all AUX
devices were grandchildren of their respective DRM devices. This is the
case for most normal GPUs, but is almost never the case with SoCs and
display bridges. So, let's fix this documentation to clarify when the right
time to use drm_dp_aux_init() or drm_dp_aux_register() is.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423184309.207645-5-lyude@redhat.com
Reviewed-by: Dave Airlie <airlied@redhat.com>
3 years agodrm/dp: Add backpointer to drm_device in drm_dp_aux
Lyude Paul [Fri, 23 Apr 2021 18:42:55 +0000 (14:42 -0400)]
drm/dp: Add backpointer to drm_device in drm_dp_aux

This is something that we've wanted for a while now: the ability to
actually look up the respective drm_device for a given drm_dp_aux struct.
This will also allow us to transition over to using the drm_dbg_*() helpers
for debug message printing, as we'll finally have a drm_device to reference
for doing so.

Note that there is one limitation with this - because some DP AUX adapters
exist as platform devices which are initialized independently of their
respective DRM devices, one cannot rely on drm_dp_aux->drm_dev to always be
non-NULL until drm_dp_aux_register() has been called. We make sure to point
this out in the documentation for struct drm_dp_aux.

v3:
* Add WARN_ON_ONCE() to drm_dp_aux_register() if drm_dev isn't filled out

Signed-off-by: Lyude Paul <lyude@redhat.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423184309.207645-4-lyude@redhat.com
Reviewed-by: Dave Airlie <airlied@redhat.com>
3 years agodrm/nouveau/kms/nv50-: Move AUX adapter reg to connector late register/early unregister
Lyude Paul [Fri, 23 Apr 2021 18:42:54 +0000 (14:42 -0400)]
drm/nouveau/kms/nv50-: Move AUX adapter reg to connector late register/early unregister

Since AUX adapters on nouveau have their respective DRM connectors as
parents, we need to make sure that we register then after their connectors.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423184309.207645-3-lyude@redhat.com
Reviewed-by: Dave Airlie <airlied@redhat.com>
3 years agodrm/bridge/cdns-mhdp8546: Register DP aux channel with userspace
Lyude Paul [Fri, 23 Apr 2021 18:42:53 +0000 (14:42 -0400)]
drm/bridge/cdns-mhdp8546: Register DP aux channel with userspace

Just adds some missing calls to
drm_dp_aux_register()/drm_dp_aux_unregister() for when we attach/detach the
bridge.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423184309.207645-2-lyude@redhat.com
Reviewed-by: Dave Airlie <airlied@redhat.com>
3 years agodrm/drm_file.c: Define drm_send_event_helper() as 'static'
Fabio M. De Francesco [Tue, 27 Apr 2021 10:55:03 +0000 (12:55 +0200)]
drm/drm_file.c: Define drm_send_event_helper() as 'static'

drm_send_event_helper() has not prototype, it has internal linkage and
therefore it should be defined with storage class 'static'.

Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20210427105503.10765-1-fmdefrancesco@gmail.com
3 years agodrm/bochs: Add screen blanking support
Takashi Iwai [Wed, 21 Apr 2021 08:08:59 +0000 (10:08 +0200)]
drm/bochs: Add screen blanking support

On bochs DRM driver, the execution of "setterm --blank force" results
in a frozen screen instead of a blank screen.  It's due to the lack of
the screen blanking support in its code.

Actually, the QEMU bochs vga side can switch to the blanking mode when
the bit 0x20 is cleared on VGA_ATT_IW register (0x3c0), which updates
ar_index in QEMU side.  So, essentially, we'd just need to clear the
bit at pipe disable callback; that's what this patch does essentially.

However, a tricky part is that the access via VGA_ATT_IW is done in
"flip-flop"; the first write is for index and the second write is for
the data like palette.  Meanwhile, in the current bochs DRM driver,
the flip-flop wasn't considered, and it calls only the register update
once with the value 0x20.

The spec and the actual VGA implementation in QEMU suggests that the
flip flop flag is discarded by reading the CRTC index register
(VGA_IS1_RC, 0x3da).  So, in this patch, we add the helper to read a
byte and the call to clear the flip flop flag before changing the
blank / unblank setup via VGA_ATT_IW register.

v1->v2:
* discard ar_flip_flop by reading 0x3da, add bochs_vga_readb()
* include video/vga.h for VGA register definitions
* move the blank/unblank code to bochs_hw_blank()

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20210421080859.14869-1-tiwai@suse.de
3 years agodrm/ast: Fixed CVE for DP501
KuoHsiang Chou [Wed, 21 Apr 2021 08:58:59 +0000 (16:58 +0800)]
drm/ast: Fixed CVE for DP501

[Bug][DP501]
If ASPEED P2A (PCI to AHB) bridge is disabled and disallowed for
CVE_2019_6260 item3, and then the monitor's EDID is unable read through
Parade DP501.
The reason is the DP501's FW is mapped to BMC addressing space rather
than Host addressing space.
The resolution is that using "pci_iomap_range()" maps to DP501's FW that
stored on the end of FB (Frame Buffer).
In this case, FrameBuffer reserves the last 2MB used for the image of
DP501.

Signed-off-by: KuoHsiang Chou <kuohsiang_chou@aspeedtech.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20210421085859.17761-1-kuohsiang_chou@aspeedtech.com
3 years agodrm/hx8357d: Avoid spamming logs if probe is deferred
Andy Shevchenko [Wed, 21 Apr 2021 16:31:57 +0000 (19:31 +0300)]
drm/hx8357d: Avoid spamming logs if probe is deferred

The GPIO request can fail and probe may be deferred. Thus,
the error message may be printed again and again. Avoid
this by replacing DRM_DEV_ERROR() by dev_err_probe().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210421163157.50949-7-andriy.shevchenko@linux.intel.com
3 years agodrm/ili9225: Avoid spamming logs if probe is deferred
Andy Shevchenko [Wed, 21 Apr 2021 16:31:56 +0000 (19:31 +0300)]
drm/ili9225: Avoid spamming logs if probe is deferred

The GPIO request can fail and probe may be deferred. Thus,
the error message may be printed again and again. Avoid
this by replacing DRM_DEV_ERROR() by dev_err_probe().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210421163157.50949-6-andriy.shevchenko@linux.intel.com
3 years agodrm/ili9341: Avoid spamming logs if probe is deferred
Andy Shevchenko [Wed, 21 Apr 2021 16:31:55 +0000 (19:31 +0300)]
drm/ili9341: Avoid spamming logs if probe is deferred

The GPIO request can fail and probe may be deferred. Thus,
the error message may be printed again and again. Avoid
this by replacing DRM_DEV_ERROR() by dev_err_probe().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210421163157.50949-5-andriy.shevchenko@linux.intel.com
3 years agodrm/ili9486: Avoid spamming logs if probe is deferred
Andy Shevchenko [Wed, 21 Apr 2021 16:31:54 +0000 (19:31 +0300)]
drm/ili9486: Avoid spamming logs if probe is deferred

The GPIO request can fail and probe may be deferred. Thus,
the error message may be printed again and again. Avoid
this by replacing DRM_DEV_ERROR() by dev_err_probe().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210421163157.50949-4-andriy.shevchenko@linux.intel.com
3 years agodrm/mi0283qt: Avoid spamming logs if probe is deferred
Andy Shevchenko [Wed, 21 Apr 2021 16:31:53 +0000 (19:31 +0300)]
drm/mi0283qt: Avoid spamming logs if probe is deferred

The GPIO request can fail and probe may be deferred. Thus,
the error message may be printed again and again. Avoid
this by replacing DRM_DEV_ERROR() by dev_err_probe().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210421163157.50949-3-andriy.shevchenko@linux.intel.com
3 years agodrm/st7586: Avoid spamming logs if probe is deferred
Andy Shevchenko [Wed, 21 Apr 2021 16:31:52 +0000 (19:31 +0300)]
drm/st7586: Avoid spamming logs if probe is deferred

The GPIO request can fail and probe may be deferred. Thus,
the error message may be printed again and again. Avoid
this by replacing DRM_DEV_ERROR() by dev_err_probe().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210421163157.50949-2-andriy.shevchenko@linux.intel.com
3 years agodrm/st7735r: Avoid spamming logs if probe is deferred
Andy Shevchenko [Wed, 21 Apr 2021 16:31:51 +0000 (19:31 +0300)]
drm/st7735r: Avoid spamming logs if probe is deferred

The GPIO request can fail and probe may be deferred. Thus,
the error message may be printed again and again. Avoid
this by replacing DRM_DEV_ERROR() by dev_err_probe().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210421163157.50949-1-andriy.shevchenko@linux.intel.com
3 years agodrm/gud: cleanup coding style a bit
Bernard Zhao [Fri, 2 Apr 2021 08:55:21 +0000 (01:55 -0700)]
drm/gud: cleanup coding style a bit

Fix coccicheck warning:
drivers/gpu/drm/gud/gud_internal.h:89:2-3: Unneeded semicolon
drivers/gpu/drm/gud/gud_internal.h:107:2-3: Unneeded semicolon

Signed-off-by: Bernard Zhao <bernard@vivo.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210402085523.76928-1-bernard@vivo.com
3 years agodrm/ast: Fix missing conversions to managed API
Takashi Iwai [Wed, 21 Apr 2021 17:04:58 +0000 (19:04 +0200)]
drm/ast: Fix missing conversions to managed API

The commit 7cbb93d89838 ("drm/ast: Use managed pci functions")
converted a few PCI accessors to the managed API and dropped the
manual pci_iounmap() calls, but it seems to have forgotten converting
pci_iomap() to the managed one.  It resulted in the leftover resources
after the driver unbind.  Let's fix them.

Fixes: 7cbb93d89838 ("drm/ast: Use managed pci functions")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20210421170458.21178-1-tiwai@suse.de
3 years agodrm: remove legacy drm_pci_alloc/free abstraction
Joseph Kogut [Fri, 23 Apr 2021 02:02:44 +0000 (19:02 -0700)]
drm: remove legacy drm_pci_alloc/free abstraction

The drm_pci_alloc/free abstraction of the dma-api is no longer required,
remove it.

Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423020248.3427369-2-joseph.kogut@gmail.com
3 years agodrm: remove usage of drm_pci_alloc/free
Joseph Kogut [Fri, 23 Apr 2021 02:02:43 +0000 (19:02 -0700)]
drm: remove usage of drm_pci_alloc/free

Remove usage of legacy dma-api abstraction in preparation for removal

Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423020248.3427369-1-joseph.kogut@gmail.com
3 years agoMerge drm/drm-next into drm-misc-next
Maxime Ripard [Mon, 26 Apr 2021 12:03:09 +0000 (14:03 +0200)]
Merge drm/drm-next into drm-misc-next

Christian needs some patches from drm/next

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
3 years agodrm: Remove DRM_KMS_FB_HELPER Kconfig option
Thomas Zimmermann [Thu, 15 Apr 2021 11:00:40 +0000 (13:00 +0200)]
drm: Remove DRM_KMS_FB_HELPER Kconfig option

It's only used by DRM_FBDEV_EMULATION, so inline it there.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20210415110040.23525-5-tzimmermann@suse.de
3 years agodrm/zte: Don't select DRM_KMS_FB_HELPER
Thomas Zimmermann [Thu, 15 Apr 2021 11:00:39 +0000 (13:00 +0200)]
drm/zte: Don't select DRM_KMS_FB_HELPER

Selecting DRM_FBDEV_EMULATION will include the correct settings for
fbdev emulation. Drivers should not override this.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20210415110040.23525-4-tzimmermann@suse.de