* [PATCHv3 1/5] drm: exynos: hdmi: remove usage of struct s5p_hdmi_platform_data
2014-04-16 15:12 [PATCHv3 0/5] drm: exynos: update/fixes to HDMI driver Tomasz Stanislawski
@ 2014-04-16 15:12 ` Tomasz Stanislawski
2014-04-17 1:54 ` Joonyoung Shim
2014-04-16 15:12 ` [PATCHv3 2/5] drm: exynos: hdmi: simplify extracting hpd-gpio from DT Tomasz Stanislawski
` (3 subsequent siblings)
4 siblings, 1 reply; 8+ messages in thread
From: Tomasz Stanislawski @ 2014-04-16 15:12 UTC (permalink / raw)
To: linux-samsung-soc, dri-devel
Cc: m.chehab, robh+dt, inki.dae, kyungmin.park, sw0312.kim, t.figa,
b.zolnierkie, jy0922.shim, rahul.sharma, pawel.moll, l.stach,
Tomasz Stanislawski
This patch continues shift of DRM EXYNOS to DT-only configuration.
The usage of the old structure for HDMI's platform data is
removed.
Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
---
drivers/gpu/drm/exynos/exynos_hdmi.c | 30 ++++++++----------------------
1 file changed, 8 insertions(+), 22 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 9a6d652..482ca77 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -43,7 +43,6 @@
#include "exynos_mixer.h"
#include <linux/gpio.h>
-#include <media/s5p_hdmi.h>
#define get_hdmi_display(dev) platform_get_drvdata(to_platform_device(dev))
#define ctx_from_connector(c) container_of(c, struct hdmi_context, connector)
@@ -2011,28 +2010,18 @@ fail:
return -ENODEV;
}
-static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata
- (struct device *dev)
+static int drm_hdmi_dt_parse(struct hdmi_context *hdata, struct device_node *np)
{
- struct device_node *np = dev->of_node;
- struct s5p_hdmi_platform_data *pd;
u32 value;
- pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
- if (!pd)
- goto err_data;
-
if (!of_find_property(np, "hpd-gpio", &value)) {
DRM_ERROR("no hpd gpio property found\n");
- goto err_data;
+ return -ENOENT;
}
- pd->hpd_gpio = of_get_named_gpio(np, "hpd-gpio", 0);
-
- return pd;
+ hdata->hpd_gpio = of_get_named_gpio(np, "hpd-gpio", 0);
-err_data:
- return NULL;
+ return 0;
}
static struct of_device_id hdmi_match_types[] = {
@@ -2051,7 +2040,6 @@ static int hdmi_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct hdmi_context *hdata;
- struct s5p_hdmi_platform_data *pdata;
struct resource *res;
const struct of_device_id *match;
struct device_node *ddc_node, *phy_node;
@@ -2061,14 +2049,14 @@ static int hdmi_probe(struct platform_device *pdev)
if (!dev->of_node)
return -ENODEV;
- pdata = drm_hdmi_dt_parse_pdata(dev);
- if (!pdata)
- return -EINVAL;
-
hdata = devm_kzalloc(dev, sizeof(struct hdmi_context), GFP_KERNEL);
if (!hdata)
return -ENOMEM;
+ ret = drm_hdmi_dt_parse(hdata, dev->of_node);
+ if (ret)
+ return -EINVAL;
+
mutex_init(&hdata->hdmi_mutex);
platform_set_drvdata(pdev, &hdmi_display);
@@ -2079,8 +2067,6 @@ static int hdmi_probe(struct platform_device *pdev)
drv_data = (struct hdmi_driver_data *)match->data;
hdata->type = drv_data->type;
-
- hdata->hpd_gpio = pdata->hpd_gpio;
hdata->dev = dev;
ret = hdmi_resources_init(hdata);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCHv3 1/5] drm: exynos: hdmi: remove usage of struct s5p_hdmi_platform_data
2014-04-16 15:12 ` [PATCHv3 1/5] drm: exynos: hdmi: remove usage of struct s5p_hdmi_platform_data Tomasz Stanislawski
@ 2014-04-17 1:54 ` Joonyoung Shim
2014-04-17 7:26 ` Tomasz Stanislawski
0 siblings, 1 reply; 8+ messages in thread
From: Joonyoung Shim @ 2014-04-17 1:54 UTC (permalink / raw)
To: Tomasz Stanislawski, linux-samsung-soc, dri-devel
Cc: m.chehab, robh+dt, inki.dae, kyungmin.park, sw0312.kim, t.figa,
b.zolnierkie, rahul.sharma, pawel.moll, l.stach
Hi Tomasz,
On 04/17/2014 12:12 AM, Tomasz Stanislawski wrote:
> This patch continues shift of DRM EXYNOS to DT-only configuration.
> The usage of the old structure for HDMI's platform data is
> removed.
>
> Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
> ---
> drivers/gpu/drm/exynos/exynos_hdmi.c | 30 ++++++++----------------------
> 1 file changed, 8 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
> index 9a6d652..482ca77 100644
> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> @@ -43,7 +43,6 @@
> #include "exynos_mixer.h"
>
> #include <linux/gpio.h>
> -#include <media/s5p_hdmi.h>
>
> #define get_hdmi_display(dev) platform_get_drvdata(to_platform_device(dev))
> #define ctx_from_connector(c) container_of(c, struct hdmi_context, connector)
> @@ -2011,28 +2010,18 @@ fail:
> return -ENODEV;
> }
>
> -static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata
> - (struct device *dev)
> +static int drm_hdmi_dt_parse(struct hdmi_context *hdata, struct device_node *np)
> {
> - struct device_node *np = dev->of_node;
> - struct s5p_hdmi_platform_data *pd;
> u32 value;
>
> - pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
> - if (!pd)
> - goto err_data;
> -
> if (!of_find_property(np, "hpd-gpio", &value)) {
> DRM_ERROR("no hpd gpio property found\n");
> - goto err_data;
> + return -ENOENT;
> }
>
> - pd->hpd_gpio = of_get_named_gpio(np, "hpd-gpio", 0);
> -
> - return pd;
> + hdata->hpd_gpio = of_get_named_gpio(np, "hpd-gpio", 0);
>
> -err_data:
> - return NULL;
> + return 0;
> }
>
> static struct of_device_id hdmi_match_types[] = {
> @@ -2051,7 +2040,6 @@ static int hdmi_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> struct hdmi_context *hdata;
> - struct s5p_hdmi_platform_data *pdata;
> struct resource *res;
> const struct of_device_id *match;
> struct device_node *ddc_node, *phy_node;
> @@ -2061,14 +2049,14 @@ static int hdmi_probe(struct platform_device *pdev)
> if (!dev->of_node)
> return -ENODEV;
>
> - pdata = drm_hdmi_dt_parse_pdata(dev);
> - if (!pdata)
> - return -EINVAL;
> -
> hdata = devm_kzalloc(dev, sizeof(struct hdmi_context), GFP_KERNEL);
> if (!hdata)
> return -ENOMEM;
>
> + ret = drm_hdmi_dt_parse(hdata, dev->of_node);
> + if (ret)
> + return -EINVAL;
It's better to return ret value.
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCHv3 1/5] drm: exynos: hdmi: remove usage of struct s5p_hdmi_platform_data
2014-04-17 1:54 ` Joonyoung Shim
@ 2014-04-17 7:26 ` Tomasz Stanislawski
0 siblings, 0 replies; 8+ messages in thread
From: Tomasz Stanislawski @ 2014-04-17 7:26 UTC (permalink / raw)
To: Joonyoung Shim, linux-samsung-soc, dri-devel
Cc: pawel.moll, b.zolnierkie, sw0312.kim, kyungmin.park, robh+dt,
rahul.sharma, m.chehab
Hi Joonyoung,
On 04/17/2014 03:54 AM, Joonyoung Shim wrote:
> Hi Tomasz,
>
> On 04/17/2014 12:12 AM, Tomasz Stanislawski wrote:
>> This patch continues shift of DRM EXYNOS to DT-only configuration.
>> The usage of the old structure for HDMI's platform data is
>> removed.
>>
>> Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
[snip]
>> + ret = drm_hdmi_dt_parse(hdata, dev->of_node);
>> + if (ret)
>> + return -EINVAL;
>
> It's better to return ret value.
>
I was considering return ret value. However, I preferred to
be consistent with other 'returns' which returns error literals.
Anyway, I will change it to 'return ret'.
Regards,
Tomasz Stanislawski
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCHv3 2/5] drm: exynos: hdmi: simplify extracting hpd-gpio from DT
2014-04-16 15:12 [PATCHv3 0/5] drm: exynos: update/fixes to HDMI driver Tomasz Stanislawski
2014-04-16 15:12 ` [PATCHv3 1/5] drm: exynos: hdmi: remove usage of struct s5p_hdmi_platform_data Tomasz Stanislawski
@ 2014-04-16 15:12 ` Tomasz Stanislawski
2014-04-16 15:12 ` [PATCHv3 3/5] drm: exynos: mixer: fix using usleep() in atomic context Tomasz Stanislawski
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Tomasz Stanislawski @ 2014-04-16 15:12 UTC (permalink / raw)
To: linux-samsung-soc, dri-devel
Cc: m.chehab, robh+dt, inki.dae, kyungmin.park, sw0312.kim, t.figa,
b.zolnierkie, jy0922.shim, rahul.sharma, pawel.moll, l.stach,
Tomasz Stanislawski
This patch eliminates redundant checks while retrieving HPD gpio from DT during
HDMI's probe().
Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
---
drivers/gpu/drm/exynos/exynos_hdmi.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 482ca77..176e764 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -2012,15 +2012,12 @@ fail:
static int drm_hdmi_dt_parse(struct hdmi_context *hdata, struct device_node *np)
{
- u32 value;
-
- if (!of_find_property(np, "hpd-gpio", &value)) {
+ hdata->hpd_gpio = of_get_named_gpio(np, "hpd-gpio", 0);
+ if (!gpio_is_valid(hdata->hpd_gpio)) {
DRM_ERROR("no hpd gpio property found\n");
return -ENOENT;
}
- hdata->hpd_gpio = of_get_named_gpio(np, "hpd-gpio", 0);
-
return 0;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCHv3 3/5] drm: exynos: mixer: fix using usleep() in atomic context
2014-04-16 15:12 [PATCHv3 0/5] drm: exynos: update/fixes to HDMI driver Tomasz Stanislawski
2014-04-16 15:12 ` [PATCHv3 1/5] drm: exynos: hdmi: remove usage of struct s5p_hdmi_platform_data Tomasz Stanislawski
2014-04-16 15:12 ` [PATCHv3 2/5] drm: exynos: hdmi: simplify extracting hpd-gpio from DT Tomasz Stanislawski
@ 2014-04-16 15:12 ` Tomasz Stanislawski
2014-04-16 15:12 ` [PATCHv3 4/5] drm: exynos: add compatibles for HDMI and Mixer chips and exynos4210 SoC Tomasz Stanislawski
2014-04-16 15:12 ` [PATCHv3 5/5] drm: exynos: hdmi: add support for pixel clock limitation Tomasz Stanislawski
4 siblings, 0 replies; 8+ messages in thread
From: Tomasz Stanislawski @ 2014-04-16 15:12 UTC (permalink / raw)
To: linux-samsung-soc, dri-devel
Cc: Tomasz Stanislawski, pawel.moll, b.zolnierkie, sw0312.kim,
kyungmin.park, robh+dt, rahul.sharma, m.chehab
This patch fixes calling usleep_range() after taking reg_slock
using spin_lock_irqsave(). The mdelay() is used instead.
Waiting in atomic context is not the best idea in general.
Hopefully, waiting occurs only when Video Processor fails
to reset correctly.
Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
---
drivers/gpu/drm/exynos/exynos_mixer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
index ce28881..e3306c8 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -615,7 +615,7 @@ static void vp_win_reset(struct mixer_context *ctx)
/* waiting until VP_SRESET_PROCESSING is 0 */
if (~vp_reg_read(res, VP_SRESET) & VP_SRESET_PROCESSING)
break;
- usleep_range(10000, 12000);
+ mdelay(10);
}
WARN(tries == 0, "failed to reset Video Processor\n");
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCHv3 4/5] drm: exynos: add compatibles for HDMI and Mixer chips and exynos4210 SoC
2014-04-16 15:12 [PATCHv3 0/5] drm: exynos: update/fixes to HDMI driver Tomasz Stanislawski
` (2 preceding siblings ...)
2014-04-16 15:12 ` [PATCHv3 3/5] drm: exynos: mixer: fix using usleep() in atomic context Tomasz Stanislawski
@ 2014-04-16 15:12 ` Tomasz Stanislawski
2014-04-16 15:12 ` [PATCHv3 5/5] drm: exynos: hdmi: add support for pixel clock limitation Tomasz Stanislawski
4 siblings, 0 replies; 8+ messages in thread
From: Tomasz Stanislawski @ 2014-04-16 15:12 UTC (permalink / raw)
To: linux-samsung-soc, dri-devel
Cc: Tomasz Stanislawski, pawel.moll, b.zolnierkie, sw0312.kim,
kyungmin.park, robh+dt, rahul.sharma, m.chehab
This patch add proper compatibles for Mixer and HDMI chip
available on exynos4210 SoCs.
Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
---
drivers/gpu/drm/exynos/exynos_hdmi.c | 7 +++++++
drivers/gpu/drm/exynos/exynos_mixer.c | 3 +++
2 files changed, 10 insertions(+)
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 176e764..9adbd34 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -203,6 +203,10 @@ struct hdmiphy_config {
u8 conf[32];
};
+struct hdmi_driver_data exynos4210_hdmi_driver_data = {
+ .type = HDMI_TYPE13,
+};
+
struct hdmi_driver_data exynos4212_hdmi_driver_data = {
.type = HDMI_TYPE14,
};
@@ -2023,6 +2027,9 @@ static int drm_hdmi_dt_parse(struct hdmi_context *hdata, struct device_node *np)
static struct of_device_id hdmi_match_types[] = {
{
+ .compatible = "samsung,exynos4210-hdmi",
+ .data = &exynos4210_hdmi_driver_data,
+ }, {
.compatible = "samsung,exynos5-hdmi",
.data = &exynos5_hdmi_driver_data,
}, {
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
index e3306c8..fd8a9a0 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -1187,6 +1187,9 @@ static struct platform_device_id mixer_driver_types[] = {
static struct of_device_id mixer_match_types[] = {
{
+ .compatible = "samsung,exynos4210-mixer",
+ .data = &exynos4210_mxr_drv_data,
+ }, {
.compatible = "samsung,exynos5-mixer",
.data = &exynos5250_mxr_drv_data,
}, {
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCHv3 5/5] drm: exynos: hdmi: add support for pixel clock limitation
2014-04-16 15:12 [PATCHv3 0/5] drm: exynos: update/fixes to HDMI driver Tomasz Stanislawski
` (3 preceding siblings ...)
2014-04-16 15:12 ` [PATCHv3 4/5] drm: exynos: add compatibles for HDMI and Mixer chips and exynos4210 SoC Tomasz Stanislawski
@ 2014-04-16 15:12 ` Tomasz Stanislawski
4 siblings, 0 replies; 8+ messages in thread
From: Tomasz Stanislawski @ 2014-04-16 15:12 UTC (permalink / raw)
To: linux-samsung-soc, dri-devel
Cc: Tomasz Stanislawski, pawel.moll, b.zolnierkie, sw0312.kim,
kyungmin.park, robh+dt, rahul.sharma, m.chehab
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 | 11 +++++++++++
2 files changed, 15 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 9adbd34..e012ba9 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -194,6 +194,7 @@ struct hdmi_context {
struct hdmi_resources res;
int hpd_gpio;
+ u32 max_pixel_clock;
enum hdmi_type type;
};
@@ -886,6 +887,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_CLOCK_HIGH;
+
ret = hdmi_find_phy_conf(hdata, mode->clock * 1000);
if (ret < 0)
return MODE_BAD;
@@ -2022,6 +2026,13 @@ static int drm_hdmi_dt_parse(struct hdmi_context *hdata, struct device_node *np)
return -ENOENT;
}
+ of_property_read_u32(np, "max-pixel-clock", &hdata->max_pixel_clock);
+ if (!hdata->max_pixel_clock) {
+ DRM_INFO("max-pixel-clock is zero, using INF\n");
+ hdata->max_pixel_clock = U32_MAX;
+ }
+
+
return 0;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread