Skip to contentSkip to conversation

drm/sun4i: Allwinner A64 MIPI-DSI support

PATCH Superseded Jagan Teki 3 participants 31 messages Mar 11, 2019 – Apr 2, 2019

Subsystems (6)

v8 of 14 Superseded Latest is v14 →

lore
Share & tools
lore

Jagan Teki

author
#0 lore raw

v8 cover drm/sun4i: Allwinner A64 MIPI-DSI support

Here is next version, v8 changes for Allwinner A64 MIPI-DSI support. It depends on DSI fixes/update series [1]

Changes for v8:
- rebased on drm-misc change along with linux-next
- reworked video start delay patch
- tested on 4 different dsi panels
- reworked commit messages
Changes for v7:
- moved vcc-dsi binding to required filed.
- drop quotes on fallback dphy bindings.
- drop min_rate clock pll-mipi patches.
- introduce dclk divider computation as like A64 BSP.
- add A64 DSI quark patches.
- fixed A64 DSI pipeline.
- add proper commit messages.
- collect Merlijn Wajer Tested-by credits.
Changes for v6:
- dropped unneeded changes, patches
- fixed all burst mode patches as per previous version comments
- rebase on master
- update proper commit message
- dropped unneeded comments
- order the patches that make review easy
Changes for v5:
- collect Rob, Acked-by
- droped "Fix VBP size calculation" patch
- updated vblk timing calculation.
- droped techstar, bananapi dsi panel drivers which may require bridge or other setup. it's under discussion.
Changes for v4:
- droppoed untested CCU_FEATURE_FIXED_POSTDIV check code in nkm min, max rate patches
- create two patches for "Add Allwinner A64 MIPI DSI support" one for has_mod_clk quirk and other one for A64 support
- use existing driver code construct for hblk computation
- dropped "Increase hfp packet overhead" patch [2], though BSP added this but we have no issues as of now.
(no issues on panel side w/o this change)
- create separate function for vblk computation
- enable vcc-dsi regulator in dsi_runtime_resume
- collect Rob, Acked-by
- update MAINTAINERS file for panel drivers
- cleanup commit messages
- fixed checkpatch warnings/errors

[1] https://patchwork.kernel.org/cover/10837163/

Any inputs?
Jagan.

Jagan Teki (15):
drm/sun4i: dsi: Fix video start delay computation
drm/sun4i: tcon: Compute DCLK dividers based on format, lanes drm/sun4i: tcon: Export get tcon0 routine
drm/sun4i: dsi: Probe tcon0 during dsi_bind
drm/sun4i: dsi: Get tcon0_div at runtime
dt-bindings: sun6i-dsi: Add VCC-DSI supply property
dt-bindings: sun6i-dsi: Add A64 MIPI-DSI compatible
dt-bindings: sun6i-dsi: Add A64 DPHY compatible (w/ A31 fallback) drm/sun4i: sun6i_mipi_dsi: Add has_mod_clk quirk
drm/sun4i: sun6i_mipi_dsi: Add has_mod_clk quirk
drm/sun4i: sun6i_mipi_dsi: Add Allwinner A64 MIPI DSI support
arm64: dts: allwinner: a64: Add MIPI DSI pipeline
arm64: dts: allwinner: a64-amarula-relic: Add Techstar TS8550B
MIPI-DSI panel
[DO NOT MERGE] arm64: dts: allwinner: a64-pine64-lts: Enable Feiyang FY07024DI26A30-D
DSI panel
[DO NOT MERGE] arm64: dts: allwinner: bananapi-m64: Enable Bananapi S070WV20-CT16 DSI
panel

 .../bindings/display/sunxi/sun6i-dsi.txt      |  3 +
 .../allwinner/sun50i-a64-amarula-relic.dts    | 39 +++++++++
 .../dts/allwinner/sun50i-a64-bananapi-m64.dts | 44 ++++++++++
 .../dts/allwinner/sun50i-a64-pine64-lts.dts   | 39 +++++++++
 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 45 ++++++++++
 drivers/gpu/drm/sun4i/sun4i_tcon.c            |  7 +-
 drivers/gpu/drm/sun4i/sun4i_tcon.h            |  1 +
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c        | 83 +++++++++++++++----
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h        |  9 +-
 9 files changed, 252 insertions(+), 18 deletions(-)
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#1 lore raw

PATCH v8 1/15 drm/sun4i: dsi: Fix video start delay computation

Vertical video start delay is computed by excluding vertical front porch value from total vertical timings.

This clearly confirmed from BSP code and here how it computed,

(drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c) u32 vfp = panel->lcd_vt - panel->lcd_y - panel->lcd_vbp; => (panel->lcd_vt) - panel->lcd_y - (panel->lcd_vbp) => (timmings->ver_front_porch + panel->lcd_vbp + panel->lcd_y)
- panel->lcd_y - (panel->lcd_vbp)
=> timmings->ver_front_porch + panel->lcd_vbp + panel->lcd_y
- panel->lcd_y - panel->lcd_vbp
=> timmings->ver_front_porch

But the current driver is assuming it can exclude vertical front porch along with vertical sync values from total vertical timings, which resulting wrong start delay indeed wrong picture rendering in the panel.

Example: timings, where it produces the issue.

{
	.vdisplay	= 600,
	.vsync_start	= 600 + 12,
	.vsync_end	= 600 + 12 + 2,
	.vtotal		= 600 + 12 + 2 + 21,
}

It produces the desired start delay value as 19 but the correct working value should be 513.

So, Fix it by computing proper video start delay.

