Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1571294 > unrolled thread

Re: [PATCH 4/7] drm/exynos/hdmi: add bridge support

Started byInki Dae <inki.dae@samsung.com>
First post2017-02-01 08:40 +0100
Last post2017-02-03 07:50 +0100
Articles 8 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 4/7] drm/exynos/hdmi: add bridge support Inki Dae <inki.dae@samsung.com> - 2017-02-01 08:40 +0100
    Re: [PATCH 4/7] drm/exynos/hdmi: add bridge support Andrzej Hajda <a.hajda@samsung.com> - 2017-02-01 08:40 +0100
      Re: [PATCH 4/7] drm/exynos/hdmi: add bridge support Inki Dae <inki.dae@samsung.com> - 2017-02-01 08:50 +0100
        Re: [PATCH 4/7] drm/exynos/hdmi: add bridge support Andrzej Hajda <a.hajda@samsung.com> - 2017-02-01 09:20 +0100
          Re: [PATCH 4/7] drm/exynos/hdmi: add bridge support Inki Dae <inki.dae@samsung.com> - 2017-02-01 09:20 +0100
            [PATCH v3 4/7] drm/exynos/hdmi: add bridge support Andrzej Hajda <a.hajda@samsung.com> - 2017-02-01 09:30 +0100
              Re: [PATCH v3 4/7] drm/exynos/hdmi: add bridge support Inki Dae <inki.dae@samsung.com> - 2017-02-03 07:40 +0100
                Re: [PATCH v3 4/7] drm/exynos/hdmi: add bridge support Inki Dae <inki.dae@samsung.com> - 2017-02-03 07:50 +0100

#1571294 — Re: [PATCH 4/7] drm/exynos/hdmi: add bridge support

FromInki Dae <inki.dae@samsung.com>
Date2017-02-01 08:40 +0100
SubjectRe: [PATCH 4/7] drm/exynos/hdmi: add bridge support
Message-ID<t5XGh-2WB-1@gated-at.bofh.it>

2017년 01월 20일 15:52에 Andrzej Hajda 이(가) 쓴 글:
> In some platforms there is attached another device to the end of HDMI.
> The patch adds support for it.

Andrzej, can you clarify what bridge device can be attached and actually is now attached to the end of HDMI?
And I wonder if we have the device tree file which defines the bridge device in mainline. Seems we have no the device tree file.

If nothing, then this patch should be merged with real use case.

Thanks.

