linux_dsm_epyc7002/drivers/gpu/drm
Samuel Holland 215be713d0
drm/sun4i: dsi: Remove incorrect use of runtime PM
The driver currently uses runtime PM to perform some of the module
initialization and cleanup. This has three problems:

1) There is no Kconfig dependency on CONFIG_PM, so if runtime PM is
   disabled, the driver will not work at all, since the module will
   never be initialized.

2) The driver does not ensure that the device is suspended when
   sun6i_dsi_probe() fails or when sun6i_dsi_remove() is called. It
   simply disables runtime PM. From the docs of pm_runtime_disable():

      The device can be either active or suspended after its runtime PM
      has been disabled.

   And indeed, the device will likely still be active if sun6i_dsi_probe
   fails. For example, if the panel driver is not yet loaded, we have
   the following sequence:

   sun6i_dsi_probe()
      pm_runtime_enable()
      mipi_dsi_host_register()
         of_mipi_dsi_device_add(child)
            ...device_add()...
               __device_attach()
                 pm_runtime_get_sync(dev->parent) -> Causes resume
                 bus_for_each_drv()
                    __device_attach_driver() -> No match for panel
                 pm_runtime_put(dev->parent) -> Async idle request
      component_add()
         __component_add()
            try_to_bring_up_masters()
               try_to_bring_up_master()
                  sun4i_drv_bind()
                     component_bind_all()
                        component_bind()
                           sun6i_dsi_bind() -> Fails with -EPROBE_DEFER
      mipi_dsi_host_unregister()
      pm_runtime_disable()
         __pm_runtime_disable()
            __pm_runtime_barrier() -> Idle request is still pending
               cancel_work_sync()  -> DSI host is *not* suspended!

   Since the device is not suspended, the clock and regulator are never
   disabled. The imbalance causes a WARN at devres free time.

3) The driver relies on being suspended when sun6i_dsi_encoder_enable()
   is called. The resume callback has a comment that says:

      Some part of it can only be done once we get a number of
      lanes, see sun6i_dsi_inst_init

   And then part of the resume callback only runs if dsi->device is not
   NULL (that is, if sun6i_dsi_attach() has been called). However, as
   the above call graph shows, the resume callback is guaranteed to be
   called before sun6i_dsi_attach(); it is called before child devices
   get their drivers attached.

   Therefore, part of the controller initialization will only run if the
   device is suspended between the calls to mipi_dsi_host_register() and
   component_add() (which ends up calling sun6i_dsi_encoder_enable()).
   Again, as shown by the above call graph, this is not the case. It
   appears that the controller happens to work because it is still
   initialized by the bootloader.

   Because the connector is hardcoded to always be connected, the
   device's runtime PM reference is not dropped until system suspend,
   when sun4i_drv_drm_sys_suspend() ends up calling
   sun6i_dsi_encoder_disable(). However, that is done as a system sleep
   PM hook, and at that point the system PM core has already taken
   another runtime PM reference, so sun6i_dsi_runtime_suspend() is
   not called. Likewise, by the time the PM core releases its reference,
   sun4i_drv_drm_sys_resume() has already re-enabled the encoder.

   So after system suspend and resume, we have *still never called*
   sun6i_dsi_inst_init(), and now that the rest of the display pipeline
   has been reset, the DSI host is unable to communicate with the panel,
   causing VBLANK timeouts.

Fix all of these issues by inlining the runtime PM hooks into the
encoder enable/disable functions, which are guaranteed to run after a
panel is attached. This allows sun6i_dsi_inst_init() to be called
unconditionally. Furthermore, this causes the hardware to be turned off
during system suspend and reinitialized on resume, which was not
happening before.

