Skip to contentSkip to conversation

drm/exynos: Support DP CLKCON register in FIMD driver

PATCH Superseded Ajay Kumar 5 participants 5 messages Jun 26, 2014 – Jun 27, 2014

Subsystems (5)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Ajay Kumar

author
#0 lore raw

PATCH v2 1/1 drm/exynos: Support DP CLKCON register in FIMD driver

Add the missing setting for DP CLKCON register.

This register is present on Exynos5 based FIMD controllers, and needs to be used if we are using DP.

---
Changes since V1:
- Remove usage of driver_data to configure DP CLKCON register

 drivers/gpu/drm/exynos/exynos_dp_core.c  | 2 ++
 drivers/gpu/drm/exynos/exynos_drm_drv.h  | 8 ++++++++
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 5 +++++
 include/video/samsung_fimd.h             | 4 ++++
 4 files changed, 19 insertions(+)
drivers/gpu/drm/exynos/exynos_dp_core.c +2 -0
index 2e77a15..d8868f3 100644
@@ -1336,6 +1336,8 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data)
 
 	platform_set_drvdata(pdev, &exynos_dp_display);
 
+	exynos_fimd_output_type = EXYNOS_FIMD_OUTPUT_DP;
+
 	return exynos_drm_create_enc_conn(drm_dev, &exynos_dp_display);
 }
 
drivers/gpu/drm/exynos/exynos_drm_drv.h +8 -0
index 36535f3..1089744 100644
@@ -60,6 +60,12 @@ enum exynos_drm_output_type {
 	EXYNOS_DISPLAY_TYPE_VIDI,
 };
 
+enum exynos_fimd_output_type {
+	EXYNOS_FIMD_OUTPUT_MIPI,
+	EXYNOS_FIMD_OUTPUT_DPI,
+	EXYNOS_FIMD_OUTPUT_DP,
+};
+
 /*
  * Exynos drm common overlay structure.
  *
@@ -380,4 +386,6 @@ extern struct platform_driver fimc_driver;
 extern struct platform_driver rotator_driver;
 extern struct platform_driver gsc_driver;
 extern struct platform_driver ipp_driver;
+
+extern enum exynos_fimd_output_type exynos_fimd_output_type;
 #endif
drivers/gpu/drm/exynos/exynos_drm_fimd.c +5 -0
index bb45ab2..a46a9c4 100644
@@ -90,6 +90,8 @@ static struct fimd_driver_data exynos5_fimd_driver_data = {
 	.has_shadowcon = 1,
 };
 
+enum exynos_fimd_output_type exynos_fimd_output_type;
+
 struct fimd_win_data {
 	unsigned int		offset_x;
 	unsigned int		offset_y;
@@ -331,6 +333,9 @@ static void fimd_commit(struct exynos_drm_manager *mgr)
 	if (clkdiv > 1)
 		val |= VIDCON0_CLKVAL_F(clkdiv - 1) | VIDCON0_CLKDIR;
 
+	if (exynos_fimd_output_type == EXYNOS_FIMD_OUTPUT_DP)
+		writel(DP_CLK_ENABLE, ctx->regs + DP_CLKCON);
+
 	writel(val, ctx->regs + VIDCON0);
 }
 
include/video/samsung_fimd.h +4 -0
index b039320..d8f4b0b 100644
@@ -435,6 +435,10 @@
 #define BLENDCON_NEW_8BIT_ALPHA_VALUE		(1 << 0)
 #define BLENDCON_NEW_4BIT_ALPHA_VALUE		(0 << 0)
 
+/* Video clock enable for DP */
+#define DP_CLKCON				0x27C
+#define DP_CLK_ENABLE				0x2
+
 /* Notes on per-window bpp settings
  *
  * Value	Win0	 Win1	  Win2	   Win3	    Win 4
Signature · 1 line
1.8.3.2
Reviewed-by on v2 1/1
#1 lore raw
Quoted 7 lines · Ajay Kumar

Add the missing setting for DP CLKCON register.

This register is present on Exynos5 based FIMD controllers, and needs to be used if we are using DP.

It looks better than V1 patch.

Best regards,
Jingoo Han

Quoted 86 lines

---
Changes since V1:
- Remove usage of driver_data to configure DP CLKCON register

 drivers/gpu/drm/exynos/exynos_dp_core.c  | 2 ++
 drivers/gpu/drm/exynos/exynos_drm_drv.h  | 8 ++++++++
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 5 +++++
 include/video/samsung_fimd.h             | 4 ++++
 4 files changed, 19 insertions(+)
drivers/gpu/drm/exynos/exynos_dp_core.c +2 -0
index 2e77a15..d8868f3 100644
@@ -1336,6 +1336,8 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data)
 
 	platform_set_drvdata(pdev, &exynos_dp_display);
 
+	exynos_fimd_output_type = EXYNOS_FIMD_OUTPUT_DP;
+
 	return exynos_drm_create_enc_conn(drm_dev, &exynos_dp_display);
 }
 
drivers/gpu/drm/exynos/exynos_drm_drv.h +8 -0
index 36535f3..1089744 100644
@@ -60,6 +60,12 @@ enum exynos_drm_output_type {
 	EXYNOS_DISPLAY_TYPE_VIDI,
 };
 
+enum exynos_fimd_output_type {
+	EXYNOS_FIMD_OUTPUT_MIPI,
+	EXYNOS_FIMD_OUTPUT_DPI,
+	EXYNOS_FIMD_OUTPUT_DP,
+};
+
 /*
  * Exynos drm common overlay structure.
  *
@@ -380,4 +386,6 @@ extern struct platform_driver fimc_driver;
 extern struct platform_driver rotator_driver;
 extern struct platform_driver gsc_driver;
 extern struct platform_driver ipp_driver;
+
+extern enum exynos_fimd_output_type exynos_fimd_output_type;
 #endif
drivers/gpu/drm/exynos/exynos_drm_fimd.c +5 -0
index bb45ab2..a46a9c4 100644
@@ -90,6 +90,8 @@ static struct fimd_driver_data exynos5_fimd_driver_data = {
 	.has_shadowcon = 1,
 };
 
+enum exynos_fimd_output_type exynos_fimd_output_type;
+
 struct fimd_win_data {
 	unsigned int		offset_x;
 	unsigned int		offset_y;
@@ -331,6 +333,9 @@ static void fimd_commit(struct exynos_drm_manager *mgr)
 	if (clkdiv > 1)
 		val |= VIDCON0_CLKVAL_F(clkdiv - 1) | VIDCON0_CLKDIR;
 
+	if (exynos_fimd_output_type == EXYNOS_FIMD_OUTPUT_DP)
+		writel(DP_CLK_ENABLE, ctx->regs + DP_CLKCON);
+
 	writel(val, ctx->regs + VIDCON0);
 }
 
include/video/samsung_fimd.h +4 -1
index b039320..d8f4b0b 100644
@@ -435,6 +435,10 @@
 #define BLENDCON_NEW_8BIT_ALPHA_VALUE		(1 << 0)
 #define BLENDCON_NEW_4BIT_ALPHA_VALUE		(0 << 0)
 
+/* Video clock enable for DP */
+#define DP_CLKCON				0x27C
+#define DP_CLK_ENABLE				0x2
+
 /* Notes on per-window bpp settings
  *
  * Value	Win0	 Win1	  Win2	   Win3	    Win 4
--

1.8.3.2

maintainer
#2 lore raw
In reply to Ajay Kumar
Quoted 66 lines · Ajay Kumar

Add the missing setting for DP CLKCON register.

This register is present on Exynos5 based FIMD controllers, and needs to be used if we are using DP.

---
Changes since V1:
- Remove usage of driver_data to configure DP CLKCON register

 drivers/gpu/drm/exynos/exynos_dp_core.c  | 2 ++
 drivers/gpu/drm/exynos/exynos_drm_drv.h  | 8 ++++++++
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 5 +++++
 include/video/samsung_fimd.h             | 4 ++++
 4 files changed, 19 insertions(+)
drivers/gpu/drm/exynos/exynos_dp_core.c +2 -0
index 2e77a15..d8868f3 100644
@@ -1336,6 +1336,8 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data)
 
 	platform_set_drvdata(pdev, &exynos_dp_display);
 
+	exynos_fimd_output_type = EXYNOS_FIMD_OUTPUT_DP;
+
 	return exynos_drm_create_enc_conn(drm_dev, &exynos_dp_display);
 }
 
drivers/gpu/drm/exynos/exynos_drm_drv.h +8 -0
index 36535f3..1089744 100644
@@ -60,6 +60,12 @@ enum exynos_drm_output_type {
 	EXYNOS_DISPLAY_TYPE_VIDI,
 };
 
+enum exynos_fimd_output_type {
+	EXYNOS_FIMD_OUTPUT_MIPI,
+	EXYNOS_FIMD_OUTPUT_DPI,
+	EXYNOS_FIMD_OUTPUT_DP,
+};
+
 /*
  * Exynos drm common overlay structure.
  *
@@ -380,4 +386,6 @@ extern struct platform_driver fimc_driver;
 extern struct platform_driver rotator_driver;
 extern struct platform_driver gsc_driver;
 extern struct platform_driver ipp_driver;
+
+extern enum exynos_fimd_output_type exynos_fimd_output_type;
 #endif
drivers/gpu/drm/exynos/exynos_drm_fimd.c +2 -0
index bb45ab2..a46a9c4 100644
@@ -90,6 +90,8 @@ static struct fimd_driver_data exynos5_fimd_driver_data = {
 	.has_shadowcon = 1,
 };
 
+enum exynos_fimd_output_type exynos_fimd_output_type;
+
 struct fimd_win_data {
 	unsigned int		offset_x;
 	unsigned int		offset_y;

drivers/gpu/drm/exynos/exynos_drm_fimd.c static void fimd_commit(struct exynos_drm_manager *mgr) · line 337

Quoted 5 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +2 -0
@@ -331,6 +333,9 @@ static void fimd_commit(struct exynos_drm_manager *mgr)
 	if (clkdiv > 1)
 		val |= VIDCON0_CLKVAL_F(clkdiv - 1) | VIDCON0_CLKDIR;
 
+	if (exynos_fimd_output_type == EXYNOS_FIMD_OUTPUT_DP)
+		writel(DP_CLK_ENABLE, ctx->regs + DP_CLKCON);

You are passing output type directly from dp driver to fimd driver using extern variable. This is really not good. Is that really only way for it?

One is,
it's to add a dt property in fimd node and use it; ex. samsung,output_type. Whether fimd output should be DPI, DSI, or eDP would be dependent on Machine.

Other is,
crtc driver is to get output type though encoder callback. At this moment, crtc driver already knows encoder/connector driver. So I think you can use a callback of encoder to get output type like below,

exynos_display_ops {
        ...
        ...get_output(struct drm_crtc *crtc);
};

at exynos_drm_encoder.c,
... exynos_drm_get_output_type(struct drm_crtc *crtc)

{
        ...
        return display_ops->get_output(...);
}

at fimd_commit function,

        ...
        ctx->output_type = exynos_drm_get_output_type(mgr->crtc);

I think first way is more simple and reasonable.

One more thing, does FIMD ip of Exynos4 series have DP_CLKCON register? No, they have no any DP_CLKCON register so you would need to consider other SoC without DP_CLKCON. For this, a proper volunteer would be fimd_driver_data.

Thanks,
Inki Dae

Quoted 20 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +1 -0
+
 	writel(val, ctx->regs + VIDCON0);
 }
 
include/video/samsung_fimd.h +4 -0
index b039320..d8f4b0b 100644
@@ -435,6 +435,10 @@
 #define BLENDCON_NEW_8BIT_ALPHA_VALUE		(1 << 0)
 #define BLENDCON_NEW_4BIT_ALPHA_VALUE		(0 << 0)
 
+/* Video clock enable for DP */
+#define DP_CLKCON				0x27C
+#define DP_CLK_ENABLE				0x2
+
 /* Notes on per-window bpp settings
  *
  * Value	Win0	 Win1	  Win2	   Win3	    Win 4
#3 lore raw

Hi Inki,

Thanks for the review.

Quoted 104 lines · Inki Dae
Quoted 66 lines · Ajay Kumar

Add the missing setting for DP CLKCON register.

This register is present on Exynos5 based FIMD controllers, and needs to be used if we are using DP.

---
Changes since V1:
- Remove usage of driver_data to configure DP CLKCON register

 drivers/gpu/drm/exynos/exynos_dp_core.c  | 2 ++
 drivers/gpu/drm/exynos/exynos_drm_drv.h  | 8 ++++++++
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 5 +++++
 include/video/samsung_fimd.h             | 4 ++++
 4 files changed, 19 insertions(+)
drivers/gpu/drm/exynos/exynos_dp_core.c +2 -0
index 2e77a15..d8868f3 100644
@@ -1336,6 +1336,8 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data)
 
      platform_set_drvdata(pdev, &exynos_dp_display);
 
+     exynos_fimd_output_type = EXYNOS_FIMD_OUTPUT_DP;
+
      return exynos_drm_create_enc_conn(drm_dev, &exynos_dp_display);
 }
 
drivers/gpu/drm/exynos/exynos_drm_drv.h +8 -0
index 36535f3..1089744 100644
@@ -60,6 +60,12 @@ enum exynos_drm_output_type {
      EXYNOS_DISPLAY_TYPE_VIDI,
 };
 
+enum exynos_fimd_output_type {
+     EXYNOS_FIMD_OUTPUT_MIPI,
+     EXYNOS_FIMD_OUTPUT_DPI,
+     EXYNOS_FIMD_OUTPUT_DP,
+};
+
 /*
  * Exynos drm common overlay structure.
  *
@@ -380,4 +386,6 @@ extern struct platform_driver fimc_driver;
 extern struct platform_driver rotator_driver;
 extern struct platform_driver gsc_driver;
 extern struct platform_driver ipp_driver;
+
+extern enum exynos_fimd_output_type exynos_fimd_output_type;
 #endif
drivers/gpu/drm/exynos/exynos_drm_fimd.c +2 -0
index bb45ab2..a46a9c4 100644
@@ -90,6 +90,8 @@ static struct fimd_driver_data exynos5_fimd_driver_data = {
      .has_shadowcon = 1,
 };
 
+enum exynos_fimd_output_type exynos_fimd_output_type;
+
 struct fimd_win_data {
      unsigned int            offset_x;
      unsigned int            offset_y;

drivers/gpu/drm/exynos/exynos_drm_fimd.c static void fimd_commit(struct exynos_drm_manager *mgr) · line 337

Quoted 5 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +2 -0
@@ -331,6 +333,9 @@ static void fimd_commit(struct exynos_drm_manager *mgr)
      if (clkdiv > 1)
              val |= VIDCON0_CLKVAL_F(clkdiv - 1) | VIDCON0_CLKDIR;
 
+     if (exynos_fimd_output_type == EXYNOS_FIMD_OUTPUT_DP)
+             writel(DP_CLK_ENABLE, ctx->regs + DP_CLKCON);

You are passing output type directly from dp driver to fimd driver using extern variable. This is really not good. Is that really only way for it?

One is,
it's to add a dt property in fimd node and use it; ex. samsung,output_type. Whether fimd output should be DPI, DSI, or eDP would be dependent on Machine.

Other is,
crtc driver is to get output type though encoder callback. At this moment, crtc driver already knows encoder/connector driver. So I think you can use a callback of encoder to get output type like below,

exynos_display_ops {
        ...
        ...get_output(struct drm_crtc *crtc);
};

at exynos_drm_encoder.c,
... exynos_drm_get_output_type(struct drm_crtc *crtc)

{
        ...
        return display_ops->get_output(...);
}

at fimd_commit function,

        ...
        ctx->output_type = exynos_drm_get_output_type(mgr->crtc);
Quoted 6 lines

I think first way is more simple and reasonable.

One more thing, does FIMD ip of Exynos4 series have DP_CLKCON register? No, they have no any DP_CLKCON register so you would need to consider other SoC without DP_CLKCON. For this, a proper volunteer would be fimd_driver_data.

Right, I should also consider putting DP CLKCON register inside driver_data. And, I will use the DT property you mentioned.
Will send a patchset ASAP.

Regards,
Ajay Kumar

Quoted 25 lines

Thanks,
Inki Dae

Quoted 20 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +1 -0
+
      writel(val, ctx->regs + VIDCON0);
 }
 
include/video/samsung_fimd.h +4 -0
index b039320..d8f4b0b 100644
@@ -435,6 +435,10 @@
 #define BLENDCON_NEW_8BIT_ALPHA_VALUE                (1 << 0)
 #define BLENDCON_NEW_4BIT_ALPHA_VALUE                (0 << 0)
 
+/* Video clock enable for DP */
+#define DP_CLKCON                            0x27C
+#define DP_CLK_ENABLE                                0x2
+
 /* Notes on per-window bpp settings
  *
  * Value     Win0     Win1     Win2     Win3     Win 4
#4 lore raw
In reply to Ajay Kumar

Am 26.06.2014 16:36, schrieb Ajay Kumar:

Quoted 57 lines

Add the missing setting for DP CLKCON register.

This register is present on Exynos5 based FIMD controllers, and needs to be used if we are using DP.

---
Changes since V1:
- Remove usage of driver_data to configure DP CLKCON register

 drivers/gpu/drm/exynos/exynos_dp_core.c  | 2 ++
 drivers/gpu/drm/exynos/exynos_drm_drv.h  | 8 ++++++++
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 5 +++++
 include/video/samsung_fimd.h             | 4 ++++
 4 files changed, 19 insertions(+)
drivers/gpu/drm/exynos/exynos_dp_core.c +2 -0
index 2e77a15..d8868f3 100644
@@ -1336,6 +1336,8 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data)
 
 	platform_set_drvdata(pdev, &exynos_dp_display);
 
+	exynos_fimd_output_type = EXYNOS_FIMD_OUTPUT_DP;
+
 	return exynos_drm_create_enc_conn(drm_dev, &exynos_dp_display);
 }
 
drivers/gpu/drm/exynos/exynos_drm_drv.h +8 -0
index 36535f3..1089744 100644
@@ -60,6 +60,12 @@ enum exynos_drm_output_type {
 	EXYNOS_DISPLAY_TYPE_VIDI,
 };
 
+enum exynos_fimd_output_type {
+	EXYNOS_FIMD_OUTPUT_MIPI,
+	EXYNOS_FIMD_OUTPUT_DPI,
+	EXYNOS_FIMD_OUTPUT_DP,
+};
+
 /*
  * Exynos drm common overlay structure.
  *
@@ -380,4 +386,6 @@ extern struct platform_driver fimc_driver;
 extern struct platform_driver rotator_driver;
 extern struct platform_driver gsc_driver;
 extern struct platform_driver ipp_driver;
+
+extern enum exynos_fimd_output_type exynos_fimd_output_type;
 #endif
drivers/gpu/drm/exynos/exynos_drm_fimd.c +0 -0
index bb45ab2..a46a9c4 100644

drivers/gpu/drm/exynos/exynos_drm_fimd.c static struct fimd_driver_data exynos5_fimd_driver_data = { · line 93

Quoted 4 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +1 -0
@@ -90,6 +90,8 @@ static struct fimd_driver_data exynos5_fimd_driver_data = {
 	.has_shadowcon = 1,
 };
 
+enum exynos_fimd_output_type exynos_fimd_output_type;

This is a non-static variable - doesn't that mean it's only ever initialized to DP above and uninitialized in C99 otherwise? Unless I'm missing something, the if below may trigger at random.

Regards,
Andreas

Quoted 29 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +4 -0
+
 struct fimd_win_data {
 	unsigned int		offset_x;
 	unsigned int		offset_y;
@@ -331,6 +333,9 @@ static void fimd_commit(struct exynos_drm_manager *mgr)
 	if (clkdiv > 1)
 		val |= VIDCON0_CLKVAL_F(clkdiv - 1) | VIDCON0_CLKDIR;
 
+	if (exynos_fimd_output_type == EXYNOS_FIMD_OUTPUT_DP)
+		writel(DP_CLK_ENABLE, ctx->regs + DP_CLKCON);
+
 	writel(val, ctx->regs + VIDCON0);
 }
 
include/video/samsung_fimd.h +4 -0
index b039320..d8f4b0b 100644
@@ -435,6 +435,10 @@
 #define BLENDCON_NEW_8BIT_ALPHA_VALUE		(1 << 0)
 #define BLENDCON_NEW_4BIT_ALPHA_VALUE		(0 << 0)
 
+/* Video clock enable for DP */
+#define DP_CLKCON				0x27C
+#define DP_CLK_ENABLE				0x2
+
 /* Notes on per-window bpp settings
  *
  * Value	Win0	 Win1	  Win2	   Win3	    Win 4
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg