diff options
author | Rob Purchase <shotofadds@rockbox.org> | 2009-10-10 17:35:02 +0000 |
---|---|---|
committer | Rob Purchase <shotofadds@rockbox.org> | 2009-10-10 17:35:02 +0000 |
commit | 16ada4cb81c70c1a151c69aa08da13e55aba0081 (patch) | |
tree | c92dda004a162cea1d2ded3188cffe1ca6f04077 /firmware/target/arm/tcc780x/cowond2/backlight-cowond2.c | |
parent | 31464f7930cd8857ef8d00ed75534087057058e2 (diff) | |
download | rockbox-16ada4cb81c70c1a151c69aa08da13e55aba0081.tar.gz rockbox-16ada4cb81c70c1a151c69aa08da13e55aba0081.zip |
Initial support for runtime detection of the PMU used in newer D2+ models (PCF50635). The backlight and battery monitoring should work, but the RTC and touchscreen are not yet implemented.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23078 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/tcc780x/cowond2/backlight-cowond2.c')
-rw-r--r-- | firmware/target/arm/tcc780x/cowond2/backlight-cowond2.c | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/firmware/target/arm/tcc780x/cowond2/backlight-cowond2.c b/firmware/target/arm/tcc780x/cowond2/backlight-cowond2.c index 39a9abf073..d417687804 100644 --- a/firmware/target/arm/tcc780x/cowond2/backlight-cowond2.c +++ b/firmware/target/arm/tcc780x/cowond2/backlight-cowond2.c | |||
@@ -22,7 +22,9 @@ | |||
22 | #include "system.h" | 22 | #include "system.h" |
23 | #include "backlight.h" | 23 | #include "backlight.h" |
24 | #include "pcf50606.h" | 24 | #include "pcf50606.h" |
25 | #include "pcf50635.h" | ||
25 | #include "tcc780x.h" | 26 | #include "tcc780x.h" |
27 | #include "power-target.h" | ||
26 | 28 | ||
27 | int _backlight_init(void) | 29 | int _backlight_init(void) |
28 | { | 30 | { |
@@ -35,17 +37,49 @@ int _backlight_init(void) | |||
35 | void _backlight_set_brightness(int brightness) | 37 | void _backlight_set_brightness(int brightness) |
36 | { | 38 | { |
37 | int level = disable_irq_save(); | 39 | int level = disable_irq_save(); |
38 | pcf50606_write(PCF5060X_PWMC1, 0xe1 | (MAX_BRIGHTNESS_SETTING-brightness)<<1); | 40 | |
39 | pcf50606_write(PCF5060X_GPOC1, 0x3); | 41 | if (get_pmu_type() == PCF50606) |
42 | { | ||
43 | pcf50606_write(PCF5060X_PWMC1, | ||
44 | 0xe1 | (MAX_BRIGHTNESS_SETTING-brightness)<<1); | ||
45 | pcf50606_write(PCF5060X_GPOC1, 0x3); | ||
46 | } | ||
47 | else | ||
48 | { | ||
49 | static const int brightness_lookup[MAX_BRIGHTNESS_SETTING+1] = | ||
50 | {0x1, 0x8, 0xa, 0xe, 0x12, 0x16, 0x19, 0x1b, 0x1e, | ||
51 | 0x21, 0x24, 0x26, 0x28, 0x2a, 0x2c}; | ||
52 | |||
53 | pcf50635_write(PCF5063X_REG_LEDOUT, brightness_lookup[brightness]); | ||
54 | } | ||
55 | |||
40 | restore_irq(level); | 56 | restore_irq(level); |
41 | } | 57 | } |
42 | 58 | ||
43 | void _backlight_on(void) | 59 | void _backlight_on(void) |
44 | { | 60 | { |
45 | GPIOA_SET = (1<<6); | 61 | if (get_pmu_type() == PCF50606) |
62 | { | ||
63 | GPIOA_SET = (1<<6); | ||
64 | } | ||
65 | else | ||
66 | { | ||
67 | int level = disable_irq_save(); | ||
68 | pcf50635_write(PCF5063X_REG_LEDENA, 1); | ||
69 | restore_irq(level); | ||
70 | } | ||
46 | } | 71 | } |
47 | 72 | ||
48 | void _backlight_off(void) | 73 | void _backlight_off(void) |
49 | { | 74 | { |
50 | GPIOA_CLEAR = (1<<6); | 75 | if (get_pmu_type() == PCF50606) |
76 | { | ||
77 | GPIOA_CLEAR = (1<<6); | ||
78 | } | ||
79 | else | ||
80 | { | ||
81 | int level = disable_irq_save(); | ||
82 | pcf50635_write(PCF5063X_REG_LEDENA, 0); | ||
83 | restore_irq(level); | ||
84 | } | ||
51 | } | 85 | } |