summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobby Cai <R63905@freescale.com>2013-06-09 00:54:18 +0800
committerRobby Cai <R63905@freescale.com>2013-06-09 22:25:37 +0800
commita2c8cc9ff19dece4fbec1d32607811793199983b (patch)
tree0a411047d27a05465f0a72d7d67e94a50581c062
parenta6752e7f047cdda4f3dd8020b2b88edc32420b75 (diff)
ENGR00264927-3 epdc: update the driver with dts
- use of_match_table - add platform_data via OF_DEV_AUXDATA Signed-off-by: Robby Cai <R63905@freescale.com>
-rw-r--r--arch/arm/mach-imx/mach-imx6q.c130
-rw-r--r--drivers/video/mxc/mxc_epdc_fb.c34
2 files changed, 145 insertions, 19 deletions
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index 33935134f65c..ed0854fec073 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -15,6 +15,7 @@
#include <linux/clkdev.h>
#include <linux/delay.h>
#include <linux/export.h>
+#include <linux/fb.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/iram_alloc.h>
@@ -49,6 +50,7 @@
#include <mach/hardware.h>
#include <mach/i2c.h>
#include <mach/busfreq.h>
+#include <mach/epdc.h>
#ifdef CONFIG_PCI_MSI
#include "msi.h"
#endif
@@ -147,6 +149,133 @@ early_param("can0", early_enable_can0);
#define IMX6Q_C_ERR(fmt, ...) \
pr_err("mach-imx6q.c ERROR: %s: " fmt, __func__, ##__VA_ARGS__)
+static struct fb_videomode e60_v110_mode = {
+ .name = "E60_V110",
+ .refresh = 50,
+ .xres = 800,
+ .yres = 600,
+ .pixclock = 18604700,
+ .left_margin = 8,
+ .right_margin = 178,
+ .upper_margin = 4,
+ .lower_margin = 10,
+ .hsync_len = 20,
+ .vsync_len = 4,
+ .sync = 0,
+ .vmode = FB_VMODE_NONINTERLACED,
+ .flag = 0,
+};
+static struct fb_videomode e60_v220_mode = {
+ .name = "E60_V220",
+ .refresh = 85,
+ .xres = 800,
+ .yres = 600,
+ .pixclock = 30000000,
+ .left_margin = 8,
+ .right_margin = 164,
+ .upper_margin = 4,
+ .lower_margin = 8,
+ .hsync_len = 4,
+ .vsync_len = 1,
+ .sync = 0,
+ .vmode = FB_VMODE_NONINTERLACED,
+ .flag = 0,
+ .refresh = 85,
+ .xres = 800,
+ .yres = 600,
+};
+static struct fb_videomode e060scm_mode = {
+ .name = "E060SCM",
+ .refresh = 85,
+ .xres = 800,
+ .yres = 600,
+ .pixclock = 26666667,
+ .left_margin = 8,
+ .right_margin = 100,
+ .upper_margin = 4,
+ .lower_margin = 8,
+ .hsync_len = 4,
+ .vsync_len = 1,
+ .sync = 0,
+ .vmode = FB_VMODE_NONINTERLACED,
+ .flag = 0,
+};
+static struct fb_videomode e97_v110_mode = {
+ .name = "E97_V110",
+ .refresh = 50,
+ .xres = 1200,
+ .yres = 825,
+ .pixclock = 32000000,
+ .left_margin = 12,
+ .right_margin = 128,
+ .upper_margin = 4,
+ .lower_margin = 10,
+ .hsync_len = 20,
+ .vsync_len = 4,
+ .sync = 0,
+ .vmode = FB_VMODE_NONINTERLACED,
+ .flag = 0,
+};
+
+static struct imx_epdc_fb_mode panel_modes[] = {
+ {
+ &e60_v110_mode,
+ 4, /* vscan_holdoff */
+ 10, /* sdoed_width */
+ 20, /* sdoed_delay */
+ 10, /* sdoez_width */
+ 20, /* sdoez_delay */
+ 428, /* gdclk_hp_offs */
+ 20, /* gdsp_offs */
+ 0, /* gdoe_offs */
+ 1, /* gdclk_offs */
+ 1, /* num_ce */
+ },
+ {
+ &e60_v220_mode,
+ 4, /* vscan_holdoff */
+ 10, /* sdoed_width */
+ 20, /* sdoed_delay */
+ 10, /* sdoez_width */
+ 20, /* sdoez_delay */
+ 465, /* gdclk_hp_offs */
+ 20, /* gdsp_offs */
+ 0, /* gdoe_offs */
+ 9, /* gdclk_offs */
+ 1, /* num_ce */
+ },
+ {
+ &e060scm_mode,
+ 4, /* vscan_holdoff */
+ 10, /* sdoed_width */
+ 20, /* sdoed_delay */
+ 10, /* sdoez_width */
+ 20, /* sdoez_delay */
+ 419, /* gdclk_hp_offs */
+ 20, /* gdsp_offs */
+ 0, /* gdoe_offs */
+ 5, /* gdclk_offs */
+ 1, /* num_ce */
+ },
+ {
+ &e97_v110_mode,
+ 8, /* vscan_holdoff */
+ 10, /* sdoed_width */
+ 20, /* sdoed_delay */
+ 10, /* sdoez_width */
+ 20, /* sdoez_delay */
+ 632, /* gdclk_hp_offs */
+ 20, /* gdsp_offs */
+ 0, /* gdoe_offs */
+ 1, /* gdclk_offs */
+ 3, /* num_ce */
+ }
+};
+
+static struct imx_epdc_fb_platform_data epdc_data = {
+ .epdc_mode = panel_modes,
+ .num_modes = ARRAY_SIZE(panel_modes),
+};
static void remove_pinctrl0(const char *path)
{
@@ -1033,6 +1162,7 @@ static const struct of_dev_auxdata imx6q_auxdata_lookup[] __initconst = {
OF_DEV_AUXDATA("fsl,imx6q-flexcan", 0x02090000, NULL, &flexcan_pdata[0]),
OF_DEV_AUXDATA("fsl,imx6q-flexcan", 0x02094000, NULL, &flexcan_pdata[1]),
OF_DEV_AUXDATA("fsl,imx6q-i2c", 0x021a8000, NULL, &i2c3_pdata),
+ OF_DEV_AUXDATA("fsl,imx6-epdc", 0x020f8000, NULL, &epdc_data),
{ /* sentinel */ }
};
diff --git a/drivers/video/mxc/mxc_epdc_fb.c b/drivers/video/mxc/mxc_epdc_fb.c
index 45a29b5fe8c5..c9cc8b8cc992 100644
--- a/drivers/video/mxc/mxc_epdc_fb.c
+++ b/drivers/video/mxc/mxc_epdc_fb.c
@@ -48,6 +48,7 @@
#include <linux/regulator/driver.h>
#include <linux/fsl_devices.h>
#include <linux/bitops.h>
+#include <linux/pinctrl/consumer.h>
#include <mach/epdc.h>
#include <mach/dma.h>
#include <asm/cacheflush.h>
@@ -1081,10 +1082,6 @@ static void epdc_powerup(struct mxc_epdc_fb_data *fb_data)
msleep(1);
- /* Enable pins used by EPDC */
- if (fb_data->pdata->enable_pins)
- fb_data->pdata->enable_pins();
-
/* Enable clocks to EPDC */
clk_enable(fb_data->epdc_clk_axi);
clk_enable(fb_data->epdc_clk_pix);
@@ -1136,10 +1133,6 @@ static void epdc_powerdown(struct mxc_epdc_fb_data *fb_data)
clk_disable(fb_data->epdc_clk_pix);
clk_disable(fb_data->epdc_clk_axi);
- /* Disable pins used by EPDC (to prevent leakage current) */
- if (fb_data->pdata->disable_pins)
- fb_data->pdata->disable_pins();
-
/* turn off the V3p3 */
regulator_disable(fb_data->v3p3_regulator);
@@ -4309,9 +4302,16 @@ static struct device_attribute fb_attrs[] = {
__ATTR(update, S_IRUGO|S_IWUSR, NULL, store_update),
};
+static const struct of_device_id imx_epdc_dt_ids[] = {
+ { .compatible = "fsl,imx6-epdc", },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, imx_epdc_dt_ids);
+
int __devinit mxc_epdc_fb_probe(struct platform_device *pdev)
{
int ret = 0;
+ struct pinctrl *pinctrl;
struct mxc_epdc_fb_data *fb_data;
struct resource *res;
struct fb_info *info;
@@ -4665,8 +4665,12 @@ int __devinit mxc_epdc_fb_probe(struct platform_device *pdev)
}
/* Initialize EPDC pins */
- if (fb_data->pdata->get_pins)
- fb_data->pdata->get_pins();
+ pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
+ if (IS_ERR(pinctrl)) {
+ dev_err(&pdev->dev, "can't get/select pinctrl\n");
+ ret = PTR_ERR(pinctrl);
+ goto out_copybuffer;
+ }
fb_data->in_init = false;
@@ -4900,8 +4904,6 @@ out_irq:
out_dma_work_buf:
dma_free_writecombine(&pdev->dev, fb_data->working_buffer_size,
fb_data->working_buffer_virt, fb_data->working_buffer_phys);
- if (fb_data->pdata->put_pins)
- fb_data->pdata->put_pins();
out_copybuffer:
dma_free_writecombine(&pdev->dev, fb_data->max_pix_size*2,
fb_data->virt_addr_copybuf,
@@ -4983,9 +4985,6 @@ static int mxc_epdc_fb_remove(struct platform_device *pdev)
dma_free_writecombine(&pdev->dev, fb_data->map_size, fb_data->info.screen_base,
fb_data->phys_start);
- if (fb_data->pdata->put_pins)
- fb_data->pdata->put_pins();
-
/* Release PxP-related resources */
if (fb_data->pxp_chan != NULL)
dma_release_channel(&fb_data->pxp_chan->dma_chan);
@@ -5043,10 +5042,6 @@ static void mxc_epdc_fb_shutdown(struct platform_device *pdev)
clk_disable(fb_data->epdc_clk_pix);
clk_disable(fb_data->epdc_clk_axi);
- /* Disable pins used by EPDC (to prevent leakage current) */
- if (fb_data->pdata->disable_pins)
- fb_data->pdata->disable_pins();
-
/* turn off the V3p3 */
if (regulator_is_enabled(fb_data->v3p3_regulator))
regulator_disable(fb_data->v3p3_regulator);
@@ -5066,6 +5061,7 @@ static struct platform_driver mxc_epdc_fb_driver = {
.driver = {
.name = "imx_epdc_fb",
.owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(imx_epdc_dt_ids),
},
};