diff options
Diffstat (limited to 'firmware/target')
-rw-r--r-- | firmware/target/arm/adc-as3514.c | 10 | ||||
-rw-r--r-- | firmware/target/arm/ascodec-pp.c | 66 | ||||
-rw-r--r-- | firmware/target/arm/ascodec-target.h | 69 | ||||
-rw-r--r-- | firmware/target/arm/i2c-pp.c | 3 | ||||
-rw-r--r-- | firmware/target/arm/philips/sa9200/backlight-sa9200.c | 6 | ||||
-rw-r--r-- | firmware/target/arm/philips/sa9200/power-sa9200.c | 4 | ||||
-rw-r--r-- | firmware/target/arm/sandisk/backlight-c200_e200.c | 6 | ||||
-rw-r--r-- | firmware/target/arm/sandisk/power-c200_e200.c | 6 |
8 files changed, 153 insertions, 17 deletions
diff --git a/firmware/target/arm/adc-as3514.c b/firmware/target/arm/adc-as3514.c index 26cdc76f0d..9c2a421441 100644 --- a/firmware/target/arm/adc-as3514.c +++ b/firmware/target/arm/adc-as3514.c | |||
@@ -20,7 +20,7 @@ | |||
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include "adc.h" | 21 | #include "adc.h" |
22 | #include "kernel.h" | 22 | #include "kernel.h" |
23 | #include "i2c-pp.h" | 23 | #include "ascodec.h" |
24 | #include "as3514.h" | 24 | #include "as3514.h" |
25 | 25 | ||
26 | /* Read 10-bit channel data */ | 26 | /* Read 10-bit channel data */ |
@@ -30,21 +30,21 @@ unsigned short adc_read(int channel) | |||
30 | 30 | ||
31 | if ((unsigned)channel < NUM_ADC_CHANNELS) | 31 | if ((unsigned)channel < NUM_ADC_CHANNELS) |
32 | { | 32 | { |
33 | i2c_lock(); | 33 | ascodec_lock(); |
34 | 34 | ||
35 | /* Select channel */ | 35 | /* Select channel */ |
36 | if (pp_i2c_send( AS3514_I2C_ADDR, AS3514_ADC_0, (channel << 4)) >= 0) | 36 | if (ascodec_write(AS3514_ADC_0, (channel << 4)) >= 0) |
37 | { | 37 | { |
38 | unsigned char buf[2]; | 38 | unsigned char buf[2]; |
39 | 39 | ||
40 | /* Read data */ | 40 | /* Read data */ |
41 | if (i2c_readbytes( AS3514_I2C_ADDR, AS3514_ADC_0, 2, buf) >= 0) | 41 | if (ascodec_readbytes(AS3514_ADC_0, 2, buf) >= 0) |
42 | { | 42 | { |
43 | data = (((buf[0] & 0x3) << 8) | buf[1]); | 43 | data = (((buf[0] & 0x3) << 8) | buf[1]); |
44 | } | 44 | } |
45 | } | 45 | } |
46 | 46 | ||
47 | i2c_unlock(); | 47 | ascodec_unlock(); |
48 | } | 48 | } |
49 | 49 | ||
50 | return data; | 50 | return data; |
diff --git a/firmware/target/arm/ascodec-pp.c b/firmware/target/arm/ascodec-pp.c new file mode 100644 index 0000000000..30b6b1f8de --- /dev/null +++ b/firmware/target/arm/ascodec-pp.c | |||
@@ -0,0 +1,66 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Driver for AS3514 audio codec | ||
11 | * | ||
12 | * Copyright (c) 2007 Daniel Ankers | ||
13 | * Copyright (c) 2007 Christian Gmeiner | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or | ||
16 | * modify it under the terms of the GNU General Public License | ||
17 | * as published by the Free Software Foundation; either version 2 | ||
18 | * of the License, or (at your option) any later version. | ||
19 | * | ||
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
21 | * KIND, either express or implied. | ||
22 | * | ||
23 | ****************************************************************************/ | ||
24 | #include "cpu.h" | ||
25 | #include "system.h" | ||
26 | |||
27 | #include "audiohw.h" | ||
28 | #include "i2s.h" | ||
29 | |||
30 | /* | ||
31 | * Initialise the PP I2C and I2S. | ||
32 | */ | ||
33 | void audiohw_init(void) | ||
34 | { | ||
35 | /* normal outputs for CDI and I2S pin groups */ | ||
36 | DEV_INIT2 &= ~0x300; | ||
37 | |||
38 | /*mini2?*/ | ||
39 | DEV_INIT1 &=~0x3000000; | ||
40 | /*mini2?*/ | ||
41 | |||
42 | /* device reset */ | ||
43 | DEV_RS |= DEV_I2S; | ||
44 | DEV_RS &=~DEV_I2S; | ||
45 | |||
46 | /* I2S device reset */ | ||
47 | DEV_RS |= DEV_I2S; | ||
48 | DEV_RS &=~DEV_I2S; | ||
49 | |||
50 | /* I2S device enable */ | ||
51 | DEV_EN |= DEV_I2S; | ||
52 | |||
53 | /* enable external dev clock clocks */ | ||
54 | DEV_EN |= DEV_EXTCLOCKS; | ||
55 | |||
56 | /* external dev clock to 24MHz */ | ||
57 | outl(inl(0x70000018) & ~0xc, 0x70000018); | ||
58 | |||
59 | i2s_reset(); | ||
60 | |||
61 | audiohw_preinit(); | ||
62 | } | ||
63 | |||
64 | void audiohw_postinit(void) | ||
65 | { | ||
66 | } | ||
diff --git a/firmware/target/arm/ascodec-target.h b/firmware/target/arm/ascodec-target.h new file mode 100644 index 0000000000..19b1644541 --- /dev/null +++ b/firmware/target/arm/ascodec-target.h | |||
@@ -0,0 +1,69 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Driver for AS3514 audio codec | ||
11 | * | ||
12 | * Copyright (c) 2007 Daniel Ankers | ||
13 | * Copyright (c) 2007 Christian Gmeiner | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or | ||
16 | * modify it under the terms of the GNU General Public License | ||
17 | * as published by the Free Software Foundation; either version 2 | ||
18 | * of the License, or (at your option) any later version. | ||
19 | * | ||
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
21 | * KIND, either express or implied. | ||
22 | * | ||
23 | ****************************************************************************/ | ||
24 | |||
25 | #ifndef _ASCODEC_TARGET_H | ||
26 | #define _ASCODEC_TARGET_H | ||
27 | |||
28 | #include "config.h" | ||
29 | |||
30 | #ifdef CPU_PP | ||
31 | /* TODO: This header is actually portalplayer specific, and should be | ||
32 | * moved into an appropriate subdir */ | ||
33 | |||
34 | #include "i2c-pp.h" | ||
35 | |||
36 | #if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200) | ||
37 | #define AS3514_I2C_ADDR 0x46 | ||
38 | #else | ||
39 | #error Unknown target! | ||
40 | #endif | ||
41 | |||
42 | static inline int ascodec_write(unsigned int reg, unsigned int value) | ||
43 | { | ||
44 | return pp_i2c_send(AS3514_I2C_ADDR, reg, value); | ||
45 | } | ||
46 | |||
47 | static inline int ascodec_read(unsigned int reg) | ||
48 | { | ||
49 | return i2c_readbyte(AS3514_I2C_ADDR, reg); | ||
50 | } | ||
51 | |||
52 | static inline int ascodec_readbytes(int addr, int len, unsigned char *data) | ||
53 | { | ||
54 | return i2c_readbytes(AS3514_I2C_ADDR, addr, len, data); | ||
55 | } | ||
56 | |||
57 | static inline void ascodec_lock(void) | ||
58 | { | ||
59 | i2c_lock(); | ||
60 | } | ||
61 | |||
62 | static inline void ascodec_unlock(void) | ||
63 | { | ||
64 | i2c_unlock(); | ||
65 | } | ||
66 | |||
67 | #endif /* CPU_PP */ | ||
68 | |||
69 | #endif /* !_ASCODEC_TARGET_H */ | ||
diff --git a/firmware/target/arm/i2c-pp.c b/firmware/target/arm/i2c-pp.c index 4d83208d91..3db25c027c 100644 --- a/firmware/target/arm/i2c-pp.c +++ b/firmware/target/arm/i2c-pp.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include "logf.h" | 32 | #include "logf.h" |
33 | #include "system.h" | 33 | #include "system.h" |
34 | #include "i2c-pp.h" | 34 | #include "i2c-pp.h" |
35 | #include "ascodec.h" | ||
35 | #include "as3514.h" | 36 | #include "as3514.h" |
36 | 37 | ||
37 | /* Local functions definitions */ | 38 | /* Local functions definitions */ |
@@ -230,7 +231,7 @@ void i2c_init(void) | |||
230 | outl(0, 0x600060a4); | 231 | outl(0, 0x600060a4); |
231 | outl(0x1e, 0x600060a4); | 232 | outl(0x1e, 0x600060a4); |
232 | 233 | ||
233 | pp_i2c_send(AS3514_I2C_ADDR, AS3514_SUPERVISOR, 5); | 234 | ascodec_write(AS3514_SUPERVISOR, 5); |
234 | #endif | 235 | #endif |
235 | #endif | 236 | #endif |
236 | 237 | ||
diff --git a/firmware/target/arm/philips/sa9200/backlight-sa9200.c b/firmware/target/arm/philips/sa9200/backlight-sa9200.c index 33342d19f1..b3984ca9ad 100644 --- a/firmware/target/arm/philips/sa9200/backlight-sa9200.c +++ b/firmware/target/arm/philips/sa9200/backlight-sa9200.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include "system.h" | 23 | #include "system.h" |
24 | #include "lcd.h" | 24 | #include "lcd.h" |
25 | #include "backlight.h" | 25 | #include "backlight.h" |
26 | #include "i2c-pp.h" | 26 | #include "ascodec.h" |
27 | #include "as3514.h" | 27 | #include "as3514.h" |
28 | 28 | ||
29 | static unsigned short backlight_brightness = DEFAULT_BRIGHTNESS_SETTING; | 29 | static unsigned short backlight_brightness = DEFAULT_BRIGHTNESS_SETTING; |
@@ -46,12 +46,12 @@ void _backlight_on(void) | |||
46 | #ifdef HAVE_LCD_ENABLE | 46 | #ifdef HAVE_LCD_ENABLE |
47 | lcd_enable(true); /* power on lcd + visible display */ | 47 | lcd_enable(true); /* power on lcd + visible display */ |
48 | #endif | 48 | #endif |
49 | pp_i2c_send(AS3514_I2C_ADDR, AS3514_DCDC15, backlight_brightness); | 49 | ascodec_write(AS3514_DCDC15, backlight_brightness); |
50 | } | 50 | } |
51 | 51 | ||
52 | void _backlight_off(void) | 52 | void _backlight_off(void) |
53 | { | 53 | { |
54 | pp_i2c_send(AS3514_I2C_ADDR, AS3514_DCDC15, 0x0); | 54 | ascodec_write(AS3514_DCDC15, 0x0); |
55 | #ifdef HAVE_LCD_ENABLE | 55 | #ifdef HAVE_LCD_ENABLE |
56 | lcd_enable(false); /* power off visible display */ | 56 | lcd_enable(false); /* power off visible display */ |
57 | #endif | 57 | #endif |
diff --git a/firmware/target/arm/philips/sa9200/power-sa9200.c b/firmware/target/arm/philips/sa9200/power-sa9200.c index a559f65ec4..b005a86651 100644 --- a/firmware/target/arm/philips/sa9200/power-sa9200.c +++ b/firmware/target/arm/philips/sa9200/power-sa9200.c | |||
@@ -36,9 +36,9 @@ void power_off(void) | |||
36 | char byte; | 36 | char byte; |
37 | 37 | ||
38 | /* Send shutdown command to PMU */ | 38 | /* Send shutdown command to PMU */ |
39 | byte = i2c_readbyte(AS3514_I2C_ADDR, AS3514_SYSTEM); | 39 | byte = ascodec_read(AS3514_SYSTEM); |
40 | byte &= ~0x1; | 40 | byte &= ~0x1; |
41 | pp_i2c_send(AS3514_I2C_ADDR, AS3514_SYSTEM, byte); | 41 | ascodec_write(AS3514_SYSTEM, byte); |
42 | 42 | ||
43 | /* Stop interrupts on both cores */ | 43 | /* Stop interrupts on both cores */ |
44 | disable_interrupt(IRQ_FIQ_STATUS); | 44 | disable_interrupt(IRQ_FIQ_STATUS); |
diff --git a/firmware/target/arm/sandisk/backlight-c200_e200.c b/firmware/target/arm/sandisk/backlight-c200_e200.c index 33342d19f1..b3984ca9ad 100644 --- a/firmware/target/arm/sandisk/backlight-c200_e200.c +++ b/firmware/target/arm/sandisk/backlight-c200_e200.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include "system.h" | 23 | #include "system.h" |
24 | #include "lcd.h" | 24 | #include "lcd.h" |
25 | #include "backlight.h" | 25 | #include "backlight.h" |
26 | #include "i2c-pp.h" | 26 | #include "ascodec.h" |
27 | #include "as3514.h" | 27 | #include "as3514.h" |
28 | 28 | ||
29 | static unsigned short backlight_brightness = DEFAULT_BRIGHTNESS_SETTING; | 29 | static unsigned short backlight_brightness = DEFAULT_BRIGHTNESS_SETTING; |
@@ -46,12 +46,12 @@ void _backlight_on(void) | |||
46 | #ifdef HAVE_LCD_ENABLE | 46 | #ifdef HAVE_LCD_ENABLE |
47 | lcd_enable(true); /* power on lcd + visible display */ | 47 | lcd_enable(true); /* power on lcd + visible display */ |
48 | #endif | 48 | #endif |
49 | pp_i2c_send(AS3514_I2C_ADDR, AS3514_DCDC15, backlight_brightness); | 49 | ascodec_write(AS3514_DCDC15, backlight_brightness); |
50 | } | 50 | } |
51 | 51 | ||
52 | void _backlight_off(void) | 52 | void _backlight_off(void) |
53 | { | 53 | { |
54 | pp_i2c_send(AS3514_I2C_ADDR, AS3514_DCDC15, 0x0); | 54 | ascodec_write(AS3514_DCDC15, 0x0); |
55 | #ifdef HAVE_LCD_ENABLE | 55 | #ifdef HAVE_LCD_ENABLE |
56 | lcd_enable(false); /* power off visible display */ | 56 | lcd_enable(false); /* power off visible display */ |
57 | #endif | 57 | #endif |
diff --git a/firmware/target/arm/sandisk/power-c200_e200.c b/firmware/target/arm/sandisk/power-c200_e200.c index a559f65ec4..d6319f44bb 100644 --- a/firmware/target/arm/sandisk/power-c200_e200.c +++ b/firmware/target/arm/sandisk/power-c200_e200.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <stdbool.h> | 22 | #include <stdbool.h> |
23 | #include "system.h" | 23 | #include "system.h" |
24 | #include "cpu.h" | 24 | #include "cpu.h" |
25 | #include "i2c-pp.h" | 25 | #include "ascodec.h" |
26 | #include "tuner.h" | 26 | #include "tuner.h" |
27 | #include "as3514.h" | 27 | #include "as3514.h" |
28 | #include "power.h" | 28 | #include "power.h" |
@@ -36,9 +36,9 @@ void power_off(void) | |||
36 | char byte; | 36 | char byte; |
37 | 37 | ||
38 | /* Send shutdown command to PMU */ | 38 | /* Send shutdown command to PMU */ |
39 | byte = i2c_readbyte(AS3514_I2C_ADDR, AS3514_SYSTEM); | 39 | byte = ascodec_read(AS3514_SYSTEM); |
40 | byte &= ~0x1; | 40 | byte &= ~0x1; |
41 | pp_i2c_send(AS3514_I2C_ADDR, AS3514_SYSTEM, byte); | 41 | ascodec_write(AS3514_SYSTEM, byte); |
42 | 42 | ||
43 | /* Stop interrupts on both cores */ | 43 | /* Stop interrupts on both cores */ |
44 | disable_interrupt(IRQ_FIQ_STATUS); | 44 | disable_interrupt(IRQ_FIQ_STATUS); |