diff options
Diffstat (limited to 'firmware/target/mips/ingenic_x1000/erosqnative/audiohw-erosqnative.c')
-rw-r--r-- | firmware/target/mips/ingenic_x1000/erosqnative/audiohw-erosqnative.c | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/firmware/target/mips/ingenic_x1000/erosqnative/audiohw-erosqnative.c b/firmware/target/mips/ingenic_x1000/erosqnative/audiohw-erosqnative.c index df97aba0c8..6968a19a1c 100644 --- a/firmware/target/mips/ingenic_x1000/erosqnative/audiohw-erosqnative.c +++ b/firmware/target/mips/ingenic_x1000/erosqnative/audiohw-erosqnative.c | |||
@@ -104,6 +104,30 @@ void audiohw_postinit(void) | |||
104 | * for 24-bit data... */ | 104 | * for 24-bit data... */ |
105 | // es9018k2m_write_reg(ES9018K2M_REG1_INPUT_CONFIG, 0b01001100); // 24-bit data | 105 | // es9018k2m_write_reg(ES9018K2M_REG1_INPUT_CONFIG, 0b01001100); // 24-bit data |
106 | 106 | ||
107 | /* Datasheet: Sets the number os FSR edges that must occur before * | ||
108 | * the DPLL and ASRC can lock on to the the incoming Signal. * | ||
109 | * When Samplerates >= 96khz could be used, STOP_DIV should be set * | ||
110 | * to 0 (= 16384 FSR Edges). * | ||
111 | * Reg #10 [3:0] (0x05 default, 2730 FSR Edges) */ | ||
112 | es9018k2m_write_reg(ES9018K2M_REG10_MASTER_MODE_CTRL, 0x00); | ||
113 | |||
114 | /* Datasheet: The ES90x8Q2M/K2M contains a Jitter Eliminator block, * | ||
115 | * which employs the use of a digital phase locked loop (DPLL) to * | ||
116 | * lock to the incoming audio clock rate. When in I2S or SPDIF mode, * | ||
117 | * the DPLL will lock to the frame clock (1 x fs). However, when in * | ||
118 | * DSD mode, the DPLL has no frame clock information, and must in- * | ||
119 | * stead lock to the bit clock rate (BCK). For this reason, there are * | ||
120 | * two bandwidth settings for the DPLL. * | ||
121 | Reg #12 [7:4] (0x05 default) bandwidth for I2S / SPDIF mode. | ||
122 | Reg #12 [3:0] (0x0A default) bandwidth for DSD mode. | ||
123 | * The DPLL bandwidth sets how quickly the DPLL can adjust its intern * | ||
124 | * representation of the audio clock. The higher the jitter or * | ||
125 | * frequency drift on the audio clock, the higher the bandwidth must * | ||
126 | * be so that the DPLL can react. * | ||
127 | * ! If the bandwidth is “too low”, the DPLL will loose lock and you * | ||
128 | * ! will hear random dropouts. (Fixed my SurfansF20 v3.2 dropouts) */ | ||
129 | es9018k2m_write_reg(ES9018K2M_REG12_DPLL_SETTINGS, 0xda); | ||
130 | |||
107 | } else { /* Default to SWVOL for PCM5102A DAC */ | 131 | } else { /* Default to SWVOL for PCM5102A DAC */ |
108 | logf("Default to SWVOL: ret=%d", ret); | 132 | logf("Default to SWVOL: ret=%d", ret); |
109 | } | 133 | } |
@@ -139,17 +163,19 @@ void audiohw_set_volume(int vol_l, int vol_r) | |||
139 | r = vol_r; | 163 | r = vol_r; |
140 | 164 | ||
141 | #if (defined(HAVE_HEADPHONE_DETECTION) && defined(HAVE_LINEOUT_DETECTION)) | 165 | #if (defined(HAVE_HEADPHONE_DETECTION) && defined(HAVE_LINEOUT_DETECTION)) |
142 | /* make sure headphones aren't present - don't want to | 166 | /* Due to the hardware's detection method, make the Line-Out |
143 | * blow out our eardrums cranking it to full */ | 167 | * the default. The LO can only be detected if it is active |
144 | if (lineout_inserted() && !headphones_inserted()) | 168 | * (assuming a high-impedance device is attached). HP takes priority |
169 | * if both are present. */ | ||
170 | if (headphones_inserted()) | ||
145 | { | 171 | { |
146 | eros_qn_switch_output(1); | 172 | eros_qn_switch_output(0); |
147 | |||
148 | l = r = eros_qn_get_volume_limit(); | ||
149 | } | 173 | } |
150 | else | 174 | else |
151 | { | 175 | { |
152 | eros_qn_switch_output(0); | 176 | eros_qn_switch_output(1); |
177 | |||
178 | l = r = eros_qn_get_volume_limit(); | ||
153 | } | 179 | } |
154 | #endif | 180 | #endif |
155 | 181 | ||