mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] drm/bridge/synopsys: dsi: Add 1.31 version support
@ 2018-02-06  8:42 ` Philippe Cornu
  2018-02-06 13:06   ` Andrzej Hajda
  2018-02-08  7:39   ` Andrzej Hajda
  0 siblings, 2 replies; 4+ messages in thread
From: Philippe Cornu @ 2018-02-06  8:42 UTC (permalink / raw)
  To: Archit Taneja, Andrzej Hajda, Laurent Pinchart, David Airlie,
	Philippe Cornu, Brian Norris, Benjamin Gaignard, Bhumika Goyal,
	dri-devel, linux-kernel, Sandy Huang, Heiko Stubner,
	linux-arm-kernel, linux-rockchip
  Cc: Yannick Fertre, Vincent Abriou, Alexandre Torgue

Add support for the Synopsys DesignWare MIPI DSI version 1.31
Two registers need to be updated/added for supporting 1.31:
* PHY_TMR_CFG 0x9c (updated)
  1.30 [31:24] phy_hs2lp_time
       [23:16] phy_lp2hs_time
       [14: 0] max_rd_time

  1.31 [25:16] phy_hs2lp_time
       [ 9: 0] phy_lp2hs_time

* PHY_TMR_RD_CFG 0xf4 (new)
  1.31 [14: 0] max_rd_time

Signed-off-by: Philippe Cornu <philippe.cornu@st.com>
---
Modified in v2: Simplify the code thanks to comments from Andrzej Hajda &
Archit Taneja.

 drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
index d2e5c026cd8c..4496687e6e67 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
@@ -25,7 +25,10 @@
 #include <drm/bridge/dw_mipi_dsi.h>
 #include <video/mipi_display.h>
 
+#define HWVER_131			0x31333100	/* IP version 1.31 */
+
 #define DSI_VERSION			0x00
+#define VERSION				GENMASK(31, 8)
 
 #define DSI_PWR_UP			0x04
 #define RESET				0
@@ -161,11 +164,12 @@
 #define PHY_CLKHS2LP_TIME(lbcc)		(((lbcc) & 0x3ff) << 16)
 #define PHY_CLKLP2HS_TIME(lbcc)		((lbcc) & 0x3ff)
 
-/* TODO Next register is slightly different between 1.30 & 1.31 IP version */
 #define DSI_PHY_TMR_CFG			0x9c
 #define PHY_HS2LP_TIME(lbcc)		(((lbcc) & 0xff) << 24)
 #define PHY_LP2HS_TIME(lbcc)		(((lbcc) & 0xff) << 16)
 #define MAX_RD_TIME(lbcc)		((lbcc) & 0x7fff)
+#define PHY_HS2LP_TIME_V131(lbcc)	(((lbcc) & 0x3ff) << 16)
+#define PHY_LP2HS_TIME_V131(lbcc)	((lbcc) & 0x3ff)
 
 #define DSI_PHY_RSTZ			0xa0
 #define PHY_DISFORCEPLL			0
@@ -204,7 +208,9 @@
 #define DSI_INT_ST1			0xc0
 #define DSI_INT_MSK0			0xc4
 #define DSI_INT_MSK1			0xc8
+
 #define DSI_PHY_TMR_RD_CFG		0xf4
+#define MAX_RD_TIME_V131(lbcc)		((lbcc) & 0x7fff)
 
 #define PHY_STATUS_TIMEOUT_US		10000
 #define CMD_PKT_STATUS_TIMEOUT_US	20000
@@ -623,6 +629,8 @@ static void dw_mipi_dsi_vertical_timing_config(struct dw_mipi_dsi *dsi,
 
 static void dw_mipi_dsi_dphy_timing_config(struct dw_mipi_dsi *dsi)
 {
+	u32 hw_version;
+
 	/*
 	 * TODO dw drv improvements
 	 * data & clock lane timers should be computed according to panel
@@ -630,8 +638,17 @@ static void dw_mipi_dsi_dphy_timing_config(struct dw_mipi_dsi *dsi)
 	 * note: DSI_PHY_TMR_CFG.MAX_RD_TIME should be in line with
 	 * DSI_CMD_MODE_CFG.MAX_RD_PKT_SIZE_LP (see CMD_MODE_ALL_LP)
 	 */
-	dsi_write(dsi, DSI_PHY_TMR_CFG, PHY_HS2LP_TIME(0x40)
-		  | PHY_LP2HS_TIME(0x40) | MAX_RD_TIME(10000));
+
+	hw_version = dsi_read(dsi, DSI_VERSION) & VERSION;
+
+	if (hw_version >= HWVER_131) {
+		dsi_write(dsi, DSI_PHY_TMR_CFG, PHY_HS2LP_TIME_V131(0x40) |
+			  PHY_LP2HS_TIME_V131(0x40));
+		dsi_write(dsi, DSI_PHY_TMR_RD_CFG, MAX_RD_TIME_V131(10000));
+	} else {
+		dsi_write(dsi, DSI_PHY_TMR_CFG, PHY_HS2LP_TIME(0x40) |
+			  PHY_LP2HS_TIME(0x40) | MAX_RD_TIME(10000));
+	}
 
 	dsi_write(dsi, DSI_PHY_TMR_LPCLK_CFG, PHY_CLKHS2LP_TIME(0x40)
 		  | PHY_CLKLP2HS_TIME(0x40));
-- 
2.15.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] drm/bridge/synopsys: dsi: Add 1.31 version support
  2018-02-06  8:42 ` [PATCH v2] drm/bridge/synopsys: dsi: Add 1.31 version support Philippe Cornu
