Skip to contentSkip to conversation

drm/fsl-dcu: Fix endian issue when using clk_register_divider

PATCH In review Meng Yi 2 participants 5 messages Aug 26, 2016 – Sep 2, 2016

Subsystems (3)
lore
Share & tools
lore

Meng Yi

author
#0 lore raw

PATCH v2 1/1 drm/fsl-dcu: Fix endian issue when using clk_register_divider

While clk_register_divider will write register as little endian, Modified the param "shift" from 0 to 24 since DCU is big endian. Or reg "DCU_DIV_RATIO" will be seted as a incorrect value which will cause vblank timing issue etc.

---
Changes in V2:
-check the soc name to decide the "shift" value
since vf610's divider reg is little endian while
ls1021a's divider reg is big endian

---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +2 -1
index 7882387..a590ce8 100644
@@ -386,7 +386,8 @@ static int fsl_dcu_drm_probe(struct platform_device *pdev)
 	snprintf(pix_clk_name, sizeof(pix_clk_name), "%s_pix", pix_clk_in_name);
 	fsl_dev->pix_clk = clk_register_divider(dev, pix_clk_name,
 			pix_clk_in_name, 0, base + DCU_DIV_RATIO,
-			0, 8, CLK_DIVIDER_ROUND_CLOSEST, NULL);
+			!strcmp(fsl_dev->soc->name, "ls1021a")?24:0, 8,
+			CLK_DIVIDER_ROUND_CLOSEST, NULL);
 	if (IS_ERR(fsl_dev->pix_clk)) {
 		dev_err(dev, "failed to register pix clk\n");
 		ret = PTR_ERR(fsl_dev->pix_clk);
Signature · 6 lines
2.1.0.27.g96db324

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author Tested-by on v2 1/1
#1 lore raw
Quoted 9 lines
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/fsl- renamed from drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +0 -0

dcu/fsl_dcu_drm_drv.c
index 7882387..a590ce8 100644

drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c static int fsl_dcu_drm_probe(struct platform_device · line 392

Quoted 8 lines
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +2 -1
@@ -386,7 +386,8 @@ static int fsl_dcu_drm_probe(struct platform_device
 *pdev)
 	snprintf(pix_clk_name, sizeof(pix_clk_name), "%s_pix",
 pix_clk_in_name);
 	fsl_dev->pix_clk = clk_register_divider(dev, pix_clk_name,
 			pix_clk_in_name, 0, base + DCU_DIV_RATIO,
-			0, 8, CLK_DIVIDER_ROUND_CLOSEST, NULL);
+			!strcmp(fsl_dev->soc->name, "ls1021a")?24:0, 8,
+			CLK_DIVIDER_ROUND_CLOSEST, NULL);
Quoted 5 lines
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +0 -0
 	if (IS_ERR(fsl_dev->pix_clk)) {
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +0 -1
 		dev_err(dev, "failed to register pix clk\n");
 		ret = PTR_ERR(fsl_dev->pix_clk);
--

2.1.0.27.g96db324

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author
#2 lore raw
Quoted 12 lines
Quoted 12 lines
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/fsl- dcu/fsl_dcu_drm_drv.c index 7882387..a590ce8 100644

drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +0 -0
@@ -386,7 +386,8 @@ static int fsl_dcu_drm_probe(struct

platform_device
*pdev)
snprintf(pix_clk_name, sizeof(pix_clk_name), "%s_pix",

Quoted 8 lines

drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c static int fsl_dcu_drm_probe(struct platform_device *pdev) · line 390

Quoted 6 lines

pix_clk_in_name);

drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +2 -1
 	fsl_dev->pix_clk = clk_register_divider(dev, pix_clk_name,
 			pix_clk_in_name, 0, base + DCU_DIV_RATIO,
-			0, 8, CLK_DIVIDER_ROUND_CLOSEST, NULL);
+			!strcmp(fsl_dev->soc->name, "ls1021a")?24:0, 8,
+			CLK_DIVIDER_ROUND_CLOSEST, NULL);

On LS1021A-TWR board.

Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +0 -1
 	if (IS_ERR(fsl_dev->pix_clk)) {
 		dev_err(dev, "failed to register pix clk\n");
 		ret = PTR_ERR(fsl_dev->pix_clk);
--

2.1.0.27.g96db324

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author
#3 lore raw
In reply to Meng Yi

Hi Stefan,

Could you test this patch on vf610, I think it will woks fine.

When could you merge this path? And how about the patches for gamma correction and multi-layer support by the way?

Best Regards,
Meng

Quoted 18 lines
Quoted 9 lines
Quoted 9 lines
(quoted diff) +0 -0

b/drivers/gpu/drm/fsl- dcu/fsl_dcu_drm_drv.c index 7882387..a590ce8 100644

drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +0 -0
@@ -386,7 +386,8 @@ static int fsl_dcu_drm_probe(struct

platform_device
*pdev)
snprintf(pix_clk_name, sizeof(pix_clk_name), "%s_pix",

Quoted 8 lines

drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c static int fsl_dcu_drm_probe(struct platform_device *pdev) · line 390

Quoted 6 lines

pix_clk_in_name);

drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +2 -1
 	fsl_dev->pix_clk = clk_register_divider(dev, pix_clk_name,
 			pix_clk_in_name, 0, base + DCU_DIV_RATIO,
-			0, 8, CLK_DIVIDER_ROUND_CLOSEST, NULL);
+			!strcmp(fsl_dev->soc->name, "ls1021a")?24:0, 8,
+			CLK_DIVIDER_ROUND_CLOSEST, NULL);
Quoted 7 lines

On LS1021A-TWR board.

Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +0 -1
 	if (IS_ERR(fsl_dev->pix_clk)) {
 		dev_err(dev, "failed to register pix clk\n");
 		ret = PTR_ERR(fsl_dev->pix_clk);
--

2.1.0.27.g96db324

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

maintainer
#4 lore raw
Quoted 3 lines · Meng Yi

Hi Stefan,

Could you test this patch on vf610, I think it will woks fine.

See comment below.

Quoted 3 lines

When could you merge this path? And how about the patches for gamma correction and multi-layer support by the way?

Still need to look in those patches. I also have multi-layer patches in our 4.4 tree:
http://git.toradex.com/cgit/linux-toradex.git/log/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c?h=toradex_vf_4.4-next

This changes also use one plane as cursor plane which probably makes sense given that we have that many planes. I try to send out an updated/rebased patchset soon.

Quoted 4 lines

Best Regards,
Meng

Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
(quoted diff) +0 -0

b/drivers/gpu/drm/fsl- dcu/fsl_dcu_drm_drv.c index 7882387..a590ce8 100644

drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +0 -0
@@ -386,7 +386,8 @@ static int fsl_dcu_drm_probe(struct

platform_device

Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c static int fsl_dcu_drm_probe(struct platform_device *pdev) · line 390

Quoted 8 lines

*pdev)
snprintf(pix_clk_name, sizeof(pix_clk_name), "%s_pix",
pix_clk_in_name);

drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +2 -1
 	fsl_dev->pix_clk = clk_register_divider(dev, pix_clk_name,
 			pix_clk_in_name, 0, base + DCU_DIV_RATIO,
-			0, 8, CLK_DIVIDER_ROUND_CLOSEST, NULL);
+			!strcmp(fsl_dev->soc->name, "ls1021a")?24:0, 8,
+			CLK_DIVIDER_ROUND_CLOSEST, NULL);

I don't like to sprinkle SoC detection all over the code, it makes it harder when new SoC's with DCU appear. I will send out a patch making use of struct fsl_dcu_soc_data or the like.

--
Stefan

Quoted 10 lines
Quoted 10 lines
Quoted 2 lines

On LS1021A-TWR board.

Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +0 -1
 	if (IS_ERR(fsl_dev->pix_clk)) {
 		dev_err(dev, "failed to register pix clk\n");
 		ret = PTR_ERR(fsl_dev->pix_clk);
--

2.1.0.27.g96db324

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel