Re: [PATCH v3 21/21] drm/bridge: ti-sn65dsi86: add drm_panel_bridge support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Sam,

Thank you for the patch.

On Fri, Jul 03, 2020 at 09:24:17PM +0200, Sam Ravnborg wrote:
> Prepare the bridge driver for use in a chained setup by
> replacing direct use of drm_panel with drm_panel_bridge support.
> 
> Note: the bridge panel will use the connector type from the panel.
> 
> Signed-off-by: Sam Ravnborg <sam@xxxxxxxxxxxx>
> Cc: Andrzej Hajda <a.hajda@xxxxxxxxxxx>
> Cc: Neil Armstrong <narmstrong@xxxxxxxxxxxx>
> Cc: Laurent Pinchart <Laurent.pinchart@xxxxxxxxxxxxxxxx>
> Cc: Jonas Karlman <jonas@xxxxxxxxx>
> Cc: Jernej Skrabec <jernej.skrabec@xxxxxxxx>
> ---
>  drivers/gpu/drm/bridge/ti-sn65dsi86.c | 27 +++++++++++++--------------
>  1 file changed, 13 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> index 0f75bb2d7f56..ecf0693e3018 100644
> --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> @@ -144,7 +144,7 @@ struct ti_sn_bridge {
>  	struct device_node		*host_node;
>  	struct mipi_dsi_device		*dsi;
>  	struct clk			*refclk;
> -	struct drm_panel		*panel;
> +	struct drm_bridge		*panel_bridge;
>  	struct gpio_desc		*enable_gpio;
>  	struct regulator_bulk_data	supplies[SN_REGULATOR_SUPPLY_NUM];
>  	int				dp_lanes;
> @@ -263,7 +263,7 @@ static int ti_sn_bridge_connector_get_modes(struct drm_connector *connector)
>  {
>  	struct ti_sn_bridge *pdata = connector_to_ti_sn_bridge(connector);
>  
> -	return drm_panel_get_modes(pdata->panel, connector);
> +	return drm_bridge_get_modes(pdata->panel_bridge, connector);
>  }
>  
>  static enum drm_mode_status
> @@ -395,9 +395,8 @@ static int ti_sn_bridge_attach(struct drm_bridge *bridge,
>  	pdata->dsi = dsi;
>  
>  	/* attach panel to bridge */
> -	drm_panel_attach(pdata->panel, &pdata->connector);
> -
> -	return 0;
> +	return drm_bridge_attach(bridge->encoder, pdata->panel_bridge,
> +				 bridge, flags);

Same comment as earlier in this series regarding the flags.

I suppose attaching the panel bridge will be moved before creating the
connector in a future patch series ?

>  
>  err_dsi_attach:
>  	mipi_dsi_device_unregister(dsi);
> @@ -410,16 +409,12 @@ static void ti_sn_bridge_disable(struct drm_bridge *bridge)
>  {
>  	struct ti_sn_bridge *pdata = bridge_to_ti_sn_bridge(bridge);
>  
> -	drm_panel_disable(pdata->panel);
> -
>  	/* disable video stream */
>  	regmap_update_bits(pdata->regmap, SN_ENH_FRAME_REG, VSTREAM_ENABLE, 0);
>  	/* semi auto link training mode OFF */
>  	regmap_write(pdata->regmap, SN_ML_TX_MODE_REG, 0);
>  	/* disable DP PLL */
>  	regmap_write(pdata->regmap, SN_PLL_ENABLE_REG, 0);
> -
> -	drm_panel_unprepare(pdata->panel);
>  }
>  
>  static u32 ti_sn_bridge_get_dsi_freq(struct ti_sn_bridge *pdata)
> @@ -780,8 +775,6 @@ static void ti_sn_bridge_enable(struct drm_bridge *bridge)
>  	/* enable video stream */
>  	regmap_update_bits(pdata->regmap, SN_ENH_FRAME_REG, VSTREAM_ENABLE,
>  			   VSTREAM_ENABLE);
> -
> -	drm_panel_enable(pdata->panel);
>  }
>  
>  static void ti_sn_bridge_pre_enable(struct drm_bridge *bridge)
> @@ -811,8 +804,6 @@ static void ti_sn_bridge_pre_enable(struct drm_bridge *bridge)
>  	 */
>  	regmap_update_bits(pdata->regmap, SN_HPD_DISABLE_REG, HPD_DISABLE,
>  			   HPD_DISABLE);
> -
> -	drm_panel_prepare(pdata->panel);
>  }
>  
>  static void ti_sn_bridge_post_disable(struct drm_bridge *bridge)
> @@ -1163,6 +1154,8 @@ static int ti_sn_bridge_probe(struct i2c_client *client,
>  			      const struct i2c_device_id *id)
>  {
>  	struct ti_sn_bridge *pdata;
> +	struct drm_bridge *bridge;
> +	struct drm_panel *panel;
>  	int ret;
>  
>  	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
> @@ -1185,12 +1178,18 @@ static int ti_sn_bridge_probe(struct i2c_client *client,
>  	pdata->dev = &client->dev;
>  
>  	ret = drm_of_find_panel_or_bridge(pdata->dev->of_node, 1, 0,
> -					  &pdata->panel, NULL);
> +					  &panel, NULL);
>  	if (ret) {
>  		DRM_ERROR("could not find any panel node\n");
>  		return ret;
>  	}
>  
> +	bridge = devm_drm_panel_bridge_add(pdata->dev, panel);
> +	if (IS_ERR(bridge))
> +		return PTR_ERR(bridge);
> +
> +	pdata->panel_bridge = bridge;
> +
>  	dev_set_drvdata(&client->dev, pdata);
>  
>  	pdata->enable_gpio = devm_gpiod_get(pdata->dev, "enable",

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux