summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon Low <lostlogic@rockbox.org>2006-03-16 17:34:37 +0000
committerBrandon Low <lostlogic@rockbox.org>2006-03-16 17:34:37 +0000
commit4b68f1e2a3e0f57e723ad5fdab4f8970bcf66719 (patch)
tree2b2fe9eb89edff9810aa7e8e927e149b23e4c277
parentd4f9ebe2c3025339e414b5b139027f19fc9a6b14 (diff)
downloadrockbox-4b68f1e2a3e0f57e723ad5fdab4f8970bcf66719.zip
rockbox-4b68f1e2a3e0f57e723ad5fdab4f8970bcf66719.tar.gz
rockbox-4b68f1e2a3e0f57e723ad5fdab4f8970bcf66719.tar.bz2
rockbox-4b68f1e2a3e0f57e723ad5fdab4f8970bcf66719.tar.xz
Proper charger input, usb and charger activity detection/reporting for ipod video
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9061 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/drivers/power.c9
-rw-r--r--firmware/export/config-ipodvideo.h2
-rw-r--r--firmware/powermgmt.c2
-rw-r--r--firmware/usb.c4
4 files changed, 11 insertions, 6 deletions
diff --git a/firmware/drivers/power.c b/firmware/drivers/power.c
index 3df8460..676e7c2 100644
--- a/firmware/drivers/power.c
+++ b/firmware/drivers/power.c
@@ -123,8 +123,11 @@ bool charger_inserted(void)
return (adc_read(ADC_CHARGE_REGULATOR) < 0x1FF);
#elif defined(TOSHIBA_GIGABEAT_F)
return false;
-#elif defined(IPOD_ARCH)
+#elif defined(APPLE_IPODVIDEO)
/* We need to get this value a faster way than i2c */
+ return (GPIOA_INPUT_VAL & 0x10)?true:false;
+#elif defined(IPOD_ARCH)
+ /* This needs filling in for other ipods. */
return false;
#else
/* Player */
@@ -154,8 +157,10 @@ void charger_enable(bool on)
bool charging_state(void) {
#if defined(IRIVER_H100_SERIES)
return charger_inserted();
-#else /* Iriver H300 */
+#elif defined(IRIVER_H300_SERIES)
return (GPIO_READ & 0x00800000)?true:false;
+#elif defined(APPLE_IPODVIDEO)
+ return (GPIOB_INPUT_VAL & 0x01)?false:true;
#endif
}
#endif
diff --git a/firmware/export/config-ipodvideo.h b/firmware/export/config-ipodvideo.h
index e08b029..6057afa 100644
--- a/firmware/export/config-ipodvideo.h
+++ b/firmware/export/config-ipodvideo.h
@@ -69,6 +69,8 @@
/* define this if the hardware can be powered off while charging */
//#define HAVE_POWEROFF_WHILE_CHARGING
+#define HAVE_CHARGE_STATE 1
+
/* The start address index for ROM builds */
#define ROM_START 0x00000000
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c
index 8f4f22f..b135a29 100644
--- a/firmware/powermgmt.c
+++ b/firmware/powermgmt.c
@@ -456,6 +456,8 @@ static int runcurrent(void)
if(usb_inserted()
#if defined(HAVE_USB_POWER) && (CURRENT_USB < CURRENT_NORMAL)
|| usb_powered()
+#else
+ && !usb_powered()
#endif
)
{
diff --git a/firmware/usb.c b/firmware/usb.c
index b96134b..3491e43 100644
--- a/firmware/usb.c
+++ b/firmware/usb.c
@@ -406,12 +406,8 @@ bool usb_detect(void)
if (USB2D_IDENT != 0x22FA05) {
return false;
}
-#ifdef APPLE_IPODVIDEO
- current_status = (GPIOB_INPUT_VAL & 0x01)?false:true;
-#else
current_status = (USB_STATUS & 0x800)?true:false;
#endif
-#endif
#ifdef USB_ISP1582
/* TODO: Implement USB_ISP1582 */
current_status = false;