diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2015-07-03 11:19:35 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-07-06 12:34:22 +0200 |
commit | 4598e92eada6e3bc8610a7aa1b01aab3df705f9a (patch) | |
tree | f8313cc27665881a043bfeab18b46c236848a7b1 /drivers/video | |
parent | 3fc19644947a2ee50a1e5c54f9f813e2601c8af0 (diff) | |
download | barebox-4598e92eada6e3bc8610a7aa1b01aab3df705f9a.tar.gz barebox-4598e92eada6e3bc8610a7aa1b01aab3df705f9a.tar.xz |
video: stm: copy platform_data to driver data
Copy the individual fields of struct imx_fb_platformdata to the
driver data rather than keeping a pointer to platform_data. This
works better with device tree where no platform_data * is
available.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/stm.c | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/drivers/video/stm.c b/drivers/video/stm.c index abaaf5d049..c58b62ce5a 100644 --- a/drivers/video/stm.c +++ b/drivers/video/stm.c @@ -144,8 +144,13 @@ struct imxfb_info { unsigned memory_size; struct fb_info info; struct device_d *hw_dev; - struct imx_fb_platformdata *pdata; struct clk *clk; + void *fixed_screen; + unsigned fixed_screen_size; + unsigned flags; + unsigned ld_intf_width; + void (*enable)(int enable); + unsigned dotclk_delay; }; /* the RGB565 true colour mode */ @@ -258,14 +263,14 @@ static void stmfb_enable_controller(struct fb_info *fb_info) writel(CTRL1_FIFO_CLEAR, fbi->base + HW_LCDIF_CTRL1 + STMP_OFFSET_REG_CLR); /* enable LCD using LCD_RESET signal*/ - if (fbi->pdata->flags & USE_LCD_RESET) + if (fbi->flags & USE_LCD_RESET) writel(CTRL1_RESET, fbi->base + HW_LCDIF_CTRL1 + STMP_OFFSET_REG_SET); /* start the engine right now */ writel(CTRL_RUN, fbi->base + HW_LCDIF_CTRL + STMP_OFFSET_REG_SET); - if (fbi->pdata->enable) - fbi->pdata->enable(1); + if (fbi->enable) + fbi->enable(1); } static void stmfb_disable_controller(struct fb_info *fb_info) @@ -276,11 +281,11 @@ static void stmfb_disable_controller(struct fb_info *fb_info) /* disable LCD using LCD_RESET signal*/ - if (fbi->pdata->flags & USE_LCD_RESET) + if (fbi->flags & USE_LCD_RESET) writel(CTRL1_RESET, fbi->base + HW_LCDIF_CTRL1 + STMP_OFFSET_REG_CLR); - if (fbi->pdata->enable) - fbi->pdata->enable(0); + if (fbi->enable) + fbi->enable(0); /* * Even if we disable the controller here, it will still continue @@ -306,7 +311,6 @@ static void stmfb_disable_controller(struct fb_info *fb_info) static int stmfb_activate_var(struct fb_info *fb_info) { struct imxfb_info *fbi = fb_info->priv; - struct imx_fb_platformdata *pdata = fbi->pdata; struct fb_videomode *mode = fb_info->mode; uint32_t reg; unsigned size; @@ -317,11 +321,11 @@ static int stmfb_activate_var(struct fb_info *fb_info) size = calc_line_length(mode->xres, fb_info->bits_per_pixel) * mode->yres; - if (pdata && pdata->fixed_screen) { - if (pdata->fixed_screen_size < size) + if (fbi->fixed_screen) { + if (fbi->fixed_screen_size < size) return -ENOMEM; - fb_info->screen_base = pdata->fixed_screen; - fbi->memory_size = pdata->fixed_screen_size; + fb_info->screen_base = fbi->fixed_screen; + fbi->memory_size = fbi->fixed_screen_size; } else { fb_info->screen_base = xrealloc(fb_info->screen_base, size); fbi->memory_size = size; @@ -349,7 +353,8 @@ static int stmfb_activate_var(struct fb_info *fb_info) /* * Configure videomode and interface mode */ - reg |= SET_BUS_WIDTH(pdata->ld_intf_width); + reg |= SET_BUS_WIDTH(fbi->ld_intf_width); + switch (fb_info->bits_per_pixel) { case 8: reg |= SET_WORD_LENGTH(1); @@ -370,7 +375,8 @@ static int stmfb_activate_var(struct fb_info *fb_info) case 32: pr_debug("Setting up an RGB888/666 mode\n"); reg |= SET_WORD_LENGTH(3); - switch (pdata->ld_intf_width) { + + switch (fbi->ld_intf_width) { case STMLCDIF_8BIT: dev_dbg(fbi->hw_dev, "Unsupported LCD bus width mapping\n"); @@ -442,7 +448,7 @@ static int stmfb_activate_var(struct fb_info *fb_info) writel( #ifdef CONFIG_ARCH_IMX28 - SET_DOTCLK_DLY(pdata->dotclk_delay) | + SET_DOTCLK_DLY(fbi->dotclk_delay) | #endif SET_DOTCLK_H_VALID_DATA_CNT(mode->xres), fbi->base + HW_LCDIF_VDCTRL4); @@ -480,7 +486,6 @@ static int stmfb_probe(struct device_d *hw_dev) /* add runtime hardware info */ fbi.hw_dev = hw_dev; fbi.base = dev_request_mem_region(hw_dev, 0); - fbi.pdata = pdata; fbi.clk = clk_get(hw_dev, NULL); if (IS_ERR(fbi.clk)) return PTR_ERR(fbi.clk); @@ -493,6 +498,11 @@ static int stmfb_probe(struct device_d *hw_dev) fbi.info.modes.modes = pdata->mode_list; fbi.info.modes.num_modes = pdata->mode_cnt; fbi.info.mode = &fbi.info.modes.modes[0]; + fbi.flags = pdata->flags; + fbi.enable = pdata->enable; + fbi.fixed_screen = pdata->fixed_screen; + fbi.fixed_screen_size = pdata->fixed_screen_size; + fbi.ld_intf_width = pdata->ld_intf_width; if (pdata->bits_per_pixel) fbi.info.bits_per_pixel = pdata->bits_per_pixel; } else { |