@ 2018-02-06 13:06   ` Andrzej Hajda
  2018-02-08  7:39   ` Andrzej Hajda
  1 sibling, 0 replies; 4+ messages in thread
From: Andrzej Hajda @ 2018-02-06 13:06 UTC (permalink / raw)
  To: Philippe Cornu, Archit Taneja, Laurent Pinchart, David Airlie,
	Brian Norris, Benjamin Gaignard, Bhumika Goyal, dri-devel,
	linux-kernel, Sandy Huang, Heiko Stubner, linux-arm-kernel,
	linux-rockchip
  Cc: Yannick Fertre, Vincent Abriou, Alexandre Torgue

On 06.02.2018 09:42, Philippe Cornu wrote:
> Add support for the Synopsys DesignWare MIPI DSI version 1.31
> Two registers need to be updated/added for supporting 1.31:
> * PHY_TMR_CFG 0x9c (updated)
>   1.30 [31:24] phy_hs2lp_time
>        [23:16] phy_lp2hs_time
>        [14: 0] max_rd_time
>
>   1.31 [25:16] phy_hs2lp_time
>        [ 9: 0] phy_lp2hs_time
>
> * PHY_TMR_RD_CFG 0xf4 (new)
>   1.31 [14: 0] max_rd_time
>
> Signed-off-by: Philippe Cornu <philippe.cornu@st.com>

Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>

If there will be no objections I will merge it this week.

 --
Regards
Andrzej

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] drm/bridge/synopsys: dsi: Add 1.31 version support
  2018-02-06  8:42 ` [PATCH v2] drm/bridge/synopsys: dsi: Add 1.31 version support Philippe Cornu
  2018-02-06 13:06   ` Andrzej Hajda
@ 2018-02-08  7:39   ` Andrzej Hajda
  2018-02-08  8:35     ` Philippe CORNU
  1 sibling, 1 reply; 4+ messages in thread
From: Andrzej Hajda @ 2018-02-08  7:39 UTC (permalink / raw)
  To: Philippe Cornu, Archit Taneja, Laurent Pinchart, David Airlie,
	Brian Norris, Benjamin Gaignard, Bhumika Goyal, dri-devel,
	linux-kernel, Sandy Huang, Heiko Stubner, linux-arm-kernel,
	linux-rockchip
  Cc: Yannick Fertre, Vincent Abriou, Alexandre Torgue

On 06.02.2018 09:42, Philippe Cornu wrote:
> Add support for the Synopsys DesignWare MIPI DSI version 1.31
> Two registers need to be updated/added for supporting 1.31:
> * PHY_TMR_CFG 0x9c (updated)
>   1.30 [31:24] phy_hs2lp_time
>        [23:16] phy_lp2hs_time
>        [14: 0] max_rd_time
>
>   1.31 [25:16] phy_hs2lp_time
>        [ 9: 0] phy_lp2hs_time
>
> * PHY_TMR_RD_CFG 0xf4 (new)
>   1.31 [14: 0] max_rd_time
>
> Signed-off-by: Philippe Cornu <philippe.cornu@st.com>
Queued to drm-misc-next.
--
Regards
Andrzej

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] drm/bridge/synopsys: dsi: Add 1.31 version support
  2018-02-08  7:39   ` Andrzej Hajda
@ 2018-02-08  8:35     ` Philippe CORNU
  0 siblings, 0 replies; 4+ messages in thread
From: Philippe CORNU @ 2018-02-08  8:35 UTC (permalink / raw)
  To: Andrzej Hajda, Archit Taneja, Laurent Pinchart, David Airlie,
	Brian Norris, Benjamin Gaignard, Bhumika Goyal, dri-devel,
	linux-kernel, Sandy Huang, Heiko Stubner, linux-arm-kernel,
	linux-rockchip
  Cc: Yannick FERTRE, Vincent ABRIOU, Alexandre TORGUE

Many thanks
Philippe :-)

On 02/08/2018 08:39 AM, Andrzej Hajda wrote:
> On 06.02.2018 09:42, Philippe Cornu wrote:
>> Add support for the Synopsys DesignWare MIPI DSI version 1.31
>> Two registers need to be updated/added for supporting 1.31:
>> * PHY_TMR_CFG 0x9c (updated)
>>    1.30 [31:24] phy_hs2lp_time
>>         [23:16] phy_lp2hs_time
>>         [14: 0] max_rd_time
>>
>>    1.31 [25:16] phy_hs2lp_time
>>         [ 9: 0] phy_lp2hs_time
>>
>> * PHY_TMR_RD_CFG 0xf4 (new)
>>    1.31 [14: 0] max_rd_time
>>
>> Signed-off-by: Philippe Cornu <philippe.cornu@st.com>
> Queued to drm-misc-next.
> --
> Regards
> Andrzej
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-02-08  8:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20180206084357epcas1p32e11d1e3c84de7da9d5ba150ded77cdf@epcas1p3.samsung.com>
2018-02-06  8:42 ` [PATCH v2] drm/bridge/synopsys: dsi: Add 1.31 version support Philippe Cornu
2018-02-06 13:06   ` Andrzej Hajda
2018-02-08  7:39   ` Andrzej Hajda
2018-02-08  8:35     ` Philippe CORNU

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®