Lines Matching +full:edp +full:- +full:bridge
1 // SPDX-License-Identifier: GPL-2.0-or-later
6 * Author: Andy Yan <andy.yan@rock-chips.com>
7 * Yakir Yang <ykk@rock-chips.com>
8 * Jeff Chen <jeff.chen@rock-chips.com>
27 #include <drm/bridge/analogix_dp.h>
45 * struct rockchip_dp_chip_data - splite the grf setting of kind of chips
47 * @lcdsel_big: reg value of selecting vop big for eDP
48 * @lcdsel_lit: reg value of selecting vop little for eDP
89 reset_control_assert(dp->rst); in rockchip_dp_pre_init()
91 reset_control_deassert(dp->rst); in rockchip_dp_pre_init()
101 ret = clk_prepare_enable(dp->pclk); in rockchip_dp_poweron()
103 DRM_DEV_ERROR(dp->dev, "failed to enable pclk %d\n", ret); in rockchip_dp_poweron()
109 DRM_DEV_ERROR(dp->dev, "failed to dp pre init %d\n", ret); in rockchip_dp_poweron()
110 clk_disable_unprepare(dp->pclk); in rockchip_dp_poweron()
121 clk_disable_unprepare(dp->pclk); in rockchip_dp_powerdown()
129 struct drm_display_info *di = &connector->display_info; in rockchip_dp_get_modes()
130 /* VOP couldn't output YUV video format for eDP rightly */ in rockchip_dp_get_modes()
133 if ((di->color_formats & mask)) { in rockchip_dp_get_modes()
135 di->color_formats &= ~mask; in rockchip_dp_get_modes()
136 di->color_formats |= DRM_COLOR_FORMAT_RGB444; in rockchip_dp_get_modes()
137 di->bpc = 8; in rockchip_dp_get_modes()
174 return conn_state->crtc; in rockchip_dp_drm_get_new_crtc()
192 if (old_crtc_state && old_crtc_state->self_refresh_active) in rockchip_dp_drm_encoder_enable()
195 ret = drm_of_encoder_active_endpoint_id(dp->dev->of_node, encoder); in rockchip_dp_drm_encoder_enable()
200 val = dp->data->lcdsel_lit; in rockchip_dp_drm_encoder_enable()
202 val = dp->data->lcdsel_big; in rockchip_dp_drm_encoder_enable()
204 DRM_DEV_DEBUG(dp->dev, "vop %s output to dp\n", (ret) ? "LIT" : "BIG"); in rockchip_dp_drm_encoder_enable()
206 ret = clk_prepare_enable(dp->grfclk); in rockchip_dp_drm_encoder_enable()
208 DRM_DEV_ERROR(dp->dev, "failed to enable grfclk %d\n", ret); in rockchip_dp_drm_encoder_enable()
212 ret = regmap_write(dp->grf, dp->data->lcdsel_grf_reg, val); in rockchip_dp_drm_encoder_enable()
214 DRM_DEV_ERROR(dp->dev, "Could not write to GRF: %d\n", ret); in rockchip_dp_drm_encoder_enable()
216 clk_disable_unprepare(dp->grfclk); in rockchip_dp_drm_encoder_enable()
233 /* If we're not entering self-refresh, no need to wait for vact */ in rockchip_dp_drm_encoder_disable()
234 if (!new_crtc_state || !new_crtc_state->self_refresh_active) in rockchip_dp_drm_encoder_disable()
239 DRM_DEV_ERROR(dp->dev, "line flag irq timed out\n"); in rockchip_dp_drm_encoder_disable()
248 struct drm_display_info *di = &conn_state->connector->display_info; in rockchip_dp_drm_encoder_atomic_check()
252 * format to eDP controller, and if eDP panel only support RGB8, in rockchip_dp_drm_encoder_atomic_check()
253 * then eDP controller should cut down the video data, not via VOP in rockchip_dp_drm_encoder_atomic_check()
258 s->output_mode = ROCKCHIP_OUT_MODE_AAAA; in rockchip_dp_drm_encoder_atomic_check()
259 s->output_type = DRM_MODE_CONNECTOR_eDP; in rockchip_dp_drm_encoder_atomic_check()
260 s->output_bpc = di->bpc; in rockchip_dp_drm_encoder_atomic_check()
275 struct device *dev = dp->dev; in rockchip_dp_of_probe()
276 struct device_node *np = dev->of_node; in rockchip_dp_of_probe()
278 dp->grf = syscon_regmap_lookup_by_phandle(np, "rockchip,grf"); in rockchip_dp_of_probe()
279 if (IS_ERR(dp->grf)) { in rockchip_dp_of_probe()
281 return PTR_ERR(dp->grf); in rockchip_dp_of_probe()
284 dp->grfclk = devm_clk_get(dev, "grf"); in rockchip_dp_of_probe()
285 if (PTR_ERR(dp->grfclk) == -ENOENT) { in rockchip_dp_of_probe()
286 dp->grfclk = NULL; in rockchip_dp_of_probe()
287 } else if (PTR_ERR(dp->grfclk) == -EPROBE_DEFER) { in rockchip_dp_of_probe()
288 return -EPROBE_DEFER; in rockchip_dp_of_probe()
289 } else if (IS_ERR(dp->grfclk)) { in rockchip_dp_of_probe()
291 return PTR_ERR(dp->grfclk); in rockchip_dp_of_probe()
294 dp->pclk = devm_clk_get(dev, "pclk"); in rockchip_dp_of_probe()
295 if (IS_ERR(dp->pclk)) { in rockchip_dp_of_probe()
297 return PTR_ERR(dp->pclk); in rockchip_dp_of_probe()
300 dp->rst = devm_reset_control_get(dev, "dp"); in rockchip_dp_of_probe()
301 if (IS_ERR(dp->rst)) { in rockchip_dp_of_probe()
303 return PTR_ERR(dp->rst); in rockchip_dp_of_probe()
311 struct drm_encoder *encoder = &dp->encoder.encoder; in rockchip_dp_drm_create_encoder()
312 struct drm_device *drm_dev = dp->drm_dev; in rockchip_dp_drm_create_encoder()
313 struct device *dev = dp->dev; in rockchip_dp_drm_create_encoder()
316 encoder->possible_crtcs = drm_of_find_possible_crtcs(drm_dev, in rockchip_dp_drm_create_encoder()
317 dev->of_node); in rockchip_dp_drm_create_encoder()
318 DRM_DEBUG_KMS("possible_crtcs = 0x%x\n", encoder->possible_crtcs); in rockchip_dp_drm_create_encoder()
339 dp->drm_dev = drm_dev; in rockchip_dp_bind()
347 rockchip_drm_encoder_set_crtc_endpoint_id(&dp->encoder, in rockchip_dp_bind()
348 dev->of_node, 0, 0); in rockchip_dp_bind()
350 dp->plat_data.encoder = &dp->encoder.encoder; in rockchip_dp_bind()
352 ret = analogix_dp_bind(dp->adp, drm_dev); in rockchip_dp_bind()
358 dp->encoder.encoder.funcs->destroy(&dp->encoder.encoder); in rockchip_dp_bind()
367 analogix_dp_unbind(dp->adp); in rockchip_dp_unbind()
368 dp->encoder.encoder.funcs->destroy(&dp->encoder.encoder); in rockchip_dp_unbind()
378 struct device *dev = &pdev->dev; in rockchip_dp_probe()
386 return -ENODEV; in rockchip_dp_probe()
388 ret = drm_of_find_panel_or_bridge(dev->of_node, 1, 0, &panel, NULL); in rockchip_dp_probe()
394 return -ENOMEM; in rockchip_dp_probe()
396 dp->dev = dev; in rockchip_dp_probe()
397 dp->adp = ERR_PTR(-ENODEV); in rockchip_dp_probe()
398 dp->data = dp_data; in rockchip_dp_probe()
399 dp->plat_data.panel = panel; in rockchip_dp_probe()
400 dp->plat_data.dev_type = dp->data->chip_type; in rockchip_dp_probe()
401 dp->plat_data.power_on = rockchip_dp_poweron; in rockchip_dp_probe()
402 dp->plat_data.power_off = rockchip_dp_powerdown; in rockchip_dp_probe()
403 dp->plat_data.get_modes = rockchip_dp_get_modes; in rockchip_dp_probe()
411 dp->adp = analogix_dp_probe(dev, &dp->plat_data); in rockchip_dp_probe()
412 if (IS_ERR(dp->adp)) in rockchip_dp_probe()
413 return PTR_ERR(dp->adp); in rockchip_dp_probe()
424 component_del(&pdev->dev, &rockchip_dp_component_ops); in rockchip_dp_remove()
431 if (IS_ERR(dp->adp)) in rockchip_dp_suspend()
434 return analogix_dp_suspend(dp->adp); in rockchip_dp_suspend()
441 if (IS_ERR(dp->adp)) in rockchip_dp_resume()
444 return analogix_dp_resume(dp->adp); in rockchip_dp_resume()
465 {.compatible = "rockchip,rk3288-dp", .data = &rk3288_dp },
466 {.compatible = "rockchip,rk3399-edp", .data = &rk3399_edp },
475 .name = "rockchip-dp",