Fixes: 133add5b5a ("drm/sun4i: Add Allwinner A31 MIPI-DSI controller support")
Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20200211072858.30784-4-samuel@sholland.org
2020-02-14 16:25:59 +01:00
..
amd drm/amdgpu: Convert to CRTC VBLANK callbacks 2020-02-13 13:08:13 +01:00
arc drm/arc: Remove sending of vblank event 2020-01-30 08:57:22 +01:00
arm drm-misc-next for v5.6: 2020-01-03 11:43:44 +10:00
armada drm: constify fb ops across all drivers 2019-12-05 10:57:42 +02:00
aspeed
ast drm/vram: Add helpers to validate a display mode's memory requirements 2020-02-06 10:32:54 +01:00
atmel-hlcdc Revert "drm: atmel-hlcdc: enable sys_clk during initalization." 2020-01-06 19:54:27 +01:00
bochs drm/bochs: add drm_driver.release callback. 2020-02-12 10:24:08 +01:00
bridge drm/bridge: ti-sn65dsi86: Avoid invalid rates 2020-02-13 10:22:05 +01:00
cirrus drm/cirrus: add drm_driver.release callback. 2020-02-12 10:24:08 +01:00
etnaviv drm-misc-next for v5.6: 2020-01-03 11:43:44 +10:00
exynos drm/exynos: dsi: Fix bridge chain handling 2020-01-08 09:09:48 +01:00
fsl-dcu drm/panel: decouple connector from drm_panel 2019-12-09 22:57:26 +01:00
gma500 drm/gma500: Convert to CRTC VBLANK callbacks 2020-02-13 13:08:13 +01:00
hisilicon drm/hisilicon/hibmc: add gamma_set function 2020-02-13 09:52:41 +00:00
i2c
i810 drm/i810: Don't include <drm/drm_pci.h> 2019-12-05 08:44:12 +01:00
i915 drm: Remove legacy version of get_scanout_position() 2020-02-13 13:10:10 +01:00
imx drm/imx: pd: Use bus format/flags provided by the bridge when available 2020-01-31 16:40:12 +01:00
ingenic gpu/drm: ingenic: Add support for the JZ4770 2019-12-14 19:26:55 +01:00
lib
lima drm/lima: increase driver version to 1.1 2020-01-27 22:01:20 +08:00
mcde drm-misc-next for v5.6: 2020-01-03 11:43:44 +10:00
mediatek drm-misc-next for v5.6: 2020-01-03 11:43:44 +10:00
meson drm: meson: fix address type confusion 2020-01-08 13:51:56 +01:00
mga drm/mga: Don't include <drm/drm_pci.h> 2019-12-05 08:44:16 +01:00
mgag200 drm/mgag200: Add module parameter to pin all buffers at offset 0 2020-01-07 11:53:19 +01:00
msm drm/msm: Convert to CRTC VBLANK callbacks 2020-02-13 13:08:14 +01:00
mxsfb drm/panel: decouple connector from drm_panel 2019-12-09 22:57:26 +01:00
nouveau drm/nouveau: Convert to CRTC VBLANK callbacks 2020-02-13 13:08:13 +01:00
omapdrm drm/omap: fix possible object reference leak 2020-02-11 11:46:51 +02:00
panel drm/panel: simple: Add Rocktech RK101II01D-CT panel 2020-02-11 16:42:48 +01:00
panfrost drm/panfrost: Prefix interrupt handlers' names 2020-01-21 10:30:10 -06:00
pl111 drm: get drm_bridge_panel connector via helper 2019-12-09 22:57:26 +01:00
qxl drm/qxl: replace zero-length array with flexible-array member 2020-02-13 11:11:59 +01:00
r128 drm/r128: Don't include <drm/drm_pci.h> 2019-12-05 08:44:23 +01:00
radeon drm/radeon: Convert to CRTC VBLANK callbacks 2020-02-13 13:08:14 +01:00
rcar-du drm/bridge: Patch atomic hooks to take a drm_bridge_state 2020-01-31 16:00:24 +01:00
rockchip drm/rockchip: plane_state->fb iff plane_state->crtc 2020-01-28 15:42:23 +01:00
savage drm/savage: Don't include <drm/drm_pci.h> 2019-12-05 08:44:34 +01:00
scheduler drm-misc-next for v5.6: 2019-12-17 13:57:54 +01:00
selftests drm/modes: parse_cmdline: Add support for specifying panel_orientation (v2) 2019-12-16 12:13:18 +01:00
shmobile
sis drm/sis: Don't include <drm/drm_pci.h> 2019-12-05 08:44:55 +01:00
sti drm/sti: Convert to CRTC VBLANK callbacks 2020-02-13 13:10:09 +01:00
stm drm/stm: Convert to CRTC VBLANK callbacks 2020-02-13 13:10:09 +01:00
sun4i drm/sun4i: dsi: Remove incorrect use of runtime PM 2020-02-14 16:25:59 +01:00
tdfx drm/tdfx: Don't include <drm/drm_pci.h> 2019-12-05 08:45:01 +01:00
tegra drm/tegra: Provide ddc symlink in output connector sysfs directory 2020-01-07 20:25:24 +01:00
tidss drm/tidss: New driver for TI Keystone platform Display SubSystem 2020-01-27 19:27:30 +02:00
tilcdc drm/tilcdc: Remove obsolete bundled tilcdc tfp410 driver 2019-12-16 10:45:43 +02:00
tiny drm/tiny/st7735r: No need to set ->owner for spi_register_driver() 2020-02-10 02:54:47 +01:00
ttm drm/ttm: individualize resv objects before calling release_notify 2020-02-12 13:03:56 +01:00
tve200 drm: get drm_bridge_panel connector via helper 2019-12-09 22:57:26 +01:00
udl drm/udl: Clear struct drm_connector_funcs.dpms 2020-02-10 09:24:09 +01:00
v3d Linux 5.4-rc7 2019-11-14 05:53:10 +10:00
vboxvideo drm/vboxvideo: Implement struct drm_mode_config_funcs.mode_valid 2020-02-06 10:34:06 +01:00
vc4 drm/vc4: Convert to CRTC VBLANK callbacks 2020-02-13 13:10:10 +01:00
vgem
via drm/via: Don't include <drm/drm_pci.h> 2019-12-05 08:45:13 +01:00
virtio drm/virtio: fix error check 2020-02-14 10:24:47 +01:00
vkms drm/vkms: Convert to CRTC VBLANK callbacks 2020-02-13 13:10:10 +01:00
vmwgfx drm/vmwgfx: Convert to CRTC VBLANK callbacks 2020-02-13 13:10:10 +01:00
xen drm/xen: Explicitly disable automatic sending of vblank event 2020-01-30 09:00:51 +01:00
zte drm/zte: plane_state->fb iff plane_state->crtc 2020-01-28 15:43:58 +01:00
drm_agpsupport.c
drm_atomic_helper.c drm/bridge: Add the necessary bits to support bus format negotiation 2020-01-31 16:39:53 +01:00
drm_atomic_state_helper.c drm/bridge: Add a drm_bridge_state object 2020-01-31 16:00:21 +01:00
drm_atomic_uapi.c drm/atomic: Spell CRTC consistently 2019-12-22 11:13:00 +01:00
drm_atomic.c drm/bridge: Add a drm_bridge_state object 2020-01-31 16:00:21 +01:00
drm_auth.c drm/auth: Drop master_create/destroy hooks 2020-01-29 09:14:11 +01:00
drm_blend.c
drm_bridge.c drm/bridge: Add the necessary bits to support bus format negotiation 2020-01-31 16:39:53 +01:00
drm_bufs.c drm: Remove the dma_alloc_coherent wrapper for internal usage 2020-02-04 23:57:26 +00:00
drm_cache.c
drm_client_modeset.c drm/client: Rename _force to _locked 2020-02-11 15:03:08 +01:00
drm_client.c drm/client: convert to drm device based logging 2019-12-19 15:52:44 +02:00
drm_color_mgmt.c drm: Inline drm_color_lut_extract() 2019-11-29 21:29:17 +02:00
drm_connector.c drm/connector: Hookup the new drm_cmdline_mode panel_orientation member (v2) 2020-01-11 11:57:59 +01:00
drm_context.c
drm_crtc_helper_internal.h
drm_crtc_helper.c drm/crtc-helper: drm_connector_get_single_encoder prototype is missing 2019-12-03 17:42:57 +01:00
drm_crtc_internal.h drm: Add getfb2 ioctl 2020-01-14 16:22:17 -05:00
drm_crtc.c
drm_damage_helper.c
drm_debugfs_crc.c drm/crc: Actually allow to change the crc source 2020-01-28 16:49:22 +01:00
drm_debugfs.c drm/debugfs: also take per device driver features into account 2020-01-25 15:49:11 +02:00
drm_dma.c drm: fix parameters documentation style in drm_dma 2020-01-18 10:33:12 +01:00
drm_dp_aux_dev.c
drm_dp_cec.c
drm_dp_dual_mode_helper.c
drm_dp_helper.c drm: Add support for DP 1.4 Compliance edid corruption test 2020-02-13 18:33:58 -05:00
drm_dp_mst_topology_internal.h
drm_dp_mst_topology.c drm/dp_mst: Fix clearing payload state on topology disable 2020-01-22 18:56:20 -05:00
drm_drv.c drm: Nerf drm_global_mutex BKL for good drivers 2020-02-11 15:03:09 +01:00
drm_dsc.c
drm_dumb_buffers.c
drm_edid_load.c
drm_edid.c drm: Add support for DP 1.4 Compliance edid corruption test 2020-02-13 18:33:58 -05:00
drm_encoder_slave.c
drm_encoder.c drm/bridge: Make the bridge chain a double-linked list 2019-12-09 10:03:01 +01:00
drm_fb_cma_helper.c drm/fb-cma-helpers: Fix include issue 2020-01-09 17:33:41 +01:00
drm_fb_helper.c drm/client: Rename _force to _locked 2020-02-11 15:03:08 +01:00
drm_file.c drm: Nerf drm_global_mutex BKL for good drivers 2020-02-11 15:03:09 +01:00
drm_flip_work.c
drm_format_helper.c
drm_fourcc.c drm/fourcc: Fill out all block sizes for P210 2019-11-28 11:19:32 +01:00
drm_framebuffer.c drm: Add getfb2 ioctl 2020-01-14 16:22:17 -05:00
drm_gem_cma_helper.c
drm_gem_framebuffer_helper.c drm/gem-fb-helper: convert to drm device based logging 2019-12-19 15:55:10 +02:00
drm_gem_shmem_helper.c drm: call drm_gem_object_funcs.mmap with fake offset 2019-12-06 11:18:11 +01:00
drm_gem_ttm_helper.c drm/ttm: fix mmap refcounting 2019-11-15 08:00:08 +01:00
drm_gem_vram_helper.c drm/vram: Add helpers to validate a display mode's memory requirements 2020-02-06 10:32:54 +01:00
drm_gem.c drm-misc-next for v5.6: 2019-12-17 13:57:54 +01:00
drm_hashtab.c
drm_hdcp.c
drm_internal.h drm: Nerf drm_global_mutex BKL for good drivers 2020-02-11 15:03:09 +01:00
drm_ioc32.c
drm_ioctl.c drm: Add getfb2 ioctl 2020-01-14 16:22:17 -05:00
drm_irq.c drm/irq: remove check on dev->dev_private 2020-02-11 18:39:47 +02:00
drm_kms_helper_common.c
drm_lease.c
drm_legacy_misc.c
drm_legacy.h
drm_lock.c gpu/drm: clean up white space in drm_legacy_lock_master_cleanup() 2020-01-08 19:51:11 +01:00
drm_memory.c
drm_mipi_dbi.c drm/mipi-dbi: Remove sending of vblank event 2020-01-30 09:00:45 +01:00
drm_mipi_dsi.c drm/dsi: add helpers for DSI compression mode and PPS packets 2019-11-07 15:00:16 +02:00
drm_mm.c
drm_mode_config.c drm/modeset: Prime modeset lock vs dma_resv 2019-11-21 11:03:31 +01:00
drm_mode_object.c
drm_modes.c drm/modes: tag unused variables to avoid warnings 2020-01-09 17:17:28 +01:00
drm_modeset_helper.c
drm_modeset_lock.c
drm_of.c drm: of: Add drm_of_lvds_get_dual_link_pixel_order 2019-12-18 02:40:16 +02:00
drm_panel_orientation_quirks.c
drm_panel.c drm/drm_panel: Fix EXPORT of drm_panel_of_backlight() one more time 2019-12-17 20:39:33 +01:00
drm_pci.c drm: Remove the dma_alloc_coherent wrapper for internal usage 2020-02-04 23:57:26 +00:00
drm_plane_helper.c
drm_plane.c
drm_prime.c drm: share address space for dma bufs 2019-12-06 11:18:11 +01:00
drm_print.c drm/print: convert debug category macros into an enum 2019-11-14 14:08:57 +02:00
drm_probe_helper.c drm: Stop accessing encoder->bridge directly 2019-12-09 10:02:45 +01:00
drm_property.c drm: limit to INT_MAX in create_blob ioctl 2019-12-04 19:44:13 -08:00
drm_rect.c drm/rect: update kerneldoc for drm_rect_clip_scaled() 2019-11-28 13:15:43 +01:00
drm_scatter.c
drm_scdc_helper.c
drm_self_refresh_helper.c
drm_simple_kms_helper.c
drm_syncobj.c drm/syncobj: Add documentation for timeline syncobj 2020-01-20 14:22:21 +01:00
drm_sysfs.c
drm_trace_points.c
drm_trace.h
drm_vblank.c drm: Remove legacy version of get_scanout_position() 2020-02-13 13:10:10 +01:00
drm_vm.c drm: Remove the dma_alloc_coherent wrapper for internal usage 2020-02-04 23:57:26 +00:00
drm_vma_manager.c
drm_vram_helper_common.c
drm_writeback.c
Kconfig drm/tidss: New driver for TI Keystone platform Display SubSystem 2020-01-27 19:27:30 +02:00
Makefile drm/tidss: New driver for TI Keystone platform Display SubSystem 2020-01-27 19:27:30 +02:00