diff options
author | Chaithrika U S <chaithrika@ti.com> | 2009-12-15 19:46:38 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-16 10:20:04 -0500 |
commit | 3611380490c6ce27a2277709a34b8c5531524caf (patch) | |
tree | 0afbddaa57a0aac765d1ddf7a93e30706300ac1f /drivers/video | |
parent | fa1f136e073ddc4e60497c51bc8918569314d38a (diff) |
davinci: fb: update the driver in preparation for addition of power management features
Add a helper function to enable raster. Also add one member in the
private data structure to track the current blank status, another function
pointer which takes in the platform specific callback function to control
panel power.
These updates will help in adding suspend/resume and frame buffer blank
operation features.
Signed-off-by: Chaithrika U S <chaithrika@ti.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/da8xx-fb.c | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c index 8966274bbbbc..eb95b893e8b2 100644 --- a/drivers/video/da8xx-fb.c +++ b/drivers/video/da8xx-fb.c | |||
@@ -115,9 +115,11 @@ struct da8xx_fb_par { | |||
115 | unsigned int databuf_sz; | 115 | unsigned int databuf_sz; |
116 | unsigned int palette_sz; | 116 | unsigned int palette_sz; |
117 | unsigned int pxl_clk; | 117 | unsigned int pxl_clk; |
118 | int blank; | ||
118 | #ifdef CONFIG_CPU_FREQ | 119 | #ifdef CONFIG_CPU_FREQ |
119 | struct notifier_block freq_transition; | 120 | struct notifier_block freq_transition; |
120 | #endif | 121 | #endif |
122 | void (*panel_power_ctrl)(int); | ||
121 | }; | 123 | }; |
122 | 124 | ||
123 | /* Variable Screen Information */ | 125 | /* Variable Screen Information */ |
@@ -195,8 +197,18 @@ static struct da8xx_panel known_lcd_panels[] = { | |||
195 | }, | 197 | }, |
196 | }; | 198 | }; |
197 | 199 | ||
200 | /* Enable the Raster Engine of the LCD Controller */ | ||
201 | static inline void lcd_enable_raster(void) | ||
202 | { | ||
203 | u32 reg; | ||
204 | |||
205 | reg = lcdc_read(LCD_RASTER_CTRL_REG); | ||
206 | if (!(reg & LCD_RASTER_ENABLE)) | ||
207 | lcdc_write(reg | LCD_RASTER_ENABLE, LCD_RASTER_CTRL_REG); | ||
208 | } | ||
209 | |||
198 | /* Disable the Raster Engine of the LCD Controller */ | 210 | /* Disable the Raster Engine of the LCD Controller */ |
199 | static void lcd_disable_raster(struct da8xx_fb_par *par) | 211 | static inline void lcd_disable_raster(void) |
200 | { | 212 | { |
201 | u32 reg; | 213 | u32 reg; |
202 | 214 | ||
@@ -448,8 +460,7 @@ static int fb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
448 | static void lcd_reset(struct da8xx_fb_par *par) | 460 | static void lcd_reset(struct da8xx_fb_par *par) |
449 | { | 461 | { |
450 | /* Disable the Raster if previously Enabled */ | 462 | /* Disable the Raster if previously Enabled */ |
451 | if (lcdc_read(LCD_RASTER_CTRL_REG) & LCD_RASTER_ENABLE) | 463 | lcd_disable_raster(); |
452 | lcd_disable_raster(par); | ||
453 | 464 | ||
454 | /* DMA has to be disabled */ | 465 | /* DMA has to be disabled */ |
455 | lcdc_write(0, LCD_DMA_CTRL_REG); | 466 | lcdc_write(0, LCD_DMA_CTRL_REG); |
@@ -529,13 +540,11 @@ static int lcd_init(struct da8xx_fb_par *par, const struct lcd_ctrl_config *cfg, | |||
529 | static irqreturn_t lcdc_irq_handler(int irq, void *arg) | 540 | static irqreturn_t lcdc_irq_handler(int irq, void *arg) |
530 | { | 541 | { |
531 | u32 stat = lcdc_read(LCD_STAT_REG); | 542 | u32 stat = lcdc_read(LCD_STAT_REG); |
532 | u32 reg; | ||
533 | 543 | ||
534 | if ((stat & LCD_SYNC_LOST) && (stat & LCD_FIFO_UNDERFLOW)) { | 544 | if ((stat & LCD_SYNC_LOST) && (stat & LCD_FIFO_UNDERFLOW)) { |
535 | reg = lcdc_read(LCD_RASTER_CTRL_REG); | 545 | lcd_disable_raster(); |
536 | lcdc_write(reg & ~LCD_RASTER_ENABLE, LCD_RASTER_CTRL_REG); | ||
537 | lcdc_write(stat, LCD_STAT_REG); | 546 | lcdc_write(stat, LCD_STAT_REG); |
538 | lcdc_write(reg | LCD_RASTER_ENABLE, LCD_RASTER_CTRL_REG); | 547 | lcd_enable_raster(); |
539 | } else | 548 | } else |
540 | lcdc_write(stat, LCD_STAT_REG); | 549 | lcdc_write(stat, LCD_STAT_REG); |
541 | 550 | ||
@@ -595,16 +604,13 @@ static int lcd_da8xx_cpufreq_transition(struct notifier_block *nb, | |||
595 | unsigned long val, void *data) | 604 | unsigned long val, void *data) |
596 | { | 605 | { |
597 | struct da8xx_fb_par *par; | 606 | struct da8xx_fb_par *par; |
598 | unsigned int reg; | ||
599 | 607 | ||
600 | par = container_of(nb, struct da8xx_fb_par, freq_transition); | 608 | par = container_of(nb, struct da8xx_fb_par, freq_transition); |
601 | if (val == CPUFREQ_PRECHANGE) { | 609 | if (val == CPUFREQ_PRECHANGE) { |
602 | reg = lcdc_read(LCD_RASTER_CTRL_REG); | 610 | lcd_disable_raster(); |
603 | lcdc_write(reg & ~LCD_RASTER_ENABLE, LCD_RASTER_CTRL_REG); | ||
604 | } else if (val == CPUFREQ_POSTCHANGE) { | 611 | } else if (val == CPUFREQ_POSTCHANGE) { |
605 | lcd_calc_clk_divider(par); | 612 | lcd_calc_clk_divider(par); |
606 | reg = lcdc_read(LCD_RASTER_CTRL_REG); | 613 | lcd_enable_raster(); |
607 | lcdc_write(reg | LCD_RASTER_ENABLE, LCD_RASTER_CTRL_REG); | ||
608 | } | 614 | } |
609 | 615 | ||
610 | return 0; | 616 | return 0; |
@@ -635,8 +641,10 @@ static int __devexit fb_remove(struct platform_device *dev) | |||
635 | #ifdef CONFIG_CPU_FREQ | 641 | #ifdef CONFIG_CPU_FREQ |
636 | lcd_da8xx_cpufreq_deregister(par); | 642 | lcd_da8xx_cpufreq_deregister(par); |
637 | #endif | 643 | #endif |
638 | if (lcdc_read(LCD_RASTER_CTRL_REG) & LCD_RASTER_ENABLE) | 644 | if (par->panel_power_ctrl) |
639 | lcd_disable_raster(par); | 645 | par->panel_power_ctrl(0); |
646 | |||
647 | lcd_disable_raster(); | ||
640 | lcdc_write(0, LCD_RASTER_CTRL_REG); | 648 | lcdc_write(0, LCD_RASTER_CTRL_REG); |
641 | 649 | ||
642 | /* disable DMA */ | 650 | /* disable DMA */ |
@@ -777,6 +785,10 @@ static int __init fb_probe(struct platform_device *device) | |||
777 | par = da8xx_fb_info->par; | 785 | par = da8xx_fb_info->par; |
778 | par->lcdc_clk = fb_clk; | 786 | par->lcdc_clk = fb_clk; |
779 | par->pxl_clk = lcdc_info->pxl_clk; | 787 | par->pxl_clk = lcdc_info->pxl_clk; |
788 | if (fb_pdata->panel_power_ctrl) { | ||
789 | par->panel_power_ctrl = fb_pdata->panel_power_ctrl; | ||
790 | par->panel_power_ctrl(1); | ||
791 | } | ||
780 | 792 | ||
781 | if (lcd_init(par, lcd_cfg, lcdc_info) < 0) { | 793 | if (lcd_init(par, lcd_cfg, lcdc_info) < 0) { |
782 | dev_err(&device->dev, "lcd_init failed\n"); | 794 | dev_err(&device->dev, "lcd_init failed\n"); |
@@ -877,8 +889,7 @@ static int __init fb_probe(struct platform_device *device) | |||
877 | #endif | 889 | #endif |
878 | 890 | ||
879 | /* enable raster engine */ | 891 | /* enable raster engine */ |
880 | lcdc_write(lcdc_read(LCD_RASTER_CTRL_REG) | | 892 | lcd_enable_raster(); |
881 | LCD_RASTER_ENABLE, LCD_RASTER_CTRL_REG); | ||
882 | 893 | ||
883 | return 0; | 894 | return 0; |
884 | 895 | ||