> 
> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_hdmi.c | 56 +++++++++++++++++++++++++++++-------
>  1 file changed, 46 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
> index a73b192..41fb894 100644
> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> @@ -35,6 +35,7 @@
>  #include <linux/io.h>
>  #include <linux/of_address.h>
>  #include <linux/of_device.h>
> +#include <linux/of_graph.h>
>  #include <linux/hdmi.h>
>  #include <linux/component.h>
>  #include <linux/mfd/syscon.h>
> @@ -133,6 +134,7 @@ struct hdmi_context {
>  	struct regulator_bulk_data	regul_bulk[ARRAY_SIZE(supply)];
>  	struct regulator		*reg_hdmi_en;
>  	struct exynos_drm_clk		phy_clk;
> +	struct drm_bridge		*bridge;
>  };
>  
>  static inline struct hdmi_context *encoder_to_hdmi(struct drm_encoder *e)
> @@ -922,7 +924,15 @@ static int hdmi_create_connector(struct drm_encoder *encoder)
>  	drm_connector_register(connector);
>  	drm_mode_connector_attach_encoder(connector, encoder);
>  
> -	return 0;
> +	if (hdata->bridge) {
> +		encoder->bridge = hdata->bridge;
> +		hdata->bridge->encoder = encoder;
> +		ret = drm_bridge_attach(encoder->dev, hdata->bridge);
> +		if (ret)
> +			DRM_ERROR("Failed to attach bridge\n");
> +	}
> +
> +	return ret;
>  }
>  
>  static bool hdmi_mode_fixup(struct drm_encoder *encoder,
> @@ -1591,6 +1601,31 @@ static void hdmiphy_clk_enable(struct exynos_drm_clk *clk, bool enable)
>  		hdmiphy_disable(hdata);
>  }
>  
> +static int hdmi_bridge_init(struct hdmi_context *hdata)
> +{
> +	struct device *dev = hdata->dev;
> +	struct device_node *ep, *np;
> +
> +	ep = of_graph_get_endpoint_by_regs(dev->of_node, 1, -1);
> +	if (!ep)
> +		return 0;
> +
> +	np = of_graph_get_remote_port_parent(ep);
> +	of_node_put(ep);
> +	if (!np) {
> +		DRM_ERROR("failed to get remote port parent");
> +		return -EINVAL;
> +	}
> +
> +	hdata->bridge = of_drm_find_bridge(np);
> +	of_node_put(np);
> +
> +	if (!hdata->bridge)
> +		return -EPROBE_DEFER;
> +
> +	return 0;
> +}
> +
>  static int hdmi_resources_init(struct hdmi_context *hdata)
>  {
>  	struct device *dev = hdata->dev;
> @@ -1630,17 +1665,18 @@ static int hdmi_resources_init(struct hdmi_context *hdata)
>  
>  	hdata->reg_hdmi_en = devm_regulator_get_optional(dev, "hdmi-en");
>  
> -	if (PTR_ERR(hdata->reg_hdmi_en) == -ENODEV)
> -		return 0;
> +	if (PTR_ERR(hdata->reg_hdmi_en) != -ENODEV) {
> +		if (IS_ERR(hdata->reg_hdmi_en))
> +			return PTR_ERR(hdata->reg_hdmi_en);
>  
> -	if (IS_ERR(hdata->reg_hdmi_en))
> -		return PTR_ERR(hdata->reg_hdmi_en);
> -
> -	ret = regulator_enable(hdata->reg_hdmi_en);
> -	if (ret)
> -		DRM_ERROR("failed to enable hdmi-en regulator\n");
> +		ret = regulator_enable(hdata->reg_hdmi_en);
> +		if (ret) {
> +			DRM_ERROR("failed to enable hdmi-en regulator\n");
> +			return ret;
> +		}
> +	}
>  
> -	return ret;
> +	return hdmi_bridge_init(hdata);
>  }
>  
>  static struct of_device_id hdmi_match_types[] = {
> 

[toc] | [next] | [standalone]


#1571297

FromAndrzej Hajda <a.hajda@samsung.com>
Date2017-02-01 08:40 +0100
Message-ID<t5XGi-2WB-9@gated-at.bofh.it>
In reply to#1571294
On 01.02.2017 08:31, Inki Dae wrote:
>
> 2017년 01월 20일 15:52에 Andrzej Hajda 이(가) 쓴 글:
>> In some platforms there is attached another device to the end of HDMI.
>> The patch adds support for it.
> Andrzej, can you clarify what bridge device can be attached and actually is now attached to the end of HDMI?
> And I wonder if we have the device tree file which defines the bridge device in mainline. Seems we have no the device tree file.
>
> If nothing, then this patch should be merged with real use case.

SiI8620 MHL bridge in tm2/tm2e.

Regards
Andrzej

>
> Thanks.
>
>> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
>> ---
>>  drivers/gpu/drm/exynos/exynos_hdmi.c | 56 +++++++++++++++++++++++++++++-------
>>  1 file changed, 46 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
>> index a73b192..41fb894 100644
>> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
>> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
>> @@ -35,6 +35,7 @@
>>  #include <linux/io.h>
>>  #include <linux/of_address.h>
>>  #include <linux/of_device.h>
>> +#include <linux/of_graph.h>
>>  #include <linux/hdmi.h>
>>  #include <linux/component.h>
>>  #include <linux/mfd/syscon.h>
>> @@ -133,6 +134,7 @@ struct hdmi_context {
>>  	struct regulator_bulk_data	regul_bulk[ARRAY_SIZE(supply)];
>>  	struct regulator		*reg_hdmi_en;
>>  	struct exynos_drm_clk		phy_clk;
>> +	struct drm_bridge		*bridge;
>>  };
>>  
>>  static inline struct hdmi_context *encoder_to_hdmi(struct drm_encoder *e)
>> @@ -922,7 +924,15 @@ static int hdmi_create_connector(struct drm_encoder *encoder)
>>  	drm_connector_register(connector);
>>  	drm_mode_connector_attach_encoder(connector, encoder);
>>  
>> -	return 0;
>> +	if (hdata->bridge) {
>> +		encoder->bridge = hdata->bridge;
>> +		hdata->bridge->encoder = encoder;
>> +		ret = drm_bridge_attach(encoder->dev, hdata->bridge);
>> +		if (ret)
>> +			DRM_ERROR("Failed to attach bridge\n");
>> +	}
>> +
>> +	return ret;
>>  }
>>  
>>  static bool hdmi_mode_fixup(struct drm_encoder *encoder,
>> @@ -1591,6 +1601,31 @@ static void hdmiphy_clk_enable(struct exynos_drm_clk *clk, bool enable)
>>  		hdmiphy_disable(hdata);
>>  }
>>  
>> +static int hdmi_bridge_init(struct hdmi_context *hdata)
>> +{
>> +	struct device *dev = hdata->dev;
>> +	struct device_node *ep, *np;
>> +
>> +	ep = of_graph_get_endpoint_by_regs(dev->of_node, 1, -1);
>> +	if (!ep)
>> +		return 0;
>> +
>> +	np = of_graph_get_remote_port_parent(ep);
>> +	of_node_put(ep);
>> +	if (!np) {
>> +		DRM_ERROR("failed to get remote port parent");
>> +		return -EINVAL;
>> +	}
>> +
>> +	hdata->bridge = of_drm_find_bridge(np);
>> +	of_node_put(np);
>> +
>> +	if (!hdata->bridge)
>> +		return -EPROBE_DEFER;
>> +
>> +	return 0;
>> +}
>> +
>>  static int hdmi_resources_init(struct hdmi_context *hdata)
>>  {
>>  	struct device *dev = hdata->dev;
>> @@ -1630,17 +1665,18 @@ static int hdmi_resources_init(struct hdmi_context *hdata)
>>  
>>  	hdata->reg_hdmi_en = devm_regulator_get_optional(dev, "hdmi-en");
>>  
>> -	if (PTR_ERR(hdata->reg_hdmi_en) == -ENODEV)
>> -		return 0;
>> +	if (PTR_ERR(hdata->reg_hdmi_en) != -ENODEV) {
>> +		if (IS_ERR(hdata->reg_hdmi_en))
>> +			return PTR_ERR(hdata->reg_hdmi_en);
>>  
>> -	if (IS_ERR(hdata->reg_hdmi_en))
>> -		return PTR_ERR(hdata->reg_hdmi_en);
>> -
>> -	ret = regulator_enable(hdata->reg_hdmi_en);
>> -	if (ret)
>> -		DRM_ERROR("failed to enable hdmi-en regulator\n");
>> +		ret = regulator_enable(hdata->reg_hdmi_en);
>> +		if (ret) {
>> +			DRM_ERROR("failed to enable hdmi-en regulator\n");
>> +			return ret;
>> +		}
>> +	}
>>  
>> -	return ret;
>> +	return hdmi_bridge_init(hdata);
>>  }
>>  
>>  static struct of_device_id hdmi_match_types[] = {
>>
>

[toc] | [prev] | [next] | [standalone]


#1571299

FromInki Dae <inki.dae@samsung.com>
Date2017-02-01 08:50 +0100
Message-ID<t5XPX-2ZX-7@gated-at.bofh.it>
In reply to#1571297

2017년 02월 01일 16:34에 Andrzej Hajda 이(가) 쓴 글:
> On 01.02.2017 08:31, Inki Dae wrote:
>>
>> 2017년 01월 20일 15:52에 Andrzej Hajda 이(가) 쓴 글:
>>> In some platforms there is attached another device to the end of HDMI.
>>> The patch adds support for it.
>> Andrzej, can you clarify what bridge device can be attached and actually is now attached to the end of HDMI?
>> And I wonder if we have the device tree file which defines the bridge device in mainline. Seems we have no the device tree file.
>>
>> If nothing, then this patch should be merged with real use case.
> 
> SiI8620 MHL bridge in tm2/tm2e.

Did you post dt patch to add the properties related to SiI8620 MHL bridge device?

I see below patch series,
[PATCH 00/24] drm/bridge/sii8620: add Ultra HD modes support

but I couldn't find dt patch for it. And specifying SiI8620 MHL bridge device as description would be needed.

Thanks.

> 
> Regards
> Andrzej
> 
>>
>> Thanks.
>>
>>> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
>>> ---
>>>  drivers/gpu/drm/exynos/exynos_hdmi.c | 56 +++++++++++++++++++++++++++++-------
>>>  1 file changed, 46 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
>>> index a73b192..41fb894 100644
>>> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
>>> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
>>> @@ -35,6 +35,7 @@
>>>  #include <linux/io.h>
>>>  #include <linux/of_address.h>
>>>  #include <linux/of_device.h>
>>> +#include <linux/of_graph.h>
>>>  #include <linux/hdmi.h>
>>>  #include <linux/component.h>
>>>  #include <linux/mfd/syscon.h>
>>> @@ -133,6 +134,7 @@ struct hdmi_context {
>>>  	struct regulator_bulk_data	regul_bulk[ARRAY_SIZE(supply)];
>>>  	struct regulator		*reg_hdmi_en;
>>>  	struct exynos_drm_clk		phy_clk;
>>> +	struct drm_bridge		*bridge;
>>>  };
>>>  
>>>  static inline struct hdmi_context *encoder_to_hdmi(struct drm_encoder *e)
>>> @@ -922,7 +924,15 @@ static int hdmi_create_connector(struct drm_encoder *encoder)
>>>  	drm_connector_register(connector);
>>>  	drm_mode_connector_attach_encoder(connector, encoder);
>>>  
>>> -	return 0;
>>> +	if (hdata->bridge) {
>>> +		encoder->bridge = hdata->bridge;
>>> +		hdata->bridge->encoder = encoder;
>>> +		ret = drm_bridge_attach(encoder->dev, hdata->bridge);
>>> +		if (ret)
>>> +			DRM_ERROR("Failed to attach bridge\n");
>>> +	}
>>> +
>>> +	return ret;
>>>  }
>>>  
>>>  static bool hdmi_mode_fixup(struct drm_encoder *encoder,
>>> @@ -1591,6 +1601,31 @@ static void hdmiphy_clk_enable(struct exynos_drm_clk *clk, bool enable)
>>>  		hdmiphy_disable(hdata);
>>>  }
>>>  
>>> +static int hdmi_bridge_init(struct hdmi_context *hdata)
>>> +{
>>> +	struct device *dev = hdata->dev;
>>> +	struct device_node *ep, *np;
>>> +
>>> +	ep = of_graph_get_endpoint_by_regs(dev->of_node, 1, -1);
>>> +	if (!ep)
>>> +		return 0;
>>> +
>>> +	np = of_graph_get_remote_port_parent(ep);
>>> +	of_node_put(ep);
>>> +	if (!np) {
>>> +		DRM_ERROR("failed to get remote port parent");
>>> +		return -EINVAL;
>>> +	}
>>> +
>>> +	hdata->bridge = of_drm_find_bridge(np);
>>> +	of_node_put(np);
>>> +
>>> +	if (!hdata->bridge)
>>> +		return -EPROBE_DEFER;
>>> +
>>> +	return 0;
>>> +}
>>> +
>>>  static int hdmi_resources_init(struct hdmi_context *hdata)
>>>  {
>>>  	struct device *dev = hdata->dev;
>>> @@ -1630,17 +1665,18 @@ static int hdmi_resources_init(struct hdmi_context *hdata)
>>>  
>>>  	hdata->reg_hdmi_en = devm_regulator_get_optional(dev, "hdmi-en");
>>>  
>>> -	if (PTR_ERR(hdata->reg_hdmi_en) == -ENODEV)
>>> -		return 0;
>>> +	if (PTR_ERR(hdata->reg_hdmi_en) != -ENODEV) {
>>> +		if (IS_ERR(hdata->reg_hdmi_en))
>>> +			return PTR_ERR(hdata->reg_hdmi_en);
>>>  
>>> -	if (IS_ERR(hdata->reg_hdmi_en))
>>> -		return PTR_ERR(hdata->reg_hdmi_en);
>>> -
>>> -	ret = regulator_enable(hdata->reg_hdmi_en);
>>> -	if (ret)
>>> -		DRM_ERROR("failed to enable hdmi-en regulator\n");
>>> +		ret = regulator_enable(hdata->reg_hdmi_en);
>>> +		if (ret) {
>>> +			DRM_ERROR("failed to enable hdmi-en regulator\n");
>>> +			return ret;
>>> +		}
>>> +	}
>>>  
>>> -	return ret;
>>> +	return hdmi_bridge_init(hdata);
>>>  }
>>>  
>>>  static struct of_device_id hdmi_match_types[] = {
>>>
>>
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 

[toc] | [prev] | [next] | [standalone]


#1571321

FromAndrzej Hajda <a.hajda@samsung.com>
Date2017-02-01 09:20 +0100
Message-ID<t5YiZ-3p8-5@gated-at.bofh.it>
In reply to#1571299
On 01.02.2017 08:44, Inki Dae wrote:
>
> 2017년 02월 01일 16:34에 Andrzej Hajda 이(가) 쓴 글:
>> On 01.02.2017 08:31, Inki Dae wrote:
>>> 2017년 01월 20일 15:52에 Andrzej Hajda 이(가) 쓴 글:
>>>> In some platforms there is attached another device to the end of HDMI.
>>>> The patch adds support for it.
>>> Andrzej, can you clarify what bridge device can be attached and actually is now attached to the end of HDMI?
>>> And I wonder if we have the device tree file which defines the bridge device in mainline. Seems we have no the device tree file.
>>>
>>> If nothing, then this patch should be merged with real use case.
>> SiI8620 MHL bridge in tm2/tm2e.
> Did you post dt patch to add the properties related to SiI8620 MHL bridge device?
>
> I see below patch series,
> [PATCH 00/24] drm/bridge/sii8620: add Ultra HD modes support
>
> but I couldn't find dt patch for it. And specifying SiI8620 MHL bridge device as description would be needed.
>
> Thanks.
>
>

Patch adding HDMI path to tm2(e) including SiI8620 node and OF bindings
between hdmi and SiI8620 [1].
As the bridge framework in lower modes was used only to eliminate
unsupported modes, support for bridge in exynos_hdmi driver was not
critical, HDMI path worked well and I forgot about it.
But for UltraHD modes it is required as SiI8620 uses bridge framework to
gather info about applied video mode to program registers accordingly.
I will add requested description to this patch.

[1]: http://www.spinics.net/lists/devicetree/msg157892.html

Regards
Andrzej

[toc] | [prev] | [next] | [standalone]


#1571322

FromInki Dae <inki.dae@samsung.com>
Date2017-02-01 09:20 +0100
Message-ID<t5YiZ-3p8-9@gated-at.bofh.it>
In reply to#1571321

2017년 02월 01일 17:12에 Andrzej Hajda 이(가) 쓴 글:
> On 01.02.2017 08:44, Inki Dae wrote:
>>
>> 2017년 02월 01일 16:34에 Andrzej Hajda 이(가) 쓴 글:
>>> On 01.02.2017 08:31, Inki Dae wrote:
>>>> 2017년 01월 20일 15:52에 Andrzej Hajda 이(가) 쓴 글:
>>>>> In some platforms there is attached another device to the end of HDMI.
>>>>> The patch adds support for it.
>>>> Andrzej, can you clarify what bridge device can be attached and actually is now attached to the end of HDMI?
>>>> And I wonder if we have the device tree file which defines the bridge device in mainline. Seems we have no the device tree file.
>>>>
>>>> If nothing, then this patch should be merged with real use case.
>>> SiI8620 MHL bridge in tm2/tm2e.
>> Did you post dt patch to add the properties related to SiI8620 MHL bridge device?
>>
>> I see below patch series,
>> [PATCH 00/24] drm/bridge/sii8620: add Ultra HD modes support
>>
>> but I couldn't find dt patch for it. And specifying SiI8620 MHL bridge device as description would be needed.
>>
>> Thanks.
>>
>>
> 
> Patch adding HDMI path to tm2(e) including SiI8620 node and OF bindings
> between hdmi and SiI8620 [1].

Oops, you already CCed me. I didn't check it. Sorry.

> As the bridge framework in lower modes was used only to eliminate
> unsupported modes, support for bridge in exynos_hdmi driver was not
> critical, HDMI path worked well and I forgot about it.
> But for UltraHD modes it is required as SiI8620 uses bridge framework to
> gather info about applied video mode to program registers accordingly.
> I will add requested description to this patch.

Thanks.

> 
> [1]: http://www.spinics.net/lists/devicetree/msg157892.html
> 
> Regards
> Andrzej
> 
> 

[toc] | [prev] | [next] | [standalone]


#1571323 — [PATCH v3 4/7] drm/exynos/hdmi: add bridge support

FromAndrzej Hajda <a.hajda@samsung.com>
Date2017-02-01 09:30 +0100
Subject[PATCH v3 4/7] drm/exynos/hdmi: add bridge support
Message-ID<t5YsF-3sn-1@gated-at.bofh.it>
In reply to#1571322
On TM2/TM2e platforms HDMI output is connected to MHL bridge
SiI8620. To allow configure UltraHD modes on the bridge
and to eliminate unsupported modes this bridge should be
attached to drm_encoder implemented in exynos_hdmi.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_hdmi.c | 56 +++++++++++++++++++++++++++++-------
 1 file changed, 46 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index a73b192..41fb894 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -35,6 +35,7 @@
 #include <linux/io.h>
 #include <linux/of_address.h>
 #include <linux/of_device.h>
+#include <linux/of_graph.h>
 #include <linux/hdmi.h>
 #include <linux/component.h>
 #include <linux/mfd/syscon.h>
@@ -133,6 +134,7 @@ struct hdmi_context {
 	struct regulator_bulk_data	regul_bulk[ARRAY_SIZE(supply)];
 	struct regulator		*reg_hdmi_en;
 	struct exynos_drm_clk		phy_clk;
+	struct drm_bridge		*bridge;
 };
 
 static inline struct hdmi_context *encoder_to_hdmi(struct drm_encoder *e)
@@ -922,7 +924,15 @@ static int hdmi_create_connector(struct drm_encoder *encoder)
 	drm_connector_register(connector);
 	drm_mode_connector_attach_encoder(connector, encoder);
 
-	return 0;
+	if (hdata->bridge) {
+		encoder->bridge = hdata->bridge;
+		hdata->bridge->encoder = encoder;
+		ret = drm_bridge_attach(encoder->dev, hdata->bridge);
+		if (ret)
+			DRM_ERROR("Failed to attach bridge\n");
+	}
+
+	return ret;
 }
 
 static bool hdmi_mode_fixup(struct drm_encoder *encoder,
@@ -1591,6 +1601,31 @@ static void hdmiphy_clk_enable(struct exynos_drm_clk *clk, bool enable)
 		hdmiphy_disable(hdata);
 }
 
