summaryrefslogtreecommitdiff
path: root/firmware/target
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target')
-rw-r--r--firmware/target/coldfire/iaudio/audio-iaudio.c (renamed from firmware/target/coldfire/iaudio/x5/audio-x5.c)23
-rw-r--r--firmware/target/coldfire/iaudio/fmradio_i2c-iaudio.c (renamed from firmware/target/coldfire/iaudio/m3/fmradio_i2c-m3.c)0
-rw-r--r--firmware/target/coldfire/iaudio/m3/audio-m3.c116
-rw-r--r--firmware/target/coldfire/iaudio/m5/audio-m5.c84
-rw-r--r--firmware/target/coldfire/iaudio/m5/power-m5.c67
-rw-r--r--firmware/target/coldfire/iaudio/power-x5m5.c (renamed from firmware/target/coldfire/iaudio/x5/power-x5.c)2
-rw-r--r--firmware/target/coldfire/iaudio/x5/fmradio_i2c-x5.c39
7 files changed, 25 insertions, 306 deletions
diff --git a/firmware/target/coldfire/iaudio/x5/audio-x5.c b/firmware/target/coldfire/iaudio/audio-iaudio.c
index eb74eaf3b6..ed3a926d72 100644
--- a/firmware/target/coldfire/iaudio/x5/audio-x5.c
+++ b/firmware/target/coldfire/iaudio/audio-iaudio.c
@@ -18,6 +18,7 @@
18 * KIND, either express or implied. 18 * KIND, either express or implied.
19 * 19 *
20 ****************************************************************************/ 20 ****************************************************************************/
21#include "config.h"
21#include "system.h" 22#include "system.h"
22#include "cpu.h" 23#include "cpu.h"
23#include "audio.h" 24#include "audio.h"
@@ -41,9 +42,13 @@ void audio_input_mux(int source, unsigned flags)
41{ 42{
42 /* Prevent pops from unneeded switching */ 43 /* Prevent pops from unneeded switching */
43 static int last_source = AUDIO_SRC_PLAYBACK; 44 static int last_source = AUDIO_SRC_PLAYBACK;
45#ifdef HAVE_FMRADIO_IN
44 static bool last_recording = false; 46 static bool last_recording = false;
45 47
46 bool recording = flags & SRCF_RECORDING; 48 bool recording = flags & SRCF_RECORDING;
49#else
50 (void)flags;
51#endif
47 52
48 switch (source) 53 switch (source)
49 { 54 {
@@ -76,6 +81,7 @@ void audio_input_mux(int source, unsigned flags)
76 } 81 }
77 break; 82 break;
78 83
84#ifdef HAVE_FMRADIO_IN
79 case AUDIO_SRC_FMRADIO: /* recording and playback */ 85 case AUDIO_SRC_FMRADIO: /* recording and playback */
80 if (!recording) 86 if (!recording)
81 audiohw_set_recvol(23, 23, AUDIO_GAIN_LINEIN); 87 audiohw_set_recvol(23, 23, AUDIO_GAIN_LINEIN);
@@ -99,17 +105,34 @@ void audio_input_mux(int source, unsigned flags)
99 coldfire_set_dataincontrol(0); 105 coldfire_set_dataincontrol(0);
100 } 106 }
101 break; 107 break;
108#endif /* HAVE_FMRADIO_IN */
102 } /* end switch */ 109 } /* end switch */
103 110
104 /* set line multiplexer */ 111 /* set line multiplexer */
112#ifdef IAUDIO_M3
113#ifdef HAVE_FMRADIO_IN
114 if (source == AUDIO_SRC_FMRADIO)
115 and_l(~(1 << 25), &GPIO1_OUT); /* FM radio */
116 else
117#endif
118 or_l((1 << 25), &GPIO1_OUT); /* Line In */
119
120 or_l((1 << 25), &GPIO1_ENABLE);
121 or_l((1 << 25), &GPIO1_FUNCTION);
122
123#else /* iAudio M5, X5 */
124#ifdef HAVE_FMRADIO_IN
105 if (source == AUDIO_SRC_FMRADIO) 125 if (source == AUDIO_SRC_FMRADIO)
106 and_l(~(1 << 29), &GPIO_OUT); /* FM radio */ 126 and_l(~(1 << 29), &GPIO_OUT); /* FM radio */
107 else 127 else
128#endif
108 or_l((1 << 29), &GPIO_OUT); /* Line In */ 129 or_l((1 << 29), &GPIO_OUT); /* Line In */
109 130
110 or_l((1 << 29), &GPIO_ENABLE); 131 or_l((1 << 29), &GPIO_ENABLE);
111 or_l((1 << 29), &GPIO_FUNCTION); 132 or_l((1 << 29), &GPIO_FUNCTION);
112 133
134#endif /* iAudio M5, X5 */
135
113 last_source = source; 136 last_source = source;
114} /* audio_input_mux */ 137} /* audio_input_mux */
115 138
diff --git a/firmware/target/coldfire/iaudio/m3/fmradio_i2c-m3.c b/firmware/target/coldfire/iaudio/fmradio_i2c-iaudio.c
index 8bc6fb8445..8bc6fb8445 100644
--- a/firmware/target/coldfire/iaudio/m3/fmradio_i2c-m3.c
+++ b/firmware/target/coldfire/iaudio/fmradio_i2c-iaudio.c
diff --git a/firmware/target/coldfire/iaudio/m3/audio-m3.c b/firmware/target/coldfire/iaudio/m3/audio-m3.c
deleted file mode 100644
index ea401cc40e..0000000000
--- a/firmware/target/coldfire/iaudio/m3/audio-m3.c
+++ /dev/null
@@ -1,116 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006 by Michael Sevakis
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#include "system.h"
23#include "cpu.h"
24#include "audio.h"
25#include "sound.h"
26
27void audio_set_output_source(int source)
28{
29 int level = set_irq_level(DMA_IRQ_LEVEL);
30 unsigned long txsrc;
31
32 if ((unsigned)source >= AUDIO_NUM_SOURCES)
33 txsrc = (3 << 8); /* playback, PDOR3 */
34 else
35 txsrc = (4 << 8); /* recording, iis1RcvData */
36
37 IIS1CONFIG = (IIS1CONFIG & ~(7 << 8)) | txsrc;
38 restore_irq(level);
39} /* audio_set_output_source */
40
41void audio_input_mux(int source, unsigned flags)
42{
43 /* Prevent pops from unneeded switching */
44 static int last_source = AUDIO_SRC_PLAYBACK;
45 static bool last_recording = false;
46
47 bool recording = flags & SRCF_RECORDING;
48
49 switch (source)
50 {
51 default: /* playback - no recording */
52 source = AUDIO_SRC_PLAYBACK;
53 case AUDIO_SRC_PLAYBACK:
54 if (source != last_source)
55 {
56 audiohw_disable_recording();
57 audiohw_set_monitor(false);
58 coldfire_set_dataincontrol(0);
59 }
60 break;
61
62 case AUDIO_SRC_MIC: /* recording only */
63 if (source != last_source)
64 {
65 audiohw_enable_recording(true); /* source mic */
66 /* Int. when 6 samples in FIFO, PDIR2 src = iis1RcvData */
67 coldfire_set_dataincontrol((3 << 14) | (4 << 3));
68 }
69 break;
70
71 case AUDIO_SRC_LINEIN: /* recording only */
72 if (source != last_source)
73 {
74 audiohw_enable_recording(false); /* source line */
75 /* Int. when 6 samples in FIFO, PDIR2 src = iis1RcvData */
76 coldfire_set_dataincontrol((3 << 14) | (4 << 3));
77 }
78 break;
79
80 case AUDIO_SRC_FMRADIO: /* recording and playback */
81 if (!recording)
82 audiohw_set_recvol(23, 23, AUDIO_GAIN_LINEIN);
83
84 /* I2S recording and analog playback */
85 if (source == last_source && recording == last_recording)
86 break;
87
88 last_recording = recording;
89
90 if (recording)
91 {
92 /* Int. when 6 samples in FIFO, PDIR2 src = iis1RcvData */
93 coldfire_set_dataincontrol((3 << 14) | (4 << 3));
94 audiohw_enable_recording(false); /* source line */
95 }
96 else
97 {
98 audiohw_disable_recording();
99 audiohw_set_monitor(true); /* analog bypass */
100 coldfire_set_dataincontrol(0);
101 }
102 break;
103 } /* end switch */
104
105 /* set line multiplexer */
106 if (source == AUDIO_SRC_FMRADIO)
107 and_l(~(1 << 25), &GPIO1_OUT); /* FM radio */
108 else
109 or_l((1 << 25), &GPIO1_OUT); /* Line In */
110
111 or_l((1 << 25), &GPIO1_ENABLE);
112 or_l((1 << 25), &GPIO1_FUNCTION);
113
114 last_source = source;
115} /* audio_input_mux */
116
diff --git a/firmware/target/coldfire/iaudio/m5/audio-m5.c b/firmware/target/coldfire/iaudio/m5/audio-m5.c
deleted file mode 100644
index 728f9be063..0000000000
--- a/firmware/target/coldfire/iaudio/m5/audio-m5.c
+++ /dev/null
@@ -1,84 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006 by Michael Sevakis
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#include "system.h"
22#include "cpu.h"
23#include "audio.h"
24#include "sound.h"
25
26void audio_set_output_source(int source)
27{
28 int level = set_irq_level(DMA_IRQ_LEVEL);
29 unsigned long txsrc;
30
31 if ((unsigned)source >= AUDIO_NUM_SOURCES)
32 txsrc = (3 << 8); /* playback, PDOR3 */
33 else
34 txsrc = (4 << 8); /* recording, iis1RcvData */
35
36 IIS1CONFIG = (IIS1CONFIG & ~(7 << 8)) | txsrc;
37 restore_irq(level);
38} /* audio_set_output_source */
39
40void audio_input_mux(int source, unsigned flags)
41{
42 /* Prevent pops from unneeded switching */
43 static int last_source = AUDIO_SRC_PLAYBACK;
44
45 (void)flags;
46
47 switch (source)
48 {
49 default: /* playback - no recording */
50 source = AUDIO_SRC_PLAYBACK;
51 case AUDIO_SRC_PLAYBACK:
52 if (source != last_source)
53 {
54 audiohw_disable_recording();
55 audiohw_set_monitor(false);
56 coldfire_set_dataincontrol(0);
57 }
58 break;
59
60 case AUDIO_SRC_MIC: /* recording only */
61 if (source != last_source)
62 {
63 audiohw_enable_recording(true); /* source mic */
64 /* Int. when 6 samples in FIFO, PDIR2 src = iis1RcvData */
65 coldfire_set_dataincontrol((3 << 14) | (4 << 3));
66 }
67 break;
68
69 case AUDIO_SRC_LINEIN: /* recording only */
70 if (source != last_source)
71 {
72 audiohw_enable_recording(false); /* source line */
73 /* Int. when 6 samples in FIFO, PDIR2 src = iis1RcvData */
74 coldfire_set_dataincontrol((3 << 14) | (4 << 3));
75 }
76 break;
77 } /* end switch */
78
79 or_l((1 << 29), &GPIO_OUT); /* Line In */
80 or_l((1 << 29), &GPIO_ENABLE);
81 or_l((1 << 29), &GPIO_FUNCTION);
82
83 last_source = source;
84} /* audio_input_mux */
diff --git a/firmware/target/coldfire/iaudio/m5/power-m5.c b/firmware/target/coldfire/iaudio/m5/power-m5.c
deleted file mode 100644
index 8bb36c663d..0000000000
--- a/firmware/target/coldfire/iaudio/m5/power-m5.c
+++ /dev/null
@@ -1,67 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006 by Linus Nielsen Feltzing
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#include "config.h"
22#include "cpu.h"
23#include <stdbool.h>
24#include "kernel.h"
25#include "system.h"
26#include "power.h"
27#include "pcf50606.h"
28#include "lcd-remote-target.h"
29
30void power_init(void)
31{
32 /* Charger detect */
33 and_l(~0x01000000, &GPIO1_ENABLE);
34 or_l(0x01000000, &GPIO1_FUNCTION);
35
36 pcf50606_init();
37}
38
39unsigned int power_input_status(void)
40{
41 return (GPIO1_READ & 0x01000000) ?
42 POWER_INPUT_MAIN_CHARGER : POWER_INPUT_NONE;
43}
44
45void ide_power_enable(bool on)
46{
47 /* GPOOD3 */
48 int level = disable_irq_save();
49 pcf50606_write(0x3c, on ? 0x07 : 0x00);
50 restore_irq(level);
51}
52
53bool ide_powered(void)
54{
55 int level = disable_irq_save();
56 int value = pcf50606_read(0x3c);
57 restore_irq(level);
58 return (value & 0x07) != 0;
59}
60
61void power_off(void)
62{
63 lcd_remote_poweroff();
64 set_irq_level(DISABLE_INTERRUPTS);
65 and_l(~0x00000008, &GPIO_OUT); /* Set KEEPACT low */
66 asm("halt");
67}
diff --git a/firmware/target/coldfire/iaudio/x5/power-x5.c b/firmware/target/coldfire/iaudio/power-x5m5.c
index 4feb9c15d0..e9bdde16ec 100644
--- a/firmware/target/coldfire/iaudio/x5/power-x5.c
+++ b/firmware/target/coldfire/iaudio/power-x5m5.c
@@ -66,8 +66,10 @@ void power_off(void)
66 asm("halt"); 66 asm("halt");
67} 67}
68 68
69#if (CONFIG_TUNER & TEA5767)
69bool tuner_power(bool status) 70bool tuner_power(bool status)
70{ 71{
71 (void)status; 72 (void)status;
72 return true; 73 return true;
73} 74}
75#endif
diff --git a/firmware/target/coldfire/iaudio/x5/fmradio_i2c-x5.c b/firmware/target/coldfire/iaudio/x5/fmradio_i2c-x5.c
deleted file mode 100644
index 68baed9bb3..0000000000
--- a/firmware/target/coldfire/iaudio/x5/fmradio_i2c-x5.c
+++ /dev/null
@@ -1,39 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 * Physical interface of the Philips TEA5767 in iAudio x5
10 *
11 * Copyright (C) 2002 by Linus Nielsen Feltzing
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
17 *
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
20 *
21 ****************************************************************************/
22#include "config.h"
23
24#if (CONFIG_TUNER & TEA5767)
25
26#include "i2c-coldfire.h"
27
28int fmradio_i2c_write(unsigned char address, const unsigned char* buf,
29 int count)
30{
31 return i2c_write(I2C_IFACE_0, address, buf, count);
32}
33
34int fmradio_i2c_read(unsigned char address, unsigned char* buf, int count)
35{
36 return i2c_read(I2C_IFACE_0, address, buf, count);
37}
38
39#endif