diff options
Diffstat (limited to 'firmware')
7 files changed, 83 insertions, 87 deletions
diff --git a/firmware/export/jz4740.h b/firmware/export/jz4740.h index f029ad606e..e4df112456 100644 --- a/firmware/export/jz4740.h +++ b/firmware/export/jz4740.h | |||
@@ -1197,7 +1197,7 @@ | |||
1197 | #define AIC_I2SDIV_BITCLK_1418KHZ (0x1A << AIC_I2SDIV_DIV_BIT) /* BIT_CLK of 1.418MHz */ | 1197 | #define AIC_I2SDIV_BITCLK_1418KHZ (0x1A << AIC_I2SDIV_DIV_BIT) /* BIT_CLK of 1.418MHz */ |
1198 | #define AIC_I2SDIV_BITCLK_1024KHZ (0x24 << AIC_I2SDIV_DIV_BIT) /* BIT_CLK of 1.024MHz */ | 1198 | #define AIC_I2SDIV_BITCLK_1024KHZ (0x24 << AIC_I2SDIV_DIV_BIT) /* BIT_CLK of 1.024MHz */ |
1199 | #define AIC_I2SDIV_BITCLK_7089KHZ (0x34 << AIC_I2SDIV_DIV_BIT) /* BIT_CLK of 708.92KHz */ | 1199 | #define AIC_I2SDIV_BITCLK_7089KHZ (0x34 << AIC_I2SDIV_DIV_BIT) /* BIT_CLK of 708.92KHz */ |
1200 | #define AIC_I2SDIV_BITCLK_512KHZ (0x48 << AIC_I2SDIV_DIV_BIT) /* BIT_CLK of 512.00KHz */ | 1200 | #define AIC_I2SDIV_BITCLK_512KHZ (0x48 << AIC_I2SDIV_DIV_BIT) /* BIT_CLK of 512.00KHz */ |
1201 | 1201 | ||
1202 | 1202 | ||
1203 | /************************************************************************* | 1203 | /************************************************************************* |
diff --git a/firmware/target/mips/ingenic_jz47xx/codec-jz4740.c b/firmware/target/mips/ingenic_jz47xx/codec-jz4740.c index 0b187be1cc..05ca2d02d4 100644 --- a/firmware/target/mips/ingenic_jz47xx/codec-jz4740.c +++ b/firmware/target/mips/ingenic_jz47xx/codec-jz4740.c | |||
@@ -40,11 +40,13 @@ const struct sound_settings_info audiohw_settings[] = { | |||
40 | #endif | 40 | #endif |
41 | }; | 41 | }; |
42 | 42 | ||
43 | #if 0 | ||
43 | static unsigned short codec_volume; | 44 | static unsigned short codec_volume; |
44 | static unsigned short codec_base_gain; | 45 | static unsigned short codec_base_gain; |
45 | static unsigned short codec_mic_gain; | 46 | static unsigned short codec_mic_gain; |
47 | static int HP_register_value; | ||
48 | #endif | ||
46 | static bool HP_on_off_flag; | 49 | static bool HP_on_off_flag; |
47 | static int HP_register_value; | ||
48 | 50 | ||
49 | static void i2s_codec_set_samplerate(unsigned short rate); | 51 | static void i2s_codec_set_samplerate(unsigned short rate); |
50 | 52 | ||
@@ -77,7 +79,7 @@ static void i2s_codec_init(void) | |||
77 | i2s_codec_reset(); | 79 | i2s_codec_reset(); |
78 | 80 | ||
79 | //REG_ICDC_CDCCR2 = (ICDC_CDCCR2_AINVOL(ICDC_CDCCR2_AINVOL_DB(0)) | ICDC_CDCCR2_SMPR(ICDC_CDCCR2_SMPR_48) | 81 | //REG_ICDC_CDCCR2 = (ICDC_CDCCR2_AINVOL(ICDC_CDCCR2_AINVOL_DB(0)) | ICDC_CDCCR2_SMPR(ICDC_CDCCR2_SMPR_48) |
80 | REG_ICDC_CDCCR2 = ( ICDC_CDCCR2_AINVOL(23) | ICDC_CDCCR2_SMPR(ICDC_CDCCR2_SMPR_44) | 82 | REG_ICDC_CDCCR2 = ( ICDC_CDCCR2_AINVOL(14) | ICDC_CDCCR2_SMPR(ICDC_CDCCR2_SMPR_44) |
81 | | ICDC_CDCCR2_HPVOL(ICDC_CDCCR2_HPVOL_6)); | 83 | | ICDC_CDCCR2_HPVOL(ICDC_CDCCR2_HPVOL_6)); |
82 | 84 | ||
83 | REG_ICDC_CDCCR1 &= ~(ICDC_CDCCR1_SUSPD | ICDC_CDCCR1_RST); | 85 | REG_ICDC_CDCCR1 &= ~(ICDC_CDCCR1_SUSPD | ICDC_CDCCR1_RST); |
@@ -101,6 +103,7 @@ static void i2s_codec_init(void) | |||
101 | HP_on_off_flag = 1; /* HP is on */ | 103 | HP_on_off_flag = 1; /* HP is on */ |
102 | } | 104 | } |
103 | 105 | ||
106 | #if 0 | ||
104 | static void i2s_codec_set_mic(unsigned short v) /* 0 <= v <= 100 */ | 107 | static void i2s_codec_set_mic(unsigned short v) /* 0 <= v <= 100 */ |
105 | { | 108 | { |
106 | v &= 0xff; | 109 | v &= 0xff; |
@@ -201,48 +204,6 @@ static unsigned short i2s_codec_get_volume(void) | |||
201 | return val; | 204 | return val; |
202 | } | 205 | } |
203 | 206 | ||
204 | static void i2s_codec_set_samplerate(unsigned short rate) | ||
205 | { | ||
206 | unsigned short speed = 0; | ||
207 | |||
208 | switch (rate) | ||
209 | { | ||
210 | case 8000: | ||
211 | speed = 0 << 8; | ||
212 | break; | ||
213 | case 11025: | ||
214 | speed = 1 << 8; | ||
215 | break; | ||
216 | case 12000: | ||
217 | speed = 2 << 8; | ||
218 | break; | ||
219 | case 16000: | ||
220 | speed = 3 << 8; | ||
221 | break; | ||
222 | case 22050: | ||
223 | speed = 4 << 8; | ||
224 | break; | ||
225 | case 24000: | ||
226 | speed = 5 << 8; | ||
227 | break; | ||
228 | case 32000: | ||
229 | speed = 6 << 8; | ||
230 | break; | ||
231 | case 44100: | ||
232 | speed = 7 << 8; | ||
233 | break; | ||
234 | case 48000: | ||
235 | speed = 8 << 8; | ||
236 | break; | ||
237 | default: | ||
238 | break; | ||
239 | } | ||
240 | REG_ICDC_CDCCR2 |= 0x00000f00; | ||
241 | |||
242 | speed |= 0xfffff0ff; | ||
243 | REG_ICDC_CDCCR2 &= speed; | ||
244 | } | ||
245 | |||
246 | static void HP_turn_on(void) | 207 | static void HP_turn_on(void) |
247 | { | 208 | { |
248 | //see 1.3.4.1 | 209 | //see 1.3.4.1 |
@@ -274,7 +235,6 @@ static void HP_turn_on(void) | |||
274 | HP_register_value = REG_ICDC_CDCCR1;*/ | 235 | HP_register_value = REG_ICDC_CDCCR1;*/ |
275 | 236 | ||
276 | //see 1.3.4.3 | 237 | //see 1.3.4.3 |
277 | |||
278 | } | 238 | } |
279 | 239 | ||
280 | 240 | ||
@@ -302,7 +262,49 @@ static void HP_turn_off(void) | |||
302 | REG_ICDC_CDCCR1 |= 0x00000002;*/ | 262 | REG_ICDC_CDCCR1 |= 0x00000002;*/ |
303 | 263 | ||
304 | //see 1.3.4.3 | 264 | //see 1.3.4.3 |
265 | } | ||
266 | #endif | ||
305 | 267 | ||
268 | static void i2s_codec_set_samplerate(unsigned short rate) | ||
269 | { | ||
270 | unsigned short speed = 0; | ||
271 | |||
272 | switch (rate) | ||
273 | { | ||
274 | case 8000: | ||
275 | speed = 0 << 8; | ||
276 | break; | ||
277 | case 11025: | ||
278 | speed = 1 << 8; | ||
279 | break; | ||
280 | case 12000: | ||
281 | speed = 2 << 8; | ||
282 | break; | ||
283 | case 16000: | ||
284 | speed = 3 << 8; | ||
285 | break; | ||
286 | case 22050: | ||
287 | speed = 4 << 8; | ||
288 | break; | ||
289 | case 24000: | ||
290 | speed = 5 << 8; | ||
291 | break; | ||
292 | case 32000: | ||
293 | speed = 6 << 8; | ||
294 | break; | ||
295 | case 44100: | ||
296 | speed = 7 << 8; | ||
297 | break; | ||
298 | case 48000: | ||
299 | speed = 8 << 8; | ||
300 | break; | ||
301 | default: | ||
302 | break; | ||
303 | } | ||
304 | REG_ICDC_CDCCR2 |= 0x00000f00; | ||
305 | |||
306 | speed |= 0xfffff0ff; | ||
307 | REG_ICDC_CDCCR2 &= speed; | ||
306 | } | 308 | } |
307 | 309 | ||
308 | void audiohw_mute(bool mute) | 310 | void audiohw_mute(bool mute) |
diff --git a/firmware/target/mips/ingenic_jz47xx/i2c-jz4740.c b/firmware/target/mips/ingenic_jz47xx/i2c-jz4740.c index b97448f4bb..5df0e90683 100644 --- a/firmware/target/mips/ingenic_jz47xx/i2c-jz4740.c +++ b/firmware/target/mips/ingenic_jz47xx/i2c-jz4740.c | |||
@@ -74,6 +74,7 @@ static int i2c_put_data(unsigned char data) | |||
74 | return -1; | 74 | return -1; |
75 | } | 75 | } |
76 | 76 | ||
77 | #if 0 | ||
77 | static int i2c_put_data_nack(unsigned char data) | 78 | static int i2c_put_data_nack(unsigned char data) |
78 | { | 79 | { |
79 | unsigned int timeout = TIMEOUT*10; | 80 | unsigned int timeout = TIMEOUT*10; |
@@ -86,6 +87,7 @@ static int i2c_put_data_nack(unsigned char data) | |||
86 | 87 | ||
87 | return 0; | 88 | return 0; |
88 | } | 89 | } |
90 | #endif | ||
89 | 91 | ||
90 | static int i2c_get_data(unsigned char *data, int ack) | 92 | static int i2c_get_data(unsigned char *data, int ack) |
91 | { | 93 | { |
@@ -111,13 +113,17 @@ static int i2c_get_data(unsigned char *data, int ack) | |||
111 | return -1; | 113 | return -1; |
112 | } | 114 | } |
113 | 115 | ||
116 | void i2c_setclk(unsigned int i2cclk) | ||
117 | { | ||
118 | __i2c_set_clk(__cpm_get_i2sclk(), i2cclk); | ||
119 | } | ||
120 | |||
114 | /* | 121 | /* |
115 | * I2C interface | 122 | * I2C interface |
116 | */ | 123 | */ |
117 | void i2c_open(void) | 124 | void i2c_open(void) |
118 | { | 125 | { |
119 | /* TODO */ | 126 | i2c_setclk(10000); /* default 10 KHz */ |
120 | //__i2c_set_clk(jz_clocks.extalclk, 10000); /* default 10 KHz */ | ||
121 | __i2c_enable(); | 127 | __i2c_enable(); |
122 | } | 128 | } |
123 | 129 | ||
@@ -127,12 +133,6 @@ void i2c_close(void) | |||
127 | __i2c_disable(); | 133 | __i2c_disable(); |
128 | } | 134 | } |
129 | 135 | ||
130 | void i2c_setclk(unsigned int i2cclk) | ||
131 | { | ||
132 | /* TODO */ | ||
133 | //__i2c_set_clk(jz_clocks.extalclk, i2cclk); | ||
134 | } | ||
135 | |||
136 | int i2c_read(int device, unsigned char *buf, int count) | 136 | int i2c_read(int device, unsigned char *buf, int count) |
137 | { | 137 | { |
138 | int cnt = count; | 138 | int cnt = count; |
diff --git a/firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c b/firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c index 3d93feac04..d9eb3ecdef 100644 --- a/firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c +++ b/firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c | |||
@@ -25,10 +25,9 @@ | |||
25 | #include "lcd-target.h" | 25 | #include "lcd-target.h" |
26 | #include "system.h" | 26 | #include "system.h" |
27 | #include "kernel.h" | 27 | #include "kernel.h" |
28 | #include "backlight-target.h" | ||
29 | 28 | ||
30 | /* | 29 | /* |
31 | Warning: code behaviour is unpredictable when threads get switched in IRQ mode! | 30 | Warning: code behaviour is unpredictable when switch_thread() gets called in IRQ mode! |
32 | So don't update the LCD in an interrupt handler! | 31 | So don't update the LCD in an interrupt handler! |
33 | */ | 32 | */ |
34 | 33 | ||
@@ -42,6 +41,7 @@ void lcd_init_device(void) | |||
42 | __cpm_start_lcd(); | 41 | __cpm_start_lcd(); |
43 | lcd_init_controller(); | 42 | lcd_init_controller(); |
44 | __cpm_stop_lcd(); | 43 | __cpm_stop_lcd(); |
44 | |||
45 | lcd_is_on = true; | 45 | lcd_is_on = true; |
46 | mutex_init(&lcd_mtx); | 46 | mutex_init(&lcd_mtx); |
47 | wakeup_init(&lcd_wkup); | 47 | wakeup_init(&lcd_wkup); |
@@ -71,7 +71,7 @@ bool lcd_enabled(void) | |||
71 | /* Update a fraction of the display. */ | 71 | /* Update a fraction of the display. */ |
72 | void lcd_update_rect(int x, int y, int width, int height) | 72 | void lcd_update_rect(int x, int y, int width, int height) |
73 | { | 73 | { |
74 | x=0;y=0;width=LCD_WIDTH;height=LCD_HEIGHT; | 74 | x=0;y=0;width=LCD_WIDTH;height=LCD_HEIGHT; /* HACK! */ |
75 | mutex_lock(&lcd_mtx); | 75 | mutex_lock(&lcd_mtx); |
76 | 76 | ||
77 | __cpm_start_lcd(); | 77 | __cpm_start_lcd(); |
@@ -133,12 +133,13 @@ void DMA_CALLBACK(DMA_LCD_CHANNEL)(void) | |||
133 | This must be called after all other LCD functions that change the display. */ | 133 | This must be called after all other LCD functions that change the display. */ |
134 | void lcd_update(void) | 134 | void lcd_update(void) |
135 | { | 135 | { |
136 | if (!lcd_is_on || !backlight_enabled()) | 136 | if(!lcd_is_on) |
137 | return; | 137 | return; |
138 | 138 | ||
139 | lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT); | 139 | lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT); |
140 | } | 140 | } |
141 | 141 | ||
142 | /* TODO: use IPU */ | ||
142 | void lcd_blit_yuv(unsigned char * const src[3], | 143 | void lcd_blit_yuv(unsigned char * const src[3], |
143 | int src_x, int src_y, int stride, | 144 | int src_x, int src_y, int stride, |
144 | int x, int y, int width, int height) | 145 | int x, int y, int width, int height) |
diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx747/backlight-onda_vx7X7.c b/firmware/target/mips/ingenic_jz47xx/onda_vx747/backlight-onda_vx7X7.c index eec48768b2..72e469977b 100644 --- a/firmware/target/mips/ingenic_jz47xx/onda_vx747/backlight-onda_vx7X7.c +++ b/firmware/target/mips/ingenic_jz47xx/onda_vx747/backlight-onda_vx7X7.c | |||
@@ -27,12 +27,11 @@ | |||
27 | #define BACKLIGHT_GPIO (32*3+31) | 27 | #define BACKLIGHT_GPIO (32*3+31) |
28 | #define BACKLIGHT_PWM 7 | 28 | #define BACKLIGHT_PWM 7 |
29 | 29 | ||
30 | /* TODO: use HW PWM */ | ||
30 | #define SW_PWM 1 | 31 | #define SW_PWM 1 |
31 | |||
32 | #if SW_PWM | 32 | #if SW_PWM |
33 | 33 | ||
34 | static bool backlight_on; | 34 | static bool backlight_on; |
35 | |||
36 | static void set_backlight(int val) | 35 | static void set_backlight(int val) |
37 | { | 36 | { |
38 | (void)val; | 37 | (void)val; |
@@ -48,20 +47,19 @@ bool _backlight_init(void) | |||
48 | return true; | 47 | return true; |
49 | } | 48 | } |
50 | 49 | ||
51 | bool backlight_enabled(void) | ||
52 | { | ||
53 | return backlight_on; | ||
54 | } | ||
55 | |||
56 | void _backlight_on(void) | 50 | void _backlight_on(void) |
57 | { | 51 | { |
58 | __gpio_set_pin(BACKLIGHT_GPIO); | 52 | if(!backlight_on) |
53 | __gpio_set_pin(BACKLIGHT_GPIO); | ||
54 | |||
59 | backlight_on = true; | 55 | backlight_on = true; |
60 | } | 56 | } |
61 | 57 | ||
62 | void _backlight_off(void) | 58 | void _backlight_off(void) |
63 | { | 59 | { |
64 | __gpio_clear_pin(BACKLIGHT_GPIO); | 60 | if(backlight_on) |
61 | __gpio_clear_pin(BACKLIGHT_GPIO); | ||
62 | |||
65 | backlight_on = false; | 63 | backlight_on = false; |
66 | } | 64 | } |
67 | 65 | ||
@@ -131,11 +129,6 @@ bool _backlight_init(void) | |||
131 | return true; | 129 | return true; |
132 | } | 130 | } |
133 | 131 | ||
134 | bool backlight_enabled(void) | ||
135 | { | ||
136 | return old_val > -1 ? true : false; | ||
137 | } | ||
138 | |||
139 | void _backlight_on(void) | 132 | void _backlight_on(void) |
140 | { | 133 | { |
141 | set_backlight_on(); | 134 | set_backlight_on(); |
diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx747/backlight-target.h b/firmware/target/mips/ingenic_jz47xx/onda_vx747/backlight-target.h index c6647fa9da..4170f96cc0 100644 --- a/firmware/target/mips/ingenic_jz47xx/onda_vx747/backlight-target.h +++ b/firmware/target/mips/ingenic_jz47xx/onda_vx747/backlight-target.h | |||
@@ -29,12 +29,9 @@ | |||
29 | 29 | ||
30 | #include <stdbool.h> | 30 | #include <stdbool.h> |
31 | 31 | ||
32 | /* | ||
33 | bool _backlight_init(void); | 32 | bool _backlight_init(void); |
34 | void _backlight_on(void); | 33 | void _backlight_on(void); |
35 | void _backlight_off(void); | 34 | void _backlight_off(void); |
36 | void _backlight_set_brightness(int brightness); | 35 | void _backlight_set_brightness(int brightness); |
37 | bool backlight_enabled(void); | ||
38 | */ | ||
39 | 36 | ||
40 | #endif /* BACKLIGHT_TARGET_H */ | 37 | #endif /* BACKLIGHT_TARGET_H */ |
diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c b/firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c index 3dce73b05e..c9c264e26a 100644 --- a/firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c +++ b/firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c | |||
@@ -71,36 +71,36 @@ static struct mutex battery_mtx; | |||
71 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = | 71 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = |
72 | { | 72 | { |
73 | /* TODO */ | 73 | /* TODO */ |
74 | 1400 | 74 | 1000 |
75 | }; | 75 | }; |
76 | 76 | ||
77 | const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = | 77 | const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = |
78 | { | 78 | { |
79 | /* TODO */ | 79 | /* TODO */ |
80 | 1300 | 80 | 900 |
81 | }; | 81 | }; |
82 | 82 | ||
83 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ | 83 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ |
84 | const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = | 84 | const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = |
85 | { | 85 | { |
86 | /* TODO */ | 86 | /* TODO */ |
87 | { 1300, 3680, 3740, 3760, 3780, 3810, 3870, 3930, 3970, 4070, 4160 }, | 87 | { 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000 }, |
88 | }; | 88 | }; |
89 | 89 | ||
90 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ | 90 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ |
91 | const unsigned short percent_to_volt_charge[11] = | 91 | const unsigned short percent_to_volt_charge[11] = |
92 | { | 92 | { |
93 | /* TODO */ | 93 | /* TODO */ |
94 | 3300, 3680, 3740, 3760, 3780, 3810, 3870, 3930, 3970, 4070, 4160 | 94 | 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000 |
95 | }; | 95 | }; |
96 | 96 | ||
97 | /* VBAT = (BDATA/4096) * 7.5V */ | 97 | /* VBAT = (BDATA/4096) * 7.5V */ |
98 | #define BATTERY_SCALE_FACTOR 7500 | 98 | #define BATTERY_SCALE_FACTOR 1875 |
99 | 99 | ||
100 | /* Returns battery voltage from ADC [millivolts] */ | 100 | /* Returns battery voltage from ADC [millivolts] */ |
101 | unsigned int battery_adc_voltage(void) | 101 | unsigned int battery_adc_voltage(void) |
102 | { | 102 | { |
103 | unsigned int dummy, timeout=1000; | 103 | unsigned int dummy, timeout=HZ/4; |
104 | 104 | ||
105 | mutex_lock(&battery_mtx); | 105 | mutex_lock(&battery_mtx); |
106 | 106 | ||
@@ -114,18 +114,18 @@ unsigned int battery_adc_voltage(void) | |||
114 | while(bat_val == 0 && timeout--) | 114 | while(bat_val == 0 && timeout--) |
115 | sleep(0); | 115 | sleep(0); |
116 | 116 | ||
117 | logf("%d %d", bat_val, (bat_val*BATTERY_SCALE_FACTOR)>>12); | 117 | logf("%d %d", bat_val, (bat_val*BATTERY_SCALE_FACTOR)>>10); |
118 | 118 | ||
119 | mutex_unlock(&battery_mtx); | 119 | mutex_unlock(&battery_mtx); |
120 | 120 | ||
121 | return (bat_val*BATTERY_SCALE_FACTOR)>>12; | 121 | return (bat_val*BATTERY_SCALE_FACTOR)>>10; |
122 | } | 122 | } |
123 | 123 | ||
124 | void button_init_device(void) | 124 | void button_init_device(void) |
125 | { | 125 | { |
126 | __cpm_start_sadc(); | 126 | __cpm_start_sadc(); |
127 | REG_SADC_ENA = 0; | 127 | REG_SADC_ENA = 0; |
128 | REG_SADC_STATE &= (~REG_SADC_STATE); | 128 | REG_SADC_STATE &= ~REG_SADC_STATE; |
129 | REG_SADC_CTRL = 0x1F; | 129 | REG_SADC_CTRL = 0x1F; |
130 | 130 | ||
131 | REG_SADC_CFG = SADC_CFG_INIT; | 131 | REG_SADC_CFG = SADC_CFG_INIT; |
@@ -134,8 +134,8 @@ void button_init_device(void) | |||
134 | 134 | ||
135 | REG_SADC_SAMETIME = 10; | 135 | REG_SADC_SAMETIME = 10; |
136 | REG_SADC_WAITTIME = 100; | 136 | REG_SADC_WAITTIME = 100; |
137 | REG_SADC_STATE &= (~REG_SADC_STATE); | 137 | REG_SADC_STATE &= ~REG_SADC_STATE; |
138 | REG_SADC_CTRL = (~(SADC_CTRL_PENDM | SADC_CTRL_PENUM | SADC_CTRL_TSRDYM | SADC_CTRL_PBATRDYM)); | 138 | REG_SADC_CTRL = ~(SADC_CTRL_PENDM | SADC_CTRL_PENUM | SADC_CTRL_TSRDYM | SADC_CTRL_PBATRDYM); |
139 | REG_SADC_ENA = SADC_ENA_TSEN; | 139 | REG_SADC_ENA = SADC_ENA_TSEN; |
140 | 140 | ||
141 | #ifdef ONDA_VX747 | 141 | #ifdef ONDA_VX747 |
@@ -192,6 +192,9 @@ int button_read_device(int *data) | |||
192 | if( UNLIKELY(!is_backlight_on(true)) ) | 192 | if( UNLIKELY(!is_backlight_on(true)) ) |
193 | *data = 0; | 193 | *data = 0; |
194 | } | 194 | } |
195 | |||
196 | if(ret & (BUTTON_VOL_DOWN|BUTTON_VOL_UP)) | ||
197 | touchscreen_set_mode( touchscreen_get_mode() == TOUCHSCREEN_BUTTON ? TOUCHSCREEN_POINT : TOUCHSCREEN_BUTTON); | ||
195 | 198 | ||
196 | return ret; | 199 | return ret; |
197 | } | 200 | } |
@@ -205,7 +208,7 @@ void SADC(void) | |||
205 | sadcstate = REG_SADC_STATE; | 208 | sadcstate = REG_SADC_STATE; |
206 | state = REG_SADC_STATE & (~REG_SADC_CTRL); | 209 | state = REG_SADC_STATE & (~REG_SADC_CTRL); |
207 | REG_SADC_STATE &= sadcstate; | 210 | REG_SADC_STATE &= sadcstate; |
208 | 211 | ||
209 | if(state & SADC_CTRL_PENDM) | 212 | if(state & SADC_CTRL_PENDM) |
210 | { | 213 | { |
211 | /* Pen down IRQ */ | 214 | /* Pen down IRQ */ |