All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v7][ 1/5] video: mx3fb: Use devm_kzalloc
@ 2014-03-14  9:12 ` Denis Carikli
  0 siblings, 0 replies; 26+ messages in thread
From: Denis Carikli @ 2014-03-14  9:12 UTC (permalink / raw)
  To: linux-arm-kernel

Replace kzalloc by devm_kzalloc and remove the kfree() calls.

Signed-off-by: Denis Carikli <denis@eukrea.com>
---
ChangeLog v6->v7:
- Removed the Cc from the patch, they went into 
  git send-email instead.
ChangeLog v5->v6:
 - New patch need
---
 drivers/video/fbdev/mx3fb.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/video/fbdev/mx3fb.c b/drivers/video/fbdev/mx3fb.c
index 142e860..ee95de8 100644
--- a/drivers/video/fbdev/mx3fb.c
+++ b/drivers/video/fbdev/mx3fb.c
@@ -1496,7 +1496,7 @@ static int mx3fb_probe(struct platform_device *pdev)
 	if (!sdc_reg)
 		return -EINVAL;
 
-	mx3fb = kzalloc(sizeof(*mx3fb), GFP_KERNEL);
+	mx3fb = devm_kzalloc(&pdev->dev, sizeof(*mx3fb), GFP_KERNEL);
 	if (!mx3fb)
 		return -ENOMEM;
 
@@ -1542,7 +1542,6 @@ ersdc0:
 	dmaengine_put();
 	iounmap(mx3fb->reg_base);
 eremap:
-	kfree(mx3fb);
 	dev_err(dev, "mx3fb: failed to register fb\n");
 	return ret;
 }
@@ -1561,7 +1560,6 @@ static int mx3fb_remove(struct platform_device *dev)
 	dmaengine_put();
 
 	iounmap(mx3fb->reg_base);
-	kfree(mx3fb);
 	return 0;
 }
 
-- 
1.7.9.5


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

* [PATCH v7][ 1/5] video: mx3fb: Use devm_kzalloc
@ 2014-03-14  9:12 ` Denis Carikli
  0 siblings, 0 replies; 26+ messages in thread
From: Denis Carikli @ 2014-03-14  9:12 UTC (permalink / raw)
  To: linux-arm-kernel

Replace kzalloc by devm_kzalloc and remove the kfree() calls.

Signed-off-by: Denis Carikli <denis@eukrea.com>
---
ChangeLog v6->v7:
- Removed the Cc from the patch, they went into 
  git send-email instead.
ChangeLog v5->v6:
 - New patch need
---
 drivers/video/fbdev/mx3fb.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/video/fbdev/mx3fb.c b/drivers/video/fbdev/mx3fb.c
index 142e860..ee95de8 100644
--- a/drivers/video/fbdev/mx3fb.c
+++ b/drivers/video/fbdev/mx3fb.c
@@ -1496,7 +1496,7 @@ static int mx3fb_probe(struct platform_device *pdev)
 	if (!sdc_reg)
 		return -EINVAL;
 
-	mx3fb = kzalloc(sizeof(*mx3fb), GFP_KERNEL);
+	mx3fb = devm_kzalloc(&pdev->dev, sizeof(*mx3fb), GFP_KERNEL);
 	if (!mx3fb)
 		return -ENOMEM;
 
@@ -1542,7 +1542,6 @@ ersdc0:
 	dmaengine_put();
 	iounmap(mx3fb->reg_base);
 eremap:
-	kfree(mx3fb);
 	dev_err(dev, "mx3fb: failed to register fb\n");
 	return ret;
 }
@@ -1561,7 +1560,6 @@ static int mx3fb_remove(struct platform_device *dev)
 	dmaengine_put();
 
 	iounmap(mx3fb->reg_base);
-	kfree(mx3fb);
 	return 0;
 }
 
-- 
1.7.9.5

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

* [PATCH v7][ 2/5] video: mx3fb: Add device tree suport.
  2014-03-14  9:12 ` Denis Carikli
@ 2014-03-14  9:12   ` Denis Carikli
  -1 siblings, 0 replies; 26+ messages in thread
From: Denis Carikli @ 2014-03-14  9:12 UTC (permalink / raw)
  To: linux-arm-kernel

This patch is based on:
  838bdf7 video: mxsfb: fix broken videomode selection

Signed-off-by: Denis Carikli <denis@eukrea.com>
---
ChangeLog v6->v7:
- Removed the Cc from the patch, they went into 
  git send-email instead.

ChangeLog v5->v6:
- Shrinked the Cc list.
- de-active and pixelclk-active dt properties are
  now handled in this patch to get rid of the
  "fbdev: Add the lacking FB_SYNC_* for matching the DISPLAY_FLAGS_*" patch

ChangeLog v4->v5:
- Added some people in the Cc list.
- The full ipu register range is now passed to the driver,
  the code and the documentation were adapted to it.
- Updated the documentation not to mention the lcd controller, the ipu was
  mentioned instead.
- The ipu patch was removed from this patchset, as a consequence the mx3fb code
  has been adapted not to expect the dma ipu driver to be probed trough the device tree.

ChangeLog v3->v4:
- Updated bindings.
- Updated documentation accordinly.
- Updated code accordinly.
- Fixed the lack of "ret =" in
  of_property_read_string(display_np, "model", &name);
- Supressed some compilation warnings.

ChangeLog v2->v3:
- The device tree bindings were reworked in order to make it look more like the
  IPUv3 bindings.
- The interface_pix_fmt property now looks like the IPUv3 one.
---
 .../devicetree/bindings/video/fsl,mx3-fb.txt       |   44 +++++
 drivers/video/fbdev/Kconfig                        |    2 +
 drivers/video/fbdev/mx3fb.c                        |  185 +++++++++++++++++---
 3 files changed, 208 insertions(+), 23 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/video/fsl,mx3-fb.txt

diff --git a/Documentation/devicetree/bindings/video/fsl,mx3-fb.txt b/Documentation/devicetree/bindings/video/fsl,mx3-fb.txt
new file mode 100644
index 0000000..c0409a4
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/fsl,mx3-fb.txt
@@ -0,0 +1,44 @@
+Freescale MX3 IPU.
+=========
+
+Required properties:
+- compatible: Should be "fsl,<chip>-ipu". compatible chips include the imx31 and the
+  imx35.
+- reg: should be register base and length as documented in the datasheet.
+- clocks: Handle to the ipu_gate clock.
+- display: Phandle to a "fsl,mx3-parallel-display" compatible display node
+  which is described below.
+
+Example:
+
+ipu: ipu@53fc0000 {
+	compatible = "fsl,imx35-ipu";
+	reg = <0x53fc0000 0x4000>;
+	clocks = <&clks 55>;
+};
+
+Parallel display support
+============
+
+Required properties:
+- compatible: Should be "fsl,mx3-parallel-display".
+- model : The user-visible name of the display.
+
+Optional properties:
+- interface_pix_fmt: How this display is connected to the
+  crtc. Currently supported types: "rgb24", "rgb565", "rgb666".
+
+It can also have an optional timing subnode as described in
+  Documentation/devicetree/bindings/video/display-timing.txt.
+
+Example:
+
+display0: display@di0 {
+	compatible = "fsl,mx3-parallel-display";
+	interface-pix-fmt = "rgb666";
+	model = "CMO-QVGA";
+};
+
+&ipu {
+	display = <&display0>;
+}
diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index 67409e0..c996b96 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -2330,6 +2330,8 @@ config FB_MX3
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
+	select VIDEOMODE_HELPERS
+	select FB_MODE_HELPERS
 	default y
 	help
 	  This is a framebuffer device for the i.MX31 LCD Controller. So
diff --git a/drivers/video/fbdev/mx3fb.c b/drivers/video/fbdev/mx3fb.c
index ee95de8..952d2b5 100644
--- a/drivers/video/fbdev/mx3fb.c
+++ b/drivers/video/fbdev/mx3fb.c
@@ -31,6 +31,10 @@
 #include <linux/platform_data/dma-imx.h>
 #include <linux/platform_data/video-mx3fb.h>
 
+#include <video/of_display_timing.h>
+#include <video/of_videomode.h>
+#include <video/videomode.h>
+
 #include <asm/io.h>
 #include <asm/uaccess.h>
 
