diff options
Diffstat (limited to 'drivers/video/sh_mobile_lcdcfb.c')
-rw-r--r-- | drivers/video/sh_mobile_lcdcfb.c | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index 295bf4ba1849..e4f6012fe4e3 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c | |||
@@ -460,7 +460,6 @@ static void sh_mobile_lcdc_geometry(struct sh_mobile_lcdc_chan *ch) | |||
460 | static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv) | 460 | static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv) |
461 | { | 461 | { |
462 | struct sh_mobile_lcdc_chan *ch; | 462 | struct sh_mobile_lcdc_chan *ch; |
463 | struct fb_videomode *lcd_cfg; | ||
464 | struct sh_mobile_lcdc_board_cfg *board_cfg; | 463 | struct sh_mobile_lcdc_board_cfg *board_cfg; |
465 | unsigned long tmp; | 464 | unsigned long tmp; |
466 | int k, m; | 465 | int k, m; |
@@ -518,7 +517,6 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv) | |||
518 | 517 | ||
519 | for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { | 518 | for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { |
520 | ch = &priv->ch[k]; | 519 | ch = &priv->ch[k]; |
521 | lcd_cfg = &ch->cfg.lcd_cfg; | ||
522 | 520 | ||
523 | if (!ch->enabled) | 521 | if (!ch->enabled) |
524 | continue; | 522 | continue; |
@@ -1018,14 +1016,14 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev) | |||
1018 | { | 1016 | { |
1019 | struct fb_info *info; | 1017 | struct fb_info *info; |
1020 | struct sh_mobile_lcdc_priv *priv; | 1018 | struct sh_mobile_lcdc_priv *priv; |
1021 | struct sh_mobile_lcdc_info *pdata; | 1019 | struct sh_mobile_lcdc_info *pdata = pdev->dev.platform_data; |
1022 | struct sh_mobile_lcdc_chan_cfg *cfg; | 1020 | struct sh_mobile_lcdc_chan_cfg *cfg; |
1023 | struct resource *res; | 1021 | struct resource *res; |
1024 | int error; | 1022 | int error; |
1025 | void *buf; | 1023 | void *buf; |
1026 | int i, j; | 1024 | int i, j; |
1027 | 1025 | ||
1028 | if (!pdev->dev.platform_data) { | 1026 | if (!pdata) { |
1029 | dev_err(&pdev->dev, "no platform data defined\n"); | 1027 | dev_err(&pdev->dev, "no platform data defined\n"); |
1030 | return -EINVAL; | 1028 | return -EINVAL; |
1031 | } | 1029 | } |
@@ -1053,32 +1051,33 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev) | |||
1053 | } | 1051 | } |
1054 | 1052 | ||
1055 | priv->irq = i; | 1053 | priv->irq = i; |
1056 | pdata = pdev->dev.platform_data; | ||
1057 | atomic_set(&priv->hw_usecnt, -1); | 1054 | atomic_set(&priv->hw_usecnt, -1); |
1058 | 1055 | ||
1059 | j = 0; | 1056 | j = 0; |
1060 | for (i = 0; i < ARRAY_SIZE(pdata->ch); i++) { | 1057 | for (i = 0; i < ARRAY_SIZE(pdata->ch); i++) { |
1061 | priv->ch[j].lcdc = priv; | 1058 | struct sh_mobile_lcdc_chan *ch = priv->ch + j; |
1062 | memcpy(&priv->ch[j].cfg, &pdata->ch[i], sizeof(pdata->ch[i])); | ||
1063 | 1059 | ||
1064 | error = sh_mobile_lcdc_check_interface(&priv->ch[j]); | 1060 | ch->lcdc = priv; |
1061 | memcpy(&ch->cfg, &pdata->ch[i], sizeof(pdata->ch[i])); | ||
1062 | |||
1063 | error = sh_mobile_lcdc_check_interface(ch); | ||
1065 | if (error) { | 1064 | if (error) { |
1066 | dev_err(&pdev->dev, "unsupported interface type\n"); | 1065 | dev_err(&pdev->dev, "unsupported interface type\n"); |
1067 | goto err1; | 1066 | goto err1; |
1068 | } | 1067 | } |
1069 | init_waitqueue_head(&priv->ch[j].frame_end_wait); | 1068 | init_waitqueue_head(&ch->frame_end_wait); |
1070 | init_completion(&priv->ch[j].vsync_completion); | 1069 | init_completion(&ch->vsync_completion); |
1071 | priv->ch[j].pan_offset = 0; | 1070 | ch->pan_offset = 0; |
1072 | 1071 | ||
1073 | switch (pdata->ch[i].chan) { | 1072 | switch (pdata->ch[i].chan) { |
1074 | case LCDC_CHAN_MAINLCD: | 1073 | case LCDC_CHAN_MAINLCD: |
1075 | priv->ch[j].enabled = 1 << 1; | 1074 | ch->enabled = 1 << 1; |
1076 | priv->ch[j].reg_offs = lcdc_offs_mainlcd; | 1075 | ch->reg_offs = lcdc_offs_mainlcd; |
1077 | j++; | 1076 | j++; |
1078 | break; | 1077 | break; |
1079 | case LCDC_CHAN_SUBLCD: | 1078 | case LCDC_CHAN_SUBLCD: |
1080 | priv->ch[j].enabled = 1 << 2; | 1079 | ch->enabled = 1 << 2; |
1081 | priv->ch[j].reg_offs = lcdc_offs_sublcd; | 1080 | ch->reg_offs = lcdc_offs_sublcd; |
1082 | j++; | 1081 | j++; |
1083 | break; | 1082 | break; |
1084 | } | 1083 | } |
@@ -1102,17 +1101,19 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev) | |||
1102 | 1101 | ||
1103 | for (i = 0; i < j; i++) { | 1102 | for (i = 0; i < j; i++) { |
1104 | struct fb_var_screeninfo *var; | 1103 | struct fb_var_screeninfo *var; |
1105 | struct fb_videomode *lcd_cfg; | 1104 | const struct fb_videomode *lcd_cfg; |
1106 | cfg = &priv->ch[i].cfg; | 1105 | struct sh_mobile_lcdc_chan *ch = priv->ch + i; |
1106 | |||
1107 | cfg = &ch->cfg; | ||
1107 | 1108 | ||
1108 | priv->ch[i].info = framebuffer_alloc(0, &pdev->dev); | 1109 | ch->info = framebuffer_alloc(0, &pdev->dev); |
1109 | if (!priv->ch[i].info) { | 1110 | if (!ch->info) { |
1110 | dev_err(&pdev->dev, "unable to allocate fb_info\n"); | 1111 | dev_err(&pdev->dev, "unable to allocate fb_info\n"); |
1111 | error = -ENOMEM; | 1112 | error = -ENOMEM; |
1112 | break; | 1113 | break; |
1113 | } | 1114 | } |
1114 | 1115 | ||
1115 | info = priv->ch[i].info; | 1116 | info = ch->info; |
1116 | var = &info->var; | 1117 | var = &info->var; |
1117 | lcd_cfg = &cfg->lcd_cfg; | 1118 | lcd_cfg = &cfg->lcd_cfg; |
1118 | info->fbops = &sh_mobile_lcdc_ops; | 1119 | info->fbops = &sh_mobile_lcdc_ops; |
@@ -1130,28 +1131,28 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev) | |||
1130 | var->yres_virtual; | 1131 | var->yres_virtual; |
1131 | 1132 | ||
1132 | buf = dma_alloc_coherent(&pdev->dev, info->fix.smem_len, | 1133 | buf = dma_alloc_coherent(&pdev->dev, info->fix.smem_len, |
1133 | &priv->ch[i].dma_handle, GFP_KERNEL); | 1134 | &ch->dma_handle, GFP_KERNEL); |
1134 | if (!buf) { | 1135 | if (!buf) { |
1135 | dev_err(&pdev->dev, "unable to allocate buffer\n"); | 1136 | dev_err(&pdev->dev, "unable to allocate buffer\n"); |
1136 | error = -ENOMEM; | 1137 | error = -ENOMEM; |
1137 | break; | 1138 | break; |
1138 | } | 1139 | } |
1139 | 1140 | ||
1140 | info->pseudo_palette = &priv->ch[i].pseudo_palette; | 1141 | info->pseudo_palette = &ch->pseudo_palette; |
1141 | info->flags = FBINFO_FLAG_DEFAULT; | 1142 | info->flags = FBINFO_FLAG_DEFAULT; |
1142 | 1143 | ||
1143 | error = fb_alloc_cmap(&info->cmap, PALETTE_NR, 0); | 1144 | error = fb_alloc_cmap(&info->cmap, PALETTE_NR, 0); |
1144 | if (error < 0) { | 1145 | if (error < 0) { |
1145 | dev_err(&pdev->dev, "unable to allocate cmap\n"); | 1146 | dev_err(&pdev->dev, "unable to allocate cmap\n"); |
1146 | dma_free_coherent(&pdev->dev, info->fix.smem_len, | 1147 | dma_free_coherent(&pdev->dev, info->fix.smem_len, |
1147 | buf, priv->ch[i].dma_handle); | 1148 | buf, ch->dma_handle); |
1148 | break; | 1149 | break; |
1149 | } | 1150 | } |
1150 | 1151 | ||
1151 | info->fix.smem_start = priv->ch[i].dma_handle; | 1152 | info->fix.smem_start = ch->dma_handle; |
1152 | info->screen_base = buf; | 1153 | info->screen_base = buf; |
1153 | info->device = &pdev->dev; | 1154 | info->device = &pdev->dev; |
1154 | info->par = &priv->ch[i]; | 1155 | info->par = ch; |
1155 | } | 1156 | } |
1156 | 1157 | ||
1157 | if (error) | 1158 | if (error) |