|
@@ -95,6 +95,7 @@ static const struct {
|
|
|
HDMI_REG(VC4_HDMI_SW_RESET_CONTROL),
|
|
|
HDMI_REG(VC4_HDMI_HOTPLUG_INT),
|
|
|
HDMI_REG(VC4_HDMI_HOTPLUG),
|
|
|
+ HDMI_REG(VC4_HDMI_RAM_PACKET_CONFIG),
|
|
|
HDMI_REG(VC4_HDMI_HORZA),
|
|
|
HDMI_REG(VC4_HDMI_HORZB),
|
|
|
HDMI_REG(VC4_HDMI_FIFO_CTL),
|
|
@@ -495,6 +496,16 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
|
|
|
goto err_put_i2c;
|
|
|
}
|
|
|
|
|
|
+ /* This is the rate that is set by the firmware. The number
|
|
|
+ * needs to be a bit higher than the pixel clock rate
|
|
|
+ * (generally 148.5Mhz).
|
|
|
+ */
|
|
|
+ ret = clk_set_rate(hdmi->hsm_clock, 163682864);
|
|
|
+ if (ret) {
|
|
|
+ DRM_ERROR("Failed to set HSM clock rate: %d\n", ret);
|
|
|
+ goto err_unprepare_pix;
|
|
|
+ }
|
|
|
+
|
|
|
ret = clk_prepare_enable(hdmi->hsm_clock);
|
|
|
if (ret) {
|
|
|
DRM_ERROR("Failed to turn on HDMI state machine clock: %d\n",
|
|
@@ -516,7 +527,24 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
|
|
|
vc4->hdmi = hdmi;
|
|
|
|
|
|
/* HDMI core must be enabled. */
|
|
|
- WARN_ON_ONCE((HD_READ(VC4_HD_M_CTL) & VC4_HD_M_ENABLE) == 0);
|
|
|
+ if (!(HD_READ(VC4_HD_M_CTL) & VC4_HD_M_ENABLE)) {
|
|
|
+ HD_WRITE(VC4_HD_M_CTL, VC4_HD_M_SW_RST);
|
|
|
+ udelay(1);
|
|
|
+ HD_WRITE(VC4_HD_M_CTL, 0);
|
|
|
+
|
|
|
+ HD_WRITE(VC4_HD_M_CTL, VC4_HD_M_ENABLE);
|
|
|
+
|
|
|
+ HDMI_WRITE(VC4_HDMI_SW_RESET_CONTROL,
|
|
|
+ VC4_HDMI_SW_RESET_HDMI |
|
|
|
+ VC4_HDMI_SW_RESET_FORMAT_DETECT);
|
|
|
+
|
|
|
+ HDMI_WRITE(VC4_HDMI_SW_RESET_CONTROL, 0);
|
|
|
+
|
|
|
+ /* PHY should be in reset, like
|
|
|
+ * vc4_hdmi_encoder_disable() does.
|
|
|
+ */
|
|
|
+ HDMI_WRITE(VC4_HDMI_TX_PHY_RESET_CTL, 0xf << 16);
|
|
|
+ }
|
|
|
|
|
|
drm_encoder_init(drm, hdmi->encoder, &vc4_hdmi_encoder_funcs,
|
|
|
DRM_MODE_ENCODER_TMDS, NULL);
|