aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Shiyan <shc_work@mail.ru>2014-02-15 00:56:23 -0500
committerTomi Valkeinen <tomi.valkeinen@ti.com>2014-02-28 05:35:22 -0500
commitb7d2d37276c1dce86d9a55239f0686e1bd81a37f (patch)
tree2c097b5b22a20a6d71feff442425158929bdf564
parent2516ae8a69c3e21771cd0095a0dd10160fa055a4 (diff)
video: imxfb: Remove unused fields from platform data structure
Some fields in platform data structure is never used by boards. This patch removes these fields and as a result optimizes private driver structure a bit. Additionally patch removes backligh_power() callback, so if it will be needed in the future, this feature should be added as pwm{gpio,etc.}-regulator to the board code or in the DTS. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Acked-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rw-r--r--drivers/video/imxfb.c64
-rw-r--r--include/linux/platform_data/video-imxfb.h10
2 files changed, 17 insertions, 57 deletions
diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c
index e50b67fada51..5b07053bbd01 100644
--- a/drivers/video/imxfb.c
+++ b/drivers/video/imxfb.c
@@ -156,11 +156,8 @@ struct imxfb_info {
156 * the framebuffer memory region to. 156 * the framebuffer memory region to.
157 */ 157 */
158 dma_addr_t map_dma; 158 dma_addr_t map_dma;
159 u_char *map_cpu;
160 u_int map_size; 159 u_int map_size;
161 160
162 u_char *screen_cpu;
163 dma_addr_t screen_dma;
164 u_int palette_size; 161 u_int palette_size;
165 162
166 dma_addr_t dbar1; 163 dma_addr_t dbar1;
@@ -170,9 +167,8 @@ struct imxfb_info {
170 u_int pwmr; 167 u_int pwmr;
171 u_int lscr1; 168 u_int lscr1;
172 u_int dmacr; 169 u_int dmacr;
173 u_int cmap_inverse:1, 170 bool cmap_inverse;
174 cmap_static:1, 171 bool cmap_static;
175 unused:30;
176 172
177 struct imx_fb_videomode *mode; 173 struct imx_fb_videomode *mode;
178 int num_modes; 174 int num_modes;
@@ -180,8 +176,6 @@ struct imxfb_info {
180 struct backlight_device *bl; 176 struct backlight_device *bl;
181#endif 177#endif
182 178
183 void (*backlight_power)(int);
184
185 struct regulator *lcd_pwr; 179 struct regulator *lcd_pwr;
186}; 180};
187 181
@@ -573,7 +567,7 @@ static void imxfb_enable_controller(struct imxfb_info *fbi)
573 567
574 pr_debug("Enabling LCD controller\n"); 568 pr_debug("Enabling LCD controller\n");
575 569
576 writel(fbi->screen_dma, fbi->regs + LCDC_SSA); 570 writel(fbi->map_dma, fbi->regs + LCDC_SSA);
577 571
578 /* panning offset 0 (0 pixel offset) */ 572 /* panning offset 0 (0 pixel offset) */
579 writel(0x00000000, fbi->regs + LCDC_POS); 573 writel(0x00000000, fbi->regs + LCDC_POS);
@@ -592,9 +586,6 @@ static void imxfb_enable_controller(struct imxfb_info *fbi)
592 clk_prepare_enable(fbi->clk_ahb); 586 clk_prepare_enable(fbi->clk_ahb);
593 clk_prepare_enable(fbi->clk_per); 587 clk_prepare_enable(fbi->clk_per);
594 fbi->enabled = true; 588 fbi->enabled = true;
595
596 if (fbi->backlight_power)
597 fbi->backlight_power(1);
598} 589}
599 590
600static void imxfb_disable_controller(struct imxfb_info *fbi) 591static void imxfb_disable_controller(struct imxfb_info *fbi)
@@ -604,9 +595,6 @@ static void imxfb_disable_controller(struct imxfb_info *fbi)
604 595
605 pr_debug("Disabling LCD controller\n"); 596 pr_debug("Disabling LCD controller\n");
606 597
607 if (fbi->backlight_power)
608 fbi->backlight_power(0);
609
610 clk_disable_unprepare(fbi->clk_per); 598 clk_disable_unprepare(fbi->clk_per);
611 clk_disable_unprepare(fbi->clk_ipg); 599 clk_disable_unprepare(fbi->clk_ipg);
612 clk_disable_unprepare(fbi->clk_ahb); 600 clk_disable_unprepare(fbi->clk_ahb);
@@ -790,13 +778,9 @@ static int imxfb_init_fbinfo(struct platform_device *pdev)
790 info->flags = FBINFO_FLAG_DEFAULT | 778 info->flags = FBINFO_FLAG_DEFAULT |
791 FBINFO_READS_FAST; 779 FBINFO_READS_FAST;
792 if (pdata) { 780 if (pdata) {
793 info->var.grayscale = pdata->cmap_greyscale;
794 fbi->cmap_inverse = pdata->cmap_inverse;
795 fbi->cmap_static = pdata->cmap_static;
796 fbi->lscr1 = pdata->lscr1; 781 fbi->lscr1 = pdata->lscr1;
797 fbi->dmacr = pdata->dmacr; 782 fbi->dmacr = pdata->dmacr;
798 fbi->pwmr = pdata->pwmr; 783 fbi->pwmr = pdata->pwmr;
799 fbi->backlight_power = pdata->backlight_power;
800 } else { 784 } else {
801 np = pdev->dev.of_node; 785 np = pdev->dev.of_node;
802 info->var.grayscale = of_property_read_bool(np, 786 info->var.grayscale = of_property_read_bool(np,
@@ -808,8 +792,6 @@ static int imxfb_init_fbinfo(struct platform_device *pdev)
808 of_property_read_u32(np, "fsl,lscr1", &fbi->lscr1); 792 of_property_read_u32(np, "fsl,lscr1", &fbi->lscr1);
809 793
810 of_property_read_u32(np, "fsl,dmacr", &fbi->dmacr); 794 of_property_read_u32(np, "fsl,dmacr", &fbi->dmacr);
811
812 fbi->backlight_power = NULL;
813 } 795 }
814 796
815 return 0; 797 return 0;
@@ -1003,32 +985,18 @@ static int imxfb_probe(struct platform_device *pdev)
1003 goto failed_ioremap; 985 goto failed_ioremap;
1004 } 986 }
1005 987
1006 /* Seems not being used by anyone, so no support for oftree */ 988 fbi->map_size = PAGE_ALIGN(info->fix.smem_len);
1007 if (!pdata || !pdata->fixed_screen_cpu) { 989 info->screen_base = dma_alloc_writecombine(&pdev->dev, fbi->map_size,
1008 fbi->map_size = PAGE_ALIGN(info->fix.smem_len); 990 &fbi->map_dma, GFP_KERNEL);
1009 fbi->map_cpu = dma_alloc_writecombine(&pdev->dev,
1010 fbi->map_size, &fbi->map_dma, GFP_KERNEL);
1011 991
1012 if (!fbi->map_cpu) { 992 if (!info->screen_base) {
1013 dev_err(&pdev->dev, "Failed to allocate video RAM: %d\n", ret); 993 dev_err(&pdev->dev, "Failed to allocate video RAM: %d\n", ret);
1014 ret = -ENOMEM; 994 ret = -ENOMEM;
1015 goto failed_map; 995 goto failed_map;
1016 }
1017
1018 info->screen_base = fbi->map_cpu;
1019 fbi->screen_cpu = fbi->map_cpu;
1020 fbi->screen_dma = fbi->map_dma;
1021 info->fix.smem_start = fbi->screen_dma;
1022 } else {
1023 /* Fixed framebuffer mapping enables location of the screen in eSRAM */
1024 fbi->map_cpu = pdata->fixed_screen_cpu;
1025 fbi->map_dma = pdata->fixed_screen_dma;
1026 info->screen_base = fbi->map_cpu;
1027 fbi->screen_cpu = fbi->map_cpu;
1028 fbi->screen_dma = fbi->map_dma;
1029 info->fix.smem_start = fbi->screen_dma;
1030 } 996 }
1031 997
998 info->fix.smem_start = fbi->map_dma;
999
1032 if (pdata && pdata->init) { 1000 if (pdata && pdata->init) {
1033 ret = pdata->init(fbi->pdev); 1001 ret = pdata->init(fbi->pdev);
1034 if (ret) 1002 if (ret)
@@ -1087,9 +1055,8 @@ failed_cmap:
1087 if (pdata && pdata->exit) 1055 if (pdata && pdata->exit)
1088 pdata->exit(fbi->pdev); 1056 pdata->exit(fbi->pdev);
1089failed_platform_init: 1057failed_platform_init:
1090 if (pdata && !pdata->fixed_screen_cpu) 1058 dma_free_writecombine(&pdev->dev, fbi->map_size, info->screen_base,
1091 dma_free_writecombine(&pdev->dev,fbi->map_size,fbi->map_cpu, 1059 fbi->map_dma);
1092 fbi->map_dma);
1093failed_map: 1060failed_map:
1094 iounmap(fbi->regs); 1061 iounmap(fbi->regs);
1095failed_ioremap: 1062failed_ioremap:
@@ -1127,6 +1094,9 @@ static int imxfb_remove(struct platform_device *pdev)
1127 kfree(info->pseudo_palette); 1094 kfree(info->pseudo_palette);
1128 framebuffer_release(info); 1095 framebuffer_release(info);
1129 1096
1097 dma_free_writecombine(&pdev->dev, fbi->map_size, info->screen_base,
1098 fbi->map_dma);
1099
1130 iounmap(fbi->regs); 1100 iounmap(fbi->regs);
1131 release_mem_region(res->start, resource_size(res)); 1101 release_mem_region(res->start, resource_size(res));
1132 1102
diff --git a/include/linux/platform_data/video-imxfb.h b/include/linux/platform_data/video-imxfb.h
index dd1bed97683c..18e908324549 100644
--- a/include/linux/platform_data/video-imxfb.h
+++ b/include/linux/platform_data/video-imxfb.h
@@ -61,22 +61,12 @@ struct imx_fb_platform_data {
61 struct imx_fb_videomode *mode; 61 struct imx_fb_videomode *mode;
62 int num_modes; 62 int num_modes;
63 63
64 u_int cmap_greyscale:1,
65 cmap_inverse:1,
66 cmap_static:1,
67 unused:29;
68
69 u_int pwmr; 64 u_int pwmr;
70 u_int lscr1; 65 u_int lscr1;
71 u_int dmacr; 66 u_int dmacr;
72 67
73 u_char * fixed_screen_cpu;
74 dma_addr_t fixed_screen_dma;
75
76 int (*init)(struct platform_device *); 68 int (*init)(struct platform_device *);
77 void (*exit)(struct platform_device *); 69 void (*exit)(struct platform_device *);
78
79 void (*backlight_power)(int);
80}; 70};
81 71
82#endif /* ifndef __MACH_IMXFB_H__ */ 72#endif /* ifndef __MACH_IMXFB_H__ */