1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
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 ****************************************************************************/
27 enum power_input_flags
{
28 /* No external power source? Default. */
29 POWER_INPUT_NONE
= 0x00,
31 /* Main power source is available (AC?), the default other than
32 * battery if for instance USB and others cannot be distinguished or
33 * USB is the only possibility. */
34 POWER_INPUT_MAIN
= 0x01,
36 /* USB power source is available (and is discernable from MAIN). */
37 POWER_INPUT_USB
= 0x02,
39 /* Something is plugged. */
42 /* POWER_INPUT_*_CHARGER of course implies presence of the respective
45 /* Battery not included in CHARGER (it can't charge itself) */
47 /* Charging is possible on main. */
48 POWER_INPUT_MAIN_CHARGER
= 0x10 | POWER_INPUT_MAIN
,
50 /* Charging is possible on USB. */
51 POWER_INPUT_USB_CHARGER
= 0x20 | POWER_INPUT_USB
,
53 /* Charging is possible from something. */
54 POWER_INPUT_CHARGER
= 0xf0,
56 #ifdef HAVE_BATTERY_SWITCH
57 /* Battery is powering device or is available to power device. It
58 * could also be used if the battery is hot-swappable to indicate if
59 * it is present ("switch" as verb vs. noun). */
60 POWER_INPUT_BATTERY
= 0x100,
64 /* Returns detailed power input status information from device. */
65 unsigned int power_input_status(void);
68 /* Returns true if any power source that is connected is capable of
69 * charging the batteries.
70 * > (power_input_status() & POWER_INPUT_CHARGER) != 0 */
71 bool charger_inserted(void);
73 /* Returns true if any power input is connected - charging-capable
75 * > (power_input_status() & POWER_INPUT) != 0 */
76 bool power_input_present(void);
77 #endif /* CONFIG_CHARGING */
80 void ide_power_enable(bool on
);
82 #if CONFIG_CHARGING >= CHARGING_MONITOR
83 bool charging_state(void);
86 #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
88 void power_init(void) INIT_ATTR
;
90 bool ide_powered(void);
93 #ifdef HAVE_SPDIF_POWER
94 void spdif_power_enable(bool on
);
95 bool spdif_powered(void);
99 bool tuner_power(bool status
);
100 bool tuner_powered(void);
103 #endif /* _POWER_H_ */