From: Maxime Ripard <maxime.ripard@free-electrons.com>
To: Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>, Chen-Yu Tsai <wens@csie.org>,
Maxime Ripard <maxime.ripard@free-electrons.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org,
Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Subject: [PATCH 4/8] drm/sun4i: Grab reserved memory region
Date: Thu, 9 Feb 2017 17:39:18 +0100 [thread overview]
Message-ID: <cf185f6de351837a9a29c123ca801682c983b83d.1486655917.git-series.maxime.ripard@free-electrons.com> (raw)
In-Reply-To: <cover.7101c7323e6f22e281ad70b93488cf44caca4ca0.1486655917.git-series.maxime.ripard@free-electrons.com>
In-Reply-To: <cover.7101c7323e6f22e281ad70b93488cf44caca4ca0.1486655917.git-series.maxime.ripard@free-electrons.com>
Allow to provide an optional memory region to allocate from for our DRM
driver.
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
drivers/gpu/drm/sun4i/sun4i_drv.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
index 4ce665349f6b..7ed7a159c9c1 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -12,6 +12,7 @@
#include <linux/component.h>
#include <linux/of_graph.h>
+#include <linux/of_reserved_mem.h>
#include <drm/drmP.h>
#include <drm/drm_crtc_helper.h>
@@ -133,10 +134,16 @@ static int sun4i_drv_bind(struct device *dev)
drm_vblank_init(drm, 1);
drm_mode_config_init(drm);
+ ret = of_reserved_mem_device_init(dev);
+ if (ret && ret != -ENODEV) {
+ dev_err(drm->dev, "Couldn't claim our memory region\n");
+ goto free_drm;
+ }
+
ret = component_bind_all(drm->dev, drm);
if (ret) {
dev_err(drm->dev, "Couldn't bind all pipelines components\n");
- goto free_drm;
+ goto free_mem_region;
}
/* Create our layers */
@@ -144,7 +151,7 @@ static int sun4i_drv_bind(struct device *dev)
if (IS_ERR(drv->layers)) {
dev_err(drm->dev, "Couldn't create the planes\n");
ret = PTR_ERR(drv->layers);
- goto free_drm;
+ goto free_mem_region;
}
/* Create our CRTC */
@@ -152,7 +159,7 @@ static int sun4i_drv_bind(struct device *dev)
if (!drv->crtc) {
dev_err(drm->dev, "Couldn't create the CRTC\n");
ret = -EINVAL;
- goto free_drm;
+ goto free_mem_region;
}
drm->irq_enabled = true;
@@ -164,7 +171,7 @@ static int sun4i_drv_bind(struct device *dev)
if (IS_ERR(drv->fbdev)) {
dev_err(drm->dev, "Couldn't create our framebuffer\n");
ret = PTR_ERR(drv->fbdev);
- goto free_drm;
+ goto free_mem_region;
}
/* Enable connectors polling */
@@ -172,10 +179,12 @@ static int sun4i_drv_bind(struct device *dev)
ret = drm_dev_register(drm, 0);
if (ret)
- goto free_drm;
+ goto free_mem_region;
return 0;
+free_mem_region:
+ of_reserved_mem_device_release(dev);
free_drm:
drm_dev_unref(drm);
return ret;
--
git-series 0.8.11
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2017-02-09 16:39 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-09 16:39 [PATCH 0/8] ARM: sun8i: a33: Mali improvements Maxime Ripard
2017-02-09 16:39 ` [PATCH 1/8] ARM: sun8i: Fix the mali clock rate Maxime Ripard
2017-02-27 14:39 ` Maxime Ripard
2017-02-09 16:39 ` [PATCH 2/8] dt-bindings: gpu: mali: Add optional memory-region Maxime Ripard
2017-02-15 23:37 ` Rob Herring
2017-02-27 14:39 ` Maxime Ripard
2017-02-09 16:39 ` [PATCH 3/8] mm: cma: Export a few symbols Maxime Ripard
2017-02-09 19:20 ` Michal Hocko
2017-02-13 13:44 ` Maxime Ripard
2017-02-20 12:35 ` Michal Hocko
2017-02-23 22:58 ` Maxime Ripard
2017-02-09 16:39 ` Maxime Ripard [this message]
2017-02-27 14:49 ` [PATCH 4/8] drm/sun4i: Grab reserved memory region Maxime Ripard
2017-02-09 16:39 ` [PATCH 5/8] ARM: sun8i: a33: Add shared display memory pool Maxime Ripard
2017-02-09 16:39 ` [PATCH 6/8] dt-bindings: gpu: mali: Add optional OPPs Maxime Ripard
2017-02-15 23:42 ` Rob Herring
2017-02-27 14:39 ` Maxime Ripard
2017-02-09 16:39 ` [PATCH 7/8] ARM: sunxi: Select PM_OPP Maxime Ripard
2017-02-27 14:40 ` Maxime Ripard
2017-02-09 16:39 ` [PATCH 8/8] ARM: sun8i: a33: Add the Mali OPPs Maxime Ripard
2017-02-15 23:40 ` Rob Herring
2017-02-27 14:40 ` Maxime Ripard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cf185f6de351837a9a29c123ca801682c983b83d.1486655917.git-series.maxime.ripard@free-electrons.com \
--to=maxime.ripard@free-electrons.com \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mark.rutland@arm.com \
--cc=robh+dt@kernel.org \
--cc=thomas.petazzoni@free-electrons.com \
--cc=wens@csie.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox