diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/audio/tsc2100.c | 11 | ||||
-rw-r--r-- | firmware/drivers/audio/uda1380.c | 14 | ||||
-rw-r--r-- | firmware/drivers/audio/wm8721.c | 50 | ||||
-rw-r--r-- | firmware/drivers/audio/wm8731.c | 3 | ||||
-rw-r--r-- | firmware/drivers/audio/wm8751.c | 1 | ||||
-rw-r--r-- | firmware/drivers/audio/wm8758.c | 3 | ||||
-rw-r--r-- | firmware/drivers/audio/wm8975.c | 3 | ||||
-rw-r--r-- | firmware/drivers/audio/wm8985.c | 75 | ||||
-rw-r--r-- | firmware/export/audiohw.h | 11 | ||||
-rw-r--r-- | firmware/target/arm/pcm-pp.c | 8 | ||||
-rw-r--r-- | firmware/target/arm/pcm-telechips.c | 13 | ||||
-rw-r--r-- | firmware/target/arm/tcc77x/iaudio7/audio-iaudio7.c | 5 | ||||
-rw-r--r-- | firmware/target/arm/tcc77x/logikdax/audio-logikdax.c | 5 | ||||
-rw-r--r-- | firmware/target/arm/tcc77x/m200/audio-m200.c | 5 | ||||
-rw-r--r-- | firmware/target/arm/wmcodec-pp.c | 18 | ||||
-rw-r--r-- | firmware/target/mips/ingenic_jz47xx/pcm-jz4740.c | 9 |
16 files changed, 76 insertions, 158 deletions
diff --git a/firmware/drivers/audio/tsc2100.c b/firmware/drivers/audio/tsc2100.c index 038f3ed178..e0e2c53e69 100644 --- a/firmware/drivers/audio/tsc2100.c +++ b/firmware/drivers/audio/tsc2100.c @@ -90,16 +90,7 @@ void audiohw_init(void) void audiohw_postinit(void) { -} - -/* Silently enable / disable audio output */ -void audiohw_enable_output(bool enable) -{ - if (enable) { - audiohw_mute(0); - } else { - audiohw_mute(1); - } + audiohw_mute(0); } void audiohw_set_master_vol(int vol_l, int vol_r) diff --git a/firmware/drivers/audio/uda1380.c b/firmware/drivers/audio/uda1380.c index e76b08a429..a0e7ef56d8 100644 --- a/firmware/drivers/audio/uda1380.c +++ b/firmware/drivers/audio/uda1380.c @@ -193,17 +193,6 @@ static int audiohw_set_regs(void) return 0; } -/* Silently enable / disable audio output */ -void audiohw_enable_output(bool enable) -{ - if (enable) { - uda1380_write_reg(REG_PWR, uda1380_regs[REG_PWR] | PON_DAC | PON_HP); - } else { - uda1380_write_reg(REG_MUTE, MUTE_MASTER); - uda1380_write_reg(REG_PWR, uda1380_regs[REG_PWR] & ~PON_DAC); - } -} - static void reset(void) { #ifdef IRIVER_H300_SERIES @@ -278,8 +267,9 @@ 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_write_reg(REG_PWR, uda1380_regs[REG_PWR] | PON_DAC | PON_HP); /* UDA1380: Unmute the master channel (DAC should be at zero point now). */ diff --git a/firmware/drivers/audio/wm8721.c b/firmware/drivers/audio/wm8721.c index 6c4e12b9dc..3f14ca467e 100644 --- a/firmware/drivers/audio/wm8721.c +++ b/firmware/drivers/audio/wm8721.c @@ -33,7 +33,6 @@ #include "wmcodec.h" #include "audiohw.h" -#include "i2s.h" #define IPOD_PCM_LEVEL 0x65 /* -6dB */ @@ -91,43 +90,38 @@ static void codec_set_active(int active) /* Silently enable / disable audio output */ -void audiohw_enable_output(bool enable) +void audiohw_preinit(void) { - if (enable) - { - /* reset the I2S controller into known state */ - i2s_reset(); - - wmcodec_write(RESET, 0x0); /*Reset*/ + wmcodec_write(RESET, 0x0); /*Reset*/ - codec_set_active(0x0); + codec_set_active(0x0); - /* DACSEL=1 */ - wmcodec_write(0x4, 0x10); + /* DACSEL=1 */ + wmcodec_write(0x4, 0x10); - /* set power register to POWEROFF=0 on OUTPD=0, DACPD=0 */ - wmcodec_write(PDCTRL, 0x67); + /* set power register to POWEROFF=0 on OUTPD=0, DACPD=0 */ + wmcodec_write(PDCTRL, 0x67); - /* BCLKINV=0(Dont invert BCLK) MS=1(Enable Master) LRSWAP=0 LRP=0 */ - /* IWL=00(16 bit) FORMAT=10(I2S format) */ - wmcodec_write(AINTFCE, 0x42); + /* BCLKINV=0(Dont invert BCLK) MS=1(Enable Master) LRSWAP=0 LRP=0 */ + /* IWL=00(16 bit) FORMAT=10(I2S format) */ + wmcodec_write(AINTFCE, 0x42); - audiohw_set_sample_rate(WM8721_USB24_44100HZ); + audiohw_set_sample_rate(WM8721_USB24_44100HZ); - /* set the volume to -6dB */ - wmcodec_write(LOUTVOL, IPOD_PCM_LEVEL); - wmcodec_write(ROUTVOL, 0x100 | IPOD_PCM_LEVEL); + /* set the volume to -6dB */ + wmcodec_write(LOUTVOL, IPOD_PCM_LEVEL); + wmcodec_write(ROUTVOL, 0x100 | IPOD_PCM_LEVEL); - /* ACTIVE=1 */ - codec_set_active(1); + /* ACTIVE=1 */ + codec_set_active(1); - /* 5. Set DACMU = 0 to soft-un-mute the audio DACs. */ - wmcodec_write(DAPCTRL, 0x0); + /* 5. Set DACMU = 0 to soft-un-mute the audio DACs. */ + wmcodec_write(DAPCTRL, 0x0); +} - audiohw_mute(0); - } else { - audiohw_mute(1); - } +void audiohw_postinit(void) +{ + audiohw_mute(0); } void audiohw_set_master_vol(int vol_l, int vol_r) diff --git a/firmware/drivers/audio/wm8731.c b/firmware/drivers/audio/wm8731.c index d6e21c34de..2f882e8fe1 100644 --- a/firmware/drivers/audio/wm8731.c +++ b/firmware/drivers/audio/wm8731.c @@ -33,7 +33,6 @@ #include "wmcodec.h" #include "audiohw.h" -#include "i2s.h" #include "sound.h" const struct sound_settings_info audiohw_settings[] = { @@ -150,8 +149,6 @@ static void codec_set_active(int active) void audiohw_preinit(void) { - i2s_reset(); - /* POWER UP SEQUENCE */ /* 1) Switch on power supplies. By default the WM8731 is in Standby Mode, * the DAC is digitally muted and the Audio Interface and Outputs are diff --git a/firmware/drivers/audio/wm8751.c b/firmware/drivers/audio/wm8751.c index 7145fe4ea4..d53cfa3d79 100644 --- a/firmware/drivers/audio/wm8751.c +++ b/firmware/drivers/audio/wm8751.c @@ -27,7 +27,6 @@ ****************************************************************************/ #include "kernel.h" #include "wmcodec.h" -#include "i2s.h" #include "audio.h" #include "audiohw.h" #include "system.h" diff --git a/firmware/drivers/audio/wm8758.c b/firmware/drivers/audio/wm8758.c index e9d4b5c5c7..8ebfbe8e26 100644 --- a/firmware/drivers/audio/wm8758.c +++ b/firmware/drivers/audio/wm8758.c @@ -31,7 +31,6 @@ #include "wmcodec.h" #include "audiohw.h" -#include "i2s.h" const struct sound_settings_info audiohw_settings[] = { [SOUND_VOLUME] = {"dB", 0, 1, -58, 6, -25}, @@ -95,8 +94,6 @@ void audiohw_mute(bool mute) void audiohw_preinit(void) { - i2s_reset(); - wmcodec_write(RESET, RESET_RESET); wmcodec_write(PWRMGMT1, PWRMGMT1_PLLEN | PWRMGMT1_BIASEN diff --git a/firmware/drivers/audio/wm8975.c b/firmware/drivers/audio/wm8975.c index 86e463cdff..aa519e8819 100644 --- a/firmware/drivers/audio/wm8975.c +++ b/firmware/drivers/audio/wm8975.c @@ -33,7 +33,6 @@ #include "wmcodec.h" #include "audiohw.h" -#include "i2s.h" const struct sound_settings_info audiohw_settings[] = { [SOUND_VOLUME] = {"dB", 0, 1, -74, 6, -25}, @@ -129,8 +128,6 @@ void audiohw_mute(bool mute) void audiohw_preinit(void) { - i2s_reset(); - /* POWER UP SEQUENCE */ wmcodec_write(RESET, RESET_RESET); diff --git a/firmware/drivers/audio/wm8985.c b/firmware/drivers/audio/wm8985.c index 9d80f9e374..0467e3718a 100644 --- a/firmware/drivers/audio/wm8985.c +++ b/firmware/drivers/audio/wm8985.c @@ -23,7 +23,6 @@ #include "wmcodec.h" #include "audiohw.h" -#include "i2s.h" /* Register addresses as per datasheet Rev.4.4 */ #define RESET 0x00 @@ -127,57 +126,50 @@ int tenthdb2master(int db) } /* Silently enable / disable audio output */ -void audiohw_enable_output(bool enable) +void audiohw_preinit(void) { - if (enable) - { - /* TODO: reset the I2S controller into known state */ - //i2s_reset(); + wmcodec_write(RESET, 0x1ff); /* Reset */ - wmcodec_write(RESET, 0x1ff); /* Reset */ + wmcodec_write(BIASCTL, 0x100); /* BIASCUT = 1 */ + wmcodec_write(OUTCTRL, 0x6); /* Thermal shutdown */ - wmcodec_write(BIASCTL, 0x100); /* BIASCUT = 1 */ - wmcodec_write(OUTCTRL, 0x6); /* Thermal shutdown */ + wmcodec_write(PWRMGMT1, 0x8); /* BIASEN = 1 */ - wmcodec_write(PWRMGMT1, 0x8); /* BIASEN = 1 */ + /* Volume zero, mute all outputs */ + wmcodec_write(LOUT1VOL, 0x140); + wmcodec_write(ROUT1VOL, 0x140); + wmcodec_write(LOUT2VOL, 0x140); + wmcodec_write(ROUT2VOL, 0x140); + wmcodec_write(OUT3MIX, 0x40); + wmcodec_write(OUT4MIX, 0x40); - /* Volume zero, mute all outputs */ - wmcodec_write(LOUT1VOL, 0x140); - wmcodec_write(ROUT1VOL, 0x140); - wmcodec_write(LOUT2VOL, 0x140); - wmcodec_write(ROUT2VOL, 0x140); - wmcodec_write(OUT3MIX, 0x40); - wmcodec_write(OUT4MIX, 0x40); - - /* DAC softmute, automute, 128OSR */ - wmcodec_write(DACCTRL, 0x4c); + /* DAC softmute, automute, 128OSR */ + wmcodec_write(DACCTRL, 0x4c); - wmcodec_write(OUT4ADC, 0x2); /* POBCTRL = 1 */ + wmcodec_write(OUT4ADC, 0x2); /* POBCTRL = 1 */ - /* Enable output, DAC and mixer */ - wmcodec_write(PWRMGMT3, 0x6f); - wmcodec_write(PWRMGMT2, 0x180); - wmcodec_write(PWRMGMT1, 0xd); - wmcodec_write(LOUTMIX, 0x1); - wmcodec_write(ROUTMIX, 0x1); + /* Enable output, DAC and mixer */ + wmcodec_write(PWRMGMT3, 0x6f); + wmcodec_write(PWRMGMT2, 0x180); + wmcodec_write(PWRMGMT1, 0xd); + wmcodec_write(LOUTMIX, 0x1); + wmcodec_write(ROUTMIX, 0x1); - /* Disable clock since we're acting as slave to the SoC */ - wmcodec_write(CLKGEN, 0x0); - wmcodec_write(AINTFCE, 0x10); /* 16-bit, I2S format */ + /* Disable clock since we're acting as slave to the SoC */ + wmcodec_write(CLKGEN, 0x0); + wmcodec_write(AINTFCE, 0x10); /* 16-bit, I2S format */ - wmcodec_write(LDACVOL, 0x1ff); /* Full DAC digital vol */ - wmcodec_write(RDACVOL, 0x1ff); + wmcodec_write(LDACVOL, 0x1ff); /* Full DAC digital vol */ + wmcodec_write(RDACVOL, 0x1ff); - wmcodec_write(OUT4ADC, 0x0); /* POBCTRL = 0 */ + wmcodec_write(OUT4ADC, 0x0); /* POBCTRL = 0 */ +} - sleep(HZ/2); +void audiohw_postinit(void) +{ + sleep(HZ/2); - audiohw_mute(0); - } - else - { - audiohw_mute(1); - } + audiohw_mute(0); } void audiohw_set_headphone_vol(int vol_l, int vol_r) @@ -256,9 +248,6 @@ void audiohw_enable_recording(bool source_mic) { (void)source_mic; /* We only have a line-in (I think) */ - /* TODO: reset the I2S controller into known state */ - //i2s_reset(); - wmcodec_write(RESET, 0x1ff); /*Reset*/ wmcodec_write(PWRMGMT1, 0x2b); diff --git a/firmware/export/audiohw.h b/firmware/export/audiohw.h index 171358c325..b82c27e2fb 100644 --- a/firmware/export/audiohw.h +++ b/firmware/export/audiohw.h @@ -150,12 +150,13 @@ extern const struct sound_settings_info audiohw_settings[]; */ /** - * Initialize audio codec to a well defined state. + * Initialize audio codec to a well defined state. Includes SoC-specific + * setup. */ void audiohw_init(void); /** - * Do initial audio codec setup. + * Do initial audio codec setup. Usually called from audiohw_init. */ void audiohw_preinit(void); @@ -207,12 +208,6 @@ void audiohw_set_balance(int val); */ void audiohw_mute(bool mute); -/** - * Silently en/disable audio output. - * @param enable true or false. - */ -void audiohw_enable_output(bool enable); - #ifdef AUDIOHW_HAVE_TREBLE /** * Set new treble value. diff --git a/firmware/target/arm/pcm-pp.c b/firmware/target/arm/pcm-pp.c index c572578383..2c4a6ac87d 100644 --- a/firmware/target/arm/pcm-pp.c +++ b/firmware/target/arm/pcm-pp.c @@ -373,14 +373,6 @@ void pcm_play_dma_init(void) /* Initialize default register values. */ audiohw_init(); -#if !defined(HAVE_WM8731) && !defined(HAVE_WM8751) && !defined(HAVE_WM8975) \ - && !defined(HAVE_WM8758) && !defined(HAVE_AS3514) - /* Power on */ - audiohw_enable_output(true); - /* Unmute the master channel (DAC should be at zero point now). */ - audiohw_mute(false); -#endif - dma_play_data.size = 0; #if NUM_CORES > 1 dma_play_data.core = 0; /* no core in control */ diff --git a/firmware/target/arm/pcm-telechips.c b/firmware/target/arm/pcm-telechips.c index b3fd9216dc..dc77b36f00 100644 --- a/firmware/target/arm/pcm-telechips.c +++ b/firmware/target/arm/pcm-telechips.c @@ -108,19 +108,18 @@ void pcm_play_dma_init(void) /* Initialize default register values. */ audiohw_init(); - - /* Power on */ - audiohw_enable_output(true); - - /* Unmute the master channel (DAC should be at zero point now). */ - audiohw_mute(false); - + dma_play_data.size = 0; #if NUM_CORES > 1 dma_play_data.core = 0; /* no core in control */ #endif } +void pcm_postinit(void) +{ + audiohw_postinit(); +} + void pcm_apply_settings(void) { pcm_curr_sampr = pcm_freq; diff --git a/firmware/target/arm/tcc77x/iaudio7/audio-iaudio7.c b/firmware/target/arm/tcc77x/iaudio7/audio-iaudio7.c index 4e7f58df47..bcb6843286 100644 --- a/firmware/target/arm/tcc77x/iaudio7/audio-iaudio7.c +++ b/firmware/target/arm/tcc77x/iaudio7/audio-iaudio7.c @@ -26,11 +26,6 @@ int audio_channels = 2; int audio_output_source = AUDIO_SRC_PLAYBACK; -void audiohw_enable_output(bool on) -{ - (void) on; -} - void audio_set_output_source(int source) { int oldmode = set_fiq_status(FIQ_DISABLED); diff --git a/firmware/target/arm/tcc77x/logikdax/audio-logikdax.c b/firmware/target/arm/tcc77x/logikdax/audio-logikdax.c index bd85e0b573..107b2743ae 100644 --- a/firmware/target/arm/tcc77x/logikdax/audio-logikdax.c +++ b/firmware/target/arm/tcc77x/logikdax/audio-logikdax.c @@ -26,11 +26,6 @@ int audio_channels = 2; int audio_output_source = AUDIO_SRC_PLAYBACK; -void audiohw_enable_output(bool on) -{ - (void)on; -} - void audio_set_output_source(int source) { (void)source; diff --git a/firmware/target/arm/tcc77x/m200/audio-m200.c b/firmware/target/arm/tcc77x/m200/audio-m200.c index bd85e0b573..107b2743ae 100644 --- a/firmware/target/arm/tcc77x/m200/audio-m200.c +++ b/firmware/target/arm/tcc77x/m200/audio-m200.c @@ -26,11 +26,6 @@ int audio_channels = 2; int audio_output_source = AUDIO_SRC_PLAYBACK; -void audiohw_enable_output(bool on) -{ - (void)on; -} - void audio_set_output_source(int source) { (void)source; diff --git a/firmware/target/arm/wmcodec-pp.c b/firmware/target/arm/wmcodec-pp.c index 0d751f6b3f..031f5c8d47 100644 --- a/firmware/target/arm/wmcodec-pp.c +++ b/firmware/target/arm/wmcodec-pp.c @@ -29,6 +29,7 @@ #include "system.h" #include "audiohw.h" #include "i2c-pp.h" +#include "i2s.h" #include "wmcodec.h" #if defined(IRIVER_H10) || defined(IRIVER_H10_5GB) || defined(MROBE_100) @@ -43,7 +44,8 @@ /* * Initialise the PP I2C and I2S. */ -void audiohw_init(void) { +void audiohw_init(void) +{ #ifdef CPU_PP502x /* normal outputs for CDI and I2S pin groups */ DEV_INIT2 &= ~0x300; @@ -95,21 +97,13 @@ void audiohw_init(void) { outl(inl(0xcf000028) & ~0x8, 0xcf000028); #endif /* IPOD_1G2G/3G */ #endif + + /* reset the I2S controller into known state */ + i2s_reset(); -#if defined(HAVE_WM8731) || defined(HAVE_WM8751) || defined(HAVE_WM8975) \ - || defined(HAVE_WM8758) audiohw_preinit(); -#endif - } -#if !defined(HAVE_WM8731) && !defined(HAVE_WM8751) && !defined(HAVE_WM8975) \ - && !defined(HAVE_WM8758) -void audiohw_postinit(void) -{ -} -#endif - 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/mips/ingenic_jz47xx/pcm-jz4740.c b/firmware/target/mips/ingenic_jz47xx/pcm-jz4740.c index a5cc61b844..cdfb67d7ee 100644 --- a/firmware/target/mips/ingenic_jz47xx/pcm-jz4740.c +++ b/firmware/target/mips/ingenic_jz47xx/pcm-jz4740.c @@ -50,12 +50,11 @@ void pcm_play_dma_init(void) /* Initialize default register values. */ audiohw_init(); +} - /* Power on */ - audiohw_enable_output(true); - - /* Unmute the master channel (DAC should be at zero point now). */ - audiohw_mute(false); +void pcm_postinit(void) +{ + audiohw_postinit(); } void pcm_apply_settings(void) |