Commit 84cf74d9 authored by Dmitry Baryshkov's avatar Dmitry Baryshkov Committed by Neil Armstrong

drm/bridge: lt9611: rework infoframes handling

Rework handling infoframes:
- Write full HDMI AVI infoframe instead of just fixing the VIC value
- Also send the HDMI Vendor Specific infoframe, as recommended by the
  HDMI spec.
Reviewed-by: default avatarNeil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: default avatarNeil Armstrong <neil.armstrong@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230118081658.2198520-12-dmitry.baryshkov@linaro.org
parent 6b089d5e
......@@ -59,7 +59,6 @@ struct lt9611 {
enum drm_connector_status status;
u8 edid_buf[EDID_SEG_SIZE];
u32 vic;
};
#define LT9611_PAGE_CONTROL 0xff
......@@ -353,12 +352,51 @@ static int lt9611_video_check(struct lt9611 *lt9611)
return temp;
}
static void lt9611_hdmi_tx_digital(struct lt9611 *lt9611, bool is_hdmi)
static void lt9611_hdmi_set_infoframes(struct lt9611 *lt9611,
struct drm_connector *connector,
struct drm_display_mode *mode)
{
regmap_write(lt9611->regmap, 0x8443, 0x46 - lt9611->vic);
regmap_write(lt9611->regmap, 0x8447, lt9611->vic);
regmap_write(lt9611->regmap, 0x843d, 0x0a); /* UD1 infoframe */
union hdmi_infoframe infoframe;
ssize_t len;
u8 iframes = 0x0a; /* UD1 infoframe */
u8 buf[32];
int ret;
int i;
ret = drm_hdmi_avi_infoframe_from_display_mode(&infoframe.avi,
connector,
mode);
if (ret < 0)
goto out;
len = hdmi_infoframe_pack(&infoframe, buf, sizeof(buf));
if (len < 0)
goto out;
for (i = 0; i < len; i++)
regmap_write(lt9611->regmap, 0x8440 + i, buf[i]);
ret = drm_hdmi_vendor_infoframe_from_display_mode(&infoframe.vendor.hdmi,
connector,
mode);
if (ret < 0)
goto out;
len = hdmi_infoframe_pack(&infoframe, buf, sizeof(buf));
if (len < 0)
goto out;
for (i = 0; i < len; i++)
regmap_write(lt9611->regmap, 0x8474 + i, buf[i]);
iframes |= 0x20;
out:
regmap_write(lt9611->regmap, 0x843d, iframes); /* UD1 infoframe */
}
static void lt9611_hdmi_tx_digital(struct lt9611 *lt9611, bool is_hdmi)
{
if (is_hdmi)
regmap_write(lt9611->regmap, 0x82d6, 0x8c);
else
......@@ -688,9 +726,7 @@ lt9611_bridge_atomic_enable(struct drm_bridge *bridge,
struct drm_connector_state *conn_state;
struct drm_crtc_state *crtc_state;
struct drm_display_mode *mode;
struct hdmi_avi_infoframe avi_frame;
unsigned int postdiv;
int ret;
connector = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder);
if (WARN_ON(!connector))
......@@ -711,18 +747,13 @@ lt9611_bridge_atomic_enable(struct drm_bridge *bridge,
lt9611_mipi_video_setup(lt9611, mode);
lt9611_pcr_setup(lt9611, mode, postdiv);
ret = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame,
connector,
mode);
if (!ret)
lt9611->vic = avi_frame.video_code;
if (lt9611_power_on(lt9611)) {
dev_err(lt9611->dev, "power on failed\n");
return;
}
lt9611_mipi_input_analog(lt9611);
lt9611_hdmi_set_infoframes(lt9611, connector, mode);
lt9611_hdmi_tx_digital(lt9611, connector->display_info.is_hdmi);
lt9611_hdmi_tx_phy(lt9611);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment