diff options
author | Steve Bavin <pondlife@pondlife.me> | 2007-02-01 10:47:22 +0000 |
---|---|---|
committer | Steve Bavin <pondlife@pondlife.me> | 2007-02-01 10:47:22 +0000 |
commit | 338d94f4661643dcd4c6440aa1c12af6933da4a5 (patch) | |
tree | 966f0bf5dcc7f4ccb71c266317adedd5705c5d2f | |
parent | 73ee2379c5361126d6fb9754845fc9e249614e40 (diff) | |
download | rockbox-338d94f4661643dcd4c6440aa1c12af6933da4a5.tar.gz rockbox-338d94f4661643dcd4c6440aa1c12af6933da4a5.zip |
FS#4770 - Add USB charging for the H300 series
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12169 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/debug_menu.c | 21 | ||||
-rw-r--r-- | apps/gui/statusbar.c | 4 | ||||
-rw-r--r-- | apps/gui/statusbar.h | 2 | ||||
-rw-r--r-- | apps/lang/deutsch.lang | 14 | ||||
-rw-r--r-- | apps/lang/english.lang | 14 | ||||
-rw-r--r-- | apps/settings.h | 6 | ||||
-rw-r--r-- | apps/settings_list.c | 6 | ||||
-rw-r--r-- | apps/settings_menu.c | 27 | ||||
-rw-r--r-- | firmware/export/pcf50606.h | 5 | ||||
-rw-r--r-- | firmware/export/usb.h | 4 | ||||
-rw-r--r-- | firmware/powermgmt.c | 5 | ||||
-rw-r--r-- | firmware/target/coldfire/iriver/h300/pcf50606-h300.c | 26 | ||||
-rw-r--r-- | firmware/usb.c | 38 |
13 files changed, 167 insertions, 5 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index c5240d0de8..99c00fa1eb 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c | |||
@@ -78,6 +78,9 @@ | |||
78 | #include "spdif.h" | 78 | #include "spdif.h" |
79 | #endif | 79 | #endif |
80 | #endif | 80 | #endif |
81 | #ifdef IRIVER_H300_SERIES | ||
82 | #include "pcf50606.h" /* for pcf50606_read */ | ||
83 | #endif | ||
81 | 84 | ||
82 | #ifdef IAUDIO_X5 | 85 | #ifdef IAUDIO_X5 |
83 | #include "lcd-remote-target.h" | 86 | #include "lcd-remote-target.h" |
@@ -1059,6 +1062,16 @@ bool dbg_ports(void) | |||
1059 | lcd_puts(0, line++, buf); | 1062 | lcd_puts(0, line++, buf); |
1060 | snprintf(buf, sizeof(buf), "GPIO1_ENABLE: %08x", gpio1_enable); | 1063 | snprintf(buf, sizeof(buf), "GPIO1_ENABLE: %08x", gpio1_enable); |
1061 | lcd_puts(0, line++, buf); | 1064 | lcd_puts(0, line++, buf); |
1065 | #if defined(IRIVER_H300_SERIES) | ||
1066 | snprintf(buf, sizeof(buf), "GPOOD0: %08x", (unsigned int)pcf50606_read(0x37)); | ||
1067 | lcd_puts(0, line++, buf); | ||
1068 | snprintf(buf, sizeof(buf), "GPOOD1: %08x", (unsigned int)pcf50606_read(0x38)); | ||
1069 | lcd_puts(0, line++, buf); | ||
1070 | snprintf(buf, sizeof(buf), "GPOOD2: %08x", (unsigned int)pcf50606_read(0x39)); | ||
1071 | lcd_puts(0, line++, buf); | ||
1072 | snprintf(buf, sizeof(buf), "GPOOD3: %08x", (unsigned int)pcf50606_read(0x3A)); | ||
1073 | lcd_puts(0, line++, buf); | ||
1074 | #endif | ||
1062 | 1075 | ||
1063 | adc_buttons = adc_read(ADC_BUTTONS); | 1076 | adc_buttons = adc_read(ADC_BUTTONS); |
1064 | adc_remote = adc_read(ADC_REMOTE); | 1077 | adc_remote = adc_read(ADC_REMOTE); |
@@ -1422,6 +1435,14 @@ static bool view_battery(void) | |||
1422 | snprintf(buf, 30, "long delta: %d", long_delta); | 1435 | snprintf(buf, 30, "long delta: %d", long_delta); |
1423 | lcd_puts(0, 6, buf); | 1436 | lcd_puts(0, 6, buf); |
1424 | lcd_puts(0, 7, power_message); | 1437 | lcd_puts(0, 7, power_message); |
1438 | snprintf(buf, 30, "USB Inserted: %s", | ||
1439 | usb_inserted() ? "yes" : "no"); | ||
1440 | lcd_puts(0, 8, buf); | ||
1441 | #if defined IRIVER_H300_SERIES | ||
1442 | snprintf(buf, 30, "USB Charging Enabled: %s", | ||
1443 | usb_charging_enabled() ? "yes" : "no"); | ||
1444 | lcd_puts(0, 9, buf); | ||
1445 | #endif | ||
1425 | #else /* CONFIG_CHARGING != CHARGING_CONTROL */ | 1446 | #else /* CONFIG_CHARGING != CHARGING_CONTROL */ |
1426 | #if defined IPOD_NANO || defined IPOD_VIDEO | 1447 | #if defined IPOD_NANO || defined IPOD_VIDEO |
1427 | int usb_pwr = (GPIOL_INPUT_VAL & 0x10)?true:false; | 1448 | int usb_pwr = (GPIOL_INPUT_VAL & 0x10)?true:false; |
diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c index ae8bba0538..2f6dfafc81 100644 --- a/apps/gui/statusbar.c +++ b/apps/gui/statusbar.c | |||
@@ -143,7 +143,7 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) | |||
143 | 143 | ||
144 | bar->info.battlevel = battery_level(); | 144 | bar->info.battlevel = battery_level(); |
145 | #ifdef HAVE_USB_POWER | 145 | #ifdef HAVE_USB_POWER |
146 | bar->info.usb_power = usb_powered(); | 146 | bar->info.usb_inserted = usb_inserted(); |
147 | #endif | 147 | #endif |
148 | #ifdef CONFIG_CHARGING | 148 | #ifdef CONFIG_CHARGING |
149 | bar->info.inserted = (charger_input_state == CHARGER); | 149 | bar->info.inserted = (charger_input_state == CHARGER); |
@@ -238,7 +238,7 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) | |||
238 | gui_statusbar_icon_battery(display, bar->info.battlevel, | 238 | gui_statusbar_icon_battery(display, bar->info.battlevel, |
239 | bar->info.batt_charge_step); | 239 | bar->info.batt_charge_step); |
240 | #ifdef HAVE_USB_POWER | 240 | #ifdef HAVE_USB_POWER |
241 | if (bar->info.usb_power) | 241 | if (bar->info.usb_inserted) |
242 | display->mono_bitmap(bitmap_icons_7x8[Icon_USBPlug], | 242 | display->mono_bitmap(bitmap_icons_7x8[Icon_USBPlug], |
243 | STATUSBAR_PLUG_X_POS, | 243 | STATUSBAR_PLUG_X_POS, |
244 | STATUSBAR_Y_POS, STATUSBAR_PLUG_WIDTH, | 244 | STATUSBAR_Y_POS, STATUSBAR_PLUG_WIDTH, |
diff --git a/apps/gui/statusbar.h b/apps/gui/statusbar.h index 5ab97d09ea..516598dd00 100644 --- a/apps/gui/statusbar.h +++ b/apps/gui/statusbar.h | |||
@@ -44,7 +44,7 @@ struct status_info { | |||
44 | bool inserted; | 44 | bool inserted; |
45 | #endif | 45 | #endif |
46 | #ifdef HAVE_USB_POWER | 46 | #ifdef HAVE_USB_POWER |
47 | bool usb_power; | 47 | bool usb_inserted; |
48 | #endif | 48 | #endif |
49 | bool battery_state; | 49 | bool battery_state; |
50 | bool shuffle; | 50 | bool shuffle; |
diff --git a/apps/lang/deutsch.lang b/apps/lang/deutsch.lang index d9481b9dca..4ae438f64d 100644 --- a/apps/lang/deutsch.lang +++ b/apps/lang/deutsch.lang | |||
@@ -3570,6 +3570,20 @@ | |||
3570 | </voice> | 3570 | </voice> |
3571 | </phrase> | 3571 | </phrase> |
3572 | <phrase> | 3572 | <phrase> |
3573 | id: LANG_USB_CHARGING | ||
3574 | desc: in Battery menu | ||
3575 | user: | ||
3576 | <source> | ||
3577 | *: "Charge During USB Connection" | ||
3578 | </source> | ||
3579 | <dest> | ||
3580 | *: "Laden bei USB-Verbindung" | ||
3581 | </dest> | ||
3582 | <voice> | ||
3583 | *: "Laden bei U S B Verbindung" | ||
3584 | </voice> | ||
3585 | </phrase> | ||
3586 | <phrase> | ||
3573 | id: LANG_DISPLAY_GRAPHIC | 3587 | id: LANG_DISPLAY_GRAPHIC |
3574 | desc: Label for type of icon display | 3588 | desc: Label for type of icon display |
3575 | user: | 3589 | user: |
diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 3f1fb11b35..e9c9f4c50c 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang | |||
@@ -3611,6 +3611,20 @@ | |||
3611 | </voice> | 3611 | </voice> |
3612 | </phrase> | 3612 | </phrase> |
3613 | <phrase> | 3613 | <phrase> |
3614 | id: LANG_USB_CHARGING | ||
3615 | desc: in Battery menu | ||
3616 | user: | ||
3617 | <source> | ||
3618 | *: "Charge During USB Connection" | ||
3619 | </source> | ||
3620 | <dest> | ||
3621 | *: "Charge During USB Connection" | ||
3622 | </dest> | ||
3623 | <voice> | ||
3624 | *: "Charge During U S B Connection" | ||
3625 | </voice> | ||
3626 | </phrase> | ||
3627 | <phrase> | ||
3614 | id: LANG_DISPLAY_GRAPHIC | 3628 | id: LANG_DISPLAY_GRAPHIC |
3615 | desc: Label for type of icon display | 3629 | desc: Label for type of icon display |
3616 | user: | 3630 | user: |
diff --git a/apps/settings.h b/apps/settings.h index 7b7f91abe0..e8db3289a1 100644 --- a/apps/settings.h +++ b/apps/settings.h | |||
@@ -611,6 +611,12 @@ struct user_settings | |||
611 | unsigned char kbd_file[MAX_FILENAME+1]; /* last keyboard */ | 611 | unsigned char kbd_file[MAX_FILENAME+1]; /* last keyboard */ |
612 | #endif | 612 | #endif |
613 | 613 | ||
614 | #ifdef HAVE_USB_POWER | ||
615 | #ifdef CONFIG_CHARGING | ||
616 | bool usb_charging; | ||
617 | #endif | ||
618 | #endif | ||
619 | |||
614 | #ifdef HAVE_WM8758 | 620 | #ifdef HAVE_WM8758 |
615 | bool eq_hw_enabled; /* Enable hardware equalizer */ | 621 | bool eq_hw_enabled; /* Enable hardware equalizer */ |
616 | 622 | ||
diff --git a/apps/settings_list.c b/apps/settings_list.c index a0651be4f3..6243607264 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c | |||
@@ -690,7 +690,11 @@ const struct settings_list settings[] = { | |||
690 | #ifdef HAVE_LCD_BITMAP | 690 | #ifdef HAVE_LCD_BITMAP |
691 | FILENAME_SETTING(0,kbd_file,"kbd","",ROCKBOX_DIR "/",".kbd",MAX_FILENAME+1), | 691 | FILENAME_SETTING(0,kbd_file,"kbd","",ROCKBOX_DIR "/",".kbd",MAX_FILENAME+1), |
692 | #endif | 692 | #endif |
693 | 693 | #ifdef HAVE_USB_POWER | |
694 | #ifdef CONFIG_CHARGING | ||
695 | OFFON_SETTING(0,usb_charging,LANG_USB_CHARGING,false,"usb charging",NULL), | ||
696 | #endif | ||
697 | #endif | ||
694 | }; | 698 | }; |
695 | 699 | ||
696 | const int nb_settings = sizeof(settings)/sizeof(*settings); | 700 | const int nb_settings = sizeof(settings)/sizeof(*settings); |
diff --git a/apps/settings_menu.c b/apps/settings_menu.c index 0b599ca0c6..b1204e2c1a 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c | |||
@@ -405,6 +405,12 @@ static bool clear_main_backdrop(void) | |||
405 | } | 405 | } |
406 | #endif | 406 | #endif |
407 | 407 | ||
408 | #ifdef HAVE_USB_POWER | ||
409 | #ifdef CONFIG_CHARGING | ||
410 | #include "usb.h" | ||
411 | #endif | ||
412 | #endif | ||
413 | |||
408 | #ifdef HAVE_LCD_COLOR | 414 | #ifdef HAVE_LCD_COLOR |
409 | /** | 415 | /** |
410 | * Menu for fore/back colors | 416 | * Menu for fore/back colors |
@@ -444,6 +450,22 @@ static bool reset_color(void) | |||
444 | } | 450 | } |
445 | #endif | 451 | #endif |
446 | 452 | ||
453 | #ifdef HAVE_USB_POWER | ||
454 | #ifdef CONFIG_CHARGING | ||
455 | /** | ||
456 | * Menu to switch the USB charging on or off | ||
457 | */ | ||
458 | static bool usb_charging(void) | ||
459 | { | ||
460 | bool rc = set_bool(str(LANG_USB_CHARGING), | ||
461 | &global_settings.usb_charging); | ||
462 | /* if (usb_charging_enabled() != global_settings.usb_charging) */ | ||
463 | usb_charging_enable(global_settings.usb_charging); | ||
464 | return rc; | ||
465 | } | ||
466 | #endif | ||
467 | #endif | ||
468 | |||
447 | /** | 469 | /** |
448 | * Menu to configure the battery display on status bar | 470 | * Menu to configure the battery display on status bar |
449 | */ | 471 | */ |
@@ -2083,6 +2105,11 @@ static bool battery_settings_menu(void) | |||
2083 | #if BATTERY_TYPES_COUNT > 1 | 2105 | #if BATTERY_TYPES_COUNT > 1 |
2084 | { ID2P(LANG_BATTERY_TYPE), battery_type }, | 2106 | { ID2P(LANG_BATTERY_TYPE), battery_type }, |
2085 | #endif | 2107 | #endif |
2108 | #ifdef HAVE_USB_POWER | ||
2109 | #ifdef CONFIG_CHARGING | ||
2110 | { ID2P(LANG_USB_CHARGING), usb_charging }, | ||
2111 | #endif | ||
2112 | #endif | ||
2086 | #else | 2113 | #else |
2087 | { "Dummy", NULL }, /* to have an entry at all, in the simulator */ | 2114 | { "Dummy", NULL }, /* to have an entry at all, in the simulator */ |
2088 | #endif | 2115 | #endif |
diff --git a/firmware/export/pcf50606.h b/firmware/export/pcf50606.h index 1f4b6ba3ad..f01df520cf 100644 --- a/firmware/export/pcf50606.h +++ b/firmware/export/pcf50606.h | |||
@@ -24,6 +24,8 @@ int pcf50606_write_multiple(int address, const unsigned char* buf, int count); | |||
24 | int pcf50606_write(int address, unsigned char val); | 24 | int pcf50606_write(int address, unsigned char val); |
25 | int pcf50606_read_multiple(int address, unsigned char* buf, int count); | 25 | int pcf50606_read_multiple(int address, unsigned char* buf, int count); |
26 | int pcf50606_read(int address); | 26 | int pcf50606_read(int address); |
27 | void pcf50606_set_usb_charging(bool on); | ||
28 | bool pcf50606_usb_charging_enabled(void); | ||
27 | 29 | ||
28 | /* internal low level calls used by the eeprom driver for h300 */ | 30 | /* internal low level calls used by the eeprom driver for h300 */ |
29 | void pcf50606_i2c_init(void); | 31 | void pcf50606_i2c_init(void); |
@@ -32,8 +34,11 @@ void pcf50606_i2c_start(void); | |||
32 | void pcf50606_i2c_stop(void); | 34 | void pcf50606_i2c_stop(void); |
33 | void pcf50606_i2c_ack(bool ack); | 35 | void pcf50606_i2c_ack(bool ack); |
34 | bool pcf50606_i2c_getack(void); | 36 | bool pcf50606_i2c_getack(void); |
37 | #if defined(IRIVER_H300_SERIES) | ||
38 | /* USB charging support */ | ||
35 | void pcf50606_i2c_outb(unsigned char byte); | 39 | void pcf50606_i2c_outb(unsigned char byte); |
36 | unsigned char pcf50606_i2c_inb(bool ack); | 40 | unsigned char pcf50606_i2c_inb(bool ack); |
41 | #endif | ||
37 | 42 | ||
38 | #if defined(IAUDIO_X5) && !defined(SIMULATOR) | 43 | #if defined(IAUDIO_X5) && !defined(SIMULATOR) |
39 | void pcf50606_reset_timeout(void); | 44 | void pcf50606_reset_timeout(void); |
diff --git a/firmware/export/usb.h b/firmware/export/usb.h index b16c11a9b8..622db35543 100644 --- a/firmware/export/usb.h +++ b/firmware/export/usb.h | |||
@@ -31,6 +31,10 @@ bool usb_inserted(void); /* return the official value, what's been reported to t | |||
31 | bool usb_detect(void); /* return the raw hardware value */ | 31 | bool usb_detect(void); /* return the raw hardware value */ |
32 | #ifdef HAVE_USB_POWER | 32 | #ifdef HAVE_USB_POWER |
33 | bool usb_powered(void); | 33 | bool usb_powered(void); |
34 | #ifdef CONFIG_CHARGING | ||
35 | bool usb_charging_enable(bool on); | ||
36 | bool usb_charging_enabled(void); | ||
37 | #endif | ||
34 | #endif | 38 | #endif |
35 | 39 | ||
36 | #endif | 40 | #endif |
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c index 5c7607413c..1b160af232 100644 --- a/firmware/powermgmt.c +++ b/firmware/powermgmt.c | |||
@@ -759,8 +759,11 @@ static void power_thread_sleep(int ticks) | |||
759 | * transition to the appropriate steady state charger on/off state. | 759 | * transition to the appropriate steady state charger on/off state. |
760 | */ | 760 | */ |
761 | if(charger_inserted() | 761 | if(charger_inserted() |
762 | #ifdef HAVE_USB_POWER | 762 | #ifdef HAVE_USB_POWER /* USB powered or USB inserted both provide power */ |
763 | || usb_powered() | 763 | || usb_powered() |
764 | #ifdef CONFIG_CHARGING | ||
765 | || (usb_inserted() && usb_charging_enabled()) | ||
766 | #endif | ||
764 | #endif | 767 | #endif |
765 | ) { | 768 | ) { |
766 | switch(charger_input_state) { | 769 | switch(charger_input_state) { |
diff --git a/firmware/target/coldfire/iriver/h300/pcf50606-h300.c b/firmware/target/coldfire/iriver/h300/pcf50606-h300.c index 3a67d541d3..7d101f7347 100644 --- a/firmware/target/coldfire/iriver/h300/pcf50606-h300.c +++ b/firmware/target/coldfire/iriver/h300/pcf50606-h300.c | |||
@@ -21,6 +21,9 @@ | |||
21 | #include "kernel.h" | 21 | #include "kernel.h" |
22 | #include "pcf50606.h" | 22 | #include "pcf50606.h" |
23 | #include "button-target.h" | 23 | #include "button-target.h" |
24 | #include "logf.h" | ||
25 | |||
26 | static bool usb_ch_enabled = false; | ||
24 | 27 | ||
25 | /* These voltages were determined by measuring the output of the PCF50606 | 28 | /* These voltages were determined by measuring the output of the PCF50606 |
26 | on a running H300, and verified by disassembling the original firmware */ | 29 | on a running H300, and verified by disassembling the original firmware */ |
@@ -70,6 +73,27 @@ static inline void enable_pmu_interrupts(void) | |||
70 | or_l(0x03000000, &INTPRI5); /* INT38 - Priority 3 */ | 73 | or_l(0x03000000, &INTPRI5); /* INT38 - Priority 3 */ |
71 | } | 74 | } |
72 | 75 | ||
76 | /* enables/disables USB charging | ||
77 | * ATTENTION: make sure to set the irq level | ||
78 | * to highest before calling this function! */ | ||
79 | void pcf50606_set_usb_charging(bool on) | ||
80 | { | ||
81 | if (on) | ||
82 | pcf50606_write(0x39, 0x00); /* Set GPOOD2 to High-Z for USB Charge Enable */ | ||
83 | else | ||
84 | pcf50606_write(0x39, 0x07); /* Set GPOOD2 to pulled down to disable USB charging */ | ||
85 | |||
86 | usb_ch_enabled = on; | ||
87 | |||
88 | logf("pcf50606_set_usb_charging(%s)\n", on ? "on" : "off" ); | ||
89 | } | ||
90 | |||
91 | bool pcf50606_usb_charging_enabled(void) | ||
92 | { | ||
93 | /* TODO: read the state of the GPOOD2 register... */ | ||
94 | return usb_ch_enabled; | ||
95 | } | ||
96 | |||
73 | void pcf50606_init(void) | 97 | void pcf50606_init(void) |
74 | { | 98 | { |
75 | pcf50606_i2c_init(); | 99 | pcf50606_i2c_init(); |
@@ -82,6 +106,8 @@ void pcf50606_init(void) | |||
82 | pcf50606_write(0x09, 0x05); /* USB and ON key debounce: 14ms */ | 106 | pcf50606_write(0x09, 0x05); /* USB and ON key debounce: 14ms */ |
83 | pcf50606_write(0x29, 0x1C); /* Disable the unused MBC module */ | 107 | pcf50606_write(0x29, 0x1C); /* Disable the unused MBC module */ |
84 | 108 | ||
109 | pcf50606_set_usb_charging(false); /* Disable USB charging atm. */ | ||
110 | |||
85 | pcf50606_write(0x35, 0x13); /* Backlight PWM = 512Hz 50/50 */ | 111 | pcf50606_write(0x35, 0x13); /* Backlight PWM = 512Hz 50/50 */ |
86 | pcf50606_write(0x3a, 0x3b); /* PWM output on GPOOD1 */ | 112 | pcf50606_write(0x3a, 0x3b); /* PWM output on GPOOD1 */ |
87 | 113 | ||
diff --git a/firmware/usb.c b/firmware/usb.c index 651c17a4b3..0a329ad624 100644 --- a/firmware/usb.c +++ b/firmware/usb.c | |||
@@ -44,6 +44,10 @@ | |||
44 | #ifdef TARGET_TREE | 44 | #ifdef TARGET_TREE |
45 | #include "usb-target.h" | 45 | #include "usb-target.h" |
46 | #endif | 46 | #endif |
47 | #ifdef IRIVER_H300_SERIES | ||
48 | #include "pcf50606.h" /* for pcf50606_usb_charging_... */ | ||
49 | #endif | ||
50 | #include "logf.h" | ||
47 | 51 | ||
48 | extern void dbg_ports(void); /* NASTY! defined in apps/ */ | 52 | extern void dbg_ports(void); /* NASTY! defined in apps/ */ |
49 | 53 | ||
@@ -487,6 +491,40 @@ bool usb_powered(void) | |||
487 | { | 491 | { |
488 | return usb_state == USB_POWERED; | 492 | return usb_state == USB_POWERED; |
489 | } | 493 | } |
494 | |||
495 | #ifdef CONFIG_CHARGING | ||
496 | bool usb_charging_enable(bool on) | ||
497 | { | ||
498 | bool rc = false; | ||
499 | #ifdef IRIVER_H300_SERIES | ||
500 | int irqlevel; | ||
501 | logf("usb_charging_enable(%s)\n", on ? "on" : "off" ); | ||
502 | irqlevel = set_irq_level(HIGHEST_IRQ_LEVEL); | ||
503 | pcf50606_set_usb_charging(on); | ||
504 | rc = on; | ||
505 | (void)set_irq_level(irqlevel); | ||
506 | #else | ||
507 | /* TODO: implement it for other targets... */ | ||
508 | (void)on; | ||
509 | #endif | ||
510 | return rc; | ||
511 | } | ||
512 | |||
513 | bool usb_charging_enabled(void) | ||
514 | { | ||
515 | bool rc = false; | ||
516 | #ifdef IRIVER_H300_SERIES | ||
517 | /* TODO: read the state of the GPOOD2 register... | ||
518 | * (this also means to set the irq level here) */ | ||
519 | rc = pcf50606_usb_charging_enabled(); | ||
520 | #else | ||
521 | /* TODO: implement it for other targets... */ | ||
522 | #endif | ||
523 | |||
524 | logf("usb_charging_enabled: %s\n", rc ? "true" : "false" ); | ||
525 | return rc; | ||
526 | } | ||
527 | #endif | ||
490 | #endif | 528 | #endif |
491 | 529 | ||
492 | #else | 530 | #else |