aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/da8xx-fb.c
diff options
context:
space:
mode:
authorChaithrika U S <chaithrika@ti.com>2009-12-15 19:46:29 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-16 10:20:02 -0500
commite04e54835fdaaeebbd95f9508bc814859fcd7afd (patch)
tree6efecc1a6ecd563ebf47f7070579b71641d949c6 /drivers/video/da8xx-fb.c
parent8097b1749f9265be0f3dbc43c3700da31eb422fd (diff)
davinci: fb: add cpufreq support
Add cpufreq support for DA8xx/OMAP-L1xx frame buffer driver Signed-off-by: Chaithrika U S <chaithrika@ti.com> Cc: Krzysztof Helt <krzysztof.h1@poczta.fm> Cc: Kevin Hilman <khilman@deeprootsystems.com> Cc: Dave Jones <davej@codemonkey.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/da8xx-fb.c')
-rw-r--r--drivers/video/da8xx-fb.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index fe0025213a82..8966274bbbbc 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -28,6 +28,7 @@
28#include <linux/uaccess.h> 28#include <linux/uaccess.h>
29#include <linux/interrupt.h> 29#include <linux/interrupt.h>
30#include <linux/clk.h> 30#include <linux/clk.h>
31#include <linux/cpufreq.h>
31#include <video/da8xx-fb.h> 32#include <video/da8xx-fb.h>
32 33
33#define DRIVER_NAME "da8xx_lcdc" 34#define DRIVER_NAME "da8xx_lcdc"
@@ -114,6 +115,9 @@ struct da8xx_fb_par {
114 unsigned int databuf_sz; 115 unsigned int databuf_sz;
115 unsigned int palette_sz; 116 unsigned int palette_sz;
116 unsigned int pxl_clk; 117 unsigned int pxl_clk;
118#ifdef CONFIG_CPU_FREQ
119 struct notifier_block freq_transition;
120#endif
117}; 121};
118 122
119/* Variable Screen Information */ 123/* Variable Screen Information */
@@ -586,6 +590,41 @@ static int fb_check_var(struct fb_var_screeninfo *var,
586 return err; 590 return err;
587} 591}
588 592
593#ifdef CONFIG_CPU_FREQ
594static int lcd_da8xx_cpufreq_transition(struct notifier_block *nb,
595 unsigned long val, void *data)
596{
597 struct da8xx_fb_par *par;
598 unsigned int reg;
599
600 par = container_of(nb, struct da8xx_fb_par, freq_transition);
601 if (val == CPUFREQ_PRECHANGE) {
602 reg = lcdc_read(LCD_RASTER_CTRL_REG);
603 lcdc_write(reg & ~LCD_RASTER_ENABLE, LCD_RASTER_CTRL_REG);
604 } else if (val == CPUFREQ_POSTCHANGE) {
605 lcd_calc_clk_divider(par);
606 reg = lcdc_read(LCD_RASTER_CTRL_REG);
607 lcdc_write(reg | LCD_RASTER_ENABLE, LCD_RASTER_CTRL_REG);
608 }
609
610 return 0;
611}
612
613static inline int lcd_da8xx_cpufreq_register(struct da8xx_fb_par *par)
614{
615 par->freq_transition.notifier_call = lcd_da8xx_cpufreq_transition;
616
617 return cpufreq_register_notifier(&par->freq_transition,
618 CPUFREQ_TRANSITION_NOTIFIER);
619}
620
621static inline void lcd_da8xx_cpufreq_deregister(struct da8xx_fb_par *par)
622{
623 cpufreq_unregister_notifier(&par->freq_transition,
624 CPUFREQ_TRANSITION_NOTIFIER);
625}
626#endif
627
589static int __devexit fb_remove(struct platform_device *dev) 628static int __devexit fb_remove(struct platform_device *dev)
590{ 629{
591 struct fb_info *info = dev_get_drvdata(&dev->dev); 630 struct fb_info *info = dev_get_drvdata(&dev->dev);
@@ -593,6 +632,9 @@ static int __devexit fb_remove(struct platform_device *dev)
593 if (info) { 632 if (info) {
594 struct da8xx_fb_par *par = info->par; 633 struct da8xx_fb_par *par = info->par;
595 634
635#ifdef CONFIG_CPU_FREQ
636 lcd_da8xx_cpufreq_deregister(par);
637#endif
596 if (lcdc_read(LCD_RASTER_CTRL_REG) & LCD_RASTER_ENABLE) 638 if (lcdc_read(LCD_RASTER_CTRL_REG) & LCD_RASTER_ENABLE)
597 lcd_disable_raster(par); 639 lcd_disable_raster(par);
598 lcdc_write(0, LCD_RASTER_CTRL_REG); 640 lcdc_write(0, LCD_RASTER_CTRL_REG);
@@ -826,12 +868,25 @@ static int __init fb_probe(struct platform_device *device)
826 goto err_dealloc_cmap; 868 goto err_dealloc_cmap;
827 } 869 }
828 870
871#ifdef CONFIG_CPU_FREQ
872 ret = lcd_da8xx_cpufreq_register(par);
873 if (ret) {
874 dev_err(&device->dev, "failed to register cpufreq\n");
875 goto err_cpu_freq;
876 }
877#endif
878
829 /* enable raster engine */ 879 /* enable raster engine */
830 lcdc_write(lcdc_read(LCD_RASTER_CTRL_REG) | 880 lcdc_write(lcdc_read(LCD_RASTER_CTRL_REG) |
831 LCD_RASTER_ENABLE, LCD_RASTER_CTRL_REG); 881 LCD_RASTER_ENABLE, LCD_RASTER_CTRL_REG);
832 882
833 return 0; 883 return 0;
834 884
885#ifdef CONFIG_CPU_FREQ
886err_cpu_freq:
887 unregister_framebuffer(da8xx_fb_info);
888#endif
889
835err_dealloc_cmap: 890err_dealloc_cmap:
836 fb_dealloc_cmap(&da8xx_fb_info->cmap); 891 fb_dealloc_cmap(&da8xx_fb_info->cmap);
837 892