Commit 9045e91a authored by Maxime Ripard's avatar Maxime Ripard

drm/vc4: hdmi: Add reset callback

The BCM2711 and BCM283x HDMI controllers use a slightly different reset
sequence, so let's add a callback to reset the controller.
Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
Tested-by: default avatarChanwoo Choi <cw00.choi@samsung.com>
Tested-by: default avatarHoegeun Kwon <hoegeun.kwon@samsung.com>
Tested-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: default avatarDave Stevenson <dave.stevenson@raspberrypi.com>
Link: https://patchwork.freedesktop.org/patch/msgid/a34bcb493da07eae58ed704f65e72ce0748e8952.1599120059.git-series.maxime@cerno.tech
parent 311e305f
...@@ -69,6 +69,21 @@ static int vc4_hdmi_debugfs_regs(struct seq_file *m, void *unused) ...@@ -69,6 +69,21 @@ static int vc4_hdmi_debugfs_regs(struct seq_file *m, void *unused)
return 0; return 0;
} }
static void vc4_hdmi_reset(struct vc4_hdmi *vc4_hdmi)
{
HDMI_WRITE(HDMI_M_CTL, VC4_HD_M_SW_RST);
udelay(1);
HDMI_WRITE(HDMI_M_CTL, 0);
HDMI_WRITE(HDMI_M_CTL, VC4_HD_M_ENABLE);
HDMI_WRITE(HDMI_SW_RESET_CONTROL,
VC4_HDMI_SW_RESET_HDMI |
VC4_HDMI_SW_RESET_FORMAT_DETECT);
HDMI_WRITE(HDMI_SW_RESET_CONTROL, 0);
}
static enum drm_connector_status static enum drm_connector_status
vc4_hdmi_connector_detect(struct drm_connector *connector, bool force) vc4_hdmi_connector_detect(struct drm_connector *connector, bool force)
{ {
...@@ -363,11 +378,8 @@ static void vc4_hdmi_encoder_enable(struct drm_encoder *encoder) ...@@ -363,11 +378,8 @@ static void vc4_hdmi_encoder_enable(struct drm_encoder *encoder)
return; return;
} }
HDMI_WRITE(HDMI_SW_RESET_CONTROL, if (vc4_hdmi->variant->reset)
VC4_HDMI_SW_RESET_HDMI | vc4_hdmi->variant->reset(vc4_hdmi);
VC4_HDMI_SW_RESET_FORMAT_DETECT);
HDMI_WRITE(HDMI_SW_RESET_CONTROL, 0);
/* PHY should be in reset, like /* PHY should be in reset, like
* vc4_hdmi_encoder_disable() does. * vc4_hdmi_encoder_disable() does.
...@@ -1291,14 +1303,6 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) ...@@ -1291,14 +1303,6 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
vc4_hdmi->hpd_active_low = hpd_gpio_flags & OF_GPIO_ACTIVE_LOW; vc4_hdmi->hpd_active_low = hpd_gpio_flags & OF_GPIO_ACTIVE_LOW;
} }
/* HDMI core must be enabled. */
if (!(HDMI_READ(HDMI_M_CTL) & VC4_HD_M_ENABLE)) {
HDMI_WRITE(HDMI_M_CTL, VC4_HD_M_SW_RST);
udelay(1);
HDMI_WRITE(HDMI_M_CTL, 0);
HDMI_WRITE(HDMI_M_CTL, VC4_HD_M_ENABLE);
}
pm_runtime_enable(dev); pm_runtime_enable(dev);
drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS); drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS);
...@@ -1427,6 +1431,7 @@ static const struct vc4_hdmi_variant bcm2835_variant = { ...@@ -1427,6 +1431,7 @@ static const struct vc4_hdmi_variant bcm2835_variant = {
.num_registers = ARRAY_SIZE(vc4_hdmi_fields), .num_registers = ARRAY_SIZE(vc4_hdmi_fields),
.init_resources = vc4_hdmi_init_resources, .init_resources = vc4_hdmi_init_resources,
.reset = vc4_hdmi_reset,
}; };
static const struct of_device_id vc4_hdmi_dt_match[] = { static const struct of_device_id vc4_hdmi_dt_match[] = {
......
...@@ -35,6 +35,9 @@ struct vc4_hdmi_variant { ...@@ -35,6 +35,9 @@ struct vc4_hdmi_variant {
* clocks, etc) for that variant. * clocks, etc) for that variant.
*/ */
int (*init_resources)(struct vc4_hdmi *vc4_hdmi); int (*init_resources)(struct vc4_hdmi *vc4_hdmi);
/* Callback to reset the HDMI block */
void (*reset)(struct vc4_hdmi *vc4_hdmi);
}; };
/* HDMI audio information */ /* HDMI audio information */
......
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