summaryrefslogtreecommitdiffstats
path: root/firmware/target/coldfire/iaudio
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/coldfire/iaudio')
-rw-r--r--firmware/target/coldfire/iaudio/m3/adc-target.h3
-rw-r--r--firmware/target/coldfire/iaudio/m3/power-m3.c4
-rw-r--r--firmware/target/coldfire/iaudio/m5/power-m5.c12
-rw-r--r--firmware/target/coldfire/iaudio/x5/power-x5.c12
4 files changed, 17 insertions, 14 deletions
diff --git a/firmware/target/coldfire/iaudio/m3/adc-target.h b/firmware/target/coldfire/iaudio/m3/adc-target.h
index e5ff818647..40ed226bea 100644
--- a/firmware/target/coldfire/iaudio/m3/adc-target.h
+++ b/firmware/target/coldfire/iaudio/m3/adc-target.h
@@ -26,4 +26,7 @@
#define ADC_BATTERY 1
#define ADC_REMOTE 2
+#define NEED_ADC_CLOSE
+void adc_close(void);
+
#endif /* _ADC_TARGET_H_ */
diff --git a/firmware/target/coldfire/iaudio/m3/power-m3.c b/firmware/target/coldfire/iaudio/m3/power-m3.c
index 52a5de3460..a7f3fc46be 100644
--- a/firmware/target/coldfire/iaudio/m3/power-m3.c
+++ b/firmware/target/coldfire/iaudio/m3/power-m3.c
@@ -36,7 +36,7 @@ void power_init(void)
/* Charger detect */
and_l(~0x00000020, &GPIO1_ENABLE);
or_l(0x00000020, &GPIO1_FUNCTION);
-
+
/* FIXME: Just disable the multi-colour LED for now. */
and_l(~0x00000210, &GPIO1_OUT);
and_l(~0x00008000, &GPIO_OUT);
@@ -61,7 +61,7 @@ void ide_power_enable(bool on)
bool ide_powered(void)
{
- return false;
+ return (GPIO_OUT & 0x00800000) != 0;
}
void power_off(void)
diff --git a/firmware/target/coldfire/iaudio/m5/power-m5.c b/firmware/target/coldfire/iaudio/m5/power-m5.c
index d33cbec8be..939cae02f2 100644
--- a/firmware/target/coldfire/iaudio/m5/power-m5.c
+++ b/firmware/target/coldfire/iaudio/m5/power-m5.c
@@ -38,23 +38,23 @@ void power_init(void)
bool charger_inserted(void)
{
- return (GPIO1_READ & 0x01000000)?true:false;
+ return (GPIO1_READ & 0x01000000) != 0;
}
void ide_power_enable(bool on)
{
/* GPOOD3 */
int level = set_irq_level(HIGHEST_IRQ_LEVEL);
- if(on)
- pcf50606_write(0x3c, 0x07);
- else
- pcf50606_write(0x3c, 0x00);
+ pcf50606_write(0x3c, on ? 0x07 : 0x00);
set_irq_level(level);
}
bool ide_powered(void)
{
- return false;
+ int level = set_irq_level(HIGHEST_IRQ_LEVEL);
+ int value = pcf50606_read(0x3c);
+ set_irq_level(level);
+ return (value & 0x07) != 0;
}
void power_off(void)
diff --git a/firmware/target/coldfire/iaudio/x5/power-x5.c b/firmware/target/coldfire/iaudio/x5/power-x5.c
index cfcb384a24..068b25f577 100644
--- a/firmware/target/coldfire/iaudio/x5/power-x5.c
+++ b/firmware/target/coldfire/iaudio/x5/power-x5.c
@@ -38,23 +38,23 @@ void power_init(void)
bool charger_inserted(void)
{
- return (GPIO1_READ & 0x01000000)?true:false;
+ return (GPIO1_READ & 0x01000000) != 0;
}
void ide_power_enable(bool on)
{
/* GPOOD3 */
int level = set_irq_level(HIGHEST_IRQ_LEVEL);
- if(on)
- pcf50606_write(0x3c, 0x07);
- else
- pcf50606_write(0x3c, 0x00);
+ pcf50606_write(0x3c, on ? 0x07 : 0x00);
set_irq_level(level);
}
bool ide_powered(void)
{
- return false;
+ int level = set_irq_level(HIGHEST_IRQ_LEVEL);
+ int value = pcf50606_read(0x3c);
+ set_irq_level(level);
+ return (value & 0x07) != 0;
}
void power_off(void)