All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/mediatek: add dsi module reset driver
@ 2019-05-19 11:15 ` Jitao Shi
  0 siblings, 0 replies; 8+ messages in thread
From: Jitao Shi @ 2019-05-19 11:15 UTC (permalink / raw)
  To: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, linux-pwm,
	David Airlie, Matthias Brugger
  Cc: stonea168, dri-devel, Andy Yan, Ajay Kumar, Vincent Palatin,
	cawa.cheng, Russell King, Thierry Reding, devicetree, Jitao Shi,
	linux-mediatek, yingjoe.chen, eddie.huang, linux-arm-kernel,
	Rahul Sharma, srv_heupstream, linux-kernel, Sascha Hauer,
	Sean Paul

Reset dsi HW to default when power on. Prevent the setting differet
between bootloader and kernel.

Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
---
 drivers/gpu/drm/mediatek/mtk_dsi.c | 35 ++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index b00eb2d2e086..39ccb34a7c7f 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -21,10 +21,12 @@
 #include <linux/component.h>
 #include <linux/iopoll.h>
 #include <linux/irq.h>
+#include <linux/mfd/syscon.h>
 #include <linux/of.h>
 #include <linux/of_platform.h>
 #include <linux/phy/phy.h>
 #include <linux/platform_device.h>
+#include <linux/regmap.h>
 #include <video/mipi_display.h>
 #include <video/videomode.h>
 
@@ -146,6 +148,8 @@
 #define T_HS_EXIT	7
 #define T_HS_ZERO	10
 
+#define MMSYS_SW_RST_DSI_B BIT(25)
+
 #define NS_TO_CYCLE(n, c)    ((n) / (c) + (((n) % (c)) ? 1 : 0))
 
 #define MTK_DSI_HOST_IS_READ(type) \
@@ -165,6 +169,8 @@ struct mtk_dsi {
 	struct drm_panel *panel;
 	struct drm_bridge *bridge;
 	struct phy *phy;
+	struct regmap *mmsys_sw_rst_b;
+	u32 sw_rst_b;
 
 	void __iomem *regs;
 
@@ -238,6 +244,16 @@ static void mtk_dsi_disable(struct mtk_dsi *dsi)
 	mtk_dsi_mask(dsi, DSI_CON_CTRL, DSI_EN, 0);
 }
 
+static void mtk_dsi_reset_all(struct mtk_dsi *dsi)
+{
+	regmap_update_bits(dsi->mmsys_sw_rst_b, dsi->sw_rst_b,
+			   MMSYS_SW_RST_DSI_B, ~MMSYS_SW_RST_DSI_B);
+	usleep_range(1000, 1100);
+
+	regmap_update_bits(dsi->mmsys_sw_rst_b, dsi->sw_rst_b,
+			   MMSYS_SW_RST_DSI_B, MMSYS_SW_RST_DSI_B);
+}
+
 static void mtk_dsi_reset_engine(struct mtk_dsi *dsi)
 {
 	mtk_dsi_mask(dsi, DSI_CON_CTRL, DSI_RESET, DSI_RESET);
@@ -831,6 +847,8 @@ static int mtk_dsi_create_conn_enc(struct drm_device *drm, struct mtk_dsi *dsi)
 			goto err_encoder_cleanup;
 	}
 
+	mtk_dsi_reset_all(dsi);
+
 	return 0;
 
 err_encoder_cleanup:
@@ -1087,6 +1105,7 @@ static int mtk_dsi_probe(struct platform_device *pdev)
 	struct mtk_dsi *dsi;
 	struct device *dev = &pdev->dev;
 	struct resource *regs;
+	struct regmap *regmap;
 	int irq_num;
 	int comp_id;
 	int ret;
@@ -1139,6 +1158,22 @@ static int mtk_dsi_probe(struct platform_device *pdev)
 		return ret;
 	}
 
+	regmap = syscon_regmap_lookup_by_phandle(dev->of_node,
+						 "mediatek,syscon-dsi");
+	ret = of_property_read_u32_index(dev->of_node, "mediatek,syscon-dsi", 1,
+					 &dsi->sw_rst_b);
+
+	if (IS_ERR(regmap))
+		ret = PTR_ERR(regmap);
+
+	if (ret) {
+		ret = PTR_ERR(regmap);
+		dev_err(dev, "Failed to get mmsys registers: %d\n", ret);
+		return ret;
+	}
+
+	dsi->mmsys_sw_rst_b = regmap;
+
 	comp_id = mtk_ddp_comp_get_id(dev->of_node, MTK_DSI);
 	if (comp_id < 0) {
 		dev_err(dev, "Failed to identify by alias: %d\n", comp_id);
-- 
2.21.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH] drm/mediatek: add dsi module reset driver
@ 2019-05-19 11:15 ` Jitao Shi
  0 siblings, 0 replies; 8+ messages in thread
