[PATCH 21/27] drm: bridge: dw-hdmi: Pass drm_connector to internal functions as needed

Neil Armstrong narmstrong at baylibre.com
Tue May 26 12:29:45 UTC 2020


On 26/05/2020 03:14, Laurent Pinchart wrote:
> To prepare for making connector creation optional in the driver, pass
> the drm_connector explicitly to the internal functions that require it.
> The functions that still access the connector from the dw_hdmi structure
> are dw_hdmi_connector_create() and __dw_hdmi_probe(). The former access
> is expected, as that's where the internal connector is created. The
> latter will be addressed separately.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas at ideasonboard.com>
> ---
>  drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 31 +++++++++++++----------
>  1 file changed, 18 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> index 16bffedb4715..b69c14b9de62 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> @@ -1632,18 +1632,17 @@ static void hdmi_tx_hdcp_config(struct dw_hdmi *hdmi)
>  }
>  
>  static void hdmi_config_AVI(struct dw_hdmi *hdmi,
> +			    const struct drm_connector *connector,
>  			    const struct drm_display_mode *mode)
>  {
>  	struct hdmi_avi_infoframe frame;
>  	u8 val;
>  
>  	/* Initialise info frame from DRM mode */
> -	drm_hdmi_avi_infoframe_from_display_mode(&frame,
> -						 &hdmi->connector, mode);
> +	drm_hdmi_avi_infoframe_from_display_mode(&frame, connector, mode);
>  
>  	if (hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_out_bus_format)) {
> -		drm_hdmi_avi_infoframe_quant_range(&frame, &hdmi->connector,
> -						   mode,
> +		drm_hdmi_avi_infoframe_quant_range(&frame, connector, mode,
>  						   hdmi->hdmi_data.rgb_limited_range ?
>  						   HDMI_QUANTIZATION_RANGE_LIMITED :
>  						   HDMI_QUANTIZATION_RANGE_FULL);
> @@ -1760,14 +1759,14 @@ static void hdmi_config_AVI(struct dw_hdmi *hdmi,
>  }
>  
>  static void hdmi_config_vendor_specific_infoframe(struct dw_hdmi *hdmi,
> +						  const struct drm_connector *connector,
>  						  const struct drm_display_mode *mode)
>  {
>  	struct hdmi_vendor_infoframe frame;
>  	u8 buffer[10];
>  	ssize_t err;
>  
> -	err = drm_hdmi_vendor_infoframe_from_display_mode(&frame,
> -							  &hdmi->connector,
> +	err = drm_hdmi_vendor_infoframe_from_display_mode(&frame, connector,
>  							  mode);
>  	if (err < 0)
>  		/*
> @@ -1813,9 +1812,10 @@ static void hdmi_config_vendor_specific_infoframe(struct dw_hdmi *hdmi,
>  			HDMI_FC_DATAUTO0_VSD_MASK);
>  }
>  
> -static void hdmi_config_drm_infoframe(struct dw_hdmi *hdmi)
> +static void hdmi_config_drm_infoframe(struct dw_hdmi *hdmi,
> +				      const struct drm_connector *connector)
>  {
> -	const struct drm_connector_state *conn_state = hdmi->connector.state;
> +	const struct drm_connector_state *conn_state = connector->state;
>  	struct hdmi_drm_infoframe frame;
>  	u8 buffer[30];
>  	ssize_t err;
> @@ -2118,9 +2118,9 @@ static void hdmi_disable_overflow_interrupts(struct dw_hdmi *hdmi)
>  }
>  
>  static int dw_hdmi_setup(struct dw_hdmi *hdmi,
> +			 const struct drm_connector *connector,
>  			 const struct drm_display_mode *mode)
>  {
> -	struct drm_connector *connector = &hdmi->connector;
>  	int ret;
>  
>  	hdmi_disable_overflow_interrupts(hdmi);
> @@ -2192,9 +2192,9 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi,
>  		dev_dbg(hdmi->dev, "%s HDMI mode\n", __func__);
>  
>  		/* HDMI Initialization Step F - Configure AVI InfoFrame */
> -		hdmi_config_AVI(hdmi, mode);
> -		hdmi_config_vendor_specific_infoframe(hdmi, mode);
> -		hdmi_config_drm_infoframe(hdmi);
> +		hdmi_config_AVI(hdmi, connector, mode);
> +		hdmi_config_vendor_specific_infoframe(hdmi, connector, mode);
> +		hdmi_config_drm_infoframe(hdmi, connector);
>  	} else {
>  		dev_dbg(hdmi->dev, "%s DVI mode\n", __func__);
>  	}
> @@ -2263,7 +2263,12 @@ static void initialize_hdmi_ih_mutes(struct dw_hdmi *hdmi)
>  static void dw_hdmi_poweron(struct dw_hdmi *hdmi)
>  {
>  	hdmi->bridge_is_on = true;
> -	dw_hdmi_setup(hdmi, &hdmi->previous_mode);
> +
> +	/*
> +	 * The curr_conn field is guaranteed to be valid here, as this function
> +	 * is only be called when !hdmi->disabled.
> +	 */
> +	dw_hdmi_setup(hdmi, hdmi->curr_conn, &hdmi->previous_mode);
>  }
>  
>  static void dw_hdmi_poweroff(struct dw_hdmi *hdmi)
> 

Reviewed-by: Neil Armstrong <narmstrong at baylibre.com>


More information about the dri-devel mailing list