Fixes 69006ef0ecb1 ("drm/sun4i: dsi: Change the start delay calculation")
---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +8 -2
index 62a508420227..8d6292c0158b 100644
@@ -364,8 +364,14 @@ static void sun6i_dsi_inst_init(struct sun6i_dsi *dsi,
 static u16 sun6i_dsi_get_video_start_delay(struct sun6i_dsi *dsi,
 					   struct drm_display_mode *mode)
 {
-	u16 start = clamp(mode->vtotal - mode->vdisplay - 10, 8, 100);
-	u16 delay = mode->vtotal - (mode->vsync_end - mode->vdisplay) + start;
+	u16 delay = mode->vtotal - (mode->vsync_start - mode->vdisplay);
+
+	/**
+	 * BSP comment:
+	 * put start_delay to tcon. set ready sync early to dramfreq,
+	 * so set start_delay 1
+	 */
+	delay += 1;
 
 	if (delay > mode->vtotal)
 		delay = delay % mode->vtotal;
Signature · 1 line
2.18.0.321.gffc6fa0e3
#2 lore raw

Re: [PATCH v8 01/15] drm/sun4i: dsi: Fix video start delay computation

Quoted 14 lines · Jagan Teki

Vertical video start delay is computed by excluding vertical front porch value from total vertical timings.

This clearly confirmed from BSP code and here how it computed,

(drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c) u32 vfp = panel->lcd_vt - panel->lcd_y - panel->lcd_vbp; => (panel->lcd_vt) - panel->lcd_y - (panel->lcd_vbp) => (timmings->ver_front_porch + panel->lcd_vbp + panel->lcd_y)
- panel->lcd_y - (panel->lcd_vbp)
=> timmings->ver_front_porch + panel->lcd_vbp + panel->lcd_y
- panel->lcd_y - panel->lcd_vbp
=> timmings->ver_front_porch

Quoted 4 lines

But the current driver is assuming it can exclude vertical front porch along with vertical sync values from total vertical timings, which resulting wrong start delay indeed wrong picture rendering in the panel.

Same story here: which panel, which datasheet, which "wrong picture rendering"?

Quoted 7 lines

Example: timings, where it produces the issue.

{
	.vdisplay	= 600,
	.vsync_start	= 600 + 12,
	.vsync_end	= 600 + 12 + 2,
	.vtotal		= 600 + 12 + 2 + 21,
}

Can you 100% trust those timings?

Quoted 18 lines

It produces the desired start delay value as 19 but the correct working value should be 513.

So, Fix it by computing proper video start delay.

Fixes 69006ef0ecb1 ("drm/sun4i: dsi: Change the start delay calculation")
---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +0 -0
index 62a508420227..8d6292c0158b 100644
@@ -364,8 +364,14 @@ static void sun6i_dsi_inst_init(struct sun6i_dsi *dsi,
 static u16 sun6i_dsi_get_video_start_delay(struct sun6i_dsi *dsi,
 					   struct drm_display_mode *mode)

drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c static void sun6i_dsi_inst_init(struct sun6i_dsi *dsi, · line 373

Quoted 10 lines
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +7 -2
 {
-	u16 start = clamp(mode->vtotal - mode->vdisplay - 10, 8, 100);
-	u16 delay = mode->vtotal - (mode->vsync_end - mode->vdisplay) + start;
+	u16 delay = mode->vtotal - (mode->vsync_start - mode->vdisplay);
+
+	/**
+	 * BSP comment:
+	 * put start_delay to tcon. set ready sync early to dramfreq,
+	 * so set start_delay 1
+	 */

That doesn't make any sense to me... What does it mean?

Maxime

Signature · 3 lines
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
author
#3 lore raw

Re: [PATCH v8 01/15] drm/sun4i: dsi: Fix video start delay computation

Quoted 16 lines · Maxime Ripard
Quoted 14 lines · Jagan Teki

Vertical video start delay is computed by excluding vertical front porch value from total vertical timings.

This clearly confirmed from BSP code and here how it computed,

(drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c) u32 vfp = panel->lcd_vt - panel->lcd_y - panel->lcd_vbp; => (panel->lcd_vt) - panel->lcd_y - (panel->lcd_vbp) => (timmings->ver_front_porch + panel->lcd_vbp + panel->lcd_y)
- panel->lcd_y - (panel->lcd_vbp)
=> timmings->ver_front_porch + panel->lcd_vbp + panel->lcd_y
- panel->lcd_y - panel->lcd_vbp
=> timmings->ver_front_porch

Quoted 7 lines
Quoted 4 lines

But the current driver is assuming it can exclude vertical front porch along with vertical sync values from total vertical timings, which resulting wrong start delay indeed wrong picture rendering in the panel.

Same story here: which panel, which datasheet, which "wrong picture rendering"?

It's bananapi,s070wv20-ct16 DSI

Quoted 10 lines
Quoted 8 lines

Example: timings, where it produces the issue.

{
      .vdisplay       = 600,
      .vsync_start    = 600 + 12,
      .vsync_end      = 600 + 12 + 2,
      .vtotal         = 600 + 12 + 2 + 21,
}

Can you 100% trust those timings?

ie. reason, I have given the Mainline timings [1]. The above timings are wrongly mentioned actual timings are from [1]

Quoted 23 lines
Quoted 23 lines

It produces the desired start delay value as 19 but the correct working value should be 513.

So, Fix it by computing proper video start delay.

Fixes 69006ef0ecb1 ("drm/sun4i: dsi: Change the start delay calculation")
---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +1 -2
index 62a508420227..8d6292c0158b 100644
@@ -364,8 +364,14 @@ static void sun6i_dsi_inst_init(struct sun6i_dsi *dsi,
 static u16 sun6i_dsi_get_video_start_delay(struct sun6i_dsi *dsi,
                                         struct drm_display_mode *mode)
 {
-     u16 start = clamp(mode->vtotal - mode->vdisplay - 10, 8, 100);
-     u16 delay = mode->vtotal - (mode->vsync_end - mode->vdisplay) + start;
+     u16 delay = mode->vtotal - (mode->vsync_start - mode->vdisplay);
Quoted 8 lines

drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c static void sun6i_dsi_inst_init(struct sun6i_dsi *dsi, · line 373

Quoted 6 lines
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +6 -0
+
+     /**
+      * BSP comment:
+      * put start_delay to tcon. set ready sync early to dramfreq,
+      * so set start_delay 1
+      */

That doesn't make any sense to me... What does it mean?

Which is meaning as above stated as "BSP comment" from here[2]

[1] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/gpu/drm/panel/panel-simple.c?id=7ad8b41cd8f5c2842646d01cdd576663caee04a7
[2] https://github.com/longsleep/linux-pine64/blob/pine64-hacks-1.2/drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c#L729
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw

Re: [PATCH v8 01/15] drm/sun4i: dsi: Fix video start delay computation

Quoted 22 lines · Jagan Teki
Quoted 21 lines · Maxime Ripard
Quoted 18 lines · Jagan Teki

Vertical video start delay is computed by excluding vertical front porch value from total vertical timings.

This clearly confirmed from BSP code and here how it computed,

(drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c) u32 vfp = panel->lcd_vt - panel->lcd_y - panel->lcd_vbp; => (panel->lcd_vt) - panel->lcd_y - (panel->lcd_vbp) => (timmings->ver_front_porch + panel->lcd_vbp + panel->lcd_y)
- panel->lcd_y - (panel->lcd_vbp)
=> timmings->ver_front_porch + panel->lcd_vbp + panel->lcd_y
- panel->lcd_y - panel->lcd_vbp
=> timmings->ver_front_porch

But the current driver is assuming it can exclude vertical front porch along with vertical sync values from total vertical timings, which resulting wrong start delay indeed wrong picture rendering in the panel.

Quoted 4 lines
Quoted 2 lines

Same story here: which panel, which datasheet, which "wrong picture rendering"?

It's bananapi,s070wv20-ct16 DSI

You're answering one out of three questions.

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

Example: timings, where it produces the issue.

{
      .vdisplay       = 600,
      .vsync_start    = 600 + 12,
      .vsync_end      = 600 + 12 + 2,
      .vtotal         = 600 + 12 + 2 + 21,
}
Quoted 4 lines
Quoted 1 line

Can you 100% trust those timings?

ie. reason, I have given the Mainline timings [1]. The above timings are wrongly mentioned actual timings are from [1]

You're still answering partially here. Those timings are working for RGB, you have no proof that we need to make the same adjustments for DSI.

Quoted 31 lines
Quoted 22 lines
Quoted 22 lines

It produces the desired start delay value as 19 but the correct working value should be 513.

So, Fix it by computing proper video start delay.

Fixes 69006ef0ecb1 ("drm/sun4i: dsi: Change the start delay calculation")
---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +1 -2
index 62a508420227..8d6292c0158b 100644
@@ -364,8 +364,14 @@ static void sun6i_dsi_inst_init(struct sun6i_dsi *dsi,
 static u16 sun6i_dsi_get_video_start_delay(struct sun6i_dsi *dsi,
                                         struct drm_display_mode *mode)
 {
-     u16 start = clamp(mode->vtotal - mode->vdisplay - 10, 8, 100);
-     u16 delay = mode->vtotal - (mode->vsync_end - mode->vdisplay) + start;
+     u16 delay = mode->vtotal - (mode->vsync_start - mode->vdisplay);
Quoted 8 lines

drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c static void sun6i_dsi_inst_init(struct sun6i_dsi *dsi, · line 373

Quoted 6 lines
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +6 -0
+
+     /**
+      * BSP comment:
+      * put start_delay to tcon. set ready sync early to dramfreq,
+      * so set start_delay 1
+      */

That doesn't make any sense to me... What does it mean?

Quoted 1 line

Which is meaning as above stated as "BSP comment" from here[2]

It doesn't matter where you took it from. If you cannot explain what happen, putting a random label that doesn't explain anything will not help.

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

author
#5 lore raw

Re: [PATCH v8 01/15] drm/sun4i: dsi: Fix video start delay computation

Quoted 24 lines · Maxime Ripard
Quoted 22 lines · Jagan Teki
Quoted 21 lines · Maxime Ripard
Quoted 18 lines · Jagan Teki

Vertical video start delay is computed by excluding vertical front porch value from total vertical timings.

This clearly confirmed from BSP code and here how it computed,

(drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c) u32 vfp = panel->lcd_vt - panel->lcd_y - panel->lcd_vbp; => (panel->lcd_vt) - panel->lcd_y - (panel->lcd_vbp) => (timmings->ver_front_porch + panel->lcd_vbp + panel->lcd_y)
- panel->lcd_y - (panel->lcd_vbp)
=> timmings->ver_front_porch + panel->lcd_vbp + panel->lcd_y
- panel->lcd_y - panel->lcd_vbp
=> timmings->ver_front_porch

But the current driver is assuming it can exclude vertical front porch along with vertical sync values from total vertical timings, which resulting wrong start delay indeed wrong picture rendering in the panel.

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

Same story here: which panel, which datasheet, which "wrong picture rendering"?

It's bananapi,s070wv20-ct16 DSI

2. as I said before, it is the same panel for both RGB and DSI, and ICN6211 bridge is converter for RGB-to-DSI. we don't have any specific programming or detailed datasheet from this except BSP DSI panel sequence along with BSP panel timings which are similar to RGB one.

3. wrong picture rendering is something sprightliness followed by colors jerks, which I couldn't explain it properly ie reason I mentioned some generic term for understanding.

Quoted 11 lines

You're answering one out of three questions.

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

Example: timings, where it produces the issue.

{
      .vdisplay       = 600,
      .vsync_start    = 600 + 12,
      .vsync_end      = 600 + 12 + 2,
      .vtotal         = 600 + 12 + 2 + 21,
}
Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Can you 100% trust those timings?

ie. reason, I have given the Mainline timings [1]. The above timings are wrongly mentioned actual timings are from [1]

You're still answering partially here. Those timings are working for RGB, you have no proof that we need to make the same adjustments for DSI.

It is RGB to DSI bridge on the same panel, as I explained above and it would shared same timings. I can confirm or proved it from BSP panel timings which are working. indeed same timings are been in Mainline tree, we can trust them atleast.

Quoted 32 lines
Quoted 32 lines
Quoted 31 lines
Quoted 19 lines

It produces the desired start delay value as 19 but the correct working value should be 513.

So, Fix it by computing proper video start delay.

Fixes 69006ef0ecb1 ("drm/sun4i: dsi: Change the start delay calculation")
---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +0 -0
index 62a508420227..8d6292c0158b 100644
@@ -364,8 +364,14 @@ static void sun6i_dsi_inst_init(struct sun6i_dsi *dsi,
 static u16 sun6i_dsi_get_video_start_delay(struct sun6i_dsi *dsi,
                                         struct drm_display_mode *mode)

drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c static void sun6i_dsi_inst_init(struct sun6i_dsi *dsi, · line 373

Quoted 10 lines
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +7 -2
 {
-     u16 start = clamp(mode->vtotal - mode->vdisplay - 10, 8, 100);
-     u16 delay = mode->vtotal - (mode->vsync_end - mode->vdisplay) + start;
+     u16 delay = mode->vtotal - (mode->vsync_start - mode->vdisplay);
+
+     /**
+      * BSP comment:
+      * put start_delay to tcon. set ready sync early to dramfreq,
+      * so set start_delay 1
+      */

That doesn't make any sense to me... What does it mean?

Quoted 5 lines
Quoted 1 line

Which is meaning as above stated as "BSP comment" from here[2]

It doesn't matter where you took it from. If you cannot explain what happen, putting a random label that doesn't explain anything will not help.

I have no idea or document to refer why this 1 would be added. so I used same comment from BSP like many places on sun4i does. w/o this +1 the delay is computed to 512 which is not working and with this the desired delay is 513 which is perfectly working.

If you have any idea on this, please share so-that I can add it in comment otherwise.

Jagan.

author
#6 lore raw

Re: [PATCH v8 01/15] drm/sun4i: dsi: Fix video start delay computation

Hi Maxime,

Quoted 103 lines · Jagan Teki
Quoted 24 lines · Maxime Ripard
Quoted 22 lines · Jagan Teki
Quoted 21 lines · Maxime Ripard
Quoted 18 lines · Jagan Teki

Vertical video start delay is computed by excluding vertical front porch value from total vertical timings.

This clearly confirmed from BSP code and here how it computed,

(drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c) u32 vfp = panel->lcd_vt - panel->lcd_y - panel->lcd_vbp; => (panel->lcd_vt) - panel->lcd_y - (panel->lcd_vbp) => (timmings->ver_front_porch + panel->lcd_vbp + panel->lcd_y)
- panel->lcd_y - (panel->lcd_vbp)
=> timmings->ver_front_porch + panel->lcd_vbp + panel->lcd_y
- panel->lcd_y - panel->lcd_vbp
=> timmings->ver_front_porch

But the current driver is assuming it can exclude vertical front porch along with vertical sync values from total vertical timings, which resulting wrong start delay indeed wrong picture rendering in the panel.

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

Same story here: which panel, which datasheet, which "wrong picture rendering"?

It's bananapi,s070wv20-ct16 DSI

2. as I said before, it is the same panel for both RGB and DSI, and ICN6211 bridge is converter for RGB-to-DSI. we don't have any specific programming or detailed datasheet from this except BSP DSI panel sequence along with BSP panel timings which are similar to RGB one.

3. wrong picture rendering is something sprightliness followed by colors jerks, which I couldn't explain it properly ie reason I mentioned some generic term for understanding.

Quoted 11 lines

You're answering one out of three questions.

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

Example: timings, where it produces the issue.

{
      .vdisplay       = 600,
      .vsync_start    = 600 + 12,
      .vsync_end      = 600 + 12 + 2,
      .vtotal         = 600 + 12 + 2 + 21,
}
Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Can you 100% trust those timings?

ie. reason, I have given the Mainline timings [1]. The above timings are wrongly mentioned actual timings are from [1]

You're still answering partially here. Those timings are working for RGB, you have no proof that we need to make the same adjustments for DSI.

It is RGB to DSI bridge on the same panel, as I explained above and it would shared same timings. I can confirm or proved it from BSP panel timings which are working. indeed same timings are been in Mainline tree, we can trust them atleast.

Quoted 32 lines
Quoted 32 lines
Quoted 31 lines
Quoted 19 lines

It produces the desired start delay value as 19 but the correct working value should be 513.

So, Fix it by computing proper video start delay.

Fixes 69006ef0ecb1 ("drm/sun4i: dsi: Change the start delay calculation")
---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +0 -0
index 62a508420227..8d6292c0158b 100644
@@ -364,8 +364,14 @@ static void sun6i_dsi_inst_init(struct sun6i_dsi *dsi,
 static u16 sun6i_dsi_get_video_start_delay(struct sun6i_dsi *dsi,
                                         struct drm_display_mode *mode)

drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c static void sun6i_dsi_inst_init(struct sun6i_dsi *dsi, · line 373

Quoted 10 lines
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +7 -2
 {
-     u16 start = clamp(mode->vtotal - mode->vdisplay - 10, 8, 100);
-     u16 delay = mode->vtotal - (mode->vsync_end - mode->vdisplay) + start;
+     u16 delay = mode->vtotal - (mode->vsync_start - mode->vdisplay);
+
+     /**
+      * BSP comment:
+      * put start_delay to tcon. set ready sync early to dramfreq,
+      * so set start_delay 1
+      */

That doesn't make any sense to me... What does it mean?

Quoted 5 lines
Quoted 1 line

Which is meaning as above stated as "BSP comment" from here[2]

It doesn't matter where you took it from. If you cannot explain what happen, putting a random label that doesn't explain anything will not help.

Quoted 7 lines

I have no idea or document to refer why this 1 would be added. so I used same comment from BSP like many places on sun4i does. w/o this +1 the delay is computed to 512 which is not working and with this the desired delay is 513 which is perfectly working.

If you have any idea on this, please share so-that I can add it in comment otherwise.

Any further comments?

#7 lore raw

Re: [PATCH v8 01/15] drm/sun4i: dsi: Fix video start delay computation

In reply to Jagan Teki
Quoted 30 lines · Jagan Teki
Quoted 24 lines · Maxime Ripard
Quoted 22 lines · Jagan Teki
Quoted 21 lines · Maxime Ripard
Quoted 18 lines · Jagan Teki

Vertical video start delay is computed by excluding vertical front porch value from total vertical timings.

This clearly confirmed from BSP code and here how it computed,

(drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c) u32 vfp = panel->lcd_vt - panel->lcd_y - panel->lcd_vbp; => (panel->lcd_vt) - panel->lcd_y - (panel->lcd_vbp) => (timmings->ver_front_porch + panel->lcd_vbp + panel->lcd_y)
- panel->lcd_y - (panel->lcd_vbp)
=> timmings->ver_front_porch + panel->lcd_vbp + panel->lcd_y
- panel->lcd_y - panel->lcd_vbp
=> timmings->ver_front_porch

But the current driver is assuming it can exclude vertical front porch along with vertical sync values from total vertical timings, which resulting wrong start delay indeed wrong picture rendering in the panel.

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

Same story here: which panel, which datasheet, which "wrong picture rendering"?

It's bananapi,s070wv20-ct16 DSI

Quoted 8 lines

2. as I said before, it is the same panel for both RGB and DSI, and ICN6211 bridge is converter for RGB-to-DSI. we don't have any specific programming or detailed datasheet from this except BSP DSI panel sequence along with BSP panel timings which are similar to RGB one.

3. wrong picture rendering is something sprightliness followed by colors jerks, which I couldn't explain it properly ie reason I mentioned some generic term for understanding.

Some generic term doesn't explain anything, it barely makes a statement.

Quoted 15 lines
Quoted 15 lines

You're answering one out of three questions.

Quoted 12 lines
Quoted 9 lines
Quoted 7 lines

Example: timings, where it produces the issue.

{
      .vdisplay       = 600,
      .vsync_start    = 600 + 12,
      .vsync_end      = 600 + 12 + 2,
      .vtotal         = 600 + 12 + 2 + 21,
}

Can you 100% trust those timings?

ie. reason, I have given the Mainline timings [1]. The above timings are wrongly mentioned actual timings are from [1]

Quoted 8 lines
Quoted 3 lines

You're still answering partially here. Those timings are working for RGB, you have no proof that we need to make the same adjustments for DSI.

It is RGB to DSI bridge on the same panel, as I explained above and it would shared same timings. I can confirm or proved it from BSP panel timings which are working. indeed same timings are been in Mainline tree, we can trust them atleast.

You're missing the point. If the bridge has a different tolerance range to DSI timings for example, then you're screwed, even though the timings work in RGB.

Quoted 37 lines
Quoted 31 lines
Quoted 31 lines
Quoted 30 lines
Quoted 18 lines

It produces the desired start delay value as 19 but the correct working value should be 513.

So, Fix it by computing proper video start delay.

Fixes 69006ef0ecb1 ("drm/sun4i: dsi: Change the start delay calculation")
---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +0 -0
index 62a508420227..8d6292c0158b 100644
@@ -364,8 +364,14 @@ static void sun6i_dsi_inst_init(struct sun6i_dsi *dsi,
 static u16 sun6i_dsi_get_video_start_delay(struct sun6i_dsi *dsi,
                                         struct drm_display_mode *mode)

drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c static void sun6i_dsi_inst_init(struct sun6i_dsi *dsi, · line 373

Quoted 10 lines
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +7 -2
 {
-     u16 start = clamp(mode->vtotal - mode->vdisplay - 10, 8, 100);
-     u16 delay = mode->vtotal - (mode->vsync_end - mode->vdisplay) + start;
+     u16 delay = mode->vtotal - (mode->vsync_start - mode->vdisplay);
+
+     /**
+      * BSP comment:
+      * put start_delay to tcon. set ready sync early to dramfreq,
+      * so set start_delay 1
+      */

That doesn't make any sense to me... What does it mean?

Quoted 5 lines
Quoted 1 line

Which is meaning as above stated as "BSP comment" from here[2]

It doesn't matter where you took it from. If you cannot explain what happen, putting a random label that doesn't explain anything will not help.

Quoted 7 lines

I have no idea or document to refer why this 1 would be added. so I used same comment from BSP like many places on sun4i does. w/o this +1 the delay is computed to 512 which is not working and with this the desired delay is 513 which is perfectly working.

If you have any idea on this, please share so-that I can add it in comment otherwise.

You're the one with the panel, the issue and apparently a solution, and the whole problem we're having is because I don't have any idea on what that issue is precisely, and neither why your solution makes sense.

I'm not sure I'm the best to write a comment in that situation.

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

author
#8 lore raw

PATCH v8 2/15 drm/sun4i: tcon: Compute DCLK dividers based on format, lanes

In reply to Jagan Teki

pll-video => pll-mipi => tcon0 => tcon0-pixel-clock is the typical MIPI clock topology in Allwinner DSI controller.

TCON dotclock driver is computing the desired DCLK divider based on panel pixel clock along with input DCLK min, max divider values from tcon driver and that would eventually set the pll-mipi clock rate.

The current code allows the TCON clock divider to have a default 4 for min, max ranges that would fail to compute the desired pll-mipi rate while supporting new panels.

So, add the computation logic 'format/lanes' to dclk min and max dividers and instead of default 4. This computation logic align with Allwinner A64 BSP, hoping that would work even for A33.

Tested this on 4 different DSI panels.

---
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/sun4i/sun4i_tcon.c +2 -2
index e75f77ff8e0f..339f9b1f5745 100644
@@ -341,8 +341,8 @@ static void sun4i_tcon0_mode_set_cpu(struct sun4i_tcon *tcon,
 	u32 block_space, start_delay;
 	u32 tcon_div;
 
-	tcon->dclk_min_div = SUN6I_DSI_TCON_DIV;
-	tcon->dclk_max_div = SUN6I_DSI_TCON_DIV;
+	tcon->dclk_min_div = bpp/lanes;
+	tcon->dclk_max_div = bpp/lanes;
 
 	sun4i_tcon0_mode_set_common(tcon, mode);
 
Signature · 1 line
2.18.0.321.gffc6fa0e3
#9 lore raw

Re: [PATCH v8 02/15] drm/sun4i: tcon: Compute DCLK dividers based on format, lanes

Quoted 7 lines · Jagan Teki

pll-video => pll-mipi => tcon0 => tcon0-pixel-clock is the typical MIPI clock topology in Allwinner DSI controller.

TCON dotclock driver is computing the desired DCLK divider based on panel pixel clock along with input DCLK min, max divider values from tcon driver and that would eventually set the pll-mipi clock rate.

Quoted 7 lines

The current code allows the TCON clock divider to have a default 4 for min, max ranges that would fail to compute the desired pll-mipi rate while supporting new panels.

So, add the computation logic 'format/lanes' to dclk min and max dividers and instead of default 4. This computation logic align with Allwinner A64 BSP, hoping that would work even for A33.

Last time we discussed this, we found out that this wasn't the case, even in the BSP.

What compelling evidence have you found that makes you say otherwise?

Maxime

Signature · 3 lines
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
author
#10 lore raw

Re: [PATCH v8 02/15] drm/sun4i: tcon: Compute DCLK dividers based on format, lanes

Quoted 13 lines · Maxime Ripard
Quoted 11 lines · Jagan Teki

pll-video => pll-mipi => tcon0 => tcon0-pixel-clock is the typical MIPI clock topology in Allwinner DSI controller.

TCON dotclock driver is computing the desired DCLK divider based on panel pixel clock along with input DCLK min, max divider values from tcon driver and that would eventually set the pll-mipi clock rate.

The current code allows the TCON clock divider to have a default 4 for min, max ranges that would fail to compute the desired pll-mipi rate while supporting new panels.

Quoted 6 lines
Quoted 3 lines

So, add the computation logic 'format/lanes' to dclk min and max dividers and instead of default 4. This computation logic align with Allwinner A64 BSP, hoping that would work even for A33.

Last time we discussed this, we found out that this wasn't the case, even in the BSP.

This was the case for BSP to compute pll-mipi not for TCON_DSI clock register, SUN4I_TCON0_DCLK_REG, which marked the divider 4 by default.

Quoted 2 lines

What compelling evidence have you found that makes you say otherwise?

divider 4 isn't worked, this I would mentioned before as well.

Tested this on 4 different panels, and below are the desired divider values and pll-mipi clock rate with respect to pixel clock frequency.

- 55MHz pixel clock with 4-lane panel, and the desired DSI clock divider is 6 with the output parent clock rate of 330MHz.
- 30MHz pixel clock with 4-lane panel, and the desired DSI clock divider is 6 with parent clock rate of 180MHz.
- 27.5Mhz pixel clock with 2-lane pane, and the desired DSI clock divider is 12 with the output parent clock rate of 330MHz.
- 147MHz pixel clock with 4-lane panel, and the desired DSI clock divider is 6 with the output parent clock rate of 882MHz.

BSP trying to use this format/lane to compute dsi divider that in-turn using pll-mipi set_rate but TCON0_DCLK_REG keep constant 4.

author
#11 lore raw

Re: [PATCH v8 02/15] drm/sun4i: tcon: Compute DCLK dividers based on format, lanes

Quoted 42 lines · Jagan Teki
Quoted 13 lines · Maxime Ripard
Quoted 11 lines · Jagan Teki

pll-video => pll-mipi => tcon0 => tcon0-pixel-clock is the typical MIPI clock topology in Allwinner DSI controller.

TCON dotclock driver is computing the desired DCLK divider based on panel pixel clock along with input DCLK min, max divider values from tcon driver and that would eventually set the pll-mipi clock rate.

The current code allows the TCON clock divider to have a default 4 for min, max ranges that would fail to compute the desired pll-mipi rate while supporting new panels.

Quoted 6 lines
Quoted 3 lines

So, add the computation logic 'format/lanes' to dclk min and max dividers and instead of default 4. This computation logic align with Allwinner A64 BSP, hoping that would work even for A33.

Last time we discussed this, we found out that this wasn't the case, even in the BSP.

This was the case for BSP to compute pll-mipi not for TCON_DSI clock register, SUN4I_TCON0_DCLK_REG, which marked the divider 4 by default.

Quoted 2 lines

What compelling evidence have you found that makes you say otherwise?

divider 4 isn't worked, this I would mentioned before as well.

Tested this on 4 different panels, and below are the desired divider values and pll-mipi clock rate with respect to pixel clock frequency.

- 55MHz pixel clock with 4-lane panel, and the desired DSI clock divider is 6 with the output parent clock rate of 330MHz.
- 30MHz pixel clock with 4-lane panel, and the desired DSI clock divider is 6 with parent clock rate of 180MHz.
- 27.5Mhz pixel clock with 2-lane pane, and the desired DSI clock divider is 12 with the output parent clock rate of 330MHz.
- 147MHz pixel clock with 4-lane panel, and the desired DSI clock divider is 6 with the output parent clock rate of 882MHz.

Quoted 2 lines

BSP trying to use this format/lane to compute dsi divider that in-turn using pll-mipi set_rate but TCON0_DCLK_REG keep constant 4.

Any comments?

For more information, I have even tying to get the dump here to show the pll_rate set in BSP code [1], please have a look at this gist[2] where the bpp/lanes value of 6 is computed for pll_rate and let me know what do you think?

DSI rate is 148.5Mhz
Panel Pixel clock is 148Mhz
PLL set rate is 888Mhz (which is bpp/lanes = 6 * 148 Mhz)

[1] https://github.com/BPI-SINOVOIP/BPI-M64-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp2/disp/de/disp_lcd.c#L793
[2] https://gist.github.com/openedev/9bae2d87d2fcc06b999fe48c998b7043

     https://gist.github.com/openedev/700de2e3701b2bf3ad1aa0f0fa862c9a
#12 lore raw

Re: [PATCH v8 02/15] drm/sun4i: tcon: Compute DCLK dividers based on format, lanes

In reply to Jagan Teki
Quoted 21 lines · Jagan Teki
Quoted 13 lines · Maxime Ripard
Quoted 11 lines · Jagan Teki

pll-video => pll-mipi => tcon0 => tcon0-pixel-clock is the typical MIPI clock topology in Allwinner DSI controller.

TCON dotclock driver is computing the desired DCLK divider based on panel pixel clock along with input DCLK min, max divider values from tcon driver and that would eventually set the pll-mipi clock rate.

The current code allows the TCON clock divider to have a default 4 for min, max ranges that would fail to compute the desired pll-mipi rate while supporting new panels.

Quoted 6 lines
Quoted 3 lines

So, add the computation logic 'format/lanes' to dclk min and max dividers and instead of default 4. This computation logic align with Allwinner A64 BSP, hoping that would work even for A33.

Last time we discussed this, we found out that this wasn't the case, even in the BSP.

Quoted 6 lines

This was the case for BSP to compute pll-mipi not for TCON_DSI clock register, SUN4I_TCON0_DCLK_REG, which marked the divider 4 by default.

Quoted 1 line

What compelling evidence have you found that makes you say otherwise?

divider 4 isn't worked, this I would mentioned before as well.

Maybe you mentionned it before, but it's nowhere to be found in your commit log.

Quoted 12 lines

Tested this on 4 different panels, and below are the desired divider values and pll-mipi clock rate with respect to pixel clock frequency.

- 55MHz pixel clock with 4-lane panel, and the desired DSI clock divider is 6 with the output parent clock rate of 330MHz.
- 30MHz pixel clock with 4-lane panel, and the desired DSI clock divider is 6 with parent clock rate of 180MHz.
- 27.5Mhz pixel clock with 2-lane pane, and the desired DSI clock divider is 12 with the output parent clock rate of 330MHz.
- 147MHz pixel clock with 4-lane panel, and the desired DSI clock divider is 6 with the output parent clock rate of 882MHz.

Quoted 2 lines

BSP trying to use this format/lane to compute dsi divider that in-turn using pll-mipi set_rate but TCON0_DCLK_REG keep constant 4.

Feel free to reply to
http://lists.infradead.org/pipermail/linux-arm-kernel/2019-February/629596.html

And correct whatever is said there that isn't what is happening.

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

#13 lore raw

Re: [PATCH v8 02/15] drm/sun4i: tcon: Compute DCLK dividers based on format, lanes

Hi, guys,

Quoted 39 lines · Maxime Ripard
Quoted 16 lines · Jagan Teki
Quoted 15 lines · Maxime Ripard
Quoted 14 lines · Jagan Teki

pll-video => pll-mipi => tcon0 => tcon0-pixel-clock is the typical MIPI clock topology in Allwinner DSI controller.

TCON dotclock driver is computing the desired DCLK divider based on panel pixel clock along with input DCLK min, max divider values from tcon driver and that would eventually set the pll-mipi clock rate.

The current code allows the TCON clock divider to have a default 4 for min, max ranges that would fail to compute the desired pll-mipi rate while supporting new panels.

So, add the computation logic 'format/lanes' to dclk min and max dividers and instead of default 4. This computation logic align with Allwinner A64 BSP, hoping that would work even for A33.

Quoted 7 lines
Quoted 2 lines

Last time we discussed this, we found out that this wasn't the case, even in the BSP.

This was the case for BSP to compute pll-mipi not for TCON_DSI clock register, SUN4I_TCON0_DCLK_REG, which marked the divider 4 by default.

Quoted 1 line

What compelling evidence have you found that makes you say otherwise?

divider 4 isn't worked, this I would mentioned before as well.

Maybe you mentionned it before, but it's nowhere to be found in your commit log.

Quoted 12 lines

Tested this on 4 different panels, and below are the desired divider values and pll-mipi clock rate with respect to pixel clock frequency.

- 55MHz pixel clock with 4-lane panel, and the desired DSI clock divider is 6 with the output parent clock rate of 330MHz.
- 30MHz pixel clock with 4-lane panel, and the desired DSI clock divider is 6 with parent clock rate of 180MHz.
- 27.5Mhz pixel clock with 2-lane pane, and the desired DSI clock divider is 12 with the output parent clock rate of 330MHz.
- 147MHz pixel clock with 4-lane panel, and the desired DSI clock divider is 6 with the output parent clock rate of 882MHz.

Quoted 6 lines
Quoted 2 lines

BSP trying to use this format/lane to compute dsi divider that in-turn using pll-mipi set_rate but TCON0_DCLK_REG keep constant 4.

Feel free to reply to
http://lists.infradead.org/pipermail/linux-arm-kernel/2019-February/629596.html

And correct whatever is said there that isn't what is happening.

excuse me if my message is out of topic.

I just want let you know  that the code

tcon->dclk_min_div = SUN6I_DSI_TCON_DIV;
tcon->dclk_max_div = SUN6I_DSI_TCON_DIV;

where SUN6I_DSI_TCON_DIV = 4  isn't working with my 2-lane panel: I am always getting the error:

 [CRTC:38:crtc-0] vblank wait timed out

As soon as I set

tcon->dclk_min_div = tcon->dclk_max_div = bpp/lanes, i.e. 12

the error disappears.

Quoted 11 lines

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

author
#14 lore raw

Re: [PATCH v8 02/15] drm/sun4i: tcon: Compute DCLK dividers based on format, lanes

Hi Sergey,

Quoted 69 lines · Sergey Suloev

Hi, guys,

On 3/19/19 1:53 PM, Maxime Ripard wrote:

On Mon, Mar 11, 2019 at 09:36:27PM +0530, Jagan Teki wrote:

On Mon, Mar 11, 2019 at 9:08 PM Maxime Ripard <[email protected]> wrote:

On Mon, Mar 11, 2019 at 07:06:24PM +0530, Jagan Teki wrote:

pll-video => pll-mipi => tcon0 => tcon0-pixel-clock is the typical MIPI clock topology in Allwinner DSI controller.

TCON dotclock driver is computing the desired DCLK divider based on panel pixel clock along with input DCLK min, max divider values from tcon driver and that would eventually set the pll-mipi clock rate.

The current code allows the TCON clock divider to have a default 4 for min, max ranges that would fail to compute the desired pll-mipi rate while supporting new panels.

So, add the computation logic 'format/lanes' to dclk min and max dividers and instead of default 4. This computation logic align with Allwinner A64 BSP, hoping that would work even for A33.

Last time we discussed this, we found out that this wasn't the case, even in the BSP.

This was the case for BSP to compute pll-mipi not for TCON_DSI clock register, SUN4I_TCON0_DCLK_REG, which marked the divider 4 by default.

What compelling evidence have you found that makes you say otherwise?

divider 4 isn't worked, this I would mentioned before as well.

Maybe you mentionned it before, but it's nowhere to be found in your commit log.

Tested this on 4 different panels, and below are the desired divider values and pll-mipi clock rate with respect to pixel clock frequency.

- 55MHz pixel clock with 4-lane panel, and the desired DSI clock divider is 6 with the output parent clock rate of 330MHz.
- 30MHz pixel clock with 4-lane panel, and the desired DSI clock divider is 6 with parent clock rate of 180MHz.
- 27.5Mhz pixel clock with 2-lane pane, and the desired DSI clock divider is 12 with the output parent clock rate of 330MHz.
- 147MHz pixel clock with 4-lane panel, and the desired DSI clock divider is 6 with the output parent clock rate of 882MHz.

BSP trying to use this format/lane to compute dsi divider that in-turn using pll-mipi set_rate but TCON0_DCLK_REG keep constant 4.

Feel free to reply to
http://lists.infradead.org/pipermail/linux-arm-kernel/2019-February/629596.html

And correct whatever is said there that isn't what is happening.

excuse me if my message is out of topic.

I just want let you know that the code

tcon->dclk_min_div = SUN6I_DSI_TCON_DIV;
tcon->dclk_max_div = SUN6I_DSI_TCON_DIV;

where SUN6I_DSI_TCON_DIV = 4 isn't working with my 2-lane panel: I am always getting the error:

Quoted 7 lines

[CRTC:38:crtc-0] vblank wait timed out

As soon as I set

tcon->dclk_min_div = tcon->dclk_max_div = bpp/lanes, i.e. 12

the error disappears.

Yes, I did test the same in 2-lane panel. it worked with the logic. thanks for testing.

author
#15 lore raw

Re: [PATCH v8 02/15] drm/sun4i: tcon: Compute DCLK dividers based on format, lanes

In reply to Maxime Ripard
Quoted 26 lines · Maxime Ripard
Quoted 24 lines · Jagan Teki
Quoted 13 lines · Maxime Ripard
Quoted 11 lines · Jagan Teki

pll-video => pll-mipi => tcon0 => tcon0-pixel-clock is the typical MIPI clock topology in Allwinner DSI controller.

TCON dotclock driver is computing the desired DCLK divider based on panel pixel clock along with input DCLK min, max divider values from tcon driver and that would eventually set the pll-mipi clock rate.

The current code allows the TCON clock divider to have a default 4 for min, max ranges that would fail to compute the desired pll-mipi rate while supporting new panels.

Quoted 6 lines
Quoted 3 lines

So, add the computation logic 'format/lanes' to dclk min and max dividers and instead of default 4. This computation logic align with Allwinner A64 BSP, hoping that would work even for A33.

Last time we discussed this, we found out that this wasn't the case, even in the BSP.

This was the case for BSP to compute pll-mipi not for TCON_DSI clock register, SUN4I_TCON0_DCLK_REG, which marked the divider 4 by default.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

What compelling evidence have you found that makes you say otherwise?

divider 4 isn't worked, this I would mentioned before as well.

Maybe you mentionned it before, but it's nowhere to be found in your commit log.

I have added it in 3rd paragraph in commit message, may be you missed it or you may look for different text.

"The current code allows the TCON clock divider to have a default 4 for min, max ranges that would fail to compute the desired pll-mipi rate while supporting new panels."

Quoted 13 lines
Quoted 13 lines

Tested this on 4 different panels, and below are the desired divider values and pll-mipi clock rate with respect to pixel clock frequency.

- 55MHz pixel clock with 4-lane panel, and the desired DSI clock divider is 6 with the output parent clock rate of 330MHz.
- 30MHz pixel clock with 4-lane panel, and the desired DSI clock divider is 6 with parent clock rate of 180MHz.
- 27.5Mhz pixel clock with 2-lane pane, and the desired DSI clock divider is 12 with the output parent clock rate of 330MHz.
- 147MHz pixel clock with 4-lane panel, and the desired DSI clock divider is 6 with the output parent clock rate of 882MHz.

Quoted 5 lines
Quoted 2 lines

BSP trying to use this format/lane to compute dsi divider that in-turn using pll-mipi set_rate but TCON0_DCLK_REG keep constant 4.

Feel free to reply to
http://lists.infradead.org/pipermail/linux-arm-kernel/2019-February/629596.html

Yes, I have replied at that time itself, please check.

http://lists.infradead.org/pipermail/linux-arm-kernel/2019-February/629673.html

Here I have taken the pixel clock to 30Mhz for example in Bananapi panel, and the above gist the pixel is 148Mhz from another panel.

author
#16 lore raw

Re: [PATCH v8 02/15] drm/sun4i: tcon: Compute DCLK dividers based on format, lanes

Hi Maxime,

Quoted 61 lines · Jagan Teki
Quoted 26 lines · Maxime Ripard
Quoted 24 lines · Jagan Teki
Quoted 13 lines · Maxime Ripard
Quoted 11 lines · Jagan Teki

pll-video => pll-mipi => tcon0 => tcon0-pixel-clock is the typical MIPI clock topology in Allwinner DSI controller.

TCON dotclock driver is computing the desired DCLK divider based on panel pixel clock along with input DCLK min, max divider values from tcon driver and that would eventually set the pll-mipi clock rate.

The current code allows the TCON clock divider to have a default 4 for min, max ranges that would fail to compute the desired pll-mipi rate while supporting new panels.

Quoted 6 lines
Quoted 3 lines

So, add the computation logic 'format/lanes' to dclk min and max dividers and instead of default 4. This computation logic align with Allwinner A64 BSP, hoping that would work even for A33.

Last time we discussed this, we found out that this wasn't the case, even in the BSP.

This was the case for BSP to compute pll-mipi not for TCON_DSI clock register, SUN4I_TCON0_DCLK_REG, which marked the divider 4 by default.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

What compelling evidence have you found that makes you say otherwise?

divider 4 isn't worked, this I would mentioned before as well.

Maybe you mentionned it before, but it's nowhere to be found in your commit log.

I have added it in 3rd paragraph in commit message, may be you missed it or you may look for different text.

"The current code allows the TCON clock divider to have a default 4 for min, max ranges that would fail to compute the desired pll-mipi rate while supporting new panels."

Quoted 13 lines
Quoted 13 lines

Tested this on 4 different panels, and below are the desired divider values and pll-mipi clock rate with respect to pixel clock frequency.

- 55MHz pixel clock with 4-lane panel, and the desired DSI clock divider is 6 with the output parent clock rate of 330MHz.
- 30MHz pixel clock with 4-lane panel, and the desired DSI clock divider is 6 with parent clock rate of 180MHz.
- 27.5Mhz pixel clock with 2-lane pane, and the desired DSI clock divider is 12 with the output parent clock rate of 330MHz.
- 147MHz pixel clock with 4-lane panel, and the desired DSI clock divider is 6 with the output parent clock rate of 882MHz.

Quoted 5 lines
Quoted 2 lines

BSP trying to use this format/lane to compute dsi divider that in-turn using pll-mipi set_rate but TCON0_DCLK_REG keep constant 4.

Feel free to reply to
http://lists.infradead.org/pipermail/linux-arm-kernel/2019-February/629596.html

Quoted 6 lines

Yes, I have replied at that time itself, please check.

http://lists.infradead.org/pipermail/linux-arm-kernel/2019-February/629673.html

Here I have taken the pixel clock to 30Mhz for example in Bananapi panel, and the above gist the pixel is 148Mhz from another panel.

Any further comments?

#17 lore raw

Re: [PATCH v8 02/15] drm/sun4i: tcon: Compute DCLK dividers based on format, lanes

In reply to Jagan Teki
Quoted 34 lines · Jagan Teki
Quoted 26 lines · Maxime Ripard
Quoted 24 lines · Jagan Teki
Quoted 13 lines · Maxime Ripard
Quoted 11 lines · Jagan Teki

pll-video => pll-mipi => tcon0 => tcon0-pixel-clock is the typical MIPI clock topology in Allwinner DSI controller.

TCON dotclock driver is computing the desired DCLK divider based on panel pixel clock along with input DCLK min, max divider values from tcon driver and that would eventually set the pll-mipi clock rate.

The current code allows the TCON clock divider to have a default 4 for min, max ranges that would fail to compute the desired pll-mipi rate while supporting new panels.

Quoted 6 lines
Quoted 3 lines

So, add the computation logic 'format/lanes' to dclk min and max dividers and instead of default 4. This computation logic align with Allwinner A64 BSP, hoping that would work even for A33.

Last time we discussed this, we found out that this wasn't the case, even in the BSP.

This was the case for BSP to compute pll-mipi not for TCON_DSI clock register, SUN4I_TCON0_DCLK_REG, which marked the divider 4 by default.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

What compelling evidence have you found that makes you say otherwise?

divider 4 isn't worked, this I would mentioned before as well.

Maybe you mentionned it before, but it's nowhere to be found in your commit log.

Quoted 6 lines

I have added it in 3rd paragraph in commit message, may be you missed it or you may look for different text.

"The current code allows the TCON clock divider to have a default 4 for min, max ranges that would fail to compute the desired pll-mipi rate while supporting new panels."

And you're still not explaining *why* that is an issue, and what makes you think that your solution is the right one.

Seriously, I feel like this discussion is going in circles. I've been asking for that since your very first version.

Quoted 18 lines
Quoted 12 lines
Quoted 12 lines

Tested this on 4 different panels, and below are the desired divider values and pll-mipi clock rate with respect to pixel clock frequency.

- 55MHz pixel clock with 4-lane panel, and the desired DSI clock divider is 6 with the output parent clock rate of 330MHz.
- 30MHz pixel clock with 4-lane panel, and the desired DSI clock divider is 6 with parent clock rate of 180MHz.
- 27.5Mhz pixel clock with 2-lane pane, and the desired DSI clock divider is 12 with the output parent clock rate of 330MHz.
- 147MHz pixel clock with 4-lane panel, and the desired DSI clock divider is 6 with the output parent clock rate of 882MHz.

Quoted 5 lines
Quoted 2 lines

BSP trying to use this format/lane to compute dsi divider that in-turn using pll-mipi set_rate but TCON0_DCLK_REG keep constant 4.

Feel free to reply to
http://lists.infradead.org/pipermail/linux-arm-kernel/2019-February/629596.html

Quoted 6 lines

Yes, I have replied at that time itself, please check.

http://lists.infradead.org/pipermail/linux-arm-kernel/2019-February/629673.html

Here I have taken the pixel clock to 30Mhz for example in Bananapi panel, and the above gist the pixel is 148Mhz from another panel.

Again, without providing any reference, just making vague statements.

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

author
#18 lore raw

PATCH v8 3/15 drm/sun4i: tcon: Export get tcon0 routine

In reply to Jagan Teki

Sometimes tcon attributes like tcon divider, clock rate etc are needed in interface drivers like DSI. So for such cases interface driver must probe the respective tcon and get the attributes.

Since tcon0 probe is already available, via sun4i_get_tcon0 function, export the same instead of probing tcon explicitly.

---
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 3 ++-
 drivers/gpu/drm/sun4i/sun4i_tcon.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/sun4i/sun4i_tcon.c +2 -1
index 339f9b1f5745..6cf9661807aa 100644
@@ -221,7 +221,7 @@ EXPORT_SYMBOL(sun4i_tcon_enable_vblank);
  * are located in TCON0. This helper returns a pointer to TCON0's
  * sun4i_tcon structure, or NULL if not found.
  */
-static struct sun4i_tcon *sun4i_get_tcon0(struct drm_device *drm)
+struct sun4i_tcon *sun4i_get_tcon0(struct drm_device *drm)
 {
 	struct sun4i_drv *drv = drm->dev_private;
 	struct sun4i_tcon *tcon;
@@ -235,6 +235,7 @@ static struct sun4i_tcon *sun4i_get_tcon0(struct drm_device *drm)
 
 	return NULL;
 }
+EXPORT_SYMBOL(sun4i_get_tcon0);
 
 void sun4i_tcon_set_mux(struct sun4i_tcon *tcon, int channel,
 			const struct drm_encoder *encoder)
drivers/gpu/drm/sun4i/sun4i_tcon.h +1 -0
index b5214d71610f..a52696db14a5 100644
@@ -274,6 +274,7 @@ struct sun4i_tcon {
 struct drm_bridge *sun4i_tcon_find_bridge(struct device_node *node);
 struct drm_panel *sun4i_tcon_find_panel(struct device_node *node);
 
+struct sun4i_tcon *sun4i_get_tcon0(struct drm_device *drm);
 void sun4i_tcon_enable_vblank(struct sun4i_tcon *tcon, bool enable);
 void sun4i_tcon_mode_set(struct sun4i_tcon *tcon,
 			 const struct drm_encoder *encoder,
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#19 lore raw

PATCH v8 4/15 drm/sun4i: dsi: Probe tcon0 during dsi_bind

In reply to Jagan Teki

Probe tcon0 during dsi_bind, so-that the tcon attributes like divider value, clock rate can get whenever it need.

---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 6 ++++++
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 1 +
 2 files changed, 7 insertions(+)
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +6 -0
index 8d6292c0158b..a8d3df0ea8f5 100644
@@ -1045,6 +1045,7 @@ static int sun6i_dsi_bind(struct device *dev, struct device *master,
 	struct drm_device *drm = data;
 	struct sun4i_drv *drv = drm->dev_private;
 	struct sun6i_dsi *dsi = dev_get_drvdata(dev);
+	struct sun4i_tcon *tcon0 = sun4i_get_tcon0(drm);
 	int ret;
 
 	if (!dsi->panel)
@@ -1052,6 +1053,11 @@ static int sun6i_dsi_bind(struct device *dev, struct device *master,
 
 	dsi->drv = drv;
 
+	if (!tcon0)
+		return -EINVAL;
+
+	dsi->tcon = tcon0;
+
 	drm_encoder_helper_add(&dsi->encoder,
 			       &sun6i_dsi_enc_helper_funcs);
 	ret = drm_encoder_init(drm,
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h +1 -0
index 5c3ad5be0690..20516f7ab179 100644
@@ -28,6 +28,7 @@ struct sun6i_dsi {
 
 	struct device		*dev;
 	struct sun4i_drv	*drv;
+	struct sun4i_tcon	*tcon;
 	struct mipi_dsi_device	*device;
 	struct drm_panel	*panel;
 };
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#20 lore raw

PATCH v8 5/15 drm/sun4i: dsi: Get tcon0_div at runtime

In reply to Jagan Teki

tcon0 divider is used while computing drq edge0 for burst mode devices, currently driver is using default macro value 4 via SUN6I_DSI_TCON_DIV.

Unfortunately not all the panel devices are working with this default divider value 4, so to make future changes on this divider value get the divider from tcon dot clock at runtime.

---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 8 +++++++-
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 2 --
 2 files changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +7 -1
index a8d3df0ea8f5..388e1161974c 100644
@@ -392,9 +392,15 @@ static u16 sun6i_dsi_get_drq_edge0(struct sun6i_dsi *dsi,
 				   struct drm_display_mode *mode,
 				   u16 line_num, u16 edge1)
 {
+	struct sun4i_tcon *tcon = dsi->tcon;
+	unsigned long dclk_rate, dclk_parent_rate, tcon0_div;
 	u16 edge0 = edge1;
 
-	edge0 += (mode->hdisplay + 40) * SUN6I_DSI_TCON_DIV / 8;
+	dclk_rate = clk_get_rate(tcon->dclk);
+	dclk_parent_rate = clk_get_rate(clk_get_parent(tcon->dclk));
+	tcon0_div = dclk_parent_rate / dclk_rate;
+
+	edge0 += (mode->hdisplay + 40) * tcon0_div / 8;
 
 	if (edge0 > line_num)
 		return edge0 - line_num;
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h +0 -2
index 20516f7ab179..747c451a9a20 100644
@@ -13,8 +13,6 @@
 #include <drm/drm_encoder.h>
 #include <drm/drm_mipi_dsi.h>
 
-#define SUN6I_DSI_TCON_DIV	4
-
 struct sun6i_dsi {
 	struct drm_connector	connector;
 	struct drm_encoder	encoder;
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#21 lore raw

PATCH v8 6/15 dt-bindings: sun6i-dsi: Add VCC-DSI supply property

In reply to Jagan Teki

Allwinner MIPI DSI controllers are supplied with SoC DSI power rails via VCC-DSI pin.

Some board still work without supplying this but give more faith on datasheet and hardware schematics and document this supply property in required property list.

---
 Documentation/devicetree/bindings/display/sunxi/sun6i-dsi.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/display/sunxi/sun6i-dsi.txt +1 -0
index 6a6cf5de08b0..1cc40663b7a2 100644
@@ -21,6 +21,7 @@ Required properties:
   - phys: phandle to the D-PHY
   - phy-names: must be "dphy"
   - resets: phandle to the reset controller driving the encoder
+  - vcc-dsi-supply: the VCC-DSI power supply of the DSI encoder
 
   - ports: A ports node with endpoint definitions as defined in
     Documentation/devicetree/bindings/media/video-interfaces.txt. The
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#22 lore raw

PATCH v8 7/15 dt-bindings: sun6i-dsi: Add A64 MIPI-DSI compatible

In reply to Jagan Teki

The MIPI DSI controller in Allwinner A64 is similar to A33.

But unlike A33, A64 doesn't have DSI_SCLK gating so it is valid to with separate compatible for A64 on the same driver.

---
 Documentation/devicetree/bindings/display/sunxi/sun6i-dsi.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/display/sunxi/sun6i-dsi.txt +1 -0
index 1cc40663b7a2..9877398be69a 100644
@@ -12,6 +12,7 @@ The DSI Encoder generates the DSI signal from the TCON's.
 Required properties:
   - compatible: value must be one of:
     * allwinner,sun6i-a31-mipi-dsi
+    * allwinner,sun50i-a64-mipi-dsi
   - reg: base address and size of memory-mapped region
   - interrupts: interrupt associated to this IP
   - clocks: phandles to the clocks feeding the DSI encoder
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#23 lore raw

PATCH v8 8/15 dt-bindings: sun6i-dsi: Add A64 DPHY compatible (w/ A31 fallback)

In reply to Jagan Teki

The MIPI DSI PHY controller on Allwinner A64 is similar on the one on A31.

Add A64 compatible and append A31 compatible as fallback.

---
 Documentation/devicetree/bindings/display/sunxi/sun6i-dsi.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/display/sunxi/sun6i-dsi.txt +1 -0
index 9877398be69a..d0ce51fea103 100644
@@ -38,6 +38,7 @@ D-PHY
 Required properties:
   - compatible: value must be one of:
     * allwinner,sun6i-a31-mipi-dphy
+    * allwinner,sun50i-a64-mipi-dphy, allwinner,sun6i-a31-mipi-dphy
   - reg: base address and size of memory-mapped region
   - clocks: phandles to the clocks feeding the DSI encoder
     * bus: the DSI interface clock
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#24 lore raw

PATCH v8 9/15 drm/sun4i: sun6i_mipi_dsi: Add has_mod_clk quirk

In reply to Jagan Teki

As per the user manual, look like mod clock is not mandatory for all Allwinner MIPI DSI controllers, it is connected to CLK_DSI_SCLK for A31 and not available in A64.

So add has_mod_clk quirk and process the clk accordingly.

---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 14 ++++++++++++++
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h |  3 +++
 2 files changed, 17 insertions(+)
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +14 -0
index 388e1161974c..f42ea806f6c8 100644
@@ -1134,6 +1134,12 @@ static int sun6i_dsi_probe(struct platform_device *pdev)
 		return PTR_ERR(base);
 	}
 
+	dsi->regulator = devm_regulator_get(dev, "vcc-dsi");
+	if (IS_ERR(dsi->regulator)) {
+		dev_err(dev, "Couldn't get VCC-DSI supply\n");
+		return PTR_ERR(dsi->regulator);
+	}
+
 	dsi->regs = devm_regmap_init_mmio_clk(dev, "bus", base,
 					      &sun6i_dsi_regmap_config);
 	if (IS_ERR(dsi->regs)) {
@@ -1207,6 +1213,13 @@ static int sun6i_dsi_remove(struct platform_device *pdev)
 static int __maybe_unused sun6i_dsi_runtime_resume(struct device *dev)
 {
 	struct sun6i_dsi *dsi = dev_get_drvdata(dev);
+	int err;
+
+	err = regulator_enable(dsi->regulator);
+	if (err) {
+		dev_err(dsi->dev, "failed to enable VCC-DSI supply: %d\n", err);
+		return err;
+	}
 
 	reset_control_deassert(dsi->reset);
 	clk_prepare_enable(dsi->mod_clk);
@@ -1239,6 +1252,7 @@ static int __maybe_unused sun6i_dsi_runtime_suspend(struct device *dev)
 
 	clk_disable_unprepare(dsi->mod_clk);
 	reset_control_assert(dsi->reset);
+	regulator_disable(dsi->regulator);
 
 	return 0;
 }
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h +3 -0
index 747c451a9a20..c570f2b3868f 100644
@@ -13,6 +13,8 @@
 #include <drm/drm_encoder.h>
 #include <drm/drm_mipi_dsi.h>
 
+#include <linux/regulator/consumer.h>
+
 struct sun6i_dsi {
 	struct drm_connector	connector;
 	struct drm_encoder	encoder;
@@ -21,6 +23,7 @@ struct sun6i_dsi {
 	struct clk		*bus_clk;
 	struct clk		*mod_clk;
 	struct regmap		*regs;
+	struct regulator	*regulator;
 	struct reset_control	*reset;
 	struct phy		*dphy;
 
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#25 lore raw

PATCH v8 10/15 drm/sun4i: sun6i_mipi_dsi: Add has_mod_clk quirk

In reply to Jagan Teki

As per the user manual, look like mod clock is not mandatory for all Allwinner MIPI DSI controllers, it is connected to CLK_DSI_SCLK for A31 and not available in A64.

So add has_mod_clk quirk and process the clk accordingly.

---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 38 ++++++++++++++++++--------
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h |  5 ++++
 2 files changed, 32 insertions(+), 11 deletions(-)
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +27 -11
index f42ea806f6c8..2a63e96aaff9 100644
@@ -10,6 +10,7 @@
 #include <linux/component.h>
 #include <linux/crc-ccitt.h>
 #include <linux/of_address.h>
+#include <linux/of_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/regmap.h>
 #include <linux/reset.h>
@@ -1126,6 +1127,7 @@ static int sun6i_dsi_probe(struct platform_device *pdev)
 	dsi->dev = dev;
 	dsi->host.ops = &sun6i_dsi_host_ops;
 	dsi->host.dev = dev;
+	dsi->variant = of_device_get_match_data(dev);
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	base = devm_ioremap_resource(dev, res);
@@ -1153,17 +1155,20 @@ static int sun6i_dsi_probe(struct platform_device *pdev)
 		return PTR_ERR(dsi->reset);
 	}
 
-	dsi->mod_clk = devm_clk_get(dev, "mod");
-	if (IS_ERR(dsi->mod_clk)) {
-		dev_err(dev, "Couldn't get the DSI mod clock\n");
-		return PTR_ERR(dsi->mod_clk);
+	if (dsi->variant->has_mod_clk) {
+		dsi->mod_clk = devm_clk_get(dev, "mod");
+		if (IS_ERR(dsi->mod_clk)) {
+			dev_err(dev, "Couldn't get the DSI mod clock\n");
+			return PTR_ERR(dsi->mod_clk);
+		}
 	}
 
 	/*
 	 * In order to operate properly, that clock seems to be always
 	 * set to 297MHz.
 	 */
-	clk_set_rate_exclusive(dsi->mod_clk, 297000000);
+	if (dsi->variant->has_mod_clk)
+		clk_set_rate_exclusive(dsi->mod_clk, 297000000);
 
 	dsi->dphy = devm_phy_get(dev, "dphy");
 	if (IS_ERR(dsi->dphy)) {
@@ -1193,7 +1198,8 @@ static int sun6i_dsi_probe(struct platform_device *pdev)
 err_pm_disable:
 	pm_runtime_disable(dev);
 err_unprotect_clk:
-	clk_rate_exclusive_put(dsi->mod_clk);
+	if (dsi->variant->has_mod_clk)
+		clk_rate_exclusive_put(dsi->mod_clk);
 	return ret;
 }
 
@@ -1205,7 +1211,8 @@ static int sun6i_dsi_remove(struct platform_device *pdev)
 	component_del(&pdev->dev, &sun6i_dsi_ops);
 	mipi_dsi_host_unregister(&dsi->host);
 	pm_runtime_disable(dev);
-	clk_rate_exclusive_put(dsi->mod_clk);
+	if (dsi->variant->has_mod_clk)
+		clk_rate_exclusive_put(dsi->mod_clk);
 
 	return 0;
 }
@@ -1222,7 +1229,8 @@ static int __maybe_unused sun6i_dsi_runtime_resume(struct device *dev)
 	}
 
 	reset_control_deassert(dsi->reset);
-	clk_prepare_enable(dsi->mod_clk);
+	if (dsi->variant->has_mod_clk)
+		clk_prepare_enable(dsi->mod_clk);
 
 	/*
 	 * Enable the DSI block.
@@ -1250,7 +1258,8 @@ static int __maybe_unused sun6i_dsi_runtime_suspend(struct device *dev)
 {
 	struct sun6i_dsi *dsi = dev_get_drvdata(dev);
 
-	clk_disable_unprepare(dsi->mod_clk);
+	if (dsi->variant->has_mod_clk)
+		clk_disable_unprepare(dsi->mod_clk);
 	reset_control_assert(dsi->reset);
 	regulator_disable(dsi->regulator);
 
@@ -1263,9 +1272,16 @@ static const struct dev_pm_ops sun6i_dsi_pm_ops = {
 			   NULL)
 };
 
+static const struct sun6i_dsi_variant sun6i_a31_mipi_dsi = {
+	.has_mod_clk = true,
+};
+
 static const struct of_device_id sun6i_dsi_of_table[] = {
-	{ .compatible = "allwinner,sun6i-a31-mipi-dsi" },
-	{ }
+	{
+		.compatible = "allwinner,sun6i-a31-mipi-dsi",
+		.data = &sun6i_a31_mipi_dsi,
+	},
+	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, sun6i_dsi_of_table);
 
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h +5 -0
index c570f2b3868f..5c4983212f89 100644
@@ -15,6 +15,10 @@
 
 #include <linux/regulator/consumer.h>
 
+struct sun6i_dsi_variant {
+	bool			has_mod_clk;
+};
+
 struct sun6i_dsi {
 	struct drm_connector	connector;
 	struct drm_encoder	encoder;
@@ -32,6 +36,7 @@ struct sun6i_dsi {
 	struct sun4i_tcon	*tcon;
 	struct mipi_dsi_device	*device;
 	struct drm_panel	*panel;
+	const struct sun6i_dsi_variant	*variant;
 };
 
 static inline struct sun6i_dsi *host_to_sun6i_dsi(struct mipi_dsi_host *host)
Signature · 6 lines
2.18.0.321.gffc6fa0e3

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#26 lore raw

PATCH v8 11/15 drm/sun4i: sun6i_mipi_dsi: Add Allwinner A64 MIPI DSI support

In reply to Jagan Teki

The MIPI DSI controller in Allwinner A64 is similar to A33.

But unlike A33, A64 doesn't have DSI_SCLK gating so add compatible for Allwinner A64 with uninitialized has_mod_clk driver.

---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +7 -0
index 2a63e96aaff9..0960b96b62cc 100644
@@ -1276,11 +1276,18 @@ static const struct sun6i_dsi_variant sun6i_a31_mipi_dsi = {
 	.has_mod_clk = true,
 };
 
+static const struct sun6i_dsi_variant sun50i_a64_mipi_dsi = {
+};
+
 static const struct of_device_id sun6i_dsi_of_table[] = {
 	{
 		.compatible = "allwinner,sun6i-a31-mipi-dsi",
 		.data = &sun6i_a31_mipi_dsi,
 	},
+	{
+		.compatible = "allwinner,sun50i-a64-mipi-dsi",
+		.data = &sun50i_a64_mipi_dsi,
+	},
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, sun6i_dsi_of_table);
Signature · 6 lines
2.18.0.321.gffc6fa0e3

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#27 lore raw

PATCH v8 12/15 arm64: dts: allwinner: a64: Add MIPI DSI pipeline

In reply to Jagan Teki

Add MIPI DSI pipeline for Allwinner A64.

- dsi node, with A64 compatible since it doesn't support DSI_SCLK gating unlike A33
- dphy node, with A64 compatible with A33 fallback since DPHY on A64 and A33 is similar
- finally, attach the dsi_in to tcon0 for complete MIPI DSI

---
 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 45 +++++++++++++++++++
 1 file changed, 45 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi +45 -0
index e628d063931b..5525fc571fc6 100644
@@ -360,6 +360,12 @@
 					#address-cells = <1>;
 					#size-cells = <0>;
 					reg = <1>;
+
+					tcon0_out_dsi: endpoint@1 {
+						reg = <1>;
+						remote-endpoint = <&dsi_in_tcon0>;
+						allwinner,tcon-channel = <1>;
+					};
 				};
 			};
 		};
@@ -946,6 +952,45 @@
 			status = "disabled";
 		};
 
+		dsi: dsi@1ca0000 {
+			compatible = "allwinner,sun50i-a64-mipi-dsi";
+			reg = <0x01ca0000 0x1000>;
+			interrupts = <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_MIPI_DSI>;
+			clock-names = "bus";
+			resets = <&ccu RST_BUS_MIPI_DSI>;
+			phys = <&dphy>;
+			phy-names = "dphy";
+			status = "disabled";
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				port@0 {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					reg = <0>;
+
+					dsi_in_tcon0: endpoint {
+						remote-endpoint = <&tcon0_out_dsi>;
+					};
+				};
+			};
+		};
+
+		dphy: d-phy@1ca1000 {
+			compatible = "allwinner,sun50i-a64-mipi-dphy",
+				     "allwinner,sun6i-a31-mipi-dphy";
+			reg = <0x01ca1000 0x1000>;
+			clocks = <&ccu CLK_BUS_MIPI_DSI>,
+				 <&ccu CLK_DSI_DPHY>;
+			clock-names = "bus", "mod";
+			resets = <&ccu RST_BUS_MIPI_DSI>;
+			status = "disabled";
+			#phy-cells = <0>;
+		};
+
 		hdmi: hdmi@1ee0000 {
 			compatible = "allwinner,sun50i-a64-dw-hdmi",
 				     "allwinner,sun8i-a83t-dw-hdmi";
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#28 lore raw

PATCH v8 13/15 arm64: dts: allwinner: a64-amarula-relic: Add Techstar TS8550B MIPI-DSI panel

In reply to Jagan Teki

Amarula A64-Relic board by default bound with Techstar TS8550B MIPI-DSI panel, add support for it.

DSI panel connected via board DSI port with,
- DLDO2 as VCC supply
- DLDO2 as IOVCC supply
- DLDO1 as VCC-DSI supply
- PD24 gpio for reset pin
- PD23 gpio for backlight enable pin

---
 .../allwinner/sun50i-a64-amarula-relic.dts    | 39 +++++++++++++++++++
 1 file changed, 39 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-a64-amarula-relic.dts +39 -0
index 6cb2b7f0c817..f85ed0b99942 100644
@@ -9,6 +9,7 @@
 #include "sun50i-a64.dtsi"
 
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/pwm/pwm.h>
 
 / {
 	model = "Amarula A64-Relic";
@@ -18,6 +19,14 @@
 		serial0 = &uart0;
 	};
 
+	backlight: backlight {
+		compatible = "pwm-backlight";
+		pwms = <&pwm 0 50000 PWM_POLARITY_INVERTED>;
+		brightness-levels = <1 2 4 8 16 32 64 128 512>;
+		default-brightness-level = <2>;
+		enable-gpios = <&pio 3 23 GPIO_ACTIVE_HIGH>; /* LCD-BL-EN: PD23 */
+	};
+
 	chosen {
 		stdout-path = "serial0:115200n8";
 	};
@@ -30,6 +39,30 @@
 	};
 };
 
+&de {
+	status = "okay";
+};
+
+&dphy {
+	status = "okay";
+};
+
+&dsi {
+	vcc-dsi-supply = <&reg_dldo1>;		/* VCC3V3-DSI */
+	#address-cells = <1>;
+	#size-cells = <0>;
+	status = "okay";
+
+	panel@0 {
+		compatible = "techstar,ts8550b", "sitronix,st7701";
+		reg = <0>;
+		VCC-supply = <&reg_dldo2>;	/* VCC-LCD */
+		IOVCC-supply = <&reg_dldo2>;	/* VCC-LCD */
+		reset-gpios = <&pio 3 24 GPIO_ACTIVE_HIGH>; /* LCD-RST: PD24 */
+		backlight = <&backlight>;
+	};
+};
+
 &ehci0 {
 	status = "okay";
 };
@@ -72,6 +105,12 @@
 	status = "okay";
 };
 
+&pwm {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pwm_pin>;
+	status = "okay";
+};
+
 &r_rsb {
 	status = "okay";
 
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#29 lore raw

PATCH v8 14/15 arm64: dts: allwinner: a64-pine64-lts: Enable Feiyang FY07024DI26A30-D DSI panel

In reply to Jagan Teki

Feiyang FY07024DI26A30-D MIPI_DSI panel is desiged to attach with DSI connector on pine64 boards, enable the same for pine64 LTS.

DSI panel connected via board DSI port with,
- DC1SW as AVDD supply
- DLDO2 as DVDD supply
- DLDO1 as VCC-DSI supply
- PD24 gpio for reset pin
- PH10 gpio for backlight enable pin

---
 .../dts/allwinner/sun50i-a64-pine64-lts.dts   | 39 +++++++++++++++++++
 1 file changed, 39 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-lts.dts +39 -0
index 72d6961dc312..341b1c035604 100644
@@ -5,9 +5,48 @@
  */
 
 #include "sun50i-a64-sopine-baseboard.dts"
+#include <dt-bindings/pwm/pwm.h>
 
 / {
 	model = "Pine64 LTS";
 	compatible = "pine64,pine64-lts", "allwinner,sun50i-r18",
 		     "allwinner,sun50i-a64";
+
+	backlight: backlight {
+		compatible = "pwm-backlight";
+		pwms = <&r_pwm 0 50000 PWM_POLARITY_INVERTED>;
+		brightness-levels = <1 2 4 8 16 32 64 128 512>;
+		default-brightness-level = <8>;
+		enable-gpios = <&pio 7 10 GPIO_ACTIVE_HIGH>; /* LCD-BL-EN: PH10 */
+	};
+};
+
+&de {
+	status = "okay";
+};
+
+&dphy {
+	status = "okay";
+};
+
+&dsi {
+	vcc-dsi-supply = <&reg_dldo1>;		/* VCC3V3-DSI */
+	#address-cells = <1>;
+	#size-cells = <0>;
+	status = "okay";
+
+	panel@0 {
+		compatible = "feiyang,fy07024di26a30d";
+		reg = <0>;
+		avdd-supply = <&reg_dc1sw>;	/* VCC-LCD */
+		dvdd-supply = <&reg_dldo2>;	/* VCC-MIPI */
+		reset-gpios = <&pio 3 24 GPIO_ACTIVE_HIGH>; /* LCD-RST: PD24 */
+		backlight = <&backlight>;
+	};
+};
+
+&r_pwm {
+	pinctrl-names = "default";
+	pinctrl-0 = <&r_pwm_pin>;
+	status = "okay";
 };
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#30 lore raw

PATCH v8 15/15 arm64: dts: allwinner: bananapi-m64: Enable Bananapi S070WV20-CT16 DSI panel

In reply to Jagan Teki

This patch add support for Bananapi S070WV20-CT16 DSI panel to BPI-M64 board.

DSI panel connected via board DSI port with,
- DLDO1 as VDD supply
- DLDO1 as VCC-DSI supply
- PD6 gpio for reset pin
- PD5 gpio for backlight enable pin
- PD7 gpio for backlight vdd supply

---
 .../dts/allwinner/sun50i-a64-bananapi-m64.dts | 44 +++++++++++++++++++
 1 file changed, 44 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts +44 -0
index 7793ebb5d2b8..9d740afadd30 100644
@@ -45,6 +45,7 @@
 #include "sun50i-a64.dtsi"
 
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/pwm/pwm.h>
 
 / {
 	model = "BananaPi-M64";
@@ -56,6 +57,15 @@
 		serial1 = &uart1;
 	};
 
+	backlight: backlight {
+		compatible = "pwm-backlight";
+		pwms = <&r_pwm 0 50000 PWM_POLARITY_INVERTED>;
+		brightness-levels = <1 2 4 8 16 32 64 128 512>;
+		default-brightness-level = <2>;
+		enable-gpios = <&pio 3 5 GPIO_ACTIVE_HIGH>; /* LCD-BL-EN: PD5 */
+		power-supply = <&reg_vdd_backlight>;
+	};
+
 	chosen {
 		stdout-path = "serial0:115200n8";
 	};
@@ -91,6 +101,15 @@
 		};
 	};
 
+	reg_vdd_backlight: vdd-backlight {
+		compatible = "regulator-fixed";
+		regulator-name = "vdd-backlight";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		gpio = <&pio 3 7 GPIO_ACTIVE_HIGH>; /* LCD-PWR-EN: PD7 */
+		enable-active-high;
+	};
+
 	wifi_pwrseq: wifi_pwrseq {
 		compatible = "mmc-pwrseq-simple";
 		reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
@@ -116,6 +135,25 @@
 	status = "okay";
 };
 
+&dphy {
+	status = "okay";
+};
+
+&dsi {
+	vcc-dsi-supply = <&reg_dldo1>;		/* VCC3V3-DSI */
+	status = "okay";
+	#address-cells = <1>;
+	#size-cells = <0>;
+
+	panel@0 {
+		compatible = "bananapi,s070wv20-ct16-icn6211";
+		reg = <0>;
+		reset-gpios = <&pio 3 6 GPIO_ACTIVE_HIGH>; /* LCD-RST: PD6 */
+		vdd-supply = <&reg_dldo1>;
+		backlight = <&backlight>;
+	};
+};
+
 &ehci0 {
 	status = "okay";
 };
@@ -208,6 +246,12 @@
 	status = "okay";
 };
 
+&r_pwm {
+	pinctrl-names = "default";
+	pinctrl-0 = <&r_pwm_pin>;
+	status = "okay";
+};
+
 &r_rsb {
 	status = "okay";
 
Signature · 1 line
2.18.0.321.gffc6fa0e3