2002-07-04 16:09:23 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002 by Linus Nielsen Feltzing
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2002-07-04 16:09:23 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
#ifndef _POWER_H_
|
|
|
|
#define _POWER_H_
|
|
|
|
|
2007-02-18 05:32:06 +00:00
|
|
|
#if CONFIG_CHARGING
|
2008-12-03 19:54:25 +00:00
|
|
|
enum power_input_flags {
|
|
|
|
/* No external power source? Default. */
|
|
|
|
POWER_INPUT_NONE = 0x00,
|
|
|
|
|
|
|
|
/* Main power source is available (AC?), the default other than
|
|
|
|
* battery if for instance USB and others cannot be distinguished or
|
|
|
|
* USB is the only possibility. */
|
|
|
|
POWER_INPUT_MAIN = 0x01,
|
|
|
|
|
|
|
|
/* USB power source is available (and is discernable from MAIN). */
|
|
|
|
POWER_INPUT_USB = 0x02,
|
|
|
|
|
|
|
|
/* Something is plugged. */
|
|
|
|
POWER_INPUT = 0x0f,
|
|
|
|
|
|
|
|
/* POWER_INPUT_*_CHARGER of course implies presence of the respective
|
|
|
|
* power source. */
|
|
|
|
|
|
|
|
/* Battery not included in CHARGER (it can't charge itself) */
|
|
|
|
|
|
|
|
/* Charging is possible on main. */
|
|
|
|
POWER_INPUT_MAIN_CHARGER = 0x10 | POWER_INPUT_MAIN,
|
|
|
|
|
|
|
|
/* Charging is possible on USB. */
|
|
|
|
POWER_INPUT_USB_CHARGER = 0x20 | POWER_INPUT_USB,
|
|
|
|
|
|
|
|
/* Charging is possible from something. */
|
|
|
|
POWER_INPUT_CHARGER = 0xf0,
|
|
|
|
|
|
|
|
#ifdef HAVE_BATTERY_SWITCH
|
|
|
|
/* Battery is powering device or is available to power device. It
|
|
|
|
* could also be used if the battery is hot-swappable to indicate if
|
|
|
|
* it is present ("switch" as verb vs. noun). */
|
|
|
|
POWER_INPUT_BATTERY = 0x100,
|
2006-02-07 14:46:03 +00:00
|
|
|
#endif
|
2008-12-03 19:54:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Returns detailed power input status information from device. */
|
|
|
|
unsigned int power_input_status(void);
|
|
|
|
|
|
|
|
/* Shortcuts */
|
|
|
|
/* Returns true if any power source that is connected is capable of
|
|
|
|
* charging the batteries.
|
|
|
|
* > (power_input_status() & POWER_INPUT_CHARGER) != 0 */
|
|
|
|
bool charger_inserted(void);
|
|
|
|
|
|
|
|
/* Returns true if any power input is connected - charging-capable
|
|
|
|
* or not.
|
|
|
|
* > (power_input_status() & POWER_INPUT) != 0 */
|
|
|
|
bool power_input_present(void);
|
|
|
|
#endif /* CONFIG_CHARGING */
|
2006-02-07 14:46:03 +00:00
|
|
|
|
|
|
|
void power_off(void);
|
2002-07-04 16:09:23 +00:00
|
|
|
void ide_power_enable(bool on);
|
2006-02-07 14:46:03 +00:00
|
|
|
|
2008-12-24 16:58:41 +00:00
|
|
|
#if CONFIG_CHARGING >= CHARGING_MONITOR
|
2006-02-07 14:46:03 +00:00
|
|
|
bool charging_state(void);
|
2008-12-24 16:58:41 +00:00
|
|
|
#endif
|
2006-02-07 14:46:03 +00:00
|
|
|
|
2010-06-21 16:53:00 +00:00
|
|
|
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
2007-08-12 19:49:03 +00:00
|
|
|
|
2010-03-03 23:20:32 +00:00
|
|
|
void power_init(void) INIT_ATTR;
|
2007-08-12 19:49:03 +00:00
|
|
|
|
2003-12-03 01:03:54 +00:00
|
|
|
bool ide_powered(void);
|
2006-02-07 14:46:03 +00:00
|
|
|
#endif
|
2002-07-04 16:09:23 +00:00
|
|
|
|
2005-04-11 11:17:31 +00:00
|
|
|
#ifdef HAVE_SPDIF_POWER
|
|
|
|
void spdif_power_enable(bool on);
|
2006-11-13 23:21:54 +00:00
|
|
|
bool spdif_powered(void);
|
2005-04-11 11:17:31 +00:00
|
|
|
#endif
|
|
|
|
|
2007-02-18 08:46:12 +00:00
|
|
|
#if CONFIG_TUNER
|
2007-08-14 22:06:23 +00:00
|
|
|
bool tuner_power(bool status);
|
2008-12-27 19:18:50 +00:00
|
|
|
bool tuner_powered(void);
|
2004-10-17 08:53:18 +00:00
|
|
|
#endif
|
|
|
|
|
2008-12-24 16:58:41 +00:00
|
|
|
#endif /* _POWER_H_ */
|