diff mbox series

[v4,20/23] drm/bridge: ti-tfp410: Provide ddc symlink in connector sysfs directory

Message ID c665d01c4eacc61417519c40c54d5060b0bbe105.1562843413.git.andrzej.p@collabora.com (mailing list archive)
State New, archived
Headers show
Series Associate ddc adapters with connectors | expand

Commit Message

Andrzej Pietrasiewicz July 11, 2019, 11:26 a.m. UTC
Use the ddc pointer provided by the generic connector.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
---
 drivers/gpu/drm/bridge/ti-tfp410.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

Comments

Neil Armstrong July 30, 2019, 12:25 p.m. UTC | #1
On 11/07/2019 13:26, Andrzej Pietrasiewicz wrote:
> Use the ddc pointer provided by the generic connector.
> 
> Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
> ---
>  drivers/gpu/drm/bridge/ti-tfp410.c | 19 +++++++++----------
>  1 file changed, 9 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c
> index dbf35c7bc85e..e55358f0a5ba 100644
> --- a/drivers/gpu/drm/bridge/ti-tfp410.c
> +++ b/drivers/gpu/drm/bridge/ti-tfp410.c
> @@ -26,7 +26,6 @@ struct tfp410 {
>  	unsigned int		connector_type;
>  
>  	u32			bus_format;
> -	struct i2c_adapter	*ddc;
>  	struct gpio_desc	*hpd;
>  	int			hpd_irq;
>  	struct delayed_work	hpd_work;
> @@ -55,10 +54,10 @@ static int tfp410_get_modes(struct drm_connector *connector)
>  	struct edid *edid;
>  	int ret;
>  
> -	if (!dvi->ddc)
> +	if (!dvi->connector.ddc)
>  		goto fallback;
>  
> -	edid = drm_get_edid(connector, dvi->ddc);
> +	edid = drm_get_edid(connector, dvi->connector.ddc);
>  	if (!edid) {
>  		DRM_INFO("EDID read failed. Fallback to standard modes\n");
>  		goto fallback;
> @@ -98,8 +97,8 @@ tfp410_connector_detect(struct drm_connector *connector, bool force)
>  			return connector_status_disconnected;
>  	}
>  
> -	if (dvi->ddc) {
> -		if (drm_probe_ddc(dvi->ddc))
> +	if (dvi->connector.ddc) {
> +		if (drm_probe_ddc(dvi->connector.ddc))
>  			return connector_status_connected;
>  		else
>  			return connector_status_disconnected;
> @@ -297,8 +296,8 @@ static int tfp410_get_connector_properties(struct tfp410 *dvi)
>  	if (!ddc_phandle)
>  		goto fail;
>  
> -	dvi->ddc = of_get_i2c_adapter_by_node(ddc_phandle);
> -	if (dvi->ddc)
> +	dvi->connector.ddc = of_get_i2c_adapter_by_node(ddc_phandle);
> +	if (dvi->connector.ddc)
>  		dev_info(dvi->dev, "Connector's ddc i2c bus found\n");
>  	else
>  		ret = -EPROBE_DEFER;
> @@ -367,7 +366,7 @@ static int tfp410_init(struct device *dev, bool i2c)
>  
>  	return 0;
>  fail:
> -	i2c_put_adapter(dvi->ddc);
> +	i2c_put_adapter(dvi->connector.ddc);
>  	if (dvi->hpd)
>  		gpiod_put(dvi->hpd);
>  	return ret;
> @@ -382,8 +381,8 @@ static int tfp410_fini(struct device *dev)
>  
>  	drm_bridge_remove(&dvi->bridge);
>  
> -	if (dvi->ddc)
> -		i2c_put_adapter(dvi->ddc);
> +	if (dvi->connector.ddc)
> +		i2c_put_adapter(dvi->connector.ddc);
>  	if (dvi->hpd)
>  		gpiod_put(dvi->hpd);
>  
> 

Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c
index dbf35c7bc85e..e55358f0a5ba 100644
--- a/drivers/gpu/drm/bridge/ti-tfp410.c
+++ b/drivers/gpu/drm/bridge/ti-tfp410.c
@@ -26,7 +26,6 @@  struct tfp410 {
 	unsigned int		connector_type;
 
 	u32			bus_format;
-	struct i2c_adapter	*ddc;
 	struct gpio_desc	*hpd;
 	int			hpd_irq;
 	struct delayed_work	hpd_work;
@@ -55,10 +54,10 @@  static int tfp410_get_modes(struct drm_connector *connector)
 	struct edid *edid;
 	int ret;
 
-	if (!dvi->ddc)
+	if (!dvi->connector.ddc)
 		goto fallback;
 
-	edid = drm_get_edid(connector, dvi->ddc);
+	edid = drm_get_edid(connector, dvi->connector.ddc);
 	if (!edid) {
 		DRM_INFO("EDID read failed. Fallback to standard modes\n");
 		goto fallback;
@@ -98,8 +97,8 @@  tfp410_connector_detect(struct drm_connector *connector, bool force)
 			return connector_status_disconnected;
 	}
 
-	if (dvi->ddc) {
-		if (drm_probe_ddc(dvi->ddc))
+	if (dvi->connector.ddc) {
+		if (drm_probe_ddc(dvi->connector.ddc))
 			return connector_status_connected;
 		else
 			return connector_status_disconnected;
@@ -297,8 +296,8 @@  static int tfp410_get_connector_properties(struct tfp410 *dvi)
 	if (!ddc_phandle)
 		goto fail;
 
-	dvi->ddc = of_get_i2c_adapter_by_node(ddc_phandle);
-	if (dvi->ddc)
+	dvi->connector.ddc = of_get_i2c_adapter_by_node(ddc_phandle);
+	if (dvi->connector.ddc)
 		dev_info(dvi->dev, "Connector's ddc i2c bus found\n");
 	else
 		ret = -EPROBE_DEFER;
@@ -367,7 +366,7 @@  static int tfp410_init(struct device *dev, bool i2c)
 
 	return 0;
 fail:
-	i2c_put_adapter(dvi->ddc);
+	i2c_put_adapter(dvi->connector.ddc);
 	if (dvi->hpd)
 		gpiod_put(dvi->hpd);
 	return ret;
@@ -382,8 +381,8 @@  static int tfp410_fini(struct device *dev)
 
 	drm_bridge_remove(&dvi->bridge);
 
-	if (dvi->ddc)
-		i2c_put_adapter(dvi->ddc);
+	if (dvi->connector.ddc)
+		i2c_put_adapter(dvi->connector.ddc);
 	if (dvi->hpd)
 		gpiod_put(dvi->hpd);