+static int hdmi_bridge_init(struct hdmi_context *hdata)
+{
+	struct device *dev = hdata->dev;
+	struct device_node *ep, *np;
+
+	ep = of_graph_get_endpoint_by_regs(dev->of_node, 1, -1);
+	if (!ep)
+		return 0;
+
+	np = of_graph_get_remote_port_parent(ep);
+	of_node_put(ep);
+	if (!np) {
+		DRM_ERROR("failed to get remote port parent");
+		return -EINVAL;
+	}
+
+	hdata->bridge = of_drm_find_bridge(np);
+	of_node_put(np);
+
+	if (!hdata->bridge)
+		return -EPROBE_DEFER;
+
+	return 0;
+}
+
 static int hdmi_resources_init(struct hdmi_context *hdata)
 {
 	struct device *dev = hdata->dev;
@@ -1630,17 +1665,18 @@ static int hdmi_resources_init(struct hdmi_context *hdata)
 
 	hdata->reg_hdmi_en = devm_regulator_get_optional(dev, "hdmi-en");
 
-	if (PTR_ERR(hdata->reg_hdmi_en) == -ENODEV)
-		return 0;
+	if (PTR_ERR(hdata->reg_hdmi_en) != -ENODEV) {
+		if (IS_ERR(hdata->reg_hdmi_en))
+			return PTR_ERR(hdata->reg_hdmi_en);
 
-	if (IS_ERR(hdata->reg_hdmi_en))
-		return PTR_ERR(hdata->reg_hdmi_en);
-
-	ret = regulator_enable(hdata->reg_hdmi_en);
-	if (ret)
-		DRM_ERROR("failed to enable hdmi-en regulator\n");
+		ret = regulator_enable(hdata->reg_hdmi_en);
+		if (ret) {
+			DRM_ERROR("failed to enable hdmi-en regulator\n");
+			return ret;
+		}
+	}
 
-	return ret;
+	return hdmi_bridge_init(hdata);
 }
 
 static struct of_device_id hdmi_match_types[] = {
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1572904 — Re: [PATCH v3 4/7] drm/exynos/hdmi: add bridge support

FromInki Dae <inki.dae@samsung.com>
Date2017-02-03 07:40 +0100
SubjectRe: [PATCH v3 4/7] drm/exynos/hdmi: add bridge support
Message-ID<t6FHj-6mg-1@gated-at.bofh.it>
In reply to#1571323

2017년 02월 01일 17:29에 Andrzej Hajda 이(가) 쓴 글:
> On TM2/TM2e platforms HDMI output is connected to MHL bridge
> SiI8620. To allow configure UltraHD modes on the bridge
> and to eliminate unsupported modes this bridge should be
> attached to drm_encoder implemented in exynos_hdmi.
> 
> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_hdmi.c | 56 +++++++++++++++++++++++++++++-------
>  1 file changed, 46 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
> index a73b192..41fb894 100644
> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> @@ -35,6 +35,7 @@
>  #include <linux/io.h>
>  #include <linux/of_address.h>
>  #include <linux/of_device.h>
> +#include <linux/of_graph.h>
>  #include <linux/hdmi.h>
>  #include <linux/component.h>
>  #include <linux/mfd/syscon.h>
> @@ -133,6 +134,7 @@ struct hdmi_context {
>  	struct regulator_bulk_data	regul_bulk[ARRAY_SIZE(supply)];
>  	struct regulator		*reg_hdmi_en;
>  	struct exynos_drm_clk		phy_clk;
> +	struct drm_bridge		*bridge;
>  };
>  
>  static inline struct hdmi_context *encoder_to_hdmi(struct drm_encoder *e)
> @@ -922,7 +924,15 @@ static int hdmi_create_connector(struct drm_encoder *encoder)
>  	drm_connector_register(connector);
>  	drm_mode_connector_attach_encoder(connector, encoder);
>  
> -	return 0;
> +	if (hdata->bridge) {
> +		encoder->bridge = hdata->bridge;
> +		hdata->bridge->encoder = encoder;
> +		ret = drm_bridge_attach(encoder->dev, hdata->bridge);

arguments of drm_bridge_attach function has been changed so fixed it - trivial thing.
Applied it including other patches.

Thanks,
Inki Dae

> +		if (ret)
> +			DRM_ERROR("Failed to attach bridge\n");
> +	}
> +
> +	return ret;
>  }
>  
>  static bool hdmi_mode_fixup(struct drm_encoder *encoder,
> @@ -1591,6 +1601,31 @@ static void hdmiphy_clk_enable(struct exynos_drm_clk *clk, bool enable)
>  		hdmiphy_disable(hdata);
>  }
>  
> +static int hdmi_bridge_init(struct hdmi_context *hdata)
> +{
> +	struct device *dev = hdata->dev;
> +	struct device_node *ep, *np;
> +
> +	ep = of_graph_get_endpoint_by_regs(dev->of_node, 1, -1);
> +	if (!ep)
> +		return 0;
> +
> +	np = of_graph_get_remote_port_parent(ep);
> +	of_node_put(ep);
> +	if (!np) {
> +		DRM_ERROR("failed to get remote port parent");
> +		return -EINVAL;
> +	}
> +
> +	hdata->bridge = of_drm_find_bridge(np);
> +	of_node_put(np);
> +
> +	if (!hdata->bridge)
> +		return -EPROBE_DEFER;
> +
> +	return 0;
> +}
> +
>  static int hdmi_resources_init(struct hdmi_context *hdata)
>  {
>  	struct device *dev = hdata->dev;
> @@ -1630,17 +1665,18 @@ static int hdmi_resources_init(struct hdmi_context *hdata)
>  
>  	hdata->reg_hdmi_en = devm_regulator_get_optional(dev, "hdmi-en");
>  
> -	if (PTR_ERR(hdata->reg_hdmi_en) == -ENODEV)
> -		return 0;
> +	if (PTR_ERR(hdata->reg_hdmi_en) != -ENODEV) {
> +		if (IS_ERR(hdata->reg_hdmi_en))
> +			return PTR_ERR(hdata->reg_hdmi_en);
>  
> -	if (IS_ERR(hdata->reg_hdmi_en))
> -		return PTR_ERR(hdata->reg_hdmi_en);
> -
> -	ret = regulator_enable(hdata->reg_hdmi_en);
> -	if (ret)
> -		DRM_ERROR("failed to enable hdmi-en regulator\n");
> +		ret = regulator_enable(hdata->reg_hdmi_en);
> +		if (ret) {
> +			DRM_ERROR("failed to enable hdmi-en regulator\n");
> +			return ret;
> +		}
> +	}
>  
> -	return ret;
> +	return hdmi_bridge_init(hdata);
>  }
>  
>  static struct of_device_id hdmi_match_types[] = {
> 

[toc] | [prev] | [next] | [standalone]


#1572905 — Re: [PATCH v3 4/7] drm/exynos/hdmi: add bridge support

FromInki Dae <inki.dae@samsung.com>
Date2017-02-03 07:50 +0100
SubjectRe: [PATCH v3 4/7] drm/exynos/hdmi: add bridge support
Message-ID<t6FQZ-6q6-1@gated-at.bofh.it>
In reply to#1572904

2017년 02월 03일 15:38에 Inki Dae 이(가) 쓴 글:
> 
> 
> 2017년 02월 01일 17:29에 Andrzej Hajda 이(가) 쓴 글:
>> On TM2/TM2e platforms HDMI output is connected to MHL bridge
>> SiI8620. To allow configure UltraHD modes on the bridge
>> and to eliminate unsupported modes this bridge should be
>> attached to drm_encoder implemented in exynos_hdmi.
>>
>> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
>> ---
>>  drivers/gpu/drm/exynos/exynos_hdmi.c | 56 +++++++++++++++++++++++++++++-------
>>  1 file changed, 46 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
>> index a73b192..41fb894 100644
>> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
>> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
>> @@ -35,6 +35,7 @@
>>  #include <linux/io.h>
>>  #include <linux/of_address.h>
>>  #include <linux/of_device.h>
>> +#include <linux/of_graph.h>
>>  #include <linux/hdmi.h>
>>  #include <linux/component.h>
>>  #include <linux/mfd/syscon.h>
>> @@ -133,6 +134,7 @@ struct hdmi_context {
>>  	struct regulator_bulk_data	regul_bulk[ARRAY_SIZE(supply)];
>>  	struct regulator		*reg_hdmi_en;
>>  	struct exynos_drm_clk		phy_clk;
>> +	struct drm_bridge		*bridge;
>>  };
>>  
>>  static inline struct hdmi_context *encoder_to_hdmi(struct drm_encoder *e)
>> @@ -922,7 +924,15 @@ static int hdmi_create_connector(struct drm_encoder *encoder)
>>  	drm_connector_register(connector);
>>  	drm_mode_connector_attach_encoder(connector, encoder);
>>  
>> -	return 0;
>> +	if (hdata->bridge) {
>> +		encoder->bridge = hdata->bridge;
>> +		hdata->bridge->encoder = encoder;
>> +		ret = drm_bridge_attach(encoder->dev, hdata->bridge);
> 
> arguments of drm_bridge_attach function has been changed so fixed it - trivial thing.
> Applied it including other patches.

The argument was changed by below patch,
drm: bridge: Link encoder and bridge in core code

Thanks.

> 
> Thanks,
> Inki Dae
> 
>> +		if (ret)
>> +			DRM_ERROR("Failed to attach bridge\n");
>> +	}
>> +
>> +	return ret;
>>  }
>>  
>>  static bool hdmi_mode_fixup(struct drm_encoder *encoder,
>> @@ -1591,6 +1601,31 @@ static void hdmiphy_clk_enable(struct exynos_drm_clk *clk, bool enable)
>>  		hdmiphy_disable(hdata);
>>  }
>>  
>> +static int hdmi_bridge_init(struct hdmi_context *hdata)
>> +{
>> +	struct device *dev = hdata->dev;
>> +	struct device_node *ep, *np;
>> +
>> +	ep = of_graph_get_endpoint_by_regs(dev->of_node, 1, -1);
>> +	if (!ep)
>> +		return 0;
>> +
>> +	np = of_graph_get_remote_port_parent(ep);
>> +	of_node_put(ep);
>> +	if (!np) {
>> +		DRM_ERROR("failed to get remote port parent");
>> +		return -EINVAL;
>> +	}
>> +
>> +	hdata->bridge = of_drm_find_bridge(np);
>> +	of_node_put(np);
>> +
>> +	if (!hdata->bridge)
>> +		return -EPROBE_DEFER;
>> +
>> +	return 0;
>> +}
>> +
>>  static int hdmi_resources_init(struct hdmi_context *hdata)
>>  {
>>  	struct device *dev = hdata->dev;
>> @@ -1630,17 +1665,18 @@ static int hdmi_resources_init(struct hdmi_context *hdata)
>>  
>>  	hdata->reg_hdmi_en = devm_regulator_get_optional(dev, "hdmi-en");
>>  
>> -	if (PTR_ERR(hdata->reg_hdmi_en) == -ENODEV)
>> -		return 0;
>> +	if (PTR_ERR(hdata->reg_hdmi_en) != -ENODEV) {
>> +		if (IS_ERR(hdata->reg_hdmi_en))
>> +			return PTR_ERR(hdata->reg_hdmi_en);
>>  
>> -	if (IS_ERR(hdata->reg_hdmi_en))
>> -		return PTR_ERR(hdata->reg_hdmi_en);
>> -
>> -	ret = regulator_enable(hdata->reg_hdmi_en);
>> -	if (ret)
>> -		DRM_ERROR("failed to enable hdmi-en regulator\n");
>> +		ret = regulator_enable(hdata->reg_hdmi_en);
>> +		if (ret) {
>> +			DRM_ERROR("failed to enable hdmi-en regulator\n");
>> +			return ret;
>> +		}
>> +	}
>>  
>> -	return ret;
>> +	return hdmi_bridge_init(hdata);
>>  }
>>  
>>  static struct of_device_id hdmi_match_types[] = {
>>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web