summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorAndree Buschmann <AndreeBuschmann@t-online.de>2008-04-20 18:28:25 +0000
committerAndree Buschmann <AndreeBuschmann@t-online.de>2008-04-20 18:28:25 +0000
commit850a11250a8c5b6825b080ff843f30fd68cb71f6 (patch)
treed236674a20fccc8002edeafa30d210b5c972327d /firmware
parentcea07eb2a4ddb72d084c7085192521613004a997 (diff)
downloadrockbox-850a11250a8c5b6825b080ff843f30fd68cb71f6.tar.gz
rockbox-850a11250a8c5b6825b080ff843f30fd68cb71f6.tar.bz2
rockbox-850a11250a8c5b6825b080ff843f30fd68cb71f6.zip
Adding new setting to System Settings <Accessory Power Supply -- off by default). This setting can be used to enable/disable the power supply for accessories. With this commit implemented for iPods with PCF50605 power controller.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17193 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/pcf50605.c14
-rw-r--r--firmware/export/config-ipod3g.h3
-rw-r--r--firmware/export/config-ipod4g.h3
-rw-r--r--firmware/export/config-ipodcolor.h3
-rw-r--r--firmware/export/config-ipodmini.h3
-rw-r--r--firmware/export/config-ipodmini2g.h3
-rw-r--r--firmware/export/config-ipodnano.h3
-rw-r--r--firmware/export/config-ipodvideo.h3
-rw-r--r--firmware/export/powermgmt.h4
-rw-r--r--firmware/target/arm/ipod/powermgmt-ipod-pcf.c19
10 files changed, 49 insertions, 9 deletions
diff --git a/firmware/drivers/pcf50605.c b/firmware/drivers/pcf50605.c
index 7d88e46aa2..9fb04ddcf2 100644
--- a/firmware/drivers/pcf50605.c
+++ b/firmware/drivers/pcf50605.c
@@ -79,27 +79,25 @@ void pcf50605_init(void)
#if defined (IPOD_VIDEO)
/* I/O and GPO voltage supply (default: 0xf8 = 3.3V ON) */
/* ECO not allowed regarding data sheet */
- pcf50605_write(PCF5060X_IOREGC, 0xf8); /* 3.3V ON */
+ pcf50605_write(PCF5060X_IOREGC, 0xf8); /* 3.3V ON */
/* core voltage supply (default DCDC1/DCDC2: 0xec = 1.2V ON) */
/* ECO not stable, assumed due to less precision of voltage in ECO mode */
- pcf50605_write(PCF5060X_DCDC1, 0xec); /* 1.2V ON */
- pcf50605_write(PCF5060X_DCDC2, 0x0c); /* OFF */
+ pcf50605_write(PCF5060X_DCDC1, 0xec); /* 1.2V ON */
+ pcf50605_write(PCF5060X_DCDC2, 0x0c); /* OFF */
/* unknown (default: 0xe3 = 1.8V ON) */
- pcf50605_write(PCF5060X_DCUDC1, 0xe3); /* 1.8V ON */
+ pcf50605_write(PCF5060X_DCUDC1, 0xe3); /* 1.8V ON */
/* WM8758 voltage supply (default: 0xf5 = 3.0V ON) */
/* ECO not allowed as max. current of 5mA is not sufficient */
- pcf50605_write(PCF5060X_D1REGC1, 0xf0); /* 2.5V ON */
+ pcf50605_write(PCF5060X_D1REGC1, 0xf0); /* 2.5V ON */
/* LCD voltage supply (default: 0xf5 = 3.0V ON) */
- pcf50605_write(PCF5060X_D3REGC1, 0xf1); /* 2.6V ON */
+ pcf50605_write(PCF5060X_D3REGC1, 0xf1); /* 2.6V ON */
#else
/* keep initialization from svn for other iPods */
pcf50605_write(PCF5060X_D1REGC1, 0xf5); /* 3.0V ON */
pcf50605_write(PCF5060X_D3REGC1, 0xf5); /* 3.0V ON */
#endif
- /* Dock Connector pin 17 (default: OFF) */
- pcf50605_write(PCF5060X_D2REGC1, 0xf8); /* 3.3V ON */
}
diff --git a/firmware/export/config-ipod3g.h b/firmware/export/config-ipod3g.h
index 4644a823a0..d5f403c1a9 100644
--- a/firmware/export/config-ipod3g.h
+++ b/firmware/export/config-ipod3g.h
@@ -63,6 +63,9 @@
/* Define if the device can wake from an RTC alarm */
#define HAVE_RTC_ALARM
+/* Define this if you can switch on/off the accessory power supply */
+#define HAVE_ACCESSORY_SUPPLY
+
/* Define this if you have a software controlled poweroff */
#define HAVE_SW_POWEROFF
diff --git a/firmware/export/config-ipod4g.h b/firmware/export/config-ipod4g.h
index 133b68257b..ad03f41b90 100644
--- a/firmware/export/config-ipod4g.h
+++ b/firmware/export/config-ipod4g.h
@@ -71,6 +71,9 @@
/* Define if the device can wake from an RTC alarm */
#define HAVE_RTC_ALARM
+/* Define this if you can switch on/off the accessory power supply */
+#define HAVE_ACCESSORY_SUPPLY
+
/* Define this if you have a software controlled poweroff */
#define HAVE_SW_POWEROFF
diff --git a/firmware/export/config-ipodcolor.h b/firmware/export/config-ipodcolor.h
index 5823af17bf..9a7c055d53 100644
--- a/firmware/export/config-ipodcolor.h
+++ b/firmware/export/config-ipodcolor.h
@@ -58,6 +58,9 @@
/* Define if the device can wake from an RTC alarm */
#define HAVE_RTC_ALARM
+/* Define this if you can switch on/off the accessory power supply */
+#define HAVE_ACCESSORY_SUPPLY
+
/* Define this if you have a software controlled poweroff */
#define HAVE_SW_POWEROFF
diff --git a/firmware/export/config-ipodmini.h b/firmware/export/config-ipodmini.h
index 34632fa6a4..6e5fe26d6a 100644
--- a/firmware/export/config-ipodmini.h
+++ b/firmware/export/config-ipodmini.h
@@ -62,6 +62,9 @@
/* Define if the device can wake from an RTC alarm */
#define HAVE_RTC_ALARM
+/* Define this if you can switch on/off the accessory power supply */
+#define HAVE_ACCESSORY_SUPPLY
+
/* Define this if you have a software controlled poweroff */
#define HAVE_SW_POWEROFF
diff --git a/firmware/export/config-ipodmini2g.h b/firmware/export/config-ipodmini2g.h
index 124d0db772..c861f5ae13 100644
--- a/firmware/export/config-ipodmini2g.h
+++ b/firmware/export/config-ipodmini2g.h
@@ -62,6 +62,9 @@
/* Define if the device can wake from an RTC alarm */
#define HAVE_RTC_ALARM
+/* Define this if you can switch on/off the accessory power supply */
+#define HAVE_ACCESSORY_SUPPLY
+
/* Define this if you have a software controlled poweroff */
#define HAVE_SW_POWEROFF
diff --git a/firmware/export/config-ipodnano.h b/firmware/export/config-ipodnano.h
index 6a47247d21..ced2c47b4e 100644
--- a/firmware/export/config-ipodnano.h
+++ b/firmware/export/config-ipodnano.h
@@ -58,6 +58,9 @@
/* Define if the device can wake from an RTC alarm */
#define HAVE_RTC_ALARM
+/* Define this if you can switch on/off the accessory power supply */
+#define HAVE_ACCESSORY_SUPPLY
+
/* Define this if you have a software controlled poweroff */
#define HAVE_SW_POWEROFF
diff --git a/firmware/export/config-ipodvideo.h b/firmware/export/config-ipodvideo.h
index 364ae65d3f..d15494cfd1 100644
--- a/firmware/export/config-ipodvideo.h
+++ b/firmware/export/config-ipodvideo.h
@@ -58,6 +58,9 @@
/* Define if the device can wake from an RTC alarm */
#define HAVE_RTC_ALARM
+/* Define this if you can switch on/off the accessory power supply */
+#define HAVE_ACCESSORY_SUPPLY
+
/* Define this if you have a software controlled poweroff */
#define HAVE_SW_POWEROFF
diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h
index 56e14b3741..4b8d239974 100644
--- a/firmware/export/powermgmt.h
+++ b/firmware/export/powermgmt.h
@@ -182,5 +182,7 @@ void reset_poweroff_timer(void);
void cancel_shutdown(void);
void shutdown_hw(void);
void sys_poweroff(void);
-
+#ifdef HAVE_ACCESSORY_SUPPLY
+void accessory_supply_set(bool);
+#endif
#endif
diff --git a/firmware/target/arm/ipod/powermgmt-ipod-pcf.c b/firmware/target/arm/ipod/powermgmt-ipod-pcf.c
index aaf4fabf52..2f97c298be 100644
--- a/firmware/target/arm/ipod/powermgmt-ipod-pcf.c
+++ b/firmware/target/arm/ipod/powermgmt-ipod-pcf.c
@@ -21,6 +21,8 @@
#include "config.h"
#include "adc.h"
#include "powermgmt.h"
+#include "pcf5060x.h"
+#include "pcf50605.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
{
@@ -88,3 +90,20 @@ unsigned int battery_adc_voltage(void)
{
return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10;
}
+
+#ifdef HAVE_ACCESSORY_SUPPLY
+void accessory_supply_set(bool enable)
+{
+ if (enable)
+ {
+ /* Accessory voltage supply */
+ pcf50605_write(PCF5060X_D2REGC1, 0xf8); /* 3.3V ON */
+ }
+ else
+ {
+ /* Accessory voltage supply */
+ pcf50605_write(PCF5060X_D2REGC1, 0x18); /* OFF */
+ }
+
+}
+#endif