1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright © 2009 Bertrik Sikken
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
27 #include "pmu-target.h"
28 #include "usb_core.h" /* for usb_charging_maxcurrent_change */
32 pmu_ldo_on_in_standby(0, 0);
33 pmu_ldo_on_in_standby(1, 0);
34 pmu_ldo_on_in_standby(2, 0);
35 pmu_ldo_on_in_standby(3, 0);
36 pmu_ldo_on_in_standby(4, 0);
37 pmu_ldo_on_in_standby(5, 0);
38 pmu_ldo_on_in_standby(6, 0);
39 pmu_ldo_on_in_standby(7, 0);
40 pmu_set_wake_condition(0x42); /* USB inserted or EXTON1 */
48 pmu_write(0x1e, 0xf); /* Vcore = 1.000V */
49 pmu_ldo_set_voltage(2, 0x13); /* LCD = 2.800V */
54 #ifdef HAVE_USB_CHARGING_ENABLE
55 void usb_charging_maxcurrent_change(int maxcurrent
)
57 bool on
= (maxcurrent
>= 500);
58 PDAT11
= (PDAT11
& ~1) | (on
? 1 : 0);
62 unsigned int power_input_status(void)
64 return (PDAT14
& 8) ? POWER_INPUT_NONE
: POWER_INPUT_MAIN_CHARGER
;
67 bool charging_state(void)
69 return (PDAT11
& 0x10) ? false : true;
71 #endif /* CONFIG_CHARGING */