summaryrefslogtreecommitdiff
path: root/firmware/target/mips
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/mips')
-rw-r--r--firmware/target/mips/ingenic_jz47xx/onda_vx747/backlight-onda_vx7X7.c22
1 files changed, 11 insertions, 11 deletions
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 e59f1812c1..48c4e2e636 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
@@ -32,23 +32,20 @@
32 * [PWM half rate, PWM full rate[ -> backlight on 32 * [PWM half rate, PWM full rate[ -> backlight on
33 * [PWM full rate, PWM full rate] -> counter reset to 0 33 * [PWM full rate, PWM full rate] -> counter reset to 0
34 */ 34 */
35static int old_val; 35static int old_val = MAX_BRIGHTNESS_SETTING;
36static const unsigned char logtable[] = {255, 254, 253, 252, 250, 248, 245, 240, 233, 224, 211, 192, 165, 128, 75, 0};
36static void set_backlight(int val) 37static void set_backlight(int val)
37{ 38{
38 /* The pulse repetition frequency should be greater than 100Hz so 39 if(val == old_val)
39 the flickering is not perceptible to the human eye but 40 return;
40 not greater than about 1kHz. */
41 41
42 /* Clock = 32 768 Hz */ 42 /* Clock = 32 768 Hz */
43 /* 1 <= val <= 30 */
44 int cycle = (MAX_BRIGHTNESS_SETTING - val + 1);
45
46 __tcu_disable_pwm_output(BACKLIGHT_PWM); 43 __tcu_disable_pwm_output(BACKLIGHT_PWM);
47 __tcu_stop_counter(BACKLIGHT_PWM); 44 __tcu_stop_counter(BACKLIGHT_PWM);
48 45
49 __tcu_set_count(BACKLIGHT_PWM, 0); 46 __tcu_set_count(BACKLIGHT_PWM, 0);
50 __tcu_set_half_data(BACKLIGHT_PWM, cycle-1); 47 __tcu_set_half_data(BACKLIGHT_PWM, logtable[val]);
51 __tcu_set_full_data(BACKLIGHT_PWM, cycle); 48 __tcu_set_full_data(BACKLIGHT_PWM, 256);
52 49
53 __tcu_start_counter(BACKLIGHT_PWM); 50 __tcu_start_counter(BACKLIGHT_PWM);
54 __tcu_enable_pwm_output(BACKLIGHT_PWM); 51 __tcu_enable_pwm_output(BACKLIGHT_PWM);
@@ -58,7 +55,8 @@ static void set_backlight(int val)
58 55
59static void set_backlight_on(void) 56static void set_backlight_on(void)
60{ 57{
61 set_backlight(old_val); 58 __tcu_start_counter(BACKLIGHT_PWM);
59 __tcu_enable_pwm_output(BACKLIGHT_PWM);
62} 60}
63 61
64static void set_backlight_off(void) 62static void set_backlight_off(void)
@@ -83,7 +81,9 @@ bool _backlight_init(void)
83 __tcu_mask_half_match_irq(BACKLIGHT_PWM); 81 __tcu_mask_half_match_irq(BACKLIGHT_PWM);
84 __tcu_mask_full_match_irq(BACKLIGHT_PWM); 82 __tcu_mask_full_match_irq(BACKLIGHT_PWM);
85 83
86 old_val = MAX_BRIGHTNESS_SETTING; 84 __tcu_set_count(BACKLIGHT_PWM, 0);
85 __tcu_set_half_data(BACKLIGHT_PWM, 0);
86 __tcu_set_full_data(BACKLIGHT_PWM, 256);
87 87
88 return true; 88 return true;
89} 89}