From: Jitao Shi @ 2019-05-19 11:15 UTC (permalink / raw)
  To: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, linux-pwm,
	David Airlie, Matthias Brugger
  Cc: stonea168, dri-devel, Andy Yan, Ajay Kumar, Vincent Palatin,
	cawa.cheng, bibby.hsieh, ck.hu, Russell King, Thierry Reding,
	devicetree, Jitao Shi, Philipp Zabel, Inki Dae, linux-mediatek,
	yingjoe.chen, eddie.huang, linux-arm-kernel, Rahul Sharma,
	srv_heupstream, linux-kernel, Sascha Hauer, Sean Paul

Reset dsi HW to default when power on. Prevent the setting differet
between bootloader and kernel.

Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
---
 drivers/gpu/drm/mediatek/mtk_dsi.c | 35 ++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index b00eb2d2e086..39ccb34a7c7f 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -21,10 +21,12 @@
 #include <linux/component.h>
 #include <linux/iopoll.h>
 #include <linux/irq.h>
+#include <linux/mfd/syscon.h>
 #include <linux/of.h>
 #include <linux/of_platform.h>
 #include <linux/phy/phy.h>
 #include <linux/platform_device.h>
+#include <linux/regmap.h>
 #include <video/mipi_display.h>
 #include <video/videomode.h>
 
@@ -146,6 +148,8 @@
 #define T_HS_EXIT	7
 #define T_HS_ZERO	10
 
+#define MMSYS_SW_RST_DSI_B BIT(25)
+
 #define NS_TO_CYCLE(n, c)    ((n) / (c) + (((n) % (c)) ? 1 : 0))
 
 #define MTK_DSI_HOST_IS_READ(type) \
@@ -165,6 +169,8 @@ struct mtk_dsi {
 	struct drm_panel *panel;
 	struct drm_bridge *bridge;
 	struct phy *phy;
+	struct regmap *mmsys_sw_rst_b;
+	u32 sw_rst_b;
 
 	void __iomem *regs;
 
@@ -238,6 +244,16 @@ static void mtk_dsi_disable(struct mtk_dsi *dsi)
 	mtk_dsi_mask(dsi, DSI_CON_CTRL, DSI_EN, 0);
 }
 
+static void mtk_dsi_reset_all(struct mtk_dsi *dsi)
+{
+	regmap_update_bits(dsi->mmsys_sw_rst_b, dsi->sw_rst_b,
+			   MMSYS_SW_RST_DSI_B, ~MMSYS_SW_RST_DSI_B);
+	usleep_range(1000, 1100);
+
+	regmap_update_bits(dsi->mmsys_sw_rst_b, dsi->sw_rst_b,
+			   MMSYS_SW_RST_DSI_B, MMSYS_SW_RST_DSI_B);
+}
+
 static void mtk_dsi_reset_engine(struct mtk_dsi *dsi)
 {
 	mtk_dsi_mask(dsi, DSI_CON_CTRL, DSI_RESET, DSI_RESET);
@@ -831,6 +847,8 @@ static int mtk_dsi_create_conn_enc(struct drm_device *drm, struct mtk_dsi *dsi)
 			goto err_encoder_cleanup;
 	}
 
+	mtk_dsi_reset_all(dsi);
+
 	return 0;
 
 err_encoder_cleanup:
@@ -1087,6 +1105,7 @@ static int mtk_dsi_probe(struct platform_device *pdev)
 	struct mtk_dsi *dsi;
 	struct device *dev = &pdev->dev;
 	struct resource *regs;
+	struct regmap *regmap;
 	int irq_num;
 	int comp_id;
 	int ret;
@@ -1139,6 +1158,22 @@ static int mtk_dsi_probe(struct platform_device *pdev)
 		return ret;
 	}
 
+	regmap = syscon_regmap_lookup_by_phandle(dev->of_node,
+						 "mediatek,syscon-dsi");
+	ret = of_property_read_u32_index(dev->of_node, "mediatek,syscon-dsi", 1,
+					 &dsi->sw_rst_b);
+
+	if (IS_ERR(regmap))
+		ret = PTR_ERR(regmap);
+
+	if (ret) {
+		ret = PTR_ERR(regmap);
+		dev_err(dev, "Failed to get mmsys registers: %d\n", ret);
+		return ret;
+	}
+
+	dsi->mmsys_sw_rst_b = regmap;
+
 	comp_id = mtk_ddp_comp_get_id(dev->of_node, MTK_DSI);
 	if (comp_id < 0) {
 		dev_err(dev, "Failed to identify by alias: %d\n", comp_id);
-- 
2.21.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] drm/mediatek: add dsi module reset driver
  2019-05-19 11:15 ` Jitao Shi
  (?)
@ 2019-05-19 17:48   ` kbuild test robot
  -1 siblings, 0 replies; 8+ messages in thread
From: kbuild test robot @ 2019-05-19 17:48 UTC (permalink / raw)
  To: Jitao Shi
  Cc: kbuild-all, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
	linux-pwm, David Airlie, Matthias Brugger, stonea168, dri-devel,
	Andy Yan, Ajay Kumar, Vincent Palatin, cawa.cheng, Russell King,
	Thierry Reding, devicetree, Jitao Shi, linux-mediatek,
	yingjoe.chen, eddie.huang, linux-arm-kernel, Rahul Sharma,
	srv_heupstream, linux-kernel, Sascha Hauer, Sean Paul

[-- Attachment #1: Type: text/plain, Size: 1995 bytes --]

Hi Jitao,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.1 next-20190517]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Jitao-Shi/drm-mediatek-add-dsi-module-reset-driver/20190519-214457
config: arm64-allyesconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.2.0 make.cross ARCH=arm64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from drivers/gpu//drm/mediatek/mtk_dsi.c:29:0:
   drivers/gpu//drm/mediatek/mtk_dsi.c: In function 'mtk_dsi_reset_all':
>> drivers/gpu//drm/mediatek/mtk_dsi.c:250:27: warning: large integer implicitly truncated to unsigned type [-Woverflow]
          MMSYS_SW_RST_DSI_B, ~MMSYS_SW_RST_DSI_B);
                              ^
   include/linux/regmap.h:77:42: note: in definition of macro 'regmap_update_bits'
     regmap_update_bits_base(map, reg, mask, val, NULL, false, false)
                                             ^~~

vim +250 drivers/gpu//drm/mediatek/mtk_dsi.c

   246	
   247	static void mtk_dsi_reset_all(struct mtk_dsi *dsi)
   248	{
   249		regmap_update_bits(dsi->mmsys_sw_rst_b, dsi->sw_rst_b,
 > 250				   MMSYS_SW_RST_DSI_B, ~MMSYS_SW_RST_DSI_B);
   251		usleep_range(1000, 1100);
   252	
   253		regmap_update_bits(dsi->mmsys_sw_rst_b, dsi->sw_rst_b,
   254				   MMSYS_SW_RST_DSI_B, MMSYS_SW_RST_DSI_B);
   255	}
   256	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 64816 bytes --]

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

* Re: [PATCH] drm/mediatek: add dsi module reset driver
@ 2019-05-19 17:48   ` kbuild test robot
  0 siblings, 0 replies; 8+ messages in thread
From: kbuild test robot @ 2019-05-19 17:48 UTC (permalink / raw)
  Cc: Mark Rutland, devicetree, David Airlie, stonea168, dri-devel,
	Ajay Kumar, Vincent Palatin, cawa.cheng, yingjoe.chen,
	Thierry Reding, Sean Paul, linux-pwm, Jitao Shi, Pawel Moll,
	Ian Campbell, Rob Herring, linux-mediatek, Russell King,
	Matthias Brugger, eddie.huang, linux-arm-kernel, Rahul Sharma,
	srv_heupstream, linux-kernel, kbuild-all, Sascha Hauer

[-- Attachment #1: Type: text/plain, Size: 1995 bytes --]

Hi Jitao,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.1 next-20190517]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Jitao-Shi/drm-mediatek-add-dsi-module-reset-driver/20190519-214457
config: arm64-allyesconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.2.0 make.cross ARCH=arm64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from drivers/gpu//drm/mediatek/mtk_dsi.c:29:0:
   drivers/gpu//drm/mediatek/mtk_dsi.c: In function 'mtk_dsi_reset_all':
>> drivers/gpu//drm/mediatek/mtk_dsi.c:250:27: warning: large integer implicitly truncated to unsigned type [-Woverflow]
          MMSYS_SW_RST_DSI_B, ~MMSYS_SW_RST_DSI_B);
                              ^
   include/linux/regmap.h:77:42: note: in definition of macro 'regmap_update_bits'
     regmap_update_bits_base(map, reg, mask, val, NULL, false, false)
                                             ^~~

vim +250 drivers/gpu//drm/mediatek/mtk_dsi.c

   246	
   247	static void mtk_dsi_reset_all(struct mtk_dsi *dsi)
   248	{
   249		regmap_update_bits(dsi->mmsys_sw_rst_b, dsi->sw_rst_b,
 > 250				   MMSYS_SW_RST_DSI_B, ~MMSYS_SW_RST_DSI_B);
   251		usleep_range(1000, 1100);
   252	
   253		regmap_update_bits(dsi->mmsys_sw_rst_b, dsi->sw_rst_b,
   254				   MMSYS_SW_RST_DSI_B, MMSYS_SW_RST_DSI_B);
   255	}
   256	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 64816 bytes --]

[-- Attachment #3: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] drm/mediatek: add dsi module reset driver
@ 2019-05-19 17:48   ` kbuild test robot
  0 siblings, 0 replies; 8+ messages in thread
From: kbuild test robot @ 2019-05-19 17:48 UTC (permalink / raw)
  To: Jitao Shi
  Cc: Mark Rutland, devicetree, David Airlie, stonea168, dri-devel,
	Ajay Kumar, Vincent Palatin, cawa.cheng, yingjoe.chen,
	Thierry Reding, Sean Paul, linux-pwm, Jitao Shi, Pawel Moll,
	Ian Campbell, Rob Herring, linux-mediatek, Russell King,
	Matthias Brugger, eddie.huang, linux-arm-kernel, Rahul Sharma,
	srv_heupstream, linux-kernel, kbuild-all, Sascha Hauer, Andy Yan

[-- Attachment #1: Type: text/plain, Size: 1995 bytes --]

Hi Jitao,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.1 next-20190517]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Jitao-Shi/drm-mediatek-add-dsi-module-reset-driver/20190519-214457
config: arm64-allyesconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.2.0 make.cross ARCH=arm64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from drivers/gpu//drm/mediatek/mtk_dsi.c:29:0:
   drivers/gpu//drm/mediatek/mtk_dsi.c: In function 'mtk_dsi_reset_all':
>> drivers/gpu//drm/mediatek/mtk_dsi.c:250:27: warning: large integer implicitly truncated to unsigned type [-Woverflow]
          MMSYS_SW_RST_DSI_B, ~MMSYS_SW_RST_DSI_B);
                              ^
   include/linux/regmap.h:77:42: note: in definition of macro 'regmap_update_bits'
     regmap_update_bits_base(map, reg, mask, val, NULL, false, false)
                                             ^~~

