diff mbox

[PATCHv2,4/4] drm: exynos: hdmi: add support for pixel clock limitation

Message ID 1397554040-4037-5-git-send-email-t.stanislaws@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tomasz Stanislawski April 15, 2014, 9:27 a.m. UTC
Adds support for limitation of maximal pixel clock of HDMI
signal. This feature is needed on boards that contains
lines or bridges with frequency limitations.

Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
---
 .../devicetree/bindings/video/exynos_hdmi.txt      |    4 ++++
 drivers/gpu/drm/exynos/exynos_hdmi.c               |   12 ++++++++++++
 include/media/s5p_hdmi.h                           |    1 +
 3 files changed, 17 insertions(+)

Comments

Rahul Sharma April 15, 2014, 9:42 a.m. UTC | #1
Hi Tomasz,

On 15 April 2014 14:57, Tomasz Stanislawski <t.stanislaws@samsung.com> wrote:
> Adds support for limitation of maximal pixel clock of HDMI
> signal. This feature is needed on boards that contains
> lines or bridges with frequency limitations.
>
> Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
> ---
>  .../devicetree/bindings/video/exynos_hdmi.txt      |    4 ++++
>  drivers/gpu/drm/exynos/exynos_hdmi.c               |   12 ++++++++++++
>  include/media/s5p_hdmi.h                           |    1 +
>  3 files changed, 17 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/video/exynos_hdmi.txt b/Documentation/devicetree/bindings/video/exynos_hdmi.txt
> index f9187a2..8718f8d 100644
> --- a/Documentation/devicetree/bindings/video/exynos_hdmi.txt
> +++ b/Documentation/devicetree/bindings/video/exynos_hdmi.txt
> @@ -28,6 +28,10 @@ Required properties:
>  - ddc: phandle to the hdmi ddc node
>  - phy: phandle to the hdmi phy node
>
> +Optional properties:
> +- max-pixel-clock: used to limit the maximal pixel clock if a board has lines,
> +       connectors or bridges not capable of carring higher frequencies
> +
>  Example:
>
>         hdmi {
> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
> index 2a18f4e..404f1b7 100644
> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> @@ -195,6 +195,7 @@ struct hdmi_context {
>         struct hdmi_resources           res;
>
>         int                             hpd_gpio;
> +       u32                             max_pixel_clock;
>
>         enum hdmi_type                  type;
>  };
> @@ -887,6 +888,9 @@ static int hdmi_mode_valid(struct drm_connector *connector,
>         if (ret)
>                 return MODE_BAD;
>
> +       if (mode->clock * 1000 > hdata->max_pixel_clock)
> +               return MODE_BAD;
> +
>         ret = hdmi_find_phy_conf(hdata, mode->clock * 1000);
>         if (ret < 0)
>                 return MODE_BAD;
> @@ -2031,6 +2035,8 @@ static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata
>                 return NULL;
>         }
>
> +       of_property_read_u32(np, "max-pixel-clock", &pd->max_pixel_clock);
> +
>         return pd;
>  }
>
> @@ -2067,6 +2073,11 @@ static int hdmi_probe(struct platform_device *pdev)
>         if (!pdata)
>                 return -EINVAL;
>
> +       if (!pdata->max_pixel_clock) {
> +               DRM_INFO("max-pixel-clock is zero, using INF\n");
> +               pdata->max_pixel_clock = U32_MAX;
> +       }
> +
>         hdata = devm_kzalloc(dev, sizeof(struct hdmi_context), GFP_KERNEL);
>         if (!hdata)
>                 return -ENOMEM;
> @@ -2083,6 +2094,7 @@ static int hdmi_probe(struct platform_device *pdev)
>         hdata->type = drv_data->type;
>
>         hdata->hpd_gpio = pdata->hpd_gpio;
> +       hdata->max_pixel_clock = pdata->max_pixel_clock;
>         hdata->dev = dev;
>
>         ret = hdmi_resources_init(hdata);
> diff --git a/include/media/s5p_hdmi.h b/include/media/s5p_hdmi.h
> index 181642b..7272d65 100644
> --- a/include/media/s5p_hdmi.h
> +++ b/include/media/s5p_hdmi.h
> @@ -31,6 +31,7 @@ struct s5p_hdmi_platform_data {
>         int mhl_bus;
>         struct i2c_board_info *mhl_info;
>         int hpd_gpio;
> +       u32 max_pixel_clock;
>  };

