drm/komeda: Add support for 'memory-region' DT node property
diff mbox series

Message ID 20190802143951.4436-1-mihail.atanassov@arm.com
State New
Headers show
Series
  • drm/komeda: Add support for 'memory-region' DT node property
Related show

Commit Message

Mihail Atanassov Aug. 2, 2019, 2:40 p.m. UTC
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(+)

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

Comments

james qian wang (Arm Technology China) Aug. 5, 2019, 8:40 a.m. UTC | #1
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

Patch
diff mbox series

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