[PATCH v2 89/91] drm/vc4: hdmi: Support the BCM2711 HDMI controllers

Stefan Wahren stefan.wahren at i2se.com
Thu May 7 17:36:52 UTC 2020


Hi Maxime,

Am 24.04.20 um 17:35 schrieb Maxime Ripard:
> Now that the driver is ready for it, let's bring in the HDMI controllers
> variants for the BCM2711.
>
> Signed-off-by: Maxime Ripard <maxime at cerno.tech>
> ---
>  drivers/gpu/drm/vc4/vc4_hdmi.c      | 276 +++++++++++++++++-
>  drivers/gpu/drm/vc4/vc4_hdmi.h      |  35 ++-
>  drivers/gpu/drm/vc4/vc4_hdmi_phy.c  | 468 +++++++++++++++++++++++++++++-
>  drivers/gpu/drm/vc4/vc4_hdmi_regs.h | 201 ++++++++++++-
>  4 files changed, 980 insertions(+)
...
> +
> +#define VC4_HDMI_RM_FORMAT_SHIFT_SHIFT			24
> +#define VC4_HDMI_RM_FORMAT_SHIFT_MASK			VC4_MASK(25, 24)
> +
> +#define OSCILLATOR_FREQUENCY	54000000
Just want to mention that the oscillator frequency of the BCM2711 is
available via bcm2711.dtsi
> +
>  void vc4_hdmi_phy_init(struct vc4_hdmi *vc4_hdmi, struct drm_display_mode *mode)
>  {
>  	/* PHY should be in reset, like
> @@ -38,3 +155,354 @@ void vc4_hdmi_phy_rng_disable(struct vc4_hdmi *vc4_hdmi)
>  		   HDMI_READ(HDMI_TX_PHY_CTL_0) |
>  		   VC4_HDMI_TX_PHY_RNG_PWRDN);
>  }
> +
> +static unsigned long long
> +phy_get_vco_freq(unsigned long long clock, u8 *vco_sel, u8 *vco_div)
> +{
> +	unsigned long long vco_freq = clock;
> +	unsigned int _vco_div = 0;
> +	unsigned int _vco_sel = 0;
> +
> +	while (vco_freq < 3000000000ULL) {
> +		_vco_div++;
> +		vco_freq = clock * _vco_div * 10;
> +	}
> +
> +	if (vco_freq > 4500000000ULL)
> +		_vco_sel = 1;
> +
> +	*vco_sel = _vco_sel;
> +	*vco_div = _vco_div;
> +
> +	return vco_freq;
> +}
> +
> +static u8 phy_get_cp_current(unsigned long vco_freq)
> +{
> +	if (vco_freq < 3700000000ULL)
> +		return 0x1c;
> +
> +	return 0xc8;

The vendor tree contains a patch [1] for this return value, which said
that the value is a typo and causes warnings because the value must be 6
bit.

Btw that my tests with Raspberry Pi 3 and 4 were good so far.

[1] -
https://github.com/raspberrypi/linux/commit/71d5db1b342097fa4dc561202837beb934648b25

> +}
> +



More information about the dri-devel mailing list