Hi everyone, This patchset adds 4 fixes/updates to EXYNOS DRM driver for HDMI subsystem.
All comments are welcome.
Regards, Tomasz Stanislawski
Tomasz Stanislawski (4): drm: exynos: hdmi: simplify extracting hpd-gpio from DT drm: exynos: mixer: fix using usleep() in atomic context drm: exynos: add compatibles for HDMI and Mixer chips and exynos4210 SoC drm: exynos: hdmi: add support for pixel clock limitation
.../devicetree/bindings/video/exynos_hdmi.txt | 4 +++ drivers/gpu/drm/exynos/exynos_hdmi.c | 26 ++++++++++++++------ drivers/gpu/drm/exynos/exynos_mixer.c | 5 +++- include/media/s5p_hdmi.h | 1 + 4 files changed, 27 insertions(+), 9 deletions(-)
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 | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 9a6d652..d2d6e2e 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -2016,23 +2016,18 @@ static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata { 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; + return NULL;
- if (!of_find_property(np, "hpd-gpio", &value)) { + pd->hpd_gpio = of_get_named_gpio(np, "hpd-gpio", 0); + if (gpio_is_valid(pd->hpd_gpio)) { DRM_ERROR("no hpd gpio property found\n"); - goto err_data; + return NULL; }
- pd->hpd_gpio = of_get_named_gpio(np, "hpd-gpio", 0); - return pd; - -err_data: - return NULL; }
static struct of_device_id hdmi_match_types[] = {
On 04/14/2014 05:00 PM, Tomasz Stanislawski wrote:
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 | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 9a6d652..d2d6e2e 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -2016,23 +2016,18 @@ static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata { 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;
return NULL;
- if (!of_find_property(np, "hpd-gpio", &value)) {
- pd->hpd_gpio = of_get_named_gpio(np, "hpd-gpio", 0);
- if (gpio_is_valid(pd->hpd_gpio)) {
Sorry. Should be !gpio_is_valid().
DRM_ERROR("no hpd gpio property found\n");
goto err_data;
}return NULL;
- pd->hpd_gpio = of_get_named_gpio(np, "hpd-gpio", 0);
- return pd;
-err_data:
- return NULL;
}
static struct of_device_id hdmi_match_types[] = {
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"); }
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 | 3 +++ drivers/gpu/drm/exynos/exynos_mixer.c | 3 +++ 2 files changed, 6 insertions(+)
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index d2d6e2e..6fa63ea 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -2032,6 +2032,9 @@ static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata
static struct of_device_id hdmi_match_types[] = { { + .compatible = "samsung,exynos4210-hdmi", + .data = (void *)HDMI_TYPE13, + }, { .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, }, {
Hi Tomasz,
On 04/15/2014 12:00 AM, Tomasz Stanislawski wrote:
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 | 3 +++ drivers/gpu/drm/exynos/exynos_mixer.c | 3 +++ 2 files changed, 6 insertions(+)
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index d2d6e2e..6fa63ea 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -2032,6 +2032,9 @@ static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata
static struct of_device_id hdmi_match_types[] = { {
.compatible = "samsung,exynos4210-hdmi",
.data = (void *)HDMI_TYPE13,
It's consistent with others to use struct hdmi_driver_data like exynos5_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, }, {
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 6fa63ea..ca313b3 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; }; @@ -883,6 +884,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; @@ -2027,6 +2031,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; }
@@ -2063,6 +2069,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 = ULONG_MAX; + } + hdata = devm_kzalloc(dev, sizeof(struct hdmi_context), GFP_KERNEL); if (!hdata) return -ENOMEM; @@ -2079,6 +2090,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 */
dri-devel@lists.freedesktop.org