linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] drm/bridge/synopsys: dsi: Allow VPG to be enabled via debugfs
@ 2019-04-30  8:17 Matt Redfearn
  2019-05-03 15:32 ` Philippe CORNU
  0 siblings, 1 reply; 5+ messages in thread
From: Matt Redfearn @ 2019-04-30  8:17 UTC (permalink / raw)
  To: Andrzej Hajda, Laurent Pinchart, Philippe Cornu
  Cc: dri-devel, Matthew Redfearn, Nickey Yang, Heiko Stuebner,
	Archit Taneja, linux-kernel, David Airlie, Daniel Vetter

The Synopsys MIPI DSI IP contains a video test pattern generator which
is helpful in debugging video timing with connected displays.
Add a debugfs directory containing files which allow the VPG to be
enabled and disabled, and its orientation to be changed.

Signed-off-by: Matt Redfearn <matt.redfearn@thinci.com>

---

Changes in v2:
- Ensure dw_mipi_dsi_video_mode_config() doesn't break without CONFIG_DEBUG_FS
- Tidy up initialisation / tidy up of debugfs

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

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
index 0ee440216b8..bffeef7a6cc 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
@@ -10,6 +10,7 @@
 
 #include <linux/clk.h>
 #include <linux/component.h>
+#include <linux/debugfs.h>
 #include <linux/iopoll.h>
 #include <linux/module.h>
 #include <linux/of_device.h>
@@ -86,6 +87,8 @@
 #define VID_MODE_TYPE_NON_BURST_SYNC_EVENTS	0x1
 #define VID_MODE_TYPE_BURST			0x2
 #define VID_MODE_TYPE_MASK			0x3
+#define VID_MODE_VPG_ENABLE		BIT(16)
+#define VID_MODE_VPG_HORIZONTAL		BIT(24)
 
 #define DSI_VID_PKT_SIZE		0x3c
 #define VID_PKT_SIZE(p)			((p) & 0x3fff)
@@ -234,6 +237,13 @@ struct dw_mipi_dsi {
 	u32 format;
 	unsigned long mode_flags;
 
+#ifdef CONFIG_DEBUG_FS
+	struct dentry *debugfs;
+
+	bool vpg;
+	bool vpg_horizontal;
+#endif /* CONFIG_DEBUG_FS */
+
 	struct dw_mipi_dsi *master; /* dual-dsi master ptr */
 	struct dw_mipi_dsi *slave; /* dual-dsi slave ptr */
 
@@ -525,6 +535,13 @@ static void dw_mipi_dsi_video_mode_config(struct dw_mipi_dsi *dsi)
 	else
 		val |= VID_MODE_TYPE_NON_BURST_SYNC_EVENTS;
 
+#ifdef CONFIG_DEBUG_FS
+	if (dsi->vpg) {
+		val |= VID_MODE_VPG_ENABLE;
+		val |= dsi->vpg_horizontal ? VID_MODE_VPG_HORIZONTAL : 0;
+	}
+#endif /* CONFIG_DEBUG_FS */
+
 	dsi_write(dsi, DSI_VID_MODE_CFG, val);
 }
 
@@ -935,6 +952,33 @@ static const struct drm_bridge_funcs dw_mipi_dsi_bridge_funcs = {
 	.attach	      = dw_mipi_dsi_bridge_attach,
 };
 
+#ifdef CONFIG_DEBUG_FS
+
+static void dw_mipi_dsi_debugfs_init(struct dw_mipi_dsi *dsi)
+{
+	dsi->debugfs = debugfs_create_dir(dev_name(dsi->dev), NULL);
+	if (IS_ERR(dsi->debugfs)) {
+		dev_err(dsi->dev, "failed to create debugfs root\n");
+		return;
+	}
+
+	debugfs_create_bool("vpg", 0660, dsi->debugfs, &dsi->vpg);
+	debugfs_create_bool("vpg_horizontal", 0660, dsi->debugfs,
+			    &dsi->vpg_horizontal);
+}
+
+static void dw_mipi_dsi_debugfs_remove(struct dw_mipi_dsi *dsi)
+{
+	debugfs_remove_recursive(dsi->debugfs);
+}
+
+#else
+
+static void dw_mipi_dsi_debugfs_init(struct dw_mipi_dsi *dsi) { }
+static void dw_mipi_dsi_debugfs_remove(struct dw_mipi_dsi *dsi) { }
+
+#endif /* CONFIG_DEBUG_FS */
+
 static struct dw_mipi_dsi *
 __dw_mipi_dsi_probe(struct platform_device *pdev,
 		    const struct dw_mipi_dsi_plat_data *plat_data)
@@ -1005,6 +1049,7 @@ __dw_mipi_dsi_probe(struct platform_device *pdev,
 		clk_disable_unprepare(dsi->pclk);
 	}
 
+	dw_mipi_dsi_debugfs_init(dsi);
 	pm_runtime_enable(dev);
 
 	dsi->dsi_host.ops = &dw_mipi_dsi_host_ops;
@@ -1012,6 +1057,7 @@ __dw_mipi_dsi_probe(struct platform_device *pdev,
 	ret = mipi_dsi_host_register(&dsi->dsi_host);
 	if (ret) {
 		dev_err(dev, "Failed to register MIPI host: %d\n", ret);
+		dw_mipi_dsi_debugfs_remove(dsi);
 		return ERR_PTR(ret);
 	}
 
@@ -1029,6 +1075,7 @@ static void __dw_mipi_dsi_remove(struct dw_mipi_dsi *dsi)
 	mipi_dsi_host_unregister(&dsi->dsi_host);
 
 	pm_runtime_disable(dsi->dev);
+	dw_mipi_dsi_debugfs_remove(dsi);
 }
 
 void dw_mipi_dsi_set_slave(struct dw_mipi_dsi *dsi, struct dw_mipi_dsi *slave)
-- 
2.17.1


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

* Re: [PATCH v2] drm/bridge/synopsys: dsi: Allow VPG to be enabled via debugfs
  2019-04-30  8:17 [PATCH v2] drm/bridge/synopsys: dsi: Allow VPG to be enabled via debugfs Matt Redfearn
@ 2019-05-03 15:32 ` Philippe CORNU
  2019-06-24 11:02   ` Matt Redfearn
  0 siblings, 1 reply; 5+ messages in thread
From: Philippe CORNU @ 2019-05-03 15:32 UTC (permalink / raw)
  To: Matt Redfearn, Andrzej Hajda, Laurent Pinchart
  Cc: dri-devel, Matthew Redfearn, Nickey Yang, Heiko Stuebner,
	Archit Taneja, linux-kernel, David Airlie, Daniel Vetter,
	Yannick FERTRE

Hi Matt,
and many thanks for the patch.

Tested successfully by Yannick on STM32MP1 boards :-)

Tested-by: Yannick Fertré <yannick.fertre@st.com>
Reviewed-by: Philippe Cornu <philippe.cornu@st.com>

Thank you,
Philippe :-)


On 4/30/19 10:17 AM, Matt Redfearn wrote:
> The Synopsys MIPI DSI IP contains a video test pattern generator which
> is helpful in debugging video timing with connected displays.
> Add a debugfs directory containing files which allow the VPG to be
> enabled and disabled, and its orientation to be changed.
> 
> Signed-off-by: Matt Redfearn <matt.redfearn@thinci.com>
> 
> ---
> 
> Changes in v2:
> - Ensure dw_mipi_dsi_video_mode_config() doesn't break without CONFIG_DEBUG_FS
> - Tidy up initialisation / tidy up of debugfs
> 
>   drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 47 +++++++++++++++++++
>   1 file changed, 47 insertions(+)
> 
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
> index 0ee440216b8..bffeef7a6cc 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
> @@ -10,6 +10,7 @@
>   
>   #include <linux/clk.h>
>   #include <linux/component.h>
> +#include <linux/debugfs.h>
>   #include <linux/iopoll.h>
>   #include <linux/module.h>
>   #include <linux/of_device.h>
> @@ -86,6 +87,8 @@
>   #define VID_MODE_TYPE_NON_BURST_SYNC_EVENTS	0x1
>   #define VID_MODE_TYPE_BURST			0x2
>   #define VID_MODE_TYPE_MASK			0x3
> +#define VID_MODE_VPG_ENABLE		BIT(16)
> +#define VID_MODE_VPG_HORIZONTAL		BIT(24)
>   
>   #define DSI_VID_PKT_SIZE		0x3c
>   #define VID_PKT_SIZE(p)			((p) & 0x3fff)
> @@ -234,6 +237,13 @@ struct dw_mipi_dsi {
>   	u32 format;
>   	unsigned long mode_flags;
>   
> +#ifdef CONFIG_DEBUG_FS
> +	struct dentry *debugfs;
> +
> +	bool vpg;
> +	bool vpg_horizontal;
> +#endif /* CONFIG_DEBUG_FS */
> +
>   	struct dw_mipi_dsi *master; /* dual-dsi master ptr */
>   	struct dw_mipi_dsi *slave; /* dual-dsi slave ptr */
>   
> @@ -525,6 +535,13 @@ static void dw_mipi_dsi_video_mode_config(struct dw_mipi_dsi *dsi)
>   	else
>   		val |= VID_MODE_TYPE_NON_BURST_SYNC_EVENTS;
>   
> +#ifdef CONFIG_DEBUG_FS
> +	if (dsi->vpg) {
> +		val |= VID_MODE_VPG_ENABLE;
> +		val |= dsi->vpg_horizontal ? VID_MODE_VPG_HORIZONTAL : 0;
> +	}
> +#endif /* CONFIG_DEBUG_FS */
> +
>   	dsi_write(dsi, DSI_VID_MODE_CFG, val);
>   }
>   
> @@ -935,6 +952,33 @@ static const struct drm_bridge_funcs dw_mipi_dsi_bridge_funcs = {
>   	.attach	      = dw_mipi_dsi_bridge_attach,
>   };
>   
> +#ifdef CONFIG_DEBUG_FS
> +
> +static void dw_mipi_dsi_debugfs_init(struct dw_mipi_dsi *dsi)
> +{
> +	dsi->debugfs = debugfs_create_dir(dev_name(dsi->dev), NULL);
> +	if (IS_ERR(dsi->debugfs)) {
> +		dev_err(dsi->dev, "failed to create debugfs root\n");
> +		return;
> +	}
> +
> +	debugfs_create_bool("vpg", 0660, dsi->debugfs, &dsi->vpg);
> +	debugfs_create_bool("vpg_horizontal", 0660, dsi->debugfs,
> +			    &dsi->vpg_horizontal);
> +}
> +
> +static void dw_mipi_dsi_debugfs_remove(struct dw_mipi_dsi *dsi)
> +{
> +	debugfs_remove_recursive(dsi->debugfs);
> +}
> +
> +#else
> +
> +static void dw_mipi_dsi_debugfs_init(struct dw_mipi_dsi *dsi) { }
> +static void dw_mipi_dsi_debugfs_remove(struct dw_mipi_dsi *dsi) { }
> +
> +#endif /* CONFIG_DEBUG_FS */
> +
>   static struct dw_mipi_dsi *
>   __dw_mipi_dsi_probe(struct platform_device *pdev,
>   		    const struct dw_mipi_dsi_plat_data *plat_data)
> @@ -1005,6 +1049,7 @@ __dw_mipi_dsi_probe(struct platform_device *pdev,
>   		clk_disable_unprepare(dsi->pclk);
>   	}
>   
> +	dw_mipi_dsi_debugfs_init(dsi);
>   	pm_runtime_enable(dev);
>   
>   	dsi->dsi_host.ops = &dw_mipi_dsi_host_ops;
> @@ -1012,6 +1057,7 @@ __dw_mipi_dsi_probe(struct platform_device *pdev,
>   	ret = mipi_dsi_host_register(&dsi->dsi_host);
>   	if (ret) {
>   		dev_err(dev, "Failed to register MIPI host: %d\n", ret);
> +		dw_mipi_dsi_debugfs_remove(dsi);
>   		return ERR_PTR(ret);
>   	}
>   
> @@ -1029,6 +1075,7 @@ static void __dw_mipi_dsi_remove(struct dw_mipi_dsi *dsi)
>   	mipi_dsi_host_unregister(&dsi->dsi_host);
>   
>   	pm_runtime_disable(dsi->dev);
> +	dw_mipi_dsi_debugfs_remove(dsi);
>   }
>   
>   void dw_mipi_dsi_set_slave(struct dw_mipi_dsi *dsi, struct dw_mipi_dsi *slave)
> 

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

* Re: [PATCH v2] drm/bridge/synopsys: dsi: Allow VPG to be enabled via debugfs
  2019-05-03 15:32 ` Philippe CORNU