vim +250 drivers/gpu//drm/mediatek/mtk_dsi.c

   246	
   247	static void mtk_dsi_reset_all(struct mtk_dsi *dsi)
   248	{
   249		regmap_update_bits(dsi->mmsys_sw_rst_b, dsi->sw_rst_b,
 > 250				   MMSYS_SW_RST_DSI_B, ~MMSYS_SW_RST_DSI_B);
   251		usleep_range(1000, 1100);
   252	
   253		regmap_update_bits(dsi->mmsys_sw_rst_b, dsi->sw_rst_b,
   254				   MMSYS_SW_RST_DSI_B, MMSYS_SW_RST_DSI_B);
   255	}
   256	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 64816 bytes --]

[-- Attachment #3: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] drm/mediatek: add dsi module reset driver
  2019-05-19 11:15 ` Jitao Shi
  (?)
@ 2019-05-31  1:50   ` CK Hu
  -1 siblings, 0 replies; 8+ messages in thread
From: CK Hu @ 2019-05-31  1:50 UTC (permalink / raw)
  To: Jitao Shi
  Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, linux-pwm,
	David Airlie, Matthias Brugger, Thierry Reding, Ajay Kumar,
	Inki Dae, Rahul Sharma, Sean Paul, Vincent Palatin, Andy Yan,
	Philipp Zabel, Russell King, devicetree, linux-kernel, dri-devel,
	linux-arm-kernel, linux-mediatek, srv_heupstream, Sascha Hauer,
	yingjoe.chen, eddie.huang, cawa.cheng, bibby.hsieh, stonea168

Hi, Jitao:

On Sun, 2019-05-19 at 19:15 +0800, Jitao Shi wrote:
> Reset dsi HW to default when power on. Prevent the setting differet
> between bootloader and kernel.
> 
> Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_dsi.c | 35 ++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index b00eb2d2e086..39ccb34a7c7f 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -21,10 +21,12 @@
>  #include <linux/component.h>
>  #include <linux/iopoll.h>
>  #include <linux/irq.h>
> +#include <linux/mfd/syscon.h>
>  #include <linux/of.h>
>  #include <linux/of_platform.h>
>  #include <linux/phy/phy.h>
>  #include <linux/platform_device.h>
> +#include <linux/regmap.h>
>  #include <video/mipi_display.h>
>  #include <video/videomode.h>
>  
> @@ -146,6 +148,8 @@
>  #define T_HS_EXIT	7
>  #define T_HS_ZERO	10
>  
> +#define MMSYS_SW_RST_DSI_B BIT(25)
> +
>  #define NS_TO_CYCLE(n, c)    ((n) / (c) + (((n) % (c)) ? 1 : 0))
>  
>  #define MTK_DSI_HOST_IS_READ(type) \
> @@ -165,6 +169,8 @@ struct mtk_dsi {
>  	struct drm_panel *panel;
>  	struct drm_bridge *bridge;
>  	struct phy *phy;
> +	struct regmap *mmsys_sw_rst_b;
> +	u32 sw_rst_b;
>  
>  	void __iomem *regs;
>  
> @@ -238,6 +244,16 @@ static void mtk_dsi_disable(struct mtk_dsi *dsi)
>  	mtk_dsi_mask(dsi, DSI_CON_CTRL, DSI_EN, 0);
>  }
>  
> +static void mtk_dsi_reset_all(struct mtk_dsi *dsi)
> +{
> +	regmap_update_bits(dsi->mmsys_sw_rst_b, dsi->sw_rst_b,
> +			   MMSYS_SW_RST_DSI_B, ~MMSYS_SW_RST_DSI_B);
> +	usleep_range(1000, 1100);
> +
> +	regmap_update_bits(dsi->mmsys_sw_rst_b, dsi->sw_rst_b,
> +			   MMSYS_SW_RST_DSI_B, MMSYS_SW_RST_DSI_B);
> +}
> +
>  static void mtk_dsi_reset_engine(struct mtk_dsi *dsi)
>  {
>  	mtk_dsi_mask(dsi, DSI_CON_CTRL, DSI_RESET, DSI_RESET);
> @@ -831,6 +847,8 @@ static int mtk_dsi_create_conn_enc(struct drm_device *drm, struct mtk_dsi *dsi)
>  			goto err_encoder_cleanup;
>  	}
>  
> +	mtk_dsi_reset_all(dsi);
> +
>  	return 0;
>  
>  err_encoder_cleanup:
> @@ -1087,6 +1105,7 @@ static int mtk_dsi_probe(struct platform_device *pdev)
>  	struct mtk_dsi *dsi;
>  	struct device *dev = &pdev->dev;
>  	struct resource *regs;
> +	struct regmap *regmap;
>  	int irq_num;
>  	int comp_id;
>  	int ret;
> @@ -1139,6 +1158,22 @@ static int mtk_dsi_probe(struct platform_device *pdev)
>  		return ret;
>  	}
>  
> +	regmap = syscon_regmap_lookup_by_phandle(dev->of_node,
> +						 "mediatek,syscon-dsi");

