platform/kernel/linux-starfive.git
2 years agodrm/bridge: tc358767: Handle dsi_lanes == 0 as invalid
Marek Vasut [Thu, 19 May 2022 09:51:36 +0000 (11:51 +0200)]
drm/bridge: tc358767: Handle dsi_lanes == 0 as invalid

Handle empty data-lanes = < >; property, which translates to
dsi_lanes = 0 as invalid.

Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Fixes: bbfd3190b6562 ("drm/bridge: tc358767: Add DSI-to-DPI mode support")
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Jonas Karlman <jonas@kwiboo.se>
Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Maxime Ripard <maxime@cerno.tech>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Robert Foss <robert.foss@linaro.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220519095137.11896-1-marex@denx.de
2 years agodrm/dp: Export symbol / kerneldoc fixes for DP AUX bus
Douglas Anderson [Tue, 10 May 2022 19:29:41 +0000 (12:29 -0700)]
drm/dp: Export symbol / kerneldoc fixes for DP AUX bus

While working on the DP AUX bus code I found a few small things that
should be fixed. Namely the non-devm version of
of_dp_aux_populate_ep_devices() was missing an export. There was also
an extra blank line in a kerneldoc and a kerneldoc that incorrectly
documented a return value. Fix these.

Fixes: aeb33699fc2c ("drm: Introduce the DP AUX bus")
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220510122726.v3.1.Ia91f4849adfc5eb9da1eb37ba79aa65fb3c95a0f@changeid
2 years agodrm: Document the power requirements for DP AUX transfers
Douglas Anderson [Mon, 9 May 2022 23:18:09 +0000 (16:18 -0700)]
drm: Document the power requirements for DP AUX transfers