@@ -237,6 +241,8 @@ static const struct fb_videomode mx3fb_modedb[] = {
 
 struct mx3fb_data {
 	struct fb_info		*fbi;
+	struct videomode	*vm;
+	struct fb_videomode	*fb_vm;
 	int			backlight_level;
 	void __iomem		*reg_base;
 	spinlock_t		lock;
@@ -269,6 +275,7 @@ struct mx3fb_info {
 	struct scatterlist		sg[2];
 
 	struct fb_var_screeninfo	cur_var; /* current var info */
+	uint32_t			flags;
 };
 
 static void mx3fb_dma_done(void *);
@@ -753,16 +760,32 @@ static int __set_par(struct fb_info *fbi, bool lock)
 
 	if (mx3_fbi->ipu_ch = IDMAC_SDC_0) {
 		memset(&sig_cfg, 0, sizeof(sig_cfg));
+
 		if (fbi->var.sync & FB_SYNC_HOR_HIGH_ACT)
 			sig_cfg.Hsync_pol = true;
+
 		if (fbi->var.sync & FB_SYNC_VERT_HIGH_ACT)
 			sig_cfg.Vsync_pol = true;
-		if (fbi->var.sync & FB_SYNC_CLK_INVERT)
-			sig_cfg.clk_pol = true;
+
+		if (fbi->device->of_node) {
+			if (mx3_fbi->flags & FB_SYNC_CLK_INVERT)
+				sig_cfg.clk_pol = true;
+		} else {
+			if (fbi->var.sync & FB_SYNC_CLK_INVERT)
+				sig_cfg.clk_pol = true;
+		}
+
 		if (fbi->var.sync & FB_SYNC_DATA_INVERT)
 			sig_cfg.data_pol = true;
-		if (fbi->var.sync & FB_SYNC_OE_ACT_HIGH)
-			sig_cfg.enable_pol = true;
+
+		if (fbi->device->of_node) {
+			if (mx3_fbi->flags & FB_SYNC_OE_ACT_HIGH)
+				sig_cfg.enable_pol = true;
+		} else {
+			if (fbi->var.sync & FB_SYNC_OE_ACT_HIGH)
+				sig_cfg.enable_pol = true;
+		}
+
 		if (fbi->var.sync & FB_SYNC_CLK_IDLE_EN)
 			sig_cfg.clkidle_en = true;
 		if (fbi->var.sync & FB_SYNC_CLK_SEL_EN)
@@ -1266,7 +1289,8 @@ static int mx3fb_map_video_memory(struct fb_info *fbi, unsigned int mem_len,
 						  &addr, GFP_DMA | GFP_KERNEL);
 
 	if (!fbi->screen_base) {
-		dev_err(fbi->device, "Cannot allocate %u bytes framebuffer memory\n",
+		dev_err(fbi->device,
+			"Cannot allocate %u bytes framebuffer memory\n",
 			mem_len);
 		retval = -EBUSY;
 		goto err0;
@@ -1280,7 +1304,8 @@ static int mx3fb_map_video_memory(struct fb_info *fbi, unsigned int mem_len,
 		mutex_unlock(&fbi->mm_lock);
 
 	dev_dbg(fbi->device, "allocated fb @ p=0x%08x, v=0x%p, size=%d.\n",
-		(uint32_t) fbi->fix.smem_start, fbi->screen_base, fbi->fix.smem_len);
+		(uint32_t) fbi->fix.smem_start,
+		fbi->screen_base, fbi->fix.smem_len);
 
 	fbi->screen_size = fbi->fix.smem_len;
 
@@ -1351,21 +1376,68 @@ static struct fb_info *mx3fb_init_fbinfo(struct device *dev, struct fb_ops *ops)
 	return fbi;
 }
 
+static int match_dt_disp_data(const char *property)
+{
+	if (!strcmp("rgb666", property))
+		return IPU_DISP_DATA_MAPPING_RGB666;
+	else if (!strcmp("rgb565", property))
+		return IPU_DISP_DATA_MAPPING_RGB565;
+	else if (!strcmp("rgb24", property))
+		return IPU_DISP_DATA_MAPPING_RGB888;
+	else
+		return -EINVAL;
+}
+
 static int init_fb_chan(struct mx3fb_data *mx3fb, struct idmac_channel *ichan)
 {
 	struct device *dev = mx3fb->dev;
 	struct mx3fb_platform_data *mx3fb_pdata = dev_get_platdata(dev);
-	const char *name = mx3fb_pdata->name;
+	struct device_node *np = dev->of_node;
+	const char *name;
+	const char *ipu_disp_format;
 	unsigned int irq;
 	struct fb_info *fbi;
 	struct mx3fb_info *mx3fbi;
 	const struct fb_videomode *mode;
 	int ret, num_modes;
+	struct device_node *display_np = NULL;
+
+	if (np) {
+		display_np = of_parse_phandle(np, "display", 0);
+		if (!display_np) {
+			dev_err(dev, "Can't get the display device node.\n");
+			return -EINVAL;
+		}
+
+		of_property_read_string(display_np, "interface-pix-fmt",
+					&ipu_disp_format);
+		if (!ipu_disp_format) {
+			mx3fb->disp_data_fmt = IPU_DISP_DATA_MAPPING_RGB666;
+			dev_warn(dev,
+				"ipu display data mapping was not defined, using the default rgb666.\n");
+		} else {
+			mx3fb->disp_data_fmt +				match_dt_disp_data(ipu_disp_format);
+		}
 
-	if (mx3fb_pdata->disp_data_fmt >= ARRAY_SIZE(di_mappings)) {
-		dev_err(dev, "Illegal display data format %d\n",
+		if (mx3fb->disp_data_fmt = -EINVAL) {
+			dev_err(dev, "Illegal display data format \"%s\"\n",
+				ipu_disp_format);
+			return -EINVAL;
+		}
+
+		ret = of_property_read_string(display_np, "model", &name);
+		if (ret) {
+			dev_err(dev, "Missing display model name\n");
+			return -EINVAL;
+		}
+	} else {
+		name = mx3fb_pdata->name;
+		if (mx3fb_pdata->disp_data_fmt >= ARRAY_SIZE(di_mappings)) {
+			dev_err(dev, "Illegal display data format %d\n",
 				mx3fb_pdata->disp_data_fmt);
-		return -EINVAL;
+			return -EINVAL;
+		}
 	}
 
 	ichan->client = mx3fb;
@@ -1386,12 +1458,36 @@ static int init_fb_chan(struct mx3fb_data *mx3fb, struct idmac_channel *ichan)
 		goto emode;
 	}
 
-	if (mx3fb_pdata->mode && mx3fb_pdata->num_modes) {
-		mode = mx3fb_pdata->mode;
-		num_modes = mx3fb_pdata->num_modes;
+	mx3fbi = fbi->par;
+
+	if (np) {
+		ret = of_get_videomode(display_np, mx3fb->vm,
+				       OF_USE_NATIVE_MODE);
+		if (ret) {
+			dev_err(dev, "failed to get videomode from DT\n");
+			goto put_display_node;
+		}
+
+		ret = fb_videomode_from_videomode(mx3fb->vm, mx3fb->fb_vm);
+		if (ret < 0)
+			goto put_display_node;
+
+		if (mx3fb->vm->flags & DISPLAY_FLAGS_DE_HIGH)
+			mx3fbi->flags |= FB_SYNC_OE_ACT_HIGH;
+
+		if (mx3fb->vm->flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE)
+			mx3fbi->flags |= FB_SYNC_CLK_INVERT;
+
+		mode = mx3fb->fb_vm;
+		num_modes = 1;
 	} else {
-		mode = mx3fb_modedb;
-		num_modes = ARRAY_SIZE(mx3fb_modedb);
+		if (mx3fb_pdata->mode && mx3fb_pdata->num_modes) {
+			mode = mx3fb_pdata->mode;
+			num_modes = mx3fb_pdata->num_modes;
+		} else {
+			mode = mx3fb_modedb;
+			num_modes = ARRAY_SIZE(mx3fb_modedb);
+		}
 	}
 
 	if (!fb_find_mode(&fbi->var, fbi, fb_mode, mode,
@@ -1415,13 +1511,13 @@ static int init_fb_chan(struct mx3fb_data *mx3fb, struct idmac_channel *ichan)
 	sdc_set_global_alpha(mx3fb, true, 0xFF);
 	sdc_set_color_key(mx3fb, IDMAC_SDC_0, false, 0);
 
-	mx3fbi			= fbi->par;
 	mx3fbi->idmac_channel	= ichan;
 	mx3fbi->ipu_ch		= ichan->dma_chan.chan_id;
 	mx3fbi->mx3fb		= mx3fb;
 	mx3fbi->blank		= FB_BLANK_NORMAL;
 
-	mx3fb->disp_data_fmt	= mx3fb_pdata->disp_data_fmt;
+	if (!np)
+		mx3fb->disp_data_fmt = mx3fb_pdata->disp_data_fmt;
 
 	init_completion(&mx3fbi->flip_cmpl);
 	disable_irq(ichan->eof_irq);
@@ -1440,6 +1536,8 @@ static int init_fb_chan(struct mx3fb_data *mx3fb, struct idmac_channel *ichan)
 
 	return 0;
 
+put_display_node:
+	of_node_put(display_np);
 erfb:
 esetpar:
 emode:
@@ -1455,17 +1553,21 @@ static bool chan_filter(struct dma_chan *chan, void *arg)
 	struct device *dev;
 	struct mx3fb_platform_data *mx3fb_pdata;
 
-	if (!imx_dma_is_ipu(chan))
-		return false;
-
 	if (!rq)
 		return false;
 
 	dev = rq->mx3fb->dev;
 	mx3fb_pdata = dev_get_platdata(dev);
 
-	return rq->id = chan->chan_id &&
-		mx3fb_pdata->dma_dev = chan->device->dev;
+	if (!imx_dma_is_ipu(chan) && mx3fb_pdata)
+		return false;
+
+	/* When using the devicetree, mx3fb_pdata is NULL */
+	if (mx3fb_pdata)
+		return rq->id = chan->chan_id &&
+			mx3fb_pdata->dma_dev = chan->device->dev;
+	else
+		return rq->id = chan->chan_id;
 }
 
 static void release_fbi(struct fb_info *fbi)
@@ -1487,6 +1589,9 @@ static int mx3fb_probe(struct platform_device *pdev)
 	dma_cap_mask_t mask;
 	struct dma_chan *chan;
 	struct dma_chan_request rq;
+	struct device_node *np = dev->of_node;
+	struct videomode *vm;
+	struct fb_videomode *fb_vm;
 
 	/*
 	 * Display Interface (DI) and Synchronous Display Controller (SDC)
@@ -1508,7 +1613,33 @@ static int mx3fb_probe(struct platform_device *pdev)
 		goto eremap;
 	}
 
-	pr_debug("Remapped %pR at %p\n", sdc_reg, mx3fb->reg_base);
+	/* The full IPU registers range is passed by the device tree,
+	 * whereas the platform data only passes the SDC registers range.
+	 */
+	if (np) {
+		vm = devm_kzalloc(&pdev->dev, sizeof(struct videomode),
+				  GFP_KERNEL);
+		if (!vm) {
+			ret = -ENOMEM;
+			goto eremap;
+		}
+
+		fb_vm = devm_kzalloc(&pdev->dev, sizeof(struct fb_videomode),
+				     GFP_KERNEL);
+		if (!fb_vm) {
+			ret = -ENOMEM;
+			goto eremap;
+		}
+
+		mx3fb->vm = vm;
+		mx3fb->fb_vm = fb_vm;
+
+		mx3fb->reg_base += MX3FB_REG_OFFSET;
+		pr_debug("Remapped %pR at %p\n", sdc_reg + MX3FB_REG_OFFSET,
+			 mx3fb->reg_base);
+	} else {
+		pr_debug("Remapped %pR at %p\n", sdc_reg, mx3fb->reg_base);
+	}
 
 	/* IDMAC interface */
 	dmaengine_get();
@@ -1563,9 +1694,17 @@ static int mx3fb_remove(struct platform_device *dev)
 	return 0;
 }
 
+static struct of_device_id mx3fb_of_dev_id[] = {
+	{ .compatible = "fsl,imx31-ipu", },
+	{ .compatible = "fsl,imx35-ipu", },
+	{ /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, mx3fb_of_dev_id);
+
 static struct platform_driver mx3fb_driver = {
 	.driver = {
 		.name = MX3FB_NAME,
+		.of_match_table = mx3fb_of_dev_id,
 		.owner = THIS_MODULE,
 	},
 	.probe = mx3fb_probe,
-- 
1.7.9.5


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

* [PATCH v7][ 2/5] video: mx3fb: Add device tree suport.
@ 2014-03-14  9:12   ` Denis Carikli
  0 siblings, 0 replies; 26+ messages in thread
From: Denis Carikli @ 2014-03-14  9:12 UTC (permalink / raw)
  To: linux-arm-kernel

This patch is based on:
  838bdf7 video: mxsfb: fix broken videomode selection

Signed-off-by: Denis Carikli <denis@eukrea.com>
---
ChangeLog v6->v7:
- Removed the Cc from the patch, they went into 
  git send-email instead.

ChangeLog v5->v6:
- Shrinked the Cc list.
- de-active and pixelclk-active dt properties are
  now handled in this patch to get rid of the
  "fbdev: Add the lacking FB_SYNC_* for matching the DISPLAY_FLAGS_*" patch

ChangeLog v4->v5:
- Added some people in the Cc list.
- The full ipu register range is now passed to the driver,
  the code and the documentation were adapted to it.
- Updated the documentation not to mention the lcd controller, the ipu was
  mentioned instead.
- The ipu patch was removed from this patchset, as a consequence the mx3fb code
  has been adapted not to expect the dma ipu driver to be probed trough the device tree.

ChangeLog v3->v4:
- Updated bindings.
- Updated documentation accordinly.
- Updated code accordinly.
- Fixed the lack of "ret =" in
  of_property_read_string(display_np, "model", &name);
- Supressed some compilation warnings.

ChangeLog v2->v3:
- The device tree bindings were reworked in order to make it look more like the
  IPUv3 bindings.
- The interface_pix_fmt property now looks like the IPUv3 one.
---
 .../devicetree/bindings/video/fsl,mx3-fb.txt       |   44 +++++
 drivers/video/fbdev/Kconfig                        |    2 +
 drivers/video/fbdev/mx3fb.c                        |  185 +++++++++++++++++---
 3 files changed, 208 insertions(+), 23 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/video/fsl,mx3-fb.txt

diff --git a/Documentation/devicetree/bindings/video/fsl,mx3-fb.txt b/Documentation/devicetree/bindings/video/fsl,mx3-fb.txt
new file mode 100644
index 0000000..c0409a4
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/fsl,mx3-fb.txt
@@ -0,0 +1,44 @@
+Freescale MX3 IPU.
+==================
+
+Required properties:
+- compatible: Should be "fsl,<chip>-ipu". compatible chips include the imx31 and the
+  imx35.
+- reg: should be register base and length as documented in the datasheet.
+- clocks: Handle to the ipu_gate clock.
+- display: Phandle to a "fsl,mx3-parallel-display" compatible display node
+  which is described below.
+
+Example:
+
+ipu: ipu at 53fc0000 {
+	compatible = "fsl,imx35-ipu";
+	reg = <0x53fc0000 0x4000>;
+	clocks = <&clks 55>;
+};
+
+Parallel display support
+========================
+
+Required properties:
+- compatible: Should be "fsl,mx3-parallel-display".
+- model : The user-visible name of the display.
+
+Optional properties:
+- interface_pix_fmt: How this display is connected to the
+  crtc. Currently supported types: "rgb24", "rgb565", "rgb666".
+
+It can also have an optional timing subnode as described in
+  Documentation/devicetree/bindings/video/display-timing.txt.
+
+Example:
+
+display0: display at di0 {
+	compatible = "fsl,mx3-parallel-display";
+	interface-pix-fmt = "rgb666";
+	model = "CMO-QVGA";
+};
+
+&ipu {
+	display = <&display0>;
+}
diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index 67409e0..c996b96 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -2330,6 +2330,8 @@ config FB_MX3
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
+	select VIDEOMODE_HELPERS
+	select FB_MODE_HELPERS
 	default y
 	help
 	  This is a framebuffer device for the i.MX31 LCD Controller. So
diff --git a/drivers/video/fbdev/mx3fb.c b/drivers/video/fbdev/mx3fb.c
index ee95de8..952d2b5 100644
--- a/drivers/video/fbdev/mx3fb.c
+++ b/drivers/video/fbdev/mx3fb.c
@@ -31,6 +31,10 @@
 #include <linux/platform_data/dma-imx.h>
 #include <linux/platform_data/video-mx3fb.h>
 
+#include <video/of_display_timing.h>
+#include <video/of_videomode.h>
+#include <video/videomode.h>
+
 #include <asm/io.h>
 #include <asm/uaccess.h>
 
@@ -237,6 +241,8 @@ static const struct fb_videomode mx3fb_modedb[] = {
 
 struct mx3fb_data {
 	struct fb_info		*fbi;
+	struct videomode	*vm;
+	struct fb_videomode	*fb_vm;
 	int			backlight_level;
 	void __iomem		*reg_base;
 	spinlock_t		lock;
@@ -269,6 +275,7 @@ struct mx3fb_info {
 	struct scatterlist		sg[2];
 
 	struct fb_var_screeninfo	cur_var; /* current var info */
+	uint32_t			flags;
 };
 
 static void mx3fb_dma_done(void *);
@@ -753,16 +760,32 @@ static int __set_par(struct fb_info *fbi, bool lock)
 
 	if (mx3_fbi->ipu_ch == IDMAC_SDC_0) {
 		memset(&sig_cfg, 0, sizeof(sig_cfg));
+
 		if (fbi->var.sync & FB_SYNC_HOR_HIGH_ACT)
 			sig_cfg.Hsync_pol = true;
+
 		if (fbi->var.sync & FB_SYNC_VERT_HIGH_ACT)
 			sig_cfg.Vsync_pol = true;
-		if (fbi->var.sync & FB_SYNC_CLK_INVERT)
-			sig_cfg.clk_pol = true;
+
+		if (fbi->device->of_node) {
+			if (mx3_fbi->flags & FB_SYNC_CLK_INVERT)
+				sig_cfg.clk_pol = true;
+		} else {
+			if (fbi->var.sync & FB_SYNC_CLK_INVERT)
+				sig_cfg.clk_pol = true;
+		}
+
 		if (fbi->var.sync & FB_SYNC_DATA_INVERT)
 			sig_cfg.data_pol = true;
-		if (fbi->var.sync & FB_SYNC_OE_ACT_HIGH)
-			sig_cfg.enable_pol = true;
+
+		if (fbi->device->of_node) {
+			if (mx3_fbi->flags & FB_SYNC_OE_ACT_HIGH)
+				sig_cfg.enable_pol = true;
+		} else {
+			if (fbi->var.sync & FB_SYNC_OE_ACT_HIGH)
+				sig_cfg.enable_pol = true;
+		}
+
 		if (fbi->var.sync & FB_SYNC_CLK_IDLE_EN)
 			sig_cfg.clkidle_en = true;
 		if (fbi->var.sync & FB_SYNC_CLK_SEL_EN)
@@ -1266,7 +1289,8 @@ static int mx3fb_map_video_memory(struct fb_info *fbi, unsigned int mem_len,
 						  &addr, GFP_DMA | GFP_KERNEL);
 
 	if (!fbi->screen_base) {
-		dev_err(fbi->device, "Cannot allocate %u bytes framebuffer memory\n",
+		dev_err(fbi->device,
+			"Cannot allocate %u bytes framebuffer memory\n",
 			mem_len);
 		retval = -EBUSY;
 		goto err0;
@@ -1280,7 +1304,8 @@ static int mx3fb_map_video_memory(struct fb_info *fbi, unsigned int mem_len,
 		mutex_unlock(&fbi->mm_lock);
 
 	dev_dbg(fbi->device, "allocated fb @ p=0x%08x, v=0x%p, size=%d.\n",
-		(uint32_t) fbi->fix.smem_start, fbi->screen_base, fbi->fix.smem_len);
+		(uint32_t) fbi->fix.smem_start,
+		fbi->screen_base, fbi->fix.smem_len);
 
 	fbi->screen_size = fbi->fix.smem_len;
 
@@ -1351,21 +1376,68 @@ static struct fb_info *mx3fb_init_fbinfo(struct device *dev, struct fb_ops *ops)
 	return fbi;
 }
 
+static int match_dt_disp_data(const char *property)
+{
+	if (!strcmp("rgb666", property))
+		return IPU_DISP_DATA_MAPPING_RGB666;
+	else if (!strcmp("rgb565", property))
+		return IPU_DISP_DATA_MAPPING_RGB565;
+	else if (!strcmp("rgb24", property))
+		return IPU_DISP_DATA_MAPPING_RGB888;
+	else
+		return -EINVAL;
+}
+
 static int init_fb_chan(struct mx3fb_data *mx3fb, struct idmac_channel *ichan)
 {
 	struct device *dev = mx3fb->dev;
 	struct mx3fb_platform_data *mx3fb_pdata = dev_get_platdata(dev);
-	const char *name = mx3fb_pdata->name;
+	struct device_node *np = dev->of_node;
+	const char *name;
+	const char *ipu_disp_format;
 	unsigned int irq;
 	struct fb_info *fbi;
 	struct mx3fb_info *mx3fbi;
 	const struct fb_videomode *mode;
 	int ret, num_modes;
+	struct device_node *display_np = NULL;
+
+	if (np) {
+		display_np = of_parse_phandle(np, "display", 0);
+		if (!display_np) {
+			dev_err(dev, "Can't get the display device node.\n");
+			return -EINVAL;
+		}
+
+		of_property_read_string(display_np, "interface-pix-fmt",
+					&ipu_disp_format);
+		if (!ipu_disp_format) {
+			mx3fb->disp_data_fmt = IPU_DISP_DATA_MAPPING_RGB666;
+			dev_warn(dev,
+				"ipu display data mapping was not defined, using the default rgb666.\n");
+		} else {
+			mx3fb->disp_data_fmt =
+				match_dt_disp_data(ipu_disp_format);
+		}
 
-	if (mx3fb_pdata->disp_data_fmt >= ARRAY_SIZE(di_mappings)) {
-		dev_err(dev, "Illegal display data format %d\n",
+		if (mx3fb->disp_data_fmt == -EINVAL) {
+			dev_err(dev, "Illegal display data format \"%s\"\n",
+				ipu_disp_format);
+			return -EINVAL;
+		}
+
+		ret = of_property_read_string(display_np, "model", &name);
+		if (ret) {
+			dev_err(dev, "Missing display model name\n");
+			return -EINVAL;
+		}
+	} else {
+		name = mx3fb_pdata->name;
+		if (mx3fb_pdata->disp_data_fmt >= ARRAY_SIZE(di_mappings)) {
+			dev_err(dev, "Illegal display data format %d\n",
 				mx3fb_pdata->disp_data_fmt);
-		return -EINVAL;
+			return -EINVAL;
+		}
 	}
 
 	ichan->client = mx3fb;
@@ -1386,12 +1458,36 @@ static int init_fb_chan(struct mx3fb_data *mx3fb, struct idmac_channel *ichan)
 		goto emode;
 	}
 
-	if (mx3fb_pdata->mode && mx3fb_pdata->num_modes) {
-		mode = mx3fb_pdata->mode;
-		num_modes = mx3fb_pdata->num_modes;
+	mx3fbi = fbi->par;
+
+	if (np) {
+		ret = of_get_videomode(display_np, mx3fb->vm,
+				       OF_USE_NATIVE_MODE);
+		if (ret) {
+			dev_err(dev, "failed to get videomode from DT\n");
+			goto put_display_node;
+		}
+
+		ret = fb_videomode_from_videomode(mx3fb->vm, mx3fb->fb_vm);
+		if (ret < 0)
+			goto put_display_node;
+
+		if (mx3fb->vm->flags & DISPLAY_FLAGS_DE_HIGH)
+			mx3fbi->flags |= FB_SYNC_OE_ACT_HIGH;
+
+		if (mx3fb->vm->flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE)
+			mx3fbi->flags |= FB_SYNC_CLK_INVERT;
+
+		mode = mx3fb->fb_vm;
+		num_modes = 1;
 	} else {
-		mode = mx3fb_modedb;
-		num_modes = ARRAY_SIZE(mx3fb_modedb);
+		if (mx3fb_pdata->mode && mx3fb_pdata->num_modes) {
+			mode = mx3fb_pdata->mode;
+			num_modes = mx3fb_pdata->num_modes;
+		} else {
+			mode = mx3fb_modedb;
+			num_modes = ARRAY_SIZE(mx3fb_modedb);
+		}
 	}
 
 	if (!fb_find_mode(&fbi->var, fbi, fb_mode, mode,
@@ -1415,13 +1511,13 @@ static int init_fb_chan(struct mx3fb_data *mx3fb, struct idmac_channel *ichan)
 	sdc_set_global_alpha(mx3fb, true, 0xFF);
 	sdc_set_color_key(mx3fb, IDMAC_SDC_0, false, 0);
 
-	mx3fbi			= fbi->par;
 	mx3fbi->idmac_channel	= ichan;
 	mx3fbi->ipu_ch		= ichan->dma_chan.chan_id;
 	mx3fbi->mx3fb		= mx3fb;
 	mx3fbi->blank		= FB_BLANK_NORMAL;
 
-	mx3fb->disp_data_fmt	= mx3fb_pdata->disp_data_fmt;
+	if (!np)
+		mx3fb->disp_data_fmt = mx3fb_pdata->disp_data_fmt;
 
 	init_completion(&mx3fbi->flip_cmpl);
 	disable_irq(ichan->eof_irq);
@@ -1440,6 +1536,8 @@ static int init_fb_chan(struct mx3fb_data *mx3fb, struct idmac_channel *ichan)
 
 	return 0;
 
+put_display_node:
+	of_node_put(display_np);
 erfb:
 esetpar:
 emode:
@@ -1455,17 +1553,21 @@ static bool chan_filter(struct dma_chan *chan, void *arg)
 	struct device *dev;
 	struct mx3fb_platform_data *mx3fb_pdata;
 
-	if (!imx_dma_is_ipu(chan))
-		return false;
-
 	if (!rq)
 		return false;
 
 	dev = rq->mx3fb->dev;
 	mx3fb_pdata = dev_get_platdata(dev);
 
-	return rq->id == chan->chan_id &&
-		mx3fb_pdata->dma_dev == chan->device->dev;
+	if (!imx_dma_is_ipu(chan) && mx3fb_pdata)
+		return false;
+
+	/* When using the devicetree, mx3fb_pdata is NULL */
+	if (mx3fb_pdata)
+		return rq->id == chan->chan_id &&
+			mx3fb_pdata->dma_dev == chan->device->dev;
+	else
+		return rq->id == chan->chan_id;
 }
 
 static void release_fbi(struct fb_info *fbi)
@@ -1487,6 +1589,9 @@ static int mx3fb_probe(struct platform_device *pdev)
 	dma_cap_mask_t mask;
 	struct dma_chan *chan;
 	struct dma_chan_request rq;
+	struct device_node *np = dev->of_node;
+	struct videomode *vm;
+	struct fb_videomode *fb_vm;
 
 	/*
 	 * Display Interface (DI) and Synchronous Display Controller (SDC)
@@ -1508,7 +1613,33 @@ static int mx3fb_probe(struct platform_device *pdev)
 		goto eremap;
 	}
 
-	pr_debug("Remapped %pR at %p\n", sdc_reg, mx3fb->reg_base);
+	/* The full IPU registers range is passed by the device tree,
+	 * whereas the platform data only passes the SDC registers range.
+	 */
+	if (np) {
+		vm = devm_kzalloc(&pdev->dev, sizeof(struct videomode),
+				  GFP_KERNEL);
+		if (!vm) {
+			ret = -ENOMEM;
+			goto eremap;
+		}
+
+		fb_vm = devm_kzalloc(&pdev->dev, sizeof(struct fb_videomode),
+				     GFP_KERNEL);
+		if (!fb_vm) {
+			ret = -ENOMEM;
+			goto eremap;
+		}
+
+		mx3fb->vm = vm;
+		mx3fb->fb_vm = fb_vm;
+
+		mx3fb->reg_base += MX3FB_REG_OFFSET;
+		pr_debug("Remapped %pR at %p\n", sdc_reg + MX3FB_REG_OFFSET,
+			 mx3fb->reg_base);
+	} else {
+		pr_debug("Remapped %pR at %p\n", sdc_reg, mx3fb->reg_base);
+	}
 
 	/* IDMAC interface */
 	dmaengine_get();
@@ -1563,9 +1694,17 @@ static int mx3fb_remove(struct platform_device *dev)
 	return 0;
 }
 
+static struct of_device_id mx3fb_of_dev_id[] = {
+	{ .compatible = "fsl,imx31-ipu", },
+	{ .compatible = "fsl,imx35-ipu", },
+	{ /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, mx3fb_of_dev_id);
+
 static struct platform_driver mx3fb_driver = {
 	.driver = {
 		.name = MX3FB_NAME,
+		.of_match_table = mx3fb_of_dev_id,
 		.owner = THIS_MODULE,
 	},
 	.probe = mx3fb_probe,
-- 
1.7.9.5

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

* [PATCH v7][ 3/5] video: mx3fb: Introduce regulator support.
  2014-03-14  9:12 ` Denis Carikli
@ 2014-03-14  9:12   ` Denis Carikli
  -1 siblings, 0 replies; 26+ messages in thread
From: Denis Carikli @ 2014-03-14  9:12 UTC (permalink / raw)
  To: linux-arm-kernel

This commit is based on the following commit by Fabio Estevam:
  4344429 video: mxsfb: Introduce regulator support

Signed-off-by: Denis Carikli <denis@eukrea.com>
---
ChangeLog v6->v7:
- Removed the Cc from the patch, they went into 
  git send-email instead.

ChangeLog v5->v6:
- Shrinked the Cc list.
- still permit non-dt boards to use that driver without a regulator.

ChangeLog v4->v5:
- Added Shawn Guo in the Cc list.
- Rebased to make it apply.

ChangeLog v3->v4:
- Some code style fixes.
- Improved error handling in eremap.

ChangeLog v2->v3:
- The prints are now replaced with non line wrapped prints.
- The regulator retrival has been adapted to the new DT bindings which looks
  more like the IPUv3 ones.
- The regulator_is_enabled checks were kept, because regulator_disable do not
  do such check.
---
 drivers/video/mx3fb.c |   56 ++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 55 insertions(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/mx3fb.c b/drivers/video/fbdev/mx3fb.c
index 952d2b5..40b47dd 100644
--- a/drivers/video/fbdev/mx3fb.c
+++ b/drivers/video/fbdev/mx3fb.c
@@ -27,6 +27,7 @@
 #include <linux/clk.h>
 #include <linux/mutex.h>
 #include <linux/dma/ipu-dma.h>
+#include <linux/regulator/consumer.h>
 
 #include <linux/platform_data/dma-imx.h>
 #include <linux/platform_data/video-mx3fb.h>
@@ -273,6 +274,7 @@ struct mx3fb_info {
 	struct dma_async_tx_descriptor	*txd;
 	dma_cookie_t			cookie;
 	struct scatterlist		sg[2];
+	struct regulator		*reg_lcd;
 
 	struct fb_var_screeninfo	cur_var; /* current var info */
 	uint32_t			flags;
@@ -1042,6 +1044,12 @@ static void __blank(int blank, struct fb_info *fbi)
 	case FB_BLANK_HSYNC_SUSPEND:
 	case FB_BLANK_NORMAL:
 		sdc_set_brightness(mx3fb, 0);
+		if (!IS_ERR(mx3_fbi->reg_lcd)) {
+			if (regulator_disable(mx3_fbi->reg_lcd)) {
+				dev_err(fbi->device,
+					"Failed to disable regulator.\n");
+			}
+		}
 		memset((char *)fbi->screen_base, 0, fbi->fix.smem_len);
 		/* Give LCD time to update - enough for 50 and 60 Hz */
 		msleep(25);
@@ -1049,6 +1057,12 @@ static void __blank(int blank, struct fb_info *fbi)
 		break;
 	case FB_BLANK_UNBLANK:
 		sdc_enable_channel(mx3_fbi);
+		if (!IS_ERR(mx3_fbi->reg_lcd)) {
+			if (regulator_enable(mx3_fbi->reg_lcd)) {
+				dev_err(fbi->device,
+					"Failed to enable regulator.\n");
+			}
+		}
 		sdc_set_brightness(mx3fb, mx3fb->backlight_level);
 		break;
 	}
@@ -1233,7 +1247,12 @@ static int mx3fb_suspend(struct platform_device *pdev, pm_message_t state)
 	if (mx3_fbi->blank = FB_BLANK_UNBLANK) {
 		sdc_disable_channel(mx3_fbi);
 		sdc_set_brightness(mx3fb, 0);
-
+		if (!IS_ERR(mx3_fbi->reg_lcd)) {
+			if (regulator_disable(mx3_fbi->reg_lcd)) {
+				dev_err(&pdev->dev,
+					"Failed to disable regulator.\n");
+			}
+		}
 	}
 	return 0;
 }
@@ -1249,6 +1268,12 @@ static int mx3fb_resume(struct platform_device *pdev)
 	if (mx3_fbi->blank = FB_BLANK_UNBLANK) {
 		sdc_enable_channel(mx3_fbi);
 		sdc_set_brightness(mx3fb, mx3fb->backlight_level);
+		if (!IS_ERR(mx3_fbi->reg_lcd)) {
+			if (regulator_enable(mx3_fbi->reg_lcd)) {
+				dev_err(&pdev->dev,
+					"Failed to enable regulator.\n");
+			}
+		}
 	}
 
 	console_lock();
@@ -1394,6 +1419,7 @@ static int init_fb_chan(struct mx3fb_data *mx3fb, struct idmac_channel *ichan)
 	struct mx3fb_platform_data *mx3fb_pdata = dev_get_platdata(dev);
 	struct device_node *np = dev->of_node;
 	const char *name;
+	const char *regulator_name;
 	const char *ipu_disp_format;
 	unsigned int irq;
 	struct fb_info *fbi;
@@ -1409,6 +1435,9 @@ static int init_fb_chan(struct mx3fb_data *mx3fb, struct idmac_channel *ichan)
 			return -EINVAL;
 		}
 
+		of_property_read_string(display_np, "regulator-name",
+					&regulator_name);
+
 		of_property_read_string(display_np, "interface-pix-fmt",
 					&ipu_disp_format);
 		if (!ipu_disp_format) {
@@ -1526,6 +1555,21 @@ static int init_fb_chan(struct mx3fb_data *mx3fb, struct idmac_channel *ichan)
 	if (ret < 0)
 		goto esetpar;
 
+	/* In dt mode,
+	 * using devm_regulator_get would require that the proprety referencing
+	 * the regulator phandle has to be inside the mx3fb node.
+	 */
+	if (np) {
+		if (regulator_name)
+			mx3fbi->reg_lcd = regulator_get(NULL, regulator_name);
+
+		if (IS_ERR(mx3fbi->reg_lcd))
+			return PTR_ERR(mx3fbi->reg_lcd);
+	} else {
+		/* Permit that driver without a regulator in non-dt mode */
+		mx3fbi->reg_lcd = regulator_get(dev, "lcd");
+	}
+
 	__blank(FB_BLANK_UNBLANK, fbi);
 
 	dev_info(dev, "registered, using mode %s\n", fb_mode);
@@ -1589,6 +1633,7 @@ static int mx3fb_probe(struct platform_device *pdev)
 	dma_cap_mask_t mask;
 	struct dma_chan *chan;
 	struct dma_chan_request rq;
+	struct mx3fb_info *mx3_fbi;
 	struct device_node *np = dev->of_node;
 	struct videomode *vm;
 	struct fb_videomode *fb_vm;
@@ -1673,6 +1718,12 @@ ersdc0:
 	dmaengine_put();
 	iounmap(mx3fb->reg_base);
 eremap:
+	if (mx3fb->fbi) {
+		mx3_fbi = mx3fb->fbi->par;
+
+		if ((!IS_ERR(mx3_fbi->reg_lcd)) && mx3_fbi->reg_lcd)
+			regulator_put(mx3_fbi->reg_lcd);
+	}
 	dev_err(dev, "mx3fb: failed to register fb\n");
 	return ret;
 }
@@ -1684,6 +1735,9 @@ static int mx3fb_remove(struct platform_device *dev)
 	struct mx3fb_info *mx3_fbi = fbi->par;
 	struct dma_chan *chan;
 
+	if ((!IS_ERR(mx3_fbi->reg_lcd)) && mx3_fbi->reg_lcd)
+		regulator_put(mx3_fbi->reg_lcd);
+
 	chan = &mx3_fbi->idmac_channel->dma_chan;
 	release_fbi(fbi);
 
-- 
1.7.9.5


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

* [PATCH v7][ 3/5] video: mx3fb: Introduce regulator support.
@ 2014-03-14  9:12   ` Denis Carikli
  0 siblings, 0 replies; 26+ messages in thread
From: Denis Carikli @ 2014-03-14  9:12 UTC (permalink / raw)
  To: linux-arm-kernel

This commit is based on the following commit by Fabio Estevam:
  4344429 video: mxsfb: Introduce regulator support

Signed-off-by: Denis Carikli <denis@eukrea.com>
---
ChangeLog v6->v7:
- Removed the Cc from the patch, they went into 
  git send-email instead.

ChangeLog v5->v6:
- Shrinked the Cc list.
- still permit non-dt boards to use that driver without a regulator.

ChangeLog v4->v5:
- Added Shawn Guo in the Cc list.
- Rebased to make it apply.

ChangeLog v3->v4:
- Some code style fixes.
- Improved error handling in eremap.

ChangeLog v2->v3:
- The prints are now replaced with non line wrapped prints.
- The regulator retrival has been adapted to the new DT bindings which looks
  more like the IPUv3 ones.
- The regulator_is_enabled checks were kept, because regulator_disable do not
  do such check.
---
 drivers/video/mx3fb.c |   56 ++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 55 insertions(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/mx3fb.c b/drivers/video/fbdev/mx3fb.c
index 952d2b5..40b47dd 100644
--- a/drivers/video/fbdev/mx3fb.c
+++ b/drivers/video/fbdev/mx3fb.c
@@ -27,6 +27,7 @@
 #include <linux/clk.h>
 #include <linux/mutex.h>
 #include <linux/dma/ipu-dma.h>
+#include <linux/regulator/consumer.h>
 
 #include <linux/platform_data/dma-imx.h>
 #include <linux/platform_data/video-mx3fb.h>
@@ -273,6 +274,7 @@ struct mx3fb_info {
 	struct dma_async_tx_descriptor	*txd;
 	dma_cookie_t			cookie;
 	struct scatterlist		sg[2];
+	struct regulator		*reg_lcd;
 
 	struct fb_var_screeninfo	cur_var; /* current var info */
 	uint32_t			flags;
@@ -1042,6 +1044,12 @@ static void __blank(int blank, struct fb_info *fbi)
 	case FB_BLANK_HSYNC_SUSPEND:
 	case FB_BLANK_NORMAL:
 		sdc_set_brightness(mx3fb, 0);
+		if (!IS_ERR(mx3_fbi->reg_lcd)) {
+			if (regulator_disable(mx3_fbi->reg_lcd)) {
+				dev_err(fbi->device,
+					"Failed to disable regulator.\n");
+			}
+		}
 		memset((char *)fbi->screen_base, 0, fbi->fix.smem_len);
 		/* Give LCD time to update - enough for 50 and 60 Hz */
 		msleep(25);
@@ -1049,6 +1057,12 @@ static void __blank(int blank, struct fb_info *fbi)
 		break;
 	case FB_BLANK_UNBLANK:
 		sdc_enable_channel(mx3_fbi);
+		if (!IS_ERR(mx3_fbi->reg_lcd)) {
+			if (regulator_enable(mx3_fbi->reg_lcd)) {
+				dev_err(fbi->device,
+					"Failed to enable regulator.\n");
+			}
+		}
 		sdc_set_brightness(mx3fb, mx3fb->backlight_level);
 		break;
 	}
@@ -1233,7 +1247,12 @@ static int mx3fb_suspend(struct platform_device *pdev, pm_message_t state)
 	if (mx3_fbi->blank == FB_BLANK_UNBLANK) {
 		sdc_disable_channel(mx3_fbi);
 		sdc_set_brightness(mx3fb, 0);
-
+		if (!IS_ERR(mx3_fbi->reg_lcd)) {
+			if (regulator_disable(mx3_fbi->reg_lcd)) {
+				dev_err(&pdev->dev,
+					"Failed to disable regulator.\n");
+			}
+		}
 	}
 	return 0;
 }
@@ -1249,6 +1268,12 @@ static int mx3fb_resume(struct platform_device *pdev)
 	if (mx3_fbi->blank == FB_BLANK_UNBLANK) {
 		sdc_enable_channel(mx3_fbi);
 		sdc_set_brightness(mx3fb, mx3fb->backlight_level);
+		if (!IS_ERR(mx3_fbi->reg_lcd)) {
+			if (regulator_enable(mx3_fbi->reg_lcd)) {
+				dev_err(&pdev->dev,
+					"Failed to enable regulator.\n");
+			}
+		}
 	}
 
 	console_lock();
@@ -1394,6 +1419,7 @@ static int init_fb_chan(struct mx3fb_data *mx3fb, struct idmac_channel *ichan)
 	struct mx3fb_platform_data *mx3fb_pdata = dev_get_platdata(dev);
 	struct device_node *np = dev->of_node;
 	const char *name;
+	const char *regulator_name;
 	const char *ipu_disp_format;
 	unsigned int irq;
 	struct fb_info *fbi;
@@ -1409,6 +1435,9 @@ static int init_fb_chan(struct mx3fb_data *mx3fb, struct idmac_channel *ichan)
 			return -EINVAL;
 		}
 
+		of_property_read_string(display_np, "regulator-name",
+					&regulator_name);
+
 		of_property_read_string(display_np, "interface-pix-fmt",
 					&ipu_disp_format);
 		if (!ipu_disp_format) {
@@ -1526,6 +1555,21 @@ static int init_fb_chan(struct mx3fb_data *mx3fb, struct idmac_channel *ichan)
 	if (ret < 0)
 		goto esetpar;
 
+	/* In dt mode,
+	 * using devm_regulator_get would require that the proprety referencing
+	 * the regulator phandle has to be inside the mx3fb node.
+	 */
+	if (np) {
+		if (regulator_name)
+			mx3fbi->reg_lcd = regulator_get(NULL, regulator_name);
+
+		if (IS_ERR(mx3fbi->reg_lcd))
+			return PTR_ERR(mx3fbi->reg_lcd);
+	} else {
+		/* Permit that driver without a regulator in non-dt mode */
+		mx3fbi->reg_lcd = regulator_get(dev, "lcd");
+	}
+
 	__blank(FB_BLANK_UNBLANK, fbi);
 
 	dev_info(dev, "registered, using mode %s\n", fb_mode);
@@ -1589,6 +1633,7 @@ static int mx3fb_probe(struct platform_device *pdev)
 	dma_cap_mask_t mask;
 	struct dma_chan *chan;
 	struct dma_chan_request rq;
+	struct mx3fb_info *mx3_fbi;
 	struct device_node *np = dev->of_node;
 	struct videomode *vm;
 	struct fb_videomode *fb_vm;
@@ -1673,6 +1718,12 @@ ersdc0:
 	dmaengine_put();
 	iounmap(mx3fb->reg_base);
 eremap:
+	if (mx3fb->fbi) {
+		mx3_fbi = mx3fb->fbi->par;
+
+		if ((!IS_ERR(mx3_fbi->reg_lcd)) && mx3_fbi->reg_lcd)
+			regulator_put(mx3_fbi->reg_lcd);
+	}
 	dev_err(dev, "mx3fb: failed to register fb\n");
 	return ret;
 }
@@ -1684,6 +1735,9 @@ static int mx3fb_remove(struct platform_device *dev)
 	struct mx3fb_info *mx3_fbi = fbi->par;
 	struct dma_chan *chan;
 
+	if ((!IS_ERR(mx3_fbi->reg_lcd)) && mx3_fbi->reg_lcd)
+		regulator_put(mx3_fbi->reg_lcd);
+
 	chan = &mx3_fbi->idmac_channel->dma_chan;
 	release_fbi(fbi);
 
-- 
1.7.9.5

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

* [PATCH v7][ 4/5] ARM: dts: i.MX35: Add display support.
  2014-03-14  9:12 ` Denis Carikli
@ 2014-03-14  9:12   ` Denis Carikli
  -1 siblings, 0 replies; 26+ messages in thread
From: Denis Carikli @ 2014-03-14  9:12 UTC (permalink / raw)
  To: linux-arm-kernel

There is already a "dma ipu driver" for the mx3*
that is currently at drivers/dma/ipu/ipu_idmac.c

The mx3fb framebuffer driver uses this "dma ipu driver".

The goal is not to expose the "dma ipu driver" in the device
tree bindings, to make the mx3fb bindings look similar
to the ipuv3 ones.

In the device tree bindings, the "dma ipu driver" is absent,
and the mx3fb compatible is "fsl,imx<soc>-ipu".

An node for the mx3fb was also added in the imx35 dtsi.

Signed-off-by: Denis Carikli <denis@eukrea.com>
---
ChangeLog v6->v7:
- Removed the Cc from the patch, they went into 
  git send-email instead.
- Removed the comment, and instead a commit messaage was 
  added to explain the non-straingtforward part of the change.

ChangeLog v5->v6:
- Shrinked the Cc list.

ChangeLog v4->v5:
- Added Grant Likely and Shawn Guo in the Cc list.
- Adapted to the new non-dma ipu bindings.
- Adapted to the use of imx35-pingrp.h
- The pinctrl ipu node addition was moved in this commit.

ChangeLog v3->v4:
- Splitted the imx35.dtsi display support (new patch).
---
 arch/arm/boot/dts/imx35.dtsi |    7 +++++++
 arch/arm/mach-imx/imx35-dt.c |    6 ++++++
 2 files changed, 13 insertions(+)

diff --git a/arch/arm/boot/dts/imx35.dtsi b/arch/arm/boot/dts/imx35.dtsi
index e59ccb4..b9bf6a0 100644
--- a/arch/arm/boot/dts/imx35.dtsi
+++ b/arch/arm/boot/dts/imx35.dtsi
@@ -230,6 +230,13 @@
 				status = "disabled";
 			};
 
+			ipu: ipu@53fc0000 {
+				compatible = "fsl,imx35-ipu";
+				reg = <0x53fc0000 0x4000>;
+				clocks = <&clks 55>;
+				status = "disabled";
+			};
+
 			audmux: audmux@53fc4000 {
 				compatible = "fsl,imx35-audmux", "fsl,imx31-audmux";
 				reg = <0x53fc4000 0x4000>;
diff --git a/arch/arm/mach-imx/imx35-dt.c b/arch/arm/mach-imx/imx35-dt.c
index 9d48e00..657cc5d 100644
--- a/arch/arm/mach-imx/imx35-dt.c
+++ b/arch/arm/mach-imx/imx35-dt.c
@@ -18,14 +18,20 @@
 #include <asm/mach/time.h>
 #include <asm/hardware/cache-l2x0.h>
 #include "common.h"
+#include "devices-imx35.h"
 #include "mx35.h"
 
 static void __init imx35_dt_init(void)
 {
+	struct device_node *np;
 	mxc_arch_reset_init_dt();
 
 	of_platform_populate(NULL, of_default_bus_match_table,
 			     NULL, NULL);
+
+	np = of_find_compatible_node(NULL, NULL, "fsl,imx35-ipu");
+	if (of_device_is_available(np))
+		imx35_add_ipu_core();
 }
 
 static void __init imx35_irq_init(void)
-- 
1.7.9.5


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

* [PATCH v7][ 4/5] ARM: dts: i.MX35: Add display support.
@ 2014-03-14  9:12   ` Denis Carikli
  0 siblings, 0 replies; 26+ messages in thread
From: Denis Carikli @ 2014-03-14  9:12 UTC (permalink / raw)
  To: linux-arm-kernel

There is already a "dma ipu driver" for the mx3*
that is currently at drivers/dma/ipu/ipu_idmac.c

The mx3fb framebuffer driver uses this "dma ipu driver".

The goal is not to expose the "dma ipu driver" in the device
tree bindings, to make the mx3fb bindings look similar
to the ipuv3 ones.

In the device tree bindings, the "dma ipu driver" is absent,
and the mx3fb compatible is "fsl,imx<soc>-ipu".

An node for the mx3fb was also added in the imx35 dtsi.

Signed-off-by: Denis Carikli <denis@eukrea.com>
---
ChangeLog v6->v7:
- Removed the Cc from the patch, they went into 
  git send-email instead.
- Removed the comment, and instead a commit messaage was 
  added to explain the non-straingtforward part of the change.

ChangeLog v5->v6:
- Shrinked the Cc list.

ChangeLog v4->v5:
- Added Grant Likely and Shawn Guo in the Cc list.
- Adapted to the new non-dma ipu bindings.
- Adapted to the use of imx35-pingrp.h
- The pinctrl ipu node addition was moved in this commit.

ChangeLog v3->v4:
- Splitted the imx35.dtsi display support (new patch).
---
 arch/arm/boot/dts/imx35.dtsi |    7 +++++++
 arch/arm/mach-imx/imx35-dt.c |    6 ++++++
 2 files changed, 13 insertions(+)

diff --git a/arch/arm/boot/dts/imx35.dtsi b/arch/arm/boot/dts/imx35.dtsi
index e59ccb4..b9bf6a0 100644
--- a/arch/arm/boot/dts/imx35.dtsi
+++ b/arch/arm/boot/dts/imx35.dtsi
@@ -230,6 +230,13 @@
 				status = "disabled";
 			};
 
+			ipu: ipu at 53fc0000 {
+				compatible = "fsl,imx35-ipu";
+				reg = <0x53fc0000 0x4000>;
+				clocks = <&clks 55>;
+				status = "disabled";
+			};
+
 			audmux: audmux at 53fc4000 {
 				compatible = "fsl,imx35-audmux", "fsl,imx31-audmux";
 				reg = <0x53fc4000 0x4000>;
diff --git a/arch/arm/mach-imx/imx35-dt.c b/arch/arm/mach-imx/imx35-dt.c
index 9d48e00..657cc5d 100644
--- a/arch/arm/mach-imx/imx35-dt.c
+++ b/arch/arm/mach-imx/imx35-dt.c
@@ -18,14 +18,20 @@
 #include <asm/mach/time.h>
 #include <asm/hardware/cache-l2x0.h>
 #include "common.h"
+#include "devices-imx35.h"
 #include "mx35.h"
 
 static void __init imx35_dt_init(void)
 {
+	struct device_node *np;
 	mxc_arch_reset_init_dt();
 
 	of_platform_populate(NULL, of_default_bus_match_table,
 			     NULL, NULL);
+
+	np = of_find_compatible_node(NULL, NULL, "fsl,imx35-ipu");
+	if (of_device_is_available(np))
+		imx35_add_ipu_core();
 }
 
 static void __init imx35_irq_init(void)
-- 
1.7.9.5

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

* =?UTF-8?q?=5BPATCH=20v7=5D=5B=205/5=5D=20ARM=3A=20dts=3A=20mbimxsd35=20Add=20video=20and=20displays=
  2014-03-14  9:12 ` Denis Carikli
@ 2014-03-14  9:12   ` Denis Carikli
  -1 siblings, 0 replies; 26+ messages in thread
From: Denis Carikli @ 2014-03-14  9:12 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Denis Carikli <denis@eukrea.com>
---
ChangeLog v6->v7:
- Removed the Cc from the patch, they went into 
  git send-email instead.

ChangeLog v5->v6:
- Shrinked the Cc list.
- Added the targets in the Makefile
- rebased not to use the now gone pingrp headers.

ChangeLog v4->v5:
- Added Grant Likely and Shawn Guo in the Cc list.
- Adapted to the new non-dma ipu bindings.

ChangeLog v3->v4:
- Shortened the licenses.
- adapted the dts(i) to the new bindings.
ChangeLog v2->v3:
- The dts were adapted to the new DT bindings which looks more like the IPUv3
  ones.
---
 arch/arm/boot/dts/Makefile                         |    3 +
 arch/arm/boot/dts/imx35-eukrea-cpuimx35.dtsi       |   28 ++++++++++
 .../imx35-eukrea-mbimxsd35-baseboard-cmo-qvga.dts  |   58 ++++++++++++++++++++
 .../imx35-eukrea-mbimxsd35-baseboard-dvi-svga.dts  |   47 ++++++++++++++++
 .../imx35-eukrea-mbimxsd35-baseboard-dvi-vga.dts   |   47 ++++++++++++++++
 5 files changed, 183 insertions(+)
 create mode 100644 arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard-cmo-qvga.dts
 create mode 100644 arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard-dvi-svga.dts
 create mode 100644 arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard-dvi-vga.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index cf6c523..1df8945 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -173,6 +173,9 @@ dtb-$(CONFIG_ARCH_MXC) += \
 	imx27-phytec-phycard-s-rdk.dtb \
 	imx31-bug.dtb \
 	imx35-eukrea-mbimxsd35-baseboard.dtb \
+	imx35-eukrea-mbimxsd35-baseboard-cmo-qvga.dtb \
+	imx35-eukrea-mbimxsd35-baseboard-dvi-svga.dtb \
+	imx35-eukrea-mbimxsd35-baseboard-dvi-vga.dtb \
 	imx50-evk.dtb \
 	imx51-apf51.dtb \
 	imx51-apf51dev.dtb \
diff --git a/arch/arm/boot/dts/imx35-eukrea-cpuimx35.dtsi b/arch/arm/boot/dts/imx35-eukrea-cpuimx35.dtsi
index 906ae93..6596009 100644
--- a/arch/arm/boot/dts/imx35-eukrea-cpuimx35.dtsi
+++ b/arch/arm/boot/dts/imx35-eukrea-cpuimx35.dtsi
@@ -70,6 +70,34 @@
 				MX35_PAD_I2C1_DAT__I2C1_SDA		0x80000000
 			>;
 		};
+
+		pinctrl_ipu_disp0: ipudisp0grp {
+			fsl,pins = <
+				MX35_PAD_LD0__IPU_DISPB_DAT_0         0x80000000
+				MX35_PAD_LD1__IPU_DISPB_DAT_1         0x80000000
+				MX35_PAD_LD2__IPU_DISPB_DAT_2         0x80000000
+				MX35_PAD_LD3__IPU_DISPB_DAT_3         0x80000000
+				MX35_PAD_LD4__IPU_DISPB_DAT_4         0x80000000
+				MX35_PAD_LD5__IPU_DISPB_DAT_5         0x80000000
+				MX35_PAD_LD6__IPU_DISPB_DAT_6         0x80000000
+				MX35_PAD_LD7__IPU_DISPB_DAT_7         0x80000000
+				MX35_PAD_LD8__IPU_DISPB_DAT_8         0x80000000
+				MX35_PAD_LD9__IPU_DISPB_DAT_9         0x80000000
+				MX35_PAD_LD10__IPU_DISPB_DAT_10       0x80000000
+				MX35_PAD_LD11__IPU_DISPB_DAT_11       0x80000000
+				MX35_PAD_LD12__IPU_DISPB_DAT_12       0x80000000
+				MX35_PAD_LD13__IPU_DISPB_DAT_13       0x80000000
+				MX35_PAD_LD14__IPU_DISPB_DAT_14       0x80000000
+				MX35_PAD_LD15__IPU_DISPB_DAT_15       0x80000000
+				MX35_PAD_LD16__IPU_DISPB_DAT_16       0x80000000
+				MX35_PAD_LD17__IPU_DISPB_DAT_17       0x80000000
+				MX35_PAD_D3_HSYNC__IPU_DISPB_D3_HSYNC 0x80000000
+				MX35_PAD_D3_FPSHIFT__IPU_DISPB_D3_CLK 0x80000000
+				MX35_PAD_D3_DRDY__IPU_DISPB_D3_DRDY   0x80000000
+				MX35_PAD_D3_VSYNC__IPU_DISPB_D3_VSYNC 0x80000000
+				MX35_PAD_CONTRAST__IPU_DISPB_CONTR    0x80000000
+			>;
+		};
 	};
 };
 
diff --git a/arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard-cmo-qvga.dts b/arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard-cmo-qvga.dts
new file mode 100644
index 0000000..345f560
--- /dev/null
+++ b/arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard-cmo-qvga.dts
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2013 Eukréa Electromatique <denis@eukrea.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include "imx35-eukrea-mbimxsd35-baseboard.dts"
+
+/ {
+	model = "Eukrea MBIMXSD35 with the CMO-QVGA Display";
+	compatible = "eukrea,mbimxsd35-baseboard-cmo-qvga", "eukrea,mbimxsd35-baseboard", "eukrea,cpuimx35", "fsl,imx35";
+
+	cmo_qvga: display@di0 {
+		compatible = "fsl,mx3-parallel-display";
+		regulator-name = "lcd";
+		interface-pix-fmt = "rgb666";
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_ipu_disp0>;
+		lcd-supply = <&reg_lcd_3v3>;
+		model = "CMO-QVGA";
+		display-timings {
+			qvga_timings: 320x240 {
+				clock-frequency = <6500000>;
+				hactive = <320>;
+				vactive = <240>;
+				hback-porch = <68>;
+				hfront-porch = <20>;
+				vback-porch = <15>;
+				vfront-porch = <4>;
+				hsync-len = <30>;
+				vsync-len = <3>;
+			};
+		};
+	};
+
+	reg_lcd_3v3: lcd-en {
+		compatible = "regulator-fixed";
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_reg_lcd_3v3>;
+		regulator-name = "lcd";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		gpio = <&gpio1 4 0>;
+		enable-active-high;
+	};
+};
+
+&ipu {
+	display = <&cmo_qvga>;
+	status = "okay";
+};
diff --git a/arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard-dvi-svga.dts b/arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard-dvi-svga.dts
new file mode 100644
index 0000000..1a249d0
--- /dev/null
+++ b/arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard-dvi-svga.dts
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2013 Eukréa Electromatique <denis@eukrea.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include "imx35-eukrea-mbimxsd35-baseboard.dts"
+
+/ {
+	model = "Eukrea MBIMXSD35 with the DVI-SVGA Display";
+	compatible = "eukrea,mbimxsd35-baseboard-dvi-svga", "eukrea,mbimxsd35-baseboard", "eukrea,cpuimx35", "fsl,imx35";
+	dvi_svga: display@di0 {
+		interface-pix-fmt = "rgb666";
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_ipu_disp0>;
+		model = "DVI-SVGA";
+		display-timings {
+			svga_timings: 800x600 {
+				clock-frequency = <40000000>;
+				hactive = <800>;
+				vactive = <600>;
+				hback-porch = <75>;
+				hfront-porch = <75>;
+				vback-porch = <7>;
+				vfront-porch = <75>;
+				hsync-len = <7>;
+				vsync-len = <7>;
+				hsync-active = <1>;
+				vsync-active = <1>;
+				de-active = <1>;
+				pixelclk-active = <0>;
+			};
+		};
+	};
+};
+
+&ipu {
+	display = <&dvi_svga>;
+	status = "okay";
+};
diff --git a/arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard-dvi-vga.dts b/arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard-dvi-vga.dts
new file mode 100644
index 0000000..44a7616
--- /dev/null
+++ b/arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard-dvi-vga.dts
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2013 Eukréa Electromatique <denis@eukrea.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include "imx35-eukrea-mbimxsd35-baseboard.dts"
+
+/ {
+	model = "Eukrea MBIMXSD35 with the DVI-VGA Display";
+	compatible = "eukrea,mbimxsd35-baseboard-dvi-vga", "eukrea,mbimxsd35-baseboard", "eukrea,cpuimx35", "fsl,imx35";
+	dvi_vga: display@di0 {
+		interface-pix-fmt = "rgb666";
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_ipu_disp0>;
+		model = "DVI-VGA";
+		display-timings {
+			vga_timings: 640x480 {
+				clock-frequency = <31250000>;
+				hactive = <640>;
+				vactive = <480>;
+				hback-porch = <100>;
+				hfront-porch = <100>;
+				vback-porch = <7>;
+				vfront-porch = <100>;
+				hsync-len = <7>;
+				vsync-len = <7>;
+				hsync-active = <1>;
+				vsync-active = <1>;
+				de-active = <1>;
+				pixelclk-active = <0>;
+			};
+		};
+	};
+};
+
+&ipu {
+	display = <&dvi_vga>;
+	status = "okay";
+};
-- 
1.7.9.5


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

* [PATCH v7][ 5/5] ARM: dts: mbimxsd35 Add video and displays support.
@ 2014-03-14  9:12   ` Denis Carikli
  0 siblings, 0 replies; 26+ messages in thread
From: Denis Carikli @ 2014-03-14  9:12 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Denis Carikli <denis@eukrea.com>
---
ChangeLog v6->v7:
- Removed the Cc from the patch, they went into 
  git send-email instead.

ChangeLog v5->v6:
- Shrinked the Cc list.
- Added the targets in the Makefile
- rebased not to use the now gone pingrp headers.

ChangeLog v4->v5:
- Added Grant Likely and Shawn Guo in the Cc list.
- Adapted to the new non-dma ipu bindings.

ChangeLog v3->v4:
- Shortened the licenses.
- adapted the dts(i) to the new bindings.
ChangeLog v2->v3:
- The dts were adapted to the new DT bindings which looks more like the IPUv3
  ones.
---
 arch/arm/boot/dts/Makefile                         |    3 +
 arch/arm/boot/dts/imx35-eukrea-cpuimx35.dtsi       |   28 ++++++++++
 .../imx35-eukrea-mbimxsd35-baseboard-cmo-qvga.dts  |   58 ++++++++++++++++++++
 .../imx35-eukrea-mbimxsd35-baseboard-dvi-svga.dts  |   47 ++++++++++++++++
 .../imx35-eukrea-mbimxsd35-baseboard-dvi-vga.dts   |   47 ++++++++++++++++
 5 files changed, 183 insertions(+)
 create mode 100644 arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard-cmo-qvga.dts
 create mode 100644 arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard-dvi-svga.dts
 create mode 100644 arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard-dvi-vga.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index cf6c523..1df8945 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -173,6 +173,9 @@ dtb-$(CONFIG_ARCH_MXC) += \
 	imx27-phytec-phycard-s-rdk.dtb \
 	imx31-bug.dtb \
 	imx35-eukrea-mbimxsd35-baseboard.dtb \
+	imx35-eukrea-mbimxsd35-baseboard-cmo-qvga.dtb \
+	imx35-eukrea-mbimxsd35-baseboard-dvi-svga.dtb \
+	imx35-eukrea-mbimxsd35-baseboard-dvi-vga.dtb \
 	imx50-evk.dtb \
 	imx51-apf51.dtb \
 	imx51-apf51dev.dtb \
diff --git a/arch/arm/boot/dts/imx35-eukrea-cpuimx35.dtsi b/arch/arm/boot/dts/imx35-eukrea-cpuimx35.dtsi
index 906ae93..6596009 100644
--- a/arch/arm/boot/dts/imx35-eukrea-cpuimx35.dtsi
+++ b/arch/arm/boot/dts/imx35-eukrea-cpuimx35.dtsi
@@ -70,6 +70,34 @@
 				MX35_PAD_I2C1_DAT__I2C1_SDA		0x80000000
 			>;
 		};
+
+		pinctrl_ipu_disp0: ipudisp0grp {
+			fsl,pins = <
+				MX35_PAD_LD0__IPU_DISPB_DAT_0         0x80000000
+				MX35_PAD_LD1__IPU_DISPB_DAT_1         0x80000000
+				MX35_PAD_LD2__IPU_DISPB_DAT_2         0x80000000
+				MX35_PAD_LD3__IPU_DISPB_DAT_3         0x80000000
+				MX35_PAD_LD4__IPU_DISPB_DAT_4         0x80000000
+				MX35_PAD_LD5__IPU_DISPB_DAT_5         0x80000000
+				MX35_PAD_LD6__IPU_DISPB_DAT_6         0x80000000
+				MX35_PAD_LD7__IPU_DISPB_DAT_7         0x80000000
+				MX35_PAD_LD8__IPU_DISPB_DAT_8         0x80000000
+				MX35_PAD_LD9__IPU_DISPB_DAT_9         0x80000000
+				MX35_PAD_LD10__IPU_DISPB_DAT_10       0x80000000
+				MX35_PAD_LD11__IPU_DISPB_DAT_11       0x80000000
+				MX35_PAD_LD12__IPU_DISPB_DAT_12       0x80000000
+				MX35_PAD_LD13__IPU_DISPB_DAT_13       0x80000000
+				MX35_PAD_LD14__IPU_DISPB_DAT_14       0x80000000
+				MX35_PAD_LD15__IPU_DISPB_DAT_15       0x80000000
+				MX35_PAD_LD16__IPU_DISPB_DAT_16       0x80000000
+				MX35_PAD_LD17__IPU_DISPB_DAT_17       0x80000000
+				MX35_PAD_D3_HSYNC__IPU_DISPB_D3_HSYNC 0x80000000
+				MX35_PAD_D3_FPSHIFT__IPU_DISPB_D3_CLK 0x80000000
+				MX35_PAD_D3_DRDY__IPU_DISPB_D3_DRDY   0x80000000
+				MX35_PAD_D3_VSYNC__IPU_DISPB_D3_VSYNC 0x80000000
+				MX35_PAD_CONTRAST__IPU_DISPB_CONTR    0x80000000
+			>;
+		};
 	};
 };
 
diff --git a/arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard-cmo-qvga.dts b/arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard-cmo-qvga.dts
new file mode 100644
index 0000000..345f560
--- /dev/null
+++ b/arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard-cmo-qvga.dts
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2013 Eukr?a Electromatique <denis@eukrea.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include "imx35-eukrea-mbimxsd35-baseboard.dts"
+
+/ {
+	model = "Eukrea MBIMXSD35 with the CMO-QVGA Display";
+	compatible = "eukrea,mbimxsd35-baseboard-cmo-qvga", "eukrea,mbimxsd35-baseboard", "eukrea,cpuimx35", "fsl,imx35";
+
+	cmo_qvga: display at di0 {
+		compatible = "fsl,mx3-parallel-display";
+		regulator-name = "lcd";
+		interface-pix-fmt = "rgb666";
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_ipu_disp0>;
+		lcd-supply = <&reg_lcd_3v3>;
+		model = "CMO-QVGA";
+		display-timings {
+			qvga_timings: 320x240 {
+				clock-frequency = <6500000>;
+				hactive = <320>;
+				vactive = <240>;
+				hback-porch = <68>;
+				hfront-porch = <20>;
+				vback-porch = <15>;
+				vfront-porch = <4>;
+				hsync-len = <30>;
+				vsync-len = <3>;
+			};
+		};
+	};
+
+	reg_lcd_3v3: lcd-en {
+		compatible = "regulator-fixed";
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_reg_lcd_3v3>;
+		regulator-name = "lcd";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		gpio = <&gpio1 4 0>;
+		enable-active-high;
+	};
+};
+
+&ipu {
+	display = <&cmo_qvga>;
+	status = "okay";
+};
diff --git a/arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard-dvi-svga.dts b/arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard-dvi-svga.dts
new file mode 100644
index 0000000..1a249d0
--- /dev/null
+++ b/arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard-dvi-svga.dts
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2013 Eukr?a Electromatique <denis@eukrea.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include "imx35-eukrea-mbimxsd35-baseboard.dts"
+
+/ {
+	model = "Eukrea MBIMXSD35 with the DVI-SVGA Display";
+	compatible = "eukrea,mbimxsd35-baseboard-dvi-svga", "eukrea,mbimxsd35-baseboard", "eukrea,cpuimx35", "fsl,imx35";
+	dvi_svga: display at di0 {
+		interface-pix-fmt = "rgb666";
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_ipu_disp0>;
+		model = "DVI-SVGA";
+		display-timings {
+			svga_timings: 800x600 {
+				clock-frequency = <40000000>;
+				hactive = <800>;
+				vactive = <600>;
+				hback-porch = <75>;
+				hfront-porch = <75>;
+				vback-porch = <7>;
+				vfront-porch = <75>;
+				hsync-len = <7>;
+				vsync-len = <7>;
+				hsync-active = <1>;
+				vsync-active = <1>;
+				de-active = <1>;
+				pixelclk-active = <0>;
+			};
+		};
+	};
+};
+
+&ipu {
+	display = <&dvi_svga>;
+	status = "okay";
+};
diff --git a/arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard-dvi-vga.dts b/arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard-dvi-vga.dts
new file mode 100644
index 0000000..44a7616
--- /dev/null
+++ b/arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard-dvi-vga.dts
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2013 Eukr?a Electromatique <denis@eukrea.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include "imx35-eukrea-mbimxsd35-baseboard.dts"
+
+/ {
+	model = "Eukrea MBIMXSD35 with the DVI-VGA Display";
+	compatible = "eukrea,mbimxsd35-baseboard-dvi-vga", "eukrea,mbimxsd35-baseboard", "eukrea,cpuimx35", "fsl,imx35";
+	dvi_vga: display at di0 {
+		interface-pix-fmt = "rgb666";
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_ipu_disp0>;
+		model = "DVI-VGA";
+		display-timings {
+			vga_timings: 640x480 {
+				clock-frequency = <31250000>;
+				hactive = <640>;
+				vactive = <480>;
+				hback-porch = <100>;
+				hfront-porch = <100>;
+				vback-porch = <7>;
+				vfront-porch = <100>;
+				hsync-len = <7>;
+				vsync-len = <7>;
+				hsync-active = <1>;
+				vsync-active = <1>;
+				de-active = <1>;
+				pixelclk-active = <0>;
+			};
+		};
+	};
+};
+
+&ipu {
+	display = <&dvi_vga>;
+	status = "okay";
+};
-- 
1.7.9.5

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

* Re: [PATCH v7][ 3/5] video: mx3fb: Introduce  =?UTF-8?B?cmVndWxhdG9yIHN1c
  2014-03-14  9:12   ` Denis Carikli
@ 2014-03-14  9:23     ` Alexander Shiyan
  -1 siblings, 0 replies; 26+ messages in thread
From: Alexander Shiyan @ 2014-03-14  9:23 UTC (permalink / raw)
  To: linux-arm-kernel

0J/Rj9GC0L3QuNGG0LAsIDE0INC80LDRgNGC0LAgMjAxNCwgMTA6MTIgKzAxOjAwINC+0YIgRGVu
aXMgQ2FyaWtsaSA8ZGVuaXNAZXVrcmVhLmNvbT46Cj4gVGhpcyBjb21taXQgaXMgYmFzZWQgb24g
dGhlIGZvbGxvd2luZyBjb21taXQgYnkgRmFiaW8gRXN0ZXZhbToKPiAgIDQzNDQ0MjkgdmlkZW86
IG14c2ZiOiBJbnRyb2R1Y2UgcmVndWxhdG9yIHN1cHBvcnQKPiAKPiBTaWduZWQtb2ZmLWJ5OiBE
ZW5pcyBDYXJpa2xpIDxkZW5pc0BldWtyZWEuY29tPgo+IC0tLQouLi4KPiArCWlmIChucCkgewo+
ICsJCWlmIChyZWd1bGF0b3JfbmFtZSkKPiArCQkJbXgzZmJpLT5yZWdfbGNkID0gcmVndWxhdG9y
X2dldChOVUxMLCByZWd1bGF0b3JfbmFtZSk7Cj4gKwo+ICsJCWlmIChJU19FUlIobXgzZmJpLT5y
ZWdfbGNkKSkKPiArCQkJcmV0dXJuIFBUUl9FUlIobXgzZmJpLT5yZWdfbGNkKTsKPiArCX0gZWxz
ZSB7Cj4gKwkJLyogUGVybWl0IHRoYXQgZHJpdmVyIHdpdGhvdXQgYSByZWd1bGF0b3IgaW4gbm9u
LWR0IG1vZGUgKi8KPiArCQlteDNmYmktPnJlZ19sY2QgPSByZWd1bGF0b3JfZ2V0KGRldiwgImxj
ZCIpOwo+ICsJfQoKSSBhbSBzdGlsbCBjb21wbGV0ZWx5IGRvIG5vdCB1bmRlcnN0YW5kIHdoeSBk
byB5b3UgbmVlZCB0byBoYXZlCiJyZWd1bGF0b3JfbmFtZSIgcHJvcGVydHk/CldoeSB0aGlzIGNh
bm5vdCBiZSBkZXZtX3JlZ3VsYXRvcl9nZXQoZGV2LCAibGNkIikgaW4gYm90aCBEVCBhbmQgbm9u
LURUIGNhc2U/CgotLS0K

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

* Re: [PATCH v7][ 3/5] video: mx3fb: Introduce regulator support.
@ 2014-03-14  9:23     ` Alexander Shiyan
  0 siblings, 0 replies; 26+ messages in thread
From: Alexander Shiyan @ 2014-03-14  9:23 UTC (permalink / raw)
  To: linux-arm-kernel

???????, 14 ????? 2014, 10:12 +01:00 ?? Denis Carikli <denis@eukrea.com>:
> This commit is based on the following commit by Fabio Estevam:
>   4344429 video: mxsfb: Introduce regulator support
> 
> Signed-off-by: Denis Carikli <denis@eukrea.com>
> ---
...
> +	if (np) {
> +		if (regulator_name)
> +			mx3fbi->reg_lcd = regulator_get(NULL, regulator_name);
> +
> +		if (IS_ERR(mx3fbi->reg_lcd))
> +			return PTR_ERR(mx3fbi->reg_lcd);
> +	} else {
> +		/* Permit that driver without a regulator in non-dt mode */
> +		mx3fbi->reg_lcd = regulator_get(dev, "lcd");
> +	}

I am still completely do not understand why do you need to have
"regulator_name" property?
Why this cannot be devm_regulator_get(dev, "lcd") in both DT and non-DT case?

---

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

* Re: [PATCH v7][ 3/5] video: mx3fb: Introduce regulator support.
  2014-03-14  9:23     ` [PATCH v7][ 3/5] video: mx3fb: Introduce regulator support Alexander Shiyan
@ 2014-03-14 11:23       ` Denis Carikli
  -1 siblings, 0 replies; 26+ messages in thread
From: Denis Carikli @ 2014-03-14 11:23 UTC (permalink / raw)
  To: linux-arm-kernel

On 03/14/2014 10:23 AM, Alexander Shiyan wrote:
> Why this cannot be devm_regulator_get(dev, "lcd") in both DT and non-DT case?

I need to add device tree support to the mx3fb driver.
My first approach gave a binding that looked like that:

cmo_qvga: display {
   model = "CMO-QVGA";
   [...]
   display-timings {
     qvga_timings: 320x240 {
       hactive = <320>;
       vactive = <240>;
       [...]
    };
};

ipu: ipu@53fc0000 {
   compatible = "fsl,imx31-ipu";
   reg = < 0x53fc0000 0x5f
   0x53fc0088 0x2b >;
   interrupts = <42 41>;
   dma-channels = <32>;
   #dma-cells = <1>;
   clocks = <&clks 55>;
   clock-names = "";
};

lcdc: mx3fb@53fc00b4 {
   compatible = "fsl,mx3-fb";
   reg = <0x53fc00b4 0x0b>;
   clocks = <&clks 55>;
   dmas = <&ipu 14>;
   dma-names = "tx";
   display = <&cmo_qvga>;
};

The issue was that exporting the "dma ipu driver" was not a good idea.
I was told to instead make bindings that looks very similar to the ipuv3 
driver[1]
So at the end that gave something like that:

cmo_qvga: display@di0 {
   compatible = "fsl,mx3-parallel-display";
   regulator-name = "lcd";
   lcd-supply = <&reg_lcd_3v3>;
   model = "CMO-QVGA";
   display-timings {
     qvga_timings: 320x240 {
       hactive = <320>;
       vactive = <240>;
       [...]
    };
};

ipu: ipu@53fc0000 {
   compatible = "fsl,imx35-ipu";
   reg = <0x53fc0000 0x4000>;
   clocks = <&clks 55>;
   display = <&cmo_qvga>;
};

So here fsl,imx35-ipu is binded to the mx3fb driver.
But the mx3fb driver still need to use the dma-ipu driver somehow.
That's why the dma-ipu driver is handled behind the scenes, that way
it's not exported to the device tree bindings.

Now, since the mx3fb driver is binded to the "fsl,imx35-ipu" compatible,
if I would do a "mx3fbi->reg_lcd = devm_regulator_get(dev, "lcd");",
that would then lookup for the regulator in the mx3fb node
(The last "ipu@53fc0000" here).

Instead the regulator can be found in the display node,
which has no driver associated with it.

In the case of the ipuv3, the parallel display driver is associated
with the display@di0 node, so the device matches with the device tree
node directly.

References:
-----------
[1] The ipuv3 driver is in drivers/staging/imx-drm/
[2] the dma ipu driver is in drivers/dma/ipu/

Denis.


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

* [PATCH v7][ 3/5] video: mx3fb: Introduce regulator support.
@ 2014-03-14 11:23       ` Denis Carikli
  0 siblings, 0 replies; 26+ messages in thread
From: Denis Carikli @ 2014-03-14 11:23 UTC (permalink / raw)
  To: linux-arm-kernel

On 03/14/2014 10:23 AM, Alexander Shiyan wrote:
> Why this cannot be devm_regulator_get(dev, "lcd") in both DT and non-DT case?

I need to add device tree support to the mx3fb driver.
My first approach gave a binding that looked like that:

cmo_qvga: display {
   model = "CMO-QVGA";
   [...]
   display-timings {
     qvga_timings: 320x240 {
       hactive = <320>;
       vactive = <240>;
       [...]
    };
};

ipu: ipu at 53fc0000 {
   compatible = "fsl,imx31-ipu";
   reg = < 0x53fc0000 0x5f
   0x53fc0088 0x2b >;
   interrupts = <42 41>;
   dma-channels = <32>;
   #dma-cells = <1>;
   clocks = <&clks 55>;
   clock-names = "";
};

lcdc: mx3fb at 53fc00b4 {
   compatible = "fsl,mx3-fb";
   reg = <0x53fc00b4 0x0b>;
   clocks = <&clks 55>;
   dmas = <&ipu 14>;
   dma-names = "tx";
   display = <&cmo_qvga>;
};

The issue was that exporting the "dma ipu driver" was not a good idea.
I was told to instead make bindings that looks very similar to the ipuv3 
driver[1]
So at the end that gave something like that:

cmo_qvga: display at di0 {
   compatible = "fsl,mx3-parallel-display";
   regulator-name = "lcd";
   lcd-supply = <&reg_lcd_3v3>;
   model = "CMO-QVGA";
   display-timings {
     qvga_timings: 320x240 {
       hactive = <320>;
       vactive = <240>;
       [...]
    };
};

ipu: ipu at 53fc0000 {
   compatible = "fsl,imx35-ipu";
   reg = <0x53fc0000 0x4000>;
   clocks = <&clks 55>;
   display = <&cmo_qvga>;
};

So here fsl,imx35-ipu is binded to the mx3fb driver.
But the mx3fb driver still need to use the dma-ipu driver somehow.
That's why the dma-ipu driver is handled behind the scenes, that way
it's not exported to the device tree bindings.

Now, since the mx3fb driver is binded to the "fsl,imx35-ipu" compatible,
if I would do a "mx3fbi->reg_lcd = devm_regulator_get(dev, "lcd");",
that would then lookup for the regulator in the mx3fb node
(The last "ipu at 53fc0000" here).

Instead the regulator can be found in the display node,
which has no driver associated with it.

In the case of the ipuv3, the parallel display driver is associated
with the display at di0 node, so the device matches with the device tree
node directly.

References:
-----------
[1] The ipuv3 driver is in drivers/staging/imx-drm/
[2] the dma ipu driver is in drivers/dma/ipu/

Denis.

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

* Re: [PATCH v7][ 3/5] video: mx3fb: Introduce  =?UTF-8?B?cmVndWxhdG9yIHN1c
  2014-03-14 11:23       ` Denis Carikli
@ 2014-03-14 12:38         ` Alexander Shiyan
  -1 siblings, 0 replies; 26+ messages in thread
From: Alexander Shiyan @ 2014-03-14 12:38 UTC (permalink / raw)
  To: linux-arm-kernel

0J/Rj9GC0L3QuNGG0LAsIDE0INC80LDRgNGC0LAgMjAxNCwgMTI6MjMgKzAxOjAwINC+0YIgRGVu
aXMgQ2FyaWtsaSA8ZGVuaXNAZXVrcmVhLmNvbT46CgpTYXNjaGEsIFNoYXduLCBjYW4geW91IGNv
bW1lbnQgb24gdGhhdD8KCj4gT24gMDMvMTQvMjAxNCAxMDoyMyBBTSwgQWxleGFuZGVyIFNoaXlh
biB3cm90ZToKPiA+IFdoeSB0aGlzIGNhbm5vdCBiZSBkZXZtX3JlZ3VsYXRvcl9nZXQoZGV2LCAi
bGNkIikgaW4gYm90aCBEVCBhbmQgbm9uLURUIGNhc2U/Cj4gCj4gSSBuZWVkIHRvIGFkZCBkZXZp
Y2UgdHJlZSBzdXBwb3J0IHRvIHRoZSBteDNmYiBkcml2ZXIuCj4gTXkgZmlyc3QgYXBwcm9hY2gg
Z2F2ZSBhIGJpbmRpbmcgdGhhdCBsb29rZWQgbGlrZSB0aGF0Ogo+IAo+IGNtb19xdmdhOiBkaXNw
bGF5IHsKPiAgICBtb2RlbCA9ICJDTU8tUVZHQSI7Cj4gICAgWy4uLl0KPiAgICBkaXNwbGF5LXRp
bWluZ3Mgewo+ICAgICAgcXZnYV90aW1pbmdzOiAzMjB4MjQwIHsKPiAgICAgICAgaGFjdGl2ZSA9
IDwzMjA+Owo+ICAgICAgICB2YWN0aXZlID0gPDI0MD47Cj4gICAgICAgIFsuLi5dCj4gICAgIH07
Cj4gfTsKPiAKPiBpcHU6IGlwdUA1M2ZjMDAwMCB7Cj4gICAgY29tcGF0aWJsZSA9ICJmc2wsaW14
MzEtaXB1IjsKPiAgICByZWcgPSA8IDB4NTNmYzAwMDAgMHg1Zgo+ICAgIDB4NTNmYzAwODggMHgy
YiA+Owo+ICAgIGludGVycnVwdHMgPSA8NDIgNDE+Owo+ICAgIGRtYS1jaGFubmVscyA9IDwzMj47
Cj4gICAgI2RtYS1jZWxscyA9IDwxPjsKPiAgICBjbG9ja3MgPSA8JmNsa3MgNTU+Owo+ICAgIGNs
b2NrLW5hbWVzID0gIiI7Cj4gfTsKPiAKPiBsY2RjOiBteDNmYkA1M2ZjMDBiNCB7Cj4gICAgY29t
cGF0aWJsZSA9ICJmc2wsbXgzLWZiIjsKPiAgICByZWcgPSA8MHg1M2ZjMDBiNCAweDBiPjsKPiAg
ICBjbG9ja3MgPSA8JmNsa3MgNTU+Owo+ICAgIGRtYXMgPSA8JmlwdSAxND47Cj4gICAgZG1hLW5h
bWVzID0gInR4IjsKPiAgICBkaXNwbGF5ID0gPCZjbW9fcXZnYT47Cj4gfTsKPiAKPiBUaGUgaXNz
dWUgd2FzIHRoYXQgZXhwb3J0aW5nIHRoZSAiZG1hIGlwdSBkcml2ZXIiIHdhcyBub3QgYSBnb29k
IGlkZWEuCj4gSSB3YXMgdG9sZCB0byBpbnN0ZWFkIG1ha2UgYmluZGluZ3MgdGhhdCBsb29rcyB2
ZXJ5IHNpbWlsYXIgdG8gdGhlIGlwdXYzIAo+IGRyaXZlclsxXQo+IFNvIGF0IHRoZSBlbmQgdGhh
dCBnYXZlIHNvbWV0aGluZyBsaWtlIHRoYXQ6Cj4gCj4gY21vX3F2Z2E6IGRpc3BsYXlAZGkwIHsK
PiAgICBjb21wYXRpYmxlID0gImZzbCxteDMtcGFyYWxsZWwtZGlzcGxheSI7Cj4gICAgcmVndWxh
dG9yLW5hbWUgPSAibGNkIjsKPiAgICBsY2Qtc3VwcGx5ID0gPCZyZWdfbGNkXzN2Mz47Cj4gICAg
bW9kZWwgPSAiQ01PLVFWR0EiOwo+ICAgIGRpc3BsYXktdGltaW5ncyB7Cj4gICAgICBxdmdhX3Rp
bWluZ3M6IDMyMHgyNDAgewo+ICAgICAgICBoYWN0aXZlID0gPDMyMD47Cj4gICAgICAgIHZhY3Rp
dmUgPSA8MjQwPjsKPiAgICAgICAgWy4uLl0KPiAgICAgfTsKPiB9Owo+IAo+IGlwdTogaXB1QDUz
ZmMwMDAwIHsKPiAgICBjb21wYXRpYmxlID0gImZzbCxpbXgzNS1pcHUiOwo+ICAgIHJlZyA9IDww
eDUzZmMwMDAwIDB4NDAwMD47Cj4gICAgY2xvY2tzID0gPCZjbGtzIDU1PjsKPiAgICBkaXNwbGF5
ID0gPCZjbW9fcXZnYT47Cj4gfTsKPiAKPiBTbyBoZXJlIGZzbCxpbXgzNS1pcHUgaXMgYmluZGVk
IHRvIHRoZSBteDNmYiBkcml2ZXIuCj4gQnV0IHRoZSBteDNmYiBkcml2ZXIgc3RpbGwgbmVlZCB0
byB1c2UgdGhlIGRtYS1pcHUgZHJpdmVyIHNvbWVob3cuCj4gVGhhdCdzIHdoeSB0aGUgZG1hLWlw
dSBkcml2ZXIgaXMgaGFuZGxlZCBiZWhpbmQgdGhlIHNjZW5lcywgdGhhdCB3YXkKPiBpdCdzIG5v
dCBleHBvcnRlZCB0byB0aGUgZGV2aWNlIHRyZWUgYmluZGluZ3MuCj4gCj4gTm93LCBzaW5jZSB0
aGUgbXgzZmIgZHJpdmVyIGlzIGJpbmRlZCB0byB0aGUgImZzbCxpbXgzNS1pcHUiIGNvbXBhdGli
bGUsCj4gaWYgSSB3b3VsZCBkbyBhICJteDNmYmktPnJlZ19sY2QgPSBkZXZtX3JlZ3VsYXRvcl9n
ZXQoZGV2LCAibGNkIik7IiwKPiB0aGF0IHdvdWxkIHRoZW4gbG9va3VwIGZvciB0aGUgcmVndWxh
dG9yIGluIHRoZSBteDNmYiBub2RlCj4gKFRoZSBsYXN0ICJpcHVANTNmYzAwMDAiIGhlcmUpLgo+
IAo+IEluc3RlYWQgdGhlIHJlZ3VsYXRvciBjYW4gYmUgZm91bmQgaW4gdGhlIGRpc3BsYXkgbm9k
ZSwKPiB3aGljaCBoYXMgbm8gZHJpdmVyIGFzc29jaWF0ZWQgd2l0aCBpdC4KPiAKPiBJbiB0aGUg
Y2FzZSBvZiB0aGUgaXB1djMsIHRoZSBwYXJhbGxlbCBkaXNwbGF5IGRyaXZlciBpcyBhc3NvY2lh
dGVkCj4gd2l0aCB0aGUgZGlzcGxheUBkaTAgbm9kZSwgc28gdGhlIGRldmljZSBtYXRjaGVzIHdp
dGggdGhlIGRldmljZSB0cmVlCj4gbm9kZSBkaXJlY3RseS4KPiAKPiBSZWZlcmVuY2VzOgo+IC0t
LS0tLS0tLS0tCj4gWzFdIFRoZSBpcHV2MyBkcml2ZXIgaXMgaW4gZHJpdmVycy9zdGFnaW5nL2lt
eC1kcm0vCj4gWzJdIHRoZSBkbWEgaXB1IGRyaXZlciBpcyBpbiBkcml2ZXJzL2RtYS9pcHUvCj4g
CgotLS0K

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

* Re: [PATCH v7][ 3/5] video: mx3fb: Introduce regulator support.
@ 2014-03-14 12:38         ` Alexander Shiyan
  0 siblings, 0 replies; 26+ messages in thread
From: Alexander Shiyan @ 2014-03-14 12:38 UTC (permalink / raw)
  To: linux-arm-kernel

???????, 14 ????? 2014, 12:23 +01:00 ?? Denis Carikli <denis@eukrea.com>:

Sascha, Shawn, can you comment on that?

> On 03/14/2014 10:23 AM, Alexander Shiyan wrote:
> > Why this cannot be devm_regulator_get(dev, "lcd") in both DT and non-DT case?
> 
> I need to add device tree support to the mx3fb driver.
> My first approach gave a binding that looked like that:
> 
> cmo_qvga: display {
>    model = "CMO-QVGA";
>    [...]
>    display-timings {
>      qvga_timings: 320x240 {
>        hactive = <320>;
>        vactive = <240>;
>        [...]
>     };
> };
> 
> ipu: ipu at 53fc0000 {
>    compatible = "fsl,imx31-ipu";
>    reg = < 0x53fc0000 0x5f
>    0x53fc0088 0x2b >;
>    interrupts = <42 41>;
>    dma-channels = <32>;
>    #dma-cells = <1>;
>    clocks = <&clks 55>;
>    clock-names = "";
> };
> 
> lcdc: mx3fb at 53fc00b4 {
>    compatible = "fsl,mx3-fb";
>    reg = <0x53fc00b4 0x0b>;
>    clocks = <&clks 55>;
>    dmas = <&ipu 14>;
>    dma-names = "tx";
>    display = <&cmo_qvga>;
> };
> 
> The issue was that exporting the "dma ipu driver" was not a good idea.
> I was told to instead make bindings that looks very similar to the ipuv3 
> driver[1]
> So at the end that gave something like that:
> 
> cmo_qvga: display at di0 {
>    compatible = "fsl,mx3-parallel-display";
>    regulator-name = "lcd";
>    lcd-supply = <&reg_lcd_3v3>;
>    model = "CMO-QVGA";
>    display-timings {
>      qvga_timings: 320x240 {
>        hactive = <320>;
>        vactive = <240>;
>        [...]
>     };
> };
> 
> ipu: ipu at 53fc0000 {
>    compatible = "fsl,imx35-ipu";
>    reg = <0x53fc0000 0x4000>;
>    clocks = <&clks 55>;
>    display = <&cmo_qvga>;
> };
> 
> So here fsl,imx35-ipu is binded to the mx3fb driver.
> But the mx3fb driver still need to use the dma-ipu driver somehow.
> That's why the dma-ipu driver is handled behind the scenes, that way
> it's not exported to the device tree bindings.
> 
> Now, since the mx3fb driver is binded to the "fsl,imx35-ipu" compatible,
> if I would do a "mx3fbi->reg_lcd = devm_regulator_get(dev, "lcd");",
> that would then lookup for the regulator in the mx3fb node
> (The last "ipu at 53fc0000" here).
> 
> Instead the regulator can be found in the display node,
> which has no driver associated with it.
> 
> In the case of the ipuv3, the parallel display driver is associated
> with the display at di0 node, so the device matches with the device tree
> node directly.
> 
> References:
> -----------
> [1] The ipuv3 driver is in drivers/staging/imx-drm/
> [2] the dma ipu driver is in drivers/dma/ipu/
> 

---

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

* Re: [PATCH v7][ 3/5] video: mx3fb: Introduce regulator support.
  2014-03-14  9:12   ` Denis Carikli
@ 2014-03-17  6:20     ` Sascha Hauer
  -1 siblings, 0 replies; 26+ messages in thread
From: Sascha Hauer @ 2014-03-17  6:20 UTC (permalink / raw)
  To: linux-arm-kernel

[Added Mark to Cc]

On Fri, Mar 14, 2014 at 10:12:47AM +0100, Denis Carikli wrote:
>  
> +		of_property_read_string(display_np, "regulator-name",
> +					&regulator_name);
> +

[...]

> +	/* In dt mode,
> +	 * using devm_regulator_get would require that the proprety referencing
> +	 * the regulator phandle has to be inside the mx3fb node.
> +	 */
> +	if (np) {
> +		if (regulator_name)
> +			mx3fbi->reg_lcd = regulator_get(NULL, regulator_name);
> +
> +		if (IS_ERR(mx3fbi->reg_lcd))
> +			return PTR_ERR(mx3fbi->reg_lcd);
> +	} else {
> +		/* Permit that driver without a regulator in non-dt mode */
> +		mx3fbi->reg_lcd = regulator_get(dev, "lcd");
> +	}

This patch adds regulator support for the display of a i.MX3 IPU. The
problem Denis has to solve here is that he needs to get the regulator,
but the display devicenode doesn't have a struct device associated with
it, so he cannot provide one to regulator_get(). One way out here could
be a of_regulator_get(struct device_node *). Mark, would this be ok with
you?

(Of course a proper driver for the display would be nicer, but this
would immediately bring us to some Common display framework, something
which is being worked on quite a while now without success)

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

* [PATCH v7][ 3/5] video: mx3fb: Introduce regulator support.
@ 2014-03-17  6:20     ` Sascha Hauer
  0 siblings, 0 replies; 26+ messages in thread
From: Sascha Hauer @ 2014-03-17  6:20 UTC (permalink / raw)
  To: linux-arm-kernel

[Added Mark to Cc]

On Fri, Mar 14, 2014 at 10:12:47AM +0100, Denis Carikli wrote:
>  
> +		of_property_read_string(display_np, "regulator-name",
> +					&regulator_name);
> +

[...]

> +	/* In dt mode,
> +	 * using devm_regulator_get would require that the proprety referencing
> +	 * the regulator phandle has to be inside the mx3fb node.
> +	 */
> +	if (np) {
> +		if (regulator_name)
> +			mx3fbi->reg_lcd = regulator_get(NULL, regulator_name);
> +
> +		if (IS_ERR(mx3fbi->reg_lcd))
> +			return PTR_ERR(mx3fbi->reg_lcd);
> +	} else {
> +		/* Permit that driver without a regulator in non-dt mode */
> +		mx3fbi->reg_lcd = regulator_get(dev, "lcd");
> +	}

This patch adds regulator support for the display of a i.MX3 IPU. The
problem Denis has to solve here is that he needs to get the regulator,
but the display devicenode doesn't have a struct device associated with
it, so he cannot provide one to regulator_get(). One way out here could
be a of_regulator_get(struct device_node *). Mark, would this be ok with
you?

(Of course a proper driver for the display would be nicer, but this
would immediately bring us to some Common display framework, something
which is being worked on quite a while now without success)

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

* Re: [PATCH v7][ 1/5] video: mx3fb: Use devm_kzalloc
  2014-03-14  9:12 ` Denis Carikli
@ 2014-05-08 10:31   ` Tomi Valkeinen
  -1 siblings, 0 replies; 26+ messages in thread
From: Tomi Valkeinen @ 2014-05-08 10:31 UTC (permalink / raw)
  To: linux-arm-kernel

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

On 14/03/14 11:12, Denis Carikli wrote:
> Replace kzalloc by devm_kzalloc and remove the kfree() calls.
> 
> Signed-off-by: Denis Carikli <denis@eukrea.com>
> ---
> ChangeLog v6->v7:
> - Removed the Cc from the patch, they went into 
>   git send-email instead.
> ChangeLog v5->v6:
>  - New patch need
> ---
>  drivers/video/fbdev/mx3fb.c |    4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)

I've picked this patch for 3.16. I didn't pick the DT related patches in
this series as there seemed to be unanswered questions about them.

 Tomi



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

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

* [PATCH v7][ 1/5] video: mx3fb: Use devm_kzalloc
@ 2014-05-08 10:31   ` Tomi Valkeinen
  0 siblings, 0 replies; 26+ messages in thread
From: Tomi Valkeinen @ 2014-05-08 10:31 UTC (permalink / raw)
  To: linux-arm-kernel

On 14/03/14 11:12, Denis Carikli wrote:
> Replace kzalloc by devm_kzalloc and remove the kfree() calls.
> 
> Signed-off-by: Denis Carikli <denis@eukrea.com>
> ---
> ChangeLog v6->v7:
> - Removed the Cc from the patch, they went into 
>   git send-email instead.
> ChangeLog v5->v6:
>  - New patch need
> ---
>  drivers/video/fbdev/mx3fb.c |    4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)

I've picked this patch for 3.16. I didn't pick the DT related patches in
this series as there seemed to be unanswered questions about them.

 Tomi


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140508/25a73595/attachment.sig>

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

* Re: [PATCH v7][ 3/5] video: mx3fb: Introduce regulator support.
  2014-03-17  6:20     ` Sascha Hauer
@ 2014-06-10 13:29       ` Denis Carikli
  -1 siblings, 0 replies; 26+ messages in thread
From: Denis Carikli @ 2014-06-10 13:29 UTC (permalink / raw)
  To: linux-arm-kernel

On 03/17/2014 07:20 AM, Sascha Hauer wrote:
> On Fri, Mar 14, 2014 at 10:12:47AM +0100, Denis Carikli wrote:
>>
>> +		of_property_read_string(display_np, "regulator-name",
>> +					&regulator_name);
>> +
>
> [...]
>
>> +	/* In dt mode,
>> +	 * using devm_regulator_get would require that the proprety referencing
>> +	 * the regulator phandle has to be inside the mx3fb node.
>> +	 */
>> +	if (np) {
>> +		if (regulator_name)
>> +			mx3fbi->reg_lcd = regulator_get(NULL, regulator_name);
>> +
>> +		if (IS_ERR(mx3fbi->reg_lcd))
>> +			return PTR_ERR(mx3fbi->reg_lcd);
>> +	} else {
>> +		/* Permit that driver without a regulator in non-dt mode */
>> +		mx3fbi->reg_lcd = regulator_get(dev, "lcd");
>> +	}
>
> This patch adds regulator support for the display of a i.MX3 IPU. The
> problem Denis has to solve here is that he needs to get the regulator,
> but the display devicenode doesn't have a struct device associated with
> it, so he cannot provide one to regulator_get(). One way out here could
> be a of_regulator_get(struct device_node *). Mark, would this be ok with
> you?

Here, the display devicenode has no struct device associated with it 
like mentioned above.
Because of that, retriving the regulator from the devicetree, for 
instance like regulator_dev_lookup() does, would require a different 
approach.

As I understand it, what happen in regulator_dev_lookup when 
regulator_get(NULL, regulator_name) is used is the following:

Since the struct device is NULL, it skips the struct device based 
lookup, but also the devicetree lookup (it uses dev->of_node for that)
At the end it falls back on a match on the regulator name to find it.

would keeping regulator_get(NULL, regulator_name); in the driver instead 
be better for now?

Denis.

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

* [PATCH v7][ 3/5] video: mx3fb: Introduce regulator support.
@ 2014-06-10 13:29       ` Denis Carikli
  0 siblings, 0 replies; 26+ messages in thread
From: Denis Carikli @ 2014-06-10 13:29 UTC (permalink / raw)
  To: linux-arm-kernel

On 03/17/2014 07:20 AM, Sascha Hauer wrote:
> On Fri, Mar 14, 2014 at 10:12:47AM +0100, Denis Carikli wrote:
>>
>> +		of_property_read_string(display_np, "regulator-name",
>> +					&regulator_name);
>> +
>
> [...]
>
>> +	/* In dt mode,
>> +	 * using devm_regulator_get would require that the proprety referencing
>> +	 * the regulator phandle has to be inside the mx3fb node.
>> +	 */
>> +	if (np) {
>> +		if (regulator_name)
>> +			mx3fbi->reg_lcd = regulator_get(NULL, regulator_name);
>> +
>> +		if (IS_ERR(mx3fbi->reg_lcd))
>> +			return PTR_ERR(mx3fbi->reg_lcd);
>> +	} else {
>> +		/* Permit that driver without a regulator in non-dt mode */
>> +		mx3fbi->reg_lcd = regulator_get(dev, "lcd");
>> +	}
>
> This patch adds regulator support for the display of a i.MX3 IPU. The
> problem Denis has to solve here is that he needs to get the regulator,
> but the display devicenode doesn't have a struct device associated with
> it, so he cannot provide one to regulator_get(). One way out here could
> be a of_regulator_get(struct device_node *). Mark, would this be ok with
> you?

Here, the display devicenode has no struct device associated with it 
like mentioned above.
Because of that, retriving the regulator from the devicetree, for 
instance like regulator_dev_lookup() does, would require a different 
approach.

As I understand it, what happen in regulator_dev_lookup when 
regulator_get(NULL, regulator_name) is used is the following:

Since the struct device is NULL, it skips the struct device based 
lookup, but also the devicetree lookup (it uses dev->of_node for that)
At the end it falls back on a match on the regulator name to find it.

would keeping regulator_get(NULL, regulator_name); in the driver instead 
be better for now?

Denis.

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

* Re: [PATCH v7][ 3/5] video: mx3fb: Introduce regulator support.
  2014-03-14  9:12   ` Denis Carikli
@ 2014-06-19  6:58     ` Denis Carikli
  -1 siblings, 0 replies; 26+ messages in thread
From: Denis Carikli @ 2014-06-19  6:58 UTC (permalink / raw)
  To: linux-arm-kernel

On 03/14/2014 10:12 AM, Denis Carikli wrote:
> +	/* In dt mode,
> +	 * using devm_regulator_get would require that the proprety referencing
> +	 * the regulator phandle has to be inside the mx3fb node.
> +	 */
> +	if (np) {
> +		if (regulator_name)
> +			mx3fbi->reg_lcd = regulator_get(NULL, regulator_name);
mx3fbi->reg_lcd is NULL if no regulator is present in the dts(i).
I'll fix it in the driver (instead of forcing the use of a dummy regulator).

Denis.

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

* [PATCH v7][ 3/5] video: mx3fb: Introduce regulator support.
@ 2014-06-19  6:58     ` Denis Carikli
  0 siblings, 0 replies; 26+ messages in thread
From: Denis Carikli @ 2014-06-19  6:58 UTC (permalink / raw)
  To: linux-arm-kernel

On 03/14/2014 10:12 AM, Denis Carikli wrote:
> +	/* In dt mode,
> +	 * using devm_regulator_get would require that the proprety referencing
> +	 * the regulator phandle has to be inside the mx3fb node.
> +	 */
> +	if (np) {
> +		if (regulator_name)
> +			mx3fbi->reg_lcd = regulator_get(NULL, regulator_name);
mx3fbi->reg_lcd is NULL if no regulator is present in the dts(i).
I'll fix it in the driver (instead of forcing the use of a dummy regulator).

Denis.

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

* Re: [PATCH v7][ 3/5] video: mx3fb: Introduce regulator support.
  2014-06-10 13:29       ` Denis Carikli
@ 2014-08-22 22:00         ` Mark Brown
  -1 siblings, 0 replies; 26+ messages in thread
From: Mark Brown @ 2014-08-22 22:00 UTC (permalink / raw)
  To: linux-arm-kernel

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

On Tue, Jun 10, 2014 at 03:29:33PM +0200, Denis Carikli wrote:
> On 03/17/2014 07:20 AM, Sascha Hauer wrote:

> >This patch adds regulator support for the display of a i.MX3 IPU. The
> >problem Denis has to solve here is that he needs to get the regulator,
> >but the display devicenode doesn't have a struct device associated with
> >it, so he cannot provide one to regulator_get(). One way out here could
> >be a of_regulator_get(struct device_node *). Mark, would this be ok with
> >you?

> Here, the display devicenode has no struct device associated with it like
> mentioned above.
> Because of that, retriving the regulator from the devicetree, for instance
> like regulator_dev_lookup() does, would require a different approach.

> As I understand it, what happen in regulator_dev_lookup when
> regulator_get(NULL, regulator_name) is used is the following:

> Since the struct device is NULL, it skips the struct device based lookup,
> but also the devicetree lookup (it uses dev->of_node for that)
> At the end it falls back on a match on the regulator name to find it.

> would keeping regulator_get(NULL, regulator_name); in the driver instead be
> better for now?

It would be much better to have an actual device to get things for,
using a hard coded regulator name is very much deprecated.  Using a hard
coded name is fragile and we don't have support for mapping this
properly in the device tree.

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

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

* [PATCH v7][ 3/5] video: mx3fb: Introduce regulator support.
@ 2014-08-22 22:00         ` Mark Brown
  0 siblings, 0 replies; 26+ messages in thread
From: Mark Brown @ 2014-08-22 22:00 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jun 10, 2014 at 03:29:33PM +0200, Denis Carikli wrote:
> On 03/17/2014 07:20 AM, Sascha Hauer wrote:

> >This patch adds regulator support for the display of a i.MX3 IPU. The
> >problem Denis has to solve here is that he needs to get the regulator,
> >but the display devicenode doesn't have a struct device associated with
> >it, so he cannot provide one to regulator_get(). One way out here could
> >be a of_regulator_get(struct device_node *). Mark, would this be ok with
> >you?

> Here, the display devicenode has no struct device associated with it like
> mentioned above.
> Because of that, retriving the regulator from the devicetree, for instance
> like regulator_dev_lookup() does, would require a different approach.

> As I understand it, what happen in regulator_dev_lookup when
> regulator_get(NULL, regulator_name) is used is the following:

> Since the struct device is NULL, it skips the struct device based lookup,
> but also the devicetree lookup (it uses dev->of_node for that)
> At the end it falls back on a match on the regulator name to find it.

> would keeping regulator_get(NULL, regulator_name); in the driver instead be
> better for now?

It would be much better to have an actual device to get things for,
using a hard coded regulator name is very much deprecated.  Using a hard
coded name is fragile and we don't have support for mapping this
properly in the device tree.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140822/16a51093/attachment.sig>

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

end of thread, other threads:[~2014-08-22 22:00 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-14  9:12 [PATCH v7][ 1/5] video: mx3fb: Use devm_kzalloc Denis Carikli
2014-03-14  9:12 ` Denis Carikli
2014-03-14  9:12 ` [PATCH v7][ 2/5] video: mx3fb: Add device tree suport Denis Carikli
2014-03-14  9:12   ` Denis Carikli
2014-03-14  9:12 ` [PATCH v7][ 3/5] video: mx3fb: Introduce regulator support Denis Carikli
2014-03-14  9:12   ` Denis Carikli
2014-03-14  9:23   ` [PATCH v7][ 3/5] video: mx3fb: Introduce =?UTF-8?B?cmVndWxhdG9yIHN1c Alexander Shiyan
2014-03-14  9:23     ` [PATCH v7][ 3/5] video: mx3fb: Introduce regulator support Alexander Shiyan
2014-03-14 11:23     ` Denis Carikli
2014-03-14 11:23       ` Denis Carikli
2014-03-14 12:38       ` [PATCH v7][ 3/5] video: mx3fb: Introduce =?UTF-8?B?cmVndWxhdG9yIHN1c Alexander Shiyan
2014-03-14 12:38         ` [PATCH v7][ 3/5] video: mx3fb: Introduce regulator support Alexander Shiyan
2014-03-17  6:20   ` Sascha Hauer
2014-03-17  6:20     ` Sascha Hauer
2014-06-10 13:29     ` Denis Carikli
2014-06-10 13:29       ` Denis Carikli
2014-08-22 22:00       ` Mark Brown
2014-08-22 22:00         ` Mark Brown
2014-06-19  6:58   ` Denis Carikli
2014-06-19  6:58     ` Denis Carikli
2014-03-14  9:12 ` [PATCH v7][ 4/5] ARM: dts: i.MX35: Add display support Denis Carikli
2014-03-14  9:12   ` Denis Carikli
2014-03-14  9:12 ` =?UTF-8?q?=5BPATCH=20v7=5D=5B=205/5=5D=20ARM=3A=20dts=3A=20mbimxsd35=20Add=20video=20and=20displays= Denis Carikli
2014-03-14  9:12   ` [PATCH v7][ 5/5] ARM: dts: mbimxsd35 Add video and displays support Denis Carikli
2014-05-08 10:31 ` [PATCH v7][ 1/5] video: mx3fb: Use devm_kzalloc Tomi Valkeinen
2014-05-08 10:31   ` Tomi Valkeinen

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.