summaryrefslogtreecommitdiff
path: root/firmware/drivers/audio/rk27xx_codec.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/audio/rk27xx_codec.c')
-rw-r--r--firmware/drivers/audio/rk27xx_codec.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/firmware/drivers/audio/rk27xx_codec.c b/firmware/drivers/audio/rk27xx_codec.c
index cfb98a9227..462565e8aa 100644
--- a/firmware/drivers/audio/rk27xx_codec.c
+++ b/firmware/drivers/audio/rk27xx_codec.c
@@ -55,12 +55,14 @@ static int codec_read(uint8_t reg, uint8_t *val)
55} 55}
56#endif 56#endif
57 57
58static uint8_t cr1_sel = DACSEL;
59
58static void audiohw_mute(bool mute) 60static void audiohw_mute(bool mute)
59{ 61{
60 if (mute) 62 if (mute)
61 codec_write(CR1, SB_MICBIAS|DAC_MUTE|DACSEL); 63 codec_write(CR1, SB_MICBIAS|DAC_MUTE|cr1_sel);
62 else 64 else
63 codec_write(CR1, SB_MICBIAS|DACSEL); 65 codec_write(CR1, SB_MICBIAS|cr1_sel);
64} 66}
65 67
66/* public functions */ 68/* public functions */
@@ -109,7 +111,7 @@ void audiohw_postinit(void)
109 udelay(1000); 111 udelay(1000);
110 112
111 /* power up output stage */ 113 /* power up output stage */
112 codec_write(PMR1, SB_ADC|SB_IN1|SB_IN2|SB_MIC|SB_IND); 114 codec_write(PMR1, SB_ADC|SB_MIC|SB_IND);
113 115
114 sleep(HZ/10); 116 sleep(HZ/10);
115 GPIO_PDDR |= (1<<7); /* PD7 high */ 117 GPIO_PDDR |= (1<<7); /* PD7 high */
@@ -159,5 +161,15 @@ void audiohw_set_master_vol(int vol_l, int vol_r)
159 161
160 codec_write(CGR9, vol_r); 162 codec_write(CGR9, vol_r);
161 codec_write(CGR8, vol_l); 163 codec_write(CGR8, vol_l);
164 codec_write(CGR5, vol_r);
165 codec_write(CGR4, vol_l);
166 codec_write(CGR3, vol_r);
167 codec_write(CGR2, vol_l);
162 } 168 }
163} 169}
170
171void audiohw_set_monitor(bool enable)
172{
173 cr1_sel = enable ? BYPASS1|BYPASS2 : DACSEL;
174 codec_write(CR1, cr1_sel|SB_MICBIAS);
175}