mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-10 13:45:10 -05:00
Samsung YP-S3: allow player to stay powered up without the USB cable plugged and implement power_off
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22175 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
7964b69635
commit
4632fc0682
2 changed files with 21 additions and 6 deletions
|
|
@ -266,6 +266,12 @@ void main(void)
|
||||||
lcd_puts(0, line++, mystring);
|
lcd_puts(0, line++, mystring);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if 1 /* power off using power button */
|
||||||
|
button = button_read_device();
|
||||||
|
if (button & BUTTON_POWER) {
|
||||||
|
power_off();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if 1 /* button info */
|
#if 1 /* button info */
|
||||||
snprintf(mystring, 64, "BUTTONS %08X, %s", button_read_device(),
|
snprintf(mystring, 64, "BUTTONS %08X, %s", button_read_device(),
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,8 @@
|
||||||
|
|
||||||
/* Power handling for the S5L8700 based Samsung YP-S3
|
/* Power handling for the S5L8700 based Samsung YP-S3
|
||||||
|
|
||||||
Pins involved in with power management:
|
Pins involved in power management:
|
||||||
|
* P0.1: stay powered up (even with the USB cable unplugged)
|
||||||
* P1.1: USB power detect
|
* P1.1: USB power detect
|
||||||
* P4.7: tuner power/enable
|
* P4.7: tuner power/enable
|
||||||
* P5.2: unknown output
|
* P5.2: unknown output
|
||||||
|
|
@ -36,19 +37,26 @@
|
||||||
|
|
||||||
void power_off(void)
|
void power_off(void)
|
||||||
{
|
{
|
||||||
/* don't know how to do this yet */
|
/* take down P0.1 to power off (plugged USB cable overrides this though) */
|
||||||
|
PDAT0 &= ~(1 << 1);
|
||||||
|
|
||||||
|
while(1); /* wait for system to shut down */
|
||||||
}
|
}
|
||||||
|
|
||||||
void power_init(void)
|
void power_init(void)
|
||||||
{
|
{
|
||||||
/* configure pin P1.1 as input for USB power detect */
|
/* configure P0.1 as output for power-up and stay powered up */
|
||||||
|
PCON0 = (PCON0 & ~(3 << 2)) | (1 << 2);
|
||||||
|
PDAT0 |= (1 << 1);
|
||||||
|
|
||||||
|
/* configure P1.1 as input for USB power detect */
|
||||||
PCON1 = (PCON1 & ~0x000000F0) | 0x00000000;
|
PCON1 = (PCON1 & ~0x000000F0) | 0x00000000;
|
||||||
|
|
||||||
/* enable tuner power pin on P4.7 and turn power off */
|
/* configure P4.7 as output for tuner power and turn power off */
|
||||||
PCON4 = (PCON4 & ~0xF0000000) | 0x10000000;
|
PCON4 = (PCON4 & ~0xF0000000) | 0x10000000;
|
||||||
PDAT4 &= ~(1 << 7);
|
PDAT4 &= ~(1 << 7);
|
||||||
|
|
||||||
/* configure pins P5.2 / P5.3 / P5.6 as output, P5.4 as input */
|
/* configure P5.2 / P5.3 / P5.6 as output, P5.4 as input */
|
||||||
PCON5 = (PCON5 & ~0x0F0FFF00) | 0x01001100;
|
PCON5 = (PCON5 & ~0x0F0FFF00) | 0x01001100;
|
||||||
PDAT5 &= ~((1 << 2) | (1 << 3) | (1 << 6));
|
PDAT5 &= ~((1 << 2) | (1 << 3) | (1 << 6));
|
||||||
}
|
}
|
||||||
|
|
@ -66,8 +74,9 @@ unsigned int power_input_status(void)
|
||||||
|
|
||||||
bool charging_state(void)
|
bool charging_state(void)
|
||||||
{
|
{
|
||||||
|
/* check if charger is enabled */
|
||||||
if (PDAT5 & (1 << 6)) {
|
if (PDAT5 & (1 << 6)) {
|
||||||
/* charger is enabled, check if charging is busy */
|
/* check if charging is busy */
|
||||||
return (PDAT5 & (1 << 4));
|
return (PDAT5 & (1 << 4));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue