Commit 2f93e8f4 authored by Sudhakar Rajashekhara's avatar Sudhakar Rajashekhara Committed by Linus Torvalds

davinci-fb-frame-buffer-driver-for-ti-da8xx-omap-l1xx-v4

Since the previous version, return values in ioctl() function have been
modified.

[akpm@linux-foundation.org: simplify lcd_disable_raster()]
Signed-off-by: default avatarSudhakar Rajashekhara <sudhakar.raj@ti.com>
Signed-off-by: default avatarPavel Kiryukhin <pkiryukhin@ru.mvista.com>
Signed-off-by: default avatarSteve Chen <schen@mvista.com>
Acked-by: default avatarKrzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 4ed824d9
...@@ -107,7 +107,6 @@ static inline void lcdc_write(unsigned int val, unsigned int addr) ...@@ -107,7 +107,6 @@ static inline void lcdc_write(unsigned int val, unsigned int addr)
} }
struct da8xx_fb_par { struct da8xx_fb_par {
wait_queue_head_t da8xx_wq;
resource_size_t p_palette_base; resource_size_t p_palette_base;
unsigned char *v_palette_base; unsigned char *v_palette_base;
struct clk *lcdc_clk; struct clk *lcdc_clk;
...@@ -158,6 +157,7 @@ struct da8xx_panel { ...@@ -158,6 +157,7 @@ struct da8xx_panel {
int vbp; /* Vertical back porch */ int vbp; /* Vertical back porch */
int vsw; /* Vertical Sync Pulse Width */ int vsw; /* Vertical Sync Pulse Width */
int pxl_clk; /* Pixel clock */ int pxl_clk; /* Pixel clock */
unsigned char invert_pxl_clk; /* Invert Pixel clock */
}; };
static struct da8xx_panel known_lcd_panels[] = { static struct da8xx_panel known_lcd_panels[] = {
...@@ -173,6 +173,7 @@ static struct da8xx_panel known_lcd_panels[] = { ...@@ -173,6 +173,7 @@ static struct da8xx_panel known_lcd_panels[] = {
.vbp = 2, .vbp = 2,
.vsw = 0, .vsw = 0,
.pxl_clk = 0x10, .pxl_clk = 0x10,
.invert_pxl_clk = 1,
}, },
/* Sharp LK043T1DG01 */ /* Sharp LK043T1DG01 */
[1] = { [1] = {
...@@ -186,29 +187,18 @@ static struct da8xx_panel known_lcd_panels[] = { ...@@ -186,29 +187,18 @@ static struct da8xx_panel known_lcd_panels[] = {
.vbp = 2, .vbp = 2,
.vsw = 10, .vsw = 10,
.pxl_clk = 0x12, .pxl_clk = 0x12,
.invert_pxl_clk = 0,
}, },
}; };
/* Disable the Raster Engine of the LCD Controller */ /* Disable the Raster Engine of the LCD Controller */
static int lcd_disable_raster(struct da8xx_fb_par *par) static void lcd_disable_raster(struct da8xx_fb_par *par)
{ {
int ret = 0;
u32 reg; u32 reg;
reg = lcdc_read(LCD_RASTER_CTRL_REG); reg = lcdc_read(LCD_RASTER_CTRL_REG);
if (reg & LCD_RASTER_ENABLE) { if (reg & LCD_RASTER_ENABLE)
lcdc_write(reg & ~LCD_RASTER_ENABLE, LCD_RASTER_CTRL_REG); lcdc_write(reg & ~LCD_RASTER_ENABLE, LCD_RASTER_CTRL_REG);
ret = wait_event_interruptible_timeout(par->da8xx_wq,
!lcdc_read(LCD_STAT_REG) &
LCD_END_OF_FRAME0, WSI_TIMEOUT);
}
if (ret < 0)
return ret;
if (ret == 0)
return -ETIMEDOUT;
return 0;
} }
static void lcd_blit(int load_mode, struct da8xx_fb_par *par) static void lcd_blit(int load_mode, struct da8xx_fb_par *par)
...@@ -256,7 +246,7 @@ static int lcd_cfg_dma(int burst_size) ...@@ -256,7 +246,7 @@ static int lcd_cfg_dma(int burst_size)
default: default:
return -EINVAL; return -EINVAL;
} }
lcdc_write(reg | LCD_END_OF_FRAME_INT_ENA, LCD_DMA_CTRL_REG); lcdc_write(reg, LCD_DMA_CTRL_REG);
return 0; return 0;
} }
...@@ -342,11 +332,6 @@ static int lcd_cfg_display(const struct lcd_ctrl_config *cfg) ...@@ -342,11 +332,6 @@ static int lcd_cfg_display(const struct lcd_ctrl_config *cfg)
else else
reg &= ~LCD_SYNC_EDGE; reg &= ~LCD_SYNC_EDGE;
if (cfg->invert_pxl_clock)
reg |= LCD_INVERT_PIXEL_CLOCK;
else
reg &= ~LCD_INVERT_PIXEL_CLOCK;
if (cfg->invert_line_clock) if (cfg->invert_line_clock)
reg |= LCD_INVERT_LINE_CLOCK; reg |= LCD_INVERT_LINE_CLOCK;
else else
...@@ -456,19 +441,15 @@ static int fb_setcolreg(unsigned regno, unsigned red, unsigned green, ...@@ -456,19 +441,15 @@ static int fb_setcolreg(unsigned regno, unsigned red, unsigned green,
return 0; return 0;
} }
static int lcd_reset(struct da8xx_fb_par *par) static void lcd_reset(struct da8xx_fb_par *par)
{ {
int ret = 0;
/* Disable the Raster if previously Enabled */ /* Disable the Raster if previously Enabled */
if (lcdc_read(LCD_RASTER_CTRL_REG) & LCD_RASTER_ENABLE) if (lcdc_read(LCD_RASTER_CTRL_REG) & LCD_RASTER_ENABLE)
ret = lcd_disable_raster(par); lcd_disable_raster(par);
/* DMA has to be disabled */ /* DMA has to be disabled */
lcdc_write(0, LCD_DMA_CTRL_REG); lcdc_write(0, LCD_DMA_CTRL_REG);
lcdc_write(0, LCD_RASTER_CTRL_REG); lcdc_write(0, LCD_RASTER_CTRL_REG);
return ret;
} }
static int lcd_init(struct da8xx_fb_par *par, const struct lcd_ctrl_config *cfg, static int lcd_init(struct da8xx_fb_par *par, const struct lcd_ctrl_config *cfg,
...@@ -477,14 +458,19 @@ static int lcd_init(struct da8xx_fb_par *par, const struct lcd_ctrl_config *cfg, ...@@ -477,14 +458,19 @@ static int lcd_init(struct da8xx_fb_par *par, const struct lcd_ctrl_config *cfg,
u32 bpp; u32 bpp;
int ret = 0; int ret = 0;
ret = lcd_reset(par); lcd_reset(par);
if (ret != 0)
return ret;
/* Configure the LCD clock divisor. */ /* Configure the LCD clock divisor. */
lcdc_write(LCD_CLK_DIVISOR(panel->pxl_clk) | lcdc_write(LCD_CLK_DIVISOR(panel->pxl_clk) |
(LCD_RASTER_MODE & 0x1), LCD_CTRL_REG); (LCD_RASTER_MODE & 0x1), LCD_CTRL_REG);
if (panel->invert_pxl_clk)
lcdc_write((lcdc_read(LCD_RASTER_TIMING_2_REG) |
LCD_INVERT_PIXEL_CLOCK), LCD_RASTER_TIMING_2_REG);
else
lcdc_write((lcdc_read(LCD_RASTER_TIMING_2_REG) &
~LCD_INVERT_PIXEL_CLOCK), LCD_RASTER_TIMING_2_REG);
/* Configure the DMA burst size. */ /* Configure the DMA burst size. */
ret = lcd_cfg_dma(cfg->dma_burst_sz); ret = lcd_cfg_dma(cfg->dma_burst_sz);
if (ret < 0) if (ret < 0)
...@@ -528,7 +514,6 @@ static int lcd_init(struct da8xx_fb_par *par, const struct lcd_ctrl_config *cfg, ...@@ -528,7 +514,6 @@ static int lcd_init(struct da8xx_fb_par *par, const struct lcd_ctrl_config *cfg,
static irqreturn_t lcdc_irq_handler(int irq, void *arg) static irqreturn_t lcdc_irq_handler(int irq, void *arg)
{ {
u32 stat = lcdc_read(LCD_STAT_REG); u32 stat = lcdc_read(LCD_STAT_REG);
struct da8xx_fb_par *par = arg;
u32 reg; u32 reg;
if ((stat & LCD_SYNC_LOST) && (stat & LCD_FIFO_UNDERFLOW)) { if ((stat & LCD_SYNC_LOST) && (stat & LCD_FIFO_UNDERFLOW)) {
...@@ -539,7 +524,6 @@ static irqreturn_t lcdc_irq_handler(int irq, void *arg) ...@@ -539,7 +524,6 @@ static irqreturn_t lcdc_irq_handler(int irq, void *arg)
} else } else
lcdc_write(stat, LCD_STAT_REG); lcdc_write(stat, LCD_STAT_REG);
wake_up_interruptible(&par->da8xx_wq);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -594,13 +578,12 @@ static int fb_check_var(struct fb_var_screeninfo *var, ...@@ -594,13 +578,12 @@ static int fb_check_var(struct fb_var_screeninfo *var,
static int __devexit fb_remove(struct platform_device *dev) static int __devexit fb_remove(struct platform_device *dev)
{ {
struct fb_info *info = dev_get_drvdata(&dev->dev); struct fb_info *info = dev_get_drvdata(&dev->dev);
int ret = 0;
if (info) { if (info) {
struct da8xx_fb_par *par = info->par; struct da8xx_fb_par *par = info->par;
if (lcdc_read(LCD_RASTER_CTRL_REG) & LCD_RASTER_ENABLE) if (lcdc_read(LCD_RASTER_CTRL_REG) & LCD_RASTER_ENABLE)
ret = lcd_disable_raster(par); lcd_disable_raster(par);
lcdc_write(0, LCD_RASTER_CTRL_REG); lcdc_write(0, LCD_RASTER_CTRL_REG);
/* disable DMA */ /* disable DMA */
...@@ -619,7 +602,7 @@ static int __devexit fb_remove(struct platform_device *dev) ...@@ -619,7 +602,7 @@ static int __devexit fb_remove(struct platform_device *dev)
release_mem_region(lcdc_regs->start, resource_size(lcdc_regs)); release_mem_region(lcdc_regs->start, resource_size(lcdc_regs));
} }
return ret; return 0;
} }
static int fb_ioctl(struct fb_info *info, unsigned int cmd, static int fb_ioctl(struct fb_info *info, unsigned int cmd,
...@@ -634,11 +617,11 @@ static int fb_ioctl(struct fb_info *info, unsigned int cmd, ...@@ -634,11 +617,11 @@ static int fb_ioctl(struct fb_info *info, unsigned int cmd,
case FBIPUT_BRIGHTNESS: case FBIPUT_BRIGHTNESS:
case FBIGET_COLOR: case FBIGET_COLOR:
case FBIPUT_COLOR: case FBIPUT_COLOR:
return -EINVAL; return -ENOTTY;
case FBIPUT_HSYNC: case FBIPUT_HSYNC:
if (copy_from_user(&sync_arg, (char *)arg, if (copy_from_user(&sync_arg, (char *)arg,
sizeof(struct lcd_sync_arg))) sizeof(struct lcd_sync_arg)))
return -EINVAL; return -EFAULT;
lcd_cfg_horizontal_sync(sync_arg.back_porch, lcd_cfg_horizontal_sync(sync_arg.back_porch,
sync_arg.pulse_width, sync_arg.pulse_width,
sync_arg.front_porch); sync_arg.front_porch);
...@@ -646,7 +629,7 @@ static int fb_ioctl(struct fb_info *info, unsigned int cmd, ...@@ -646,7 +629,7 @@ static int fb_ioctl(struct fb_info *info, unsigned int cmd,
case FBIPUT_VSYNC: case FBIPUT_VSYNC:
if (copy_from_user(&sync_arg, (char *)arg, if (copy_from_user(&sync_arg, (char *)arg,
sizeof(struct lcd_sync_arg))) sizeof(struct lcd_sync_arg)))
return -EINVAL; return -EFAULT;
lcd_cfg_vertical_sync(sync_arg.back_porch, lcd_cfg_vertical_sync(sync_arg.back_porch,
sync_arg.pulse_width, sync_arg.pulse_width,
sync_arg.front_porch); sync_arg.front_porch);
...@@ -773,8 +756,6 @@ static int __init fb_probe(struct platform_device *device) ...@@ -773,8 +756,6 @@ static int __init fb_probe(struct platform_device *device)
par->lcdc_clk = fb_clk; par->lcdc_clk = fb_clk;
init_waitqueue_head(&par->da8xx_wq);
par->irq = platform_get_irq(device, 0); par->irq = platform_get_irq(device, 0);
if (par->irq < 0) { if (par->irq < 0) {
ret = -ENOENT; ret = -ENOENT;
......
...@@ -67,9 +67,6 @@ struct lcd_ctrl_config { ...@@ -67,9 +67,6 @@ struct lcd_ctrl_config {
/* Mono 8-bit Mode: 1=D0-D7 or 0=D0-D3 */ /* Mono 8-bit Mode: 1=D0-D7 or 0=D0-D3 */
unsigned char mono_8bit_mode; unsigned char mono_8bit_mode;
/* Invert pixel clock */
unsigned char invert_pxl_clock;
/* Invert line clock */ /* Invert line clock */
unsigned char invert_line_clock; unsigned char invert_line_clock;
......
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