Lines Matching +full:dp +full:- +full:bridge

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
17 * dp_bridge_detect - callback to determine if connector is connected
18 * @bridge: Pointer to drm bridge structure
19 * Returns: Bridge's 'is connected' status
21 static enum drm_connector_status dp_bridge_detect(struct drm_bridge *bridge) in dp_bridge_detect() argument
23 struct msm_dp *dp; in dp_bridge_detect() local
25 dp = to_dp_bridge(bridge)->dp_display; in dp_bridge_detect()
27 drm_dbg_dp(dp->drm_dev, "is_connected = %s\n", in dp_bridge_detect()
28 (dp->is_connected) ? "true" : "false"); in dp_bridge_detect()
30 return (dp->is_connected) ? connector_status_connected : in dp_bridge_detect()
34 static int dp_bridge_atomic_check(struct drm_bridge *bridge, in dp_bridge_atomic_check() argument
39 struct msm_dp *dp; in dp_bridge_atomic_check() local
41 dp = to_dp_bridge(bridge)->dp_display; in dp_bridge_atomic_check()
43 drm_dbg_dp(dp->drm_dev, "is_connected = %s\n", in dp_bridge_atomic_check()
44 (dp->is_connected) ? "true" : "false"); in dp_bridge_atomic_check()
50 * crtc->active is still true. Any attempt to set the mode or manually in dp_bridge_atomic_check()
57 if (bridge->ops & DRM_BRIDGE_OP_HPD) in dp_bridge_atomic_check()
58 return (dp->is_connected) ? 0 : -ENOTCONN; in dp_bridge_atomic_check()
65 * dp_bridge_get_modes - callback to add drm modes via drm_mode_probed_add()
66 * @bridge: Poiner to drm bridge
70 static int dp_bridge_get_modes(struct drm_bridge *bridge, struct drm_connector *connector) in dp_bridge_get_modes() argument
73 struct msm_dp *dp; in dp_bridge_get_modes() local
78 dp = to_dp_bridge(bridge)->dp_display; in dp_bridge_get_modes()
81 if (dp->is_connected) { in dp_bridge_get_modes()
82 rc = dp_display_get_modes(dp); in dp_bridge_get_modes()
84 DRM_ERROR("failed to get DP sink modes, rc=%d\n", rc); in dp_bridge_get_modes()
88 drm_dbg_dp(connector->dev, "No sink connected\n"); in dp_bridge_get_modes()
115 struct msm_dp *dp = to_dp_bridge(drm_bridge)->dp_display; in edp_bridge_atomic_check() local
118 return -ENODEV; in edp_bridge_atomic_check()
120 conn_state->self_refresh_aware = dp->psr_supported; in edp_bridge_atomic_check()
122 if (!conn_state->crtc || !crtc_state) in edp_bridge_atomic_check()
125 if (crtc_state->self_refresh_active && !dp->psr_supported) in edp_bridge_atomic_check()
126 return -EINVAL; in edp_bridge_atomic_check()
134 struct drm_atomic_state *atomic_state = old_bridge_state->base.state; in edp_bridge_atomic_enable()
138 struct msm_dp *dp = dp_bridge->dp_display; in edp_bridge_atomic_enable() local
144 * bridge enable sequence. in edp_bridge_atomic_enable()
147 drm_bridge->encoder); in edp_bridge_atomic_enable()
153 if (old_crtc_state && old_crtc_state->self_refresh_active) { in edp_bridge_atomic_enable()
154 dp_display_set_psr(dp, false); in edp_bridge_atomic_enable()
164 struct drm_atomic_state *atomic_state = old_bridge_state->base.state; in edp_bridge_atomic_disable()
168 struct msm_dp *dp = dp_bridge->dp_display; in edp_bridge_atomic_disable() local
171 drm_bridge->encoder); in edp_bridge_atomic_disable()
194 if (new_crtc_state->self_refresh_active) { in edp_bridge_atomic_disable()
195 dp_display_set_psr(dp, true); in edp_bridge_atomic_disable()
197 } else if (old_crtc_state->self_refresh_active) { in edp_bridge_atomic_disable()
198 dp_display_set_psr(dp, false); in edp_bridge_atomic_disable()
209 struct drm_atomic_state *atomic_state = old_bridge_state->base.state; in edp_bridge_atomic_post_disable()
214 drm_bridge->encoder); in edp_bridge_atomic_post_disable()
225 if (new_crtc_state->self_refresh_active) in edp_bridge_atomic_post_disable()
232 * edp_bridge_mode_valid - callback to determine if specified mode is valid
233 * @bridge: Pointer to drm bridge structure
238 static enum drm_mode_status edp_bridge_mode_valid(struct drm_bridge *bridge, in edp_bridge_mode_valid() argument
242 struct msm_dp *dp; in edp_bridge_mode_valid() local
243 int mode_pclk_khz = mode->clock; in edp_bridge_mode_valid()
245 dp = to_dp_bridge(bridge)->dp_display; in edp_bridge_mode_valid()
247 if (!dp || !mode_pclk_khz || !dp->connector) { in edp_bridge_mode_valid()
249 return -EINVAL; in edp_bridge_mode_valid()
252 if (mode->clock > DP_MAX_PIXEL_CLK_KHZ) in edp_bridge_mode_valid()
280 struct drm_bridge *bridge; in dp_bridge_init() local
282 dp_bridge = devm_kzalloc(dev->dev, sizeof(*dp_bridge), GFP_KERNEL); in dp_bridge_init()
284 return ERR_PTR(-ENOMEM); in dp_bridge_init()
286 dp_bridge->dp_display = dp_display; in dp_bridge_init()
288 bridge = &dp_bridge->bridge; in dp_bridge_init()
289 bridge->funcs = dp_display->is_edp ? &edp_bridge_ops : &dp_bridge_ops; in dp_bridge_init()
290 bridge->type = dp_display->connector_type; in dp_bridge_init()
293 * Many ops only make sense for DP. Why? in dp_bridge_init()
294 * - Detect/HPD are used by DRM to know if a display is _physically_ in dp_bridge_init()
299 * - Currently eDP mode reading is driven by the panel driver. This in dp_bridge_init()
303 if (!dp_display->is_edp) { in dp_bridge_init()
304 bridge->ops = in dp_bridge_init()
310 drm_bridge_add(bridge); in dp_bridge_init()
312 rc = drm_bridge_attach(encoder, bridge, NULL, DRM_BRIDGE_ATTACH_NO_CONNECTOR); in dp_bridge_init()
314 DRM_ERROR("failed to attach bridge, rc=%d\n", rc); in dp_bridge_init()
315 drm_bridge_remove(bridge); in dp_bridge_init()
320 if (dp_display->next_bridge) { in dp_bridge_init()
322 dp_display->next_bridge, bridge, in dp_bridge_init()
325 DRM_ERROR("failed to attach panel bridge: %d\n", rc); in dp_bridge_init()
326 drm_bridge_remove(bridge); in dp_bridge_init()
331 return bridge; in dp_bridge_init()
339 connector = drm_bridge_connector_init(dp_display->drm_dev, encoder); in dp_drm_connector_init()