Where is the binding document for "mediatek,syscon-dsi"?

Regards,
CK

> +	ret = of_property_read_u32_index(dev->of_node, "mediatek,syscon-dsi", 1,
> +					 &dsi->sw_rst_b);
> +
> +	if (IS_ERR(regmap))
> +		ret = PTR_ERR(regmap);
> +
> +	if (ret) {
> +		ret = PTR_ERR(regmap);
> +		dev_err(dev, "Failed to get mmsys registers: %d\n", ret);
> +		return ret;
> +	}
> +
> +	dsi->mmsys_sw_rst_b = regmap;
> +
>  	comp_id = mtk_ddp_comp_get_id(dev->of_node, MTK_DSI);
>  	if (comp_id < 0) {
>  		dev_err(dev, "Failed to identify by alias: %d\n", comp_id);



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

* Re: [PATCH] drm/mediatek: add dsi module reset driver
@ 2019-05-31  1:50   ` CK Hu
  0 siblings, 0 replies; 8+ messages in thread
From: CK Hu @ 2019-05-31  1:50 UTC (permalink / raw)
  To: Jitao Shi
  Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, linux-pwm,
	David Airlie, Matthias Brugger, Thierry Reding, Ajay Kumar,
	Inki Dae, Rahul Sharma, Sean Paul, Vincent Palatin, Andy Yan,
	Philipp Zabel, Russell King, devicetree, linux-kernel, dri-devel,
	linux-arm-kernel, linux-media

Hi, Jitao:

On Sun, 2019-05-19 at 19:15 +0800, Jitao Shi wrote:
> Reset dsi HW to default when power on. Prevent the setting differet
> between bootloader and kernel.
> 
> Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_dsi.c | 35 ++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index b00eb2d2e086..39ccb34a7c7f 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -21,10 +21,12 @@
>  #include <linux/component.h>
>  #include <linux/iopoll.h>
>  #include <linux/irq.h>
> +#include <linux/mfd/syscon.h>
>  #include <linux/of.h>
>  #include <linux/of_platform.h>
>  #include <linux/phy/phy.h>
>  #include <linux/platform_device.h>
> +#include <linux/regmap.h>
>  #include <video/mipi_display.h>
>  #include <video/videomode.h>
>  
> @@ -146,6 +148,8 @@
>  #define T_HS_EXIT	7
>  #define T_HS_ZERO	10
>  
> +#define MMSYS_SW_RST_DSI_B BIT(25)
> +
>  #define NS_TO_CYCLE(n, c)    ((n) / (c) + (((n) % (c)) ? 1 : 0))
>  
>  #define MTK_DSI_HOST_IS_READ(type) \
> @@ -165,6 +169,8 @@ struct mtk_dsi {
>  	struct drm_panel *panel;
>  	struct drm_bridge *bridge;
>  	struct phy *phy;
> +	struct regmap *mmsys_sw_rst_b;
> +	u32 sw_rst_b;
>  
>  	void __iomem *regs;
>  
> @@ -238,6 +244,16 @@ static void mtk_dsi_disable(struct mtk_dsi *dsi)
>  	mtk_dsi_mask(dsi, DSI_CON_CTRL, DSI_EN, 0);
>  }
>  
> +static void mtk_dsi_reset_all(struct mtk_dsi *dsi)
> +{
> +	regmap_update_bits(dsi->mmsys_sw_rst_b, dsi->sw_rst_b,
> +			   MMSYS_SW_RST_DSI_B, ~MMSYS_SW_RST_DSI_B);
> +	usleep_range(1000, 1100);
> +
> +	regmap_update_bits(dsi->mmsys_sw_rst_b, dsi->sw_rst_b,
> +			   MMSYS_SW_RST_DSI_B, MMSYS_SW_RST_DSI_B);
> +}
> +
>  static void mtk_dsi_reset_engine(struct mtk_dsi *dsi)
>  {
>  	mtk_dsi_mask(dsi, DSI_CON_CTRL, DSI_RESET, DSI_RESET);
> @@ -831,6 +847,8 @@ static int mtk_dsi_create_conn_enc(struct drm_device *drm, struct mtk_dsi *dsi)
>  			goto err_encoder_cleanup;
>  	}
>  
> +	mtk_dsi_reset_all(dsi);
> +
>  	return 0;
>  
>  err_encoder_cleanup:
> @@ -1087,6 +1105,7 @@ static int mtk_dsi_probe(struct platform_device *pdev)
>  	struct mtk_dsi *dsi;
>  	struct device *dev = &pdev->dev;
>  	struct resource *regs;
> +	struct regmap *regmap;
>  	int irq_num;
>  	int comp_id;
>  	int ret;
> @@ -1139,6 +1158,22 @@ static int mtk_dsi_probe(struct platform_device *pdev)
>  		return ret;
>  	}
>  
> +	regmap = syscon_regmap_lookup_by_phandle(dev->of_node,
> +						 "mediatek,syscon-dsi");

Where is the binding document for "mediatek,syscon-dsi"?

Regards,
CK

> +	ret = of_property_read_u32_index(dev->of_node, "mediatek,syscon-dsi", 1,
> +					 &dsi->sw_rst_b);
> +
> +	if (IS_ERR(regmap))
> +		ret = PTR_ERR(regmap);
> +
> +	if (ret) {
> +		ret = PTR_ERR(regmap);
> +		dev_err(dev, "Failed to get mmsys registers: %d\n", ret);
> +		return ret;
> +	}
> +
> +	dsi->mmsys_sw_rst_b = regmap;
> +
>  	comp_id = mtk_ddp_comp_get_id(dev->of_node, MTK_DSI);
>  	if (comp_id < 0) {
>  		dev_err(dev, "Failed to identify by alias: %d\n", comp_id);

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

* Re: [PATCH] drm/mediatek: add dsi module reset driver
@ 2019-05-31  1:50   ` CK Hu
  0 siblings, 0 replies; 8+ messages in thread
From: CK Hu @ 2019-05-31  1:50 UTC (permalink / raw)
  To: Jitao Shi
  Cc: Mark Rutland, devicetree, David Airlie, stonea168, dri-devel,
	yingjoe.chen, Ajay Kumar, Vincent Palatin, cawa.cheng,
	bibby.hsieh, Russell King, Thierry Reding, linux-pwm,
	Sascha Hauer, Pawel Moll, Ian Campbell, Inki Dae, Rob Herring,
	linux-mediatek, Andy Yan, Matthias Brugger, eddie.huang,
	linux-arm-kernel, Rahul Sharma, srv_heupstream, linux-kernel,
	Philipp Zabel, Sean Paul

Hi, Jitao:

On Sun, 2019-05-19 at 19:15 +0800, Jitao Shi wrote:
> Reset dsi HW to default when power on. Prevent the setting differet
> between bootloader and kernel.
> 
> Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_dsi.c | 35 ++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index b00eb2d2e086..39ccb34a7c7f 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -21,10 +21,12 @@
>  #include <linux/component.h>
>  #include <linux/iopoll.h>
>  #include <linux/irq.h>
> +#include <linux/mfd/syscon.h>
>  #include <linux/of.h>
>  #include <linux/of_platform.h>
>  #include <linux/phy/phy.h>
>  #include <linux/platform_device.h>
> +#include <linux/regmap.h>
>  #include <video/mipi_display.h>
>  #include <video/videomode.h>
>  
> @@ -146,6 +148,8 @@
>  #define T_HS_EXIT	7
>  #define T_HS_ZERO	10
>  
> +#define MMSYS_SW_RST_DSI_B BIT(25)
> +
>  #define NS_TO_CYCLE(n, c)    ((n) / (c) + (((n) % (c)) ? 1 : 0))
>  
>  #define MTK_DSI_HOST_IS_READ(type) \
> @@ -165,6 +169,8 @@ struct mtk_dsi {
>  	struct drm_panel *panel;
>  	struct drm_bridge *bridge;
>  	struct phy *phy;
> +	struct regmap *mmsys_sw_rst_b;
> +	u32 sw_rst_b;
>  
>  	void __iomem *regs;
>  
> @@ -238,6 +244,16 @@ static void mtk_dsi_disable(struct mtk_dsi *dsi)
>  	mtk_dsi_mask(dsi, DSI_CON_CTRL, DSI_EN, 0);
>  }
>  
> +static void mtk_dsi_reset_all(struct mtk_dsi *dsi)
> +{
> +	regmap_update_bits(dsi->mmsys_sw_rst_b, dsi->sw_rst_b,
> +			   MMSYS_SW_RST_DSI_B, ~MMSYS_SW_RST_DSI_B);
> +	usleep_range(1000, 1100);
> +
> +	regmap_update_bits(dsi->mmsys_sw_rst_b, dsi->sw_rst_b,
> +			   MMSYS_SW_RST_DSI_B, MMSYS_SW_RST_DSI_B);
> +}
> +
>  static void mtk_dsi_reset_engine(struct mtk_dsi *dsi)
>  {
>  	mtk_dsi_mask(dsi, DSI_CON_CTRL, DSI_RESET, DSI_RESET);
> @@ -831,6 +847,8 @@ static int mtk_dsi_create_conn_enc(struct drm_device *drm, struct mtk_dsi *dsi)
>  			goto err_encoder_cleanup;
>  	}
>  
> +	mtk_dsi_reset_all(dsi);
> +
>  	return 0;
>  
>  err_encoder_cleanup:
> @@ -1087,6 +1105,7 @@ static int mtk_dsi_probe(struct platform_device *pdev)
>  	struct mtk_dsi *dsi;
>  	struct device *dev = &pdev->dev;
>  	struct resource *regs;
> +	struct regmap *regmap;
>  	int irq_num;
>  	int comp_id;
>  	int ret;
> @@ -1139,6 +1158,22 @@ static int mtk_dsi_probe(struct platform_device *pdev)
>  		return ret;
>  	}
>  
> +	regmap = syscon_regmap_lookup_by_phandle(dev->of_node,
> +						 "mediatek,syscon-dsi");

Where is the binding document for "mediatek,syscon-dsi"?

Regards,
CK

> +	ret = of_property_read_u32_index(dev->of_node, "mediatek,syscon-dsi", 1,
> +					 &dsi->sw_rst_b);
> +
> +	if (IS_ERR(regmap))
> +		ret = PTR_ERR(regmap);
> +
> +	if (ret) {
> +		ret = PTR_ERR(regmap);
> +		dev_err(dev, "Failed to get mmsys registers: %d\n", ret);
> +		return ret;
> +	}
> +
> +	dsi->mmsys_sw_rst_b = regmap;
> +
>  	comp_id = mtk_ddp_comp_get_id(dev->of_node, MTK_DSI);
>  	if (comp_id < 0) {
>  		dev_err(dev, "Failed to identify by alias: %d\n", comp_id);



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2019-05-31  1:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-19 11:15 [PATCH] drm/mediatek: add dsi module reset driver Jitao Shi
2019-05-19 11:15 ` Jitao Shi
2019-05-19 17:48 ` kbuild test robot
2019-05-19 17:48   ` kbuild test robot
2019-05-19 17:48   ` kbuild test robot
2019-05-31  1:50 ` CK Hu
2019-05-31  1:50   ` CK Hu
2019-05-31  1:50   ` CK Hu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.