diff options
author | Andrew Ryabinin <ryabinin.a.a@gmail.com> | 2012-02-28 20:53:52 +0400 |
---|---|---|
committer | Marcin Bukat <marcin.bukat@gmail.com> | 2012-03-06 09:37:11 +0100 |
commit | b069562ef4146c2b377d14bbe6cb35f0ff4fd043 (patch) | |
tree | 819f168e69ee7cf2c0058b10d79400b309ac5f94 | |
parent | 4601a8b44a2aad323b7c805228fcade2333c95dd (diff) | |
download | rockbox-b069562ef4146c2b377d14bbe6cb35f0ff4fd043.tar.gz rockbox-b069562ef4146c2b377d14bbe6cb35f0ff4fd043.zip |
rk27xx: lcdif refactoring: make lcdif-rk27xx.c more generic
iomux_lcd now has parameter for display bit mode settings, so we doesn't need ifdef here.
lcd_init_device moved to target specific code
lcdif_init configure pins and lcd cotroller
Change-Id: I3a2d7fd38b08fe3bc5ebefa8c9f7288c21f58212
Reviewed-on: http://gerrit.rockbox.org/153
Reviewed-by: Marcin Bukat <marcin.bukat@gmail.com>
Tested-by: Marcin Bukat <marcin.bukat@gmail.com>
-rw-r--r-- | firmware/target/arm/rk27xx/lcd-hifiman.c | 8 | ||||
-rw-r--r-- | firmware/target/arm/rk27xx/lcdif-rk27xx.c | 15 | ||||
-rw-r--r-- | firmware/target/arm/rk27xx/lcdif-rk27xx.h | 7 | ||||
-rw-r--r-- | firmware/target/arm/rk27xx/rk27generic/lcd-rk27generic.c | 8 |
4 files changed, 27 insertions, 11 deletions
diff --git a/firmware/target/arm/rk27xx/lcd-hifiman.c b/firmware/target/arm/rk27xx/lcd-hifiman.c index dba6accd1d..d98ed5a1c3 100644 --- a/firmware/target/arm/rk27xx/lcd-hifiman.c +++ b/firmware/target/arm/rk27xx/lcd-hifiman.c | |||
@@ -29,7 +29,7 @@ | |||
29 | 29 | ||
30 | static bool display_on = false; | 30 | static bool display_on = false; |
31 | 31 | ||
32 | void lcd_display_init() | 32 | static void lcd_display_init(void) |
33 | { | 33 | { |
34 | unsigned int x, y; | 34 | unsigned int x, y; |
35 | 35 | ||
@@ -108,6 +108,12 @@ void lcd_display_init() | |||
108 | display_on = true; | 108 | display_on = true; |
109 | } | 109 | } |
110 | 110 | ||
111 | void lcd_init_device(void) | ||
112 | { | ||
113 | lcdif_init(LCDIF_16BIT); | ||
114 | lcd_display_init(); | ||
115 | } | ||
116 | |||
111 | void lcd_enable (bool on) | 117 | void lcd_enable (bool on) |
112 | { | 118 | { |
113 | if (on) | 119 | if (on) |
diff --git a/firmware/target/arm/rk27xx/lcdif-rk27xx.c b/firmware/target/arm/rk27xx/lcdif-rk27xx.c index ff60279315..affc49b213 100644 --- a/firmware/target/arm/rk27xx/lcdif-rk27xx.c +++ b/firmware/target/arm/rk27xx/lcdif-rk27xx.c | |||
@@ -123,27 +123,26 @@ static void lcdctrl_init(void) | |||
123 | } | 123 | } |
124 | 124 | ||
125 | /* configure pins to drive lcd in 18bit mode (16bit mode for HiFiMAN's) */ | 125 | /* configure pins to drive lcd in 18bit mode (16bit mode for HiFiMAN's) */ |
126 | static void iomux_lcd(void) | 126 | static void iomux_lcd(enum lcdif_mode_t mode) |
127 | { | 127 | { |
128 | unsigned long muxa; | 128 | unsigned long muxa; |
129 | 129 | ||
130 | muxa = SCU_IOMUXA_CON & ~(IOMUX_LCD_VSYNC|IOMUX_LCD_DEN|0xff); | 130 | muxa = SCU_IOMUXA_CON & ~(IOMUX_LCD_VSYNC|IOMUX_LCD_DEN|0xff); |
131 | 131 | ||
132 | #if !defined(HM801) && !defined(HM60x) | 132 | if (mode == LCDIF_18BIT) |
133 | muxa |= IOMUX_LCD_D18|IOMUX_LCD_D20|IOMUX_LCD_D22|IOMUX_LCD_D17|IOMUX_LCD_D16; | 133 | { |
134 | #endif | 134 | muxa |= IOMUX_LCD_D18|IOMUX_LCD_D20|IOMUX_LCD_D22|IOMUX_LCD_D17|IOMUX_LCD_D16; |
135 | } | ||
135 | 136 | ||
136 | SCU_IOMUXA_CON = muxa; | 137 | SCU_IOMUXA_CON = muxa; |
137 | SCU_IOMUXB_CON |= IOMUX_LCD_D815; | 138 | SCU_IOMUXB_CON |= IOMUX_LCD_D815; |
138 | } | 139 | } |
139 | 140 | ||
140 | void lcd_init_device() | 141 | void lcdif_init(enum lcdif_mode_t mode) |
141 | { | 142 | { |
142 | iomux_lcd(); /* setup pins for 16bit lcd interface */ | 143 | iomux_lcd(mode); /* setup pins for lcd interface */ |
143 | lcdctrl_init(); /* basic lcdc module configuration */ | 144 | lcdctrl_init(); /* basic lcdc module configuration */ |
144 | |||
145 | lcdctrl_bypass(1); /* run in bypass mode - all writes goes directly to lcd controller */ | 145 | lcdctrl_bypass(1); /* run in bypass mode - all writes goes directly to lcd controller */ |
146 | lcd_display_init(); | ||
147 | } | 146 | } |
148 | 147 | ||
149 | /* This is ugly hack. We drive lcd in bypass mode | 148 | /* This is ugly hack. We drive lcd in bypass mode |
diff --git a/firmware/target/arm/rk27xx/lcdif-rk27xx.h b/firmware/target/arm/rk27xx/lcdif-rk27xx.h index caf97c8e94..1d7b810fa2 100644 --- a/firmware/target/arm/rk27xx/lcdif-rk27xx.h +++ b/firmware/target/arm/rk27xx/lcdif-rk27xx.h | |||
@@ -1,11 +1,16 @@ | |||
1 | #ifndef _LCDIF_RK27XX_H | 1 | #ifndef _LCDIF_RK27XX_H |
2 | #define _LCDIF_RK27XX_H | 2 | #define _LCDIF_RK27XX_H |
3 | 3 | ||
4 | enum lcdif_mode_t { | ||
5 | LCDIF_16BIT, | ||
6 | LCDIF_18BIT | ||
7 | }; | ||
8 | |||
4 | unsigned int lcd_data_transform(unsigned int data); | 9 | unsigned int lcd_data_transform(unsigned int data); |
5 | 10 | ||
6 | void lcd_cmd(unsigned int cmd); | 11 | void lcd_cmd(unsigned int cmd); |
7 | void lcd_data(unsigned int data); | 12 | void lcd_data(unsigned int data); |
8 | void lcd_write_reg(unsigned int reg, unsigned int val); | 13 | void lcd_write_reg(unsigned int reg, unsigned int val); |
9 | void lcd_display_init(void); | 14 | void lcdif_init(enum lcdif_mode_t mode); |
10 | 15 | ||
11 | #endif /* _LCDIF_RK27XX_H */ | 16 | #endif /* _LCDIF_RK27XX_H */ |
diff --git a/firmware/target/arm/rk27xx/rk27generic/lcd-rk27generic.c b/firmware/target/arm/rk27xx/rk27generic/lcd-rk27generic.c index e15262398b..5eca87c6d8 100644 --- a/firmware/target/arm/rk27xx/rk27generic/lcd-rk27generic.c +++ b/firmware/target/arm/rk27xx/rk27generic/lcd-rk27generic.c | |||
@@ -71,7 +71,7 @@ static void lcd_sleep(bool sleep) | |||
71 | lcd_cmd(GRAM_WRITE); | 71 | lcd_cmd(GRAM_WRITE); |
72 | } | 72 | } |
73 | 73 | ||
74 | void lcd_display_init() | 74 | static void lcd_display_init(void) |
75 | { | 75 | { |
76 | unsigned int x, y; | 76 | unsigned int x, y; |
77 | 77 | ||
@@ -173,6 +173,12 @@ void lcd_display_init() | |||
173 | lcd_sleep(false); | 173 | lcd_sleep(false); |
174 | } | 174 | } |
175 | 175 | ||
176 | void lcd_init_device(void) | ||
177 | { | ||
178 | lcdif_init(LCDIF_18BIT); | ||
179 | lcd_display_init(); | ||
180 | } | ||
181 | |||
176 | void lcd_update_rect(int x, int y, int width, int height) | 182 | void lcd_update_rect(int x, int y, int width, int height) |
177 | { | 183 | { |
178 | int px = x, py = y; | 184 | int px = x, py = y; |