@ 2019-06-24 11:02   ` Matt Redfearn
  2019-06-24 11:44     ` Andrzej Hajda
  0 siblings, 1 reply; 5+ messages in thread
From: Matt Redfearn @ 2019-06-24 11:02 UTC (permalink / raw)
  To: Philippe CORNU, Andrzej Hajda, Laurent Pinchart
  Cc: Archit Taneja, David Airlie, linux-kernel, Matthew Redfearn,
	Yannick FERTRE, Nickey Yang, dri-devel

Hi,
Anything stopping this being applied?

Thanks,
Matt

On 03/05/2019 16:32, Philippe CORNU wrote:
> Hi Matt,
> and many thanks for the patch.
> 
> Tested successfully by Yannick on STM32MP1 boards :-)
> 
> Tested-by: Yannick Fertré <yannick.fertre@st.com>
> Reviewed-by: Philippe Cornu <philippe.cornu@st.com>
> 
> Thank you,
> Philippe :-)
> 
> 
> On 4/30/19 10:17 AM, Matt Redfearn wrote:
>> The Synopsys MIPI DSI IP contains a video test pattern generator which
>> is helpful in debugging video timing with connected displays.
>> Add a debugfs directory containing files which allow the VPG to be
>> enabled and disabled, and its orientation to be changed.
>>
>> Signed-off-by: Matt Redfearn <matt.redfearn@thinci.com>
>>
>> ---
>>
>> Changes in v2:
>> - Ensure dw_mipi_dsi_video_mode_config() doesn't break without CONFIG_DEBUG_FS
>> - Tidy up initialisation / tidy up of debugfs
>>
>>    drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 47 +++++++++++++++++++
>>    1 file changed, 47 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
>> index 0ee440216b8..bffeef7a6cc 100644
>> --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
>> +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
>> @@ -10,6 +10,7 @@
>>    
>>    #include <linux/clk.h>
>>    #include <linux/component.h>
>> +#include <linux/debugfs.h>
>>    #include <linux/iopoll.h>
>>    #include <linux/module.h>
>>    #include <linux/of_device.h>
>> @@ -86,6 +87,8 @@
>>    #define VID_MODE_TYPE_NON_BURST_SYNC_EVENTS	0x1
>>    #define VID_MODE_TYPE_BURST			0x2
>>    #define VID_MODE_TYPE_MASK			0x3
>> +#define VID_MODE_VPG_ENABLE		BIT(16)
>> +#define VID_MODE_VPG_HORIZONTAL		BIT(24)
>>    
>>    #define DSI_VID_PKT_SIZE		0x3c
>>    #define VID_PKT_SIZE(p)			((p) & 0x3fff)
>> @@ -234,6 +237,13 @@ struct dw_mipi_dsi {
>>    	u32 format;
>>    	unsigned long mode_flags;
>>    
>> +#ifdef CONFIG_DEBUG_FS
>> +	struct dentry *debugfs;
>> +
>> +	bool vpg;
>> +	bool vpg_horizontal;
>> +#endif /* CONFIG_DEBUG_FS */
>> +
>>    	struct dw_mipi_dsi *master; /* dual-dsi master ptr */
>>    	struct dw_mipi_dsi *slave; /* dual-dsi slave ptr */
>>    
>> @@ -525,6 +535,13 @@ static void dw_mipi_dsi_video_mode_config(struct dw_mipi_dsi *dsi)
>>    	else
>>    		val |= VID_MODE_TYPE_NON_BURST_SYNC_EVENTS;
>>    
>> +#ifdef CONFIG_DEBUG_FS
>> +	if (dsi->vpg) {
>> +		val |= VID_MODE_VPG_ENABLE;
>> +		val |= dsi->vpg_horizontal ? VID_MODE_VPG_HORIZONTAL : 0;
>> +	}
>> +#endif /* CONFIG_DEBUG_FS */
>> +
>>    	dsi_write(dsi, DSI_VID_MODE_CFG, val);
>>    }
>>    
>> @@ -935,6 +952,33 @@ static const struct drm_bridge_funcs dw_mipi_dsi_bridge_funcs = {
>>    	.attach	      = dw_mipi_dsi_bridge_attach,
>>    };
>>    
>> +#ifdef CONFIG_DEBUG_FS
>> +
>> +static void dw_mipi_dsi_debugfs_init(struct dw_mipi_dsi *dsi)
>> +{
>> +	dsi->debugfs = debugfs_create_dir(dev_name(dsi->dev), NULL);
>> +	if (IS_ERR(dsi->debugfs)) {
>> +		dev_err(dsi->dev, "failed to create debugfs root\n");
>> +		return;
>> +	}
>> +
>> +	debugfs_create_bool("vpg", 0660, dsi->debugfs, &dsi->vpg);
>> +	debugfs_create_bool("vpg_horizontal", 0660, dsi->debugfs,
>> +			    &dsi->vpg_horizontal);
>> +}
>> +
>> +static void dw_mipi_dsi_debugfs_remove(struct dw_mipi_dsi *dsi)
>> +{
>> +	debugfs_remove_recursive(dsi->debugfs);
>> +}
>> +
>> +#else
>> +
>> +static void dw_mipi_dsi_debugfs_init(struct dw_mipi_dsi *dsi) { }
>> +static void dw_mipi_dsi_debugfs_remove(struct dw_mipi_dsi *dsi) { }
>> +
>> +#endif /* CONFIG_DEBUG_FS */
>> +
>>    static struct dw_mipi_dsi *
>>    __dw_mipi_dsi_probe(struct platform_device *pdev,
>>    		    const struct dw_mipi_dsi_plat_data *plat_data)
>> @@ -1005,6 +1049,7 @@ __dw_mipi_dsi_probe(struct platform_device *pdev,
>>    		clk_disable_unprepare(dsi->pclk);
>>    	}
>>    
>> +	dw_mipi_dsi_debugfs_init(dsi);
>>    	pm_runtime_enable(dev);
>>    
>>    	dsi->dsi_host.ops = &dw_mipi_dsi_host_ops;
>> @@ -1012,6 +1057,7 @@ __dw_mipi_dsi_probe(struct platform_device *pdev,
>>    	ret = mipi_dsi_host_register(&dsi->dsi_host);
>>    	if (ret) {
>>    		dev_err(dev, "Failed to register MIPI host: %d\n", ret);
>> +		dw_mipi_dsi_debugfs_remove(dsi);
>>    		return ERR_PTR(ret);
>>    	}
>>    
>> @@ -1029,6 +1075,7 @@ static void __dw_mipi_dsi_remove(struct dw_mipi_dsi *dsi)
>>    	mipi_dsi_host_unregister(&dsi->dsi_host);
>>    
>>    	pm_runtime_disable(dsi->dev);
>> +	dw_mipi_dsi_debugfs_remove(dsi);
>>    }
>>    
>>    void dw_mipi_dsi_set_slave(struct dw_mipi_dsi *dsi, struct dw_mipi_dsi *slave)
>>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 

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

* Re: [PATCH v2] drm/bridge/synopsys: dsi: Allow VPG to be enabled via debugfs
  2019-06-24 11:02   ` Matt Redfearn
@ 2019-06-24 11:44     ` Andrzej Hajda
  2019-06-24 13:14       ` Matt Redfearn
  0 siblings, 1 reply; 5+ messages in thread
From: Andrzej Hajda @ 2019-06-24 11:44 UTC (permalink / raw)
  To: Matt Redfearn, Philippe CORNU, Laurent Pinchart
  Cc: Archit Taneja, David Airlie, linux-kernel, Matthew Redfearn,
	Yannick FERTRE, Nickey Yang, dri-devel

On 24.06.2019 13:02, Matt Redfearn wrote:
> Hi,
> Anything stopping this being applied?


Queued to drm-misc-next.

--
Regards
Andrzej


>
> Thanks,
> Matt
>
> On 03/05/2019 16:32, Philippe CORNU wrote:
>> Hi Matt,
>> and many thanks for the patch.
>>
>> Tested successfully by Yannick on STM32MP1 boards :-)
>>
>> Tested-by: Yannick Fertré <yannick.fertre@st.com>
>> Reviewed-by: Philippe Cornu <philippe.cornu@st.com>
>>
>> Thank you,
>> Philippe :-)
>>
>>
>> On 4/30/19 10:17 AM, Matt Redfearn wrote:
>>> The Synopsys MIPI DSI IP contains a video test pattern generator which
>>> is helpful in debugging video timing with connected displays.
>>> Add a debugfs directory containing files which allow the VPG to be
>>> enabled and disabled, and its orientation to be changed.
>>>
>>> Signed-off-by: Matt Redfearn <matt.redfearn@thinci.com>
>>>
>>> ---
>>>
>>> Changes in v2:
>>> - Ensure dw_mipi_dsi_video_mode_config() doesn't break without CONFIG_DEBUG_FS
>>> - Tidy up initialisation / tidy up of debugfs
>>>
>>>    drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 47 +++++++++++++++++++
>>>    1 file changed, 47 insertions(+)
>>>
>>> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
>>> index 0ee440216b8..bffeef7a6cc 100644
>>> --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
>>> +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
>>> @@ -10,6 +10,7 @@
>>>    
>>>    #include <linux/clk.h>
>>>    #include <linux/component.h>
>>> +#include <linux/debugfs.h>
>>>    #include <linux/iopoll.h>
>>>    #include <linux/module.h>
>>>    #include <linux/of_device.h>
>>> @@ -86,6 +87,8 @@
>>>    #define VID_MODE_TYPE_NON_BURST_SYNC_EVENTS	0x1
>>>    #define VID_MODE_TYPE_BURST			0x2
>>>    #define VID_MODE_TYPE_MASK			0x3
>>> +#define VID_MODE_VPG_ENABLE		BIT(16)
>>> +#define VID_MODE_VPG_HORIZONTAL		BIT(24)
>>>    
>>>    #define DSI_VID_PKT_SIZE		0x3c
>>>    #define VID_PKT_SIZE(p)			((p) & 0x3fff)
>>> @@ -234,6 +237,13 @@ struct dw_mipi_dsi {
>>>    	u32 format;
>>>    	unsigned long mode_flags;
>>>    
>>> +#ifdef CONFIG_DEBUG_FS
>>> +	struct dentry *debugfs;
>>> +
>>> +	bool vpg;
>>> +	bool vpg_horizontal;
>>> +#endif /* CONFIG_DEBUG_FS */
>>> +
>>>    	struct dw_mipi_dsi *master; /* dual-dsi master ptr */
>>>    	struct dw_mipi_dsi *slave; /* dual-dsi slave ptr */
>>>    
>>> @@ -525,6 +535,13 @@ static void dw_mipi_dsi_video_mode_config(struct dw_mipi_dsi *dsi)
>>>    	else
>>>    		val |= VID_MODE_TYPE_NON_BURST_SYNC_EVENTS;
>>>    
>>> +#ifdef CONFIG_DEBUG_FS
>>> +	if (dsi->vpg) {
>>> +		val |= VID_MODE_VPG_ENABLE;
>>> +		val |= dsi->vpg_horizontal ? VID_MODE_VPG_HORIZONTAL : 0;
>>> +	}
>>> +#endif /* CONFIG_DEBUG_FS */
>>> +
>>>    	dsi_write(dsi, DSI_VID_MODE_CFG, val);
>>>    }
>>>    
>>> @@ -935,6 +952,33 @@ static const struct drm_bridge_funcs dw_mipi_dsi_bridge_funcs = {
>>>    	.attach	      = dw_mipi_dsi_bridge_attach,
>>>    };
>>>    
>>> +#ifdef CONFIG_DEBUG_FS
>>> +
>>> +static void dw_mipi_dsi_debugfs_init(struct dw_mipi_dsi *dsi)
>>> +{
>>> +	dsi->debugfs = debugfs_create_dir(dev_name(dsi->dev), NULL);
>>> +	if (IS_ERR(dsi->debugfs)) {
>>> +		dev_err(dsi->dev, "failed to create debugfs root\n");
>>> +		return;
>>> +	}
>>> +
>>> +	debugfs_create_bool("vpg", 0660, dsi->debugfs, &dsi->vpg);
>>> +	debugfs_create_bool("vpg_horizontal", 0660, dsi->debugfs,
>>> +			    &dsi->vpg_horizontal);
>>> +}
>>> +
>>> +static void dw_mipi_dsi_debugfs_remove(struct dw_mipi_dsi *dsi)
>>> +{
>>> +	debugfs_remove_recursive(dsi->debugfs);
>>> +}
>>> +
>>> +#else
>>> +
>>> +static void dw_mipi_dsi_debugfs_init(struct dw_mipi_dsi *dsi) { }
>>> +static void dw_mipi_dsi_debugfs_remove(struct dw_mipi_dsi *dsi) { }
>>> +
>>> +#endif /* CONFIG_DEBUG_FS */
>>> +
>>>    static struct dw_mipi_dsi *
>>>    __dw_mipi_dsi_probe(struct platform_device *pdev,
>>>    		    const struct dw_mipi_dsi_plat_data *plat_data)
>>> @@ -1005,6 +1049,7 @@ __dw_mipi_dsi_probe(struct platform_device *pdev,
>>>    		clk_disable_unprepare(dsi->pclk);
>>>    	}
>>>    
>>> +	dw_mipi_dsi_debugfs_init(dsi);
>>>    	pm_runtime_enable(dev);
>>>    
>>>    	dsi->dsi_host.ops = &dw_mipi_dsi_host_ops;
>>> @@ -1012,6 +1057,7 @@ __dw_mipi_dsi_probe(struct platform_device *pdev,
>>>    	ret = mipi_dsi_host_register(&dsi->dsi_host);
>>>    	if (ret) {
>>>    		dev_err(dev, "Failed to register MIPI host: %d\n", ret);
>>> +		dw_mipi_dsi_debugfs_remove(dsi);
>>>    		return ERR_PTR(ret);
>>>    	}
>>>    
>>> @@ -1029,6 +1075,7 @@ static void __dw_mipi_dsi_remove(struct dw_mipi_dsi *dsi)
>>>    	mipi_dsi_host_unregister(&dsi->dsi_host);
>>>    
>>>    	pm_runtime_disable(dsi->dev);
>>> +	dw_mipi_dsi_debugfs_remove(dsi);
>>>    }
>>>    
>>>    void dw_mipi_dsi_set_slave(struct dw_mipi_dsi *dsi, struct dw_mipi_dsi *slave)
>>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>>


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

* Re: [PATCH v2] drm/bridge/synopsys: dsi: Allow VPG to be enabled via debugfs
  2019-06-24 11:44     ` Andrzej Hajda
@ 2019-06-24 13:14       ` Matt Redfearn
  0 siblings, 0 replies; 5+ messages in thread
From: Matt Redfearn @ 2019-06-24 13:14 UTC (permalink / raw)
  To: Andrzej Hajda, Philippe CORNU, Laurent Pinchart
  Cc: Archit Taneja, David Airlie, linux-kernel, Matthew Redfearn,
	Yannick FERTRE, Nickey Yang, dri-devel



On 24/06/2019 12:44, Andrzej Hajda wrote:
> On 24.06.2019 13:02, Matt Redfearn wrote:
>> Hi,
>> Anything stopping this being applied?
> 
> 
> Queued to drm-misc-next.

Thanks Andrzej!

> 
> --
> Regards
> Andrzej
> 
> 
>>
>> Thanks,
>> Matt
>>
>> On 03/05/2019 16:32, Philippe CORNU wrote:
>>> Hi Matt,
>>> and many thanks for the patch.
>>>
>>> Tested successfully by Yannick on STM32MP1 boards :-)
>>>
>>> Tested-by: Yannick Fertré <yannick.fertre@st.com>
>>> Reviewed-by: Philippe Cornu <philippe.cornu@st.com>
>>>
>>> Thank you,
>>> Philippe :-)
>>>
>>>
>>> On 4/30/19 10:17 AM, Matt Redfearn wrote:
>>>> The Synopsys MIPI DSI IP contains a video test pattern generator which
>>>> is helpful in debugging video timing with connected displays.
>>>> Add a debugfs directory containing files which allow the VPG to be
>>>> enabled and disabled, and its orientation to be changed.
>>>>
>>>> Signed-off-by: Matt Redfearn <matt.redfearn@thinci.com>
>>>>
>>>> ---
>>>>
>>>> Changes in v2:
>>>> - Ensure dw_mipi_dsi_video_mode_config() doesn't break without CONFIG_DEBUG_FS
>>>> - Tidy up initialisation / tidy up of debugfs
>>>>
>>>>     drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 47 +++++++++++++++++++
>>>>     1 file changed, 47 insertions(+)
>>>>
>>>> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
>>>> index 0ee440216b8..bffeef7a6cc 100644
>>>> --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
>>>> +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
>>>> @@ -10,6 +10,7 @@
>>>>     
>>>>     #include <linux/clk.h>
>>>>     #include <linux/component.h>
>>>> +#include <linux/debugfs.h>
>>>>     #include <linux/iopoll.h>
>>>>     #include <linux/module.h>
>>>>     #include <linux/of_device.h>
>>>> @@ -86,6 +87,8 @@
>>>>     #define VID_MODE_TYPE_NON_BURST_SYNC_EVENTS	0x1
>>>>     #define VID_MODE_TYPE_BURST			0x2
>>>>     #define VID_MODE_TYPE_MASK			0x3
>>>> +#define VID_MODE_VPG_ENABLE		BIT(16)
>>>> +#define VID_MODE_VPG_HORIZONTAL		BIT(24)
>>>>     
>>>>     #define DSI_VID_PKT_SIZE		0x3c
>>>>     #define VID_PKT_SIZE(p)			((p) & 0x3fff)
>>>> @@ -234,6 +237,13 @@ struct dw_mipi_dsi {
>>>>     	u32 format;
>>>>     	unsigned long mode_flags;
>>>>     
>>>> +#ifdef CONFIG_DEBUG_FS
>>>> +	struct dentry *debugfs;
>>>> +
>>>> +	bool vpg;
>>>> +	bool vpg_horizontal;
>>>> +#endif /* CONFIG_DEBUG_FS */
>>>> +
>>>>     	struct dw_mipi_dsi *master; /* dual-dsi master ptr */
>>>>     	struct dw_mipi_dsi *slave; /* dual-dsi slave ptr */
>>>>     
>>>> @@ -525,6 +535,13 @@ static void dw_mipi_dsi_video_mode_config(struct dw_mipi_dsi *dsi)
>>>>     	else
>>>>     		val |= VID_MODE_TYPE_NON_BURST_SYNC_EVENTS;
>>>>     
>>>> +#ifdef CONFIG_DEBUG_FS
>>>> +	if (dsi->vpg) {
>>>> +		val |= VID_MODE_VPG_ENABLE;
>>>> +		val |= dsi->vpg_horizontal ? VID_MODE_VPG_HORIZONTAL : 0;
>>>> +	}
>>>> +#endif /* CONFIG_DEBUG_FS */
>>>> +
>>>>     	dsi_write(dsi, DSI_VID_MODE_CFG, val);
>>>>     }
>>>>     
>>>> @@ -935,6 +952,33 @@ static const struct drm_bridge_funcs dw_mipi_dsi_bridge_funcs = {
>>>>     	.attach	      = dw_mipi_dsi_bridge_attach,
>>>>     };
>>>>     
>>>> +#ifdef CONFIG_DEBUG_FS
>>>> +
>>>> +static void dw_mipi_dsi_debugfs_init(struct dw_mipi_dsi *dsi)
>>>> +{
>>>> +	dsi->debugfs = debugfs_create_dir(dev_name(dsi->dev), NULL);
>>>> +	if (IS_ERR(dsi->debugfs)) {
>>>> +		dev_err(dsi->dev, "failed to create debugfs root\n");
>>>> +		return;
>>>> +	}
>>>> +
>>>> +	debugfs_create_bool("vpg", 0660, dsi->debugfs, &dsi->vpg);
>>>> +	debugfs_create_bool("vpg_horizontal", 0660, dsi->debugfs,
>>>> +			    &dsi->vpg_horizontal);
>>>> +}
>>>> +
>>>> +static void dw_mipi_dsi_debugfs_remove(struct dw_mipi_dsi *dsi)
>>>> +{
>>>> +	debugfs_remove_recursive(dsi->debugfs);
>>>> +}
>>>> +
>>>> +#else
>>>> +
>>>> +static void dw_mipi_dsi_debugfs_init(struct dw_mipi_dsi *dsi) { }
>>>> +static void dw_mipi_dsi_debugfs_remove(struct dw_mipi_dsi *dsi) { }
>>>> +
>>>> +#endif /* CONFIG_DEBUG_FS */
>>>> +
>>>>     static struct dw_mipi_dsi *
>>>>     __dw_mipi_dsi_probe(struct platform_device *pdev,
>>>>     		    const struct dw_mipi_dsi_plat_data *plat_data)
>>>> @@ -1005,6 +1049,7 @@ __dw_mipi_dsi_probe(struct platform_device *pdev,
>>>>     		clk_disable_unprepare(dsi->pclk);
>>>>     	}
>>>>     
>>>> +	dw_mipi_dsi_debugfs_init(dsi);
>>>>     	pm_runtime_enable(dev);
>>>>     
>>>>     	dsi->dsi_host.ops = &dw_mipi_dsi_host_ops;
>>>> @@ -1012,6 +1057,7 @@ __dw_mipi_dsi_probe(struct platform_device *pdev,
>>>>     	ret = mipi_dsi_host_register(&dsi->dsi_host);
>>>>     	if (ret) {
>>>>     		dev_err(dev, "Failed to register MIPI host: %d\n", ret);
>>>> +		dw_mipi_dsi_debugfs_remove(dsi);
>>>>     		return ERR_PTR(ret);
>>>>     	}
>>>>     
>>>> @@ -1029,6 +1075,7 @@ static void __dw_mipi_dsi_remove(struct dw_mipi_dsi *dsi)
>>>>     	mipi_dsi_host_unregister(&dsi->dsi_host);
>>>>     
>>>>     	pm_runtime_disable(dsi->dev);
>>>> +	dw_mipi_dsi_debugfs_remove(dsi);
>>>>     }
>>>>     
>>>>     void dw_mipi_dsi_set_slave(struct dw_mipi_dsi *dsi, struct dw_mipi_dsi *slave)
>>>>
>>> _______________________________________________
>>> dri-devel mailing list
>>> dri-devel@lists.freedesktop.org
>>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>>>
> 

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

end of thread, other threads:[~2019-06-24 13:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-30  8:17 [PATCH v2] drm/bridge/synopsys: dsi: Allow VPG to be enabled via debugfs Matt Redfearn
2019-05-03 15:32 ` Philippe CORNU
2019-06-24 11:02   ` Matt Redfearn
2019-06-24 11:44     ` Andrzej Hajda
2019-06-24 13:14       ` Matt Redfearn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).