summaryrefslogtreecommitdiff
path: root/firmware/target/arm/rk27xx/lcdif-rk27xx.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/rk27xx/lcdif-rk27xx.c')
-rw-r--r--firmware/target/arm/rk27xx/lcdif-rk27xx.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/firmware/target/arm/rk27xx/lcdif-rk27xx.c b/firmware/target/arm/rk27xx/lcdif-rk27xx.c
index 3f22057f2f..314838f2c1 100644
--- a/firmware/target/arm/rk27xx/lcdif-rk27xx.c
+++ b/firmware/target/arm/rk27xx/lcdif-rk27xx.c
@@ -50,19 +50,19 @@ static uint32_t lcd_data_transform(uint32_t data)
50{ 50{
51 unsigned int r, g, b; 51 unsigned int r, g, b;
52 52
53#if defined(RK27_GENERIC) 53#if (LCD_DATABUS_WIDTH == LCDIF_18BIT)
54 /* 18 bit interface */ 54 /* 18 bit interface */
55 r = (data & 0x0000fc00)<<8; 55 r = (data & 0x0000fc00)<<8;
56 /* g = ((data & 0x00000300) >> 2) | ((data & 0x000000e0) >> 3); */ 56 /* g = ((data & 0x00000300) >> 2) | ((data & 0x000000e0) >> 3); */
57 g = ((data & 0x00000300) << 6) | ((data & 0x000000e0) << 5); 57 g = ((data & 0x00000300) << 6) | ((data & 0x000000e0) << 5);
58 b = (data & 0x00000001f) << 3; 58 b = (data & 0x00000001f) << 3;
59#elif defined(HM60X) || defined(HM801) || defined(MA9) 59#elif (LCD_DATABUS_WIDTH == LCDIF_16BIT)
60 /* 16 bit interface */ 60 /* 16 bit interface */
61 r = (data & 0x0000f800) << 8; 61 r = (data & 0x0000f800) << 8;
62 g = (data & 0x000007e0) << 5; 62 g = (data & 0x000007e0) << 5;
63 b = (data & 0x0000001f) << 3; 63 b = (data & 0x0000001f) << 3;
64#else 64#else
65#error "Unknown target" 65#error "LCD_DATABUS_WIDTH needs to be defined in lcd-target.h"
66#endif 66#endif
67 67
68 return (r | g | b); 68 return (r | g | b);
@@ -119,17 +119,15 @@ static void lcdctrl_init(void)
119 MCU_CTRL = MCU_CTRL_RS_HIGH|MCU_CTRL_BUFF_WRITE|MCU_CTRL_BUFF_START; 119 MCU_CTRL = MCU_CTRL_RS_HIGH|MCU_CTRL_BUFF_WRITE|MCU_CTRL_BUFF_START;
120} 120}
121 121
122/* configure pins to drive lcd in 18bit mode (16bit mode for HiFiMAN's) */ 122/* configure pins to drive lcd in 18bit or 16bit mode */
123static void iomux_lcd(enum lcdif_mode_t mode) 123static void iomux_lcd(void)
124{ 124{
125 unsigned long muxa; 125 unsigned long muxa;
126 126
127 muxa = SCU_IOMUXA_CON & ~(IOMUX_LCD_VSYNC|IOMUX_LCD_DEN|0xff); 127 muxa = SCU_IOMUXA_CON & ~(IOMUX_LCD_VSYNC|IOMUX_LCD_DEN|0xff);
128 128#if (LCD_DATABUS_WIDTH == LCDIF_18BIT)
129 if (mode == LCDIF_18BIT) 129 muxa |= IOMUX_LCD_D18|IOMUX_LCD_D20|IOMUX_LCD_D22|IOMUX_LCD_D17|IOMUX_LCD_D16;
130 { 130#endif
131 muxa |= IOMUX_LCD_D18|IOMUX_LCD_D20|IOMUX_LCD_D22|IOMUX_LCD_D17|IOMUX_LCD_D16;
132 }
133 131
134 SCU_IOMUXA_CON = muxa; 132 SCU_IOMUXA_CON = muxa;
135 SCU_IOMUXB_CON |= IOMUX_LCD_D815; 133 SCU_IOMUXB_CON |= IOMUX_LCD_D815;
@@ -241,10 +239,9 @@ void lcd_write_reg(unsigned int reg, unsigned int val)
241/* rockbox API functions */ 239/* rockbox API functions */
242void lcd_init_device(void) 240void lcd_init_device(void)
243{ 241{
244 iomux_lcd(LCD_DATABUS_WIDTH); /* setup pins for lcd interface */ 242 iomux_lcd(); /* setup pins for lcd interface */
245 dwdma_init(); /* init dwdma module */ 243 dwdma_init(); /* init dwdma module */
246 create_llp(); /* build LLPs for screen update dma */ 244 lcdctrl_init(); /* basic lcdc module configuration */
247 lcdctrl_init(); /* basic lcdc module configuration */
248} 245}
249 246
250void lcd_update() 247void lcd_update()