drm: exynos: update/fixes to HDMI driver
v3 cover drm: exynos: update/fixes to HDMI driver
Hi everyone,
This patchset adds 5 fixes/updates to EXYNOS DRM driver for HDMI subsystem.
All comments are welcome.
Regards,
Tomasz Stanislawski
Changelog:
v3:
* remove usage of s5p_hdmi_platform_data
* return MODE_CLOCK_HIGH instead of MODE_CLOCK_BAD
v2:
* fix check with gpio_is_valid()
* use U32_MAX instead of ULONG_MAX to be 64-bit-friendly
* use hdmi_driver_data as hdmi's compatile data
v1:
* initial version
Tomasz Stanislawski (5):
drm: exynos: hdmi: remove usage of struct s5p_hdmi_platform_data
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 | 49 ++++++++++---------- drivers/gpu/drm/exynos/exynos_mixer.c | 5 +- 3 files changed, 33 insertions(+), 25 deletions(-)
Signature · 1 line
1.7.9.5
PATCH v3 1/5 drm: exynos: hdmi: remove usage of struct s5p_hdmi_platform_data
This patch continues shift of DRM EXYNOS to DT-only configuration. The usage of the old structure for HDMI's platform data is removed.
--- drivers/gpu/drm/exynos/exynos_hdmi.c | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-)
drivers/gpu/drm/exynos/exynos_hdmi.c +8 -22
@@ -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);
Signature · 1 line
1.7.9.5
Re: [PATCHv3 1/5] drm: exynos: hdmi: remove usage of struct s5p_hdmi_platform_data
Hi Tomasz,
Quoted 67 lines · 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 <[email protected]>--- drivers/gpu/drm/exynos/exynos_hdmi.c | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-)drivers/gpu/drm/exynos/exynos_hdmi.c +4
-17@@ -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);
drivers/gpu/drm/exynos/exynos_hdmi.c static int hdmi_probe(struct platform_device *pdev) · line 2058
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_hdmi.c +3
-3-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.
Re: [PATCHv3 1/5] drm: exynos: hdmi: remove usage of struct s5p_hdmi_platform_data
Hi Joonyoung,
Quoted 8 lines · Joonyoung Shim
Hi Tomasz,
Quoted 5 lines · 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 <[email protected]>
[snip]
Quoted 6 lines
drivers/gpu/drm/exynos/exynos_hdmi.c static int hdmi_probe(struct platform_device *pdev) · line 2058
Quoted 3 lines
+ ret =
drm_hdmi_dt_parse(hdata, dev->of_node);drivers/gpu/drm/exynos/exynos_hdmi.c +2
-0+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
PATCH v3 2/5 drm: exynos: hdmi: simplify extracting hpd-gpio from DT
In reply to Tomasz StanislawskiThis patch eliminates redundant checks while retrieving HPD gpio from DT during HDMI's probe().
--- drivers/gpu/drm/exynos/exynos_hdmi.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/drm/exynos/exynos_hdmi.c +2 -5
@@ -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 ; }
Signature · 1 line
1.7.9.5
PATCH v3 3/5 drm: exynos: mixer: fix using usleep() in atomic context
In reply to Tomasz StanislawskiThis 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.
--- drivers/gpu/drm/exynos/exynos_mixer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/exynos/exynos_mixer.c +1 -1
@@ -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" ); }
Signature · 1 line
1.7.9.5
PATCH v3 4/5 drm: exynos: add compatibles for HDMI and Mixer chips and exynos4210 SoC
In reply to Tomasz StanislawskiThis patch add proper compatibles for Mixer and HDMI chip available on exynos4210 SoCs.
--- drivers/gpu/drm/exynos/exynos_hdmi.c | 7 +++++++ drivers/gpu/drm/exynos/exynos_mixer.c | 3 +++ 2 files changed, 10 insertions(+)
drivers/gpu/drm/exynos/exynos_hdmi.c +7 -0
@@ -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, }, {
drivers/gpu/drm/exynos/exynos_mixer.c +3 -0
@@ -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, }, {
Signature · 1 line
1.7.9.5
PATCH v3 5/5 drm: exynos: hdmi: add support for pixel clock limitation
In reply to Tomasz StanislawskiAdds support for limitation of maximal pixel clock of HDMI signal. This feature is needed on boards that contains lines or bridges with frequency limitations.
--- .../devicetree/bindings/video/exynos_hdmi.txt | 4 ++++ drivers/gpu/drm/exynos/exynos_hdmi.c | 11 +++++++++++ 2 files changed, 15 insertions(+)
Documentation/devicetree/bindings/video/exynos_hdmi.txt +4 -0
@@ -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 {
drivers/gpu/drm/exynos/exynos_hdmi.c +11 -0
@@ -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 ; }
Signature · 1 line
1.7.9.5