Skip to content

Commit 4f4cfb0

Browse files
Venkateshwar Rao GannavarapuMichal Simek
authored andcommitted
drm: xlnx: hdmi: Get maximum link rate and number of lanes supported by sink
This patch gets the maximum link rate and number of lanes information from display_info structure and request the phy to generate the required clock. Signed-off-by: Venkateshwar Rao Gannavarapu <venkateshwar.rao.gannavarapu@xilinx.com> Reviewed-by: Vishal Sagar <vishal.sagar@xilinx.com>
1 parent 798a6e8 commit 4f4cfb0

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

‎drivers/gpu/drm/xlnx/xlnx_hdmi.c‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@
300300

301301
#define HDMI_TX_FRL_CLK_CYCLES 0x3E7
302302
#define HDMI_TX_PIXEL_MAXRATE 340000
303+
#define HDMI_TX_PIXELRATE_GBPS ((u64)1e9)
303304

304305
#define HDMI_TX_DDC_CMD_STR_TOKEN 0x100
305306
#define HDMI_TX_DDC_CMD_STP_TOKEN 0x101
@@ -452,6 +453,8 @@ struct xlnx_hdmi_config {
452453
* @tmds_clock_ratio: tmds clock ratio
453454
* @is_hdmi: flag indicates dvi or hdmi
454455
* @is_scrambled: scrambled enabled status;
456+
* @sink_max_linerate: maximum linerate supported by sink in Gbps
457+
* @sink_max_lanes: maximum lanes supported by sink
455458
* @state: enum reflects the stream is up or down
456459
*/
457460
struct xlnx_hdmi_stream {
@@ -460,6 +463,8 @@ struct xlnx_hdmi_stream {
460463
u8 tmds_clock_ratio;
461464
u8 is_hdmi;
462465
u8 is_scrambled;
466+
u8 sink_max_linerate;
467+
u8 sink_max_lanes;
463468
enum hdmi_state state;
464469
};
465470

@@ -1679,6 +1684,10 @@ static int xlnx_hdmi_exec_frl_state_lts2(struct xlnx_hdmi *hdmi)
16791684
}
16801685

16811686
/* Enable HDMI 2.1 config */
1687+
phy_cfg.hdmi.linerate =
1688+
(u64)(hdmi->stream.sink_max_linerate *
1689+
HDMI_TX_PIXELRATE_GBPS);
1690+
phy_cfg.hdmi.nchannels = hdmi->stream.sink_max_lanes;
16821691
phy_cfg.hdmi.config_hdmi21 = 1;
16831692
for (i = 0; i < HDMI_MAX_LANES; i++) {
16841693
ret = phy_configure(hdmi->phy[i], &phy_cfg);
@@ -2521,6 +2530,7 @@ xlnx_hdmi_encoder_atomic_mode_set(struct drm_encoder *encoder,
25212530
struct drm_connector_state *connector_state)
25222531
{
25232532
struct xlnx_hdmi *hdmi = encoder_to_hdmi(encoder);
2533+
struct drm_connector *connector = &hdmi->connector;
25242534
struct xlnx_hdmi_config *config = &hdmi->config;
25252535
struct drm_display_mode *mode = &crtc_state->mode;
25262536
struct drm_display_mode *adjusted_mode = &crtc_state->adjusted_mode;
@@ -2550,6 +2560,10 @@ xlnx_hdmi_encoder_atomic_mode_set(struct drm_encoder *encoder,
25502560
xlnx_hdmi_frl_reset_deassert(hdmi);
25512561
xlnx_hdmi_frl_intr_enable(hdmi);
25522562
xlnx_hdmi_frl_execute(hdmi);
2563+
hdmi->stream.sink_max_lanes =
2564+
connector->display_info.hdmi.max_lanes;
2565+
hdmi->stream.sink_max_linerate =
2566+
connector->display_info.hdmi.max_frl_rate_per_lane;
25532567
} else {
25542568
xlnx_hdmi_frl_ext_vidsrc(hdmi);
25552569
xlnx_hdmi_frl_sleep(hdmi);

0 commit comments

Comments
 (0)