linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/komeda: Add support for 'memory-region' DT node property
@ 2019-08-02 14:40 Mihail Atanassov
  2019-08-05  8:40 ` james qian wang (Arm Technology China)
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Mihail Atanassov @ 2019-08-02 14:40 UTC (permalink / raw)
  To: dri-devel
  Cc: Mihail Atanassov, james qian wang (Arm Technology China),
	Liviu Dudau, Brian Starkey, David Airlie, Daniel Vetter,
	linux-kernel

The 'memory-region' property of the komeda display driver DT binding
allows the use of a 'reserved-memory' node for buffer allocations. Add
the requisite of_reserved_mem_device_{init,release} calls to actually
make use of the memory if present.

Signed-off-by: Mihail Atanassov <mihail.atanassov@arm.com>
---
 drivers/gpu/drm/arm/display/komeda/komeda_drv.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
index cfa5068d9d1e..2ec877ad260a 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
@@ -6,6 +6,7 @@
  */
 #include <linux/module.h>
 #include <linux/kernel.h>
+#include <linux/of_reserved_mem.h>
 #include <linux/platform_device.h>
 #include <linux/component.h>
 #include <drm/drm_of.h>
@@ -32,6 +33,7 @@ static void komeda_unbind(struct device *dev)
 return;

 komeda_kms_detach(mdrv->kms);
+of_reserved_mem_device_release(dev);
 komeda_dev_destroy(mdrv->mdev);

 dev_set_drvdata(dev, NULL);
@@ -53,6 +55,11 @@ static int komeda_bind(struct device *dev)
 goto free_mdrv;
 }

+/* Get the optional framebuffer memory resource */
+err = of_reserved_mem_device_init(dev);
+if (err && err != -ENODEV)
+goto destroy_mdev;
+
 mdrv->kms = komeda_kms_attach(mdrv->mdev);
 if (IS_ERR(mdrv->kms)) {
 err = PTR_ERR(mdrv->kms);
--
2.22.0

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

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

* Re: [PATCH] drm/komeda: Add support for 'memory-region' DT node property
  2019-08-02 14:40 [PATCH] drm/komeda: Add support for 'memory-region' DT node property Mihail Atanassov
@ 2019-08-05  8:40 ` james qian wang (Arm Technology China)
  2019-08-05  9:52 ` [PATCH v2] " Mihail Atanassov
  2019-08-05  9:56 ` [PATCH v2.1] " Mihail Atanassov
  2 siblings, 0 replies; 6+ messages in thread
From: james qian wang (Arm Technology China) @ 2019-08-05  8:40 UTC (permalink / raw)
  To: Mihail Atanassov
  Cc: dri-devel, Liviu Dudau, Brian Starkey, David Airlie,
	Daniel Vetter, linux-kernel, nd

Hi Mihail:

On Fri, Aug 02, 2019 at 10:40:19PM +0800, Mihail Atanassov wrote:
> The 'memory-region' property of the komeda display driver DT binding
> allows the use of a 'reserved-memory' node for buffer allocations. Add
> the requisite of_reserved_mem_device_{init,release} calls to actually
> make use of the memory if present.
> 
> Signed-off-by: Mihail Atanassov <mihail.atanassov@arm.com>
> ---
>  drivers/gpu/drm/arm/display/komeda/komeda_drv.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
> index cfa5068d9d1e..2ec877ad260a 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
> @@ -6,6 +6,7 @@
>   */
>  #include <linux/module.h>
>  #include <linux/kernel.h>
> +#include <linux/of_reserved_mem.h>
>  #include <linux/platform_device.h>
>  #include <linux/component.h>
>  #include <drm/drm_of.h>
> @@ -32,6 +33,7 @@ static void komeda_unbind(struct device *dev)
>  		return;
>  
>  	komeda_kms_detach(mdrv->kms);
> +	of_reserved_mem_device_release(dev);
>  	komeda_dev_destroy(mdrv->mdev);
>  
>  	dev_set_drvdata(dev, NULL);
> @@ -53,6 +55,11 @@ static int komeda_bind(struct device *dev)
>  		goto free_mdrv;
>  	}
>  
> +	/* Get the optional framebuffer memory resource */
> +	err = of_reserved_mem_device_init(dev);
> +	if (err && err != -ENODEV)
> +		goto destroy_mdev;
> +

