diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/target/arm/as3525/lcd-clip.h (renamed from firmware/target/arm/as3525/sansa-clip/lcd-clip.h) | 12 | ||||
-rw-r--r-- | firmware/target/arm/as3525/lcd-ssd1303.c | 18 | ||||
-rw-r--r-- | firmware/target/arm/as3525/sansa-clip/lcd-clip.c | 15 | ||||
-rw-r--r-- | firmware/target/arm/as3525/sansa-clipplus/lcd-clip-plus.c | 10 | ||||
-rw-r--r-- | firmware/target/arm/as3525/sansa-clipplus/lcd-clip.h | 28 | ||||
-rw-r--r-- | firmware/target/arm/as3525/sansa-clipv2/lcd-clip.h | 28 | ||||
-rw-r--r-- | firmware/target/arm/as3525/sansa-clipv2/lcd-clipv2.c | 14 |
7 files changed, 49 insertions, 76 deletions
diff --git a/firmware/target/arm/as3525/sansa-clip/lcd-clip.h b/firmware/target/arm/as3525/lcd-clip.h index 3d4fe60311..ab31f688db 100644 --- a/firmware/target/arm/as3525/sansa-clip/lcd-clip.h +++ b/firmware/target/arm/as3525/lcd-clip.h | |||
@@ -20,10 +20,10 @@ | |||
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | 21 | ||
22 | #include "config.h" | 22 | #include "config.h" |
23 | #include "ascodec.h" | ||
24 | 23 | ||
25 | void lcd_hw_init(int *offset) INIT_ATTR; | 24 | /* return variant number: 0 = clipv1, old clip+, 1 = newer clip+ */ |
26 | static inline void lcd_enable_power(bool onoff) | 25 | int lcd_hw_init(void) INIT_ATTR; |
27 | { | 26 | |
28 | ascodec_write(AS3514_DCDC15, onoff ? 1 : 0); | 27 | /* target-specific power enable */ |
29 | } | 28 | void lcd_enable_power(bool onoff); |
29 | |||
diff --git a/firmware/target/arm/as3525/lcd-ssd1303.c b/firmware/target/arm/as3525/lcd-ssd1303.c index e0e0715311..213f12a424 100644 --- a/firmware/target/arm/as3525/lcd-ssd1303.c +++ b/firmware/target/arm/as3525/lcd-ssd1303.c | |||
@@ -44,7 +44,6 @@ | |||
44 | #define LCD_SET_REVERSE_DISPLAY ((char)0xA7) | 44 | #define LCD_SET_REVERSE_DISPLAY ((char)0xA7) |
45 | #define LCD_SET_MULTIPLEX_RATIO ((char)0xA8) | 45 | #define LCD_SET_MULTIPLEX_RATIO ((char)0xA8) |
46 | #define LCD_SET_DC_DC ((char)0xAD) | 46 | #define LCD_SET_DC_DC ((char)0xAD) |
47 | #define LCD_SET_DC_DC_PART2 ((char)0x8A) | ||
48 | #define LCD_SET_DISPLAY_OFF ((char)0xAE) | 47 | #define LCD_SET_DISPLAY_OFF ((char)0xAE) |
49 | #define LCD_SET_DISPLAY_ON ((char)0xAF) | 48 | #define LCD_SET_DISPLAY_ON ((char)0xAF) |
50 | #define LCD_SET_PAGE_ADDRESS ((char)0xB0) | 49 | #define LCD_SET_PAGE_ADDRESS ((char)0xB0) |
@@ -68,6 +67,13 @@ | |||
68 | /** globals **/ | 67 | /** globals **/ |
69 | 68 | ||
70 | static bool display_on; /* used by lcd_enable */ | 69 | static bool display_on; /* used by lcd_enable */ |
70 | |||
71 | /* Display variant, always 0 in clipv1, clipv2, can be 0 or 1 in clip+ | ||
72 | * variant 0: has 132 pixel wide framebuffer, max brightness about 50 | ||
73 | * variant 1: has 128 pixel wide framebuffer, max brightness about 128 | ||
74 | */ | ||
75 | static int variant; | ||
76 | |||
71 | static int offset; /* column offset */ | 77 | static int offset; /* column offset */ |
72 | 78 | ||
73 | /*** hardware configuration ***/ | 79 | /*** hardware configuration ***/ |
@@ -80,6 +86,9 @@ int lcd_default_contrast(void) | |||
80 | void lcd_set_contrast(int val) | 86 | void lcd_set_contrast(int val) |
81 | { | 87 | { |
82 | lcd_write_command(LCD_CNTL_CONTRAST); | 88 | lcd_write_command(LCD_CNTL_CONTRAST); |
89 | if (variant == 1) { | ||
90 | val = val * 5 / 2; | ||
91 | } | ||
83 | lcd_write_command(val); | 92 | lcd_write_command(val); |
84 | } | 93 | } |
85 | 94 | ||
@@ -137,7 +146,8 @@ void lcd_init_device(void) | |||
137 | { | 146 | { |
138 | int i; | 147 | int i; |
139 | 148 | ||
140 | lcd_hw_init(&offset); | 149 | variant = lcd_hw_init(); |
150 | offset = (variant == 0) ? 2 : 0; | ||
141 | 151 | ||
142 | /* Set display clock (divide ratio = 1) and oscillator frequency (1) */ | 152 | /* Set display clock (divide ratio = 1) and oscillator frequency (1) */ |
143 | lcd_write_command(LCD_SET_DISPLAY_CLOCK_AND_OSC_FREQ); | 153 | lcd_write_command(LCD_SET_DISPLAY_CLOCK_AND_OSC_FREQ); |
@@ -154,9 +164,9 @@ void lcd_init_device(void) | |||
154 | /* Set contrast register to 12% */ | 164 | /* Set contrast register to 12% */ |
155 | lcd_set_contrast(lcd_default_contrast()); | 165 | lcd_set_contrast(lcd_default_contrast()); |
156 | 166 | ||
157 | /* Disable DC-DC */ | 167 | /* Configure DC-DC */ |
158 | lcd_write_command(LCD_SET_DC_DC); | 168 | lcd_write_command(LCD_SET_DC_DC); |
159 | lcd_write_command(LCD_SET_DC_DC_PART2/*|0*/); | 169 | lcd_write_command((variant == 0) ? 0x8A : 0x10); |
160 | 170 | ||
161 | /* Set starting line as 0 */ | 171 | /* Set starting line as 0 */ |
162 | lcd_write_command(LCD_SET_DISPLAY_START_LINE /*|(0 & 0x3f)*/); | 172 | lcd_write_command(LCD_SET_DISPLAY_START_LINE /*|(0 & 0x3f)*/); |
diff --git a/firmware/target/arm/as3525/sansa-clip/lcd-clip.c b/firmware/target/arm/as3525/sansa-clip/lcd-clip.c index 775988cc0e..21d8902739 100644 --- a/firmware/target/arm/as3525/sansa-clip/lcd-clip.c +++ b/firmware/target/arm/as3525/sansa-clip/lcd-clip.c | |||
@@ -25,8 +25,11 @@ | |||
25 | #include "lcd-clip.h" | 25 | #include "lcd-clip.h" |
26 | #include "system.h" | 26 | #include "system.h" |
27 | #include "cpu.h" | 27 | #include "cpu.h" |
28 | #include "ascodec.h" | ||
28 | 29 | ||
29 | void lcd_hw_init(int *offset) | 30 | #define LCD_DELAY 1 |
31 | |||
32 | int lcd_hw_init(void) | ||
30 | { | 33 | { |
31 | /* DBOP initialisation, do what OF does */ | 34 | /* DBOP initialisation, do what OF does */ |
32 | CGU_DBOP = (1<<3) | AS3525_DBOP_DIV; | 35 | CGU_DBOP = (1<<3) | AS3525_DBOP_DIV; |
@@ -46,11 +49,9 @@ void lcd_hw_init(int *offset) | |||
46 | GPIOA_PIN(4) = 0; | 49 | GPIOA_PIN(4) = 0; |
47 | GPIOB_PIN(6) = (1<<6); | 50 | GPIOB_PIN(6) = (1<<6); |
48 | 51 | ||
49 | *offset = 2; | 52 | return 0; |
50 | } | 53 | } |
51 | 54 | ||
52 | #define LCD_DELAY 1 | ||
53 | |||
54 | void lcd_write_command(int byte) | 55 | void lcd_write_command(int byte) |
55 | { | 56 | { |
56 | volatile int i = 0; | 57 | volatile int i = 0; |
@@ -90,3 +91,9 @@ void lcd_write_data(const fb_data* p_bytes, int count) | |||
90 | /* While push fifo is not empty */ | 91 | /* While push fifo is not empty */ |
91 | while ((DBOP_STAT & (1<<10)) == 0); | 92 | while ((DBOP_STAT & (1<<10)) == 0); |
92 | } | 93 | } |
94 | |||
95 | void lcd_enable_power(bool onoff) | ||
96 | { | ||
97 | ascodec_write(AS3514_DCDC15, onoff ? 1 : 0); | ||
98 | } | ||
99 | |||
diff --git a/firmware/target/arm/as3525/sansa-clipplus/lcd-clip-plus.c b/firmware/target/arm/as3525/sansa-clipplus/lcd-clip-plus.c index 3faa92da31..ac7b77d772 100644 --- a/firmware/target/arm/as3525/sansa-clipplus/lcd-clip-plus.c +++ b/firmware/target/arm/as3525/sansa-clipplus/lcd-clip-plus.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include "system.h" | 26 | #include "system.h" |
27 | #include "cpu.h" | 27 | #include "cpu.h" |
28 | 28 | ||
29 | void lcd_hw_init(int *offset) | 29 | int lcd_hw_init(void) |
30 | { | 30 | { |
31 | bitset32(&CGU_PERI, CGU_SSP_CLOCK_ENABLE); | 31 | bitset32(&CGU_PERI, CGU_SSP_CLOCK_ENABLE); |
32 | 32 | ||
@@ -41,7 +41,7 @@ void lcd_hw_init(int *offset) | |||
41 | GPIOB_PIN(7) = 0; | 41 | GPIOB_PIN(7) = 0; |
42 | GPIOA_PIN(5) = (1<<5); | 42 | GPIOA_PIN(5) = (1<<5); |
43 | 43 | ||
44 | *offset = GPIOB_PIN(3) ? 0 : 2; | 44 | return GPIOB_PIN(3) ? 1 : 0; |
45 | } | 45 | } |
46 | 46 | ||
47 | void lcd_write_command(int byte) | 47 | void lcd_write_command(int byte) |
@@ -68,3 +68,9 @@ void lcd_write_data(const fb_data* p_bytes, int count) | |||
68 | SSP_DATA = *p_bytes++; | 68 | SSP_DATA = *p_bytes++; |
69 | } | 69 | } |
70 | } | 70 | } |
71 | |||
72 | void lcd_enable_power(bool onoff) | ||
73 | { | ||
74 | (void) onoff; | ||
75 | } | ||
76 | |||
diff --git a/firmware/target/arm/as3525/sansa-clipplus/lcd-clip.h b/firmware/target/arm/as3525/sansa-clipplus/lcd-clip.h deleted file mode 100644 index 70bafe4212..0000000000 --- a/firmware/target/arm/as3525/sansa-clipplus/lcd-clip.h +++ /dev/null | |||
@@ -1,28 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008-2009 Rafaël Carré | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #include "config.h" | ||
23 | |||
24 | void lcd_hw_init(int *offset) INIT_ATTR; | ||
25 | static inline void lcd_enable_power(bool onoff) | ||
26 | { | ||
27 | (void) onoff; | ||
28 | } | ||
diff --git a/firmware/target/arm/as3525/sansa-clipv2/lcd-clip.h b/firmware/target/arm/as3525/sansa-clipv2/lcd-clip.h deleted file mode 100644 index 70bafe4212..0000000000 --- a/firmware/target/arm/as3525/sansa-clipv2/lcd-clip.h +++ /dev/null | |||
@@ -1,28 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008-2009 Rafaël Carré | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #include "config.h" | ||
23 | |||
24 | void lcd_hw_init(int *offset) INIT_ATTR; | ||
25 | static inline void lcd_enable_power(bool onoff) | ||
26 | { | ||
27 | (void) onoff; | ||
28 | } | ||
diff --git a/firmware/target/arm/as3525/sansa-clipv2/lcd-clipv2.c b/firmware/target/arm/as3525/sansa-clipv2/lcd-clipv2.c index 14c8b77aec..d7266f72a0 100644 --- a/firmware/target/arm/as3525/sansa-clipv2/lcd-clipv2.c +++ b/firmware/target/arm/as3525/sansa-clipv2/lcd-clipv2.c | |||
@@ -26,7 +26,9 @@ | |||
26 | #include "system.h" | 26 | #include "system.h" |
27 | #include "cpu.h" | 27 | #include "cpu.h" |
28 | 28 | ||
29 | void lcd_hw_init(int *offset) | 29 | #define LCD_DELAY 10 |
30 | |||
31 | int lcd_hw_init(void) | ||
30 | { | 32 | { |
31 | /* DBOP initialisation, do what OF does */ | 33 | /* DBOP initialisation, do what OF does */ |
32 | bitset32(&CCU_IO, 1<<12); /* ?? */ | 34 | bitset32(&CCU_IO, 1<<12); /* ?? */ |
@@ -39,11 +41,9 @@ void lcd_hw_init(int *offset) | |||
39 | GPIOB_DIR |= (1<<2)|(1<<5); | 41 | GPIOB_DIR |= (1<<2)|(1<<5); |
40 | GPIOB_PIN(5) = (1<<5); | 42 | GPIOB_PIN(5) = (1<<5); |
41 | 43 | ||
42 | *offset = 2; | 44 | return 0; |
43 | } | 45 | } |
44 | 46 | ||
45 | #define LCD_DELAY 10 | ||
46 | |||
47 | void lcd_write_command(int byte) | 47 | void lcd_write_command(int byte) |
48 | { | 48 | { |
49 | volatile int i = 0; | 49 | volatile int i = 0; |
@@ -84,3 +84,9 @@ void lcd_write_data(const fb_data* p_bytes, int count) | |||
84 | /* While push fifo is not empty */ | 84 | /* While push fifo is not empty */ |
85 | while ((DBOP_STAT & (1<<10)) == 0); | 85 | while ((DBOP_STAT & (1<<10)) == 0); |
86 | } | 86 | } |
87 | |||
88 | void lcd_enable_power(bool onoff) | ||
89 | { | ||
90 | (void) onoff; | ||
91 | } | ||
92 | |||