forked from len0rd/rockbox
HD200 - power_init() rework based on latest power consumption measurements
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26767 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
b45a2d433b
commit
2f7bd4d993
1 changed files with 41 additions and 24 deletions
|
|
@ -30,15 +30,10 @@
|
||||||
#if CONFIG_TUNER
|
#if CONFIG_TUNER
|
||||||
bool tuner_power(bool status)
|
bool tuner_power(bool status)
|
||||||
{
|
{
|
||||||
(void)status;
|
|
||||||
if (status)
|
if (status)
|
||||||
{
|
|
||||||
and_l(~(1<<17), &GPIO1_OUT);
|
and_l(~(1<<17), &GPIO1_OUT);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
or_l((1<<17), &GPIO1_OUT);
|
or_l((1<<17), &GPIO1_OUT);
|
||||||
}
|
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
@ -46,20 +41,39 @@ bool tuner_power(bool status)
|
||||||
|
|
||||||
void power_init(void)
|
void power_init(void)
|
||||||
{
|
{
|
||||||
/* GPIO53 has to be high - low resets device */
|
/* GPIO53 has to be high - low resets device
|
||||||
/* GPIO49 is FM related */
|
* it is setup in crt0.S
|
||||||
or_l((1<<21)|(1<<17), &GPIO1_OUT);
|
*/
|
||||||
or_l((1<<21)|(1<<17), &GPIO1_ENABLE);
|
|
||||||
or_l((1<<21)|(1<<17)|(1<<14), &GPIO1_FUNCTION);
|
|
||||||
|
|
||||||
and_l(~(1<<15), &GPIO_OUT);
|
/* GPIO50 is ATA power (default OFF) */
|
||||||
or_l((1<<15),&GPIO_ENABLE);
|
or_l((1<<18), &GPIO1_OUT);
|
||||||
or_l((1<<15),&GPIO_FUNCTION);
|
or_l((1<<18), &GPIO1_ENABLE);
|
||||||
|
or_l((1<<18), &GPIO1_FUNCTION);
|
||||||
|
|
||||||
|
/* GPIO49 is FM power (default OFF) */
|
||||||
|
or_l((1<<17), &GPIO1_OUT);
|
||||||
|
or_l((1<<17), &GPIO1_ENABLE);
|
||||||
|
or_l((1<<17), &GPIO1_FUNCTION);
|
||||||
|
|
||||||
|
/* GPIO46 is wall charger detect (input) */
|
||||||
|
and_l(~(1<<14), &GPIO1_ENABLE);
|
||||||
|
or_l((1<<14), &GPIO1_FUNCTION);
|
||||||
|
|
||||||
|
/* GPIO31 needs to be low */
|
||||||
|
and_l(~(1<<31), &GPIO_OUT);
|
||||||
|
or_l((1<<31),&GPIO_ENABLE);
|
||||||
|
or_l((1<<31),&GPIO_FUNCTION);
|
||||||
|
|
||||||
|
/* turn off charger by default*/
|
||||||
or_l((1<<23), &GPIO_OUT);
|
or_l((1<<23), &GPIO_OUT);
|
||||||
and_l(~(1<<23), &GPIO_ENABLE);
|
and_l(~(1<<23), &GPIO_ENABLE);
|
||||||
or_l((1<<23), &GPIO_FUNCTION);
|
or_l((1<<23), &GPIO_FUNCTION);
|
||||||
|
|
||||||
|
/* high current charge mode */
|
||||||
|
or_l((1<<15), &GPIO_OUT);
|
||||||
|
or_l((1<<15),&GPIO_ENABLE);
|
||||||
|
or_l((1<<15),&GPIO_FUNCTION);
|
||||||
|
|
||||||
#ifndef BOOTLOADER
|
#ifndef BOOTLOADER
|
||||||
/* The boot loader controls the power */
|
/* The boot loader controls the power */
|
||||||
ide_power_enable(true);
|
ide_power_enable(true);
|
||||||
|
|
@ -71,8 +85,16 @@ unsigned int power_input_status(void)
|
||||||
unsigned int status = POWER_INPUT_NONE;
|
unsigned int status = POWER_INPUT_NONE;
|
||||||
/* GPIO46 is AC plug detect (low = AC plugged) */
|
/* GPIO46 is AC plug detect (low = AC plugged) */
|
||||||
if (!(GPIO1_READ & (1<<14)))
|
if (!(GPIO1_READ & (1<<14)))
|
||||||
|
{
|
||||||
status |= POWER_INPUT_MAIN_CHARGER;
|
status |= POWER_INPUT_MAIN_CHARGER;
|
||||||
|
/* tristate GPIO23 to start charging cycle */
|
||||||
|
and_l(~(1<<23), &GPIO_ENABLE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* drive GPIO23 high to enter LTC1733 shutdown mode */
|
||||||
|
or_l((1<<23), &GPIO_ENABLE);
|
||||||
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -87,20 +109,15 @@ bool charging_state(void)
|
||||||
|
|
||||||
void ide_power_enable(bool on)
|
void ide_power_enable(bool on)
|
||||||
{
|
{
|
||||||
(void)on;
|
|
||||||
if (on)
|
if (on)
|
||||||
and_l(~(1<<31),&GPIO_OUT);
|
and_l(~(1<<18),&GPIO1_OUT);
|
||||||
else
|
else
|
||||||
or_l((1<<31),&GPIO_OUT);
|
or_l((1<<18),&GPIO1_OUT);
|
||||||
|
|
||||||
or_l((1<<31),&GPIO_ENABLE);
|
|
||||||
or_l((1<<31),&GPIO_FUNCTION);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ide_powered(void)
|
bool ide_powered(void)
|
||||||
{
|
{
|
||||||
return true;
|
return (GPIO1_OUT & (1<<18))?false:true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void power_off(void)
|
void power_off(void)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue