static void madera_configure_input_mode(struct madera *madera)
{
- unsigned int dig_mode, ana_mode_l, ana_mode_r;
- int max_analogue_inputs, i;
+ unsigned int dig_mode, dig_mask, ana_mode_l, ana_mode_r;
+ int max_analogue_inputs, max_dmic_sup, i;
switch (madera->type) {
case CS47L35:
max_analogue_inputs = 2;
+ max_dmic_sup = 2;
break;
case CS47L85:
case WM1840:
max_analogue_inputs = 3;
+ max_dmic_sup = 3;
+ break;
+ case CS47L90:
+ case CS47L91:
+ max_analogue_inputs = 2;
+ max_dmic_sup = 2;
break;
default:
max_analogue_inputs = 2;
+ max_dmic_sup = 4;
break;
}
* Initialize input modes from the A settings. For muxed inputs the
* B settings will be applied if the mux is changed
*/
- for (i = 0; i < max_analogue_inputs; i++) {
+ for (i = 0; i < max_dmic_sup; i++) {
dev_dbg(madera->dev, "IN%d mode %u:%u:%u:%u\n", i + 1,
madera->pdata.codec.inmode[i][0],
madera->pdata.codec.inmode[i][1],
"IN%dA DMIC mode=0x%x Analogue mode=0x%x,0x%x\n",
i + 1, dig_mode, ana_mode_l, ana_mode_r);
+ dig_mask = MADERA_IN1_DMIC_SUP_MASK;
+
+ if (i < max_analogue_inputs)
+ dig_mask |= MADERA_IN1_MODE_MASK;
+
regmap_update_bits(madera->regmap,
MADERA_IN1L_CONTROL + (i * 8),
- MADERA_IN1_DMIC_SUP_MASK |
- MADERA_IN1_MODE_MASK,
- dig_mode);
+ dig_mask, dig_mode);
+
+ if (i >= max_analogue_inputs)
+ continue;
regmap_update_bits(madera->regmap,
MADERA_ADC_DIGITAL_VOLUME_1L + (i * 8),