AMSv2 SD: use a sleep instead of a udelay for 100 ms delay
[maemo-rb.git] / firmware / export / power.h
blob137f40cb01b5c3cae071485c49bc533f2ee373bc
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 by Linus Nielsen Feltzing
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 ****************************************************************************/
21 #ifndef _POWER_H_
22 #define _POWER_H_
24 #if CONFIG_CHARGING
25 enum power_input_flags {
26 /* No external power source? Default. */
27 POWER_INPUT_NONE = 0x00,
29 /* Main power source is available (AC?), the default other than
30 * battery if for instance USB and others cannot be distinguished or
31 * USB is the only possibility. */
32 POWER_INPUT_MAIN = 0x01,
34 /* USB power source is available (and is discernable from MAIN). */
35 POWER_INPUT_USB = 0x02,
37 /* Something is plugged. */
38 POWER_INPUT = 0x0f,
40 /* POWER_INPUT_*_CHARGER of course implies presence of the respective
41 * power source. */
43 /* Battery not included in CHARGER (it can't charge itself) */
45 /* Charging is possible on main. */
46 POWER_INPUT_MAIN_CHARGER = 0x10 | POWER_INPUT_MAIN,
48 /* Charging is possible on USB. */
49 POWER_INPUT_USB_CHARGER = 0x20 | POWER_INPUT_USB,
51 /* Charging is possible from something. */
52 POWER_INPUT_CHARGER = 0xf0,
54 #ifdef HAVE_BATTERY_SWITCH
55 /* Battery is powering device or is available to power device. It
56 * could also be used if the battery is hot-swappable to indicate if
57 * it is present ("switch" as verb vs. noun). */
58 POWER_INPUT_BATTERY = 0x100,
59 #endif
62 /* Returns detailed power input status information from device. */
63 unsigned int power_input_status(void);
65 /* Shortcuts */
66 /* Returns true if any power source that is connected is capable of
67 * charging the batteries.
68 * > (power_input_status() & POWER_INPUT_CHARGER) != 0 */
69 bool charger_inserted(void);
71 /* Returns true if any power input is connected - charging-capable
72 * or not.
73 * > (power_input_status() & POWER_INPUT) != 0 */
74 bool power_input_present(void);
75 #endif /* CONFIG_CHARGING */
77 void power_off(void);
78 void ide_power_enable(bool on);
80 #if CONFIG_CHARGING >= CHARGING_MONITOR
81 bool charging_state(void);
82 #endif
84 #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
86 void power_init(void) INIT_ATTR;
88 bool ide_powered(void);
89 #endif
91 #ifdef HAVE_SPDIF_POWER
92 void spdif_power_enable(bool on);
93 bool spdif_powered(void);
94 #endif
96 #if CONFIG_TUNER
97 bool tuner_power(bool status);
98 bool tuner_powered(void);
99 #endif
101 #endif /* _POWER_H_ */