summaryrefslogtreecommitdiff
path: root/firmware/target/arm/s3c2440/gigabeat-fx/power-meg-fx.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/s3c2440/gigabeat-fx/power-meg-fx.c')
-rw-r--r--firmware/target/arm/s3c2440/gigabeat-fx/power-meg-fx.c90
1 files changed, 90 insertions, 0 deletions
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/power-meg-fx.c b/firmware/target/arm/s3c2440/gigabeat-fx/power-meg-fx.c
new file mode 100644
index 0000000000..eb2ffb5238
--- /dev/null
+++ b/firmware/target/arm/s3c2440/gigabeat-fx/power-meg-fx.c
@@ -0,0 +1,90 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006 by Linus Nielsen Feltzing
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#include "config.h"
20#include "cpu.h"
21#include <stdbool.h>
22#include "kernel.h"
23#include "system.h"
24#include "power.h"
25#include "pcf50606.h"
26#include "backlight.h"
27#include "backlight-target.h"
28
29#ifndef SIMULATOR
30
31void power_init(void)
32{
33 /* Charger detect */
34}
35
36bool charger_inserted(void)
37{
38 return (GPFDAT & (1 << 4)) ? false : true;
39}
40
41/* Returns true if the unit is charging the batteries. */
42bool charging_state(void) {
43 return (GPGDAT & (1 << 8)) ? false : true;
44}
45
46void ide_power_enable(bool on)
47{
48 if (on)
49 GPGDAT |= (1 << 11);
50 else
51 GPGDAT &= ~(1 << 11);
52}
53
54bool ide_powered(void)
55{
56 return (GPGDAT & (1 << 11)) != 0;
57}
58
59void power_off(void)
60{
61 /* turn off backlight and wait for 1 second */
62 __backlight_off();
63 sleep(HZ/2);
64 /* set SLEEP bit to on in CLKCON to turn off */
65 CLKCON |=(1<<3);
66}
67
68#else /* SIMULATOR */
69
70bool charger_inserted(void)
71{
72 return false;
73}
74
75void charger_enable(bool on)
76{
77 (void)on;
78}
79
80void power_off(void)
81{
82}
83
84void ide_power_enable(bool on)
85{
86 (void)on;
87}
88
89#endif /* SIMULATOR */
90