Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/bridge: panel: Add a device link between drm device and panel device

Add the device link when panel bridge is attached and delete the link
when panel bridge is detached. The drm device is the consumer while
the panel device is the supplier. This makes sure that the drm device
suspends eariler and resumes later than the panel device, hence resolves
problems where the order is reversed, like the problematic case mentioned
in the below link.

Link: https://lore.kernel.org/lkml/CAPDyKFr0XjrU_udKoUKQ_q8RWaUkyqL+8fV-7s1CTMqi7u3-Rg@mail.gmail.com/T/
Suggested-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Liu Ying <victor.liu@nxp.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230807061115.3244501-1-victor.liu@nxp.com

authored by

Liu Ying and committed by
Neil Armstrong
199cf07e 4d49d87b

+16
+16
drivers/gpu/drm/bridge/panel.c
··· 4 4 * Copyright (C) 2017 Broadcom 5 5 */ 6 6 7 + #include <linux/device.h> 8 + 7 9 #include <drm/drm_atomic_helper.h> 8 10 #include <drm/drm_bridge.h> 9 11 #include <drm/drm_connector.h> ··· 21 19 struct drm_bridge bridge; 22 20 struct drm_connector connector; 23 21 struct drm_panel *panel; 22 + struct device_link *link; 24 23 u32 connector_type; 25 24 }; 26 25 ··· 63 60 { 64 61 struct panel_bridge *panel_bridge = drm_bridge_to_panel_bridge(bridge); 65 62 struct drm_connector *connector = &panel_bridge->connector; 63 + struct drm_panel *panel = panel_bridge->panel; 64 + struct drm_device *drm_dev = bridge->dev; 66 65 int ret; 67 66 68 67 if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) ··· 75 70 return -ENODEV; 76 71 } 77 72 73 + panel_bridge->link = device_link_add(drm_dev->dev, panel->dev, 74 + DL_FLAG_STATELESS); 75 + if (!panel_bridge->link) { 76 + DRM_ERROR("Failed to add device link between %s and %s\n", 77 + dev_name(drm_dev->dev), dev_name(panel->dev)); 78 + return -EINVAL; 79 + } 80 + 78 81 drm_connector_helper_add(connector, 79 82 &panel_bridge_connector_helper_funcs); 80 83 ··· 91 78 panel_bridge->connector_type); 92 79 if (ret) { 93 80 DRM_ERROR("Failed to initialize connector\n"); 81 + device_link_del(panel_bridge->link); 94 82 return ret; 95 83 } 96 84 ··· 113 99 { 114 100 struct panel_bridge *panel_bridge = drm_bridge_to_panel_bridge(bridge); 115 101 struct drm_connector *connector = &panel_bridge->connector; 102 + 103 + device_link_del(panel_bridge->link); 116 104 117 105 /* 118 106 * Cleanup the connector if we know it was initialized.