Fix warning about missing newline at the EOF
[maemo-rb.git] / firmware / export / power.h
blob2aea20c27e880e68ee6419a5e98b45be654b9237
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 #include "config.h"
26 #if (CONFIG_PLATFORM & PLATFORM_NATIVE) || defined(SAMSUNG_YPR0) || defined(SIMULATOR)
27 #if CONFIG_CHARGING
28 enum power_input_flags {
29 /* No external power source? Default. */
30 POWER_INPUT_NONE = 0x00,
32 /* Main power source is available (AC?), the default other than
33 * battery if for instance USB and others cannot be distinguished or
34 * USB is the only possibility. */
35 POWER_INPUT_MAIN = 0x01,
37 /* USB power source is available (and is discernable from MAIN). */
38 POWER_INPUT_USB = 0x02,
40 /* Something is plugged. */
41 POWER_INPUT = 0x0f,
43 /* POWER_INPUT_*_CHARGER of course implies presence of the respective
44 * power source. */
46 /* Battery not included in CHARGER (it can't charge itself) */
48 /* Charging is possible on main. */
49 POWER_INPUT_MAIN_CHARGER = 0x10 | POWER_INPUT_MAIN,
51 /* Charging is possible on USB. */
52 POWER_INPUT_USB_CHARGER = 0x20 | POWER_INPUT_USB,
54 /* Charging is possible from something. */
55 POWER_INPUT_CHARGER = 0xf0,
57 #ifdef HAVE_BATTERY_SWITCH
58 /* Battery is powering device or is available to power device. It
59 * could also be used if the battery is hot-swappable to indicate if
60 * it is present ("switch" as verb vs. noun). */
61 POWER_INPUT_BATTERY = 0x100,
62 #endif
65 /* Returns detailed power input status information from device. */
66 unsigned int power_input_status(void);
68 /* Shortcuts */
69 /* Returns true if any power source that is connected is capable of
70 * charging the batteries.
71 * > (power_input_status() & POWER_INPUT_CHARGER) != 0 */
72 bool charger_inserted(void);
74 /* Returns true if any power input is connected - charging-capable
75 * or not.
76 * > (power_input_status() & POWER_INPUT) != 0 */
77 bool power_input_present(void);
78 #endif /* CONFIG_CHARGING */
80 void power_off(void);
81 void ide_power_enable(bool on);
83 #if CONFIG_CHARGING >= CHARGING_MONITOR
84 bool charging_state(void);
85 #endif
87 #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
89 void power_init(void) INIT_ATTR;
91 bool ide_powered(void);
92 #endif
94 #ifdef HAVE_SPDIF_POWER
95 void spdif_power_enable(bool on);
96 bool spdif_powered(void);
97 #endif
99 #if CONFIG_TUNER
100 bool tuner_power(bool status);
101 bool tuner_powered(void);
102 #endif
104 #endif
106 #endif /* _POWER_H_ */