diff options
author | Tomasz Moń <desowin@gmail.com> | 2011-12-04 09:48:10 +0000 |
---|---|---|
committer | Tomasz Moń <desowin@gmail.com> | 2011-12-04 09:48:10 +0000 |
commit | 2ee9facc11745db8d2b5d8795e24e683c9deee5e (patch) | |
tree | 9a965c58ec04550ccf197c86e9272d3580c832ac | |
parent | de712eebbdbfc1a514ede554ba7d5d7db8ed4478 (diff) | |
download | rockbox-2ee9facc11745db8d2b5d8795e24e683c9deee5e.tar.gz rockbox-2ee9facc11745db8d2b5d8795e24e683c9deee5e.zip |
Power management is to be kept in target tree due to being target specific.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31136 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/SOURCES | 1 | ||||
-rw-r--r-- | firmware/drivers/tps65021.c | 64 | ||||
-rw-r--r-- | firmware/export/tps65021.h | 27 | ||||
-rw-r--r-- | firmware/target/arm/tms320dm320/sansa-connect/power-sansaconnect.c | 28 |
4 files changed, 26 insertions, 94 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES index 5610b5ab5a..f5ee7873a2 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -1118,7 +1118,6 @@ target/arm/tms320dm320/creative-zvm/usb-creativezvm.c | |||
1118 | 1118 | ||
1119 | #ifdef SANSA_CONNECT | 1119 | #ifdef SANSA_CONNECT |
1120 | #ifndef SIMULATOR | 1120 | #ifndef SIMULATOR |
1121 | drivers/tps65021.c | ||
1122 | target/arm/mmu-arm.S | 1121 | target/arm/mmu-arm.S |
1123 | target/arm/lcd-as-memframe.S | 1122 | target/arm/lcd-as-memframe.S |
1124 | target/arm/tms320dm320/sdmmc-dm320.c | 1123 | target/arm/tms320dm320/sdmmc-dm320.c |
diff --git a/firmware/drivers/tps65021.c b/firmware/drivers/tps65021.c deleted file mode 100644 index d645b0d6f0..0000000000 --- a/firmware/drivers/tps65021.c +++ /dev/null | |||
@@ -1,64 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id: $ | ||
9 | * | ||
10 | * Driver for TPS 65021 Power Management IC | ||
11 | * | ||
12 | * Copyright (c) 2011 Tomasz Moń | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License | ||
16 | * as published by the Free Software Foundation; either version 2 | ||
17 | * of the License, or (at your option) any later version. | ||
18 | * | ||
19 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
20 | * KIND, either express or implied. | ||
21 | * | ||
22 | ****************************************************************************/ | ||
23 | #include "system.h" | ||
24 | #include "config.h" | ||
25 | #if CONFIG_I2C == I2C_DM320 | ||
26 | #include "i2c-dm320.h" | ||
27 | #endif | ||
28 | #include "logf.h" | ||
29 | #include "tps65021.h" | ||
30 | |||
31 | /* (7-bit) address is 0x48, the LSB is read/write flag */ | ||
32 | #define TPS65021_ADDR (0x48 << 1) | ||
33 | |||
34 | static void tps65021_write_reg(unsigned reg, unsigned value) | ||
35 | { | ||
36 | unsigned char data[2]; | ||
37 | |||
38 | data[0] = reg; | ||
39 | data[1] = value; | ||
40 | |||
41 | #if CONFIG_I2C == I2C_DM320 | ||
42 | if (i2c_write(TPS65021_ADDR, data, 2) != 0) | ||
43 | #else | ||
44 | #warning Implement tps65021_write_reg() | ||
45 | #endif | ||
46 | { | ||
47 | logf("TPS65021 error reg=0x%x", reg); | ||
48 | return; | ||
49 | } | ||
50 | } | ||
51 | |||
52 | void tps65021_init(void) | ||
53 | { | ||
54 | #ifdef SANSA_CONNECT | ||
55 | /* PWM mode */ | ||
56 | tps65021_write_reg(0x04, 0xB2); | ||
57 | |||
58 | /* Set core voltage to 1.5V */ | ||
59 | tps65021_write_reg(0x06, 0x1C); | ||
60 | |||
61 | /* Set LCM (LDO1) to 2.85V, Set CODEC and USB (LDO2) to 1.8V */ | ||
62 | tps65021_write_reg(0x08, 0x36); | ||
63 | #endif | ||
64 | } | ||
diff --git a/firmware/export/tps65021.h b/firmware/export/tps65021.h deleted file mode 100644 index 2b28ccb37e..0000000000 --- a/firmware/export/tps65021.h +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id: $ | ||
9 | * | ||
10 | * Copyright (C) 2011 by Tomasz Moń | ||
11 | * | ||
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. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #ifndef TPS65021_H | ||
23 | #define TPS65021_H | ||
24 | |||
25 | void tps65021_init(void); | ||
26 | |||
27 | #endif | ||
diff --git a/firmware/target/arm/tms320dm320/sansa-connect/power-sansaconnect.c b/firmware/target/arm/tms320dm320/sansa-connect/power-sansaconnect.c index bb03e4c0dd..07c80a07c3 100644 --- a/firmware/target/arm/tms320dm320/sansa-connect/power-sansaconnect.c +++ b/firmware/target/arm/tms320dm320/sansa-connect/power-sansaconnect.c | |||
@@ -28,11 +28,35 @@ | |||
28 | #include "backlight.h" | 28 | #include "backlight.h" |
29 | #include "backlight-target.h" | 29 | #include "backlight-target.h" |
30 | #include "avr-sansaconnect.h" | 30 | #include "avr-sansaconnect.h" |
31 | #include "tps65021.h" | 31 | #include "i2c-dm320.h" |
32 | #include "logf.h" | ||
33 | |||
34 | /* (7-bit) address is 0x48, the LSB is read/write flag */ | ||
35 | #define TPS65021_ADDR (0x48 << 1) | ||
36 | |||
37 | static void tps65021_write_reg(unsigned reg, unsigned value) | ||
38 | { | ||
39 | unsigned char data[2]; | ||
40 | |||
41 | data[0] = reg; | ||
42 | data[1] = value; | ||
43 | |||
44 | if (i2c_write(TPS65021_ADDR, data, 2) != 0) | ||
45 | { | ||
46 | logf("TPS65021 error reg=0x%x", reg); | ||
47 | } | ||
48 | } | ||
32 | 49 | ||
33 | void power_init(void) | 50 | void power_init(void) |
34 | { | 51 | { |
35 | tps65021_init(); | 52 | /* PWM mode */ |
53 | tps65021_write_reg(0x04, 0xB2); | ||
54 | |||
55 | /* Set core voltage to 1.5V */ | ||
56 | tps65021_write_reg(0x06, 0x1C); | ||
57 | |||
58 | /* Set LCM (LDO1) to 2.85V, Set CODEC and USB (LDO2) to 1.8V */ | ||
59 | tps65021_write_reg(0x08, 0x36); | ||
36 | } | 60 | } |
37 | 61 | ||
38 | void power_off(void) | 62 | void power_off(void) |