Lines Matching refs:dp_panel
20 struct dp_panel dp_panel; member
30 struct dp_panel *dp_panel; in dp_panel_read_psr_cap() local
32 dp_panel = &panel->dp_panel; in dp_panel_read_psr_cap()
35 if (dp_panel->dpcd[DP_EDP_CONFIGURATION_CAP]) { in dp_panel_read_psr_cap()
37 &dp_panel->psr_cap, sizeof(dp_panel->psr_cap)); in dp_panel_read_psr_cap()
38 if (rlen == sizeof(dp_panel->psr_cap)) { in dp_panel_read_psr_cap()
41 dp_panel->psr_cap.version, in dp_panel_read_psr_cap()
42 dp_panel->psr_cap.capabilities); in dp_panel_read_psr_cap()
48 static int dp_panel_read_dpcd(struct dp_panel *dp_panel) in dp_panel_read_dpcd() argument
55 panel = container_of(dp_panel, struct dp_panel_private, dp_panel); in dp_panel_read_dpcd()
56 dpcd = dp_panel->dpcd; in dp_panel_read_dpcd()
61 dp_panel->vsc_sdp_supported = drm_dp_vsc_sdp_supported(panel->aux, dpcd); in dp_panel_read_dpcd()
62 link_info = &dp_panel->link_info; in dp_panel_read_dpcd()
71 if (link_info->num_lanes > dp_panel->max_dp_lanes) in dp_panel_read_dpcd()
72 link_info->num_lanes = dp_panel->max_dp_lanes; in dp_panel_read_dpcd()
75 if (link_info->rate > dp_panel->max_dp_link_rate) in dp_panel_read_dpcd()
76 link_info->rate = dp_panel->max_dp_link_rate; in dp_panel_read_dpcd()
90 static u32 dp_panel_get_supported_bpp(struct dp_panel *dp_panel, in dp_panel_get_supported_bpp() argument
99 link_info = &dp_panel->link_info; in dp_panel_get_supported_bpp()
111 int dp_panel_read_sink_caps(struct dp_panel *dp_panel, in dp_panel_read_sink_caps() argument
118 if (!dp_panel || !connector) { in dp_panel_read_sink_caps()
123 panel = container_of(dp_panel, struct dp_panel_private, dp_panel); in dp_panel_read_sink_caps()
126 dp_panel->max_dp_lanes, dp_panel->max_dp_link_rate); in dp_panel_read_sink_caps()
128 rc = dp_panel_read_dpcd(dp_panel); in dp_panel_read_sink_caps()
134 bw_code = drm_dp_link_rate_to_bw_code(dp_panel->link_info.rate); in dp_panel_read_sink_caps()
136 !is_lane_count_valid(dp_panel->link_info.num_lanes) || in dp_panel_read_sink_caps()
137 (bw_code > dp_panel->max_bw_code)) { in dp_panel_read_sink_caps()
138 DRM_ERROR("Illegal link rate=%d lane=%d\n", dp_panel->link_info.rate, in dp_panel_read_sink_caps()
139 dp_panel->link_info.num_lanes); in dp_panel_read_sink_caps()
143 if (drm_dp_is_branch(dp_panel->dpcd)) { in dp_panel_read_sink_caps()
151 rc = drm_dp_read_downstream_info(panel->aux, dp_panel->dpcd, in dp_panel_read_sink_caps()
152 dp_panel->downstream_ports); in dp_panel_read_sink_caps()
156 drm_edid_free(dp_panel->drm_edid); in dp_panel_read_sink_caps()
158 dp_panel->drm_edid = drm_edid_read_ddc(connector, &panel->aux->ddc); in dp_panel_read_sink_caps()
160 drm_edid_connector_update(connector, dp_panel->drm_edid); in dp_panel_read_sink_caps()
162 if (!dp_panel->drm_edid) { in dp_panel_read_sink_caps()
175 u32 dp_panel_get_mode_bpp(struct dp_panel *dp_panel, in dp_panel_get_mode_bpp() argument
181 if (!dp_panel || !mode_edid_bpp || !mode_pclk_khz) { in dp_panel_get_mode_bpp()
186 panel = container_of(dp_panel, struct dp_panel_private, dp_panel); in dp_panel_get_mode_bpp()
188 if (dp_panel->video_test) in dp_panel_get_mode_bpp()
192 bpp = dp_panel_get_supported_bpp(dp_panel, mode_edid_bpp, in dp_panel_get_mode_bpp()
198 int dp_panel_get_modes(struct dp_panel *dp_panel, in dp_panel_get_modes() argument
201 if (!dp_panel) { in dp_panel_get_modes()
206 if (dp_panel->drm_edid) in dp_panel_get_modes()
219 void dp_panel_handle_sink_request(struct dp_panel *dp_panel) in dp_panel_handle_sink_request() argument
223 if (!dp_panel) { in dp_panel_handle_sink_request()
228 panel = container_of(dp_panel, struct dp_panel_private, dp_panel); in dp_panel_handle_sink_request()
232 const struct edid *edid = drm_edid_raw(dp_panel->drm_edid); in dp_panel_handle_sink_request()
238 checksum = dp_panel->connector->real_edid_checksum; in dp_panel_handle_sink_request()
245 void dp_panel_tpg_config(struct dp_panel *dp_panel, bool enable) in dp_panel_tpg_config() argument
250 if (!dp_panel) { in dp_panel_tpg_config()
255 panel = container_of(dp_panel, struct dp_panel_private, dp_panel); in dp_panel_tpg_config()
270 dp_catalog_panel_tpg_enable(catalog, &panel->dp_panel.dp_mode.drm_mode); in dp_panel_tpg_config()
273 static int dp_panel_setup_vsc_sdp_yuv_420(struct dp_panel *dp_panel) in dp_panel_setup_vsc_sdp_yuv_420() argument
282 if (!dp_panel) { in dp_panel_setup_vsc_sdp_yuv_420()
287 panel = container_of(dp_panel, struct dp_panel_private, dp_panel); in dp_panel_setup_vsc_sdp_yuv_420()
289 dp_mode = &dp_panel->dp_mode; in dp_panel_setup_vsc_sdp_yuv_420()
320 void dp_panel_dump_regs(struct dp_panel *dp_panel) in dp_panel_dump_regs() argument
325 panel = container_of(dp_panel, struct dp_panel_private, dp_panel); in dp_panel_dump_regs()
331 int dp_panel_timing_cfg(struct dp_panel *dp_panel) in dp_panel_timing_cfg() argument
342 panel = container_of(dp_panel, struct dp_panel_private, dp_panel); in dp_panel_timing_cfg()
344 drm_mode = &panel->dp_panel.dp_mode.drm_mode; in dp_panel_timing_cfg()
374 data |= (panel->dp_panel.dp_mode.v_active_low << 31); in dp_panel_timing_cfg()
376 data |= (panel->dp_panel.dp_mode.h_active_low << 15); in dp_panel_timing_cfg()
388 if (dp_panel->dp_mode.out_fmt_is_yuv_420) in dp_panel_timing_cfg()
389 dp_panel_setup_vsc_sdp_yuv_420(dp_panel); in dp_panel_timing_cfg()
396 int dp_panel_init_panel_info(struct dp_panel *dp_panel) in dp_panel_init_panel_info() argument
401 drm_mode = &dp_panel->dp_mode.drm_mode; in dp_panel_init_panel_info()
403 panel = container_of(dp_panel, struct dp_panel_private, dp_panel); in dp_panel_init_panel_info()
424 drm_dbg_dp(panel->drm_dev, "bpp = %d\n", dp_panel->dp_mode.bpp); in dp_panel_init_panel_info()
426 dp_panel->dp_mode.bpp = dp_panel_get_mode_bpp(dp_panel, dp_panel->dp_mode.bpp, in dp_panel_init_panel_info()
427 dp_panel->dp_mode.drm_mode.clock); in dp_panel_init_panel_info()
430 dp_panel->dp_mode.bpp); in dp_panel_init_panel_info()
459 static int dp_panel_parse_dt(struct dp_panel *dp_panel) in dp_panel_parse_dt() argument
465 panel = container_of(dp_panel, struct dp_panel_private, dp_panel); in dp_panel_parse_dt()
478 dp_panel->max_dp_lanes = cnt; in dp_panel_parse_dt()
480 dp_panel->max_dp_lanes = DP_MAX_NUM_DP_LANES; /* 4 lanes */ in dp_panel_parse_dt()
482 dp_panel->max_dp_link_rate = dp_panel_link_frequencies(of_node); in dp_panel_parse_dt()
483 if (!dp_panel->max_dp_link_rate) in dp_panel_parse_dt()
484 dp_panel->max_dp_link_rate = DP_LINK_RATE_HBR2; in dp_panel_parse_dt()
489 struct dp_panel *dp_panel_get(struct dp_panel_in *in) in dp_panel_get()
492 struct dp_panel *dp_panel; in dp_panel_get() local
509 dp_panel = &panel->dp_panel; in dp_panel_get()
510 dp_panel->max_bw_code = DP_LINK_BW_8_1; in dp_panel_get()
512 ret = dp_panel_parse_dt(dp_panel); in dp_panel_get()
516 return dp_panel; in dp_panel_get()
519 void dp_panel_put(struct dp_panel *dp_panel) in dp_panel_put() argument
521 if (!dp_panel) in dp_panel_put()
524 drm_edid_free(dp_panel->drm_edid); in dp_panel_put()