Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 176638
b: refs/heads/master
c: e04e548
h: refs/heads/master
v: v3
  • Loading branch information
Chaithrika U S authored and Linus Torvalds committed Dec 16, 2009
1 parent 3ca8140 commit 4a6f4c0
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8097b1749f9265be0f3dbc43c3700da31eb422fd
refs/heads/master: e04e54835fdaaeebbd95f9508bc814859fcd7afd
55 changes: 55 additions & 0 deletions trunk/drivers/video/da8xx-fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <linux/uaccess.h>
#include <linux/interrupt.h>
#include <linux/clk.h>
#include <linux/cpufreq.h>
#include <video/da8xx-fb.h>

#define DRIVER_NAME "da8xx_lcdc"
Expand Down Expand Up @@ -114,6 +115,9 @@ struct da8xx_fb_par {
unsigned int databuf_sz;
unsigned int palette_sz;
unsigned int pxl_clk;
#ifdef CONFIG_CPU_FREQ
struct notifier_block freq_transition;
#endif
};

/* Variable Screen Information */
Expand Down Expand Up @@ -586,13 +590,51 @@ static int fb_check_var(struct fb_var_screeninfo *var,
return err;
}

#ifdef CONFIG_CPU_FREQ
static int lcd_da8xx_cpufreq_transition(struct notifier_block *nb,
unsigned long val, void *data)
{
struct da8xx_fb_par *par;
unsigned int reg;

par = container_of(nb, struct da8xx_fb_par, freq_transition);
if (val == CPUFREQ_PRECHANGE) {
reg = lcdc_read(LCD_RASTER_CTRL_REG);
lcdc_write(reg & ~LCD_RASTER_ENABLE, LCD_RASTER_CTRL_REG);
} else if (val == CPUFREQ_POSTCHANGE) {
lcd_calc_clk_divider(par);
reg = lcdc_read(LCD_RASTER_CTRL_REG);
lcdc_write(reg | LCD_RASTER_ENABLE, LCD_RASTER_CTRL_REG);
}

return 0;
}

static inline int lcd_da8xx_cpufreq_register(struct da8xx_fb_par *par)
{
par->freq_transition.notifier_call = lcd_da8xx_cpufreq_transition;

return cpufreq_register_notifier(&par->freq_transition,
CPUFREQ_TRANSITION_NOTIFIER);
}

static inline void lcd_da8xx_cpufreq_deregister(struct da8xx_fb_par *par)
{
cpufreq_unregister_notifier(&par->freq_transition,
CPUFREQ_TRANSITION_NOTIFIER);
}
#endif

static int __devexit fb_remove(struct platform_device *dev)
{
struct fb_info *info = dev_get_drvdata(&dev->dev);

if (info) {
struct da8xx_fb_par *par = info->par;

#ifdef CONFIG_CPU_FREQ
lcd_da8xx_cpufreq_deregister(par);
#endif
if (lcdc_read(LCD_RASTER_CTRL_REG) & LCD_RASTER_ENABLE)
lcd_disable_raster(par);
lcdc_write(0, LCD_RASTER_CTRL_REG);
Expand Down Expand Up @@ -826,12 +868,25 @@ static int __init fb_probe(struct platform_device *device)
goto err_dealloc_cmap;
}

#ifdef CONFIG_CPU_FREQ
ret = lcd_da8xx_cpufreq_register(par);
if (ret) {
dev_err(&device->dev, "failed to register cpufreq\n");
goto err_cpu_freq;
}
#endif

/* enable raster engine */
lcdc_write(lcdc_read(LCD_RASTER_CTRL_REG) |
LCD_RASTER_ENABLE, LCD_RASTER_CTRL_REG);

return 0;

#ifdef CONFIG_CPU_FREQ
err_cpu_freq:
unregister_framebuffer(da8xx_fb_info);
#endif

err_dealloc_cmap:
fb_dealloc_cmap(&da8xx_fb_info->cmap);

Expand Down

0 comments on commit 4a6f4c0

Please sign in to comment.