drm/rockchip: dw_hdmi: Configure HDMI PHY in atomic_mode_set()

The HDMI helpers negotiated TMDS character rate and output bpc are
available from the connector state. Change the encoder helper from
mode_set() to atomic_mode_set() so these values can be used to configure
the HDMI PHY using phy_configure().

This has no impact until the dw-hdmi bridge is fully converted into a
HDMI bridge and HDMI helpers are used to assign hdmi.tmds_char_rate.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Tested-by: Heiko Stuebner <heiko@sntech.de> #rk3328
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patch.msgid.link/20260518193748.2482823-10-jonas@kwiboo.se
This commit is contained in:
Jonas Karlman 2026-05-18 19:37:43 +00:00 committed by Heiko Stuebner
parent 1481cc03cc
commit e54d6ed9a0

View File

@ -226,11 +226,22 @@ dw_hdmi_rockchip_mode_valid(struct dw_hdmi *dw_hdmi, void *data,
return MODE_OK;
}
static void dw_hdmi_rockchip_encoder_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *mode,
struct drm_display_mode *adj_mode)
static void
dw_hdmi_rockchip_encoder_atomic_mode_set(struct drm_encoder *encoder,
struct drm_crtc_state *crtc_state,
struct drm_connector_state *conn_state)
{
struct rockchip_hdmi *hdmi = to_rockchip_hdmi(encoder);
struct drm_display_mode *adj_mode = &crtc_state->adjusted_mode;
if (hdmi->phy && conn_state->hdmi.tmds_char_rate) {
union phy_configure_opts opts = {};
opts.hdmi.bpc = conn_state->hdmi.output_bpc;
opts.hdmi.tmds_char_rate = conn_state->hdmi.tmds_char_rate;
phy_configure(hdmi->phy, &opts);
}
clk_set_rate(hdmi->ref_clk, adj_mode->clock * 1000);
}
@ -270,15 +281,23 @@ dw_hdmi_rockchip_encoder_atomic_check(struct drm_encoder *encoder,
struct drm_connector_state *conn_state)
{
struct rockchip_crtc_state *s = to_rockchip_crtc_state(crtc_state);
struct rockchip_hdmi *hdmi = to_rockchip_hdmi(encoder);
union phy_configure_opts opts = {};
s->output_mode = ROCKCHIP_OUT_MODE_AAAA;
s->output_type = DRM_MODE_CONNECTOR_HDMIA;
return 0;
if (!hdmi->phy || !conn_state->hdmi.tmds_char_rate)
return 0;
opts.hdmi.bpc = conn_state->hdmi.output_bpc;
opts.hdmi.tmds_char_rate = conn_state->hdmi.tmds_char_rate;
return phy_validate(hdmi->phy, PHY_MODE_HDMI, PHY_HDMI_MODE_TMDS, &opts);
}
static const struct drm_encoder_helper_funcs dw_hdmi_rockchip_encoder_helper_funcs = {
.mode_set = dw_hdmi_rockchip_encoder_mode_set,
.atomic_mode_set = dw_hdmi_rockchip_encoder_atomic_mode_set,
.enable = dw_hdmi_rockchip_encoder_enable,
.atomic_check = dw_hdmi_rockchip_encoder_atomic_check,
};