}
}
+static const struct soc_enum cs47l35_input_rate =
+ SOC_VALUE_ENUM_SINGLE(MADERA_INPUT_RATE,
+ MADERA_IN_RATE_SHIFT,
+ 0x0f,
+ MADERA_SYNC_RATE_ENUM_SIZE,
+ madera_rate_text,
+ madera_rate_val);
+
static const struct snd_kcontrol_new cs47l35_snd_controls[] = {
SOC_ENUM("IN1 OSR", madera_in_dmic_osr[0]),
SOC_ENUM("IN2 OSR", madera_in_dmic_osr[1]),
SOC_ENUM("Sample Rate 2", madera_sample_rate[0]),
SOC_ENUM("Sample Rate 3", madera_sample_rate[1]),
+MADERA_RATE_ENUM("FX Rate", madera_fx_rate),
+
MADERA_RATE_ENUM("ISRC1 FSL", madera_isrc_fsl[0]),
MADERA_RATE_ENUM("ISRC2 FSL", madera_isrc_fsl[1]),
MADERA_RATE_ENUM("ISRC1 FSH", madera_isrc_fsh[0]),
SOC_ENUM("Output Ramp Up", madera_out_vi_ramp),
SOC_ENUM("Output Ramp Down", madera_out_vd_ramp),
+MADERA_RATE_ENUM("SPDIF1 Rate", madera_spdif_rate),
+
SOC_SINGLE("Noise Gate Switch", MADERA_NOISE_GATE_CONTROL,
MADERA_NGATE_ENA_SHIFT, 1, 0),
SOC_SINGLE_TLV("Noise Gate Threshold Volume", MADERA_NOISE_GATE_CONTROL,
MADERA_NGATE_THR_SHIFT, 7, 1, madera_ng_tlv),
SOC_ENUM("Noise Gate Hold", madera_ng_hold),
+MADERA_RATE_ENUM("Output Rate 1", madera_output_rate),
+SOC_ENUM("In Rate", cs47l35_input_rate),
+
CS47L35_NG_SRC("HPOUT1L", MADERA_NOISE_GATE_SELECT_1L),
CS47L35_NG_SRC("HPOUT1R", MADERA_NOISE_GATE_SELECT_1R),
CS47L35_NG_SRC("SPKOUT", MADERA_NOISE_GATE_SELECT_4L),
}
}
+static const struct soc_enum cs47l85_input_rate =
+ SOC_VALUE_ENUM_SINGLE(MADERA_INPUT_RATE,
+ MADERA_IN_RATE_SHIFT,
+ 0x0f,
+ MADERA_SYNC_RATE_ENUM_SIZE,
+ madera_rate_text,
+ madera_rate_val);
+
static const struct snd_kcontrol_new cs47l85_snd_controls[] = {
SOC_ENUM("IN1 OSR", madera_in_dmic_osr[0]),
SOC_ENUM("IN2 OSR", madera_in_dmic_osr[1]),
SOC_ENUM("Sample Rate 3", madera_sample_rate[1]),
SOC_ENUM("ASYNC Sample Rate 2", madera_sample_rate[2]),
+MADERA_RATE_ENUM("FX Rate", madera_fx_rate),
+
MADERA_RATE_ENUM("ISRC1 FSL", madera_isrc_fsl[0]),
MADERA_RATE_ENUM("ISRC2 FSL", madera_isrc_fsl[1]),
MADERA_RATE_ENUM("ISRC3 FSL", madera_isrc_fsl[2]),
SOC_ENUM("Output Ramp Up", madera_out_vi_ramp),
SOC_ENUM("Output Ramp Down", madera_out_vd_ramp),
+MADERA_RATE_ENUM("SPDIF1 Rate", madera_spdif_rate),
+
SOC_SINGLE("Noise Gate Switch", MADERA_NOISE_GATE_CONTROL,
MADERA_NGATE_ENA_SHIFT, 1, 0),
SOC_SINGLE_TLV("Noise Gate Threshold Volume", MADERA_NOISE_GATE_CONTROL,
MADERA_NGATE_THR_SHIFT, 7, 1, madera_ng_tlv),
SOC_ENUM("Noise Gate Hold", madera_ng_hold),
+MADERA_RATE_ENUM("Output Rate 1", madera_output_rate),
+SOC_ENUM("In Rate", cs47l85_input_rate),
+
CS47L85_NG_SRC("HPOUT1L", MADERA_NOISE_GATE_SELECT_1L),
CS47L85_NG_SRC("HPOUT1R", MADERA_NOISE_GATE_SELECT_1R),
CS47L85_NG_SRC("HPOUT2L", MADERA_NOISE_GATE_SELECT_2L),
SOC_ENUM("Sample Rate 3", madera_sample_rate[1]),
SOC_ENUM("ASYNC Sample Rate 2", madera_sample_rate[2]),
+MADERA_RATE_ENUM("FX Rate", madera_fx_rate),
+
MADERA_RATE_ENUM("ISRC1 FSL", madera_isrc_fsl[0]),
MADERA_RATE_ENUM("ISRC2 FSL", madera_isrc_fsl[1]),
MADERA_RATE_ENUM("ISRC3 FSL", madera_isrc_fsl[2]),
SOC_ENUM("Output Ramp Up", madera_out_vi_ramp),
SOC_ENUM("Output Ramp Down", madera_out_vd_ramp),
+MADERA_RATE_ENUM("SPDIF1 Rate", madera_spdif_rate),
+
SOC_SINGLE("Noise Gate Switch", MADERA_NOISE_GATE_CONTROL,
MADERA_NGATE_ENA_SHIFT, 1, 0),
SOC_SINGLE_TLV("Noise Gate Threshold Volume", MADERA_NOISE_GATE_CONTROL,
MADERA_NGATE_THR_SHIFT, 7, 1, madera_ng_tlv),
SOC_ENUM("Noise Gate Hold", madera_ng_hold),
+MADERA_RATE_ENUM("Output Rate 1", madera_output_rate),
+
+SOC_ENUM_EXT("IN1L Rate", madera_input_rate[0],
+ snd_soc_get_enum_double, madera_in_rate_put),
+SOC_ENUM_EXT("IN1R Rate", madera_input_rate[1],
+ snd_soc_get_enum_double, madera_in_rate_put),
+SOC_ENUM_EXT("IN2L Rate", madera_input_rate[2],
+ snd_soc_get_enum_double, madera_in_rate_put),
+SOC_ENUM_EXT("IN2R Rate", madera_input_rate[3],
+ snd_soc_get_enum_double, madera_in_rate_put),
+SOC_ENUM_EXT("IN3L Rate", madera_input_rate[4],
+ snd_soc_get_enum_double, madera_in_rate_put),
+SOC_ENUM_EXT("IN3R Rate", madera_input_rate[5],
+ snd_soc_get_enum_double, madera_in_rate_put),
+SOC_ENUM_EXT("IN4L Rate", madera_input_rate[6],
+ snd_soc_get_enum_double, madera_in_rate_put),
+SOC_ENUM_EXT("IN4R Rate", madera_input_rate[7],
+ snd_soc_get_enum_double, madera_in_rate_put),
+SOC_ENUM_EXT("IN5L Rate", madera_input_rate[8],
+ snd_soc_get_enum_double, madera_in_rate_put),
+SOC_ENUM_EXT("IN5R Rate", madera_input_rate[9],
+ snd_soc_get_enum_double, madera_in_rate_put),
+
SOC_ENUM_EXT("DFC1RX Width", madera_dfc_width[0],
snd_soc_get_enum_double, madera_dfc_put),
SOC_ENUM_EXT("DFC1RX Type", madera_dfc_type[0],
SOC_ENUM("Sample Rate 3", madera_sample_rate[1]),
SOC_ENUM("ASYNC Sample Rate 2", madera_sample_rate[2]),
+MADERA_RATE_ENUM("FX Rate", madera_fx_rate),
+
MADERA_RATE_ENUM("ISRC1 FSL", madera_isrc_fsl[0]),
MADERA_RATE_ENUM("ISRC2 FSL", madera_isrc_fsl[1]),
MADERA_RATE_ENUM("ISRC1 FSH", madera_isrc_fsh[0]),
SOC_ENUM("Output Ramp Up", madera_out_vi_ramp),
SOC_ENUM("Output Ramp Down", madera_out_vd_ramp),
+MADERA_RATE_ENUM("SPDIF1 Rate", madera_spdif_rate),
+
SOC_SINGLE("Noise Gate Switch", MADERA_NOISE_GATE_CONTROL,
MADERA_NGATE_ENA_SHIFT, 1, 0),
SOC_SINGLE_TLV("Noise Gate Threshold Volume", MADERA_NOISE_GATE_CONTROL,
MADERA_NGATE_THR_SHIFT, 7, 1, madera_ng_tlv),
SOC_ENUM("Noise Gate Hold", madera_ng_hold),
+MADERA_RATE_ENUM("Output Rate 1", madera_output_ext_rate),
+
+SOC_ENUM_EXT("IN1L Rate", madera_input_rate[0],
+ snd_soc_get_enum_double, madera_in_rate_put),
+SOC_ENUM_EXT("IN1R Rate", madera_input_rate[1],
+ snd_soc_get_enum_double, madera_in_rate_put),
+SOC_ENUM_EXT("IN2L Rate", madera_input_rate[2],
+ snd_soc_get_enum_double, madera_in_rate_put),
+SOC_ENUM_EXT("IN2R Rate", madera_input_rate[3],
+ snd_soc_get_enum_double, madera_in_rate_put),
+SOC_ENUM_EXT("IN3L Rate", madera_input_rate[4],
+ snd_soc_get_enum_double, madera_in_rate_put),
+SOC_ENUM_EXT("IN3R Rate", madera_input_rate[5],
+ snd_soc_get_enum_double, madera_in_rate_put),
+SOC_ENUM_EXT("IN4L Rate", madera_input_rate[6],
+ snd_soc_get_enum_double, madera_in_rate_put),
+SOC_ENUM_EXT("IN4R Rate", madera_input_rate[7],
+ snd_soc_get_enum_double, madera_in_rate_put),
+
SOC_ENUM_EXT("DFC1RX Width", madera_dfc_width[0],
snd_soc_get_enum_double, madera_dfc_put),
SOC_ENUM_EXT("DFC1RX Type", madera_dfc_type[0],
};
EXPORT_SYMBOL_GPL(madera_rate_val);
+const struct soc_enum madera_output_rate =
+ SOC_VALUE_ENUM_SINGLE(MADERA_OUTPUT_RATE_1,
+ MADERA_OUT_RATE_SHIFT,
+ MADERA_OUT_RATE_MASK >> MADERA_OUT_RATE_SHIFT,
+ MADERA_SYNC_RATE_ENUM_SIZE,
+ madera_rate_text,
+ madera_rate_val);
+EXPORT_SYMBOL_GPL(madera_output_rate);
+
+const struct soc_enum madera_output_ext_rate =
+ SOC_VALUE_ENUM_SINGLE(MADERA_OUTPUT_RATE_1,
+ MADERA_OUT_RATE_SHIFT,
+ MADERA_OUT_RATE_MASK >> MADERA_OUT_RATE_SHIFT,
+ MADERA_RATE_ENUM_SIZE,
+ madera_rate_text,
+ madera_rate_val);
+EXPORT_SYMBOL_GPL(madera_output_ext_rate);
+
+const struct soc_enum madera_input_rate[] = {
+ SOC_VALUE_ENUM_SINGLE(MADERA_IN1L_RATE_CONTROL,
+ MADERA_IN1L_RATE_SHIFT,
+ MADERA_IN1L_RATE_MASK >> MADERA_IN1L_RATE_SHIFT,
+ MADERA_SYNC_RATE_ENUM_SIZE,
+ madera_rate_text,
+ madera_rate_val),
+ SOC_VALUE_ENUM_SINGLE(MADERA_IN1R_RATE_CONTROL,
+ MADERA_IN1R_RATE_SHIFT,
+ MADERA_IN1R_RATE_MASK >> MADERA_IN1R_RATE_SHIFT,
+ MADERA_SYNC_RATE_ENUM_SIZE,
+ madera_rate_text,
+ madera_rate_val),
+ SOC_VALUE_ENUM_SINGLE(MADERA_IN2L_RATE_CONTROL,
+ MADERA_IN2L_RATE_SHIFT,
+ MADERA_IN2L_RATE_MASK >> MADERA_IN2L_RATE_SHIFT,
+ MADERA_SYNC_RATE_ENUM_SIZE,
+ madera_rate_text,
+ madera_rate_val),
+ SOC_VALUE_ENUM_SINGLE(MADERA_IN2R_RATE_CONTROL,
+ MADERA_IN2R_RATE_SHIFT,
+ MADERA_IN2R_RATE_MASK >> MADERA_IN2R_RATE_SHIFT,
+ MADERA_SYNC_RATE_ENUM_SIZE,
+ madera_rate_text,
+ madera_rate_val),
+ SOC_VALUE_ENUM_SINGLE(MADERA_IN3L_RATE_CONTROL,
+ MADERA_IN3L_RATE_SHIFT,
+ MADERA_IN3L_RATE_MASK >> MADERA_IN3L_RATE_SHIFT,
+ MADERA_SYNC_RATE_ENUM_SIZE,
+ madera_rate_text,
+ madera_rate_val),
+ SOC_VALUE_ENUM_SINGLE(MADERA_IN3R_RATE_CONTROL,
+ MADERA_IN3R_RATE_SHIFT,
+ MADERA_IN3R_RATE_MASK >> MADERA_IN3R_RATE_SHIFT,
+ MADERA_SYNC_RATE_ENUM_SIZE,
+ madera_rate_text,
+ madera_rate_val),
+ SOC_VALUE_ENUM_SINGLE(MADERA_IN4L_RATE_CONTROL,
+ MADERA_IN4L_RATE_SHIFT,
+ MADERA_IN4L_RATE_MASK >> MADERA_IN4L_RATE_SHIFT,
+ MADERA_SYNC_RATE_ENUM_SIZE,
+ madera_rate_text,
+ madera_rate_val),
+ SOC_VALUE_ENUM_SINGLE(MADERA_IN4R_RATE_CONTROL,
+ MADERA_IN4R_RATE_SHIFT,
+ MADERA_IN4R_RATE_MASK >> MADERA_IN4R_RATE_SHIFT,
+ MADERA_SYNC_RATE_ENUM_SIZE,
+ madera_rate_text,
+ madera_rate_val),
+ SOC_VALUE_ENUM_SINGLE(MADERA_IN5L_RATE_CONTROL,
+ MADERA_IN5L_RATE_SHIFT,
+ MADERA_IN5L_RATE_MASK >> MADERA_IN5L_RATE_SHIFT,
+ MADERA_SYNC_RATE_ENUM_SIZE,
+ madera_rate_text,
+ madera_rate_val),
+ SOC_VALUE_ENUM_SINGLE(MADERA_IN5R_RATE_CONTROL,
+ MADERA_IN5R_RATE_SHIFT,
+ MADERA_IN5R_RATE_MASK >> MADERA_IN5R_RATE_SHIFT,
+ MADERA_SYNC_RATE_ENUM_SIZE,
+ madera_rate_text,
+ madera_rate_val),
+};
+EXPORT_SYMBOL_GPL(madera_input_rate);
+
const char * const madera_dfc_width_text[MADERA_DFC_WIDTH_ENUM_SIZE] = {
"8bit", "16bit", "20bit", "24bit", "32bit",
};
};
EXPORT_SYMBOL_GPL(madera_dfc_type);
+const struct soc_enum madera_fx_rate =
+ SOC_VALUE_ENUM_SINGLE(MADERA_FX_CTRL1,
+ MADERA_FX_RATE_SHIFT, 0xf,
+ MADERA_RATE_ENUM_SIZE,
+ madera_rate_text, madera_rate_val);
+EXPORT_SYMBOL_GPL(madera_fx_rate);
+
+const struct soc_enum madera_spdif_rate =
+ SOC_VALUE_ENUM_SINGLE(MADERA_SPD1_TX_CONTROL,
+ MADERA_SPD1_RATE_SHIFT,
+ 0x0f,
+ MADERA_SYNC_RATE_ENUM_SIZE,
+ madera_rate_text,
+ madera_rate_val);
+EXPORT_SYMBOL_GPL(madera_spdif_rate);
+
const struct soc_enum madera_isrc_fsh[] = {
SOC_VALUE_ENUM_SINGLE(MADERA_ISRC_1_CTRL_1,
MADERA_ISRC1_FSH_SHIFT, 0xf,
};
EXPORT_SYMBOL_GPL(madera_output_anc_src);
+int madera_in_rate_put(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+ struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
+ struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
+ unsigned int reg, mask;
+ int ret = 0;
+
+ snd_soc_dapm_mutex_lock(dapm);
+
+ /* Cannot change rate on an active input */
+ reg = snd_soc_read(codec, MADERA_INPUT_ENABLES);
+ mask = (e->reg - MADERA_IN1L_CONTROL) / 4;
+ mask ^= 0x1; /* Flip bottom bit for channel order */
+
+ if ((reg) & (1 << mask)) {
+ ret = -EBUSY;
+ goto exit;
+ }
+
+ ret = snd_soc_put_enum_double(kcontrol, ucontrol);
+exit:
+ snd_soc_dapm_mutex_unlock(dapm);
+ return ret;
+}
+EXPORT_SYMBOL_GPL(madera_in_rate_put);
+
int madera_dfc_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
extern const struct soc_enum madera_asrc1_rate[];
extern const struct soc_enum madera_asrc1_bidir_rate[];
extern const struct soc_enum madera_asrc2_rate[];
+extern const struct soc_enum madera_output_rate;
+extern const struct soc_enum madera_output_ext_rate;
+extern const struct soc_enum madera_input_rate[];
extern const struct soc_enum madera_dfc_width[];
extern const struct soc_enum madera_dfc_type[];
+extern const struct soc_enum madera_fx_rate;
extern const struct soc_enum madera_spdif_rate;
extern const struct soc_enum madera_in_vi_ramp;
int madera_lp_mode_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol);
+int madera_in_rate_put(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol);
int madera_out1_demux_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol);