From c2d17ffef2d455253aceac1d0d8d60a897ff02b7 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Fri, 28 Nov 2014 17:42:31 +0800 Subject: [PATCH] lcd: get rid of lcd_setup() Combine init and setup into one function, and call it lcd_init(). Signed-off-by: Sean Cross --- include/lcd.h | 1 - lcd.c | 33 +++++++++------------------------ 2 files changed, 9 insertions(+), 25 deletions(-) diff --git a/include/lcd.h b/include/lcd.h index 3e9dc81..ab893f6 100644 --- a/include/lcd.h +++ b/include/lcd.h @@ -14,7 +14,6 @@ static inline pixel_t rgb(unsigned r, unsigned g, unsigned b) } int lcd_init(void); -int lcd_start(void); int lcd_run(void); int lcd_stop(void); diff --git a/lcd.c b/lcd.c index 8a39eac..7a44965 100644 --- a/lcd.c +++ b/lcd.c @@ -131,10 +131,8 @@ static int lcd_setup(void) return 0; } -int lcd_init(void) +static void lcd_panel_setup(void) { - lcd_setup(); - writew(LCD_RESET_CLEAR, LCD_RESET_REG); _usleep(20000); writew(LCD_RESET_SET, LCD_RESET_REG); @@ -194,8 +192,6 @@ int lcd_init(void) /* Memory Write -- prep for the first pixel to be written */ lcd_cmd(0x2c); - - return 0; } /* Fill pre-frame command buffer. These commands are sent out before @@ -205,22 +201,6 @@ static void lcd_fill_cmd_buffer(void) { int ncommands = 0; -#if 0 - /* Column set */ - lcd_cmd_slot(0x2a, ncommands++); - lcd_dat_slot(0x00, ncommands++); - lcd_dat_slot(0x00, ncommands++); - lcd_dat_slot(0x00, ncommands++); - lcd_dat_slot(0xEF, ncommands++); - - /* Page address set */ - lcd_cmd_slot(0x2b, ncommands++); - lcd_dat_slot(0x00, ncommands++); - lcd_dat_slot(0x00, ncommands++); - lcd_dat_slot(0x01, ncommands++); - lcd_dat_slot(0x3F, ncommands++); -#endif - /* Memory write */ lcd_cmd_slot(0x2c, ncommands++); @@ -231,7 +211,7 @@ static void lcd_fill_cmd_buffer(void) LCD_AUTOCOPY_CTRL_REG); } -int lcd_start(void) +static int lcd_dma_setup(void) { /* Set up AUTOCOPY (i.e. freerunning mode) */ writel(LCD_FORMAT | (0x1f << LCD_AUTOCOPY_CTRL_PERIOD_SHIFT), @@ -252,14 +232,19 @@ int lcd_start(void) writel(readl(LCD_AUTOCOPY_CTRL_REG) | LCD_AUTOCOPY_CTRL_EN0, LCD_AUTOCOPY_CTRL_REG); - lcd_fill_cmd_buffer(); - /* Enable AUTOCOPY_CTRL command transfer */ writel(readl(LCD_AUTOCOPY_CTRL_REG) | LCD_AUTOCOPY_CTRL_ENC | LCD_AUTOCOPY_CTRL_SEND_RESIDUE, LCD_AUTOCOPY_CTRL_REG); + return 0; +} +int lcd_init(void) +{ + lcd_setup(); + lcd_panel_setup(); + lcd_dma_setup(); return 0; }