提交 afaad83b 编写于 作者: L Laurent Pinchart

fbdev: sh_mobile_lcdc: Merge board_cfg and lcd_size_cfg into panel_cfg

Update board code accordingly.
Signed-off-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
上级 43059b0f
...@@ -252,12 +252,12 @@ static struct sh_mobile_lcdc_info lcdc0_info = { ...@@ -252,12 +252,12 @@ static struct sh_mobile_lcdc_info lcdc0_info = {
.interface_type = RGB24, .interface_type = RGB24,
.clock_divider = 1, .clock_divider = 1,
.flags = LCDC_FLAGS_DWPOL, .flags = LCDC_FLAGS_DWPOL,
.lcd_size_cfg.width = 44,
.lcd_size_cfg.height = 79,
.fourcc = V4L2_PIX_FMT_RGB565, .fourcc = V4L2_PIX_FMT_RGB565,
.lcd_cfg = lcdc0_modes, .lcd_cfg = lcdc0_modes,
.num_cfg = ARRAY_SIZE(lcdc0_modes), .num_cfg = ARRAY_SIZE(lcdc0_modes),
.board_cfg = { .panel_cfg = {
.width = 44,
.height = 79,
.display_on = lcd_backlight_on, .display_on = lcd_backlight_on,
.display_off = lcd_backlight_reset, .display_off = lcd_backlight_reset,
}, },
......
...@@ -1360,8 +1360,8 @@ static void __init ap4evb_init(void) ...@@ -1360,8 +1360,8 @@ static void __init ap4evb_init(void)
lcdc_info.ch[0].interface_type = RGB24; lcdc_info.ch[0].interface_type = RGB24;
lcdc_info.ch[0].clock_divider = 1; lcdc_info.ch[0].clock_divider = 1;
lcdc_info.ch[0].flags = LCDC_FLAGS_DWPOL; lcdc_info.ch[0].flags = LCDC_FLAGS_DWPOL;
lcdc_info.ch[0].lcd_size_cfg.width = 44; lcdc_info.ch[0].panel_cfg.width = 44;
lcdc_info.ch[0].lcd_size_cfg.height = 79; lcdc_info.ch[0].panel_cfg.height = 79;
platform_add_devices(qhd_devices, ARRAY_SIZE(qhd_devices)); platform_add_devices(qhd_devices, ARRAY_SIZE(qhd_devices));
...@@ -1402,8 +1402,8 @@ static void __init ap4evb_init(void) ...@@ -1402,8 +1402,8 @@ static void __init ap4evb_init(void)
lcdc_info.ch[0].interface_type = RGB18; lcdc_info.ch[0].interface_type = RGB18;
lcdc_info.ch[0].clock_divider = 3; lcdc_info.ch[0].clock_divider = 3;
lcdc_info.ch[0].flags = 0; lcdc_info.ch[0].flags = 0;
lcdc_info.ch[0].lcd_size_cfg.width = 152; lcdc_info.ch[0].panel_cfg.width = 152;
lcdc_info.ch[0].lcd_size_cfg.height = 91; lcdc_info.ch[0].panel_cfg.height = 91;
/* enable TouchScreen */ /* enable TouchScreen */
irq_set_irq_type(IRQ7, IRQ_TYPE_LEVEL_LOW); irq_set_irq_type(IRQ7, IRQ_TYPE_LEVEL_LOW);
......
...@@ -247,7 +247,7 @@ static struct sh_mobile_lcdc_info lcdc0_info = { ...@@ -247,7 +247,7 @@ static struct sh_mobile_lcdc_info lcdc0_info = {
.flags = 0, .flags = 0,
.lcd_cfg = &lcdc0_mode, .lcd_cfg = &lcdc0_mode,
.num_cfg = 1, .num_cfg = 1,
.lcd_size_cfg = { .panel_cfg = {
.width = 152, .width = 152,
.height = 91, .height = 91,
}, },
......
...@@ -389,8 +389,10 @@ static struct sh_mobile_lcdc_info lcdc_info = { ...@@ -389,8 +389,10 @@ static struct sh_mobile_lcdc_info lcdc_info = {
.interface_type = RGB24, .interface_type = RGB24,
.clock_divider = 3, .clock_divider = 3,
.flags = 0, .flags = 0,
.lcd_size_cfg.width = 152, .panel_cfg = {
.lcd_size_cfg.height = 91, .width = 152,
.height = 91,
},
.bl_info = { .bl_info = {
.name = "sh_mobile_lcdc_bl", .name = "sh_mobile_lcdc_bl",
.max_brightness = 1, .max_brightness = 1,
......
...@@ -213,11 +213,9 @@ static struct sh_mobile_lcdc_info lcdc_info = { ...@@ -213,11 +213,9 @@ static struct sh_mobile_lcdc_info lcdc_info = {
.clock_divider = 1, .clock_divider = 1,
.lcd_cfg = ap325rxa_lcdc_modes, .lcd_cfg = ap325rxa_lcdc_modes,
.num_cfg = ARRAY_SIZE(ap325rxa_lcdc_modes), .num_cfg = ARRAY_SIZE(ap325rxa_lcdc_modes),
.lcd_size_cfg = { /* 7.0 inch */ .panel_cfg = {
.width = 152, .width = 152, /* 7.0 inch */
.height = 91, .height = 91,
},
.board_cfg = {
.display_on = ap320_wvga_power_on, .display_on = ap320_wvga_power_on,
.display_off = ap320_wvga_power_off, .display_off = ap320_wvga_power_off,
}, },
......
...@@ -327,7 +327,7 @@ static struct sh_mobile_lcdc_info lcdc_info = { ...@@ -327,7 +327,7 @@ static struct sh_mobile_lcdc_info lcdc_info = {
.interface_type = RGB18, .interface_type = RGB18,
.chan = LCDC_CHAN_MAINLCD, .chan = LCDC_CHAN_MAINLCD,
.fourcc = V4L2_PIX_FMT_RGB565, .fourcc = V4L2_PIX_FMT_RGB565,
.lcd_size_cfg = { /* 7.0 inch */ .panel_cfg = { /* 7.0 inch */
.width = 152, .width = 152,
.height = 91, .height = 91,
}, },
......
...@@ -150,11 +150,9 @@ static struct sh_mobile_lcdc_info kfr2r09_sh_lcdc_info = { ...@@ -150,11 +150,9 @@ static struct sh_mobile_lcdc_info kfr2r09_sh_lcdc_info = {
.flags = LCDC_FLAGS_DWPOL, .flags = LCDC_FLAGS_DWPOL,
.lcd_cfg = kfr2r09_lcdc_modes, .lcd_cfg = kfr2r09_lcdc_modes,
.num_cfg = ARRAY_SIZE(kfr2r09_lcdc_modes), .num_cfg = ARRAY_SIZE(kfr2r09_lcdc_modes),
.lcd_size_cfg = { .panel_cfg = {
.width = 35, .width = 35,
.height = 58, .height = 58,
},
.board_cfg = {
.setup_sys = kfr2r09_lcd_setup, .setup_sys = kfr2r09_lcd_setup,
.start_transfer = kfr2r09_lcd_start, .start_transfer = kfr2r09_lcd_start,
.display_on = kfr2r09_lcd_on, .display_on = kfr2r09_lcd_on,
......
...@@ -248,7 +248,7 @@ static struct sh_mobile_lcdc_info sh_mobile_lcdc_info = { ...@@ -248,7 +248,7 @@ static struct sh_mobile_lcdc_info sh_mobile_lcdc_info = {
.clock_divider = 2, .clock_divider = 2,
.lcd_cfg = migor_lcd_modes, .lcd_cfg = migor_lcd_modes,
.num_cfg = ARRAY_SIZE(migor_lcd_modes), .num_cfg = ARRAY_SIZE(migor_lcd_modes),
.lcd_size_cfg = { /* 7.0 inch */ .panel_cfg = { /* 7.0 inch */
.width = 152, .width = 152,
.height = 91, .height = 91,
}, },
...@@ -262,11 +262,9 @@ static struct sh_mobile_lcdc_info sh_mobile_lcdc_info = { ...@@ -262,11 +262,9 @@ static struct sh_mobile_lcdc_info sh_mobile_lcdc_info = {
.clock_divider = 10, .clock_divider = 10,
.lcd_cfg = migor_lcd_modes, .lcd_cfg = migor_lcd_modes,
.num_cfg = ARRAY_SIZE(migor_lcd_modes), .num_cfg = ARRAY_SIZE(migor_lcd_modes),
.lcd_size_cfg = { /* 2.4 inch */ .panel_cfg = {
.width = 49, .width = 49, /* 2.4 inch */
.height = 37, .height = 37,
},
.board_cfg = {
.setup_sys = migor_lcd_qvga_setup, .setup_sys = migor_lcd_qvga_setup,
}, },
.sys_bus_cfg = { .sys_bus_cfg = {
......
...@@ -182,7 +182,7 @@ static struct sh_mobile_lcdc_info lcdc_info = { ...@@ -182,7 +182,7 @@ static struct sh_mobile_lcdc_info lcdc_info = {
.chan = LCDC_CHAN_MAINLCD, .chan = LCDC_CHAN_MAINLCD,
.fourcc = V4L2_PIX_FMT_RGB565, .fourcc = V4L2_PIX_FMT_RGB565,
.clock_divider = 1, .clock_divider = 1,
.lcd_size_cfg = { /* 7.0 inch */ .panel_cfg = { /* 7.0 inch */
.width = 152, .width = 152,
.height = 91, .height = 91,
}, },
......
...@@ -289,7 +289,7 @@ static void sh_mobile_lcdc_deferred_io(struct fb_info *info, ...@@ -289,7 +289,7 @@ static void sh_mobile_lcdc_deferred_io(struct fb_info *info,
struct list_head *pagelist) struct list_head *pagelist)
{ {
struct sh_mobile_lcdc_chan *ch = info->par; struct sh_mobile_lcdc_chan *ch = info->par;
struct sh_mobile_lcdc_board_cfg *bcfg = &ch->cfg.board_cfg; struct sh_mobile_lcdc_panel_cfg *panel = &ch->cfg.panel_cfg;
/* enable clocks before accessing hardware */ /* enable clocks before accessing hardware */
sh_mobile_lcdc_clk_on(ch->lcdc); sh_mobile_lcdc_clk_on(ch->lcdc);
...@@ -314,13 +314,13 @@ static void sh_mobile_lcdc_deferred_io(struct fb_info *info, ...@@ -314,13 +314,13 @@ static void sh_mobile_lcdc_deferred_io(struct fb_info *info,
/* trigger panel update */ /* trigger panel update */
dma_map_sg(info->dev, ch->sglist, nr_pages, DMA_TO_DEVICE); dma_map_sg(info->dev, ch->sglist, nr_pages, DMA_TO_DEVICE);
if (bcfg->start_transfer) if (panel->start_transfer)
bcfg->start_transfer(ch, &sh_mobile_lcdc_sys_bus_ops); panel->start_transfer(ch, &sh_mobile_lcdc_sys_bus_ops);
lcdc_write_chan(ch, LDSM2R, LDSM2R_OSTRG); lcdc_write_chan(ch, LDSM2R, LDSM2R_OSTRG);
dma_unmap_sg(info->dev, ch->sglist, nr_pages, DMA_TO_DEVICE); dma_unmap_sg(info->dev, ch->sglist, nr_pages, DMA_TO_DEVICE);
} else { } else {
if (bcfg->start_transfer) if (panel->start_transfer)
bcfg->start_transfer(ch, &sh_mobile_lcdc_sys_bus_ops); panel->start_transfer(ch, &sh_mobile_lcdc_sys_bus_ops);
lcdc_write_chan(ch, LDSM2R, LDSM2R_OSTRG); lcdc_write_chan(ch, LDSM2R, LDSM2R_OSTRG);
} }
} }
...@@ -335,7 +335,7 @@ static void sh_mobile_lcdc_deferred_io_touch(struct fb_info *info) ...@@ -335,7 +335,7 @@ static void sh_mobile_lcdc_deferred_io_touch(struct fb_info *info)
static void sh_mobile_lcdc_display_on(struct sh_mobile_lcdc_chan *ch) static void sh_mobile_lcdc_display_on(struct sh_mobile_lcdc_chan *ch)
{ {
struct sh_mobile_lcdc_board_cfg *board_cfg = &ch->cfg.board_cfg; struct sh_mobile_lcdc_panel_cfg *panel = &ch->cfg.panel_cfg;
if (ch->tx_dev) { if (ch->tx_dev) {
if (ch->tx_dev->ops->display_on(ch->tx_dev, ch->info) < 0) if (ch->tx_dev->ops->display_on(ch->tx_dev, ch->info) < 0)
...@@ -343,16 +343,16 @@ static void sh_mobile_lcdc_display_on(struct sh_mobile_lcdc_chan *ch) ...@@ -343,16 +343,16 @@ static void sh_mobile_lcdc_display_on(struct sh_mobile_lcdc_chan *ch)
} }
/* HDMI must be enabled before LCDC configuration */ /* HDMI must be enabled before LCDC configuration */
if (board_cfg->display_on) if (panel->display_on)
board_cfg->display_on(); panel->display_on();
} }
static void sh_mobile_lcdc_display_off(struct sh_mobile_lcdc_chan *ch) static void sh_mobile_lcdc_display_off(struct sh_mobile_lcdc_chan *ch)
{ {
struct sh_mobile_lcdc_board_cfg *board_cfg = &ch->cfg.board_cfg; struct sh_mobile_lcdc_panel_cfg *panel = &ch->cfg.panel_cfg;
if (board_cfg->display_off) if (panel->display_off)
board_cfg->display_off(); panel->display_off();
if (ch->tx_dev) if (ch->tx_dev)
ch->tx_dev->ops->display_off(ch->tx_dev); ch->tx_dev->ops->display_off(ch->tx_dev);
...@@ -687,16 +687,15 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv) ...@@ -687,16 +687,15 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
lcdc_wait_bit(priv, _LDCNT2R, LDCNT2R_BR, 0); lcdc_wait_bit(priv, _LDCNT2R, LDCNT2R_BR, 0);
for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
struct sh_mobile_lcdc_board_cfg *board_cfg; struct sh_mobile_lcdc_panel_cfg *panel;
ch = &priv->ch[k]; ch = &priv->ch[k];
if (!ch->enabled) if (!ch->enabled)
continue; continue;
board_cfg = &ch->cfg.board_cfg; panel = &ch->cfg.panel_cfg;
if (board_cfg->setup_sys) { if (panel->setup_sys) {
ret = board_cfg->setup_sys(ch, ret = panel->setup_sys(ch, &sh_mobile_lcdc_sys_bus_ops);
&sh_mobile_lcdc_sys_bus_ops);
if (ret) if (ret)
return ret; return ret;
} }
...@@ -1654,8 +1653,8 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv, ...@@ -1654,8 +1653,8 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
*/ */
var = &info->var; var = &info->var;
fb_videomode_to_var(var, mode); fb_videomode_to_var(var, mode);
var->width = cfg->lcd_size_cfg.width; var->width = cfg->panel_cfg.width;
var->height = cfg->lcd_size_cfg.height; var->height = cfg->panel_cfg.height;
var->yres_virtual = var->yres * 2; var->yres_virtual = var->yres * 2;
var->activate = FB_ACTIVATE_NOW; var->activate = FB_ACTIVATE_NOW;
......
...@@ -147,7 +147,9 @@ struct sh_mobile_lcdc_sys_bus_ops { ...@@ -147,7 +147,9 @@ struct sh_mobile_lcdc_sys_bus_ops {
unsigned long (*read_data)(void *handle); unsigned long (*read_data)(void *handle);
}; };
struct sh_mobile_lcdc_board_cfg { struct sh_mobile_lcdc_panel_cfg {
unsigned long width; /* Panel width in mm */
unsigned long height; /* Panel height in mm */
int (*setup_sys)(void *sys_ops_handle, int (*setup_sys)(void *sys_ops_handle,
struct sh_mobile_lcdc_sys_bus_ops *sys_ops); struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
void (*start_transfer)(void *sys_ops_handle, void (*start_transfer)(void *sys_ops_handle,
...@@ -156,11 +158,6 @@ struct sh_mobile_lcdc_board_cfg { ...@@ -156,11 +158,6 @@ struct sh_mobile_lcdc_board_cfg {
void (*display_off)(void); void (*display_off)(void);
}; };
struct sh_mobile_lcdc_lcd_size_cfg { /* width and height of panel in mm */
unsigned long width;
unsigned long height;
};
/* backlight info */ /* backlight info */
struct sh_mobile_lcdc_bl_info { struct sh_mobile_lcdc_bl_info {
const char *name; const char *name;
...@@ -178,8 +175,7 @@ struct sh_mobile_lcdc_chan_cfg { ...@@ -178,8 +175,7 @@ struct sh_mobile_lcdc_chan_cfg {
unsigned long flags; /* LCDC_FLAGS_... */ unsigned long flags; /* LCDC_FLAGS_... */
const struct fb_videomode *lcd_cfg; const struct fb_videomode *lcd_cfg;
int num_cfg; int num_cfg;
struct sh_mobile_lcdc_lcd_size_cfg lcd_size_cfg; struct sh_mobile_lcdc_panel_cfg panel_cfg;
struct sh_mobile_lcdc_board_cfg board_cfg;
struct sh_mobile_lcdc_bl_info bl_info; struct sh_mobile_lcdc_bl_info bl_info;
struct sh_mobile_lcdc_sys_bus_cfg sys_bus_cfg; /* only for SYSn I/F */ struct sh_mobile_lcdc_sys_bus_cfg sys_bus_cfg; /* only for SYSn I/F */
struct sh_mobile_meram_cfg *meram_cfg; struct sh_mobile_meram_cfg *meram_cfg;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册