Re: [PATCH v2 08/50] drm/bridge: simple-bridge: Add support for non-VGA bridges

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

 



On Tue, 20 Aug 2019 04:16:39 +0300
Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx> wrote:

> Create a new simple_bridge_info structure that stores information about
> the bridge model, and store the bridge timings in there, along with the
> connector type. Use that new structure for of_device_id data. This
> enables support for non-VGA bridges.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
> Reviewed-by: Andrzej Hajda <a.hajda@xxxxxxxxxxx>
> Reviewed-by: Stefan Agner <stefan@xxxxxxxx>

Reviewed-by: Boris Brezillon <boris.brezillon@xxxxxxxxxxxxx>

> ---
> Changes since v1:
> 
> - Renamed simple_bridge_info.type field to connector_type
> ---
>  drivers/gpu/drm/bridge/simple-bridge.c | 41 ++++++++++++++++++--------
>  1 file changed, 29 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/simple-bridge.c b/drivers/gpu/drm/bridge/simple-bridge.c
> index 7551a361f22e..85aa852eafb4 100644
> --- a/drivers/gpu/drm/bridge/simple-bridge.c
> +++ b/drivers/gpu/drm/bridge/simple-bridge.c
> @@ -16,10 +16,17 @@
>  #include <drm/drm_print.h>
>  #include <drm/drm_probe_helper.h>
>  
> +struct simple_bridge_info {
> +	const struct drm_bridge_timings *timings;
> +	unsigned int connector_type;
> +};
> +
>  struct simple_bridge {
>  	struct drm_bridge	bridge;
>  	struct drm_connector	connector;
>  
> +	const struct simple_bridge_info *info;
> +
>  	struct i2c_adapter	*ddc;
>  	struct regulator	*vdd;
>  };
> @@ -117,7 +124,7 @@ static int simple_bridge_attach(struct drm_bridge *bridge,
>  				 &simple_bridge_con_helper_funcs);
>  	ret = drm_connector_init_with_ddc(bridge->dev, &sbridge->connector,
>  					  &simple_bridge_con_funcs,
> -					  DRM_MODE_CONNECTOR_VGA,
> +					  sbridge->info->connector_type,
>  					  sbridge->ddc);
>  	if (ret) {
>  		DRM_ERROR("Failed to initialize connector\n");
> @@ -187,6 +194,8 @@ static int simple_bridge_probe(struct platform_device *pdev)
>  		return -ENOMEM;
>  	platform_set_drvdata(pdev, sbridge);
>  
> +	sbridge->info = of_device_get_match_data(&pdev->dev);
> +
>  	sbridge->vdd = devm_regulator_get_optional(&pdev->dev, "vdd");
>  	if (IS_ERR(sbridge->vdd)) {
>  		int ret = PTR_ERR(sbridge->vdd);
> @@ -210,7 +219,7 @@ static int simple_bridge_probe(struct platform_device *pdev)
>  
>  	sbridge->bridge.funcs = &simple_bridge_bridge_funcs;
>  	sbridge->bridge.of_node = pdev->dev.of_node;
> -	sbridge->bridge.timings = of_device_get_match_data(&pdev->dev);
> +	sbridge->bridge.timings = sbridge->info->timings;
>  
>  	drm_bridge_add(&sbridge->bridge);
>  
> @@ -270,19 +279,27 @@ static const struct drm_bridge_timings ti_ths8135_bridge_timings = {
>  static const struct of_device_id simple_bridge_match[] = {
>  	{
>  		.compatible = "dumb-vga-dac",
> -		.data = NULL,
> -	},
> -	{
> +		.data = &(const struct simple_bridge_info) {
> +			.connector_type = DRM_MODE_CONNECTOR_VGA,
> +		},
> +	}, {
>  		.compatible = "adi,adv7123",
> -		.data = &default_bridge_timings,
> -	},
> -	{
> +		.data = &(const struct simple_bridge_info) {
> +			.timings = &default_bridge_timings,
> +			.connector_type = DRM_MODE_CONNECTOR_VGA,
> +		},
> +	}, {
>  		.compatible = "ti,ths8135",
> -		.data = &ti_ths8135_bridge_timings,
> -	},
> -	{
> +		.data = &(const struct simple_bridge_info) {
> +			.timings = &ti_ths8135_bridge_timings,
> +			.connector_type = DRM_MODE_CONNECTOR_VGA,
> +		},
> +	}, {
>  		.compatible = "ti,ths8134",
> -		.data = &ti_ths8134_bridge_timings,
> +		.data = &(const struct simple_bridge_info) {
> +			.timings = &ti_ths8134_bridge_timings,
> +			.connector_type = DRM_MODE_CONNECTOR_VGA,
> +		},
>  	},
>  	{},
>  };

_______________________________________________
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