* [PATCH 0/2] simple device tree support for mxsfb
@ 2012-06-26 9:02 ` Shawn Guo
0 siblings, 0 replies; 12+ messages in thread
From: Shawn Guo @ 2012-06-26 9:02 UTC (permalink / raw)
To: linux-arm-kernel
It adds a simple device tree support for mxsfb driver.
Shawn Guo (2):
video: mxsfb: move mxsfb.h into include/linux
video: mxsfb: add simple device tree probe
Documentation/devicetree/bindings/fb/mxsfb.txt | 21 +++++++
arch/arm/mach-mxs/devices-mx23.h | 2 +-
arch/arm/mach-mxs/devices-mx28.h | 2 +-
arch/arm/mach-mxs/devices/platform-mxsfb.c | 2 +-
drivers/video/mxsfb.c | 62 +++++++++++++++-----
.../include/mach => include/linux}/mxsfb.h | 6 +-
6 files changed, 75 insertions(+), 20 deletions(-)
create mode 100644 Documentation/devicetree/bindings/fb/mxsfb.txt
rename {arch/arm/mach-mxs/include/mach => include/linux}/mxsfb.h (95%)
--
1.7.5.4
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 0/2] simple device tree support for mxsfb
@ 2012-06-26 9:02 ` Shawn Guo
0 siblings, 0 replies; 12+ messages in thread
From: Shawn Guo @ 2012-06-26 9:02 UTC (permalink / raw)
To: linux-arm-kernel
It adds a simple device tree support for mxsfb driver.
Shawn Guo (2):
video: mxsfb: move mxsfb.h into include/linux
video: mxsfb: add simple device tree probe
Documentation/devicetree/bindings/fb/mxsfb.txt | 21 +++++++
arch/arm/mach-mxs/devices-mx23.h | 2 +-
arch/arm/mach-mxs/devices-mx28.h | 2 +-
arch/arm/mach-mxs/devices/platform-mxsfb.c | 2 +-
drivers/video/mxsfb.c | 62 +++++++++++++++-----
.../include/mach => include/linux}/mxsfb.h | 6 +-
6 files changed, 75 insertions(+), 20 deletions(-)
create mode 100644 Documentation/devicetree/bindings/fb/mxsfb.txt
rename {arch/arm/mach-mxs/include/mach => include/linux}/mxsfb.h (95%)
--
1.7.5.4
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/2] video: mxsfb: move mxsfb.h into include/linux
2012-06-26 9:02 ` Shawn Guo
@ 2012-06-26 9:02 ` Shawn Guo
-1 siblings, 0 replies; 12+ messages in thread
From: Shawn Guo @ 2012-06-26 9:02 UTC (permalink / raw)
To: linux-arm-kernel
Move mxsfb.h into include/linux, so that mxsfb driver does not have to
include <mach/*> header.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
arch/arm/mach-mxs/devices-mx23.h | 2 +-
arch/arm/mach-mxs/devices-mx28.h | 2 +-
arch/arm/mach-mxs/devices/platform-mxsfb.c | 2 +-
drivers/video/mxsfb.c | 2 +-
.../include/mach => include/linux}/mxsfb.h | 6 +++---
5 files changed, 7 insertions(+), 7 deletions(-)
rename {arch/arm/mach-mxs/include/mach => include/linux}/mxsfb.h (95%)
diff --git a/arch/arm/mach-mxs/devices-mx23.h b/arch/arm/mach-mxs/devices-mx23.h
index 9acdd63..9ee5ced 100644
--- a/arch/arm/mach-mxs/devices-mx23.h
+++ b/arch/arm/mach-mxs/devices-mx23.h
@@ -10,7 +10,7 @@
*/
#include <mach/mx23.h>
#include <mach/devices-common.h>
-#include <mach/mxsfb.h>
+#include <linux/mxsfb.h>
#include <linux/amba/bus.h>
static inline int mx23_add_duart(void)
diff --git a/arch/arm/mach-mxs/devices-mx28.h b/arch/arm/mach-mxs/devices-mx28.h
index 84b2960..fcab431 100644
--- a/arch/arm/mach-mxs/devices-mx28.h
+++ b/arch/arm/mach-mxs/devices-mx28.h
@@ -10,7 +10,7 @@
*/
#include <mach/mx28.h>
#include <mach/devices-common.h>
-#include <mach/mxsfb.h>
+#include <linux/mxsfb.h>
#include <linux/amba/bus.h>
static inline int mx28_add_duart(void)
diff --git a/arch/arm/mach-mxs/devices/platform-mxsfb.c b/arch/arm/mach-mxs/devices/platform-mxsfb.c
index 5a75b71..76b53f73 100644
--- a/arch/arm/mach-mxs/devices/platform-mxsfb.c
+++ b/arch/arm/mach-mxs/devices/platform-mxsfb.c
@@ -10,7 +10,7 @@
#include <mach/mx23.h>
#include <mach/mx28.h>
#include <mach/devices-common.h>
-#include <mach/mxsfb.h>
+#include <linux/mxsfb.h>
#ifdef CONFIG_SOC_IMX23
struct platform_device *__init mx23_add_mxsfb(
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
index abbe691..08dad8d 100644
--- a/drivers/video/mxsfb.c
+++ b/drivers/video/mxsfb.c
@@ -46,7 +46,7 @@
#include <linux/dma-mapping.h>
#include <linux/io.h>
#include <linux/pinctrl/consumer.h>
-#include <mach/mxsfb.h>
+#include <linux/mxsfb.h>
#define REG_SET 4
#define REG_CLR 8
diff --git a/arch/arm/mach-mxs/include/mach/mxsfb.h b/include/linux/mxsfb.h
similarity index 95%
rename from arch/arm/mach-mxs/include/mach/mxsfb.h
rename to include/linux/mxsfb.h
index e4d7979..f14943d 100644
--- a/arch/arm/mach-mxs/include/mach/mxsfb.h
+++ b/include/linux/mxsfb.h
@@ -14,8 +14,8 @@
* MA 02110-1301, USA.
*/
-#ifndef __MACH_FB_H
-#define __MACH_FB_H
+#ifndef __LINUX_MXSFB_H
+#define __LINUX_MXSFB_H
#include <linux/fb.h>
@@ -46,4 +46,4 @@ struct mxsfb_platform_data {
*/
};
-#endif /* __MACH_FB_H */
+#endif /* __LINUX_MXSFB_H */
--
1.7.5.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 1/2] video: mxsfb: move mxsfb.h into include/linux
@ 2012-06-26 9:02 ` Shawn Guo
0 siblings, 0 replies; 12+ messages in thread
From: Shawn Guo @ 2012-06-26 9:02 UTC (permalink / raw)
To: linux-arm-kernel
Move mxsfb.h into include/linux, so that mxsfb driver does not have to
include <mach/*> header.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
arch/arm/mach-mxs/devices-mx23.h | 2 +-
arch/arm/mach-mxs/devices-mx28.h | 2 +-
arch/arm/mach-mxs/devices/platform-mxsfb.c | 2 +-
drivers/video/mxsfb.c | 2 +-
.../include/mach => include/linux}/mxsfb.h | 6 +++---
5 files changed, 7 insertions(+), 7 deletions(-)
rename {arch/arm/mach-mxs/include/mach => include/linux}/mxsfb.h (95%)
diff --git a/arch/arm/mach-mxs/devices-mx23.h b/arch/arm/mach-mxs/devices-mx23.h
index 9acdd63..9ee5ced 100644
--- a/arch/arm/mach-mxs/devices-mx23.h
+++ b/arch/arm/mach-mxs/devices-mx23.h
@@ -10,7 +10,7 @@
*/
#include <mach/mx23.h>
#include <mach/devices-common.h>
-#include <mach/mxsfb.h>
+#include <linux/mxsfb.h>
#include <linux/amba/bus.h>
static inline int mx23_add_duart(void)
diff --git a/arch/arm/mach-mxs/devices-mx28.h b/arch/arm/mach-mxs/devices-mx28.h
index 84b2960..fcab431 100644
--- a/arch/arm/mach-mxs/devices-mx28.h
+++ b/arch/arm/mach-mxs/devices-mx28.h
@@ -10,7 +10,7 @@
*/
#include <mach/mx28.h>
#include <mach/devices-common.h>
-#include <mach/mxsfb.h>
+#include <linux/mxsfb.h>
#include <linux/amba/bus.h>
static inline int mx28_add_duart(void)
diff --git a/arch/arm/mach-mxs/devices/platform-mxsfb.c b/arch/arm/mach-mxs/devices/platform-mxsfb.c
index 5a75b71..76b53f73 100644
--- a/arch/arm/mach-mxs/devices/platform-mxsfb.c
+++ b/arch/arm/mach-mxs/devices/platform-mxsfb.c
@@ -10,7 +10,7 @@
#include <mach/mx23.h>
#include <mach/mx28.h>
#include <mach/devices-common.h>
-#include <mach/mxsfb.h>
+#include <linux/mxsfb.h>
#ifdef CONFIG_SOC_IMX23
struct platform_device *__init mx23_add_mxsfb(
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
index abbe691..08dad8d 100644
--- a/drivers/video/mxsfb.c
+++ b/drivers/video/mxsfb.c
@@ -46,7 +46,7 @@
#include <linux/dma-mapping.h>
#include <linux/io.h>
#include <linux/pinctrl/consumer.h>
-#include <mach/mxsfb.h>
+#include <linux/mxsfb.h>
#define REG_SET 4
#define REG_CLR 8
diff --git a/arch/arm/mach-mxs/include/mach/mxsfb.h b/include/linux/mxsfb.h
similarity index 95%
rename from arch/arm/mach-mxs/include/mach/mxsfb.h
rename to include/linux/mxsfb.h
index e4d7979..f14943d 100644
--- a/arch/arm/mach-mxs/include/mach/mxsfb.h
+++ b/include/linux/mxsfb.h
@@ -14,8 +14,8 @@
* MA 02110-1301, USA.
*/
-#ifndef __MACH_FB_H
-#define __MACH_FB_H
+#ifndef __LINUX_MXSFB_H
+#define __LINUX_MXSFB_H
#include <linux/fb.h>
@@ -46,4 +46,4 @@ struct mxsfb_platform_data {
*/
};
-#endif /* __MACH_FB_H */
+#endif /* __LINUX_MXSFB_H */
--
1.7.5.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/2] video: mxsfb: add simple device tree probe
2012-06-26 9:02 ` Shawn Guo
@ 2012-06-26 9:02 ` Shawn Guo
-1 siblings, 0 replies; 12+ messages in thread
From: Shawn Guo @ 2012-06-26 9:02 UTC (permalink / raw)
To: linux-arm-kernel
Add a simple device tree probe support for mxsfb driver. Before
a common binding for struct fb_videomode is available, the driver will
keep using struct mxsfb_platform_data. That said, platform code will
use auxdata to attach mxsfb_platform_data for device tree boot.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
Documentation/devicetree/bindings/fb/mxsfb.txt | 21 ++++++++
drivers/video/mxsfb.c | 60 ++++++++++++++++++-----
2 files changed, 68 insertions(+), 13 deletions(-)
create mode 100644 Documentation/devicetree/bindings/fb/mxsfb.txt
diff --git a/Documentation/devicetree/bindings/fb/mxsfb.txt b/Documentation/devicetree/bindings/fb/mxsfb.txt
new file mode 100644
index 0000000..d4f8bdb
--- /dev/null
+++ b/Documentation/devicetree/bindings/fb/mxsfb.txt
@@ -0,0 +1,21 @@
+* Freescale MXS LCD Interface (LCDIF)
+
+Required properties:
+- compatible: Should be "fsl,<chip>-lcdif". Supported chips include
+ imx23 and imx28.
+- reg: Address and length of the register set for lcdif
+- interrupts: Should contain lcdif interrupts
+
+Optional properties:
+- panel-enable-gpios : Should specify the gpio for panel enable
+- enable-active-low : Polarity of panel enable gpio is active low.
+ If this property is missing, the default assumed is active high.
+
+Examples:
+
+lcdif@80030000 {
+ compatible = "fsl,imx28-lcdif";
+ reg = <0x80030000 2000>;
+ interrupts = <38 86>;
+ panel-enable-gpios = <&gpio3 30 0>;
+};
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
index 08dad8d..588f00d 100644
--- a/drivers/video/mxsfb.c
+++ b/drivers/video/mxsfb.c
@@ -41,6 +41,8 @@
#include <linux/module.h>
#include <linux/kernel.h>
+#include <linux/of_device.h>
+#include <linux/of_gpio.h>
#include <linux/platform_device.h>
#include <linux/clk.h>
#include <linux/dma-mapping.h>
@@ -750,16 +752,42 @@ static void __devexit mxsfb_free_videomem(struct mxsfb_info *host)
}
}
+static struct platform_device_id mxsfb_devtype[] = {
+ {
+ .name = "imx23-fb",
+ .driver_data = MXSFB_V3,
+ }, {
+ .name = "imx28-fb",
+ .driver_data = MXSFB_V4,
+ }, {
+ /* sentinel */
+ }
+};
+MODULE_DEVICE_TABLE(platform, mxsfb_devtype);
+
+static const struct of_device_id mxsfb_dt_ids[] = {
+ { .compatible = "fsl,imx23-lcdif", .data = &mxsfb_devtype[0], },
+ { .compatible = "fsl,imx28-lcdif", .data = &mxsfb_devtype[1], },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, mxsfb_dt_ids);
+
static int __devinit mxsfb_probe(struct platform_device *pdev)
{
+ const struct of_device_id *of_id + of_match_device(mxsfb_dt_ids, &pdev->dev);
struct mxsfb_platform_data *pdata = pdev->dev.platform_data;
struct resource *res;
struct mxsfb_info *host;
struct fb_info *fb_info;
struct fb_modelist *modelist;
struct pinctrl *pinctrl;
+ int panel_enable;
int i, ret;
+ if (of_id)
+ pdev->id_entry = of_id->data;
+
if (!pdata) {
dev_err(&pdev->dev, "No platformdata. Giving up\n");
return -ENODEV;
@@ -807,6 +835,23 @@ static int __devinit mxsfb_probe(struct platform_device *pdev)
goto error_getclock;
}
+ panel_enable = of_get_named_gpio(pdev->dev.of_node,
+ "panel-enable-gpios", 0);
+ if (gpio_is_valid(panel_enable)) {
+ int flags = GPIOF_OUT_INIT_HIGH;
+ if (of_get_property(pdev->dev.of_node,
+ "enable-active-low", NULL))
+ flags = GPIOF_OUT_INIT_LOW;
+ ret = devm_gpio_request_one(&pdev->dev, panel_enable,
+ flags, "panel-enable");
+ if (ret) {
+ dev_err(&pdev->dev,
+ "failed to request gpio %d: %d\n",
+ panel_enable, ret);
+ goto error_panel_enable;
+ }
+ }
+
fb_info->pseudo_palette = kmalloc(sizeof(u32) * 16, GFP_KERNEL);
if (!fb_info->pseudo_palette) {
ret = -ENOMEM;
@@ -854,6 +899,7 @@ error_register:
error_init_fb:
kfree(fb_info->pseudo_palette);
error_pseudo_pallette:
+error_panel_enable:
clk_put(host->clk);
error_getclock:
error_getpin:
@@ -901,19 +947,6 @@ static void mxsfb_shutdown(struct platform_device *pdev)
writel(CTRL_RUN, host->base + LCDC_CTRL + REG_CLR);
}
-static struct platform_device_id mxsfb_devtype[] = {
- {
- .name = "imx23-fb",
- .driver_data = MXSFB_V3,
- }, {
- .name = "imx28-fb",
- .driver_data = MXSFB_V4,
- }, {
- /* sentinel */
- }
-};
-MODULE_DEVICE_TABLE(platform, mxsfb_devtype);
-
static struct platform_driver mxsfb_driver = {
.probe = mxsfb_probe,
.remove = __devexit_p(mxsfb_remove),
@@ -921,6 +954,7 @@ static struct platform_driver mxsfb_driver = {
.id_table = mxsfb_devtype,
.driver = {
.name = DRIVER_NAME,
+ .of_match_table = mxsfb_dt_ids,
},
};
--
1.7.5.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/2] video: mxsfb: add simple device tree probe
@ 2012-06-26 9:02 ` Shawn Guo
0 siblings, 0 replies; 12+ messages in thread
From: Shawn Guo @ 2012-06-26 9:02 UTC (permalink / raw)
To: linux-arm-kernel
Add a simple device tree probe support for mxsfb driver. Before
a common binding for struct fb_videomode is available, the driver will
keep using struct mxsfb_platform_data. That said, platform code will
use auxdata to attach mxsfb_platform_data for device tree boot.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
Documentation/devicetree/bindings/fb/mxsfb.txt | 21 ++++++++
drivers/video/mxsfb.c | 60 ++++++++++++++++++-----
2 files changed, 68 insertions(+), 13 deletions(-)
create mode 100644 Documentation/devicetree/bindings/fb/mxsfb.txt
diff --git a/Documentation/devicetree/bindings/fb/mxsfb.txt b/Documentation/devicetree/bindings/fb/mxsfb.txt
new file mode 100644
index 0000000..d4f8bdb
--- /dev/null
+++ b/Documentation/devicetree/bindings/fb/mxsfb.txt
@@ -0,0 +1,21 @@
+* Freescale MXS LCD Interface (LCDIF)
+
+Required properties:
+- compatible: Should be "fsl,<chip>-lcdif". Supported chips include
+ imx23 and imx28.
+- reg: Address and length of the register set for lcdif
+- interrupts: Should contain lcdif interrupts
+
+Optional properties:
+- panel-enable-gpios : Should specify the gpio for panel enable
+- enable-active-low : Polarity of panel enable gpio is active low.
+ If this property is missing, the default assumed is active high.
+
+Examples:
+
+lcdif at 80030000 {
+ compatible = "fsl,imx28-lcdif";
+ reg = <0x80030000 2000>;
+ interrupts = <38 86>;
+ panel-enable-gpios = <&gpio3 30 0>;
+};
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
index 08dad8d..588f00d 100644
--- a/drivers/video/mxsfb.c
+++ b/drivers/video/mxsfb.c
@@ -41,6 +41,8 @@
#include <linux/module.h>
#include <linux/kernel.h>
+#include <linux/of_device.h>
+#include <linux/of_gpio.h>
#include <linux/platform_device.h>
#include <linux/clk.h>
#include <linux/dma-mapping.h>
@@ -750,16 +752,42 @@ static void __devexit mxsfb_free_videomem(struct mxsfb_info *host)
}
}
+static struct platform_device_id mxsfb_devtype[] = {
+ {
+ .name = "imx23-fb",
+ .driver_data = MXSFB_V3,
+ }, {
+ .name = "imx28-fb",
+ .driver_data = MXSFB_V4,
+ }, {
+ /* sentinel */
+ }
+};
+MODULE_DEVICE_TABLE(platform, mxsfb_devtype);
+
+static const struct of_device_id mxsfb_dt_ids[] = {
+ { .compatible = "fsl,imx23-lcdif", .data = &mxsfb_devtype[0], },
+ { .compatible = "fsl,imx28-lcdif", .data = &mxsfb_devtype[1], },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, mxsfb_dt_ids);
+
static int __devinit mxsfb_probe(struct platform_device *pdev)
{
+ const struct of_device_id *of_id =
+ of_match_device(mxsfb_dt_ids, &pdev->dev);
struct mxsfb_platform_data *pdata = pdev->dev.platform_data;
struct resource *res;
struct mxsfb_info *host;
struct fb_info *fb_info;
struct fb_modelist *modelist;
struct pinctrl *pinctrl;
+ int panel_enable;
int i, ret;
+ if (of_id)
+ pdev->id_entry = of_id->data;
+
if (!pdata) {
dev_err(&pdev->dev, "No platformdata. Giving up\n");
return -ENODEV;
@@ -807,6 +835,23 @@ static int __devinit mxsfb_probe(struct platform_device *pdev)
goto error_getclock;
}
+ panel_enable = of_get_named_gpio(pdev->dev.of_node,
+ "panel-enable-gpios", 0);
+ if (gpio_is_valid(panel_enable)) {
+ int flags = GPIOF_OUT_INIT_HIGH;
+ if (of_get_property(pdev->dev.of_node,
+ "enable-active-low", NULL))
+ flags = GPIOF_OUT_INIT_LOW;
+ ret = devm_gpio_request_one(&pdev->dev, panel_enable,
+ flags, "panel-enable");
+ if (ret) {
+ dev_err(&pdev->dev,
+ "failed to request gpio %d: %d\n",
+ panel_enable, ret);
+ goto error_panel_enable;
+ }
+ }
+
fb_info->pseudo_palette = kmalloc(sizeof(u32) * 16, GFP_KERNEL);
if (!fb_info->pseudo_palette) {
ret = -ENOMEM;
@@ -854,6 +899,7 @@ error_register:
error_init_fb:
kfree(fb_info->pseudo_palette);
error_pseudo_pallette:
+error_panel_enable:
clk_put(host->clk);
error_getclock:
error_getpin:
@@ -901,19 +947,6 @@ static void mxsfb_shutdown(struct platform_device *pdev)
writel(CTRL_RUN, host->base + LCDC_CTRL + REG_CLR);
}
-static struct platform_device_id mxsfb_devtype[] = {
- {
- .name = "imx23-fb",
- .driver_data = MXSFB_V3,
- }, {
- .name = "imx28-fb",
- .driver_data = MXSFB_V4,
- }, {
- /* sentinel */
- }
-};
-MODULE_DEVICE_TABLE(platform, mxsfb_devtype);
-
static struct platform_driver mxsfb_driver = {
.probe = mxsfb_probe,
.remove = __devexit_p(mxsfb_remove),
@@ -921,6 +954,7 @@ static struct platform_driver mxsfb_driver = {
.id_table = mxsfb_devtype,
.driver = {
.name = DRIVER_NAME,
+ .of_match_table = mxsfb_dt_ids,
},
};
--
1.7.5.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 0/2] simple device tree support for mxsfb
2012-06-26 9:02 ` Shawn Guo
@ 2012-06-27 13:53 ` Shawn Guo
-1 siblings, 0 replies; 12+ messages in thread
From: Shawn Guo @ 2012-06-27 13:53 UTC (permalink / raw)
To: linux-arm-kernel
Hi Florian,
I have a mxs platform patch depends on these two patches to covert
a few board files over to device tree. I would like to have the patches
go via arm-soc tree if they look good. Please let me know if you have
problem with the patches go through arm-soc tree. Thanks.
Regards,
Shawn
On Tue, Jun 26, 2012 at 05:02:57PM +0800, Shawn Guo wrote:
> It adds a simple device tree support for mxsfb driver.
>
> Shawn Guo (2):
> video: mxsfb: move mxsfb.h into include/linux
> video: mxsfb: add simple device tree probe
>
> Documentation/devicetree/bindings/fb/mxsfb.txt | 21 +++++++
> arch/arm/mach-mxs/devices-mx23.h | 2 +-
> arch/arm/mach-mxs/devices-mx28.h | 2 +-
> arch/arm/mach-mxs/devices/platform-mxsfb.c | 2 +-
> drivers/video/mxsfb.c | 62 +++++++++++++++-----
> .../include/mach => include/linux}/mxsfb.h | 6 +-
> 6 files changed, 75 insertions(+), 20 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/fb/mxsfb.txt
> rename {arch/arm/mach-mxs/include/mach => include/linux}/mxsfb.h (95%)
>
> --
> 1.7.5.4
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 0/2] simple device tree support for mxsfb
@ 2012-06-27 13:53 ` Shawn Guo
0 siblings, 0 replies; 12+ messages in thread
From: Shawn Guo @ 2012-06-27 13:53 UTC (permalink / raw)
To: linux-arm-kernel
Hi Florian,
I have a mxs platform patch depends on these two patches to covert
a few board files over to device tree. I would like to have the patches
go via arm-soc tree if they look good. Please let me know if you have
problem with the patches go through arm-soc tree. Thanks.
Regards,
Shawn
On Tue, Jun 26, 2012 at 05:02:57PM +0800, Shawn Guo wrote:
> It adds a simple device tree support for mxsfb driver.
>
> Shawn Guo (2):
> video: mxsfb: move mxsfb.h into include/linux
> video: mxsfb: add simple device tree probe
>
> Documentation/devicetree/bindings/fb/mxsfb.txt | 21 +++++++
> arch/arm/mach-mxs/devices-mx23.h | 2 +-
> arch/arm/mach-mxs/devices-mx28.h | 2 +-
> arch/arm/mach-mxs/devices/platform-mxsfb.c | 2 +-
> drivers/video/mxsfb.c | 62 +++++++++++++++-----
> .../include/mach => include/linux}/mxsfb.h | 6 +-
> 6 files changed, 75 insertions(+), 20 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/fb/mxsfb.txt
> rename {arch/arm/mach-mxs/include/mach => include/linux}/mxsfb.h (95%)
>
> --
> 1.7.5.4
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 2/2] video: mxsfb: add simple device tree probe
2012-06-26 9:02 ` Shawn Guo
@ 2012-06-28 3:34 ` Shawn Guo
-1 siblings, 0 replies; 12+ messages in thread
From: Shawn Guo @ 2012-06-28 3:34 UTC (permalink / raw)
To: linux-arm-kernel
Add a simple device tree probe support for mxsfb driver. Before
a common binding for struct fb_videomode is available, the driver will
keep using struct mxsfb_platform_data. That said, platform code will
use auxdata to attach mxsfb_platform_data for device tree boot.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
Changes since v1:
* Remove enable-active-low property and use of_get_named_gpio_flags
instead
Documentation/devicetree/bindings/fb/mxsfb.txt | 19 ++++++++
drivers/video/mxsfb.c | 60 ++++++++++++++++++-----
2 files changed, 66 insertions(+), 13 deletions(-)
create mode 100644 Documentation/devicetree/bindings/fb/mxsfb.txt
diff --git a/Documentation/devicetree/bindings/fb/mxsfb.txt b/Documentation/devicetree/bindings/fb/mxsfb.txt
new file mode 100644
index 0000000..b41e5e52
--- /dev/null
+++ b/Documentation/devicetree/bindings/fb/mxsfb.txt
@@ -0,0 +1,19 @@
+* Freescale MXS LCD Interface (LCDIF)
+
+Required properties:
+- compatible: Should be "fsl,<chip>-lcdif". Supported chips include
+ imx23 and imx28.
+- reg: Address and length of the register set for lcdif
+- interrupts: Should contain lcdif interrupts
+
+Optional properties:
+- panel-enable-gpios : Should specify the gpio for panel enable
+
+Examples:
+
+lcdif@80030000 {
+ compatible = "fsl,imx28-lcdif";
+ reg = <0x80030000 2000>;
+ interrupts = <38 86>;
+ panel-enable-gpios = <&gpio3 30 0>;
+};
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
index 08dad8d..49619b4 100644
--- a/drivers/video/mxsfb.c
+++ b/drivers/video/mxsfb.c
@@ -41,6 +41,8 @@
#include <linux/module.h>
#include <linux/kernel.h>
+#include <linux/of_device.h>
+#include <linux/of_gpio.h>
#include <linux/platform_device.h>
#include <linux/clk.h>
#include <linux/dma-mapping.h>
@@ -750,16 +752,43 @@ static void __devexit mxsfb_free_videomem(struct mxsfb_info *host)
}
}
+static struct platform_device_id mxsfb_devtype[] = {
+ {
+ .name = "imx23-fb",
+ .driver_data = MXSFB_V3,
+ }, {
+ .name = "imx28-fb",
+ .driver_data = MXSFB_V4,
+ }, {
+ /* sentinel */
+ }
+};
+MODULE_DEVICE_TABLE(platform, mxsfb_devtype);
+
+static const struct of_device_id mxsfb_dt_ids[] = {
+ { .compatible = "fsl,imx23-lcdif", .data = &mxsfb_devtype[0], },
+ { .compatible = "fsl,imx28-lcdif", .data = &mxsfb_devtype[1], },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, mxsfb_dt_ids);
+
static int __devinit mxsfb_probe(struct platform_device *pdev)
{
+ const struct of_device_id *of_id + of_match_device(mxsfb_dt_ids, &pdev->dev);
struct mxsfb_platform_data *pdata = pdev->dev.platform_data;
struct resource *res;
struct mxsfb_info *host;
struct fb_info *fb_info;
struct fb_modelist *modelist;
struct pinctrl *pinctrl;
+ int panel_enable;
+ enum of_gpio_flags flags;
int i, ret;
+ if (of_id)
+ pdev->id_entry = of_id->data;
+
if (!pdata) {
dev_err(&pdev->dev, "No platformdata. Giving up\n");
return -ENODEV;
@@ -807,6 +836,22 @@ static int __devinit mxsfb_probe(struct platform_device *pdev)
goto error_getclock;
}
+ panel_enable = of_get_named_gpio_flags(pdev->dev.of_node,
+ "panel-enable-gpios", 0, &flags);
+ if (gpio_is_valid(panel_enable)) {
+ unsigned long f = GPIOF_OUT_INIT_HIGH;
+ if (flags = OF_GPIO_ACTIVE_LOW)
+ f = GPIOF_OUT_INIT_LOW;
+ ret = devm_gpio_request_one(&pdev->dev, panel_enable,
+ f, "panel-enable");
+ if (ret) {
+ dev_err(&pdev->dev,
+ "failed to request gpio %d: %d\n",
+ panel_enable, ret);
+ goto error_panel_enable;
+ }
+ }
+
fb_info->pseudo_palette = kmalloc(sizeof(u32) * 16, GFP_KERNEL);
if (!fb_info->pseudo_palette) {
ret = -ENOMEM;
@@ -854,6 +899,7 @@ error_register:
error_init_fb:
kfree(fb_info->pseudo_palette);
error_pseudo_pallette:
+error_panel_enable:
clk_put(host->clk);
error_getclock:
error_getpin:
@@ -901,19 +947,6 @@ static void mxsfb_shutdown(struct platform_device *pdev)
writel(CTRL_RUN, host->base + LCDC_CTRL + REG_CLR);
}
-static struct platform_device_id mxsfb_devtype[] = {
- {
- .name = "imx23-fb",
- .driver_data = MXSFB_V3,
- }, {
- .name = "imx28-fb",
- .driver_data = MXSFB_V4,
- }, {
- /* sentinel */
- }
-};
-MODULE_DEVICE_TABLE(platform, mxsfb_devtype);
-
static struct platform_driver mxsfb_driver = {
.probe = mxsfb_probe,
.remove = __devexit_p(mxsfb_remove),
@@ -921,6 +954,7 @@ static struct platform_driver mxsfb_driver = {
.id_table = mxsfb_devtype,
.driver = {
.name = DRIVER_NAME,
+ .of_match_table = mxsfb_dt_ids,
},
};
--
1.7.5.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v2 2/2] video: mxsfb: add simple device tree probe
@ 2012-06-28 3:34 ` Shawn Guo
0 siblings, 0 replies; 12+ messages in thread
From: Shawn Guo @ 2012-06-28 3:34 UTC (permalink / raw)
To: linux-arm-kernel
Add a simple device tree probe support for mxsfb driver. Before
a common binding for struct fb_videomode is available, the driver will
keep using struct mxsfb_platform_data. That said, platform code will
use auxdata to attach mxsfb_platform_data for device tree boot.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
Changes since v1:
* Remove enable-active-low property and use of_get_named_gpio_flags
instead
Documentation/devicetree/bindings/fb/mxsfb.txt | 19 ++++++++
drivers/video/mxsfb.c | 60 ++++++++++++++++++-----
2 files changed, 66 insertions(+), 13 deletions(-)
create mode 100644 Documentation/devicetree/bindings/fb/mxsfb.txt
diff --git a/Documentation/devicetree/bindings/fb/mxsfb.txt b/Documentation/devicetree/bindings/fb/mxsfb.txt
new file mode 100644
index 0000000..b41e5e52
--- /dev/null
+++ b/Documentation/devicetree/bindings/fb/mxsfb.txt
@@ -0,0 +1,19 @@
+* Freescale MXS LCD Interface (LCDIF)
+
+Required properties:
+- compatible: Should be "fsl,<chip>-lcdif". Supported chips include
+ imx23 and imx28.
+- reg: Address and length of the register set for lcdif
+- interrupts: Should contain lcdif interrupts
+
+Optional properties:
+- panel-enable-gpios : Should specify the gpio for panel enable
+
+Examples:
+
+lcdif at 80030000 {
+ compatible = "fsl,imx28-lcdif";
+ reg = <0x80030000 2000>;
+ interrupts = <38 86>;
+ panel-enable-gpios = <&gpio3 30 0>;
+};
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
index 08dad8d..49619b4 100644
--- a/drivers/video/mxsfb.c
+++ b/drivers/video/mxsfb.c
@@ -41,6 +41,8 @@
#include <linux/module.h>
#include <linux/kernel.h>
+#include <linux/of_device.h>
+#include <linux/of_gpio.h>
#include <linux/platform_device.h>
#include <linux/clk.h>
#include <linux/dma-mapping.h>
@@ -750,16 +752,43 @@ static void __devexit mxsfb_free_videomem(struct mxsfb_info *host)
}
}
+static struct platform_device_id mxsfb_devtype[] = {
+ {
+ .name = "imx23-fb",
+ .driver_data = MXSFB_V3,
+ }, {
+ .name = "imx28-fb",
+ .driver_data = MXSFB_V4,
+ }, {
+ /* sentinel */
+ }
+};
+MODULE_DEVICE_TABLE(platform, mxsfb_devtype);
+
+static const struct of_device_id mxsfb_dt_ids[] = {
+ { .compatible = "fsl,imx23-lcdif", .data = &mxsfb_devtype[0], },
+ { .compatible = "fsl,imx28-lcdif", .data = &mxsfb_devtype[1], },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, mxsfb_dt_ids);
+
static int __devinit mxsfb_probe(struct platform_device *pdev)
{
+ const struct of_device_id *of_id =
+ of_match_device(mxsfb_dt_ids, &pdev->dev);
struct mxsfb_platform_data *pdata = pdev->dev.platform_data;
struct resource *res;
struct mxsfb_info *host;
struct fb_info *fb_info;
struct fb_modelist *modelist;
struct pinctrl *pinctrl;
+ int panel_enable;
+ enum of_gpio_flags flags;
int i, ret;
+ if (of_id)
+ pdev->id_entry = of_id->data;
+
if (!pdata) {
dev_err(&pdev->dev, "No platformdata. Giving up\n");
return -ENODEV;
@@ -807,6 +836,22 @@ static int __devinit mxsfb_probe(struct platform_device *pdev)
goto error_getclock;
}
+ panel_enable = of_get_named_gpio_flags(pdev->dev.of_node,
+ "panel-enable-gpios", 0, &flags);
+ if (gpio_is_valid(panel_enable)) {
+ unsigned long f = GPIOF_OUT_INIT_HIGH;
+ if (flags == OF_GPIO_ACTIVE_LOW)
+ f = GPIOF_OUT_INIT_LOW;
+ ret = devm_gpio_request_one(&pdev->dev, panel_enable,
+ f, "panel-enable");
+ if (ret) {
+ dev_err(&pdev->dev,
+ "failed to request gpio %d: %d\n",
+ panel_enable, ret);
+ goto error_panel_enable;
+ }
+ }
+
fb_info->pseudo_palette = kmalloc(sizeof(u32) * 16, GFP_KERNEL);
if (!fb_info->pseudo_palette) {
ret = -ENOMEM;
@@ -854,6 +899,7 @@ error_register:
error_init_fb:
kfree(fb_info->pseudo_palette);
error_pseudo_pallette:
+error_panel_enable:
clk_put(host->clk);
error_getclock:
error_getpin:
@@ -901,19 +947,6 @@ static void mxsfb_shutdown(struct platform_device *pdev)
writel(CTRL_RUN, host->base + LCDC_CTRL + REG_CLR);
}
-static struct platform_device_id mxsfb_devtype[] = {
- {
- .name = "imx23-fb",
- .driver_data = MXSFB_V3,
- }, {
- .name = "imx28-fb",
- .driver_data = MXSFB_V4,
- }, {
- /* sentinel */
- }
-};
-MODULE_DEVICE_TABLE(platform, mxsfb_devtype);
-
static struct platform_driver mxsfb_driver = {
.probe = mxsfb_probe,
.remove = __devexit_p(mxsfb_remove),
@@ -921,6 +954,7 @@ static struct platform_driver mxsfb_driver = {
.id_table = mxsfb_devtype,
.driver = {
.name = DRIVER_NAME,
+ .of_match_table = mxsfb_dt_ids,
},
};
--
1.7.5.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 0/2] simple device tree support for mxsfb
2012-06-26 9:02 ` Shawn Guo
@ 2012-07-03 7:46 ` Shawn Guo
-1 siblings, 0 replies; 12+ messages in thread
From: Shawn Guo @ 2012-07-03 7:46 UTC (permalink / raw)
To: linux-arm-kernel
Hi Florian,
On Tue, Jun 26, 2012 at 05:02:57PM +0800, Shawn Guo wrote:
> It adds a simple device tree support for mxsfb driver.
>
> Shawn Guo (2):
> video: mxsfb: move mxsfb.h into include/linux
> video: mxsfb: add simple device tree probe
>
I just queued these two patches on mxs arch tree. Please let me know
if you see problem with that.
Regards,
Shawn
> Documentation/devicetree/bindings/fb/mxsfb.txt | 21 +++++++
> arch/arm/mach-mxs/devices-mx23.h | 2 +-
> arch/arm/mach-mxs/devices-mx28.h | 2 +-
> arch/arm/mach-mxs/devices/platform-mxsfb.c | 2 +-
> drivers/video/mxsfb.c | 62 +++++++++++++++-----
> .../include/mach => include/linux}/mxsfb.h | 6 +-
> 6 files changed, 75 insertions(+), 20 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/fb/mxsfb.txt
> rename {arch/arm/mach-mxs/include/mach => include/linux}/mxsfb.h (95%)
>
> --
> 1.7.5.4
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 0/2] simple device tree support for mxsfb
@ 2012-07-03 7:46 ` Shawn Guo
0 siblings, 0 replies; 12+ messages in thread
From: Shawn Guo @ 2012-07-03 7:46 UTC (permalink / raw)
To: linux-arm-kernel
Hi Florian,
On Tue, Jun 26, 2012 at 05:02:57PM +0800, Shawn Guo wrote:
> It adds a simple device tree support for mxsfb driver.
>
> Shawn Guo (2):
> video: mxsfb: move mxsfb.h into include/linux
> video: mxsfb: add simple device tree probe
>
I just queued these two patches on mxs arch tree. Please let me know
if you see problem with that.
Regards,
Shawn
> Documentation/devicetree/bindings/fb/mxsfb.txt | 21 +++++++
> arch/arm/mach-mxs/devices-mx23.h | 2 +-
> arch/arm/mach-mxs/devices-mx28.h | 2 +-
> arch/arm/mach-mxs/devices/platform-mxsfb.c | 2 +-
> drivers/video/mxsfb.c | 62 +++++++++++++++-----
> .../include/mach => include/linux}/mxsfb.h | 6 +-
> 6 files changed, 75 insertions(+), 20 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/fb/mxsfb.txt
> rename {arch/arm/mach-mxs/include/mach => include/linux}/mxsfb.h (95%)
>
> --
> 1.7.5.4
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2012-07-03 7:46 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-26 9:02 [PATCH 0/2] simple device tree support for mxsfb Shawn Guo
2012-06-26 9:02 ` Shawn Guo
2012-06-26 9:02 ` [PATCH 1/2] video: mxsfb: move mxsfb.h into include/linux Shawn Guo
2012-06-26 9:02 ` Shawn Guo
2012-06-26 9:02 ` [PATCH 2/2] video: mxsfb: add simple device tree probe Shawn Guo
2012-06-26 9:02 ` Shawn Guo
2012-06-28 3:34 ` [PATCH v2 " Shawn Guo
2012-06-28 3:34 ` Shawn Guo
2012-06-27 13:53 ` [PATCH 0/2] simple device tree support for mxsfb Shawn Guo
2012-06-27 13:53 ` Shawn Guo
2012-07-03 7:46 ` Shawn Guo
2012-07-03 7:46 ` Shawn Guo
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.