Hi Mihail:

Thanks for your patch.

Since we have a dedicated function for DT parsing: "komeda_parse_dt",
seems we'd move this into it as well.

thank you
James

>  	mdrv->kms = komeda_kms_attach(mdrv->mdev);
>  	if (IS_ERR(mdrv->kms)) {
>  		err = PTR_ERR(mdrv->kms);
> -- 
> 2.22.0

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

* [PATCH v2] drm/komeda: Add support for 'memory-region' DT node property
  2019-08-02 14:40 [PATCH] drm/komeda: Add support for 'memory-region' DT node property Mihail Atanassov
  2019-08-05  8:40 ` james qian wang (Arm Technology China)
@ 2019-08-05  9:52 ` Mihail Atanassov
  2019-08-05  9:56 ` [PATCH v2.1] " Mihail Atanassov
  2 siblings, 0 replies; 6+ messages in thread
From: Mihail Atanassov @ 2019-08-05  9:52 UTC (permalink / raw)
  To: dri-devel
  Cc: Mihail Atanassov, james qian wang (Arm Technology China),
	Liviu Dudau, Brian Starkey, David Airlie, Daniel Vetter,
	linux-kernel

The 'memory-region' property of the komeda display driver DT binding
allows the use of a 'reserved-memory' node for buffer allocations. Add
the requisite of_reserved_mem_device_{init,release} calls to actually
make use of the memory if present.

Changes since v1:
 - Move handling inside komeda_parse_dt

Signed-off-by: Mihail Atanassov <mihail.atanassov@arm.com>
---
 drivers/gpu/drm/arm/display/komeda/komeda_dev.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
index 1ff7f4b2c620..0142ee991957 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
@@ -8,6 +8,7 @@
 #include <linux/iommu.h>
 #include <linux/of_device.h>
 #include <linux/of_graph.h>
+#include <linux/of_reserved_mem.h>
 #include <linux/platform_device.h>
 #include <linux/dma-mapping.h>
 #ifdef CONFIG_DEBUG_FS
@@ -146,6 +147,12 @@ static int komeda_parse_dt(struct device *dev, struct komeda_dev *mdev)
 return mdev->irq;
 }

+/* Get the optional framebuffer memory resource */
+ret = of_reserved_mem_device_init(dev);
+if (ret && ret != -ENODEV)
+return ret;
+ret = 0;
+
 for_each_available_child_of_node(np, child) {
 if (of_node_cmp(child->name, "pipeline") == 0) {
 ret = komeda_parse_pipe_dt(mdev, child);
@@ -292,6 +299,8 @@ void komeda_dev_destroy(struct komeda_dev *mdev)

 mdev->n_pipelines = 0;

+of_reserved_mem_device_release(dev);
+
 if (funcs && funcs->cleanup)
 funcs->cleanup(mdev);

--
2.22.0

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

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

* [PATCH v2.1] drm/komeda: Add support for 'memory-region' DT node property
  2019-08-02 14:40 [PATCH] drm/komeda: Add support for 'memory-region' DT node property Mihail Atanassov
  2019-08-05  8:40 ` james qian wang (Arm Technology China)
  2019-08-05  9:52 ` [PATCH v2] " Mihail Atanassov
@ 2019-08-05  9:56 ` Mihail Atanassov
  2019-08-05 10:13   ` james qian wang (Arm Technology China)
  2 siblings, 1 reply; 6+ messages in thread
From: Mihail Atanassov @ 2019-08-05  9:56 UTC (permalink / raw)
  To: dri-devel
  Cc: nd, Mihail Atanassov, james qian wang (Arm Technology China),
	Liviu Dudau, Brian Starkey, David Airlie, Daniel Vetter,
	linux-kernel

The 'memory-region' property of the komeda display driver DT binding
allows the use of a 'reserved-memory' node for buffer allocations. Add
the requisite of_reserved_mem_device_{init,release} calls to actually
make use of the memory if present.

Changes since v1:
 - Move handling inside komeda_parse_dt

Signed-off-by: Mihail Atanassov <mihail.atanassov@arm.com>
---
 drivers/gpu/drm/arm/display/komeda/komeda_dev.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
index 1ff7f4b2c620..0142ee991957 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
@@ -8,6 +8,7 @@
 #include <linux/iommu.h>
 #include <linux/of_device.h>
 #include <linux/of_graph.h>
+#include <linux/of_reserved_mem.h>
 #include <linux/platform_device.h>
 #include <linux/dma-mapping.h>
 #ifdef CONFIG_DEBUG_FS
@@ -146,6 +147,12 @@ static int komeda_parse_dt(struct device *dev, struct komeda_dev *mdev)
 		return mdev->irq;
 	}
 
+	/* Get the optional framebuffer memory resource */
+	ret = of_reserved_mem_device_init(dev);
+	if (ret && ret != -ENODEV)
+		return ret;
+	ret = 0;
+
 	for_each_available_child_of_node(np, child) {
 		if (of_node_cmp(child->name, "pipeline") == 0) {
 			ret = komeda_parse_pipe_dt(mdev, child);
@@ -292,6 +299,8 @@ void komeda_dev_destroy(struct komeda_dev *mdev)
 
 	mdev->n_pipelines = 0;
 
+	of_reserved_mem_device_release(dev);
+
 	if (funcs && funcs->cleanup)
 		funcs->cleanup(mdev);
 
-- 
2.22.0


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

* Re: [PATCH v2.1] drm/komeda: Add support for 'memory-region' DT node property
  2019-08-05  9:56 ` [PATCH v2.1] " Mihail Atanassov
@ 2019-08-05 10:13   ` james qian wang (Arm Technology China)
  2019-08-20 10:31     ` Ayan Halder
  0 siblings, 1 reply; 6+ messages in thread
From: james qian wang (Arm Technology China) @ 2019-08-05 10:13 UTC (permalink / raw)
  To: Mihail Atanassov
  Cc: dri-devel, nd, Liviu Dudau, Brian Starkey, David Airlie,
	Daniel Vetter, linux-kernel

On Mon, Aug 05, 2019 at 05:56:25PM +0800, Mihail Atanassov wrote:
> The 'memory-region' property of the komeda display driver DT binding
> allows the use of a 'reserved-memory' node for buffer allocations. Add
> the requisite of_reserved_mem_device_{init,release} calls to actually
> make use of the memory if present.
> 
> Changes since v1:
>  - Move handling inside komeda_parse_dt
> 
> Signed-off-by: Mihail Atanassov <mihail.atanassov@arm.com>
> ---
>  drivers/gpu/drm/arm/display/komeda/komeda_dev.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
> index 1ff7f4b2c620..0142ee991957 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
> @@ -8,6 +8,7 @@
>  #include <linux/iommu.h>
>  #include <linux/of_device.h>
>  #include <linux/of_graph.h>
> +#include <linux/of_reserved_mem.h>
>  #include <linux/platform_device.h>
>  #include <linux/dma-mapping.h>
>  #ifdef CONFIG_DEBUG_FS
> @@ -146,6 +147,12 @@ static int komeda_parse_dt(struct device *dev, struct komeda_dev *mdev)
>  		return mdev->irq;
>  	}
>  
> +	/* Get the optional framebuffer memory resource */
> +	ret = of_reserved_mem_device_init(dev);
> +	if (ret && ret != -ENODEV)
> +		return ret;
> +	ret = 0;
> +
>  	for_each_available_child_of_node(np, child) {
>  		if (of_node_cmp(child->name, "pipeline") == 0) {
>  			ret = komeda_parse_pipe_dt(mdev, child);
> @@ -292,6 +299,8 @@ void komeda_dev_destroy(struct komeda_dev *mdev)
>  
>  	mdev->n_pipelines = 0;
>  
> +	of_reserved_mem_device_release(dev);
> +
>  	if (funcs && funcs->cleanup)
>  		funcs->cleanup(mdev);
>  
> -- 
> 2.22.0


Thank you.

Reviewed-by: James Qian Wang (Arm Technology China) <james.qian.wang@arm.com>

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

* Re: [PATCH v2.1] drm/komeda: Add support for 'memory-region' DT node property
  2019-08-05 10:13   ` james qian wang (Arm Technology China)
@ 2019-08-20 10:31     ` Ayan Halder
  0 siblings, 0 replies; 6+ messages in thread
From: Ayan Halder @ 2019-08-20 10:31 UTC (permalink / raw)
  To: james qian wang (Arm Technology China)
  Cc: Mihail Atanassov, David Airlie, Liviu Dudau, linux-kernel, dri-devel, nd

On Mon, Aug 05, 2019 at 10:13:35AM +0000, james qian wang (Arm Technology China) wrote:
> On Mon, Aug 05, 2019 at 05:56:25PM +0800, Mihail Atanassov wrote:
> > The 'memory-region' property of the komeda display driver DT binding
> > allows the use of a 'reserved-memory' node for buffer allocations. Add
> > the requisite of_reserved_mem_device_{init,release} calls to actually
> > make use of the memory if present.
> > 
> > Changes since v1:
> >  - Move handling inside komeda_parse_dt
> > 
> > Signed-off-by: Mihail Atanassov <mihail.atanassov@arm.com>
> > ---
> >  drivers/gpu/drm/arm/display/komeda/komeda_dev.c | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
> > index 1ff7f4b2c620..0142ee991957 100644
> > --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
> > +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
> > @@ -8,6 +8,7 @@
> >  #include <linux/iommu.h>
> >  #include <linux/of_device.h>
> >  #include <linux/of_graph.h>
> > +#include <linux/of_reserved_mem.h>
> >  #include <linux/platform_device.h>
> >  #include <linux/dma-mapping.h>
> >  #ifdef CONFIG_DEBUG_FS
> > @@ -146,6 +147,12 @@ static int komeda_parse_dt(struct device *dev, struct komeda_dev *mdev)
> >  		return mdev->irq;
> >  	}
> >  
> > +	/* Get the optional framebuffer memory resource */
> > +	ret = of_reserved_mem_device_init(dev);
> > +	if (ret && ret != -ENODEV)
> > +		return ret;
> > +	ret = 0;
> > +
> >  	for_each_available_child_of_node(np, child) {
> >  		if (of_node_cmp(child->name, "pipeline") == 0) {
> >  			ret = komeda_parse_pipe_dt(mdev, child);
> > @@ -292,6 +299,8 @@ void komeda_dev_destroy(struct komeda_dev *mdev)
> >  
> >  	mdev->n_pipelines = 0;
> >  
> > +	of_reserved_mem_device_release(dev);
> > +
> >  	if (funcs && funcs->cleanup)
> >  		funcs->cleanup(mdev);
> >  
> > -- 
> > 2.22.0
> 
> 
> Thank you.
> 
> Reviewed-by: James Qian Wang (Arm Technology China) <james.qian.wang@arm.com>

Pushed to drm-misc-next - a8c16b7593bd1a4e613164a47c526ca9d1be764b
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2019-08-20 10:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-02 14:40 [PATCH] drm/komeda: Add support for 'memory-region' DT node property Mihail Atanassov
2019-08-05  8:40 ` james qian wang (Arm Technology China)
2019-08-05  9:52 ` [PATCH v2] " Mihail Atanassov
2019-08-05  9:56 ` [PATCH v2.1] " Mihail Atanassov
2019-08-05 10:13   ` james qian wang (Arm Technology China)
2019-08-20 10:31     ` Ayan Halder

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).