drm/exynos: fimd: Get signal polarities from device tree
Subsystems (3)
PATCH 1/1 drm/exynos: fimd: Get signal polarities from device tree
This patch modifies the driver to perform two stage parsing of video timings from device tree, to get timing information as struct videomode, which contains more data than struct fb_videomode.
Thanks to this change, information about polarity of control signals (VSYNC, HSYNC, VDEN, VCLK) can be retrieved, in addition to standard video timings.
--- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +16 -2
@@ -21,7 +21,9 @@#include <linux/pm_runtime.h> #include <video/of_display_timing.h> +#include <video/of_videomode.h> #include <video/samsung_fimd.h> +#include <video/videomode.h> #include <drm/exynos_drm.h> #include "exynos_drm_drv.h"
@@ -928,18 +930,30 @@ static int fimd_probe(struct platform_device *pdev)DRM_DEBUG_KMS ("%s\n" , __FILE__);if (pdev->dev.of_node) { +struct videomode vm; + pdata =devm_kzalloc (dev,sizeof (*pdata),GFP_KERNEL );if (!pdata) {DRM_ERROR ("memory allocation for pdata failed\n" );return -ENOMEM ; } - ret =of_get_fb_videomode (dev->of_node, &pdata->panel.timing, -OF_USE_NATIVE_MODE ); + ret =of_get_videomode (dev->of_node, &vm,OF_USE_NATIVE_MODE );if (ret) {DRM_ERROR ("failed: of_get_fb_videomode() : %d\n" , ret);return ret; } + +fb_videomode_from_videomode (&vm, &pdata->panel.timing); + +if (vm.flags &DISPLAY_FLAGS_VSYNC_LOW ) + pdata->vidcon1 |=VIDCON1_INV_VSYNC ; +if (vm.flags &DISPLAY_FLAGS_HSYNC_LOW ) + pdata->vidcon1 |=VIDCON1_INV_HSYNC ; +if (vm.flags &DISPLAY_FLAGS_DE_LOW ) + pdata->vidcon1 |=VIDCON1_INV_VDEN ; +if (vm.flags &DISPLAY_FLAGS_PIXDATA_NEGEDGE ) + pdata->vidcon1 |=VIDCON1_INV_VCLK ; }else { pdata = pdev->dev.platform_data;if (!pdata) {
Signature · 1 line
1.8.2.1
Quoted 9 lines · Tomasz Figa
This patch modifies the driver to perform two stage parsing of video timings from device tree, to get timing information as struct videomode, which contains more data than struct
fb_videomode.Thanks to this change, information about polarity of control signals (VSYNC, HSYNC, VDEN, VCLK) can be retrieved, in addition to standard video timings.
Signed-off-by Tomasz Figa <[email protected]>
Since the drm mode struct also contains flags for sync polarity ... why is there no direct of -> drm_mode function? Going through an fb videomode in a kms drm driver looks _really_ backwards to me.
Cc'in Dave for the fun of it ;-)
Cheers, Daniel
Quoted 58 lines
--- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)drivers/gpu/drm/exynos/exynos_drm_fimd.c +16
-2@@ -21,7 +21,9 @@#include <linux/pm_runtime.h> #include <video/of_display_timing.h> +#include <video/of_videomode.h> #include <video/samsung_fimd.h> +#include <video/videomode.h> #include <drm/exynos_drm.h> #include "exynos_drm_drv.h" @@ -928,18 +930,30 @@ static int fimd_probe(struct platform_device *pdev)DRM_DEBUG_KMS ("%s\n" , __FILE__);if (pdev->dev.of_node) { +struct videomode vm; + pdata =devm_kzalloc (dev,sizeof (*pdata),GFP_KERNEL );if (!pdata) {DRM_ERROR ("memory allocation for pdata failed\n" );return -ENOMEM ; } - ret =of_get_fb_videomode (dev->of_node, &pdata->panel.timing, -OF_USE_NATIVE_MODE ); + ret =of_get_videomode (dev->of_node, &vm,OF_USE_NATIVE_MODE );if (ret) {DRM_ERROR ("failed: of_get_fb_videomode() : %d\n" , ret);return ret; } + +fb_videomode_from_videomode (&vm, &pdata->panel.timing); + +if (vm.flags &DISPLAY_FLAGS_VSYNC_LOW ) + pdata->vidcon1 |=VIDCON1_INV_VSYNC ; +if (vm.flags &DISPLAY_FLAGS_HSYNC_LOW ) + pdata->vidcon1 |=VIDCON1_INV_HSYNC ; +if (vm.flags &DISPLAY_FLAGS_DE_LOW ) + pdata->vidcon1 |=VIDCON1_INV_VDEN ; +if (vm.flags &DISPLAY_FLAGS_PIXDATA_NEGEDGE ) + pdata->vidcon1 |=VIDCON1_INV_VCLK ; }else { pdata = pdev->dev.platform_data;if (!pdata) {Signature · 6 lines
1.8.2.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Hi,
Quoted 9 lines · On Wednesday 01 of May 2013 22:00:25 Daniel Vetter wrote:
Quoted 8 lines · Tomasz Figa
This patch modifies the driver to perform two stage parsing of video timings from device tree, to get timing information as struct videomode, which contains more data than struct
fb_videomode.Thanks to this change, information about polarity of control signals (VSYNC, HSYNC, VDEN, VCLK) can be retrieved, in addition to standard video timings.
Quoted 7 lines
Quoted 1 line
Signed-off-by Tomasz Figa <[email protected]>Since the drm mode struct also contains flags for sync polarity ... why is there no direct of ->
drm_modefunction? Going through an fb videomode in a kms drm driver looks _really_ backwards to me.Cc'in Dave for the fun of it ;-)
Struct fb_videomode is what exynos_drm_fimd driver uses internally. Sure it should use drm_mode, but this is not really related to this patch, because the code added in this patch only fills in the pdata struct, which for compatibility reasons (the same structure is used for both fbdev and drm drivers) contains struct fb_videomode.
OK, now after having a bit of fun, could we merge this patch to at least have usable support of parallel displays using this driver?
Best regards,
Tomasz
Quoted 43 lines
Cheers, Daniel
Quoted 41 lines
---
drivers/gpu/drm/exynos/exynos_drm_fimd.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/exynos/exynos_drm_fimd.cindex a1669d4..9023efa 100644drivers/gpu/drm/exynos/exynos_drm_fimd.c +4
-0@@ -21,7 +21,9 @@#include <linux/pm_runtime.h> #include <video/of_display_timing.h> +#include <video/of_videomode.h> #include <video/samsung_fimd.h> +#include <video/videomode.h> #include <drm/exynos_drm.h> #include "exynos_drm_drv.h" @@ -928,18 +930,30 @@ static int fimd_probe(struct platform_device *pdev)>DRM_DEBUG_KMS ("%s\n" , __FILE__);if (pdev->dev.of_node) { +struct videomode vm; + pdata =devm_kzalloc (dev,sizeof (*pdata),GFP_KERNEL );if (!pdata) {DRM_ERROR ("memory allocation for pdata failed\n" );return -ENOMEM ;
Quoted 6 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c static int fimd_probe(struct platform_device · line 942
Quoted 3 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +0
-1} - ret = of_get_fb_videomode(dev->of_node, &pdata-panel.timing,
drivers/gpu/drm/exynos/exynos_drm_fimd.c static int fimd_probe(struct platform_device · line 946
Quoted 2 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +1
-1- OF_USE_NATIVE_MODE); + ret = of_get_videomode(dev->of_node, &vm,
OF_USE_NATIVE_MODE);
Quoted 4 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c static int fimd_probe(struct platform_device
Quoted 4 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +0
-0if (ret) { DRM_ERROR("failed: of_get_fb_videomode() : %d\n",
ret);
Quoted 20 lines
Quoted 20 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +11
-0return ret; } + +fb_videomode_from_videomode (&vm, &pdata->panel.timing); + +if (vm.flags &DISPLAY_FLAGS_VSYNC_LOW ) + pdata->vidcon1 |=VIDCON1_INV_VSYNC ; +if (vm.flags &DISPLAY_FLAGS_HSYNC_LOW ) + pdata->vidcon1 |=VIDCON1_INV_HSYNC ; +if (vm.flags &DISPLAY_FLAGS_DE_LOW ) + pdata->vidcon1 |=VIDCON1_INV_VDEN ; +if (vm.flags &DISPLAY_FLAGS_PIXDATA_NEGEDGE ) + pdata->vidcon1 |=VIDCON1_INV_VCLK ; }else { pdata = pdev->dev.platform_data;if (!pdata) {
Quoted 18 lines · Tomasz Figa
Hi,
Quoted 9 lines · On Wednesday 01 of May 2013 22:00:25 Daniel Vetter wrote:
Quoted 8 lines · Tomasz Figa
This patch modifies the driver to perform two stage parsing of video timings from device tree, to get timing information as struct videomode, which contains more data than struct
fb_videomode.Thanks to this change, information about polarity of control signals (VSYNC, HSYNC, VDEN, VCLK) can be retrieved, in addition to standard video timings.
Quoted 6 lines
Quoted 1 line
Signed-off-by Tomasz Figa <[email protected]>Since the drm mode struct also contains flags for sync polarity ... why is there no direct of ->
drm_modefunction? Going through an fb videomode in a kms drm driver looks _really_ backwards to me.Cc'in Dave for the fun of it ;-)
Quoted 8 lines
Struct
fb_videomodeis whatexynos_drm_fimddriver uses internally. Sure it should usedrm_mode, but this is not really related to this patch, because the code added in this patch only fills in the pdata struct, which for compatibility reasons (the same structure is used for both fbdev and drm drivers) contains structfb_videomode.OK, now after having a bit of fun, could we merge this patch to at least have usable support of parallel displays using this driver?
I think it's better to use struct display_timings instead of struct fb_videomode in exynos_drm.
Thanks.
Hi Joonyoung,
Quoted 28 lines · On Thursday 06 of June 2013 13:30:49 Joonyoung Shim wrote:
Quoted 27 lines · Tomasz Figa
Hi,
Quoted 9 lines · On Wednesday 01 of May 2013 22:00:25 Daniel Vetter wrote:
Quoted 8 lines · Tomasz Figa
This patch modifies the driver to perform two stage parsing of video timings from device tree, to get timing information as struct videomode, which contains more data than struct
fb_videomode.Thanks to this change, information about polarity of control signals (VSYNC, HSYNC, VDEN, VCLK) can be retrieved, in addition to standard video timings.
Quoted 8 lines
Quoted 1 line
Signed-off-by Tomasz Figa <[email protected]>Since the drm mode struct also contains flags for sync polarity ... why
is there no direct of ->drm_modefunction? Going through an fb videomode in a kms drm driver looks _really_ backwards to me.Cc'in Dave for the fun of it ;-)
Struct
fb_videomodeis whatexynos_drm_fimddriver uses internally. Sure it should usedrm_mode, but this is not really related to this patch, because the code added in this patch only fills in the pdata struct, which for compatibility reasons (the same structure is used for both fbdev and drm drivers) contains structfb_videomode.
Quoted 5 lines
Quoted 2 lines
OK, now after having a bit of fun, could we merge this patch to at least have usable support of parallel displays using this driver?
I think it's better to use struct
display_timingsinstead of structfb_videomodeinexynos_drm.
I agree that fb_videomode struct is a bit unfortunate here, but it seems to be widely used in the exynos_drm_fimd driver.
Actually, if I understood it properly, the correct struct to use in DRM drivers is drm_display_mode, but there is no conversion function from struct display_timing to it.
IMHO a separate patch introducing such conversion and then another one which modifies the driver to use drm_display_mode everywhere would be the best solution.
Best regards,
Tomasz
Quoted 31 lines · Tomasz Figa
Hi Joonyoung,
Quoted 28 lines · On Thursday 06 of June 2013 13:30:49 Joonyoung Shim wrote:
Quoted 27 lines · Tomasz Figa
Hi,
Quoted 9 lines · On Wednesday 01 of May 2013 22:00:25 Daniel Vetter wrote:
Quoted 8 lines · Tomasz Figa
This patch modifies the driver to perform two stage parsing of video timings from device tree, to get timing information as struct videomode, which contains more data than struct
fb_videomode.Thanks to this change, information about polarity of control signals (VSYNC, HSYNC, VDEN, VCLK) can be retrieved, in addition to standard video timings.
Quoted 7 lines
Quoted 1 line
Signed-off-by Tomasz Figa <[email protected]>Since the drm mode struct also contains flags for sync polarity ... why
is there no direct of ->drm_modefunction? Going through an fb videomode in a kms drm driver looks _really_ backwards to me.Cc'in Dave for the fun of it ;-)
Struct
fb_videomodeis whatexynos_drm_fimddriver uses internally. Sure it should usedrm_mode, but this is not really related to this patch, because the code added in this patch only fills in the pdata struct, which for compatibility reasons (the same structure is used for both fbdev and drm drivers) contains structfb_videomode.OK, now after having a bit of fun, could we merge this patch to at least have usable support of parallel displays using this driver?
Quoted 8 lines
Quoted 2 lines
I think it's better to use struct
display_timingsinstead of structfb_videomodeinexynos_drm.I agree that
fb_videomodestruct is a bit unfortunate here, but it seems to be widely used in theexynos_drm_fimddriver.Actually, if I understood it properly, the correct struct to use in DRM drivers is
drm_display_mode, but there is no conversion function from structdisplay_timingto it.
It's easy to convert from struct display_timing to videomode and there is conversion function from struct videomode to drm_display_mode.
Already it uses at drivers/gpu/drm/tilcdc/tilcdc_panel.c
Quoted 4 lines
IMHO a separate patch introducing such conversion and then another one which modifies the driver to use
drm_display_modeeverywhere would be the best solution.
OK, but the struct drm_display_mode doesn't include only timing information so we need also to use struct videomode or struct drm_timing properly.
Quoted 34 lines · On Wednesday 01 of May 2013 21:06:09 Tomasz Figa wrote:
This patch modifies the driver to perform two stage parsing of video timings from device tree, to get timing information as struct videomode, which contains more data than struct
fb_videomode.Thanks to this change, information about polarity of control signals (VSYNC, HSYNC, VDEN, VCLK) can be retrieved, in addition to standard video timings.
Signed-off-by Tomasz Figa <[email protected]>--- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/exynos/exynos_drm_fimd.cindex a1669d4..9023efa 100644drivers/gpu/drm/exynos/exynos_drm_fimd.c +4
-0@@ -21,7 +21,9 @@#include <linux/pm_runtime.h> #include <video/of_display_timing.h> +#include <video/of_videomode.h> #include <video/samsung_fimd.h> +#include <video/videomode.h> #include <drm/exynos_drm.h> #include "exynos_drm_drv.h" @@ -928,18 +930,30 @@ static int fimd_probe(struct platform_device *pdev) DRM_DEBUG_KMS("%s\n", __FILE__);if (pdev->dev.of_node) { +struct videomode vm; +
drivers/gpu/drm/exynos/exynos_drm_fimd.c static int fimd_probe(struct platform_device · line 942
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +1
-2pdata =devm_kzalloc (dev,sizeof (*pdata),GFP_KERNEL );if (!pdata) {DRM_ERROR ("memory allocation for pdata failed\n" );return -ENOMEM ; } - ret =of_get_fb_videomode (dev->of_node, &pdata- panel.timing, -OF_USE_NATIVE_MODE ); + ret = of_get_videomode(dev->of_node, &vm,
OF_USE_NATIVE_MODE);
drivers/gpu/drm/exynos/exynos_drm_fimd.c static int fimd_probe(struct platform_device · line 944
Quoted 2 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +0
-0if (ret) { DRM_ERROR("failed: of_get_fb_videomode() : %d\n",
ret);
Quoted 15 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +11
-0return ret; } + +fb_videomode_from_videomode (&vm, &pdata->panel.timing); + +if (vm.flags &DISPLAY_FLAGS_VSYNC_LOW ) + pdata->vidcon1 |=VIDCON1_INV_VSYNC ; +if (vm.flags &DISPLAY_FLAGS_HSYNC_LOW ) + pdata->vidcon1 |=VIDCON1_INV_HSYNC ; +if (vm.flags &DISPLAY_FLAGS_DE_LOW ) + pdata->vidcon1 |=VIDCON1_INV_VDEN ; +if (vm.flags &DISPLAY_FLAGS_PIXDATA_NEGEDGE ) + pdata->vidcon1 |=VIDCON1_INV_VCLK ; }else { pdata = pdev->dev.platform_data;
Quoted 1 line
if (!pdata) {
Ping.
Best regards,
Tomasz