diff options
Diffstat (limited to 'firmware/target/coldfire')
4 files changed, 24 insertions, 0 deletions
diff --git a/firmware/target/coldfire/iaudio/x5/backlight-target.h b/firmware/target/coldfire/iaudio/x5/backlight-target.h index 262650ae24..e982e656d6 100755 --- a/firmware/target/coldfire/iaudio/x5/backlight-target.h +++ b/firmware/target/coldfire/iaudio/x5/backlight-target.h @@ -21,6 +21,7 @@ void __backlight_on(void); void __backlight_off(void); +void __backlight_set_brightness(int val); void __remote_backlight_on(void); void __remote_backlight_off(void); diff --git a/firmware/target/coldfire/iaudio/x5/backlight-x5.c b/firmware/target/coldfire/iaudio/x5/backlight-x5.c index 70a5d957b6..9d02c35988 100755 --- a/firmware/target/coldfire/iaudio/x5/backlight-x5.c +++ b/firmware/target/coldfire/iaudio/x5/backlight-x5.c @@ -40,6 +40,16 @@ void __backlight_off(void) lcd_enable(false); } +/* set brightness by changing the PWM */ +void __backlight_set_brightness(int val) +{ + /* disable IRQs while bitbanging */ + int old_irq_level = set_irq_level(HIGHEST_IRQ_LEVEL); + pcf50606_write(0x35, (val << 1) | 0x01); /* 512Hz, Enable PWM */ + /* enable IRQs again */ + set_irq_level(old_irq_level); +} + void __remote_backlight_on(void) { and_l(~0x00200000, &GPIO_OUT); diff --git a/firmware/target/coldfire/iriver/backlight-target.h b/firmware/target/coldfire/iriver/backlight-target.h index 262650ae24..086ab02761 100644 --- a/firmware/target/coldfire/iriver/backlight-target.h +++ b/firmware/target/coldfire/iriver/backlight-target.h @@ -21,6 +21,9 @@ void __backlight_on(void); void __backlight_off(void); +#ifdef HAVE_BACKLIGHT_BRIGHTNESS +void __backlight_set_brightness(int val); +#endif void __remote_backlight_on(void); void __remote_backlight_off(void); diff --git a/firmware/target/coldfire/iriver/h300/backlight-h300.c b/firmware/target/coldfire/iriver/h300/backlight-h300.c index d5322c2cf7..50bd757612 100644 --- a/firmware/target/coldfire/iriver/h300/backlight-h300.c +++ b/firmware/target/coldfire/iriver/h300/backlight-h300.c @@ -38,6 +38,16 @@ void __backlight_off(void) lcd_enable(false); } +/* set brightness by changing the PWM */ +void __backlight_set_brightness(int val) +{ + /* disable IRQs while bitbanging */ + int old_irq_level = set_irq_level(HIGHEST_IRQ_LEVEL); + pcf50606_write(0x35, (val << 1) | 0x01); /* 512Hz, Enable PWM */ + /* enable IRQs again */ + set_irq_level(old_irq_level); +} + void __remote_backlight_on(void) { and_l(~0x00000002, &GPIO1_OUT); |