We have already removed Non DT support from the drm hdmi
driver. IMO we should not be extending the pdata struct.

Regards,
Rahul Sharma

>
>  #endif /* S5P_HDMI_H */
> --
> 1.7.9.5
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
Lucas Stach April 15, 2014, 9:49 a.m. UTC | #2
Am Dienstag, den 15.04.2014, 11:27 +0200 schrieb Tomasz Stanislawski:
> Adds support for limitation of maximal pixel clock of HDMI
> signal. This feature is needed on boards that contains
> lines or bridges with frequency limitations.
> 
> Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
> ---
>  .../devicetree/bindings/video/exynos_hdmi.txt      |    4 ++++
>  drivers/gpu/drm/exynos/exynos_hdmi.c               |   12 ++++++++++++
>  include/media/s5p_hdmi.h                           |    1 +
>  3 files changed, 17 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/video/exynos_hdmi.txt b/Documentation/devicetree/bindings/video/exynos_hdmi.txt
> index f9187a2..8718f8d 100644
> --- a/Documentation/devicetree/bindings/video/exynos_hdmi.txt
> +++ b/Documentation/devicetree/bindings/video/exynos_hdmi.txt
> @@ -28,6 +28,10 @@ Required properties:
>  - ddc: phandle to the hdmi ddc node
>  - phy: phandle to the hdmi phy node
>  
> +Optional properties:
> +- max-pixel-clock: used to limit the maximal pixel clock if a board has lines,
> +	connectors or bridges not capable of carring higher frequencies
> +
>  Example:
>  
>  	hdmi {
> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
> index 2a18f4e..404f1b7 100644
> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> @@ -195,6 +195,7 @@ struct hdmi_context {
>  	struct hdmi_resources		res;
>  
>  	int				hpd_gpio;
> +	u32				max_pixel_clock;
>  
>  	enum hdmi_type			type;
>  };
> @@ -887,6 +888,9 @@ static int hdmi_mode_valid(struct drm_connector *connector,
>  	if (ret)
>  		return MODE_BAD;
>  
> +	if (mode->clock * 1000 > hdata->max_pixel_clock)
> +		return MODE_BAD;
> +
This should be MODE_CLOCK_HIGH

Regards,
Lucas
Tomasz Stanislawski April 15, 2014, 1:11 p.m. UTC | #3
On 04/15/2014 11:42 AM, Rahul Sharma wrote:
> Hi Tomasz,
> 
> On 15 April 2014 14:57, Tomasz Stanislawski <t.stanislaws@samsung.com> wrote:
>> Adds support for limitation of maximal pixel clock of HDMI
>> signal. This feature is needed on boards that contains
>> lines or bridges with frequency limitations.
>>
>> Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
>> ---
>>  .../devicetree/bindings/video/exynos_hdmi.txt      |    4 ++++
>>  drivers/gpu/drm/exynos/exynos_hdmi.c               |   12 ++++++++++++
>>  include/media/s5p_hdmi.h                           |    1 +
>>  3 files changed, 17 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/video/exynos_hdmi.txt b/Documentation/devicetree/bindings/video/exynos_hdmi.txt
>> index f9187a2..8718f8d 100644
>> --- a/Documentation/devicetree/bindings/video/exynos_hdmi.txt
>> +++ b/Documentation/devicetree/bindings/video/exynos_hdmi.txt
>> @@ -28,6 +28,10 @@ Required properties:
>>  - ddc: phandle to the hdmi ddc node
>>  - phy: phandle to the hdmi phy node
>>
>> +Optional properties:
>> +- max-pixel-clock: used to limit the maximal pixel clock if a board has lines,
>> +       connectors or bridges not capable of carring higher frequencies
>> +
>>  Example:
>>
>>         hdmi {
>> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
>> index 2a18f4e..404f1b7 100644
>> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
>> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
>> @@ -195,6 +195,7 @@ struct hdmi_context {
>>         struct hdmi_resources           res;
>>
>>         int                             hpd_gpio;
>> +       u32                             max_pixel_clock;
>>
>>         enum hdmi_type                  type;
>>  };
>> @@ -887,6 +888,9 @@ static int hdmi_mode_valid(struct drm_connector *connector,
>>         if (ret)
>>                 return MODE_BAD;
>>
>> +       if (mode->clock * 1000 > hdata->max_pixel_clock)
>> +               return MODE_BAD;
>> +
>>         ret = hdmi_find_phy_conf(hdata, mode->clock * 1000);
>>         if (ret < 0)
>>                 return MODE_BAD;
>> @@ -2031,6 +2035,8 @@ static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata
>>                 return NULL;
>>         }
>>
>> +       of_property_read_u32(np, "max-pixel-clock", &pd->max_pixel_clock);
>> +
>>         return pd;
>>  }
>>
>> @@ -2067,6 +2073,11 @@ static int hdmi_probe(struct platform_device *pdev)
>>         if (!pdata)
>>                 return -EINVAL;
>>
>> +       if (!pdata->max_pixel_clock) {
>> +               DRM_INFO("max-pixel-clock is zero, using INF\n");
>> +               pdata->max_pixel_clock = U32_MAX;
>> +       }
>> +
>>         hdata = devm_kzalloc(dev, sizeof(struct hdmi_context), GFP_KERNEL);
>>         if (!hdata)
>>                 return -ENOMEM;
>> @@ -2083,6 +2094,7 @@ static int hdmi_probe(struct platform_device *pdev)
>>         hdata->type = drv_data->type;
>>
>>         hdata->hpd_gpio = pdata->hpd_gpio;
>> +       hdata->max_pixel_clock = pdata->max_pixel_clock;
>>         hdata->dev = dev;
>>
>>         ret = hdmi_resources_init(hdata);
>> diff --git a/include/media/s5p_hdmi.h b/include/media/s5p_hdmi.h
>> index 181642b..7272d65 100644
>> --- a/include/media/s5p_hdmi.h
>> +++ b/include/media/s5p_hdmi.h
>> @@ -31,6 +31,7 @@ struct s5p_hdmi_platform_data {
>>         int mhl_bus;
>>         struct i2c_board_info *mhl_info;
>>         int hpd_gpio;
>> +       u32 max_pixel_clock;
>>  };
> 
> We have already removed Non DT support from the drm hdmi
> driver. IMO we should not be extending the pdata struct.
> 
> Regards,
> Rahul Sharma

Hi Rahul,

This is not a non-DT patch. The s5p_hdmi_platform_data is
generated from DT itself. This structure is just
a parsed version of DT attributes.

It may be a good idea to rename s5p_hdmi_platform_data
to exynos_hdmi_pdata and move it to exynos_hdmi_drm.c file
or parse DT directly in probe function.

I can prepare a patch for that.

Regards,
Tomasz Stanislawski


> 
>>
>>  #endif /* S5P_HDMI_H */
>> --
>> 1.7.9.5
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/dri-devel
Rahul Sharma April 15, 2014, 1:42 p.m. UTC | #4
On 15 April 2014 18:41, Tomasz Stanislawski <t.stanislaws@samsung.com> wrote:
> On 04/15/2014 11:42 AM, Rahul Sharma wrote:
>> Hi Tomasz,
>>
>> On 15 April 2014 14:57, Tomasz Stanislawski <t.stanislaws@samsung.com> wrote:
>>> Adds support for limitation of maximal pixel clock of HDMI
>>> signal. This feature is needed on boards that contains
>>> lines or bridges with frequency limitations.
>>>
>>> Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
>>> ---
>>>  .../devicetree/bindings/video/exynos_hdmi.txt      |    4 ++++
>>>  drivers/gpu/drm/exynos/exynos_hdmi.c               |   12 ++++++++++++
>>>  include/media/s5p_hdmi.h                           |    1 +
>>>  3 files changed, 17 insertions(+)
>>>
>>> diff --git a/Documentation/devicetree/bindings/video/exynos_hdmi.txt b/Documentation/devicetree/bindings/video/exynos_hdmi.txt
>>> index f9187a2..8718f8d 100644
>>> --- a/Documentation/devicetree/bindings/video/exynos_hdmi.txt
>>> +++ b/Documentation/devicetree/bindings/video/exynos_hdmi.txt
>>> @@ -28,6 +28,10 @@ Required properties:
>>>  - ddc: phandle to the hdmi ddc node
>>>  - phy: phandle to the hdmi phy node
>>>
>>> +Optional properties:
>>> +- max-pixel-clock: used to limit the maximal pixel clock if a board has lines,
>>> +       connectors or bridges not capable of carring higher frequencies
>>> +
>>>  Example:
>>>
>>>         hdmi {
>>> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
>>> index 2a18f4e..404f1b7 100644
>>> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
>>> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
>>> @@ -195,6 +195,7 @@ struct hdmi_context {
>>>         struct hdmi_resources           res;
>>>
>>>         int                             hpd_gpio;
>>> +       u32                             max_pixel_clock;
>>>
>>>         enum hdmi_type                  type;
>>>  };
>>> @@ -887,6 +888,9 @@ static int hdmi_mode_valid(struct drm_connector *connector,
>>>         if (ret)
>>>                 return MODE_BAD;
>>>
>>> +       if (mode->clock * 1000 > hdata->max_pixel_clock)
>>> +               return MODE_BAD;
>>> +
>>>         ret = hdmi_find_phy_conf(hdata, mode->clock * 1000);
>>>         if (ret < 0)
>>>                 return MODE_BAD;
>>> @@ -2031,6 +2035,8 @@ static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata
>>>                 return NULL;
>>>         }
>>>
>>> +       of_property_read_u32(np, "max-pixel-clock", &pd->max_pixel_clock);
>>> +
>>>         return pd;
>>>  }
>>>
>>> @@ -2067,6 +2073,11 @@ static int hdmi_probe(struct platform_device *pdev)
>>>         if (!pdata)
>>>                 return -EINVAL;
>>>
>>> +       if (!pdata->max_pixel_clock) {
>>> +               DRM_INFO("max-pixel-clock is zero, using INF\n");
>>> +               pdata->max_pixel_clock = U32_MAX;
>>> +       }
>>> +
>>>         hdata = devm_kzalloc(dev, sizeof(struct hdmi_context), GFP_KERNEL);
>>>         if (!hdata)
>>>                 return -ENOMEM;
>>> @@ -2083,6 +2094,7 @@ static int hdmi_probe(struct platform_device *pdev)
>>>         hdata->type = drv_data->type;
>>>
>>>         hdata->hpd_gpio = pdata->hpd_gpio;
>>> +       hdata->max_pixel_clock = pdata->max_pixel_clock;
>>>         hdata->dev = dev;
>>>
>>>         ret = hdmi_resources_init(hdata);
>>> diff --git a/include/media/s5p_hdmi.h b/include/media/s5p_hdmi.h
>>> index 181642b..7272d65 100644
>>> --- a/include/media/s5p_hdmi.h
>>> +++ b/include/media/s5p_hdmi.h
>>> @@ -31,6 +31,7 @@ struct s5p_hdmi_platform_data {
>>>         int mhl_bus;
>>>         struct i2c_board_info *mhl_info;
>>>         int hpd_gpio;
>>> +       u32 max_pixel_clock;
>>>  };
>>
>> We have already removed Non DT support from the drm hdmi
>> driver. IMO we should not be extending the pdata struct.
>>
>> Regards,
>> Rahul Sharma
>
> Hi Rahul,
>
> This is not a non-DT patch. The s5p_hdmi_platform_data is
> generated from DT itself. This structure is just
> a parsed version of DT attributes.
>
> It may be a good idea to rename s5p_hdmi_platform_data
> to exynos_hdmi_pdata and move it to exynos_hdmi_drm.c file
> or parse DT directly in probe function.
>
> I can prepare a patch for that.

Else we can completely remove the dependency from
s5p_hdmi_platform_data. We can directly assign to hdmi context
variables. Later we can remove that struct itself from include/.
What you say?

Regards,
Rahul Sharma

>
> Regards,
> Tomasz Stanislawski
>
>
>>
>>>
>>>  #endif /* S5P_HDMI_H */
>>> --
>>> 1.7.9.5
>>>
>>> _______________________________________________
>>> dri-devel mailing list
>>> dri-devel@lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
Tomasz Stanislawski April 15, 2014, 2:29 p.m. UTC | #5
On 04/15/2014 03:42 PM, Rahul Sharma wrote:
> On 15 April 2014 18:41, Tomasz Stanislawski <t.stanislaws@samsung.com> wrote:
>> On 04/15/2014 11:42 AM, Rahul Sharma wrote:
>>> Hi Tomasz,
>>>
>>> On 15 April 2014 14:57, Tomasz Stanislawski <t.stanislaws@samsung.com> wrote:
>>>> Adds support for limitation of maximal pixel clock of HDMI
>>>> signal. This feature is needed on boards that contains
>>>> lines or bridges with frequency limitations.
>>>>
>>>> Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
[snip]

>>>> diff --git a/include/media/s5p_hdmi.h b/include/media/s5p_hdmi.h
>>>> index 181642b..7272d65 100644
>>>> --- a/include/media/s5p_hdmi.h
>>>> +++ b/include/media/s5p_hdmi.h
>>>> @@ -31,6 +31,7 @@ struct s5p_hdmi_platform_data {
>>>>         int mhl_bus;
>>>>         struct i2c_board_info *mhl_info;
>>>>         int hpd_gpio;
>>>> +       u32 max_pixel_clock;
>>>>  };
>>>
>>> We have already removed Non DT support from the drm hdmi
>>> driver. IMO we should not be extending the pdata struct.
>>>
>>> Regards,
>>> Rahul Sharma
>>
>> Hi Rahul,
>>
>> This is not a non-DT patch. The s5p_hdmi_platform_data is
>> generated from DT itself. This structure is just
>> a parsed version of DT attributes.
>>
>> It may be a good idea to rename s5p_hdmi_platform_data
>> to exynos_hdmi_pdata and move it to exynos_hdmi_drm.c file
>> or parse DT directly in probe function.
>>
>> I can prepare a patch for that.
> 
> Else we can completely remove the dependency from
> s5p_hdmi_platform_data. We can directly assign to hdmi context
> variables. Later we can remove that struct itself from include/.
> What you say?

This structure cannot be removed from include yet because it is used by s5p-tv driver.
However its usage can be removed from both drivers.
I can prepare both.

> 
> Regards,
> Rahul Sharma
> 

Regards,
Tomasz Stanislawski

>>
>> Regards,
>> Tomasz Stanislawski
>>
>>
>>>
>>>>
>>>>  #endif /* S5P_HDMI_H */
>>>> --
>>>> 1.7.9.5
>>>>
>>>> _______________________________________________
>>>> dri-devel mailing list
>>>> dri-devel@lists.freedesktop.org
>>>> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>>
>
Rahul Sharma April 16, 2014, 2:07 a.m. UTC | #6
On 15 April 2014 19:59, Tomasz Stanislawski <t.stanislaws@samsung.com> wrote:
> On 04/15/2014 03:42 PM, Rahul Sharma wrote:
>> On 15 April 2014 18:41, Tomasz Stanislawski <t.stanislaws@samsung.com> wrote:
>>> On 04/15/2014 11:42 AM, Rahul Sharma wrote:
>>>> Hi Tomasz,
>>>>
>>>> On 15 April 2014 14:57, Tomasz Stanislawski <t.stanislaws@samsung.com> wrote:
>>>>> Adds support for limitation of maximal pixel clock of HDMI
>>>>> signal. This feature is needed on boards that contains
>>>>> lines or bridges with frequency limitations.
>>>>>
>>>>> Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
> [snip]
>
>>>>> diff --git a/include/media/s5p_hdmi.h b/include/media/s5p_hdmi.h
>>>>> index 181642b..7272d65 100644
>>>>> --- a/include/media/s5p_hdmi.h
>>>>> +++ b/include/media/s5p_hdmi.h
>>>>> @@ -31,6 +31,7 @@ struct s5p_hdmi_platform_data {
>>>>>         int mhl_bus;
>>>>>         struct i2c_board_info *mhl_info;
>>>>>         int hpd_gpio;
>>>>> +       u32 max_pixel_clock;
>>>>>  };
>>>>
>>>> We have already removed Non DT support from the drm hdmi
>>>> driver. IMO we should not be extending the pdata struct.
>>>>
>>>> Regards,
>>>> Rahul Sharma
>>>
>>> Hi Rahul,
>>>
>>> This is not a non-DT patch. The s5p_hdmi_platform_data is
>>> generated from DT itself. This structure is just
>>> a parsed version of DT attributes.
>>>
>>> It may be a good idea to rename s5p_hdmi_platform_data
>>> to exynos_hdmi_pdata and move it to exynos_hdmi_drm.c file
>>> or parse DT directly in probe function.
>>>
>>> I can prepare a patch for that.
>>
>> Else we can completely remove the dependency from
>> s5p_hdmi_platform_data. We can directly assign to hdmi context
>> variables. Later we can remove that struct itself from include/.
>> What you say?
>
> This structure cannot be removed from include yet because it is used by s5p-tv driver.
> However its usage can be removed from both drivers.
> I can prepare both.
>

yea correct. but if you doing it for both of them, it can be removed, I guess.
your call.

Regards,
Rahul Sharma

>>
>> Regards,
>> Rahul Sharma
>>
>
> Regards,
> Tomasz Stanislawski
>
>>>
>>> Regards,
>>> Tomasz Stanislawski
>>>
>>>
>>>>
>>>>>
>>>>>  #endif /* S5P_HDMI_H */
>>>>> --
>>>>> 1.7.9.5
>>>>>
>>>>> _______________________________________________
>>>>> dri-devel mailing list
>>>>> dri-devel@lists.freedesktop.org
>>>>> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>>>
>>
>
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/video/exynos_hdmi.txt b/Documentation/devicetree/bindings/video/exynos_hdmi.txt
index f9187a2..8718f8d 100644
--- a/Documentation/devicetree/bindings/video/exynos_hdmi.txt
+++ b/Documentation/devicetree/bindings/video/exynos_hdmi.txt
@@ -28,6 +28,10 @@  Required properties:
 - ddc: phandle to the hdmi ddc node
 - phy: phandle to the hdmi phy node
 
+Optional properties:
+- max-pixel-clock: used to limit the maximal pixel clock if a board has lines,
+	connectors or bridges not capable of carring higher frequencies
+
 Example:
 
 	hdmi {
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 2a18f4e..404f1b7 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -195,6 +195,7 @@  struct hdmi_context {
 	struct hdmi_resources		res;
 
 	int				hpd_gpio;
+	u32				max_pixel_clock;
 
 	enum hdmi_type			type;
 };
@@ -887,6 +888,9 @@  static int hdmi_mode_valid(struct drm_connector *connector,
 	if (ret)
 		return MODE_BAD;
 
+	if (mode->clock * 1000 > hdata->max_pixel_clock)
+		return MODE_BAD;
+
 	ret = hdmi_find_phy_conf(hdata, mode->clock * 1000);
 	if (ret < 0)
 		return MODE_BAD;
@@ -2031,6 +2035,8 @@  static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata
 		return NULL;
 	}
 
+	of_property_read_u32(np, "max-pixel-clock", &pd->max_pixel_clock);
+
 	return pd;
 }
 
@@ -2067,6 +2073,11 @@  static int hdmi_probe(struct platform_device *pdev)
 	if (!pdata)
 		return -EINVAL;
 
+	if (!pdata->max_pixel_clock) {
+		DRM_INFO("max-pixel-clock is zero, using INF\n");
+		pdata->max_pixel_clock = U32_MAX;
+	}
+
 	hdata = devm_kzalloc(dev, sizeof(struct hdmi_context), GFP_KERNEL);
 	if (!hdata)
 		return -ENOMEM;
@@ -2083,6 +2094,7 @@  static int hdmi_probe(struct platform_device *pdev)
 	hdata->type = drv_data->type;
 
 	hdata->hpd_gpio = pdata->hpd_gpio;
+	hdata->max_pixel_clock = pdata->max_pixel_clock;
 	hdata->dev = dev;
 
 	ret = hdmi_resources_init(hdata);
diff --git a/include/media/s5p_hdmi.h b/include/media/s5p_hdmi.h
index 181642b..7272d65 100644
--- a/include/media/s5p_hdmi.h
+++ b/include/media/s5p_hdmi.h
@@ -31,6 +31,7 @@  struct s5p_hdmi_platform_data {
 	int mhl_bus;
 	struct i2c_board_info *mhl_info;
 	int hpd_gpio;
+	u32 max_pixel_clock;
 };
 
 #endif /* S5P_HDMI_H */