Commit 647b9655 authored by Maxime Ripard's avatar Maxime Ripard

drm/vc4: hdmi: Add PHY RNG enable / disable function

Let's continue the implementation of hooks for the parts that change in the
BCM2711 SoC with the PHY RNG setup.
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/216155f1c0b83e622ac60a2f7d00eb707de3acba.1599120059.git-series.maxime@cerno.tech
parent c457b8ae
...@@ -762,9 +762,9 @@ static int vc4_hdmi_audio_trigger(struct snd_pcm_substream *substream, int cmd, ...@@ -762,9 +762,9 @@ static int vc4_hdmi_audio_trigger(struct snd_pcm_substream *substream, int cmd,
switch (cmd) { switch (cmd) {
case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_START:
vc4_hdmi_set_audio_infoframe(encoder); vc4_hdmi_set_audio_infoframe(encoder);
HDMI_WRITE(HDMI_TX_PHY_CTL_0,
HDMI_READ(HDMI_TX_PHY_CTL_0) & if (vc4_hdmi->variant->phy_rng_enable)
~VC4_HDMI_TX_PHY_RNG_PWRDN); vc4_hdmi->variant->phy_rng_enable(vc4_hdmi);
HDMI_WRITE(HDMI_MAI_CTL, HDMI_WRITE(HDMI_MAI_CTL,
VC4_SET_FIELD(vc4_hdmi->audio.channels, VC4_SET_FIELD(vc4_hdmi->audio.channels,
...@@ -776,9 +776,10 @@ static int vc4_hdmi_audio_trigger(struct snd_pcm_substream *substream, int cmd, ...@@ -776,9 +776,10 @@ static int vc4_hdmi_audio_trigger(struct snd_pcm_substream *substream, int cmd,
VC4_HD_MAI_CTL_DLATE | VC4_HD_MAI_CTL_DLATE |
VC4_HD_MAI_CTL_ERRORE | VC4_HD_MAI_CTL_ERRORE |
VC4_HD_MAI_CTL_ERRORF); VC4_HD_MAI_CTL_ERRORF);
HDMI_WRITE(HDMI_TX_PHY_CTL_0,
HDMI_READ(HDMI_TX_PHY_CTL_0) | if (vc4_hdmi->variant->phy_rng_disable)
VC4_HDMI_TX_PHY_RNG_PWRDN); vc4_hdmi->variant->phy_rng_disable(vc4_hdmi);
break; break;
default: default:
break; break;
...@@ -1432,6 +1433,8 @@ static const struct vc4_hdmi_variant bcm2835_variant = { ...@@ -1432,6 +1433,8 @@ static const struct vc4_hdmi_variant bcm2835_variant = {
.reset = vc4_hdmi_reset, .reset = vc4_hdmi_reset,
.phy_init = vc4_hdmi_phy_init, .phy_init = vc4_hdmi_phy_init,
.phy_disable = vc4_hdmi_phy_disable, .phy_disable = vc4_hdmi_phy_disable,
.phy_rng_enable = vc4_hdmi_phy_rng_enable,
.phy_rng_disable = vc4_hdmi_phy_rng_disable,
}; };
static const struct of_device_id vc4_hdmi_dt_match[] = { static const struct of_device_id vc4_hdmi_dt_match[] = {
......
...@@ -47,6 +47,12 @@ struct vc4_hdmi_variant { ...@@ -47,6 +47,12 @@ struct vc4_hdmi_variant {
/* Callback to disable the PHY */ /* Callback to disable the PHY */
void (*phy_disable)(struct vc4_hdmi *vc4_hdmi); void (*phy_disable)(struct vc4_hdmi *vc4_hdmi);
/* Callback to enable the RNG in the PHY */
void (*phy_rng_enable)(struct vc4_hdmi *vc4_hdmi);
/* Callback to disable the RNG in the PHY */
void (*phy_rng_disable)(struct vc4_hdmi *vc4_hdmi);
}; };
/* HDMI audio information */ /* HDMI audio information */
...@@ -107,5 +113,7 @@ encoder_to_vc4_hdmi(struct drm_encoder *encoder) ...@@ -107,5 +113,7 @@ encoder_to_vc4_hdmi(struct drm_encoder *encoder)
void vc4_hdmi_phy_init(struct vc4_hdmi *vc4_hdmi, void vc4_hdmi_phy_init(struct vc4_hdmi *vc4_hdmi,
struct drm_display_mode *mode); struct drm_display_mode *mode);
void vc4_hdmi_phy_disable(struct vc4_hdmi *vc4_hdmi); void vc4_hdmi_phy_disable(struct vc4_hdmi *vc4_hdmi);
void vc4_hdmi_phy_rng_enable(struct vc4_hdmi *vc4_hdmi);
void vc4_hdmi_phy_rng_disable(struct vc4_hdmi *vc4_hdmi);
#endif /* _VC4_HDMI_H_ */ #endif /* _VC4_HDMI_H_ */
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
*/ */
#include "vc4_hdmi.h" #include "vc4_hdmi.h"
#include "vc4_regs.h"
#include "vc4_hdmi_regs.h" #include "vc4_hdmi_regs.h"
void vc4_hdmi_phy_init(struct vc4_hdmi *vc4_hdmi, struct drm_display_mode *mode) void vc4_hdmi_phy_init(struct vc4_hdmi *vc4_hdmi, struct drm_display_mode *mode)
...@@ -23,3 +24,17 @@ void vc4_hdmi_phy_disable(struct vc4_hdmi *vc4_hdmi) ...@@ -23,3 +24,17 @@ void vc4_hdmi_phy_disable(struct vc4_hdmi *vc4_hdmi)
{ {
HDMI_WRITE(HDMI_TX_PHY_RESET_CTL, 0xf << 16); HDMI_WRITE(HDMI_TX_PHY_RESET_CTL, 0xf << 16);
} }
void vc4_hdmi_phy_rng_enable(struct vc4_hdmi *vc4_hdmi)
{
HDMI_WRITE(HDMI_TX_PHY_CTL_0,
HDMI_READ(HDMI_TX_PHY_CTL_0) &
~VC4_HDMI_TX_PHY_RNG_PWRDN);
}
void vc4_hdmi_phy_rng_disable(struct vc4_hdmi *vc4_hdmi)
{
HDMI_WRITE(HDMI_TX_PHY_CTL_0,
HDMI_READ(HDMI_TX_PHY_CTL_0) |
VC4_HDMI_TX_PHY_RNG_PWRDN);
}
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