All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fbdev: fsl-diu-fb: optionally configure frame buffer depth in DT
@ 2013-03-13 15:24 ` Anatolij Gustschin
  0 siblings, 0 replies; 3+ messages in thread
From: Anatolij Gustschin @ 2013-03-13 15:24 UTC (permalink / raw)
  To: linux-fbdev-u79uwXL29TY76Z2rM5mHXA
  Cc: Florian Tobias Schandinat,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Timur Tabi,
	Rob Herring

Add support for 'depth' property to configure default frame
buffer color depth over device tree.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
 .../devicetree/bindings/powerpc/fsl/diu.txt        |    2 ++
 drivers/video/fsl-diu-fb.c                         |   16 ++++++++++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/powerpc/fsl/diu.txt b/Documentation/devicetree/bindings/powerpc/fsl/diu.txt
index b66cb6d..502aae5 100644
--- a/Documentation/devicetree/bindings/powerpc/fsl/diu.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/diu.txt
@@ -12,6 +12,7 @@ Required properties:
   services interrupts for this device.
 
 Optional properties:
+- depth : default frame buffer color depth
 - edid : verbatim EDID data block describing attached display.
   Data from the detailed timing descriptor will be used to
   program the display controller.
@@ -30,5 +31,6 @@ Example for MPC5121:
 		reg = <0x2100 0x100>;
 		interrupts = <64 0x8>;
 		interrupt-parent = <&ipic>;
+		depth = <16>;
 		edid = [edid-data];
 	};
diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c
index 41fbd94..2287817 100644
--- a/drivers/video/fsl-diu-fb.c
+++ b/drivers/video/fsl-diu-fb.c
@@ -1534,6 +1534,7 @@ static int fsl_diu_probe(struct platform_device *pdev)
 	const void *prop;
 	unsigned int i;
 	int ret;
+	u32 depth;
 
 	data = dmam_alloc_coherent(&pdev->dev, sizeof(struct fsl_diu_data),
 				   &dma_addr, GFP_DMA | __GFP_ZERO);
@@ -1584,6 +1585,21 @@ static int fsl_diu_probe(struct platform_device *pdev)
 		data->has_edid = true;
 	}
 
+	if (!of_property_read_u32(np, "depth", &depth)) {
+		switch (depth) {
+		case 32:
+		case 24:
+		case 16:
+		case 8:
+			default_bpp = depth;
+			break;
+		default:
+			dev_err(&pdev->dev,
+				"%s: invalid depth property\n",
+				np->full_name);
+		}
+	}
+
 	data->diu_reg = of_iomap(np, 0);
 	if (!data->diu_reg) {
 		dev_err(&pdev->dev, "cannot map DIU registers\n");
-- 
1.7.5.4


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

* [PATCH] fbdev: fsl-diu-fb: optionally configure frame buffer depth in DT
@ 2013-03-13 15:24 ` Anatolij Gustschin
  0 siblings, 0 replies; 3+ messages in thread
From: Anatolij Gustschin @ 2013-03-13 15:24 UTC (permalink / raw)
  To: linux-fbdev-u79uwXL29TY76Z2rM5mHXA
  Cc: Florian Tobias Schandinat,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Timur Tabi,
	Rob Herring

Add support for 'depth' property to configure default frame
buffer color depth over device tree.

Signed-off-by: Anatolij Gustschin <agust-ynQEQJNshbs@public.gmane.org>
---
 .../devicetree/bindings/powerpc/fsl/diu.txt        |    2 ++
 drivers/video/fsl-diu-fb.c                         |   16 ++++++++++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/powerpc/fsl/diu.txt b/Documentation/devicetree/bindings/powerpc/fsl/diu.txt
index b66cb6d..502aae5 100644
--- a/Documentation/devicetree/bindings/powerpc/fsl/diu.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/diu.txt
@@ -12,6 +12,7 @@ Required properties:
   services interrupts for this device.
 
 Optional properties:
+- depth : default frame buffer color depth
 - edid : verbatim EDID data block describing attached display.
   Data from the detailed timing descriptor will be used to
   program the display controller.
@@ -30,5 +31,6 @@ Example for MPC5121:
 		reg = <0x2100 0x100>;
 		interrupts = <64 0x8>;
 		interrupt-parent = <&ipic>;
+		depth = <16>;
 		edid = [edid-data];
 	};
diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c
index 41fbd94..2287817 100644
--- a/drivers/video/fsl-diu-fb.c
+++ b/drivers/video/fsl-diu-fb.c
@@ -1534,6 +1534,7 @@ static int fsl_diu_probe(struct platform_device *pdev)
 	const void *prop;
 	unsigned int i;
 	int ret;
+	u32 depth;
 
 	data = dmam_alloc_coherent(&pdev->dev, sizeof(struct fsl_diu_data),
 				   &dma_addr, GFP_DMA | __GFP_ZERO);
@@ -1584,6 +1585,21 @@ static int fsl_diu_probe(struct platform_device *pdev)
 		data->has_edid = true;
 	}
 
+	if (!of_property_read_u32(np, "depth", &depth)) {
+		switch (depth) {
+		case 32:
+		case 24:
+		case 16:
+		case 8:
+			default_bpp = depth;
+			break;
+		default:
+			dev_err(&pdev->dev,
+				"%s: invalid depth property\n",
+				np->full_name);
+		}
+	}
+
 	data->diu_reg = of_iomap(np, 0);
 	if (!data->diu_reg) {
 		dev_err(&pdev->dev, "cannot map DIU registers\n");
-- 
1.7.5.4

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

* Re: [PATCH] fbdev: fsl-diu-fb: optionally configure frame buffer depth in DT
  2013-03-13 15:24 ` Anatolij Gustschin
  (?)
@ 2013-03-13 15:37 ` Timur Tabi
  -1 siblings, 0 replies; 3+ messages in thread
From: Timur Tabi @ 2013-03-13 15:37 UTC (permalink / raw)
  To: linux-fbdev

On 03/13/2013 10:24 AM, Anatolij Gustschin wrote:
> @@ -30,5 +31,6 @@ Example for MPC5121:
>  		reg = <0x2100 0x100>;
>  		interrupts = <64 0x8>;
>  		interrupt-parent = <&ipic>;
> +		depth = <16>;

NACK.

Device trees are supposed to be used for describing the hardware, not
for software configuration.  Besides, the driver already supports a
command-line parameter for the color depth.  Your patch just overrides
that parameter (default_bpp) with a device tree property.

module_param_named(mode, fb_mode, charp, 0);
MODULE_PARM_DESC(mode,
        "Specify resolution as \"<xres>x<yres>[-<bpp>][@<refresh>]\" ");
module_param_named(bpp, default_bpp, ulong, 0);
MODULE_PARM_DESC(bpp, "Specify bit-per-pixel if not specified in 'mode'");
module_param_named(monitor, monitor_string, charp, 0);
MODULE_PARM_DESC(monitor, "Specify the monitor port "
        "(\"dvi\", \"lvds\", or \"dlvds\") if supported by the platform");

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

end of thread, other threads:[~2013-03-13 15:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-13 15:24 [PATCH] fbdev: fsl-diu-fb: optionally configure frame buffer depth in DT Anatolij Gustschin
2013-03-13 15:24 ` Anatolij Gustschin
2013-03-13 15:37 ` Timur Tabi

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.