Linux Framebuffer Layer development
 help / color / mirror / Atom feed
* Re: [PATCH v3 6/8] video: xilinxfb: Add support for little endian accesses
From: Arnd Bergmann @ 2013-05-31 13:38 UTC (permalink / raw)
  To: Michal Simek
  Cc: linux-kernel, Michal Simek, Timur Tabi,
	Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev
In-Reply-To: <c1791574b211528b9f59af634018b7c83678f963.1370004925.git.michal.simek@xilinx.com>

On Friday 31 May 2013 14:55:36 Michal Simek wrote:
> Dynamically detect endianess on IP and use
> ioread/iowrite functions instead of powerpc and microblaze
> specific out_be32.
> 
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>

Acked-by: Arnd Bergmann <arnd@arndb.de>

^ permalink raw reply

* Re: [PATCH v3 7/8] video: xilinxfb: Fix sparse warnings
From: Michal Simek @ 2013-05-31 13:37 UTC (permalink / raw)
  To: Timur Tabi
  Cc: Michal Simek, linux-kernel, Arnd Bergmann,
	Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev
In-Reply-To: <51A8A4ED.6070104@tabi.org>

[-- Attachment #1: Type: text/plain, Size: 1930 bytes --]

On 05/31/2013 03:26 PM, Timur Tabi wrote:
> On 05/31/2013 07:55 AM, Michal Simek wrote:
> 
>> diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c
>> index f3d4a69..e27a4f6 100644
>> --- a/drivers/video/xilinxfb.c
>> +++ b/drivers/video/xilinxfb.c
>> @@ -131,7 +131,7 @@ struct xilinxfb_drvdata {
>>  	dcr_host_t      dcr_host;
>>  	unsigned int    dcr_len;
>>  #endif
>> -	void		*fb_virt;	/* virt. address of the frame buffer */
>> +	void __iomem	*fb_virt;	/* virt. address of the frame buffer */
>>  	dma_addr_t	fb_phys;	/* phys. address of the frame buffer */
>>  	int		fb_alloced;	/* Flag, was the fb memory alloced? */
>>
>> @@ -273,8 +273,10 @@ static int xilinxfb_assign(struct platform_device *pdev,
>>  		drvdata->fb_virt = ioremap(pdata->fb_phys, fbsize);
>>  	} else {
>>  		drvdata->fb_alloced = 1;
>> -		drvdata->fb_virt = dma_alloc_coherent(dev, PAGE_ALIGN(fbsize),
>> -					&drvdata->fb_phys, GFP_KERNEL);
>> +		drvdata->fb_virt = (__force void __iomem *)
>> +				   dma_alloc_coherent(dev, PAGE_ALIGN(fbsize),
>> +						      &drvdata->fb_phys,
>> +						      GFP_KERNEL);
> 
> I think this is wrong.  At least, it would be on PowerPC.
> dma_alloc_coherent() allocates regular RAM, not I/O memory.  So it
> should not be __iomem.

The same is for Microblaze. Driver shares fb_virt for IO memory
and for allocated memory. The purpose of this driver wasn't
to change the driver logic just resolved sparse warnings.
The other way is also wrong.
I have compiled this driver with ppc toolchain and it should
remove sparse warnings for PPC.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

^ permalink raw reply

* Re: [PATCH v3 7/8] video: xilinxfb: Fix sparse warnings
From: Timur Tabi @ 2013-05-31 13:26 UTC (permalink / raw)
  To: Michal Simek
  Cc: linux-kernel, Michal Simek, Arnd Bergmann,
	Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev
In-Reply-To: <ea3d6fcbb9f7a00a9cdbd3d0a7a4d3401265ebf0.1370004925.git.michal.simek@xilinx.com>

On 05/31/2013 07:55 AM, Michal Simek wrote:

> diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c
> index f3d4a69..e27a4f6 100644
> --- a/drivers/video/xilinxfb.c
> +++ b/drivers/video/xilinxfb.c
> @@ -131,7 +131,7 @@ struct xilinxfb_drvdata {
>  	dcr_host_t      dcr_host;
>  	unsigned int    dcr_len;
>  #endif
> -	void		*fb_virt;	/* virt. address of the frame buffer */
> +	void __iomem	*fb_virt;	/* virt. address of the frame buffer */
>  	dma_addr_t	fb_phys;	/* phys. address of the frame buffer */
>  	int		fb_alloced;	/* Flag, was the fb memory alloced? */
> 
> @@ -273,8 +273,10 @@ static int xilinxfb_assign(struct platform_device *pdev,
>  		drvdata->fb_virt = ioremap(pdata->fb_phys, fbsize);
>  	} else {
>  		drvdata->fb_alloced = 1;
> -		drvdata->fb_virt = dma_alloc_coherent(dev, PAGE_ALIGN(fbsize),
> -					&drvdata->fb_phys, GFP_KERNEL);
> +		drvdata->fb_virt = (__force void __iomem *)
> +				   dma_alloc_coherent(dev, PAGE_ALIGN(fbsize),
> +						      &drvdata->fb_phys,
> +						      GFP_KERNEL);

I think this is wrong.  At least, it would be on PowerPC.
dma_alloc_coherent() allocates regular RAM, not I/O memory.  So it
should not be __iomem.



-- 
Timur Tabi

^ permalink raw reply

* Re: [PATCH v3 1/8] video: xilinxfb: Fix OF probing on little-endian systems
From: Michal Simek @ 2013-05-31 13:09 UTC (permalink / raw)
  To: Timur Tabi
  Cc: Michal Simek, linux-kernel, Arnd Bergmann,
	Jean-Christophe Plagniol-Villard, Tomi Valkeinen, Grant Likely,
	Rob Herring, linux-fbdev, devicetree-discuss
In-Reply-To: <51A8A016.3000306@tabi.org>

[-- Attachment #1: Type: text/plain, Size: 829 bytes --]

On 05/31/2013 03:05 PM, Timur Tabi wrote:
> On 05/31/2013 07:55 AM, Michal Simek wrote:
>> -	p = (u32 *)of_get_property(op->dev.of_node, "xlnx,dcr-splb-slave-if", NULL);
>> -	tft_access = p ? *p : 0;
>> +	of_property_read_u32(op->dev.of_node, "xlnx,dcr-splb-slave-if",
>> +			     &tft_access);
> 
> This is okay, but just FYI, you could instead have just used be32_to_cpup().

yep. I was there in v1 but then Soren suggested to use of_property_read_u32
http://lkml.org/lkml/2013/5/29/365

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

^ permalink raw reply

* Re: [PATCH v3 1/8] video: xilinxfb: Fix OF probing on little-endian systems
From: Timur Tabi @ 2013-05-31 13:05 UTC (permalink / raw)
  To: Michal Simek
  Cc: linux-kernel, Michal Simek, Arnd Bergmann,
	Jean-Christophe Plagniol-Villard, Tomi Valkeinen, Grant Likely,
	Rob Herring, linux-fbdev, devicetree-discuss
In-Reply-To: <0a546c3de84c4650d019274debef0ded9007b36f.1370004925.git.michal.simek@xilinx.com>

On 05/31/2013 07:55 AM, Michal Simek wrote:
> -	p = (u32 *)of_get_property(op->dev.of_node, "xlnx,dcr-splb-slave-if", NULL);
> -	tft_access = p ? *p : 0;
> +	of_property_read_u32(op->dev.of_node, "xlnx,dcr-splb-slave-if",
> +			     &tft_access);

This is okay, but just FYI, you could instead have just used be32_to_cpup().

-- 
Timur Tabi

^ permalink raw reply

* [PATCH v3 8/8] video: xilinxfb: Use driver for Xilinx ARM Zynq
From: Michal Simek @ 2013-05-31 12:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Michal Simek, Michal Simek, Arnd Bergmann, Timur Tabi,
	Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev
In-Reply-To: <cover.1370004925.git.michal.simek@xilinx.com>

[-- Attachment #1: Type: text/plain, Size: 717 bytes --]

From: Michal Simek <monstr@monstr.eu>

Enable this driver for all Xilinx platforms.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
Changes in v3: None
Changes in v2: None

 drivers/video/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 2e937bd..2c301f8 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -2188,7 +2188,7 @@ config FB_PS3_DEFAULT_SIZE_M

 config FB_XILINX
 	tristate "Xilinx frame buffer support"
-	depends on FB && (XILINX_VIRTEX || MICROBLAZE)
+	depends on FB && (XILINX_VIRTEX || MICROBLAZE || ARCH_ZYNQ)
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
--
1.8.2.3


[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply related

* [PATCH v3 7/8] video: xilinxfb: Fix sparse warnings
From: Michal Simek @ 2013-05-31 12:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Michal Simek, Michal Simek, Arnd Bergmann, Timur Tabi,
	Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev
In-Reply-To: <cover.1370004925.git.michal.simek@xilinx.com>

[-- Attachment #1: Type: text/plain, Size: 3035 bytes --]

Use proper casting for fb_virt variable.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
Changes in v3:
- New patch in this patchset

Changes in v2: None

 drivers/video/xilinxfb.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c
index f3d4a69..e27a4f6 100644
--- a/drivers/video/xilinxfb.c
+++ b/drivers/video/xilinxfb.c
@@ -131,7 +131,7 @@ struct xilinxfb_drvdata {
 	dcr_host_t      dcr_host;
 	unsigned int    dcr_len;
 #endif
-	void		*fb_virt;	/* virt. address of the frame buffer */
+	void __iomem	*fb_virt;	/* virt. address of the frame buffer */
 	dma_addr_t	fb_phys;	/* phys. address of the frame buffer */
 	int		fb_alloced;	/* Flag, was the fb memory alloced? */

@@ -273,8 +273,10 @@ static int xilinxfb_assign(struct platform_device *pdev,
 		drvdata->fb_virt = ioremap(pdata->fb_phys, fbsize);
 	} else {
 		drvdata->fb_alloced = 1;
-		drvdata->fb_virt = dma_alloc_coherent(dev, PAGE_ALIGN(fbsize),
-					&drvdata->fb_phys, GFP_KERNEL);
+		drvdata->fb_virt = (__force void __iomem *)
+				   dma_alloc_coherent(dev, PAGE_ALIGN(fbsize),
+						      &drvdata->fb_phys,
+						      GFP_KERNEL);
 	}

 	if (!drvdata->fb_virt) {
@@ -287,7 +289,7 @@ static int xilinxfb_assign(struct platform_device *pdev,
 	}

 	/* Clear (turn to black) the framebuffer */
-	memset_io((void __iomem *)drvdata->fb_virt, 0, fbsize);
+	memset_io(drvdata->fb_virt, 0, fbsize);

 	/* Tell the hardware where the frame buffer is */
 	xilinx_fb_out32(drvdata, REG_FB_ADDR, drvdata->fb_phys);
@@ -307,7 +309,7 @@ static int xilinxfb_assign(struct platform_device *pdev,

 	/* Fill struct fb_info */
 	drvdata->info.device = dev;
-	drvdata->info.screen_base = (void __iomem *)drvdata->fb_virt;
+	drvdata->info.screen_base = drvdata->fb_virt;
 	drvdata->info.fbops = &xilinxfb_ops;
 	drvdata->info.fix = xilinx_fb_fix;
 	drvdata->info.fix.smem_start = drvdata->fb_phys;
@@ -341,8 +343,8 @@ static int xilinxfb_assign(struct platform_device *pdev,

 	if (drvdata->flags & BUS_ACCESS_FLAG) {
 		/* Put a banner in the log (for DEBUG) */
-		dev_dbg(dev, "regs: phys=%x, virt=%p\n", drvdata->regs_phys,
-					drvdata->regs);
+		dev_dbg(dev, "regs: phys=%x, virt=%p\n",
+			(u32)drvdata->regs_phys, drvdata->regs);
 	}
 	/* Put a banner in the log (for DEBUG) */
 	dev_dbg(dev, "fb: phys=%llx, virt=%p, size=%x\n",
@@ -355,8 +357,9 @@ err_regfb:

 err_cmap:
 	if (drvdata->fb_alloced)
-		dma_free_coherent(dev, PAGE_ALIGN(fbsize), drvdata->fb_virt,
-			drvdata->fb_phys);
+		dma_free_coherent(dev, PAGE_ALIGN(fbsize),
+				  (__force void *)drvdata->fb_virt,
+				  drvdata->fb_phys);
 	else
 		iounmap(drvdata->fb_virt);

@@ -388,7 +391,8 @@ static int xilinxfb_release(struct device *dev)

 	if (drvdata->fb_alloced)
 		dma_free_coherent(dev, PAGE_ALIGN(drvdata->info.fix.smem_len),
-				  drvdata->fb_virt, drvdata->fb_phys);
+				  (__force void *)drvdata->fb_virt,
+				  drvdata->fb_phys);
 	else
 		iounmap(drvdata->fb_virt);

--
1.8.2.3


[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply related

* [PATCH v3 6/8] video: xilinxfb: Add support for little endian accesses
From: Michal Simek @ 2013-05-31 12:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Michal Simek, Michal Simek, Arnd Bergmann, Timur Tabi,
	Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev
In-Reply-To: <cover.1370004925.git.michal.simek@xilinx.com>

[-- Attachment #1: Type: text/plain, Size: 2287 bytes --]

Dynamically detect endianess on IP and use
ioread/iowrite functions instead of powerpc and microblaze
specific out_be32.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
Changes in v3:
- New patch in this patchset based on discussions

Changes in v2: None

 drivers/video/xilinxfb.c | 30 ++++++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)

diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c
index bd3b85d..f3d4a69 100644
--- a/drivers/video/xilinxfb.c
+++ b/drivers/video/xilinxfb.c
@@ -117,6 +117,7 @@ static struct fb_var_screeninfo xilinx_fb_var = {


 #define BUS_ACCESS_FLAG		0x1 /* 1 = BUS, 0 = DCR */
+#define LITTLE_ENDIAN_ACCESS	0x2 /* LITTLE ENDIAN IO functions */

 struct xilinxfb_drvdata {

@@ -153,14 +154,33 @@ struct xilinxfb_drvdata {
 static void xilinx_fb_out32(struct xilinxfb_drvdata *drvdata, u32 offset,
 				u32 val)
 {
-	if (drvdata->flags & BUS_ACCESS_FLAG)
-		out_be32(drvdata->regs + (offset << 2), val);
+	if (drvdata->flags & BUS_ACCESS_FLAG) {
+		if (drvdata->flags & LITTLE_ENDIAN_ACCESS)
+			iowrite32(val, drvdata->regs + (offset << 2));
+		else
+			iowrite32be(val, drvdata->regs + (offset << 2));
+	}
 #ifdef CONFIG_PPC_DCR
 	else
 		dcr_write(drvdata->dcr_host, offset, val);
 #endif
 }

+static u32 xilinx_fb_in32(struct xilinxfb_drvdata *drvdata, u32 offset)
+{
+	if (drvdata->flags & BUS_ACCESS_FLAG) {
+		if (drvdata->flags & LITTLE_ENDIAN_ACCESS)
+			return ioread32(drvdata->regs + (offset << 2));
+		else
+			return ioread32be(drvdata->regs + (offset << 2));
+	}
+#ifdef CONFIG_PPC_DCR
+	else
+		return dcr_read(drvdata->dcr_host, offset);
+#endif
+	return 0;
+}
+
 static int
 xilinx_fb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue,
 	unsigned transp, struct fb_info *fbi)
@@ -271,6 +291,12 @@ static int xilinxfb_assign(struct platform_device *pdev,

 	/* Tell the hardware where the frame buffer is */
 	xilinx_fb_out32(drvdata, REG_FB_ADDR, drvdata->fb_phys);
+	rc = xilinx_fb_in32(drvdata, REG_FB_ADDR);
+	/* Endianess detection */
+	if (rc != drvdata->fb_phys) {
+		drvdata->flags |= LITTLE_ENDIAN_ACCESS;
+		xilinx_fb_out32(drvdata, REG_FB_ADDR, drvdata->fb_phys);
+	}

 	/* Turn on the display */
 	drvdata->reg_ctrl_default = REG_CTRL_ENABLE;
--
1.8.2.3


[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply related

* [PATCH v3 5/8] video: xilinxfb: Group bus initialization
From: Michal Simek @ 2013-05-31 12:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Michal Simek, Michal Simek, Arnd Bergmann, Timur Tabi,
	Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev
In-Reply-To: <cover.1370004925.git.michal.simek@xilinx.com>

[-- Attachment #1: Type: text/plain, Size: 3797 bytes --]

Move of_address_to_resource() to xilinxfb_assign()
which simplify driver probing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
Changes in v3:
- New patch in this patchset

Changes in v2: None

 drivers/video/xilinxfb.c | 56 +++++++++++++-----------------------------------
 1 file changed, 15 insertions(+), 41 deletions(-)

diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c
index 1b55f18..bd3b85d 100644
--- a/drivers/video/xilinxfb.c
+++ b/drivers/video/xilinxfb.c
@@ -227,33 +227,23 @@ static struct fb_ops xilinxfb_ops =
  * Bus independent setup/teardown
  */

-static int xilinxfb_assign(struct device *dev,
+static int xilinxfb_assign(struct platform_device *pdev,
 			   struct xilinxfb_drvdata *drvdata,
-			   unsigned long physaddr,
 			   struct xilinxfb_platform_data *pdata)
 {
 	int rc;
+	struct device *dev = &pdev->dev;
 	int fbsize = pdata->xvirt * pdata->yvirt * BYTES_PER_PIXEL;

 	if (drvdata->flags & BUS_ACCESS_FLAG) {
-		/*
-		 * Map the control registers in if the controller
-		 * is on direct BUS interface.
-		 */
-		if (!request_mem_region(physaddr, 8, DRIVER_NAME)) {
-			dev_err(dev, "Couldn't lock memory region at 0x%08lX\n",
-				physaddr);
-			rc = -ENODEV;
-			goto err_region;
-		}
+		struct resource *res;

-		drvdata->regs_phys = physaddr;
-		drvdata->regs = ioremap(physaddr, 8);
+		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+		drvdata->regs_phys = res->start;
+		drvdata->regs = devm_request_and_ioremap(&pdev->dev, res);
 		if (!drvdata->regs) {
-			dev_err(dev, "Couldn't lock memory region at 0x%08lX\n",
-				physaddr);
-			rc = -ENODEV;
-			goto err_map;
+			rc = -EADDRNOTAVAIL;
+			goto err_region;
 		}
 	}

@@ -349,11 +339,7 @@ err_cmap:

 err_fbmem:
 	if (drvdata->flags & BUS_ACCESS_FLAG)
-		iounmap(drvdata->regs);
-
-err_map:
-	if (drvdata->flags & BUS_ACCESS_FLAG)
-		release_mem_region(drvdata->regs_phys, 8);
+		devm_iounmap(dev, drvdata->regs);

 err_region:
 	kfree(drvdata);
@@ -384,10 +370,8 @@ static int xilinxfb_release(struct device *dev)
 	xilinx_fb_out32(drvdata, REG_CTRL, 0);

 	/* Release the resources, as allocated based on interface */
-	if (drvdata->flags & BUS_ACCESS_FLAG) {
-		iounmap(drvdata->regs);
-		release_mem_region(drvdata->regs_phys, 8);
-	}
+	if (drvdata->flags & BUS_ACCESS_FLAG)
+		devm_iounmap(dev, drvdata->regs);
 #ifdef CONFIG_PPC_DCR
 	else
 		dcr_unmap(drvdata->dcr_host, drvdata->dcr_len);
@@ -408,8 +392,7 @@ static int xilinxfb_of_probe(struct platform_device *op)
 	const u32 *prop;
 	u32 tft_access = 0;
 	struct xilinxfb_platform_data pdata;
-	struct resource res;
-	int size, rc;
+	int size;
 	struct xilinxfb_drvdata *drvdata;

 	/* Copy with the default pdata (not a ptr reference!) */
@@ -435,22 +418,17 @@ static int xilinxfb_of_probe(struct platform_device *op)
 	 */
 	if (tft_access) {
 		drvdata->flags |= BUS_ACCESS_FLAG;
-		rc = of_address_to_resource(op->dev.of_node, 0, &res);
-		if (rc) {
-			dev_err(&op->dev, "invalid address\n");
-			goto err;
-		}
 	}
 #ifdef CONFIG_PPC_DCR
 	else {
 		int start;
-		res.start = 0;
 		start = dcr_resource_start(op->dev.of_node, 0);
 		drvdata->dcr_len = dcr_resource_len(op->dev.of_node, 0);
 		drvdata->dcr_host = dcr_map(op->dev.of_node, start, drvdata->dcr_len);
 		if (!DCR_MAP_OK(drvdata->dcr_host)) {
 			dev_err(&op->dev, "invalid DCR address\n");
-			goto err;
+			kfree(drvdata);
+			return -ENODEV;
 		}
 	}
 #endif
@@ -477,11 +455,7 @@ static int xilinxfb_of_probe(struct platform_device *op)
 		pdata.rotate_screen = 1;

 	dev_set_drvdata(&op->dev, drvdata);
-	return xilinxfb_assign(&op->dev, drvdata, res.start, &pdata);
-
- err:
-	kfree(drvdata);
-	return -ENODEV;
+	return xilinxfb_assign(op, drvdata, &pdata);
 }

 static int xilinxfb_of_remove(struct platform_device *op)
--
1.8.2.3


[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply related

* [PATCH v3 4/8] video: xilinxfb: Use drvdata->regs_phys instead of physaddr
From: Michal Simek @ 2013-05-31 12:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Michal Simek, Michal Simek, Arnd Bergmann, Timur Tabi,
	Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev
In-Reply-To: <cover.1370004925.git.michal.simek@xilinx.com>

[-- Attachment #1: Type: text/plain, Size: 983 bytes --]

physaddr will be remove in the next patch.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
Changes in v3:
- New patch in this patchset based on discussions

Changes in v2: None

 drivers/video/xilinxfb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c
index d94c992..1b55f18 100644
--- a/drivers/video/xilinxfb.c
+++ b/drivers/video/xilinxfb.c
@@ -325,7 +325,7 @@ static int xilinxfb_assign(struct device *dev,

 	if (drvdata->flags & BUS_ACCESS_FLAG) {
 		/* Put a banner in the log (for DEBUG) */
-		dev_dbg(dev, "regs: phys=%lx, virt=%p\n", physaddr,
+		dev_dbg(dev, "regs: phys=%x, virt=%p\n", drvdata->regs_phys,
 					drvdata->regs);
 	}
 	/* Put a banner in the log (for DEBUG) */
@@ -353,7 +353,7 @@ err_fbmem:

 err_map:
 	if (drvdata->flags & BUS_ACCESS_FLAG)
-		release_mem_region(physaddr, 8);
+		release_mem_region(drvdata->regs_phys, 8);

 err_region:
 	kfree(drvdata);
--
1.8.2.3


[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply related

* [PATCH v3 3/8] video: xilinxfb: Rename PLB_ACCESS_FLAG to BUS_ACCESS_FLAG
From: Michal Simek @ 2013-05-31 12:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Michal Simek, Michal Simek, Arnd Bergmann, Timur Tabi,
	Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev
In-Reply-To: <cover.1370004925.git.michal.simek@xilinx.com>

[-- Attachment #1: Type: text/plain, Size: 4801 bytes --]

Using only PLB name is wrong for a long time because
the same access functions are also used for AXI.
s/PLB/BUS/g

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
Changes in v3:
- New patch in this patchset based on discussions

Changes in v2: None

 drivers/video/xilinxfb.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c
index c9b442b..d94c992 100644
--- a/drivers/video/xilinxfb.c
+++ b/drivers/video/xilinxfb.c
@@ -44,7 +44,7 @@


 /*
- * Xilinx calls it "PLB TFT LCD Controller" though it can also be used for
+ * Xilinx calls it "TFT LCD Controller" though it can also be used for
  * the VGA port on the Xilinx ML40x board. This is a hardware display
  * controller for a 640x480 resolution TFT or VGA screen.
  *
@@ -54,11 +54,11 @@
  * don't start thinking about scrolling).  The second allows the LCD to
  * be turned on or off as well as rotated 180 degrees.
  *
- * In case of direct PLB access the second control register will be at
+ * In case of direct BUS access the second control register will be at
  * an offset of 4 as compared to the DCR access where the offset is 1
  * i.e. REG_CTRL. So this is taken care in the function
  * xilinx_fb_out32 where it left shifts the offset 2 times in case of
- * direct PLB access.
+ * direct BUS access.
  */
 #define NUM_REGS	2
 #define REG_FB_ADDR	0
@@ -116,7 +116,7 @@ static struct fb_var_screeninfo xilinx_fb_var = {
 };


-#define PLB_ACCESS_FLAG	0x1		/* 1 = PLB, 0 = DCR */
+#define BUS_ACCESS_FLAG		0x1 /* 1 = BUS, 0 = DCR */

 struct xilinxfb_drvdata {

@@ -146,14 +146,14 @@ struct xilinxfb_drvdata {
 	container_of(_info, struct xilinxfb_drvdata, info)

 /*
- * The XPS TFT Controller can be accessed through PLB or DCR interface.
+ * The XPS TFT Controller can be accessed through BUS or DCR interface.
  * To perform the read/write on the registers we need to check on
  * which bus its connected and call the appropriate write API.
  */
 static void xilinx_fb_out32(struct xilinxfb_drvdata *drvdata, u32 offset,
 				u32 val)
 {
-	if (drvdata->flags & PLB_ACCESS_FLAG)
+	if (drvdata->flags & BUS_ACCESS_FLAG)
 		out_be32(drvdata->regs + (offset << 2), val);
 #ifdef CONFIG_PPC_DCR
 	else
@@ -235,10 +235,10 @@ static int xilinxfb_assign(struct device *dev,
 	int rc;
 	int fbsize = pdata->xvirt * pdata->yvirt * BYTES_PER_PIXEL;

-	if (drvdata->flags & PLB_ACCESS_FLAG) {
+	if (drvdata->flags & BUS_ACCESS_FLAG) {
 		/*
 		 * Map the control registers in if the controller
-		 * is on direct PLB interface.
+		 * is on direct BUS interface.
 		 */
 		if (!request_mem_region(physaddr, 8, DRIVER_NAME)) {
 			dev_err(dev, "Couldn't lock memory region at 0x%08lX\n",
@@ -270,7 +270,7 @@ static int xilinxfb_assign(struct device *dev,
 	if (!drvdata->fb_virt) {
 		dev_err(dev, "Could not allocate frame buffer memory\n");
 		rc = -ENOMEM;
-		if (drvdata->flags & PLB_ACCESS_FLAG)
+		if (drvdata->flags & BUS_ACCESS_FLAG)
 			goto err_fbmem;
 		else
 			goto err_region;
@@ -323,7 +323,7 @@ static int xilinxfb_assign(struct device *dev,
 		goto err_regfb;
 	}

-	if (drvdata->flags & PLB_ACCESS_FLAG) {
+	if (drvdata->flags & BUS_ACCESS_FLAG) {
 		/* Put a banner in the log (for DEBUG) */
 		dev_dbg(dev, "regs: phys=%lx, virt=%p\n", physaddr,
 					drvdata->regs);
@@ -348,11 +348,11 @@ err_cmap:
 	xilinx_fb_out32(drvdata, REG_CTRL, 0);

 err_fbmem:
-	if (drvdata->flags & PLB_ACCESS_FLAG)
+	if (drvdata->flags & BUS_ACCESS_FLAG)
 		iounmap(drvdata->regs);

 err_map:
-	if (drvdata->flags & PLB_ACCESS_FLAG)
+	if (drvdata->flags & BUS_ACCESS_FLAG)
 		release_mem_region(physaddr, 8);

 err_region:
@@ -384,7 +384,7 @@ static int xilinxfb_release(struct device *dev)
 	xilinx_fb_out32(drvdata, REG_CTRL, 0);

 	/* Release the resources, as allocated based on interface */
-	if (drvdata->flags & PLB_ACCESS_FLAG) {
+	if (drvdata->flags & BUS_ACCESS_FLAG) {
 		iounmap(drvdata->regs);
 		release_mem_region(drvdata->regs_phys, 8);
 	}
@@ -423,18 +423,18 @@ static int xilinxfb_of_probe(struct platform_device *op)
 	}

 	/*
-	 * To check whether the core is connected directly to DCR or PLB
+	 * To check whether the core is connected directly to DCR or BUS
 	 * interface and initialize the tft_access accordingly.
 	 */
 	of_property_read_u32(op->dev.of_node, "xlnx,dcr-splb-slave-if",
 			     &tft_access);

 	/*
-	 * Fill the resource structure if its direct PLB interface
+	 * Fill the resource structure if its direct BUS interface
 	 * otherwise fill the dcr_host structure.
 	 */
 	if (tft_access) {
-		drvdata->flags |= PLB_ACCESS_FLAG;
+		drvdata->flags |= BUS_ACCESS_FLAG;
 		rc = of_address_to_resource(op->dev.of_node, 0, &res);
 		if (rc) {
 			dev_err(&op->dev, "invalid address\n");
--
1.8.2.3


[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply related

* [PATCH v3 2/8] video: xilinxfb: Do not name out_be32 in function name
From: Michal Simek @ 2013-05-31 12:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Michal Simek, Michal Simek, Arnd Bergmann, Timur Tabi,
	Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev
In-Reply-To: <cover.1370004925.git.michal.simek@xilinx.com>

[-- Attachment #1: Type: text/plain, Size: 3208 bytes --]

out_be32 IO function is not supported by ARM.
It is only available for PPC and Microblaze.
Because this driver can be used on ARM let's
remove out_be32 from function name.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
Changes in v3:
- Remove out_be IO name from function name
- Change patch subject from "Do not use out_be32 IO function"
  to "Do not name out_be32 in function name"

Changes in v2: None

 drivers/video/xilinxfb.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c
index aecd15d..c9b442b 100644
--- a/drivers/video/xilinxfb.c
+++ b/drivers/video/xilinxfb.c
@@ -57,7 +57,7 @@
  * In case of direct PLB access the second control register will be at
  * an offset of 4 as compared to the DCR access where the offset is 1
  * i.e. REG_CTRL. So this is taken care in the function
- * xilinx_fb_out_be32 where it left shifts the offset 2 times in case of
+ * xilinx_fb_out32 where it left shifts the offset 2 times in case of
  * direct PLB access.
  */
 #define NUM_REGS	2
@@ -150,7 +150,7 @@ struct xilinxfb_drvdata {
  * To perform the read/write on the registers we need to check on
  * which bus its connected and call the appropriate write API.
  */
-static void xilinx_fb_out_be32(struct xilinxfb_drvdata *drvdata, u32 offset,
+static void xilinx_fb_out32(struct xilinxfb_drvdata *drvdata, u32 offset,
 				u32 val)
 {
 	if (drvdata->flags & PLB_ACCESS_FLAG)
@@ -197,7 +197,7 @@ xilinx_fb_blank(int blank_mode, struct fb_info *fbi)
 	switch (blank_mode) {
 	case FB_BLANK_UNBLANK:
 		/* turn on panel */
-		xilinx_fb_out_be32(drvdata, REG_CTRL, drvdata->reg_ctrl_default);
+		xilinx_fb_out32(drvdata, REG_CTRL, drvdata->reg_ctrl_default);
 		break;

 	case FB_BLANK_NORMAL:
@@ -205,7 +205,7 @@ xilinx_fb_blank(int blank_mode, struct fb_info *fbi)
 	case FB_BLANK_HSYNC_SUSPEND:
 	case FB_BLANK_POWERDOWN:
 		/* turn off panel */
-		xilinx_fb_out_be32(drvdata, REG_CTRL, 0);
+		xilinx_fb_out32(drvdata, REG_CTRL, 0);
 	default:
 		break;

@@ -280,13 +280,13 @@ static int xilinxfb_assign(struct device *dev,
 	memset_io((void __iomem *)drvdata->fb_virt, 0, fbsize);

 	/* Tell the hardware where the frame buffer is */
-	xilinx_fb_out_be32(drvdata, REG_FB_ADDR, drvdata->fb_phys);
+	xilinx_fb_out32(drvdata, REG_FB_ADDR, drvdata->fb_phys);

 	/* Turn on the display */
 	drvdata->reg_ctrl_default = REG_CTRL_ENABLE;
 	if (pdata->rotate_screen)
 		drvdata->reg_ctrl_default |= REG_CTRL_ROTATE;
-	xilinx_fb_out_be32(drvdata, REG_CTRL,
+	xilinx_fb_out32(drvdata, REG_CTRL,
 					drvdata->reg_ctrl_default);

 	/* Fill struct fb_info */
@@ -345,7 +345,7 @@ err_cmap:
 		iounmap(drvdata->fb_virt);

 	/* Turn off the display */
-	xilinx_fb_out_be32(drvdata, REG_CTRL, 0);
+	xilinx_fb_out32(drvdata, REG_CTRL, 0);

 err_fbmem:
 	if (drvdata->flags & PLB_ACCESS_FLAG)
@@ -381,7 +381,7 @@ static int xilinxfb_release(struct device *dev)
 		iounmap(drvdata->fb_virt);

 	/* Turn off the display */
-	xilinx_fb_out_be32(drvdata, REG_CTRL, 0);
+	xilinx_fb_out32(drvdata, REG_CTRL, 0);

 	/* Release the resources, as allocated based on interface */
 	if (drvdata->flags & PLB_ACCESS_FLAG) {
--
1.8.2.3


[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply related

* [PATCH v3 1/8] video: xilinxfb: Fix OF probing on little-endian systems
From: Michal Simek @ 2013-05-31 12:55 UTC (permalink / raw)
  To: linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Michal Simek,
	Rob Herring, Timur Tabi, Tomi Valkeinen,
	linux-fbdev-u79uwXL29TY76Z2rM5mHXA, Grant Likely
In-Reply-To: <cover.1370004925.git.michal.simek-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1355 bytes --]

From: Michal Simek <monstr@monstr.eu>

DTB is always big-endian that's why it is necessary
to properly convert value (*p).
It is automatically done in of_property_read_u32().

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
Changes in v3: None
Changes in v2:
- use of_property_read_u32 helper function
Series-changes: 3
- fix commit message

 drivers/video/xilinxfb.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c
index af0b4fd..aecd15d 100644
--- a/drivers/video/xilinxfb.c
+++ b/drivers/video/xilinxfb.c
@@ -406,8 +406,7 @@ static int xilinxfb_release(struct device *dev)
 static int xilinxfb_of_probe(struct platform_device *op)
 {
 	const u32 *prop;
-	u32 *p;
-	u32 tft_access;
+	u32 tft_access = 0;
 	struct xilinxfb_platform_data pdata;
 	struct resource res;
 	int size, rc;
@@ -427,8 +426,8 @@ static int xilinxfb_of_probe(struct platform_device *op)
 	 * To check whether the core is connected directly to DCR or PLB
 	 * interface and initialize the tft_access accordingly.
 	 */
-	p = (u32 *)of_get_property(op->dev.of_node, "xlnx,dcr-splb-slave-if", NULL);
-	tft_access = p ? *p : 0;
+	of_property_read_u32(op->dev.of_node, "xlnx,dcr-splb-slave-if",
+			     &tft_access);

 	/*
 	 * Fill the resource structure if its direct PLB interface
--
1.8.2.3


[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply related

* [PATCH v3 0/8] xilinxfb changes
From: Michal Simek @ 2013-05-31 12:55 UTC (permalink / raw)
  To: linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: Timur Tabi, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-fbdev-u79uwXL29TY76Z2rM5mHXA, Rob Herring, Michal Simek,
	Tomi Valkeinen, Grant Likely

[-- Attachment #1: Type: text/plain, Size: 1341 bytes --]

Hi,

I have done more changes in the driver to support probing
on little and big endian system where detection is done
directly on the hardware.
I have also done some cleanups to get it to the better shape.

Thanks for your review,
Michal

Changes in v3:
- Remove out_be IO name from function name
- Change patch subject from "Do not use out_be32 IO function"
  to "Do not name out_be32 in function name"
- New patch in this patchset based on discussions
- New patch in this patchset based on discussions
- New patch in this patchset
- New patch in this patchset based on discussions
- New patch in this patchset

Changes in v2:
- use of_property_read_u32 helper function
Series-changes: 3
- fix commit message

Michal Simek (8):
  video: xilinxfb: Fix OF probing on little-endian systems
  video: xilinxfb: Do not name out_be32 in function name
  video: xilinxfb: Rename PLB_ACCESS_FLAG to BUS_ACCESS_FLAG
  video: xilinxfb: Use drvdata->regs_phys instead of physaddr
  video: xilinxfb: Group bus initialization
  video: xilinxfb: Add support for little endian accesses
  video: xilinxfb: Fix sparse warnings
  video: xilinxfb: Use driver for Xilinx ARM Zynq

 drivers/video/Kconfig    |   2 +-
 drivers/video/xilinxfb.c | 157 ++++++++++++++++++++++++-----------------------
 2 files changed, 81 insertions(+), 78 deletions(-)

--
1.8.2.3


[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply

* [PATCH 10/11] video: da8xx-fb: adopt pinctrl support
From: Hebbar Gururaja @ 2013-05-31 10:25 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1369995191-20855-1-git-send-email-gururaja.hebbar@ti.com>

Amend the da8xx-fb controller to optionally take a pin control handle
and set the state of the pins to:

- "default" on boot, resume
- "sleep" on suspend()

By optionally putting the pins into sleep state in the suspend callback
we can accomplish two things.
- One is to minimize current leakage from pins and thus save power,
- second, we can prevent the IP from driving pins output in an
uncontrolled manner, which may happen if the power domain drops the
domain regulator.

If any of the above pin states are missing in dt, a warning message
about the missing state is displayed.
If certain pin-states are not available, to remove this warning message
pass respective state name with null phandler.

Todo:
        - if an idle state is available for pins, add support for it.

Signed-off-by: Hebbar Gururaja <gururaja.hebbar@ti.com>
Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: linux-fbdev@vger.kernel.org
---
:100644 100644 0810939... 10c8036... M	drivers/video/da8xx-fb.c
 drivers/video/da8xx-fb.c |   48 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 0810939..10c8036 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -36,6 +36,7 @@
 #include <linux/slab.h>
 #include <linux/delay.h>
 #include <linux/lcm.h>
+#include <linux/pinctrl/consumer.h>
 #include <video/da8xx-fb.h>
 #include <asm/div64.h>
 
@@ -182,6 +183,11 @@ struct da8xx_fb_par {
 #endif
 	void (*panel_power_ctrl)(int);
 	u32 pseudo_palette[16];
+
+	/* two pin states - default, sleep */
+	struct pinctrl			*pinctrl;
+	struct pinctrl_state		*pins_default;
+	struct pinctrl_state		*pins_sleep;
 };
 
 /* Variable Screen Information */
@@ -1306,6 +1312,36 @@ static int fb_probe(struct platform_device *device)
 	par->lcd_fck_rate = clk_get_rate(fb_clk);
 #endif
 	par->pxl_clk = lcdc_info->pixclock;
+
+	par->pinctrl = devm_pinctrl_get(&device->dev);
+	if (!IS_ERR(par->pinctrl)) {
+		par->pins_default = pinctrl_lookup_state(par->pinctrl,
+							 PINCTRL_STATE_DEFAULT);
+		if (IS_ERR(par->pins_default))
+			dev_dbg(&device->dev, "could not get default pinstate\n");
+		else
+			if (pinctrl_select_state(par->pinctrl,
+						 par->pins_default))
+				dev_err(&device->dev,
+					"could not set default pinstate\n");
+
+		par->pins_sleep = pinctrl_lookup_state(par->pinctrl,
+						       PINCTRL_STATE_SLEEP);
+		if (IS_ERR(par->pins_sleep))
+			dev_dbg(&device->dev, "could not get sleep pinstate\n");
+	} else {
+		/*
+		* Since we continue even when pinctrl node is not found,
+		* Invalidate pins as not available. This is to make sure that
+		* IS_ERR(pins_xxx) results in failure when used.
+		*/
+		par->pins_default = ERR_PTR(-ENODATA);
+		par->pins_sleep = ERR_PTR(-ENODATA);
+
+		dev_dbg(&device->dev, "did not get pins for lcd error: %li\n",
+			PTR_ERR(par->pinctrl));
+	}
+
 	if (fb_pdata->panel_power_ctrl) {
 		par->panel_power_ctrl = fb_pdata->panel_power_ctrl;
 		par->panel_power_ctrl(1);
@@ -1551,6 +1587,12 @@ static int fb_suspend(struct platform_device *dev, pm_message_t state)
 	pm_runtime_put_sync(&dev->dev);
 	console_unlock();
 
+	/* Optionally let pins go into sleep states */
+	if (!IS_ERR(par->pins_sleep))
+		if (pinctrl_select_state(par->pinctrl, par->pins_sleep))
+			dev_err(&dev->dev,
+				"could not set pins to sleep state\n");
+
 	return 0;
 }
 static int fb_resume(struct platform_device *dev)
@@ -1560,6 +1602,12 @@ static int fb_resume(struct platform_device *dev)
 
 	console_lock();
 	pm_runtime_get_sync(&dev->dev);
+
+	/* Optionaly enable pins to be muxed in and configured */
+	if (!IS_ERR(par->pins_default))
+		if (pinctrl_select_state(par->pinctrl, par->pins_default))
+			dev_err(&dev->dev, "could not set default pins\n");
+
 	lcd_context_restore();
 	if (par->blank = FB_BLANK_UNBLANK) {
 		lcd_enable_raster();
-- 
1.7.9.5


^ permalink raw reply related

* Re: [PATCH v2 2/3] video: xilinxfb: Do not use out_be32 IO function
From: Michal Simek @ 2013-05-31  7:39 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Michal Simek, linux-kernel, Florian Tobias Schandinat,
	linux-fbdev
In-Reply-To: <3808365.SOUxDqkW9J@wuerfel>

[-- Attachment #1: Type: text/plain, Size: 1684 bytes --]

On 05/31/2013 12:04 AM, Arnd Bergmann wrote:
> On Thursday 30 May 2013 11:41:01 Michal Simek wrote:
>>   * To perform the read/write on the registers we need to check on
>>   * which bus its connected and call the appropriate write API.
>>   */
>> -static void xilinx_fb_out_be32(struct xilinxfb_drvdata *drvdata, u32 offset,
>> +static void xilinx_fb_out32(struct xilinxfb_drvdata *drvdata, u32 offset,
>>                                 u32 val)
>>  {
>>         if (drvdata->flags & PLB_ACCESS_FLAG)
>> -               out_be32(drvdata->regs + (offset << 2), val);
>> +               __raw_writel(val, drvdata->regs + (offset << 2));
>>  #ifdef CONFIG_PPC_DCR
>>         else
>>                 dcr_write(drvdata->dcr_host, offset, val);
>>
> 
> This is probably missing barriers, and is wrong on systems on which
> the endianess of the device is different from the CPU.
> 
> You already have an indirection in there, so I guess it won't hurt
> to create a third case for little-endian registers and add
> another bit in drvdata->flags, or make it depend on the architecture,
> if the endianess of the device registers is known at compile time.

The PLB_ACCESS_FLAGS is incorrectly named. It means BUS_ACCESS.
But I will find a way how to autodetect endianess directly on IP
as I have done it for uartlite and will send v3.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

^ permalink raw reply

* linux-next: fbdev-next inclusing
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-05-31  5:13 UTC (permalink / raw)
  To: linux-fbdev

HI,

	Could you include the new fbdev -next in the linux-next please?

	git://git.kernel.org/pub/scm/linux/kernel/git/plagnioj/linux-fbdev.git for-next

Best Regards,
J.

^ permalink raw reply

* Re: [PATCH] backlight: Turn backlight on/off when necessary
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-05-31  5:02 UTC (permalink / raw)
  To: Liu Ying; +Cc: Liu Ying, Florian Tobias Schandinat, linux-fbdev, linux-kernel
In-Reply-To: <CA+8Hj80pF_zNqr8DC70FV0=NU39QbZOZm=2YeJSGEnr4aEFT4g@mail.gmail.com>

On 10:31 Fri 31 May     , Liu Ying wrote:
>    2013/5/30 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> 
>      On 16:13 Thu 30 May     , Liu Ying wrote:
>      > We don't have to turn backlight on/off everytime a blanking
>      > or unblanking event comes because the backlight status may have
>      > already been what we want. Another thought is that one backlight
>      > device may be shared by multiple framebuffers. We don't hope that
>      > blanking one of the framebuffers would turn the backlight off for
>      > all the other framebuffers, since they are likely active to show
>      > display content. This patch adds logic to record each framebuffer's
>      > backlight status to determine the backlight device use count and
>      > whether the backlight should be turned on or off.
>      >
>      > Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
>      > ---
>      >  drivers/video/backlight/backlight.c |   23 +++++++++++++++++------
>      >  include/linux/backlight.h           |    6 ++++++
>      >  2 files changed, 23 insertions(+), 6 deletions(-)
>      >
>      > diff --git a/drivers/video/backlight/backlight.c
>      b/drivers/video/backlight/backlight.c
>      > index c74e7aa..97ea2b8 100644
>      > --- a/drivers/video/backlight/backlight.c
>      > +++ b/drivers/video/backlight/backlight.c
>      > @@ -31,13 +31,14 @@ static const char *const backlight_types[] = {
>      >                        
>       defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE))
>      >  /* This callback gets called when something important happens inside
>      a
>      >   * framebuffer driver. We're looking if that important event is
>      blanking,
>      > - * and if it is, we're switching backlight power as well ...
>      > + * and if it is and necessary, we're switching backlight power as
>      well ...
>      >   */
>      >  static int fb_notifier_callback(struct notifier_block *self,
>      >                               unsigned long event, void *data)
>      >  {
>      >       struct backlight_device *bd;
>      >       struct fb_event *evdata = data;
>      > +     int node = evdata->info->node;
>      >
>      >       /* If we aren't interested in this event, skip it immediately
>      ... */
>      >       if (event != FB_EVENT_BLANK && event != FB_EVENT_CONBLANK)
>      > @@ -49,11 +50,21 @@ static int fb_notifier_callback(struct
>      notifier_block *self,
>      >               if (!bd->ops->check_fb ||
>      >                   bd->ops->check_fb(bd, evdata->info)) {
>      >                       bd->props.fb_blank = *(int *)evdata->data;
>      > -                     if (bd->props.fb_blank = FB_BLANK_UNBLANK)
>      > -                             bd->props.state &= ~BL_CORE_FBBLANK;
>      > -                     else
>      > -                             bd->props.state |= BL_CORE_FBBLANK;
>      > -                     backlight_update_status(bd);
>      > +                     if (bd->props.fb_blank = FB_BLANK_UNBLANK &&
>      > +                         !bd->fb_bl_on[node]) {
>      > +                             bd->fb_bl_on[node] = true;
>      > +                             if (!bd->use_count++) {
>      > +                                     bd->props.state &>      ~BL_CORE_FBBLANK;
>      > +                                     backlight_update_status(bd);
>      > +                             }
>      > +                     } else if (bd->props.fb_blank !>      FB_BLANK_UNBLANK &&
>      > +                                bd->fb_bl_on[node]) {
>      > +                             bd->fb_bl_on[node] = false;
>      > +                             if (!(--bd->use_count)) {
>      > +                                     bd->props.state |>      BL_CORE_FBBLANK;
>      > +                                     backlight_update_status(bd);
>      > +                             }
>      > +                     }
>      >               }
>      >       mutex_unlock(&bd->ops_lock);
>      >       return 0;
>      > diff --git a/include/linux/backlight.h b/include/linux/backlight.h
>      > index da9a082..5de71a0 100644
>      > --- a/include/linux/backlight.h
>      > +++ b/include/linux/backlight.h
>      > @@ -9,6 +9,7 @@
>      >  #define _LINUX_BACKLIGHT_H
>      >
>      >  #include <linux/device.h>
>      > +#include <linux/fb.h>
>      >  #include <linux/mutex.h>
>      >  #include <linux/notifier.h>
>      >
>      > @@ -101,6 +102,11 @@ struct backlight_device {
>      >       struct notifier_block fb_notif;
>      >
>      >       struct device dev;
>      > +
>      > +     /* Multiple framebuffers may share one backlight device */
>      > +     bool fb_bl_on[FB_MAX];
> 
>      I don't like such array at all
> 
>      I understand the fact you will have only on hw backlight for x fb or
>      overlay
>      but have a static on no
> 
>     
>    My board has two LVDS display panels. They share one PWM backlight.
>    The framebuffer HW engine may drive a background framebuffer and an
>    overlay framebuffer on one panel, and only one background framebuffer on
>    the other panel. The three framebuffers may be active simultaneously.
>     
> 
>      if you want to track all user create a strcut and register it or do more
>      simple just as a int to count the number of user and shut down it if 0
>      and
>      enable it otherwise
> 
>    Users may unblank a framebuffer for multiple times continuously and then
>    trigger a blanking operation.
>    If that framebuffer is the only user of the backlight, the backlight will
>    be turned off after the blanking operation.
>    This is the behavior before this patch is applied to kernel. And, this
>    patch doesn't change the behavior here.
>    So, it seems that it is reasonable to record backlight status(on or off)
>    for framebuffers. And, I use a straightforward array for the recording. 
>    I thought about changing to use a list instead for the recording, but it
>    appears to me it would take more CPU cycles to search and update entries.
>    It is basically a kind of space-against-speed trade-off.
>    You probably have already provided me a better way to do this, but it
>    looks I didn't catch it. If this is the case, would you please shed more
>    light on this? Thanks!

so just use a int

check who we do for clk_enable/disable on at91

arch/arm/mach-at91/clock.c

Best Regards,
J.
> 
>      Best Regards,
>      J.
>      > +
>      > +     int use_count;
>      >  };
>      >
>      >  static inline void backlight_update_status(struct backlight_device
>      *bd)
>      > --
>      > 1.7.1
>      >
>      >
>      > --
>      > To unsubscribe from this list: send the line "unsubscribe linux-fbdev"
>      in
>      > the body of a message to majordomo@vger.kernel.org
>      > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
>    --
>    Best Regards,
>    Liu Ying

^ permalink raw reply

* Re: [PATCH] fbdev: bfin-lq035q1-fb: Use dev_pm_ops
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-05-31  5:01 UTC (permalink / raw)
  To: Jingoo Han
  Cc: 'Rafael J. Wysocki', 'Lars-Peter Clausen',
	'Michael Hennerich', 'Tomi Valkeinen',
	linux-fbdev, linux-pm
In-Reply-To: <000a01ce5daf$8b228b80$a167a280$@samsung.com>

On 12:32 Fri 31 May     , Jingoo Han wrote:
> On Thursday, May 30, 2013 7:46 PM, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > On 09:52 Thu 30 May     , Lars-Peter Clausen wrote:
> > > On 05/30/2013 09:14 AM, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > > On 09:32 Thu 30 May     , Jingoo Han wrote:
> > > >> On Thursday, May 30, 2013 4:20 AM, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > >>> On 16:24 Wed 29 May     , Michael Hennerich wrote:
> > > >>>> On 05/29/2013 02:17 PM, Lars-Peter Clausen wrote:
> > > >>>>> Use dev_pm_ops instead of the legacy suspend/resume callbacks.
> > > >>>>>
> > > >>>>> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> > > >>>> Acked-by: Michael Hennerich <michael.hennerich@analog.com>
> > > >>>>> ---
> > > >>>>>  drivers/video/bfin-lq035q1-fb.c | 22 ++++++++++++++--------
> > > >>>>>  1 file changed, 14 insertions(+), 8 deletions(-)
> > > >>>>>
> > > >>>>> diff --git a/drivers/video/bfin-lq035q1-fb.c b/drivers/video/bfin-lq035q1-fb.c
> > > >>>>> index 29d8c04..6084c17 100644
> > > >>>>> --- a/drivers/video/bfin-lq035q1-fb.c
> > > >>>>> +++ b/drivers/video/bfin-lq035q1-fb.c
> > > >>>>> @@ -170,16 +170,19 @@ static int lq035q1_spidev_remove(struct spi_device *spi)
> > > >>>>>  	return lq035q1_control(spi, LQ035_SHUT_CTL, LQ035_SHUT);
> > > >>>>>  }
> > > >>>>> -#ifdef CONFIG_PM
> > > >>>>> -static int lq035q1_spidev_suspend(struct spi_device *spi, pm_message_t state)
> > > >>>>> +#ifdef CONFIG_PM_SLEEP
> > > >>>>> +static int lq035q1_spidev_suspend(struct device *dev)
> > > >>>>>  {
> > > >>>>> +	struct spi_device *spi = to_spi_device(dev);
> > > >>>>> +
> > > >>>>>  	return lq035q1_control(spi, LQ035_SHUT_CTL, LQ035_SHUT);
> > > >>>>>  }
> > > >>>>> -static int lq035q1_spidev_resume(struct spi_device *spi)
> > > >>>>> +static int lq035q1_spidev_resume(struct device *dev)
> > > >>>>>  {
> > > >>>>> -	int ret;
> > > >>>>> +	struct spi_device *spi = to_spi_device(dev);
> > > >>>>>  	struct spi_control *ctl = spi_get_drvdata(spi);
> > > >>>>> +	int ret;
> > > >>>>>  	ret = lq035q1_control(spi, LQ035_DRIVER_OUTPUT_CTL, ctl->mode);
> > > >>>>>  	if (ret)
> > > >>>>> @@ -187,9 +190,13 @@ static int lq035q1_spidev_resume(struct spi_device *spi)
> > > >>>>>  	return lq035q1_control(spi, LQ035_SHUT_CTL, LQ035_ON);
> > > >>>>>  }
> > > >>>>> +
> > > >>>>> +static SIMPLE_DEV_PM_OPS(lq035q1_spidev_pm_ops, lq035q1_spidev_suspend,
> > > >>>>> +	lq035q1_spidev_resume);
> > > >>>>> +#define LQ035Q1_SPIDEV_PM_OPS (&lq035q1_spidev_pm_ops)
> > > >>>>> +
> > > >>>>>  #else
> > > >>>>> -# define lq035q1_spidev_suspend NULL
> > > >>>>> -# define lq035q1_spidev_resume  NULL
> > > >>>>> +#define LQ035Q1_SPIDEV_PM_OPS NULL
> > > >>>>>  #endif
> > > >>> we really need to ahve a macro like for DT of_match_ptr to drop the #else
> > > >>
> > > >> Hi Jean-Christophe PLAGNIOL-VILLARD,
> > > >>
> > > >> I submitted the following patch. :)
> > > >> (https://patchwork.kernel.org/patch/2502971/)
> > > >>
> > > >> --- a/include/linux/pm.h
> > > >> +++ b/include/linux/pm.h
> > > >> @@ -55,8 +55,10 @@  struct device;
> > > >>
> > > >>  #ifdef CONFIG_PM
> > > >>  extern const char power_group_name[];		/* = "power" */
> > > >> +#define pm_ops_ptr(_ptr)	(_ptr)
> > > >>  #else
> > > >>  #define power_group_name	NULL
> > > >> +#define pm_ops_ptr(_ptr)	NULL
> > > >>  #endif
> > > >>
> > > >>
> > > >> This patch was accepted by Rafael Wysocki, and will be merged to v3.11-rc1.
> > > >>
> > > > Lars-Peter please update with and
> > >
> > > Since the code depends on CONFIG_PM_SLEEP and not CONFIG_PM I don't think
> > > the macro will work.
> > 
> > se please ad a similar macros too
> 
> Hi Jean-Christophe,
> 
> I added pm_sleep_ops_ptr() as below.
> Maybe you want it.
> There is no build warnings below 4 config situations.
>    a) CONFIG_PM is enabled.
>    b) only CONFIG_PM_SLEEP is enabled
>    c) only CONFIG_PM_RUNTIME is enabled
>    d) CONFIG_PM is NOT enabled.
> 
> --- a/drivers/video/bfin-lq035q1-fb.c
> +++ b/drivers/video/bfin-lq035q1-fb.c
> @@ -170,16 +170,19 @@ static int lq035q1_spidev_remove(struct spi_device *spi)
>         return lq035q1_control(spi, LQ035_SHUT_CTL, LQ035_SHUT);
>  }
> 
> -#ifdef CONFIG_PM
> -static int lq035q1_spidev_suspend(struct spi_device *spi, pm_message_t state)
> +#ifdef CONFIG_PM_SLEEP
> +static int lq035q1_spidev_suspend(struct device *dev)
>  {
> +       struct spi_device *spi = to_spi_device(dev);
> +
>         return lq035q1_control(spi, LQ035_SHUT_CTL, LQ035_SHUT);
>  }
> 
> -static int lq035q1_spidev_resume(struct spi_device *spi)
> +static int lq035q1_spidev_resume(struct device *dev)
>  {
> -       int ret;
> +       struct spi_device *spi = to_spi_device(dev);
>         struct spi_control *ctl = spi_get_drvdata(spi);
> +       int ret;
> 
>         ret = lq035q1_control(spi, LQ035_DRIVER_OUTPUT_CTL, ctl->mode);
>         if (ret)
> @@ -187,11 +190,11 @@ static int lq035q1_spidev_resume(struct spi_device *spi)
> 
>         return lq035q1_control(spi, LQ035_SHUT_CTL, LQ035_ON);
>  }
> -#else
> -# define lq035q1_spidev_suspend NULL
> -# define lq035q1_spidev_resume  NULL
>  #endif
> 
> +static SIMPLE_DEV_PM_OPS(lq035q1_spidev_pm_ops, lq035q1_spidev_suspend,
> +       lq035q1_spidev_resume);
> +
>  /* Power down all displays on reboot, poweroff or halt */
>  static void lq035q1_spidev_shutdown(struct spi_device *spi)
>  {
> @@ -708,8 +711,7 @@ static int bfin_lq035q1_probe(struct platform_device *pdev)
>         info->spidrv.probe    = lq035q1_spidev_probe;
>         info->spidrv.remove   = lq035q1_spidev_remove;
>         info->spidrv.shutdown = lq035q1_spidev_shutdown;
> -       info->spidrv.suspend  = lq035q1_spidev_suspend;
> -       info->spidrv.resume   = lq035q1_spidev_resume;
> +       info->spidrv.driver.pm = pm_sleep_ops_ptr(&lq035q1_spidev_pm_ops);
> 
>         ret = spi_register_driver(&info->spidrv);
>         if (ret < 0) {
> diff --git a/include/linux/pm.h b/include/linux/pm.h
> index bd50d15..999d652 100644
> --- a/include/linux/pm.h
> +++ b/include/linux/pm.h
> @@ -61,6 +61,12 @@ extern const char power_group_name[];                /* = "power" */
>  #define pm_ops_ptr(_ptr)       NULL
>  #endif
> 
> +#ifdef CONFIG_PM_SLEEP
> +#define pm_sleep_ops_ptr(_ptr) (_ptr)
> +#else
> +#define pm_sleep_ops_ptr(_ptr) NULL
> +#endif
> +
> 
> 
> Hi Rafael J. Wysocki,
> How about adding this pm_sleep_ops_ptr() macro?
> 
> My draft idea is below:
> However, I want other's better ideas. :)
> 
> 1. The case that only CONFIG_PM_SLEEP is necessary.
> #ifdef CONFIG_PM_SLEEP
> static int *_suspend(struct device *dev)
> 	[....]
> static int *_resume(struct device *dev)
> 	[....]
> #endif
> 
> static SIMPLE_DEV_PM_OPS(*_pm_ops, *_suspend, *_resume);
> 
> static struct {platform/spi/i2c/etc}_driver *_driver = {
> 	.driver = {
> 		.pm     = pm_sleep_ops_ptr(&*_pm_ops),
> 
> 
> 2. The case that both CONFIG_PM_SLEEP & CONFIG_PM_RUNTIME
>     are necessary.
> 
> #ifdef CONFIG_PM_SLEEP
> static int *_suspend(struct device *dev)
> 	[....]
> static int *_resume(struct device *dev)
> 	[....]
> #endif
> 
> #ifdef CONFIG_PM_RUNTIME
> static int *_runtime_suspend(struct device *dev)
> 	[....]
> static int *_runtime_resume(struct device *dev)
> 	[....]
> #endif
> 
> static const struct dev_pm_ops *_pm_ops = {
> 	SET_SYSTEM_SLEEP_PM_OPS(*_suspend, *_resume)
> 	SET_RUNTIME_PM_OPS(*_runtime_suspend, *_runtime_resume, NULL)
> };
> 
> static struct {platform/spi/i2c/etc}_driver *_driver = {
> 	.driver = {
> 		.pm     = pm_ops_ptr(&*_pm_ops),
> 
> 

yes for me

Best Regards,
J.
> 
> Best regards,
> Jingoo Han
> 
> 

^ permalink raw reply

* Re: [PATCH v8, part3 06/14] mm, acornfb: use free_reserved_area() to simplify code
From: Jiang Liu @ 2013-05-31  4:31 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
	KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
	David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
	linux-kernel, Florian Tobias Schandinat, linux-fbdev
In-Reply-To: <20130530145844.902b3a947c1f7430c1c2ecf5@linux-foundation.org>

On Fri 31 May 2013 05:58:44 AM CST, Andrew Morton wrote:
> On Sun, 26 May 2013 21:38:34 +0800 Jiang Liu <liuj97@gmail.com> wrote:
>
>> Use common help function free_reserved_area() to simplify code.
>
> http://ozlabs.org/~akpm/mmots/broken-out/drivers-video-acornfbc-remove-dead-code.patch
> removes all the code which your patch alters.
Thanks Andrew, please just drop that patch.


^ permalink raw reply

* Re: [PATCH v3 3/9] drm: Update drm_addmap and drm_mmap to use PAT WC instead of MTRRs
From: Dave Airlie @ 2013-05-31  3:47 UTC (permalink / raw)
  To: Andy Lutomirski
  Cc: linux-kernel, dri-devel, linux-fbdev, Daniel Vetter,
	Jerome Glisse, Alex Deucher
In-Reply-To: <b1c6c2652b302431a4d4cff46ac872db8e520b6a.1368485053.git.luto@amacapital.net>

On Tue, May 14, 2013 at 9:58 AM, Andy Lutomirski <luto@amacapital.net> wrote:
> Previously, DRM_FRAME_BUFFER mappings, as well as DRM_REGISTERS
> mappings with DRM_WRITE_COMBINING set, resulted in an unconditional
> MTRR being added but the actual mappings being created as UC-.
>
> Now these mappings have the MTRR added only if needed, but they will
> be mapped with pgprot_writecombine.
>
> The non-WC DRM_REGISTERS case now uses pgprot_noncached instead of
> hardcoding the bit twiddling.
>
> The DRM_AGP case is unchanged for now.

Just FYI this breaks on powerpc build, I've fixed it up and pushed the
fixed version to
drm-next-staging, I'll push that to drm-next in a couple of days, once
kbuild robot hits it.

Dave.

^ permalink raw reply

* Re: [PATCH] fbdev: bfin-lq035q1-fb: Use dev_pm_ops
From: Jingoo Han @ 2013-05-31  3:32 UTC (permalink / raw)
  To: 'Jean-Christophe PLAGNIOL-VILLARD',
	'Rafael J. Wysocki'
  Cc: 'Lars-Peter Clausen', 'Michael Hennerich',
	'Tomi Valkeinen', linux-fbdev, linux-pm, Jingoo Han
In-Reply-To: <20130530104535.GF19468@game.jcrosoft.org>

On Thursday, May 30, 2013 7:46 PM, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 09:52 Thu 30 May     , Lars-Peter Clausen wrote:
> > On 05/30/2013 09:14 AM, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > On 09:32 Thu 30 May     , Jingoo Han wrote:
> > >> On Thursday, May 30, 2013 4:20 AM, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > >>> On 16:24 Wed 29 May     , Michael Hennerich wrote:
> > >>>> On 05/29/2013 02:17 PM, Lars-Peter Clausen wrote:
> > >>>>> Use dev_pm_ops instead of the legacy suspend/resume callbacks.
> > >>>>>
> > >>>>> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> > >>>> Acked-by: Michael Hennerich <michael.hennerich@analog.com>
> > >>>>> ---
> > >>>>>  drivers/video/bfin-lq035q1-fb.c | 22 ++++++++++++++--------
> > >>>>>  1 file changed, 14 insertions(+), 8 deletions(-)
> > >>>>>
> > >>>>> diff --git a/drivers/video/bfin-lq035q1-fb.c b/drivers/video/bfin-lq035q1-fb.c
> > >>>>> index 29d8c04..6084c17 100644
> > >>>>> --- a/drivers/video/bfin-lq035q1-fb.c
> > >>>>> +++ b/drivers/video/bfin-lq035q1-fb.c
> > >>>>> @@ -170,16 +170,19 @@ static int lq035q1_spidev_remove(struct spi_device *spi)
> > >>>>>  	return lq035q1_control(spi, LQ035_SHUT_CTL, LQ035_SHUT);
> > >>>>>  }
> > >>>>> -#ifdef CONFIG_PM
> > >>>>> -static int lq035q1_spidev_suspend(struct spi_device *spi, pm_message_t state)
> > >>>>> +#ifdef CONFIG_PM_SLEEP
> > >>>>> +static int lq035q1_spidev_suspend(struct device *dev)
> > >>>>>  {
> > >>>>> +	struct spi_device *spi = to_spi_device(dev);
> > >>>>> +
> > >>>>>  	return lq035q1_control(spi, LQ035_SHUT_CTL, LQ035_SHUT);
> > >>>>>  }
> > >>>>> -static int lq035q1_spidev_resume(struct spi_device *spi)
> > >>>>> +static int lq035q1_spidev_resume(struct device *dev)
> > >>>>>  {
> > >>>>> -	int ret;
> > >>>>> +	struct spi_device *spi = to_spi_device(dev);
> > >>>>>  	struct spi_control *ctl = spi_get_drvdata(spi);
> > >>>>> +	int ret;
> > >>>>>  	ret = lq035q1_control(spi, LQ035_DRIVER_OUTPUT_CTL, ctl->mode);
> > >>>>>  	if (ret)
> > >>>>> @@ -187,9 +190,13 @@ static int lq035q1_spidev_resume(struct spi_device *spi)
> > >>>>>  	return lq035q1_control(spi, LQ035_SHUT_CTL, LQ035_ON);
> > >>>>>  }
> > >>>>> +
> > >>>>> +static SIMPLE_DEV_PM_OPS(lq035q1_spidev_pm_ops, lq035q1_spidev_suspend,
> > >>>>> +	lq035q1_spidev_resume);
> > >>>>> +#define LQ035Q1_SPIDEV_PM_OPS (&lq035q1_spidev_pm_ops)
> > >>>>> +
> > >>>>>  #else
> > >>>>> -# define lq035q1_spidev_suspend NULL
> > >>>>> -# define lq035q1_spidev_resume  NULL
> > >>>>> +#define LQ035Q1_SPIDEV_PM_OPS NULL
> > >>>>>  #endif
> > >>> we really need to ahve a macro like for DT of_match_ptr to drop the #else
> > >>
> > >> Hi Jean-Christophe PLAGNIOL-VILLARD,
> > >>
> > >> I submitted the following patch. :)
> > >> (https://patchwork.kernel.org/patch/2502971/)
> > >>
> > >> --- a/include/linux/pm.h
> > >> +++ b/include/linux/pm.h
> > >> @@ -55,8 +55,10 @@  struct device;
> > >>
> > >>  #ifdef CONFIG_PM
> > >>  extern const char power_group_name[];		/* = "power" */
> > >> +#define pm_ops_ptr(_ptr)	(_ptr)
> > >>  #else
> > >>  #define power_group_name	NULL
> > >> +#define pm_ops_ptr(_ptr)	NULL
> > >>  #endif
> > >>
> > >>
> > >> This patch was accepted by Rafael Wysocki, and will be merged to v3.11-rc1.
> > >>
> > > Lars-Peter please update with and
> >
> > Since the code depends on CONFIG_PM_SLEEP and not CONFIG_PM I don't think
> > the macro will work.
> 
> se please ad a similar macros too

Hi Jean-Christophe,

I added pm_sleep_ops_ptr() as below.
Maybe you want it.
There is no build warnings below 4 config situations.
   a) CONFIG_PM is enabled.
   b) only CONFIG_PM_SLEEP is enabled
   c) only CONFIG_PM_RUNTIME is enabled
   d) CONFIG_PM is NOT enabled.

--- a/drivers/video/bfin-lq035q1-fb.c
+++ b/drivers/video/bfin-lq035q1-fb.c
@@ -170,16 +170,19 @@ static int lq035q1_spidev_remove(struct spi_device *spi)
        return lq035q1_control(spi, LQ035_SHUT_CTL, LQ035_SHUT);
 }

-#ifdef CONFIG_PM
-static int lq035q1_spidev_suspend(struct spi_device *spi, pm_message_t state)
+#ifdef CONFIG_PM_SLEEP
+static int lq035q1_spidev_suspend(struct device *dev)
 {
+       struct spi_device *spi = to_spi_device(dev);
+
        return lq035q1_control(spi, LQ035_SHUT_CTL, LQ035_SHUT);
 }

-static int lq035q1_spidev_resume(struct spi_device *spi)
+static int lq035q1_spidev_resume(struct device *dev)
 {
-       int ret;
+       struct spi_device *spi = to_spi_device(dev);
        struct spi_control *ctl = spi_get_drvdata(spi);
+       int ret;

        ret = lq035q1_control(spi, LQ035_DRIVER_OUTPUT_CTL, ctl->mode);
        if (ret)
@@ -187,11 +190,11 @@ static int lq035q1_spidev_resume(struct spi_device *spi)

        return lq035q1_control(spi, LQ035_SHUT_CTL, LQ035_ON);
 }
-#else
-# define lq035q1_spidev_suspend NULL
-# define lq035q1_spidev_resume  NULL
 #endif

+static SIMPLE_DEV_PM_OPS(lq035q1_spidev_pm_ops, lq035q1_spidev_suspend,
+       lq035q1_spidev_resume);
+
 /* Power down all displays on reboot, poweroff or halt */
 static void lq035q1_spidev_shutdown(struct spi_device *spi)
 {
@@ -708,8 +711,7 @@ static int bfin_lq035q1_probe(struct platform_device *pdev)
        info->spidrv.probe    = lq035q1_spidev_probe;
        info->spidrv.remove   = lq035q1_spidev_remove;
        info->spidrv.shutdown = lq035q1_spidev_shutdown;
-       info->spidrv.suspend  = lq035q1_spidev_suspend;
-       info->spidrv.resume   = lq035q1_spidev_resume;
+       info->spidrv.driver.pm = pm_sleep_ops_ptr(&lq035q1_spidev_pm_ops);

        ret = spi_register_driver(&info->spidrv);
        if (ret < 0) {
diff --git a/include/linux/pm.h b/include/linux/pm.h
index bd50d15..999d652 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -61,6 +61,12 @@ extern const char power_group_name[];                /* = "power" */
 #define pm_ops_ptr(_ptr)       NULL
 #endif

+#ifdef CONFIG_PM_SLEEP
+#define pm_sleep_ops_ptr(_ptr) (_ptr)
+#else
+#define pm_sleep_ops_ptr(_ptr) NULL
+#endif
+


Hi Rafael J. Wysocki,
How about adding this pm_sleep_ops_ptr() macro?

My draft idea is below:
However, I want other's better ideas. :)

1. The case that only CONFIG_PM_SLEEP is necessary.
#ifdef CONFIG_PM_SLEEP
static int *_suspend(struct device *dev)
	[....]
static int *_resume(struct device *dev)
	[....]
#endif

static SIMPLE_DEV_PM_OPS(*_pm_ops, *_suspend, *_resume);

static struct {platform/spi/i2c/etc}_driver *_driver = {
	.driver = {
		.pm     = pm_sleep_ops_ptr(&*_pm_ops),


2. The case that both CONFIG_PM_SLEEP & CONFIG_PM_RUNTIME
    are necessary.

#ifdef CONFIG_PM_SLEEP
static int *_suspend(struct device *dev)
	[....]
static int *_resume(struct device *dev)
	[....]
#endif

#ifdef CONFIG_PM_RUNTIME
static int *_runtime_suspend(struct device *dev)
	[....]
static int *_runtime_resume(struct device *dev)
	[....]
#endif

static const struct dev_pm_ops *_pm_ops = {
	SET_SYSTEM_SLEEP_PM_OPS(*_suspend, *_resume)
	SET_RUNTIME_PM_OPS(*_runtime_suspend, *_runtime_resume, NULL)
};

static struct {platform/spi/i2c/etc}_driver *_driver = {
	.driver = {
		.pm     = pm_ops_ptr(&*_pm_ops),



Best regards,
Jingoo Han



^ permalink raw reply related

* Re: [PATCH v3 0/9] Clean up write-combining MTRR addition
From: Dave Airlie @ 2013-05-31  3:16 UTC (permalink / raw)
  To: Andy Lutomirski
  Cc: linux-kernel, dri-devel, linux-fbdev, Daniel Vetter,
	Jerome Glisse, Alex Deucher
In-Reply-To: <CALCETrXd=6aJwQdDL+XU9x2Pnh0V_9120iw1NHaguN1ahRhhXQ@mail.gmail.com>

On Fri, May 24, 2013 at 4:35 AM, Andy Lutomirski <luto@amacapital.net> wrote:
> On Mon, May 13, 2013 at 4:58 PM, Andy Lutomirski <luto@amacapital.net> wrote:
>> A fair number of drivers (mostly graphics) add write-combining MTRRs.
>> Most ignore errors and most add the MTRR even on PAT systems which don't
>> need to use MTRRs.
>>
>> This series adds new functions arch_phys_wc_{add,del} that, on PAT-less
>> x86 systems with MTRRs, add MTRRs and report errors, and that do nothing
>> otherwise.  (Other architectures, if any, with a similar mechanism could
>> implement them.)
>
> That's the path to upstream for this?  Should it go through drm-next?
> (Sorry for possible noob question -- I've never sent in anything other
> than trivial fixes to drm stuff before.)

I've pulled the v3 series into drm-next, lets see how they go for a while,

I suppose I should try and boot an AGP box with them.

Dave.

^ permalink raw reply

* Re: [PATCH v2 2/3] video: xilinxfb: Do not use out_be32 IO function
From: Timur Tabi @ 2013-05-31  1:16 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Michal Simek, lkml, Michal Simek, Florian Tobias Schandinat,
	linux-fbdev@vger.kernel.org
In-Reply-To: <3808365.SOUxDqkW9J@wuerfel>

On Thu, May 30, 2013 at 5:04 PM, Arnd Bergmann <arnd@arndb.de> wrote:
>
> This is probably missing barriers, and is wrong on systems on which
> the endianess of the device is different from the CPU.


I suggest what was done in fsl_ssi.c:

#ifdef PPC
#define read_ssi(addr)             in_be32(addr)
#define write_ssi(val, addr)         out_be32(addr, val)
#define write_ssi_mask(addr, clear, set) clrsetbits_be32(addr, clear, set)
#elif defined ARM
#define read_ssi(addr)             readl(addr)
#define write_ssi(val, addr)         writel(val, addr)
/*
 * FIXME: Proper locking should be added at write_ssi_mask caller level
 * to ensure this register read/modify/write sequence is race free.
 */
static inline void write_ssi_mask(u32 __iomem *addr, u32 clear, u32 set)
{
    u32 val = readl(addr);
    val = (val & ~clear) | set;
    writel(val, addr);
}
#endif

^ permalink raw reply

* Re: [PATCH v2 2/3] video: xilinxfb: Do not use out_be32 IO function
From: Arnd Bergmann @ 2013-05-30 22:04 UTC (permalink / raw)
  To: Michal Simek
  Cc: linux-kernel, Michal Simek, Florian Tobias Schandinat,
	linux-fbdev
In-Reply-To: <a15de155a3f32fc1416833df1b281db05d347541.1369906849.git.michal.simek@xilinx.com>

On Thursday 30 May 2013 11:41:01 Michal Simek wrote:
>   * To perform the read/write on the registers we need to check on
>   * which bus its connected and call the appropriate write API.
>   */
> -static void xilinx_fb_out_be32(struct xilinxfb_drvdata *drvdata, u32 offset,
> +static void xilinx_fb_out32(struct xilinxfb_drvdata *drvdata, u32 offset,
>                                 u32 val)
>  {
>         if (drvdata->flags & PLB_ACCESS_FLAG)
> -               out_be32(drvdata->regs + (offset << 2), val);
> +               __raw_writel(val, drvdata->regs + (offset << 2));
>  #ifdef CONFIG_PPC_DCR
>         else
>                 dcr_write(drvdata->dcr_host, offset, val);
> 

This is probably missing barriers, and is wrong on systems on which
the endianess of the device is different from the CPU.

You already have an indirection in there, so I guess it won't hurt
to create a third case for little-endian registers and add
another bit in drvdata->flags, or make it depend on the architecture,
if the endianess of the device registers is known at compile time.

	Arnd

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox