lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <43cca862-01cc-119d-4a1b-4aa31ec88a04@i2se.com>
Date:   Sat, 25 Apr 2020 23:06:51 +0200
From:   Stefan Wahren <stefan.wahren@...e.com>
To:     Maxime Ripard <maxime@...no.tech>,
        Nicolas Saenz Julienne <nsaenzjulienne@...e.de>,
        Eric Anholt <eric@...olt.net>
Cc:     Tim Gover <tim.gover@...pberrypi.com>,
        Dave Stevenson <dave.stevenson@...pberrypi.com>,
        linux-kernel@...r.kernel.org, dri-devel@...ts.freedesktop.org,
        bcm-kernel-feedback-list@...adcom.com,
        linux-rpi-kernel@...ts.infradead.org,
        Phil Elwell <phil@...pberrypi.com>,
        linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v2 72/91] drm/vc4: hdmi: Introduce resource init and
 variant

Hi Maxime,

Am 24.04.20 um 17:34 schrieb Maxime Ripard:
> The HDMI controllers found in the BCM2711 has a pretty different clock and
> registers areas than found in the older BCM283x SoCs.
>
> Let's create a variant structure to store the various adjustments we'll
> need later on, and a function to get the resources needed for one
> particular version.
>
> Signed-off-by: Maxime Ripard <maxime@...no.tech>
> ---
>  drivers/gpu/drm/vc4/vc4_hdmi.c | 67 ++++++++++++++++++++++-------------
>  drivers/gpu/drm/vc4/vc4_hdmi.h | 10 +++++-
>  2 files changed, 54 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
> index eeaea2ad46fa..5f5943370982 100644
> --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
> +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
> @@ -1186,38 +1186,23 @@ static const struct cec_adap_ops vc4_hdmi_cec_adap_ops = {
>  };
>  #endif
>  
> -static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
> +static int vc4_hdmi_init_resources(struct vc4_hdmi *vc4_hdmi)
>  {
> -#ifdef CONFIG_DRM_VC4_HDMI_CEC
> -	struct cec_connector_info conn_info;
> -#endif
> -	struct platform_device *pdev = to_platform_device(dev);
> -	struct drm_device *drm = dev_get_drvdata(master);
> -	struct vc4_hdmi *vc4_hdmi;
> -	struct drm_encoder *encoder;
> -	struct device_node *ddc_node;
> -	u32 value;
> -	int ret;
> -
> -	vc4_hdmi = devm_kzalloc(dev, sizeof(*vc4_hdmi), GFP_KERNEL);
> -	if (!vc4_hdmi)
> -		return -ENOMEM;
> -
> -	vc4_hdmi->pdev = pdev;
> -	encoder = &vc4_hdmi->encoder.base.base;
> -	encoder->base.type = VC4_ENCODER_TYPE_HDMI0;
> +	struct platform_device *pdev = vc4_hdmi->pdev;
> +	struct device *dev = &pdev->dev;
>  
>  	vc4_hdmi->hdmicore_regs = vc4_ioremap_regs(pdev, 0);
>  	if (IS_ERR(vc4_hdmi->hdmicore_regs))
>  		return PTR_ERR(vc4_hdmi->hdmicore_regs);
>  
> +	vc4_hdmi->hdmi_regset.base = vc4_hdmi->hdmicore_regs;
> +	vc4_hdmi->hdmi_regset.regs = hdmi_regs;
> +	vc4_hdmi->hdmi_regset.nregs = ARRAY_SIZE(hdmi_regs);
> +
>  	vc4_hdmi->hd_regs = vc4_ioremap_regs(pdev, 1);
>  	if (IS_ERR(vc4_hdmi->hd_regs))
>  		return PTR_ERR(vc4_hdmi->hd_regs);
>  
> -	vc4_hdmi->hdmi_regset.base = vc4_hdmi->hdmicore_regs;
> -	vc4_hdmi->hdmi_regset.regs = hdmi_regs;
> -	vc4_hdmi->hdmi_regset.nregs = ARRAY_SIZE(hdmi_regs);
>  	vc4_hdmi->hd_regset.base = vc4_hdmi->hd_regs;
>  	vc4_hdmi->hd_regset.regs = hd_regs;
>  	vc4_hdmi->hd_regset.nregs = ARRAY_SIZE(hd_regs);
> @@ -1227,12 +1212,44 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
>  		DRM_ERROR("Failed to get pixel clock\n");
>  		return PTR_ERR(vc4_hdmi->pixel_clock);
>  	}
> +
>  	vc4_hdmi->hsm_clock = devm_clk_get(dev, "hdmi");
>  	if (IS_ERR(vc4_hdmi->hsm_clock)) {
>  		DRM_ERROR("Failed to get HDMI state machine clock\n");
>  		return PTR_ERR(vc4_hdmi->hsm_clock);
>  	}

moving the VC4 specific HDMI core enabling at this place, avoid the
warning "vc4_hdmi fef00700.hdmi: Unknown register ID 46" on the BCM2711
[1]. Not sure this is safe.

+       /* 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);
+       }

[1] - https://github.com/raspberrypi/linux/pull/3515#issuecomment-606623658

>  
> +	return 0;
> +}
> +

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