summaryrefslogtreecommitdiffstats
path: root/firmware/target
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@gmail.com>2009-06-18 22:33:02 +0000
committerRafaël Carré <rafael.carre@gmail.com>2009-06-18 22:33:02 +0000
commit1e787a9911b047ac371d03b7a8c4d2405157b057 (patch)
treeaf9599a994099d3d6fb947b393b72557f9d5d808 /firmware/target
parentefb9343bc66038a26cd6eae135deafa6b2cd5bc3 (diff)
downloadrockbox-1e787a9911b047ac371d03b7a8c4d2405157b057.tar.gz
rockbox-1e787a9911b047ac371d03b7a8c4d2405157b057.zip
FS#10306 by Thomas Martitz : button light doesn't change on SD transfers on Sansa AMS (Fuze & e200v2)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21340 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target')
-rw-r--r--firmware/target/arm/as3525/ata_sd_as3525.c26
-rw-r--r--firmware/target/arm/as3525/backlight-e200v2-fuze.c10
2 files changed, 29 insertions, 7 deletions
diff --git a/firmware/target/arm/as3525/ata_sd_as3525.c b/firmware/target/arm/as3525/ata_sd_as3525.c
index a6265b37f4..ac4a264172 100644
--- a/firmware/target/arm/as3525/ata_sd_as3525.c
+++ b/firmware/target/arm/as3525/ata_sd_as3525.c
@@ -38,6 +38,9 @@
#include "pl081.h" /* DMA controller */
#include "dma-target.h" /* DMA request lines */
#include "clock-target.h"
+#ifdef HAVE_BUTTON_LIGHT
+#include "backlight-target.h"
+#endif
#include "stdbool.h"
#include "ata_idle_notify.h"
#include "sd.h"
@@ -822,6 +825,11 @@ long sd_last_disk_activity(void)
void sd_enable(bool on)
{
+ /* buttonlight AMSes need a bit of special handling for the buttonlight here,
+ * due to the dual mapping of GPIOD and XPD */
+#ifdef HAVE_BUTTON_LIGHT
+ extern int buttonlight_is_on;
+#endif
if (sd_enabled == on)
return; /* nothing to do */
if(on)
@@ -829,10 +837,13 @@ void sd_enable(bool on)
CGU_PERI |= CGU_NAF_CLOCK_ENABLE;
#ifdef HAVE_MULTIVOLUME
CGU_PERI |= CGU_MCI_CLOCK_ENABLE;
- /* Needed for buttonlight and MicroSD to work at the same time */
- /* Turn ROD control on, as the OF does */
- SD_MCI_POWER |= (1<<7);
+#ifdef HAVE_BUTTON_LIGHT
CCU_IO |= (1<<2);
+ if (buttonlight_is_on)
+ GPIOD_DIR &= ~(1<<7);
+ else
+ _buttonlight_off();
+#endif
#endif
CGU_IDE |= (1<<7) /* AHB interface enable */ |
(1<<6) /* interface enable */;
@@ -842,11 +853,12 @@ void sd_enable(bool on)
{
CGU_PERI &= ~CGU_NAF_CLOCK_ENABLE;
#ifdef HAVE_MULTIVOLUME
- CGU_PERI &= ~CGU_MCI_CLOCK_ENABLE;
- /* Needed for buttonlight and MicroSD to work at the same time */
- /* Turn ROD control off, as the OF does */
- SD_MCI_POWER &= ~(1<<7);
+#ifdef HAVE_BUTTON_LIGHT
CCU_IO &= ~(1<<2);
+ if (buttonlight_is_on)
+ _buttonlight_on();
+#endif
+ CGU_PERI &= ~CGU_MCI_CLOCK_ENABLE;
#endif
CGU_IDE &= ~((1<<7)|(1<<6));
sd_enabled = false;
diff --git a/firmware/target/arm/as3525/backlight-e200v2-fuze.c b/firmware/target/arm/as3525/backlight-e200v2-fuze.c
index 30c6d4b22f..61c2b1db79 100644
--- a/firmware/target/arm/as3525/backlight-e200v2-fuze.c
+++ b/firmware/target/arm/as3525/backlight-e200v2-fuze.c
@@ -26,6 +26,8 @@
#include "ascodec-target.h"
#include "as3514.h"
+int buttonlight_is_on = 0;
+
void _backlight_set_brightness(int brightness)
{
ascodec_write(AS3514_DCDC15, brightness);
@@ -53,12 +55,20 @@ void _backlight_off(void)
void _buttonlight_on(void)
{
+ /* Needed for buttonlight and MicroSD to work at the same time */
+ /* Turn ROD control on, as the OF does */
GPIOD_DIR |= (1<<7);
+ SD_MCI_POWER |= (1<<7);
GPIOD_PIN(7) = (1<<7);
+ buttonlight_is_on = 1;
}
void _buttonlight_off(void)
{
+ /* Needed for buttonlight and MicroSD to work at the same time */
+ /* Turn ROD control off, as the OF does */
+ SD_MCI_POWER &= ~(1<<7);
GPIOD_PIN(7) = 0;
GPIOD_DIR &= ~(1<<7);
+ buttonlight_is_on = 0;
}