All of lore.kernel.org
 help / color / mirror / Atom feed
From: Magnus Damm <magnus.damm@gmail.com>
To: linux-sh@vger.kernel.org
Cc: Magnus Damm <magnus.damm@gmail.com>,
	lethal@linux-sh.org, linux-fbdev-devel@lists.sourceforge.net
Subject: [PATCH] video: add sh_mobile_lcdcfb memory resource
Date: Tue, 12 May 2009 09:57:45 +0000	[thread overview]
Message-ID: <20090512095745.25477.87326.sendpatchset@rx1.opensource.se> (raw)

From: Magnus Damm <damm@igel.co.jp>

This patch adds memory resource support to the LCDC driver.
With this applied the physical memory range used for framebuffer
data will show up in /proc/iomem together with other SuperH
Mobile devices.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
---

 drivers/video/sh_mobile_lcdcfb.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

--- 0001/drivers/video/sh_mobile_lcdcfb.c
+++ work/drivers/video/sh_mobile_lcdcfb.c	2009-05-11 21:14:35.000000000 +0900
@@ -35,6 +35,7 @@ struct sh_mobile_lcdc_chan {
 	struct fb_deferred_io defio;
 	unsigned long frame_end;
 	wait_queue_head_t frame_end_wait;
+	struct resource memory;
 };
 
 struct sh_mobile_lcdc_priv {
@@ -813,12 +814,26 @@ static int __init sh_mobile_lcdc_probe(s
 			break;
 		}
 
+		res = &priv->ch[i].memory;
+		res->name = "lcdc";
+		res->start = priv->ch[i].dma_handle;
+		res->end = res->start + info->fix.smem_len - 1;
+		res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
+		error = insert_resource(&iomem_resource, res);
+		if (error) {
+			dev_err(&pdev->dev, "unable to request resource\n");
+			dma_free_coherent(&pdev->dev, info->fix.smem_len,
+					  buf, priv->ch[i].dma_handle);
+			break;
+		}
+
 		info->pseudo_palette = &priv->ch[i].pseudo_palette;
 		info->flags = FBINFO_FLAG_DEFAULT;
 
 		error = fb_alloc_cmap(&info->cmap, PALETTE_NR, 0);
 		if (error < 0) {
 			dev_err(&pdev->dev, "unable to allocate cmap\n");
+			release_resource(res);
 			dma_free_coherent(&pdev->dev, info->fix.smem_len,
 					  buf, priv->ch[i].dma_handle);
 			break;
@@ -887,6 +902,7 @@ static int sh_mobile_lcdc_remove(struct 
 		if (!info->device)
 			continue;
 
+		release_resource(&priv->ch[i].memory);
 		dma_free_coherent(&pdev->dev, info->fix.smem_len,
 				  info->screen_base, priv->ch[i].dma_handle);
 		fb_dealloc_cmap(&info->cmap);

WARNING: multiple messages have this Message-ID (diff)
From: Magnus Damm <magnus.damm@gmail.com>
To: linux-sh@vger.kernel.org
Cc: Magnus Damm <magnus.damm@gmail.com>,
	lethal@linux-sh.org, linux-fbdev-devel@lists.sourceforge.net
Subject: [PATCH] video: add sh_mobile_lcdcfb memory resource
Date: Tue, 12 May 2009 18:57:45 +0900	[thread overview]
Message-ID: <20090512095745.25477.87326.sendpatchset@rx1.opensource.se> (raw)

From: Magnus Damm <damm@igel.co.jp>

This patch adds memory resource support to the LCDC driver.
With this applied the physical memory range used for framebuffer
data will show up in /proc/iomem together with other SuperH
Mobile devices.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
---

 drivers/video/sh_mobile_lcdcfb.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

--- 0001/drivers/video/sh_mobile_lcdcfb.c
+++ work/drivers/video/sh_mobile_lcdcfb.c	2009-05-11 21:14:35.000000000 +0900
@@ -35,6 +35,7 @@ struct sh_mobile_lcdc_chan {
 	struct fb_deferred_io defio;
 	unsigned long frame_end;
 	wait_queue_head_t frame_end_wait;
+	struct resource memory;
 };
 
 struct sh_mobile_lcdc_priv {
@@ -813,12 +814,26 @@ static int __init sh_mobile_lcdc_probe(s
 			break;
 		}
 
+		res = &priv->ch[i].memory;
+		res->name = "lcdc";
+		res->start = priv->ch[i].dma_handle;
+		res->end = res->start + info->fix.smem_len - 1;
+		res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
+		error = insert_resource(&iomem_resource, res);
+		if (error) {
+			dev_err(&pdev->dev, "unable to request resource\n");
+			dma_free_coherent(&pdev->dev, info->fix.smem_len,
+					  buf, priv->ch[i].dma_handle);
+			break;
+		}
+
 		info->pseudo_palette = &priv->ch[i].pseudo_palette;
 		info->flags = FBINFO_FLAG_DEFAULT;
 
 		error = fb_alloc_cmap(&info->cmap, PALETTE_NR, 0);
 		if (error < 0) {
 			dev_err(&pdev->dev, "unable to allocate cmap\n");
+			release_resource(res);
 			dma_free_coherent(&pdev->dev, info->fix.smem_len,
 					  buf, priv->ch[i].dma_handle);
 			break;
@@ -887,6 +902,7 @@ static int sh_mobile_lcdc_remove(struct 
 		if (!info->device)
 			continue;
 
+		release_resource(&priv->ch[i].memory);
 		dma_free_coherent(&pdev->dev, info->fix.smem_len,
 				  info->screen_base, priv->ch[i].dma_handle);
 		fb_dealloc_cmap(&info->cmap);

             reply	other threads:[~2009-05-12  9:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-12  9:57 Magnus Damm [this message]
2009-05-12  9:57 ` [PATCH] video: add sh_mobile_lcdcfb memory resource Magnus Damm
2009-05-12 10:50 ` Paul Mundt
2009-05-12 10:50   ` Paul Mundt
2009-05-12 11:18   ` Magnus Damm
2009-05-12 11:18     ` Magnus Damm

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=20090512095745.25477.87326.sendpatchset@rx1.opensource.se \
    --to=magnus.damm@gmail.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-fbdev-devel@lists.sourceforge.net \
    --cc=linux-sh@vger.kernel.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 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.