diff options
-rw-r--r-- | firmware/target/arm/as3525/ata_sd_as3525.c | 26 | ||||
-rw-r--r-- | firmware/target/arm/as3525/backlight-e200v2-fuze.c | 10 |
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 @@ | |||
38 | #include "pl081.h" /* DMA controller */ | 38 | #include "pl081.h" /* DMA controller */ |
39 | #include "dma-target.h" /* DMA request lines */ | 39 | #include "dma-target.h" /* DMA request lines */ |
40 | #include "clock-target.h" | 40 | #include "clock-target.h" |
41 | #ifdef HAVE_BUTTON_LIGHT | ||
42 | #include "backlight-target.h" | ||
43 | #endif | ||
41 | #include "stdbool.h" | 44 | #include "stdbool.h" |
42 | #include "ata_idle_notify.h" | 45 | #include "ata_idle_notify.h" |
43 | #include "sd.h" | 46 | #include "sd.h" |
@@ -822,6 +825,11 @@ long sd_last_disk_activity(void) | |||
822 | 825 | ||
823 | void sd_enable(bool on) | 826 | void sd_enable(bool on) |
824 | { | 827 | { |
828 | /* buttonlight AMSes need a bit of special handling for the buttonlight here, | ||
829 | * due to the dual mapping of GPIOD and XPD */ | ||
830 | #ifdef HAVE_BUTTON_LIGHT | ||
831 | extern int buttonlight_is_on; | ||
832 | #endif | ||
825 | if (sd_enabled == on) | 833 | if (sd_enabled == on) |
826 | return; /* nothing to do */ | 834 | return; /* nothing to do */ |
827 | if(on) | 835 | if(on) |
@@ -829,10 +837,13 @@ void sd_enable(bool on) | |||
829 | CGU_PERI |= CGU_NAF_CLOCK_ENABLE; | 837 | CGU_PERI |= CGU_NAF_CLOCK_ENABLE; |
830 | #ifdef HAVE_MULTIVOLUME | 838 | #ifdef HAVE_MULTIVOLUME |
831 | CGU_PERI |= CGU_MCI_CLOCK_ENABLE; | 839 | CGU_PERI |= CGU_MCI_CLOCK_ENABLE; |
832 | /* Needed for buttonlight and MicroSD to work at the same time */ | 840 | #ifdef HAVE_BUTTON_LIGHT |
833 | /* Turn ROD control on, as the OF does */ | ||
834 | SD_MCI_POWER |= (1<<7); | ||
835 | CCU_IO |= (1<<2); | 841 | CCU_IO |= (1<<2); |
842 | if (buttonlight_is_on) | ||
843 | GPIOD_DIR &= ~(1<<7); | ||
844 | else | ||
845 | _buttonlight_off(); | ||
846 | #endif | ||
836 | #endif | 847 | #endif |
837 | CGU_IDE |= (1<<7) /* AHB interface enable */ | | 848 | CGU_IDE |= (1<<7) /* AHB interface enable */ | |
838 | (1<<6) /* interface enable */; | 849 | (1<<6) /* interface enable */; |
@@ -842,11 +853,12 @@ void sd_enable(bool on) | |||
842 | { | 853 | { |
843 | CGU_PERI &= ~CGU_NAF_CLOCK_ENABLE; | 854 | CGU_PERI &= ~CGU_NAF_CLOCK_ENABLE; |
844 | #ifdef HAVE_MULTIVOLUME | 855 | #ifdef HAVE_MULTIVOLUME |
845 | CGU_PERI &= ~CGU_MCI_CLOCK_ENABLE; | 856 | #ifdef HAVE_BUTTON_LIGHT |
846 | /* Needed for buttonlight and MicroSD to work at the same time */ | ||
847 | /* Turn ROD control off, as the OF does */ | ||
848 | SD_MCI_POWER &= ~(1<<7); | ||
849 | CCU_IO &= ~(1<<2); | 857 | CCU_IO &= ~(1<<2); |
858 | if (buttonlight_is_on) | ||
859 | _buttonlight_on(); | ||
860 | #endif | ||
861 | CGU_PERI &= ~CGU_MCI_CLOCK_ENABLE; | ||
850 | #endif | 862 | #endif |
851 | CGU_IDE &= ~((1<<7)|(1<<6)); | 863 | CGU_IDE &= ~((1<<7)|(1<<6)); |
852 | sd_enabled = false; | 864 | 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 @@ | |||
26 | #include "ascodec-target.h" | 26 | #include "ascodec-target.h" |
27 | #include "as3514.h" | 27 | #include "as3514.h" |
28 | 28 | ||
29 | int buttonlight_is_on = 0; | ||
30 | |||
29 | void _backlight_set_brightness(int brightness) | 31 | void _backlight_set_brightness(int brightness) |
30 | { | 32 | { |
31 | ascodec_write(AS3514_DCDC15, brightness); | 33 | ascodec_write(AS3514_DCDC15, brightness); |
@@ -53,12 +55,20 @@ void _backlight_off(void) | |||
53 | 55 | ||
54 | void _buttonlight_on(void) | 56 | void _buttonlight_on(void) |
55 | { | 57 | { |
58 | /* Needed for buttonlight and MicroSD to work at the same time */ | ||
59 | /* Turn ROD control on, as the OF does */ | ||
56 | GPIOD_DIR |= (1<<7); | 60 | GPIOD_DIR |= (1<<7); |
61 | SD_MCI_POWER |= (1<<7); | ||
57 | GPIOD_PIN(7) = (1<<7); | 62 | GPIOD_PIN(7) = (1<<7); |
63 | buttonlight_is_on = 1; | ||
58 | } | 64 | } |
59 | 65 | ||
60 | void _buttonlight_off(void) | 66 | void _buttonlight_off(void) |
61 | { | 67 | { |
68 | /* Needed for buttonlight and MicroSD to work at the same time */ | ||
69 | /* Turn ROD control off, as the OF does */ | ||
70 | SD_MCI_POWER &= ~(1<<7); | ||
62 | GPIOD_PIN(7) = 0; | 71 | GPIOD_PIN(7) = 0; |
63 | GPIOD_DIR &= ~(1<<7); | 72 | GPIOD_DIR &= ~(1<<7); |
73 | buttonlight_is_on = 0; | ||
64 | } | 74 | } |