diff options
author | Eric Anholt <eric@anholt.net> | 2016-02-12 17:15:14 -0500 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2016-02-26 18:51:10 -0500 |
commit | 851479ad5927b7b1aa141ca9dedb897a7bce2b1d (patch) | |
tree | dd6b847909a6592ce9868e18f24345ebd85a1903 | |
parent | 48627eb8dc55c60d35794105f6f79fb627347dbd (diff) |
drm/vc4: Bring HDMI up from power off if necessary.
If the firmware hadn't brought up HDMI for us, we need to do its
power-on reset sequence (reset HD and and clear its STANDBY bits,
reset HDMI, and leave the PHY disabled).
Signed-off-by: Eric Anholt <eric@anholt.net>
-rw-r--r-- | drivers/gpu/drm/vc4/vc4_hdmi.c | 29 | ||||
-rw-r--r-- | drivers/gpu/drm/vc4/vc4_regs.h | 2 |
2 files changed, 30 insertions, 1 deletions
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index c69c0460196b..6e55760511bf 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c | |||
@@ -495,6 +495,16 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) | |||
495 | goto err_put_i2c; | 495 | goto err_put_i2c; |
496 | } | 496 | } |
497 | 497 | ||
498 | /* This is the rate that is set by the firmware. The number | ||
499 | * needs to be a bit higher than the pixel clock rate | ||
500 | * (generally 148.5Mhz). | ||
501 | */ | ||
502 | ret = clk_set_rate(hdmi->hsm_clock, 163682864); | ||
503 | if (ret) { | ||
504 | DRM_ERROR("Failed to set HSM clock rate: %d\n", ret); | ||
505 | goto err_unprepare_pix; | ||
506 | } | ||
507 | |||
498 | ret = clk_prepare_enable(hdmi->hsm_clock); | 508 | ret = clk_prepare_enable(hdmi->hsm_clock); |
499 | if (ret) { | 509 | if (ret) { |
500 | DRM_ERROR("Failed to turn on HDMI state machine clock: %d\n", | 510 | DRM_ERROR("Failed to turn on HDMI state machine clock: %d\n", |
@@ -516,7 +526,24 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) | |||
516 | vc4->hdmi = hdmi; | 526 | vc4->hdmi = hdmi; |
517 | 527 | ||
518 | /* HDMI core must be enabled. */ | 528 | /* HDMI core must be enabled. */ |
519 | WARN_ON_ONCE((HD_READ(VC4_HD_M_CTL) & VC4_HD_M_ENABLE) == 0); | 529 | if (!(HD_READ(VC4_HD_M_CTL) & VC4_HD_M_ENABLE)) { |
530 | HD_WRITE(VC4_HD_M_CTL, VC4_HD_M_SW_RST); | ||
531 | udelay(1); | ||
532 | HD_WRITE(VC4_HD_M_CTL, 0); | ||
533 | |||
534 | HD_WRITE(VC4_HD_M_CTL, VC4_HD_M_ENABLE); | ||
535 | |||
536 | HDMI_WRITE(VC4_HDMI_SW_RESET_CONTROL, | ||
537 | VC4_HDMI_SW_RESET_HDMI | | ||
538 | VC4_HDMI_SW_RESET_FORMAT_DETECT); | ||
539 | |||
540 | HDMI_WRITE(VC4_HDMI_SW_RESET_CONTROL, 0); | ||
541 | |||
542 | /* PHY should be in reset, like | ||
543 | * vc4_hdmi_encoder_disable() does. | ||
544 | */ | ||
545 | HDMI_WRITE(VC4_HDMI_TX_PHY_RESET_CTL, 0xf << 16); | ||
546 | } | ||
520 | 547 | ||
521 | drm_encoder_init(drm, hdmi->encoder, &vc4_hdmi_encoder_funcs, | 548 | drm_encoder_init(drm, hdmi->encoder, &vc4_hdmi_encoder_funcs, |
522 | DRM_MODE_ENCODER_TMDS, NULL); | 549 | DRM_MODE_ENCODER_TMDS, NULL); |
diff --git a/drivers/gpu/drm/vc4/vc4_regs.h b/drivers/gpu/drm/vc4/vc4_regs.h index 4e52a0a88551..85c36d238669 100644 --- a/drivers/gpu/drm/vc4/vc4_regs.h +++ b/drivers/gpu/drm/vc4/vc4_regs.h | |||
@@ -456,6 +456,8 @@ | |||
456 | #define VC4_HDMI_TX_PHY_RESET_CTL 0x2c0 | 456 | #define VC4_HDMI_TX_PHY_RESET_CTL 0x2c0 |
457 | 457 | ||
458 | #define VC4_HD_M_CTL 0x00c | 458 | #define VC4_HD_M_CTL 0x00c |
459 | # define VC4_HD_M_REGISTER_FILE_STANDBY (3 << 6) | ||
460 | # define VC4_HD_M_RAM_STANDBY (3 << 4) | ||
459 | # define VC4_HD_M_SW_RST BIT(2) | 461 | # define VC4_HD_M_SW_RST BIT(2) |
460 | # define VC4_HD_M_ENABLE BIT(0) | 462 | # define VC4_HD_M_ENABLE BIT(0) |
461 | 463 | ||