When doing DP AUX transfers there are two actors that need to be
powered in order for the DP AUX transfer to work: the DP source and
the DP sink. Commit bacbab58f09d ("drm: Mention the power state
requirement on side-channel operations") added some documentation
saying that the DP source is required to power itself up (if needed)
to do AUX transfers. However, that commit doesn't talk anything about
the DP sink.

For full fledged DP the sink isn't really a problem. It's expected
that if an external DP monitor isn't plugged in that attempting to do
AUX transfers won't work. It's also expected that if a DP monitor is
plugged in (and thus asserting HPD) then AUX transfers will work.

When we're looking at eDP, however, things are less obvious. Let's add
some documentation about expectations. Here's what we'll say:

1. We don't expect the DP AUX transfer function to power on an eDP
panel. If an eDP panel is physically connected but powered off then it
makes sense for the transfer to fail.

2. We'll document that the official way to power on a panel is via the
bridge chain, specifically by making sure that the panel's prepare
function has been called (which is called by
panel_bridge_pre_enable()). It's already specified in the kernel doc
of drm_panel_prepare() that this is the way to power the panel on and
also that after this call "it is possible to communicate with any
integrated circuitry via a command bus."

3. We'll also document that for code running in the panel driver
itself that it is legal for the panel driver to power itself up
however it wants (it doesn't need to officially call
drm_panel_pre_enable()) and then it can do AUX bus transfers. This is
currently the way that edp-panel works when it's running atop the DP
AUX bus.

NOTE: there was much discussion of all of this in response to v1 [1]
of this patch. A summary of that is:
* With the Intel i195 driver, apparently eDP panels do get powered
  up. We won't forbid this but it is expected that code that wants to
  run on a variety of platforms should ensure that the drm_panel's
  prepare() function has been called.
* There is at least a reasonable amount of agreement that the
  transfer() functions itself shouldn't be responsible for powering
  the panel. It's proposed that if we need the DP AUX dev nodes to be
  robust for eDP that the code handling the DP AUX dev nodes could
  handle powering the panel by ensuring that the panel's prepare()
  call was made. Potentially drm_dp_aux_dev_get_by_minor() could be a
  good place to do this. This is left as a future exercise. Until
  that's fixed the DP AUX dev nodes for eDP are probably best just
  used for debugging.
* If a panel could be in PSR and DP AUX via the dev node needs to be
  reliable then we need to be able to pull the panel out of PSR. On
  i915 this is also apparently handled as part of the transfer()
  function.

[1] https://lore.kernel.org/r/20220503162033.1.Ia8651894026707e4fa61267da944ff739610d180@changeid

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220509161733.v2.1.Ia8651894026707e4fa61267da944ff739610d180@changeid
2 years agodrm/probe-helper: For DP, add 640x480 if all other modes are bad
Douglas Anderson [Wed, 11 May 2022 22:58:08 +0000 (15:58 -0700)]
drm/probe-helper: For DP, add 640x480 if all other modes are bad

As per Displayport spec section 5.2.1.2 ("Video Timing Format") says
that all detachable sinks shall support 640x480 @60Hz as a fail safe
mode.

A DP compliance test expected us to utilize the above fact when all
modes it presented to the DP source were not achievable. It presented
only modes that would be achievable with more lanes and/or higher
speeds than we had available and expected that when we couldn't do
that then we'd fall back to 640x480 even though it didn't advertise
this size.

In order to pass the compliance test (and also support any users who
might fall into a similar situation with their display), we need to
add 640x480 into the list of modes. However, we don't want to add
640x480 all the time. Despite the fact that the DP spec says all sinks
_shall support_ 640x480, they're not guaranteed to support it
_well_. Continuing to read the spec you can see that the display is
not required to really treat 640x480 equal to all the other modes. It
doesn't need to scale or anything--just display the pixels somehow for
failsafe purposes. It should also be noted that it's not hard to find
a display hooked up via DisplayPort that _doesn't_ support 640x480 at
all. The HP ZR30w screen I'm sitting in front of has a native DP port
and doesn't work at 640x480. I also plugged in a tiny 800x480 HDMI
display via a DP to HDMI adapter and that screen definitely doesn't
support 640x480.

As a compromise solution, let's only add the 640x480 mode if:
* We're on DP.
* All other modes have been pruned.

This acknowledges that 640x480 might not be the best mode to use but,
since sinks are _supposed_ to support it, we will at least fall back
to it if there's nothing else.

Note that we _don't_ add higher resolution modes like 1024x768 in this
case. We only add those modes for a failed EDID read where we have no
idea what's going on. In the case where we've pruned all modes then
instead we only want 640x480 which is the only defined "Fail Safe"
resolution.

This patch originated in response to Kuogee Hsieh's patch [1].

[1] https://lore.kernel.org/r/1650671124-14030-1-git-send-email-quic_khsieh@quicinc.com

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Tested-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220511155749.v3.2.I4ac7f55aa446699f8c200a23c10463256f6f439f@changeid
2 years agodrm/probe-helper: Add helper for drm_helper_probe_single_connector_modes()
Douglas Anderson [Wed, 11 May 2022 22:58:07 +0000 (15:58 -0700)]
drm/probe-helper: Add helper for drm_helper_probe_single_connector_modes()

The drm_helper_probe_single_connector_modes() is a bit long. Let's
break a chunk off to update and validate modes. This helps avoid one
goto and also will allow us to more easily call the helper a second
time in a future patch without adding looping or another goto.

This change is intended to be a no-op change--just code movement.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20220511155749.v3.1.I2dd93486c6952bd52f2020904de0133970d11b29@changeid
2 years agodrm/gem: Warn on trying to use a non-existing framebuffer plane
Thomas Zimmermann [Tue, 17 May 2022 11:33:27 +0000 (13:33 +0200)]
drm/gem: Warn on trying to use a non-existing framebuffer plane

Warn if callers of drm_gem_fb_get_obj() try to use a GEM buffer for
a non-existing or unset plane.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Tested-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220517113327.26919-6-tzimmermann@suse.de
2 years agodrm/gem-vram: Ignore planes that are unused by framebuffer format
Thomas Zimmermann [Tue, 17 May 2022 11:33:26 +0000 (13:33 +0200)]
drm/gem-vram: Ignore planes that are unused by framebuffer format

Only handle color planes that exist in a framebuffer's color format.
Ignore non-existing planes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Tested-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220517113327.26919-5-tzimmermann@suse.de
2 years agodrm/gem-vram: Share code between GEM VRAM's _{prepare, cleanup}_fb()
Thomas Zimmermann [Tue, 17 May 2022 11:33:25 +0000 (13:33 +0200)]
drm/gem-vram: Share code between GEM VRAM's _{prepare, cleanup}_fb()

The error-recovery code in drm_gem_vram_plane_helper_prepare_fb() is of
the same pattern as drm_gem_vram_plane_helper_cleanup_fb(). Implement
both of them using an internal helper. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Acked-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220517113327.26919-4-tzimmermann@suse.de
2 years agodrm/gem: Ignore color planes that are unused by framebuffer format
Thomas Zimmermann [Tue, 17 May 2022 11:33:24 +0000 (13:33 +0200)]
drm/gem: Ignore color planes that are unused by framebuffer format

Only handle color planes that exist in a framebuffer's color format.
Ignore non-existing planes.

So far, several helpers assumed that all 4 planes are available and
silently ignored non-existing planes. This lead to subtil bugs with
uninitialized data in instances of struct iosys_map. [1]

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Tested-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Christian König <christian.koenig@amd.com>
Link: https://lore.kernel.org/dri-devel/20210730183511.20080-1-tzimmermann@suse.de/T/#md0172b10bb588d8f20f4f456e304f08d2a4505f7
Link: https://patchwork.freedesktop.org/patch/msgid/20220517113327.26919-3-tzimmermann@suse.de
2 years agodrm/gem: Share code between drm_gem_fb_{begin,end}_cpu_access()
Thomas Zimmermann [Tue, 17 May 2022 11:33:23 +0000 (13:33 +0200)]
drm/gem: Share code between drm_gem_fb_{begin,end}_cpu_access()

The error-recovery code in drm_gem_fb_begin() is of the same pattern
as drm_gem_fb_end(). Implement both of them using an internal helper.
No functional changes.

v2:
* print additional information in error message (Javier)
* fix commit description (Javier)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Tested-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220517113327.26919-2-tzimmermann@suse.de
2 years agodrm/meson: add YUV422 output support
Dongjin Kim [Mon, 16 May 2022 07:22:45 +0000 (07:22 +0000)]
drm/meson: add YUV422 output support

Support YUV422 output from the Amlogic Meson SoC VPU to the HDMI
controller. Without this YUV422 format out of the HDMI encoder
leads to using the dw-hdmi YUV444 to YUV422 color conversion which
gives wrong colors and a green line on the left edge of the screen.

Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
Tested-by: Furkan Kardame <f.kardame@manjaro.org>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
Tested-by: Dan Johansen <strit@manjaro.org>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220516072245.10745-1-christianshewitt@gmail.com
2 years agodrm/meson: Fix refcount leak in meson_encoder_hdmi_init
Miaoqian Lin [Wed, 11 May 2022 05:40:51 +0000 (09:40 +0400)]
drm/meson: Fix refcount leak in meson_encoder_hdmi_init

of_find_device_by_node() takes reference, we should use put_device()
to release it when not need anymore.
Add missing put_device() in error path to avoid refcount
leak.

Fixes: 0af5e0b41110 ("drm/meson: encoder_hdmi: switch to bridge DRM_BRIDGE_ATTACH_NO_CONNECTOR")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220511054052.51981-1-linmq006@gmail.com
2 years agodrm/udl: Set VGA connector
Thomas Zimmermann [Tue, 8 Feb 2022 14:31:52 +0000 (15:31 +0100)]
drm/udl: Set VGA connector

Set the connector type to VGA. The previously exported DVII type
isn't even supported by the driver.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220208143152.5846-1-tzimmermann@suse.de
2 years agodrm/mgag200: Split up connector's mode_valid helper
Thomas Zimmermann [Mon, 16 May 2022 13:43:43 +0000 (15:43 +0200)]
drm/mgag200: Split up connector's mode_valid helper

Split up the connector's mode_valid helper into a simple-pipe and a
mode-config helper. The simple-pipe helper tests for display-size
limits while the mode-config helper tests for memory-bandwidth limits.

Also add the mgag200_ prefix to mga_vga_calculate_mode_bandwidth() and
comment on the function's purpose.

The memory-bandwidth tests assume that the display uses 4 bytes per
pixel. The first models of G200SE-A only had 1.75 MiB of VRAM, which
limits these devices to 640x480-32.

v2:
* note the memory constraints on early G200SE-A

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220516134343.6085-8-tzimmermann@suse.de
2 years agodrm/mgag200: Test memory requirements in drm_mode_config_funcs.mode_valid
Thomas Zimmermann [Mon, 16 May 2022 13:43:42 +0000 (15:43 +0200)]
drm/mgag200: Test memory requirements in drm_mode_config_funcs.mode_valid

Test for a mode's memory requirements in the device-wide mode_valid
helper. For simplicify, always assume a 32-bit color format. While
some rejected modes would work with less colors, implementing this
is probably not worth the effort.

Also remove the memory-related test from the connector's mode_valid
helper. The test uses the bpp value that users can specify on the
kernel's command line. This value is unrelated and the test would
belong into atomic_check.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220516134343.6085-7-tzimmermann@suse.de
2 years agodrm/mgag200: Remove struct mga_connector
Thomas Zimmermann [Mon, 16 May 2022 13:43:41 +0000 (15:43 +0200)]
drm/mgag200: Remove struct mga_connector

struct mga_connector has outlived its purpose. Inline the rsp init
helper into the mode-config code and remove the data structure. No
functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220516134343.6085-6-tzimmermann@suse.de
2 years agodrm/mgag200: Switch I2C code to managed cleanup
Thomas Zimmermann [Mon, 16 May 2022 13:43:40 +0000 (15:43 +0200)]
drm/mgag200: Switch I2C code to managed cleanup

Store the I2C state within struct mga_device and switch I2C to
managed release. Simplifies the related code and lets us remove
mga_connector_destroy().

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220516134343.6085-5-tzimmermann@suse.de
2 years agodrm/mgag200: Implement connector's get_modes with helper
Thomas Zimmermann [Mon, 16 May 2022 13:43:39 +0000 (15:43 +0200)]
drm/mgag200: Implement connector's get_modes with helper

Provide drm_connector_helper_get_modes_from_ddc() to implement the
connector's get_modes callback. The new helper updates the connector
from DDC-provided EDID data.

v2:
* clear property if EDID is NULL in helper

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220516134343.6085-4-tzimmermann@suse.de
2 years agodrm/mgag200: Fail on I2C initialization errors
Thomas Zimmermann [Mon, 16 May 2022 13:43:38 +0000 (15:43 +0200)]
drm/mgag200: Fail on I2C initialization errors

Initialization of the I2C adapter was allowed to fail. The mgag200
driver would have continued without DDC support. Had this happened in
practice, it would have led to segmentation faults in the connector
code. Resolve this problem by failing driver initialization on I2C-
related errors.

v2:
* initialize 'ret' before drm_err() (kernel test robot)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220516134343.6085-3-tzimmermann@suse.de
2 years agodrm/mgag200: Acquire I/O lock while reading EDID
Thomas Zimmermann [Mon, 16 May 2022 13:43:37 +0000 (15:43 +0200)]
drm/mgag200: Acquire I/O lock while reading EDID

DDC operation conflicts with concurrent mode setting. Acquire the
driver's I/O lock in get_modes to prevent this. This change should
have been part of commit 931e3f3a0e99 ("drm/mgag200: Protect
concurrent access to I/O registers with lock"), but apparently got
lost somewhere.

v3:
* fix commit message to say 'drm/mgag200' (Jocelyn)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Fixes: 931e3f3a0e99 ("drm/mgag200: Protect concurrent access to I/O registers with lock")
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Jocelyn Falempe <jfalempe@redhat.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Dave Airlie <airlied@redhat.com>
Cc: dri-devel@lists.freedesktop.org
Link: https://patchwork.freedesktop.org/patch/msgid/20220516134343.6085-2-tzimmermann@suse.de
2 years agodrm/bridge: anx7625: Use DPI bus type
Xin Ji [Fri, 22 Apr 2022 08:47:18 +0000 (16:47 +0800)]
drm/bridge: anx7625: Use DPI bus type

As V4L2_FWNODE_BUS_TYPE_PARALLEL not properly descript for DPI
interface, this patch use new defined V4L2_FWNODE_BUS_TYPE_DPI for it.

Fixes: fd0310b6fe7d ("drm/bridge: anx7625: add MIPI DPI input feature")
Signed-off-by: Xin Ji <xji@analogixsemi.com>
Tested-by: Chen-Yu Tsai <wenst@chromium.org>
Acked-by: Robert Foss <robert.foss@linaro.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/20220422084720.959271-4-xji@analogixsemi.com
2 years agodt-bindings:drm/bridge:anx7625: add port@0 property
Xin Ji [Fri, 22 Apr 2022 08:47:17 +0000 (16:47 +0800)]
dt-bindings:drm/bridge:anx7625: add port@0 property

Add 'bus-type' and 'data-lanes' define, bus-type 7 for MIPI DPI
input, others for DSI input.

Signed-off-by: Xin Ji <xji@analogixsemi.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Acked-by: Robert Foss <robert.foss@linaro.org>
Signed-off-by: Robert Foss <robert.foss@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220422084720.959271-3-xji@analogixsemi.com
2 years agodrm/scheduler: Don't kill jobs in interrupt context
Dmitry Osipenko [Mon, 11 Apr 2022 22:15:36 +0000 (01:15 +0300)]
drm/scheduler: Don't kill jobs in interrupt context

Interrupt context can't sleep. Drivers like Panfrost and MSM are taking
mutex when job is released, and thus, that code can sleep. This results
into "BUG: scheduling while atomic" if locks are contented while job is
freed. There is no good reason for releasing scheduler's jobs in IRQ
context, hence use normal context to fix the trouble.

Cc: stable@vger.kernel.org
Fixes: 542cff7893a3 ("drm/sched: Avoid lockdep spalt on killing a processes")
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220411221536.283312-1-dmitry.osipenko@collabora.com
2 years agodrm: bridge: DRM_FSL_LDB should depend on ARCH_MXC
Geert Uytterhoeven [Mon, 9 May 2022 13:52:02 +0000 (15:52 +0200)]
drm: bridge: DRM_FSL_LDB should depend on ARCH_MXC

The Freescale i.MX8MP LDB bridge is only present on Freescale i.MX8MP
SoCs.  Hence add a dependency on ARCH_MXC, to prevent asking the user
about this driver when configuring a kernel without i.MX SoC support.

Fixes: 463db5c2ed4aed01 ("drm: bridge: ldb: Implement simple Freescale i.MX8MP LDB bridge")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Robert Foss <robert.foss@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/449e08ca791a3ca308de5477c1bdc1f6eb1b34e7.1652104211.git.geert+renesas@glider.be
2 years agodrm: bridge: icn6211: Register macro clean up
Marek Vasut [Sat, 30 Apr 2022 02:50:20 +0000 (04:50 +0200)]
drm: bridge: icn6211: Register macro clean up

Drop two unused register macros, ICN6211_MAX_REGISTER and MIPI_ATE_STATUS_1,
neither of which is used and where the later should be specified using macro
MIPI_ATE_STATUS(1) instead. Drop the _(n) underscore and keep only the (n)
part of register macros. No functional change.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Maxime Ripard <maxime@cerno.tech>
Cc: Robert Foss <robert.foss@linaro.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
To: dri-devel@lists.freedesktop.org
Signed-off-by: Robert Foss <robert.foss@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220430025020.640277-1-marex@denx.de
2 years agodrm/mgag200: Enable atomic gamma lut update
Jocelyn Falempe [Fri, 13 May 2022 08:49:00 +0000 (10:49 +0200)]
drm/mgag200: Enable atomic gamma lut update

Add support for atomic update of gamma lut.
With this patch the "Night light" feature of gnome3
is working properly on mgag200.

v2:
 - Add a default linear gamma function
 - renamed functions with mgag200 prefix
 - use format's 4cc code instead of bit depth
 - use better interpolation for 16bits gamma
 - remove legacy function mga_crtc_load_lut()
 - can't remove the call to drm_mode_crtc_set_gamma_size()
    because it doesn't work with userspace.
 - other small refactors

v3:
 - change mgag200_crtc_set_gamma*() argument
    to struct drm_format_info *format
 - fix printk format to %p4cc for 4cc and %zu for size_t
 - rebased to drm-misc-next.

Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20220513084900.1832381-1-jfalempe@redhat.com
2 years agodrm/client: Don't add new command-line mode
Thomas Zimmermann [Wed, 11 May 2022 18:31:25 +0000 (20:31 +0200)]
drm/client: Don't add new command-line mode

Don't add a mode for the kernel's command-line parameters from
within the DRM client code. Doing so can result in an unusable
display. If there's no compatible command-line mode, the client
will use one of the connector's preferred modes.

All mode creation and validation has to be performed by the
connector. When clients run, the connector's fill_modes callback
has already processed the kernel parameters and validated each
mode before adding it. The connector's mode list does not contain
invalid modes.

v2:
* grammar in commit message (Javier)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20220511183125.14294-4-tzimmermann@suse.de
2 years agodrm/client: Look for command-line modes first
Thomas Zimmermann [Wed, 11 May 2022 18:31:24 +0000 (20:31 +0200)]
drm/client: Look for command-line modes first

When picking a mode, first look for modes that have been specified
by the user on the kernel's command line. Only if that fails, use
the existing heuristic of picking a nearby mode from it's various
parameters.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20220511183125.14294-3-tzimmermann@suse.de
2 years agodrm: Always warn if user-defined modes are not supported
Thomas Zimmermann [Wed, 11 May 2022 18:31:23 +0000 (20:31 +0200)]
drm: Always warn if user-defined modes are not supported

Print a warning if a user-specifed display mode is not supported by
the display pipeline. Users specified the display mode on the kernel
command line with the use of the video= parameter. Setting an
unsupported mode will leave the console blank, so we should at least
let the user know why.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20220511183125.14294-2-tzimmermann@suse.de
2 years agodrm/rockchip: vop2: unlock on error path in vop2_crtc_atomic_enable()
Dan Carpenter [Mon, 9 May 2022 09:05:05 +0000 (12:05 +0300)]
drm/rockchip: vop2: unlock on error path in vop2_crtc_atomic_enable()

This error path needs an unlock before returning.

Fixes: 604be85547ce ("drm/rockchip: Add VOP2 driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/YnjZQRV9lpub2ET8@kili
2 years agodrm/panel: feiyang-fy07024di26a30d: make reset gpio optional
Peter Geis [Wed, 11 May 2022 11:35:15 +0000 (07:35 -0400)]
drm/panel: feiyang-fy07024di26a30d: make reset gpio optional

Some implementations do not use the reset signal, instead tying it to dvdd.
Make the reset gpio optional to permit this.

Signed-off-by: Peter Geis <pgwipeout@gmail.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20220511113517.4172962-3-pgwipeout@gmail.com
2 years agodt-bindings: display: panel: feiyang, fy07024di26a30d: make reset gpio optional
Peter Geis [Wed, 11 May 2022 11:35:14 +0000 (07:35 -0400)]
dt-bindings: display: panel: feiyang, fy07024di26a30d: make reset gpio optional

Some implementations do not use the reset signal, instead tying it to dvdd.
Make the reset gpio optional to permit this.

Signed-off-by: Peter Geis <pgwipeout@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20220511113517.4172962-2-pgwipeout@gmail.com
2 years agodrm/edid: convert version_greater() to drm_edid
Jani Nikula [Mon, 9 May 2022 12:03:24 +0000 (15:03 +0300)]
drm/edid: convert version_greater() to drm_edid

We'll need to propagate drm_edid everywhere. Also make version_greater()
a function for type safety.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/f1835a86294b392d075570001ed9009a48352670.1652097712.git.jani.nikula@intel.com
2 years agodrm/displayid: convert to drm_edid
Jani Nikula [Mon, 9 May 2022 12:03:23 +0000 (15:03 +0300)]
drm/displayid: convert to drm_edid

We'll need to propagate drm_edid everywhere.

v2: Rebase

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/a52a6882e87a4bb6b1670918f3aba13f9b52f6de.1652097712.git.jani.nikula@intel.com
2 years agodrm/edid: add drm_edid helper for drm_update_tile_info()
Jani Nikula [Mon, 9 May 2022 12:03:22 +0000 (15:03 +0300)]
drm/edid: add drm_edid helper for drm_update_tile_info()

We'll need to propagate drm_edid everywhere.

v2: Handle NULL EDID pointer (Ville, CI)

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/5b36683b656446a4d9a172d4dca1cf9aca08a48b.1652097712.git.jani.nikula@intel.com
2 years agodrm/edid: convert drm_edid_iter_begin() to drm_edid
Jani Nikula [Mon, 9 May 2022 12:03:21 +0000 (15:03 +0300)]
drm/edid: convert drm_edid_iter_begin() to drm_edid

We'll need to propagate drm_edid everywhere.

v2: Rebase

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/24dfb5fd9026ebef573bb55b368b94e56cae5cec.1652097712.git.jani.nikula@intel.com
2 years agodrm/edid: convert cea_db_iter_edid_begin() to drm_edid
Jani Nikula [Mon, 9 May 2022 12:03:20 +0000 (15:03 +0300)]
drm/edid: convert cea_db_iter_edid_begin() to drm_edid

We'll need to propagate drm_edid everywhere.

v2: Handle NULL drm_edid

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/7d9f060815086e1e4ea037dbfb9fd8ad54d1f25e.1652097712.git.jani.nikula@intel.com
2 years agodrm/edid: add drm_edid helper for drm_detect_monitor_audio()
Jani Nikula [Mon, 9 May 2022 12:03:19 +0000 (15:03 +0300)]
drm/edid: add drm_edid helper for drm_detect_monitor_audio()

We'll need to propagate drm_edid everywhere.

v2: Handle NULL EDID pointer (Ville, CI)

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/ea33244c473ace1bc72a7e87f97580f00705a683.1652097712.git.jani.nikula@intel.com
2 years agodrm/edid: add drm_edid helper for drm_detect_hdmi_monitor()
Jani Nikula [Mon, 9 May 2022 12:03:18 +0000 (15:03 +0300)]
drm/edid: add drm_edid helper for drm_detect_hdmi_monitor()

We'll need to propagate drm_edid everywhere.

v2: Handle NULL EDID pointer (Ville, CI)

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/2fbee0d7b544b44ef0866bb154beefac5d260bec.1652097712.git.jani.nikula@intel.com
2 years agodrm/edid: add drm_edid helper for drm_edid_to_speaker_allocation()
Jani Nikula [Mon, 9 May 2022 12:03:17 +0000 (15:03 +0300)]
drm/edid: add drm_edid helper for drm_edid_to_speaker_allocation()

We'll need to propagate drm_edid everywhere.'

v2: Handle NULL EDID pointer (Ville, CI)

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/770d095c93274969c4b86480e07044e16a7b5760.1652097712.git.jani.nikula@intel.com
2 years agodrm/edid: add drm_edid helper for drm_edid_to_sad()
Jani Nikula [Mon, 9 May 2022 12:03:16 +0000 (15:03 +0300)]
drm/edid: add drm_edid helper for drm_edid_to_sad()

We'll need to propagate drm_edid everywhere.

v2: Handle NULL EDID pointer (Ville, CI)

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/14aa1e44caa2e9c1b54c2f2a471d2fd7d3f62d5d.1652097712.git.jani.nikula@intel.com
2 years agodrm/edid: convert drm_for_each_detailed_block() to drm_edid
Jani Nikula [Mon, 9 May 2022 12:03:15 +0000 (15:03 +0300)]
drm/edid: convert drm_for_each_detailed_block() to drm_edid

We'll need to propagate drm_edid everywhere.

v2: Fix checkpatch warning on superfluous parens

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/bfd06d64235393012b2f3626d5764350de5f5321.1652097712.git.jani.nikula@intel.com
2 years agodrm/edid: convert get_monitor_name() to drm_edid
Jani Nikula [Mon, 9 May 2022 12:03:14 +0000 (15:03 +0300)]
drm/edid: convert get_monitor_name() to drm_edid

We'll need to propagate drm_edid everywhere.

v2: Drop incorrect NULL name check (Dan Carpenter)

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/c940aad14f323ef3a7907a0fb534011deb1589a9.1652097712.git.jani.nikula@intel.com
2 years agodrm/edid: convert mode_in_range() and drm_monitor_supports_rb() to drm_edid
Jani Nikula [Mon, 9 May 2022 12:03:13 +0000 (15:03 +0300)]
drm/edid: convert mode_in_range() and drm_monitor_supports_rb() to drm_edid

We'll need to propagate drm_edid everywhere.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/aac7dd14ce8c266491e9dfae12cad00fecdcd2e3.1652097712.git.jani.nikula@intel.com
2 years agodrm/edid: convert drm_mode_std() and children to drm_edid
Jani Nikula [Mon, 9 May 2022 12:03:12 +0000 (15:03 +0300)]
drm/edid: convert drm_mode_std() and children to drm_edid

We'll need to propagate drm_edid everywhere.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/9fb970d108a8bb666b87a590c74f480e0fd81cc8.1652097712.git.jani.nikula@intel.com
2 years agodrm/edid: convert drm_cvt_modes_for_range() to drm_edid
Jani Nikula [Mon, 9 May 2022 12:03:11 +0000 (15:03 +0300)]
drm/edid: convert drm_cvt_modes_for_range() to drm_edid

We'll need to propagate drm_edid everywhere.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/c2c251a504933debacf78e1382ae665ae490ed40.1652097712.git.jani.nikula@intel.com
2 years agodrm/edid: convert drm_gtf_modes_for_range() to drm_edid
Jani Nikula [Mon, 9 May 2022 12:03:10 +0000 (15:03 +0300)]
drm/edid: convert drm_gtf_modes_for_range() to drm_edid

We'll need to propagate drm_edid everywhere.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/b50377ce67fd3cee6628ea5865c80fa0fa7da990.1652097712.git.jani.nikula@intel.com
2 years agodrm/edid: convert drm_dmt_modes_for_range() to drm_edid
Jani Nikula [Mon, 9 May 2022 12:03:09 +0000 (15:03 +0300)]
drm/edid: convert drm_dmt_modes_for_range() to drm_edid

We'll need to propagate drm_edid everywhere.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/a8f393263225321e74f1e2884e81b3346d1adf20.1652097712.git.jani.nikula@intel.com
2 years agodrm/edid: convert drm_mode_detailed() to drm_edid
Jani Nikula [Mon, 9 May 2022 12:03:08 +0000 (15:03 +0300)]
drm/edid: convert drm_mode_detailed() to drm_edid

We'll need to propagate drm_edid everywhere.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/6e4625d529ee4bfb2f6ebbfef5fb707d65a0554d.1652097712.git.jani.nikula@intel.com
2 years agodrm/edid: convert struct detailed_mode_closure to drm_edid
Jani Nikula [Mon, 9 May 2022 12:03:07 +0000 (15:03 +0300)]
drm/edid: convert struct detailed_mode_closure to drm_edid

We'll need to propagate drm_edid everywhere.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/da4c927cd973766568a79ef044254fff20317e7f.1652097712.git.jani.nikula@intel.com
2 years agodrm/edid: convert drm_edid_connector_update() to drm_edid fully
Jani Nikula [Wed, 11 May 2022 09:26:50 +0000 (12:26 +0300)]
drm/edid: convert drm_edid_connector_update() to drm_edid fully

We'll need to propagate drm_edid everywhere.

v3: s/edid/drm_edid/ in comment too (Ankit)

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220511092650.4193330-1-jani.nikula@intel.com
2 years agodrm/edid: propagate drm_edid to drm_edid_to_eld()
Jani Nikula [Wed, 11 May 2022 09:23:49 +0000 (12:23 +0300)]
drm/edid: propagate drm_edid to drm_edid_to_eld()

We'll need to propagate drm_edid everywhere.

v3: Rebase

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220511092349.4186498-1-jani.nikula@intel.com
2 years agodrm/edid: keep propagating drm_edid to display info
Jani Nikula [Wed, 11 May 2022 09:21:04 +0000 (12:21 +0300)]
drm/edid: keep propagating drm_edid to display info

We'll need to propagate drm_edid everywhere.

v3: Update comment to refer to update_display_info() (Ankit)

v2: Use drm_edid_legacy_init()

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220511092104.4179637-1-jani.nikula@intel.com
2 years agodrm/edid: start propagating drm_edid to lower levels
Jani Nikula [Mon, 9 May 2022 12:03:03 +0000 (15:03 +0300)]
drm/edid: start propagating drm_edid to lower levels

We'll need to propagate drm_edid everywhere. This is a clunky start, but
a start nonetheless. We'll eventually convert all of the EDID parsing to
struct drm_edid.

Initially, we'll just create the struct drm_edid in stack. This will be
the compat layer for legacy struct edid code. In the future, we'll have
EDID read return drm_edid objects.

v2: Add legacy init helper.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/000452fddedbaf7f473ac25d4dde2502e60b8e39.1652097712.git.jani.nikula@intel.com
2 years agodrm/edid: add struct drm_edid container
Jani Nikula [Mon, 9 May 2022 12:03:02 +0000 (15:03 +0300)]
drm/edid: add struct drm_edid container

Introduce new opaque type struct drm_edid to encapsulate the EDID data
and the size allocated for it. The contents will be private to
drm_edid.c.

There are a number of reasons for adding a container around struct edid:

* struct edid is a raw blob pointer to data that usually originates
  outside of the kernel. Its size is contained within the structure.

* There's no way to attach meta information (such as allocated memory
  size) to struct edid.

* Validation of the EDID blob and its size become crucial, and it's
  spread all over the subsystem, with varying levels of accuracy.

* HDMI Forum has introduced an HF-EEODB extension that defines an
  override EDID size within an EDID extension. The size allocated for an
  EDID depends on whether the allocator understands the HF-EEODB
  extension. Given a struct edid *, it's impossible to know how much
  memory was actually allocated for it.

There are also some reasons for making the container type struct
drm_edid opaque and private to drm_edid.c:

* Have only one place for creating and parsing the EDID, to avoid
  duplicating bugs.

* Prepare for reading a pure DisplayID 2.0 from its own DDC address, and
  adding it within the same struct drm_edid container, transparently,
  and for all drivers.

* With the idea that the drm_edid objects are immutable during their
  lifetimes, it will be possible to refcount them and reduce EDID
  copying everywhere (this is left for future work).

Initially, just add the type. In follow-up, we'll start converting the
guts of drm_edid.c to use it, and finally add interfaces around it.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/f3ecabd8a219aea678ad00f7bcdecf77b27b3c78.1652097712.git.jani.nikula@intel.com
2 years agodrm/edid: convert drm_for_each_detailed_block() to edid iter
Jani Nikula [Mon, 9 May 2022 12:03:01 +0000 (15:03 +0300)]
drm/edid: convert drm_for_each_detailed_block() to edid iter

We have an iterator for this, use it. It does include the base block,
but its tag is 0 and will be skipped.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/a68718819a3dbfbdaaaddca7f73afa5ac6b33d07.1652097712.git.jani.nikula@intel.com
2 years agodrm/edid: use else-if in CTA extension parsing
Jani Nikula [Mon, 9 May 2022 12:03:00 +0000 (15:03 +0300)]
drm/edid: use else-if in CTA extension parsing

Only one of the conditions can be true.

Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/3a7ba2217134b0ab4c4c72e4333231a4e0616e88.1652097712.git.jani.nikula@intel.com
2 years agofbdev: vesafb: Allow to be built if COMPILE_TEST is enabled
Javier Martinez Canillas [Thu, 5 May 2022 12:04:18 +0000 (14:04 +0200)]
fbdev: vesafb: Allow to be built if COMPILE_TEST is enabled

The driver has runtime but no build time dependency with X86, so it can
be built for testing purposes if the COMPILE_TEST option is enabled.

This is useful to have more build coverage and make sure that the driver
is not affected by changes that could cause build regressions.

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20220505120419.314136-1-javierm@redhat.com
2 years agofbdev: Restart conflicting fb removal loop when unregistering devices
Javier Martinez Canillas [Wed, 11 May 2022 11:30:39 +0000 (13:30 +0200)]
fbdev: Restart conflicting fb removal loop when unregistering devices

Drivers that want to remove registered conflicting framebuffers prior to
register their own framebuffer, call to remove_conflicting_framebuffers().

This function takes the registration_lock mutex, to prevent a race when
drivers register framebuffer devices. But if a conflicting framebuffer
device is found, the underlaying platform device is unregistered and this
will lead to the platform driver .remove callback to be called. Which in
turn will call to unregister_framebuffer() that takes the same lock.

To prevent this, a struct fb_info.forced_out field was used as indication
to unregister_framebuffer() whether the mutex has to be grabbed or not.

But this could be unsafe, since the fbdev core is making assumptions about
what drivers may or may not do in their .remove callbacks. Allowing to run
these callbacks with the registration_lock held can cause deadlocks, since
the fbdev core has no control over what drivers do in their removal path.

A better solution is to drop the lock before platform_device_unregister(),
so unregister_framebuffer() can take it when called from the fbdev driver.
The lock is acquired again after the device has been unregistered and at
this point the removal loop can be restarted.

Since the conflicting framebuffer device has already been removed, the
loop would just finish when no more conflicting framebuffers are found.

Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20220511113039.1252432-1-javierm@redhat.com
2 years agodrm/bridge: tc358767: Add DSI-to-(e)DP mode support
Marek Vasut [Fri, 29 Apr 2022 20:56:44 +0000 (22:56 +0200)]
drm/bridge: tc358767: Add DSI-to-(e)DP mode support

Implement DSI-to-e(DP) mode, which is a mix of currently supported
DSI-to-DPI and DPI-to-(e)DP modes. The input side is configured as
either DSI or DPI, the DP AUX channel is registered for both input
side options, and the DSI host is attached for both DPI and (e)DP
output side options.

One notable detail is that the DSI-to-(e)DP mode requires the Pixel
PLL to be always enabled, which is not needed for DPI-to-(e)DP mode
which gets the matching clock direct from DPI Pixel Clock instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Jonas Karlman <jonas@kwiboo.se>
Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Maxime Ripard <maxime@cerno.tech>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Robert Foss <robert.foss@linaro.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Robert Foss <robert.foss@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220429205644.245480-2-marex@denx.de
2 years agodrm/bridge: tc358767: Factor out DSI and DPI RX enablement
Marek Vasut [Fri, 29 Apr 2022 20:56:43 +0000 (22:56 +0200)]
drm/bridge: tc358767: Factor out DSI and DPI RX enablement

Factor out register programming to configure the chip video RX side for
reception of video data from DSI or DPI. This is particularly useful in
the (e)DP output mode, where the video data can be received from either
DPI or DSI. While only the former is supported in (e)DP output mode so
far, this patch is added in preparation for addition of the later.

There is a change in the order or register programming in case of the
DSI-to-DPI mode. The DSI RX side is now programmed and enabled all in
one place after the output mode has been configured. Before this change,
the DSI RX has been programmed before the output mode has been set and
only enabled afterward. The order makes no difference however, since the
DSI RX is only enabled at the end either way.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Jonas Karlman <jonas@kwiboo.se>
Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Maxime Ripard <maxime@cerno.tech>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Robert Foss <robert.foss@linaro.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Robert Foss <robert.foss@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220429205644.245480-1-marex@denx.de
2 years agodrm/mgag200: Warn once if trying to set start address on broken hardware.
Jocelyn Falempe [Wed, 4 May 2022 13:40:26 +0000 (15:40 +0200)]
drm/mgag200: Warn once if trying to set start address on broken hardware.

Some MGA200 hardware is broken and can't use a start address > 0.

v2: Warn if startaddr is not 0, and hw doesn't support it.
  (instead of removing MGAG200_FLAG_HW_BUG_NO_STARTADD)

Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20220504134026.283417-4-jfalempe@redhat.com
2 years agodrm/mgag200: Optimize damage clips
Jocelyn Falempe [Wed, 4 May 2022 13:40:25 +0000 (15:40 +0200)]
drm/mgag200: Optimize damage clips

When there are multiple damage clips, previous code merged them into one
big rectangle. As the Matrox memory is very slow, it's faster to copy each
damage clip.

Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20220504134026.283417-2-jfalempe@redhat.com
2 years agodrm/mgag200: Add FB_DAMAGE_CLIPS support
Jocelyn Falempe [Wed, 4 May 2022 13:40:24 +0000 (15:40 +0200)]
drm/mgag200: Add FB_DAMAGE_CLIPS support

The driver does support damage clips, but doesn't advertise it.
So when running gnome/wayland on Matrox hardware, the full frame is
copied to the slow Matrox memory, which leads to very poor performances.

Add drm_plane_enable_fb_damage_clips() to advertise this capability to
userspace.

With this patch, gnome/wayland becomes usable on Matrox GPU.

Suggested-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20220504134026.283417-2-jfalempe@redhat.com
2 years agoMAINTAINERS: add Melissa to V3D maintainers
Melissa Wen [Fri, 29 Apr 2022 19:33:30 +0000 (18:33 -0100)]
MAINTAINERS: add Melissa to V3D maintainers

I've been contributing to v3d through improvements, reviews, testing,
debugging, etc. So, I'm adding myself as a co-maintainer of the V3D
driver.

Signed-off-by: Melissa Wen <mwen@igalia.com>
Acked-by: Juan A. Suarez <jasuarez@igalia.com>
Acked-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20220429193317.ol3u4e5jpt5jucox@mail.igalia.com
2 years agodrm/bridge: cdns-dsi: Add support for pre_enable and post_enable control functions.
Jayshri Pawar [Mon, 11 Apr 2022 14:06:06 +0000 (16:06 +0200)]
drm/bridge: cdns-dsi: Add support for pre_enable and post_enable control functions.

Add support for pre_enable and post_enable drm bridge control functions.
Making sure that host to be prepared before panel is powered up,
for the panels like TC358762.

Signed-off-by: Jayshri Pawar <jpawar@cadence.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/20220411140606.15654-1-jpawar@cadence.com
2 years agodrm/todo: Add entry for converting kselftests to kunit
Javier Martinez Canillas [Mon, 9 May 2022 13:08:46 +0000 (15:08 +0200)]
drm/todo: Add entry for converting kselftests to kunit

Many of the kselftests in DRM can be converted to kunit tests instead,
since that framework is more suitable for unit testing.

Suggested-by: Maxime Ripard <maxime@cerno.tech>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Acked-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20220509130846.694397-1-javierm@redhat.com
2 years agoMAINTAINERS: Add simpledrm driver co-maintainer
Javier Martinez Canillas [Thu, 5 May 2022 17:26:10 +0000 (19:26 +0200)]
MAINTAINERS: Add simpledrm driver co-maintainer

Thomas asked me to serve as co-maintainer for the simpledrm driver.

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20220505172610.338299-1-javierm@redhat.com
2 years agodrm/amdgpu: move internal vram_mgr function into the C file
Christian König [Tue, 10 May 2022 11:26:46 +0000 (13:26 +0200)]
drm/amdgpu: move internal vram_mgr function into the C file

No need to have those in the header.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220510113649.879821-2-christian.koenig@amd.com
2 years agodrm/amdgpu: fix start calculation in amdgpu_vram_mgr_new
Christian König [Tue, 10 May 2022 10:52:05 +0000 (12:52 +0200)]
drm/amdgpu: fix start calculation in amdgpu_vram_mgr_new

We still need to calculate a virtual start address for the resource to
aid checking of it is visible or not. Only matters on small BAR systems,
but better save than sorry.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220510113649.879821-1-christian.koenig@amd.com
2 years agodrm/amdgpu: switch DM to atomic fence helpers v2
Christian König [Mon, 9 May 2022 07:47:12 +0000 (09:47 +0200)]
drm/amdgpu: switch DM to atomic fence helpers v2

This gives us the standard atomic implicit and explicit fencing rules.

v2: move the wait to amdgpu_dm_atomic_commit_tail

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Cc: Roman Li <Roman.Li@amd.com>
Cc: Qingqing Zhuo <qingqing.zhuo@amd.com>
Cc: Jude Shih <shenshih@amd.com>
Cc: Wayne Lin <Wayne.Lin@amd.com>
Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220509074712.163899-1-christian.koenig@amd.com
2 years agodrm/bridge: simplify the return expression of ps8640_bridge_host_attach
Minghao Chi [Fri, 29 Apr 2022 05:51:45 +0000 (05:51 +0000)]
drm/bridge: simplify the return expression of ps8640_bridge_host_attach

Simplify the return expression.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220429055145.3852271-1-chi.minghao@zte.com.cn
2 years agodma-buf: add the name field to the table header
Yuanzheng Song [Thu, 28 Apr 2022 06:39:24 +0000 (06:39 +0000)]
dma-buf: add the name field to the table header

'cat /sys/kernel/debug/dma_buf/bufinfo' will print the Dma-buf
Objects' information when the CONFIG_DEBUG_FS=y.
However, the printed table header information does not contain
the name field. So we need to add the name field to the table
header and use the '<none>' to replace the empty buf_obj->name.

Signed-off-by: Yuanzheng Song <songyuanzheng@huawei.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220428063924.3570409-1-songyuanzheng@huawei.com
2 years agodrm/ttm: move default BO destructor into VMWGFX v2
Christian König [Fri, 18 Feb 2022 09:05:40 +0000 (10:05 +0100)]
drm/ttm: move default BO destructor into VMWGFX v2

It's the only driver using this.

v2: use BUG_ON() in vmw_bo_create() as suggested by Zack

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220329110243.6335-5-christian.koenig@amd.com
2 years agodrm/rockchip: Fix spelling mistake "aligened" -> "aligned"
Colin Ian King [Thu, 5 May 2022 11:10:44 +0000 (12:10 +0100)]
drm/rockchip: Fix spelling mistake "aligened" -> "aligned"

There is a spelling mistake in a drm_err message. Fix it.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20220505111044.374174-1-colin.i.king@gmail.com
2 years agodrm/rockchip: remove unneeded semicolon from vop2 driver
Yang Li [Thu, 5 May 2022 23:26:59 +0000 (07:26 +0800)]
drm/rockchip: remove unneeded semicolon from vop2 driver

Eliminate the following coccicheck warning:
./drivers/gpu/drm/rockchip/rockchip_drm_vop2.c:1476:2-3: Unneeded
semicolon

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20220505232659.4405-1-yang.lee@linux.alibaba.com
2 years agodrm/rockchip: Fix Kconfig dependencies for display-port encoders
Ren Zhijie [Sat, 7 May 2022 10:09:10 +0000 (18:09 +0800)]
drm/rockchip: Fix Kconfig dependencies for display-port encoders

The DP-helper module has been replaced by the display-helper module.
So the driver have to select it.

Reported-by: Hulk Robot <hulkci@huawei.com>
Fixes: 1e0f66420b13("drm/display: Introduce a DRM display-helper module")
Signed-off-by: Ren Zhijie <renzhijie2@huawei.com>
Reviewed-by: Andy Yan <andy.yan@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20220507100910.93705-1-renzhijie2@huawei.com
2 years agodt-bindings: display: bridge: ldb: Fill in reg property
Marek Vasut [Wed, 4 May 2022 01:26:01 +0000 (03:26 +0200)]
dt-bindings: display: bridge: ldb: Fill in reg property

Add missing reg and reg-names properties for both 'LDB_CTRL'
and 'LVDS_CTRL' registers.

Fixes: 463db5c2ed4ae ("drm: bridge: ldb: Implement simple Freescale i.MX8MP LDB bridge")
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Maxime Ripard <maxime@cerno.tech>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Robby Cai <robby.cai@nxp.com>
Cc: Robert Foss <robert.foss@linaro.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: devicetree@vger.kernel.org
To: dri-devel@lists.freedesktop.org
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Robert Foss <robert.foss@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220504012601.423644-1-marex@denx.de
2 years agodrm/bridge: nwl-dsi: Set PHY mode in nwl_dsi_mode_set()
Liu Ying [Tue, 19 Apr 2022 01:08:48 +0000 (09:08 +0800)]
drm/bridge: nwl-dsi: Set PHY mode in nwl_dsi_mode_set()

The Northwest Logic MIPI DSI host controller embedded in i.MX8qxp
works with a Mixel MIPI DPHY + LVDS PHY combo to support either
a MIPI DSI display or a LVDS display.  So, this patch calls
phy_set_mode() from nwl_dsi_mode_set() to set PHY mode to MIPI DPHY
explicitly.

Cc: Guido Günther <agx@sigxcpu.org>
Cc: Robert Chiras <robert.chiras@nxp.com>
Cc: Martin Kepplinger <martin.kepplinger@puri.sm>
Cc: Andrzej Hajda <andrzej.hajda@intel.com>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
Cc: Jonas Karlman <jonas@kwiboo.se>
Cc: Jernej Skrabec <jernej.skrabec@gmail.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: NXP Linux Team <linux-imx@nxp.com>
Signed-off-by: Liu Ying <victor.liu@nxp.com>
Acked-by: Robert Foss <robert.foss@linaro.org>
Reviewed-by: Guido Günther <agx@sigxcpu.org>
Signed-off-by: Guido Günther <agx@sigxcpu.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220419010852.452169-2-victor.liu@nxp.com
2 years agodrm/nouveau/gr/gf100-: Clean up some inconsistent indenting
Jiapeng Chong [Thu, 5 May 2022 08:13:45 +0000 (16:13 +0800)]
drm/nouveau/gr/gf100-: Clean up some inconsistent indenting

Eliminate the follow smatch warning:

drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c:1925
gf100_gr_oneinit_tiles() warn: inconsistent indenting.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220505081345.89762-1-jiapeng.chong@linux.alibaba.com
2 years agodrm/edid: sunset drm_find_cea_extension()
Jani Nikula [Tue, 3 May 2022 09:24:05 +0000 (12:24 +0300)]
drm/edid: sunset drm_find_cea_extension()

Convert drm_find_cea_extension() to a predicate function to check if the
EDID has a CTA extension or a DisplayID CTA data block. This is mainly
to avoid adding new users that only find the first CTA extension.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/a5bf228942e6bd0fc70d5cf7a14c249a14a7afcd.1651569697.git.jani.nikula@intel.com
2 years agodrm/edid: skip CTA extension scan in drm_edid_to_eld() just for CTA rev
Jani Nikula [Tue, 3 May 2022 09:24:04 +0000 (12:24 +0300)]
drm/edid: skip CTA extension scan in drm_edid_to_eld() just for CTA rev

The DisplayID CTA data block version does not necessarily match the CTA
revision. Simplify by postponing drm_edid_to_eld() slightly, and reusing
the CTA revision extracted by drm_parse_cea_ext().

By not bailing out early in drm_edid_to_eld() we may end up filling
meaningless data to the ELD. However, the main decision for audio is not
the ELD, but rather drm_detect_monitor_audio() called by drivers.

(Arguably a future cleanup could do that in drm_add_edid_modes() and
cache the result in the connector.)

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/163ebbfd765066acbfc267256fb3b67fc711a78d.1651569697.git.jani.nikula@intel.com
2 years agodrm/edid: detect color formats and CTA revision in all CTA extensions
Jani Nikula [Thu, 5 May 2022 10:52:42 +0000 (13:52 +0300)]
drm/edid: detect color formats and CTA revision in all CTA extensions

Convert drm_find_cea_extension() to EDID block iterator in color format
and CTA revision detection. Detect them in all CTA extensions.

Also parse CTA Data Blocks in DisplayID even if there's no CTA EDID
extension.

v2:
- Don't assume DRM_COLOR_FORMAT_RGB444 support if there's only DisplayID
  CTA Data Blocks (Ville)

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220505105242.1198521-1-jani.nikula@intel.com
2 years agodrm/edid: detect basic audio in all CEA extensions
Jani Nikula [Tue, 3 May 2022 09:24:02 +0000 (12:24 +0300)]
drm/edid: detect basic audio in all CEA extensions

Convert drm_find_cea_extension() to EDID block iterator in basic audio
detection. Detect basic audio in all CEA extensions.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/59481d0397de4b91b3e6ea665882334e92538f40.1651569697.git.jani.nikula@intel.com
2 years agodrm/edid: restore some type safety to cea_db_*() functions
Jani Nikula [Tue, 3 May 2022 09:24:01 +0000 (12:24 +0300)]
drm/edid: restore some type safety to cea_db_*() functions

During the transition, we accepted a void pointer for a poor C
programmer's version of polymorphism. Switch the functions to use struct
cea_db * to regain some more type safety.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/c6ad496cdadea1bb598711a65ef536f4a43b74a7.1651569697.git.jani.nikula@intel.com
2 years agodrm/edid: sunset the old unused cea data block iterators
Jani Nikula [Tue, 3 May 2022 09:24:00 +0000 (12:24 +0300)]
drm/edid: sunset the old unused cea data block iterators

All CTA data block iteration has now been converted to the new cea db
iterators.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/a5b35ed0e711bd874f76ae87ee0b70150d0a77c4.1651569697.git.jani.nikula@intel.com
2 years agodrm/edid: convert drm_edid_to_eld() to use cea db iter
Jani Nikula [Tue, 3 May 2022 09:23:59 +0000 (12:23 +0300)]
drm/edid: convert drm_edid_to_eld() to use cea db iter

Iterate through all CTA data blocks across all CTA extensions and
DisplayID data blocks. This may gather more data than before, and if
there's duplicated data, some is overwritten by whichever comes last.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/8bdc67aa731857111eddd08a9c192d41d40b5f5a.1651569697.git.jani.nikula@intel.com
2 years agodrm/edid: convert drm_parse_cea_ext() to use cea db iter
Jani Nikula [Tue, 3 May 2022 09:23:58 +0000 (12:23 +0300)]
drm/edid: convert drm_parse_cea_ext() to use cea db iter

Iterate through all CTA data blocks across all CTA Extensions and
DisplayID data blocks.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/7400792525c13f58652f288b891d6057637ed4c8.1651569697.git.jani.nikula@intel.com
2 years agodrm/edid: convert drm_detect_monitor_audio() to use cea db iter
Jani Nikula [Tue, 3 May 2022 09:23:57 +0000 (12:23 +0300)]
drm/edid: convert drm_detect_monitor_audio() to use cea db iter

Iterate through all CEA data blocks.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/a7f0c380da9526f8dd6f758d7a748bca7b4da6ce.1651569697.git.jani.nikula@intel.com
2 years agodrm/edid: convert drm_detect_hdmi_monitor() to use cea db iter
Jani Nikula [Tue, 3 May 2022 09:23:56 +0000 (12:23 +0300)]
drm/edid: convert drm_detect_hdmi_monitor() to use cea db iter

Iterate through all CTA data blocks, not just the first CTA extension.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/b867e7b628189d2f8fa7eac5b9aa701892724711.1651569697.git.jani.nikula@intel.com
2 years agodrm/edid: convert drm_edid_to_sad() to use cea db iter
Jani Nikula [Tue, 3 May 2022 09:23:55 +0000 (12:23 +0300)]
drm/edid: convert drm_edid_to_sad() to use cea db iter

Use the cea db iterator for short audio descriptors. We'll still stop at
the first audio data block, but not at the first CTA Extension if that
doesn't have the info.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/237e4b1de1567903d37ce1d1bb830020b8fd6690.1651569697.git.jani.nikula@intel.com
2 years agodrm/edid: convert drm_edid_to_speaker_allocation() to use cea db iter
Jani Nikula [Tue, 3 May 2022 09:23:54 +0000 (12:23 +0300)]
drm/edid: convert drm_edid_to_speaker_allocation() to use cea db iter

Use the cea db iterator for speaker allocation. We'll still stop at the
first speaker data block, but not at the first CTA extension if that
doesn't have the info.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/0b9e7f136854055a14b826097160fe0b43b9f3d1.1651569697.git.jani.nikula@intel.com
2 years agodrm/edid: convert add_cea_modes() to use cea db iter
Jani Nikula [Tue, 3 May 2022 09:23:53 +0000 (12:23 +0300)]
drm/edid: convert add_cea_modes() to use cea db iter

Iterate through all CTA EDID extension blocks and DisplayID CTA data
blocks to add CEA modes.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/dfa2d79db61d5eea543bef7aca7d80da3e71f99d.1651569697.git.jani.nikula@intel.com
2 years agodrm/edid: clean up cea_db_is_*() functions
Jani Nikula [Tue, 3 May 2022 09:23:52 +0000 (12:23 +0300)]
drm/edid: clean up cea_db_is_*() functions

Abstract helpers for matching vendor data blocks and extended tags, and
use them to simplify all the cea_db_is_*() functions.

Take void pointer as parameter to allow transitional use for both u8 *
and struct cea_db *.

v2: Remove superfluous parens (Ville)

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/b6bb813afc35c763e744c6cdb4a787da3adf910b.1651569697.git.jani.nikula@intel.com
2 years agodrm/edid: add iterator for CTA data blocks
Jani Nikula [Tue, 3 May 2022 09:23:51 +0000 (12:23 +0300)]
drm/edid: add iterator for CTA data blocks

Add an iterator for CTA Data Blocks across EDID CTA Extensions and
DisplayID CTA Data Blocks.

v2: Update references, note why we can trust displayid ranges (Ville)

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/37fdd2d9eabc73aaa9f95c56246dc47aea0e8e4e.1651569697.git.jani.nikula@intel.com
2 years agodrm/edid: add iterator for EDID base and extension blocks
Jani Nikula [Tue, 3 May 2022 09:23:50 +0000 (12:23 +0300)]
drm/edid: add iterator for EDID base and extension blocks

Add an iterator abstraction for going through all the EDID blocks.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/ce02778b353b906c928268de9d7569d493a9be5d.1651569697.git.jani.nikula@intel.com
2 years agodrm/edid: clean up CTA data block tag definitions
Jani Nikula [Tue, 3 May 2022 09:23:49 +0000 (12:23 +0300)]
drm/edid: clean up CTA data block tag definitions

Add prefixed names, group, sort, add references.

v2:
- Updated references to CTA-861-H
- s/CEA/CTA/ in data block macros

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/c66cc3adeb375f5e60d1a8f91b41580d8ab67442.1651569697.git.jani.nikula@intel.com
2 years agodrm/edid: rename HDMI Forum VSDB to SCDS
Jani Nikula [Tue, 3 May 2022 09:23:48 +0000 (12:23 +0300)]
drm/edid: rename HDMI Forum VSDB to SCDS

The HDMI spec talks about SCDS, Sink Capability Data Structure, exposed
via HF-VSDB or HF-SCDB. Rename VSDB to SCDS.

Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/f8230e1893400e9a9c5829041a8ab36349182a54.1651569697.git.jani.nikula@intel.com
2 years agodrm/edid: check for HF-SCDB block
Lee Shawn C [Tue, 3 May 2022 09:23:47 +0000 (12:23 +0300)]
drm/edid: check for HF-SCDB block

Find HF-SCDB information in CEA extensions block. And retrieve
Max_TMDS_Character_Rate that support by sink device.

v2: HF-SCDB and HF-VSDBS carry the same SCDS data. Reuse
    drm_parse_hdmi_forum_vsdb() to parse this packet.

Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Cc: intel-gfx <intel-gfx@lists.freedesktop.org>
Signed-off-by: Lee Shawn C <shawn.c.lee@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/2bf7110cdb56d5dda311480787faf472c9802de4.1651569697.git.jani.nikula@intel.com
2 years agodrm/edid: reset display info in drm_add_edid_modes() for NULL edid
Jani Nikula [Tue, 3 May 2022 09:23:46 +0000 (12:23 +0300)]
drm/edid: reset display info in drm_add_edid_modes() for NULL edid

If a NULL edid gets passed to drm_add_edid_modes(), we should probably
also reset the display info.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/2ac1c55f94a08d5e72c0b518d956a11002ec85c1.1651569697.git.jani.nikula@intel.com