Commit 26e71645 authored by Darren Etheridge's avatar Darren Etheridge Committed by Tomi Valkeinen

video: da8xx-fb: improve readability of code

Change the lcd_disable_raster funtion from using a bool to an enum
as the function is very confusing with the current api.  This helps
make it clearer what the parameter is really doing.
Signed-off-by: default avatarDarren Etheridge <detheridge@ti.com>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent fe8c98f0
...@@ -271,7 +271,8 @@ static inline void lcd_enable_raster(void) ...@@ -271,7 +271,8 @@ static inline void lcd_enable_raster(void)
} }
/* Disable the Raster Engine of the LCD Controller */ /* Disable the Raster Engine of the LCD Controller */
static inline void lcd_disable_raster(bool wait_for_frame_done) static inline void lcd_disable_raster(enum da8xx_frame_complete
wait_for_frame_done)
{ {
u32 reg; u32 reg;
int ret; int ret;
...@@ -283,7 +284,8 @@ static inline void lcd_disable_raster(bool wait_for_frame_done) ...@@ -283,7 +284,8 @@ static inline void lcd_disable_raster(bool wait_for_frame_done)
/* return if already disabled */ /* return if already disabled */
return; return;
if ((wait_for_frame_done == true) && (lcd_revision == LCD_VERSION_2)) { if ((wait_for_frame_done == DA8XX_FRAME_WAIT) &&
(lcd_revision == LCD_VERSION_2)) {
frame_done_flag = 0; frame_done_flag = 0;
ret = wait_event_interruptible_timeout(frame_done_wq, ret = wait_event_interruptible_timeout(frame_done_wq,
frame_done_flag != 0, frame_done_flag != 0,
...@@ -771,7 +773,7 @@ static irqreturn_t lcdc_irq_handler_rev02(int irq, void *arg) ...@@ -771,7 +773,7 @@ static irqreturn_t lcdc_irq_handler_rev02(int irq, void *arg)
u32 stat = lcdc_read(LCD_MASKED_STAT_REG); u32 stat = lcdc_read(LCD_MASKED_STAT_REG);
if ((stat & LCD_SYNC_LOST) && (stat & LCD_FIFO_UNDERFLOW)) { if ((stat & LCD_SYNC_LOST) && (stat & LCD_FIFO_UNDERFLOW)) {
lcd_disable_raster(false); lcd_disable_raster(DA8XX_FRAME_NOWAIT);
lcdc_write(stat, LCD_MASKED_STAT_REG); lcdc_write(stat, LCD_MASKED_STAT_REG);
lcd_enable_raster(); lcd_enable_raster();
} else if (stat & LCD_PL_LOAD_DONE) { } else if (stat & LCD_PL_LOAD_DONE) {
...@@ -781,7 +783,7 @@ static irqreturn_t lcdc_irq_handler_rev02(int irq, void *arg) ...@@ -781,7 +783,7 @@ static irqreturn_t lcdc_irq_handler_rev02(int irq, void *arg)
* interrupt via the following write to the status register. If * interrupt via the following write to the status register. If
* this is done after then one gets multiple PL done interrupts. * this is done after then one gets multiple PL done interrupts.
*/ */
lcd_disable_raster(false); lcd_disable_raster(DA8XX_FRAME_NOWAIT);
lcdc_write(stat, LCD_MASKED_STAT_REG); lcdc_write(stat, LCD_MASKED_STAT_REG);
...@@ -834,7 +836,7 @@ static irqreturn_t lcdc_irq_handler_rev01(int irq, void *arg) ...@@ -834,7 +836,7 @@ static irqreturn_t lcdc_irq_handler_rev01(int irq, void *arg)
u32 reg_ras; u32 reg_ras;
if ((stat & LCD_SYNC_LOST) && (stat & LCD_FIFO_UNDERFLOW)) { if ((stat & LCD_SYNC_LOST) && (stat & LCD_FIFO_UNDERFLOW)) {
lcd_disable_raster(false); lcd_disable_raster(DA8XX_FRAME_NOWAIT);
lcdc_write(stat, LCD_STAT_REG); lcdc_write(stat, LCD_STAT_REG);
lcd_enable_raster(); lcd_enable_raster();
} else if (stat & LCD_PL_LOAD_DONE) { } else if (stat & LCD_PL_LOAD_DONE) {
...@@ -844,7 +846,7 @@ static irqreturn_t lcdc_irq_handler_rev01(int irq, void *arg) ...@@ -844,7 +846,7 @@ static irqreturn_t lcdc_irq_handler_rev01(int irq, void *arg)
* interrupt via the following write to the status register. If * interrupt via the following write to the status register. If
* this is done after then one gets multiple PL done interrupts. * this is done after then one gets multiple PL done interrupts.
*/ */
lcd_disable_raster(false); lcd_disable_raster(DA8XX_FRAME_NOWAIT);
lcdc_write(stat, LCD_STAT_REG); lcdc_write(stat, LCD_STAT_REG);
...@@ -986,7 +988,7 @@ static int lcd_da8xx_cpufreq_transition(struct notifier_block *nb, ...@@ -986,7 +988,7 @@ static int lcd_da8xx_cpufreq_transition(struct notifier_block *nb,
if (val == CPUFREQ_POSTCHANGE) { if (val == CPUFREQ_POSTCHANGE) {
if (par->lcd_fck_rate != clk_get_rate(par->lcdc_clk)) { if (par->lcd_fck_rate != clk_get_rate(par->lcdc_clk)) {
par->lcd_fck_rate = clk_get_rate(par->lcdc_clk); par->lcd_fck_rate = clk_get_rate(par->lcdc_clk);
lcd_disable_raster(true); lcd_disable_raster(DA8XX_FRAME_WAIT);
da8xx_fb_calc_config_clk_divider(par, &par->mode); da8xx_fb_calc_config_clk_divider(par, &par->mode);
if (par->blank == FB_BLANK_UNBLANK) if (par->blank == FB_BLANK_UNBLANK)
lcd_enable_raster(); lcd_enable_raster();
...@@ -1024,7 +1026,7 @@ static int fb_remove(struct platform_device *dev) ...@@ -1024,7 +1026,7 @@ static int fb_remove(struct platform_device *dev)
if (par->panel_power_ctrl) if (par->panel_power_ctrl)
par->panel_power_ctrl(0); par->panel_power_ctrl(0);
lcd_disable_raster(true); lcd_disable_raster(DA8XX_FRAME_WAIT);
lcdc_write(0, LCD_RASTER_CTRL_REG); lcdc_write(0, LCD_RASTER_CTRL_REG);
/* disable DMA */ /* disable DMA */
...@@ -1140,7 +1142,7 @@ static int cfb_blank(int blank, struct fb_info *info) ...@@ -1140,7 +1142,7 @@ static int cfb_blank(int blank, struct fb_info *info)
if (par->panel_power_ctrl) if (par->panel_power_ctrl)
par->panel_power_ctrl(0); par->panel_power_ctrl(0);
lcd_disable_raster(true); lcd_disable_raster(DA8XX_FRAME_WAIT);
break; break;
default: default:
ret = -EINVAL; ret = -EINVAL;
...@@ -1208,7 +1210,7 @@ static int da8xxfb_set_par(struct fb_info *info) ...@@ -1208,7 +1210,7 @@ static int da8xxfb_set_par(struct fb_info *info)
bool raster = da8xx_fb_is_raster_enabled(); bool raster = da8xx_fb_is_raster_enabled();
if (raster) if (raster)
lcd_disable_raster(true); lcd_disable_raster(DA8XX_FRAME_WAIT);
fb_var_to_videomode(&par->mode, &info->var); fb_var_to_videomode(&par->mode, &info->var);
...@@ -1569,7 +1571,7 @@ static int fb_suspend(struct platform_device *dev, pm_message_t state) ...@@ -1569,7 +1571,7 @@ static int fb_suspend(struct platform_device *dev, pm_message_t state)
par->panel_power_ctrl(0); par->panel_power_ctrl(0);
fb_set_suspend(info, 1); fb_set_suspend(info, 1);
lcd_disable_raster(true); lcd_disable_raster(DA8XX_FRAME_WAIT);
lcd_context_save(); lcd_context_save();
pm_runtime_put_sync(&dev->dev); pm_runtime_put_sync(&dev->dev);
console_unlock(); console_unlock();
......
...@@ -23,6 +23,11 @@ enum raster_load_mode { ...@@ -23,6 +23,11 @@ enum raster_load_mode {
LOAD_PALETTE, LOAD_PALETTE,
}; };
enum da8xx_frame_complete {
DA8XX_FRAME_WAIT,
DA8XX_FRAME_NOWAIT,
};
struct da8xx_lcdc_platform_data { struct da8xx_lcdc_platform_data {
const char manu_name[10]; const char manu_name[10];
void *controller_data; void *controller_data;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment