mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-08 12:45:26 -05:00
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
This commit is contained in:
parent
efb9343bc6
commit
1e787a9911
2 changed files with 29 additions and 7 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue