summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/tlv320.c10
-rw-r--r--firmware/drivers/uda1380.c13
-rw-r--r--firmware/export/sound.h2
-rw-r--r--firmware/target/arm/gigabeat/meg-fx/wmcodec-meg-fx.c4
-rw-r--r--firmware/target/arm/wmcodec-pp.c4
-rw-r--r--firmware/target/coldfire/pcm-coldfire.c22
6 files changed, 37 insertions, 18 deletions
diff --git a/firmware/drivers/tlv320.c b/firmware/drivers/tlv320.c
index a88eae5f26..c0f28d31d9 100644
--- a/firmware/drivers/tlv320.c
+++ b/firmware/drivers/tlv320.c
@@ -99,8 +99,18 @@ void audiohw_init(void)
tlv320_write_reg(REG_DAIF, DAIF_IWL_16 | DAIF_FOR_I2S);
tlv320_write_reg(REG_DIA, DIA_ACT);
audiohw_set_frequency(-1); /* default */
+}
+
+/**
+ * Switch outputs ON
+ */
+void audiohw_postinit(void)
+{
/* All ON except ADC, MIC and LINE */
+ sleep(HZ);
tlv320_write_reg(REG_PC, PC_ADC | PC_MIC | PC_LINE);
+ sleep(HZ/4);
+ audiohw_mute(false);
}
/**
diff --git a/firmware/drivers/uda1380.c b/firmware/drivers/uda1380.c
index 00019148c1..6984427fc9 100644
--- a/firmware/drivers/uda1380.c
+++ b/firmware/drivers/uda1380.c
@@ -270,6 +270,19 @@ int audiohw_init(void)
return 0;
}
+void audiohw_postinit(void)
+{
+ /* Sleep a while so the power can stabilize (especially a long
+ delay is needed for the line out connector). */
+ sleep(HZ);
+ /* Power on FSDAC and HP amp. */
+ audiohw_enable_output(true);
+
+ /* UDA1380: Unmute the master channel
+ (DAC should be at zero point now). */
+ audiohw_mute(false);
+}
+
/* Nice shutdown of UDA1380 codec */
void audiohw_close(void)
{
diff --git a/firmware/export/sound.h b/firmware/export/sound.h
index 192384031d..99741c24c1 100644
--- a/firmware/export/sound.h
+++ b/firmware/export/sound.h
@@ -32,6 +32,8 @@
#include "tlv320.h"
#endif
+extern void audiohw_postinit(void);
+
enum {
SOUND_VOLUME = 0,
SOUND_BASS,
diff --git a/firmware/target/arm/gigabeat/meg-fx/wmcodec-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/wmcodec-meg-fx.c
index fd023e1be0..fe42b7527a 100644
--- a/firmware/target/arm/gigabeat/meg-fx/wmcodec-meg-fx.c
+++ b/firmware/target/arm/gigabeat/meg-fx/wmcodec-meg-fx.c
@@ -61,6 +61,10 @@ int audiohw_init(void) {
return 0;
}
+void audiohw_postinit(void)
+{
+}
+
void wmcodec_write(int reg, int data)
{
i2c_send(0x34, (reg<<1) | ((data&0x100)>>8), data&0xff);
diff --git a/firmware/target/arm/wmcodec-pp.c b/firmware/target/arm/wmcodec-pp.c
index e252cf0ac1..505a31deb4 100644
--- a/firmware/target/arm/wmcodec-pp.c
+++ b/firmware/target/arm/wmcodec-pp.c
@@ -92,6 +92,10 @@ int audiohw_init(void) {
return 0;
}
+void audiohw_postinit(void)
+{
+}
+
void wmcodec_write(int reg, int data)
{
pp_i2c_send(I2C_AUDIO_ADDRESS, (reg<<1) | ((data&0x100)>>8),data&0xff);
diff --git a/firmware/target/coldfire/pcm-coldfire.c b/firmware/target/coldfire/pcm-coldfire.c
index ef847004ce..720c77e434 100644
--- a/firmware/target/coldfire/pcm-coldfire.c
+++ b/firmware/target/coldfire/pcm-coldfire.c
@@ -255,6 +255,10 @@ void pcm_init(void)
pcm_play_dma_stop();
/* Call pcm_close_recording to put in closed state */
pcm_close_recording();
+
+ /* Initialize default register values. */
+ audiohw_init();
+
audio_set_output_source(AUDIO_SRC_PLAYBACK);
audio_set_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK);
pcm_set_frequency(HW_FREQ_DEFAULT);
@@ -264,24 +268,6 @@ void pcm_init(void)
#if defined(HAVE_SPDIF_IN) || defined(HAVE_SPDIF_OUT)
spdif_init();
#endif
-
- /* Initialize default register values. */
- audiohw_init();
-
-#if defined(HAVE_UDA1380)
- /* Sleep a while so the power can stabilize (especially a long
- delay is needed for the line out connector). */
- sleep(HZ);
- /* Power on FSDAC and HP amp. */
- audiohw_enable_output(true);
-#elif defined(HAVE_TLV320)
- sleep(HZ/4);
-#endif
-
- /* UDA1380: Unmute the master channel
- (DAC should be at zero point now). */
- audiohw_mute(false);
-
/* Enable interrupt at level 6, priority 0 */
ICR6 = (6 << 2);
and_l(~(1 << 14), &IMR); /* bit 14 is DMA0 */