#define AIC3X_MODEL_3X 0
#define AIC3X_MODEL_33 1
#define AIC3X_MODEL_3007 2
+++++ #define AIC3X_MODEL_3104 3
u16 model;
/* Selects the micbias voltage */
static int mic_bias_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
----- struct snd_soc_codec *codec = w->codec;
+++++ struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec);
switch (event) {
* only for swapped L-to-R and R-to-L routes. See below stereo controls
* for direct L-to-L and R-to-R routes.
*/
----- SOC_SINGLE_TLV("Left Line Mixer Line2R Bypass Volume",
----- LINE2R_2_LLOPM_VOL, 0, 118, 1, output_stage_tlv),
SOC_SINGLE_TLV("Left Line Mixer PGAR Bypass Volume",
PGAR_2_LLOPM_VOL, 0, 118, 1, output_stage_tlv),
SOC_SINGLE_TLV("Left Line Mixer DACR1 Playback Volume",
DACR1_2_LLOPM_VOL, 0, 118, 1, output_stage_tlv),
----- SOC_SINGLE_TLV("Right Line Mixer Line2L Bypass Volume",
----- LINE2L_2_RLOPM_VOL, 0, 118, 1, output_stage_tlv),
SOC_SINGLE_TLV("Right Line Mixer PGAL Bypass Volume",
PGAL_2_RLOPM_VOL, 0, 118, 1, output_stage_tlv),
SOC_SINGLE_TLV("Right Line Mixer DACL1 Playback Volume",
DACL1_2_RLOPM_VOL, 0, 118, 1, output_stage_tlv),
----- SOC_SINGLE_TLV("Left HP Mixer Line2R Bypass Volume",
----- LINE2R_2_HPLOUT_VOL, 0, 118, 1, output_stage_tlv),
SOC_SINGLE_TLV("Left HP Mixer PGAR Bypass Volume",
PGAR_2_HPLOUT_VOL, 0, 118, 1, output_stage_tlv),
SOC_SINGLE_TLV("Left HP Mixer DACR1 Playback Volume",
DACR1_2_HPLOUT_VOL, 0, 118, 1, output_stage_tlv),
----- SOC_SINGLE_TLV("Right HP Mixer Line2L Bypass Volume",
----- LINE2L_2_HPROUT_VOL, 0, 118, 1, output_stage_tlv),
SOC_SINGLE_TLV("Right HP Mixer PGAL Bypass Volume",
PGAL_2_HPROUT_VOL, 0, 118, 1, output_stage_tlv),
SOC_SINGLE_TLV("Right HP Mixer DACL1 Playback Volume",
DACL1_2_HPROUT_VOL, 0, 118, 1, output_stage_tlv),
----- SOC_SINGLE_TLV("Left HPCOM Mixer Line2R Bypass Volume",
----- LINE2R_2_HPLCOM_VOL, 0, 118, 1, output_stage_tlv),
SOC_SINGLE_TLV("Left HPCOM Mixer PGAR Bypass Volume",
PGAR_2_HPLCOM_VOL, 0, 118, 1, output_stage_tlv),
SOC_SINGLE_TLV("Left HPCOM Mixer DACR1 Playback Volume",
DACR1_2_HPLCOM_VOL, 0, 118, 1, output_stage_tlv),
----- SOC_SINGLE_TLV("Right HPCOM Mixer Line2L Bypass Volume",
----- LINE2L_2_HPRCOM_VOL, 0, 118, 1, output_stage_tlv),
SOC_SINGLE_TLV("Right HPCOM Mixer PGAL Bypass Volume",
PGAL_2_HPRCOM_VOL, 0, 118, 1, output_stage_tlv),
SOC_SINGLE_TLV("Right HPCOM Mixer DACL1 Playback Volume",
DACL1_2_HPRCOM_VOL, 0, 118, 1, output_stage_tlv),
/* Stereo output controls for direct L-to-L and R-to-R routes */
----- SOC_DOUBLE_R_TLV("Line Line2 Bypass Volume",
----- LINE2L_2_LLOPM_VOL, LINE2R_2_RLOPM_VOL,
----- 0, 118, 1, output_stage_tlv),
SOC_DOUBLE_R_TLV("Line PGA Bypass Volume",
PGAL_2_LLOPM_VOL, PGAR_2_RLOPM_VOL,
0, 118, 1, output_stage_tlv),
DACL1_2_LLOPM_VOL, DACR1_2_RLOPM_VOL,
0, 118, 1, output_stage_tlv),
----- SOC_DOUBLE_R_TLV("HP Line2 Bypass Volume",
----- LINE2L_2_HPLOUT_VOL, LINE2R_2_HPROUT_VOL,
----- 0, 118, 1, output_stage_tlv),
SOC_DOUBLE_R_TLV("HP PGA Bypass Volume",
PGAL_2_HPLOUT_VOL, PGAR_2_HPROUT_VOL,
0, 118, 1, output_stage_tlv),
DACL1_2_HPLOUT_VOL, DACR1_2_HPROUT_VOL,
0, 118, 1, output_stage_tlv),
----- SOC_DOUBLE_R_TLV("HPCOM Line2 Bypass Volume",
----- LINE2L_2_HPLCOM_VOL, LINE2R_2_HPRCOM_VOL,
----- 0, 118, 1, output_stage_tlv),
SOC_DOUBLE_R_TLV("HPCOM PGA Bypass Volume",
PGAL_2_HPLCOM_VOL, PGAR_2_HPRCOM_VOL,
0, 118, 1, output_stage_tlv),
SOC_ENUM("Output Driver Ramp-up step", aic3x_rampup_step_enum),
};
+++++ /* For other than tlv320aic3104 */
+++++ static const struct snd_kcontrol_new aic3x_extra_snd_controls[] = {
+++++ /*
+++++ * Output controls that map to output mixer switches. Note these are
+++++ * only for swapped L-to-R and R-to-L routes. See below stereo controls
+++++ * for direct L-to-L and R-to-R routes.
+++++ */
+++++ SOC_SINGLE_TLV("Left Line Mixer Line2R Bypass Volume",
+++++ LINE2R_2_LLOPM_VOL, 0, 118, 1, output_stage_tlv),
+++++
+++++ SOC_SINGLE_TLV("Right Line Mixer Line2L Bypass Volume",
+++++ LINE2L_2_RLOPM_VOL, 0, 118, 1, output_stage_tlv),
+++++
+++++ SOC_SINGLE_TLV("Left HP Mixer Line2R Bypass Volume",
+++++ LINE2R_2_HPLOUT_VOL, 0, 118, 1, output_stage_tlv),
+++++
+++++ SOC_SINGLE_TLV("Right HP Mixer Line2L Bypass Volume",
+++++ LINE2L_2_HPROUT_VOL, 0, 118, 1, output_stage_tlv),
+++++
+++++ SOC_SINGLE_TLV("Left HPCOM Mixer Line2R Bypass Volume",
+++++ LINE2R_2_HPLCOM_VOL, 0, 118, 1, output_stage_tlv),
+++++
+++++ SOC_SINGLE_TLV("Right HPCOM Mixer Line2L Bypass Volume",
+++++ LINE2L_2_HPRCOM_VOL, 0, 118, 1, output_stage_tlv),
+++++
+++++ /* Stereo output controls for direct L-to-L and R-to-R routes */
+++++ SOC_DOUBLE_R_TLV("Line Line2 Bypass Volume",
+++++ LINE2L_2_LLOPM_VOL, LINE2R_2_RLOPM_VOL,
+++++ 0, 118, 1, output_stage_tlv),
+++++
+++++ SOC_DOUBLE_R_TLV("HP Line2 Bypass Volume",
+++++ LINE2L_2_HPLOUT_VOL, LINE2R_2_HPROUT_VOL,
+++++ 0, 118, 1, output_stage_tlv),
+++++
+++++ SOC_DOUBLE_R_TLV("HPCOM Line2 Bypass Volume",
+++++ LINE2L_2_HPLCOM_VOL, LINE2R_2_HPRCOM_VOL,
+++++ 0, 118, 1, output_stage_tlv),
+++++ };
+++++
static const struct snd_kcontrol_new aic3x_mono_controls[] = {
SOC_DOUBLE_R_TLV("Mono Line2 Bypass Volume",
LINE2L_2_MONOLOPM_VOL, LINE2R_2_MONOLOPM_VOL,
/* Left Line Mixer */
static const struct snd_kcontrol_new aic3x_left_line_mixer_controls[] = {
----- SOC_DAPM_SINGLE("Line2L Bypass Switch", LINE2L_2_LLOPM_VOL, 7, 1, 0),
SOC_DAPM_SINGLE("PGAL Bypass Switch", PGAL_2_LLOPM_VOL, 7, 1, 0),
SOC_DAPM_SINGLE("DACL1 Switch", DACL1_2_LLOPM_VOL, 7, 1, 0),
----- SOC_DAPM_SINGLE("Line2R Bypass Switch", LINE2R_2_LLOPM_VOL, 7, 1, 0),
SOC_DAPM_SINGLE("PGAR Bypass Switch", PGAR_2_LLOPM_VOL, 7, 1, 0),
SOC_DAPM_SINGLE("DACR1 Switch", DACR1_2_LLOPM_VOL, 7, 1, 0),
+++++ /* Not on tlv320aic3104 */
+++++ SOC_DAPM_SINGLE("Line2L Bypass Switch", LINE2L_2_LLOPM_VOL, 7, 1, 0),
+++++ SOC_DAPM_SINGLE("Line2R Bypass Switch", LINE2R_2_LLOPM_VOL, 7, 1, 0),
};
/* Right Line Mixer */
static const struct snd_kcontrol_new aic3x_right_line_mixer_controls[] = {
----- SOC_DAPM_SINGLE("Line2L Bypass Switch", LINE2L_2_RLOPM_VOL, 7, 1, 0),
SOC_DAPM_SINGLE("PGAL Bypass Switch", PGAL_2_RLOPM_VOL, 7, 1, 0),
SOC_DAPM_SINGLE("DACL1 Switch", DACL1_2_RLOPM_VOL, 7, 1, 0),
----- SOC_DAPM_SINGLE("Line2R Bypass Switch", LINE2R_2_RLOPM_VOL, 7, 1, 0),
SOC_DAPM_SINGLE("PGAR Bypass Switch", PGAR_2_RLOPM_VOL, 7, 1, 0),
SOC_DAPM_SINGLE("DACR1 Switch", DACR1_2_RLOPM_VOL, 7, 1, 0),
+++++ /* Not on tlv320aic3104 */
+++++ SOC_DAPM_SINGLE("Line2L Bypass Switch", LINE2L_2_RLOPM_VOL, 7, 1, 0),
+++++ SOC_DAPM_SINGLE("Line2R Bypass Switch", LINE2R_2_RLOPM_VOL, 7, 1, 0),
};
/* Mono Mixer */
/* Left HP Mixer */
static const struct snd_kcontrol_new aic3x_left_hp_mixer_controls[] = {
----- SOC_DAPM_SINGLE("Line2L Bypass Switch", LINE2L_2_HPLOUT_VOL, 7, 1, 0),
SOC_DAPM_SINGLE("PGAL Bypass Switch", PGAL_2_HPLOUT_VOL, 7, 1, 0),
SOC_DAPM_SINGLE("DACL1 Switch", DACL1_2_HPLOUT_VOL, 7, 1, 0),
----- SOC_DAPM_SINGLE("Line2R Bypass Switch", LINE2R_2_HPLOUT_VOL, 7, 1, 0),
SOC_DAPM_SINGLE("PGAR Bypass Switch", PGAR_2_HPLOUT_VOL, 7, 1, 0),
SOC_DAPM_SINGLE("DACR1 Switch", DACR1_2_HPLOUT_VOL, 7, 1, 0),
+++++ /* Not on tlv320aic3104 */
+++++ SOC_DAPM_SINGLE("Line2L Bypass Switch", LINE2L_2_HPLOUT_VOL, 7, 1, 0),
+++++ SOC_DAPM_SINGLE("Line2R Bypass Switch", LINE2R_2_HPLOUT_VOL, 7, 1, 0),
};
/* Right HP Mixer */
static const struct snd_kcontrol_new aic3x_right_hp_mixer_controls[] = {
----- SOC_DAPM_SINGLE("Line2L Bypass Switch", LINE2L_2_HPROUT_VOL, 7, 1, 0),
SOC_DAPM_SINGLE("PGAL Bypass Switch", PGAL_2_HPROUT_VOL, 7, 1, 0),
SOC_DAPM_SINGLE("DACL1 Switch", DACL1_2_HPROUT_VOL, 7, 1, 0),
----- SOC_DAPM_SINGLE("Line2R Bypass Switch", LINE2R_2_HPROUT_VOL, 7, 1, 0),
SOC_DAPM_SINGLE("PGAR Bypass Switch", PGAR_2_HPROUT_VOL, 7, 1, 0),
SOC_DAPM_SINGLE("DACR1 Switch", DACR1_2_HPROUT_VOL, 7, 1, 0),
+++++ /* Not on tlv320aic3104 */
+++++ SOC_DAPM_SINGLE("Line2L Bypass Switch", LINE2L_2_HPROUT_VOL, 7, 1, 0),
+++++ SOC_DAPM_SINGLE("Line2R Bypass Switch", LINE2R_2_HPROUT_VOL, 7, 1, 0),
};
/* Left HPCOM Mixer */
static const struct snd_kcontrol_new aic3x_left_hpcom_mixer_controls[] = {
----- SOC_DAPM_SINGLE("Line2L Bypass Switch", LINE2L_2_HPLCOM_VOL, 7, 1, 0),
SOC_DAPM_SINGLE("PGAL Bypass Switch", PGAL_2_HPLCOM_VOL, 7, 1, 0),
SOC_DAPM_SINGLE("DACL1 Switch", DACL1_2_HPLCOM_VOL, 7, 1, 0),
----- SOC_DAPM_SINGLE("Line2R Bypass Switch", LINE2R_2_HPLCOM_VOL, 7, 1, 0),
SOC_DAPM_SINGLE("PGAR Bypass Switch", PGAR_2_HPLCOM_VOL, 7, 1, 0),
SOC_DAPM_SINGLE("DACR1 Switch", DACR1_2_HPLCOM_VOL, 7, 1, 0),
+++++ /* Not on tlv320aic3104 */
+++++ SOC_DAPM_SINGLE("Line2L Bypass Switch", LINE2L_2_HPLCOM_VOL, 7, 1, 0),
+++++ SOC_DAPM_SINGLE("Line2R Bypass Switch", LINE2R_2_HPLCOM_VOL, 7, 1, 0),
};
/* Right HPCOM Mixer */
static const struct snd_kcontrol_new aic3x_right_hpcom_mixer_controls[] = {
----- SOC_DAPM_SINGLE("Line2L Bypass Switch", LINE2L_2_HPRCOM_VOL, 7, 1, 0),
SOC_DAPM_SINGLE("PGAL Bypass Switch", PGAL_2_HPRCOM_VOL, 7, 1, 0),
SOC_DAPM_SINGLE("DACL1 Switch", DACL1_2_HPRCOM_VOL, 7, 1, 0),
----- SOC_DAPM_SINGLE("Line2R Bypass Switch", LINE2R_2_HPRCOM_VOL, 7, 1, 0),
SOC_DAPM_SINGLE("PGAR Bypass Switch", PGAR_2_HPRCOM_VOL, 7, 1, 0),
SOC_DAPM_SINGLE("DACR1 Switch", DACR1_2_HPRCOM_VOL, 7, 1, 0),
+++++ /* Not on tlv320aic3104 */
+++++ SOC_DAPM_SINGLE("Line2L Bypass Switch", LINE2L_2_HPRCOM_VOL, 7, 1, 0),
+++++ SOC_DAPM_SINGLE("Line2R Bypass Switch", LINE2R_2_HPRCOM_VOL, 7, 1, 0),
};
/* Left PGA Mixer */
SOC_DAPM_SINGLE_AIC3X("Mic3R Switch", MIC3LR_2_RADC_CTRL, 0, 1, 1),
};
+++++ /* Left PGA Mixer for tlv320aic3104 */
+++++ static const struct snd_kcontrol_new aic3104_left_pga_mixer_controls[] = {
+++++ SOC_DAPM_SINGLE_AIC3X("Line1L Switch", LINE1L_2_LADC_CTRL, 3, 1, 1),
+++++ SOC_DAPM_SINGLE_AIC3X("Line1R Switch", LINE1R_2_LADC_CTRL, 3, 1, 1),
+++++ SOC_DAPM_SINGLE_AIC3X("Mic2L Switch", MIC3LR_2_LADC_CTRL, 4, 1, 1),
+++++ SOC_DAPM_SINGLE_AIC3X("Mic2R Switch", MIC3LR_2_LADC_CTRL, 0, 1, 1),
+++++ };
+++++
+++++ /* Right PGA Mixer for tlv320aic3104 */
+++++ static const struct snd_kcontrol_new aic3104_right_pga_mixer_controls[] = {
+++++ SOC_DAPM_SINGLE_AIC3X("Line1R Switch", LINE1R_2_RADC_CTRL, 3, 1, 1),
+++++ SOC_DAPM_SINGLE_AIC3X("Line1L Switch", LINE1L_2_RADC_CTRL, 3, 1, 1),
+++++ SOC_DAPM_SINGLE_AIC3X("Mic2L Switch", MIC3LR_2_RADC_CTRL, 4, 1, 1),
+++++ SOC_DAPM_SINGLE_AIC3X("Mic2R Switch", MIC3LR_2_RADC_CTRL, 0, 1, 1),
+++++ };
+++++
/* Left Line1 Mux */
static const struct snd_kcontrol_new aic3x_left_line1l_mux_controls =
SOC_DAPM_ENUM("Route", aic3x_line1l_2_l_enum);
/* Inputs to Left ADC */
SND_SOC_DAPM_ADC("Left ADC", "Left Capture", LINE1L_2_LADC_CTRL, 2, 0),
----- SND_SOC_DAPM_MIXER("Left PGA Mixer", SND_SOC_NOPM, 0, 0,
----- &aic3x_left_pga_mixer_controls[0],
----- ARRAY_SIZE(aic3x_left_pga_mixer_controls)),
SND_SOC_DAPM_MUX("Left Line1L Mux", SND_SOC_NOPM, 0, 0,
&aic3x_left_line1l_mux_controls),
SND_SOC_DAPM_MUX("Left Line1R Mux", SND_SOC_NOPM, 0, 0,
&aic3x_left_line1r_mux_controls),
----- SND_SOC_DAPM_MUX("Left Line2L Mux", SND_SOC_NOPM, 0, 0,
----- &aic3x_left_line2_mux_controls),
/* Inputs to Right ADC */
SND_SOC_DAPM_ADC("Right ADC", "Right Capture",
LINE1R_2_RADC_CTRL, 2, 0),
----- SND_SOC_DAPM_MIXER("Right PGA Mixer", SND_SOC_NOPM, 0, 0,
----- &aic3x_right_pga_mixer_controls[0],
----- ARRAY_SIZE(aic3x_right_pga_mixer_controls)),
SND_SOC_DAPM_MUX("Right Line1L Mux", SND_SOC_NOPM, 0, 0,
&aic3x_right_line1l_mux_controls),
SND_SOC_DAPM_MUX("Right Line1R Mux", SND_SOC_NOPM, 0, 0,
&aic3x_right_line1r_mux_controls),
+++++
+++++ /* Mic Bias */
+++++ SND_SOC_DAPM_SUPPLY("Mic Bias", MICBIAS_CTRL, 6, 0,
+++++ mic_bias_event,
+++++ SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
+++++
+++++ SND_SOC_DAPM_OUTPUT("LLOUT"),
+++++ SND_SOC_DAPM_OUTPUT("RLOUT"),
+++++ SND_SOC_DAPM_OUTPUT("HPLOUT"),
+++++ SND_SOC_DAPM_OUTPUT("HPROUT"),
+++++ SND_SOC_DAPM_OUTPUT("HPLCOM"),
+++++ SND_SOC_DAPM_OUTPUT("HPRCOM"),
+++++
+++++ SND_SOC_DAPM_INPUT("LINE1L"),
+++++ SND_SOC_DAPM_INPUT("LINE1R"),
+++++
+++++ /*
+++++ * Virtual output pin to detection block inside codec. This can be
+++++ * used to keep codec bias on if gpio or detection features are needed.
+++++ * Force pin on or construct a path with an input jack and mic bias
+++++ * widgets.
+++++ */
+++++ SND_SOC_DAPM_OUTPUT("Detection"),
+++++ };
+++++
+++++ /* For other than tlv320aic3104 */
+++++ static const struct snd_soc_dapm_widget aic3x_extra_dapm_widgets[] = {
+++++ /* Inputs to Left ADC */
+++++ SND_SOC_DAPM_MIXER("Left PGA Mixer", SND_SOC_NOPM, 0, 0,
+++++ &aic3x_left_pga_mixer_controls[0],
+++++ ARRAY_SIZE(aic3x_left_pga_mixer_controls)),
+++++ SND_SOC_DAPM_MUX("Left Line2L Mux", SND_SOC_NOPM, 0, 0,
+++++ &aic3x_left_line2_mux_controls),
+++++
+++++ /* Inputs to Right ADC */
+++++ SND_SOC_DAPM_MIXER("Right PGA Mixer", SND_SOC_NOPM, 0, 0,
+++++ &aic3x_right_pga_mixer_controls[0],
+++++ ARRAY_SIZE(aic3x_right_pga_mixer_controls)),
SND_SOC_DAPM_MUX("Right Line2R Mux", SND_SOC_NOPM, 0, 0,
&aic3x_right_line2_mux_controls),
SND_SOC_DAPM_REG(snd_soc_dapm_micbias, "DMic Rate 32",
AIC3X_ASD_INTF_CTRLA, 0, 3, 3, 0),
----- /* Mic Bias */
----- SND_SOC_DAPM_SUPPLY("Mic Bias", MICBIAS_CTRL, 6, 0,
----- mic_bias_event,
----- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
-----
/* Output mixers */
SND_SOC_DAPM_MIXER("Left Line Mixer", SND_SOC_NOPM, 0, 0,
&aic3x_left_line_mixer_controls[0],
&aic3x_right_hpcom_mixer_controls[0],
ARRAY_SIZE(aic3x_right_hpcom_mixer_controls)),
----- SND_SOC_DAPM_OUTPUT("LLOUT"),
----- SND_SOC_DAPM_OUTPUT("RLOUT"),
----- SND_SOC_DAPM_OUTPUT("HPLOUT"),
----- SND_SOC_DAPM_OUTPUT("HPROUT"),
----- SND_SOC_DAPM_OUTPUT("HPLCOM"),
----- SND_SOC_DAPM_OUTPUT("HPRCOM"),
-----
SND_SOC_DAPM_INPUT("MIC3L"),
SND_SOC_DAPM_INPUT("MIC3R"),
----- SND_SOC_DAPM_INPUT("LINE1L"),
----- SND_SOC_DAPM_INPUT("LINE1R"),
SND_SOC_DAPM_INPUT("LINE2L"),
SND_SOC_DAPM_INPUT("LINE2R"),
+++++ };
----- /*
----- * Virtual output pin to detection block inside codec. This can be
----- * used to keep codec bias on if gpio or detection features are needed.
----- * Force pin on or construct a path with an input jack and mic bias
----- * widgets.
----- */
----- SND_SOC_DAPM_OUTPUT("Detection"),
+++++ /* For tlv320aic3104 */
+++++ static const struct snd_soc_dapm_widget aic3104_extra_dapm_widgets[] = {
+++++ /* Inputs to Left ADC */
+++++ SND_SOC_DAPM_MIXER("Left PGA Mixer", SND_SOC_NOPM, 0, 0,
+++++ &aic3104_left_pga_mixer_controls[0],
+++++ ARRAY_SIZE(aic3104_left_pga_mixer_controls)),
+++++
+++++ /* Inputs to Right ADC */
+++++ SND_SOC_DAPM_MIXER("Right PGA Mixer", SND_SOC_NOPM, 0, 0,
+++++ &aic3104_right_pga_mixer_controls[0],
+++++ ARRAY_SIZE(aic3104_right_pga_mixer_controls)),
+++++
+++++ /* Output mixers */
+++++ SND_SOC_DAPM_MIXER("Left Line Mixer", SND_SOC_NOPM, 0, 0,
+++++ &aic3x_left_line_mixer_controls[0],
+++++ ARRAY_SIZE(aic3x_left_line_mixer_controls) - 2),
+++++ SND_SOC_DAPM_MIXER("Right Line Mixer", SND_SOC_NOPM, 0, 0,
+++++ &aic3x_right_line_mixer_controls[0],
+++++ ARRAY_SIZE(aic3x_right_line_mixer_controls) - 2),
+++++ SND_SOC_DAPM_MIXER("Left HP Mixer", SND_SOC_NOPM, 0, 0,
+++++ &aic3x_left_hp_mixer_controls[0],
+++++ ARRAY_SIZE(aic3x_left_hp_mixer_controls) - 2),
+++++ SND_SOC_DAPM_MIXER("Right HP Mixer", SND_SOC_NOPM, 0, 0,
+++++ &aic3x_right_hp_mixer_controls[0],
+++++ ARRAY_SIZE(aic3x_right_hp_mixer_controls) - 2),
+++++ SND_SOC_DAPM_MIXER("Left HPCOM Mixer", SND_SOC_NOPM, 0, 0,
+++++ &aic3x_left_hpcom_mixer_controls[0],
+++++ ARRAY_SIZE(aic3x_left_hpcom_mixer_controls) - 2),
+++++ SND_SOC_DAPM_MIXER("Right HPCOM Mixer", SND_SOC_NOPM, 0, 0,
+++++ &aic3x_right_hpcom_mixer_controls[0],
+++++ ARRAY_SIZE(aic3x_right_hpcom_mixer_controls) - 2),
+++++
+++++ SND_SOC_DAPM_INPUT("MIC2L"),
+++++ SND_SOC_DAPM_INPUT("MIC2R"),
};
static const struct snd_soc_dapm_widget aic3x_dapm_mono_widgets[] = {
{"Left Line1R Mux", "single-ended", "LINE1R"},
{"Left Line1R Mux", "differential", "LINE1R"},
----- {"Left Line2L Mux", "single-ended", "LINE2L"},
----- {"Left Line2L Mux", "differential", "LINE2L"},
-----
{"Left PGA Mixer", "Line1L Switch", "Left Line1L Mux"},
{"Left PGA Mixer", "Line1R Switch", "Left Line1R Mux"},
----- {"Left PGA Mixer", "Line2L Switch", "Left Line2L Mux"},
----- {"Left PGA Mixer", "Mic3L Switch", "MIC3L"},
----- {"Left PGA Mixer", "Mic3R Switch", "MIC3R"},
{"Left ADC", NULL, "Left PGA Mixer"},
----- {"Left ADC", NULL, "GPIO1 dmic modclk"},
/* Right Input */
{"Right Line1R Mux", "single-ended", "LINE1R"},
{"Right Line1L Mux", "single-ended", "LINE1L"},
{"Right Line1L Mux", "differential", "LINE1L"},
----- {"Right Line2R Mux", "single-ended", "LINE2R"},
----- {"Right Line2R Mux", "differential", "LINE2R"},
-----
{"Right PGA Mixer", "Line1L Switch", "Right Line1L Mux"},
{"Right PGA Mixer", "Line1R Switch", "Right Line1R Mux"},
----- {"Right PGA Mixer", "Line2R Switch", "Right Line2R Mux"},
----- {"Right PGA Mixer", "Mic3L Switch", "MIC3L"},
----- {"Right PGA Mixer", "Mic3R Switch", "MIC3R"},
{"Right ADC", NULL, "Right PGA Mixer"},
----- {"Right ADC", NULL, "GPIO1 dmic modclk"},
-----
----- /*
----- * Logical path between digital mic enable and GPIO1 modulator clock
----- * output function
----- */
----- {"GPIO1 dmic modclk", NULL, "DMic Rate 128"},
----- {"GPIO1 dmic modclk", NULL, "DMic Rate 64"},
----- {"GPIO1 dmic modclk", NULL, "DMic Rate 32"},
/* Left DAC Output */
{"Left DAC Mux", "DAC_L1", "Left DAC"},
{"Right DAC Mux", "DAC_R3", "Right DAC"},
/* Left Line Output */
----- {"Left Line Mixer", "Line2L Bypass Switch", "Left Line2L Mux"},
{"Left Line Mixer", "PGAL Bypass Switch", "Left PGA Mixer"},
{"Left Line Mixer", "DACL1 Switch", "Left DAC Mux"},
----- {"Left Line Mixer", "Line2R Bypass Switch", "Right Line2R Mux"},
{"Left Line Mixer", "PGAR Bypass Switch", "Right PGA Mixer"},
{"Left Line Mixer", "DACR1 Switch", "Right DAC Mux"},
{"LLOUT", NULL, "Left Line Out"},
/* Right Line Output */
----- {"Right Line Mixer", "Line2L Bypass Switch", "Left Line2L Mux"},
{"Right Line Mixer", "PGAL Bypass Switch", "Left PGA Mixer"},
{"Right Line Mixer", "DACL1 Switch", "Left DAC Mux"},
----- {"Right Line Mixer", "Line2R Bypass Switch", "Right Line2R Mux"},
{"Right Line Mixer", "PGAR Bypass Switch", "Right PGA Mixer"},
{"Right Line Mixer", "DACR1 Switch", "Right DAC Mux"},
{"RLOUT", NULL, "Right Line Out"},
/* Left HP Output */
----- {"Left HP Mixer", "Line2L Bypass Switch", "Left Line2L Mux"},
{"Left HP Mixer", "PGAL Bypass Switch", "Left PGA Mixer"},
{"Left HP Mixer", "DACL1 Switch", "Left DAC Mux"},
----- {"Left HP Mixer", "Line2R Bypass Switch", "Right Line2R Mux"},
{"Left HP Mixer", "PGAR Bypass Switch", "Right PGA Mixer"},
{"Left HP Mixer", "DACR1 Switch", "Right DAC Mux"},
{"HPLOUT", NULL, "Left HP Out"},
/* Right HP Output */
----- {"Right HP Mixer", "Line2L Bypass Switch", "Left Line2L Mux"},
{"Right HP Mixer", "PGAL Bypass Switch", "Left PGA Mixer"},
{"Right HP Mixer", "DACL1 Switch", "Left DAC Mux"},
----- {"Right HP Mixer", "Line2R Bypass Switch", "Right Line2R Mux"},
{"Right HP Mixer", "PGAR Bypass Switch", "Right PGA Mixer"},
{"Right HP Mixer", "DACR1 Switch", "Right DAC Mux"},
{"HPROUT", NULL, "Right HP Out"},
/* Left HPCOM Output */
----- {"Left HPCOM Mixer", "Line2L Bypass Switch", "Left Line2L Mux"},
{"Left HPCOM Mixer", "PGAL Bypass Switch", "Left PGA Mixer"},
{"Left HPCOM Mixer", "DACL1 Switch", "Left DAC Mux"},
----- {"Left HPCOM Mixer", "Line2R Bypass Switch", "Right Line2R Mux"},
{"Left HPCOM Mixer", "PGAR Bypass Switch", "Right PGA Mixer"},
{"Left HPCOM Mixer", "DACR1 Switch", "Right DAC Mux"},
{"HPLCOM", NULL, "Left HP Com"},
/* Right HPCOM Output */
----- {"Right HPCOM Mixer", "Line2L Bypass Switch", "Left Line2L Mux"},
{"Right HPCOM Mixer", "PGAL Bypass Switch", "Left PGA Mixer"},
{"Right HPCOM Mixer", "DACL1 Switch", "Left DAC Mux"},
----- {"Right HPCOM Mixer", "Line2R Bypass Switch", "Right Line2R Mux"},
{"Right HPCOM Mixer", "PGAR Bypass Switch", "Right PGA Mixer"},
{"Right HPCOM Mixer", "DACR1 Switch", "Right DAC Mux"},
{"HPRCOM", NULL, "Right HP Com"},
};
+++++ /* For other than tlv320aic3104 */
+++++ static const struct snd_soc_dapm_route intercon_extra[] = {
+++++ /* Left Input */
+++++ {"Left Line2L Mux", "single-ended", "LINE2L"},
+++++ {"Left Line2L Mux", "differential", "LINE2L"},
+++++
+++++ {"Left PGA Mixer", "Line2L Switch", "Left Line2L Mux"},
+++++ {"Left PGA Mixer", "Mic3L Switch", "MIC3L"},
+++++ {"Left PGA Mixer", "Mic3R Switch", "MIC3R"},
+++++
+++++ {"Left ADC", NULL, "GPIO1 dmic modclk"},
+++++
+++++ /* Right Input */
+++++ {"Right Line2R Mux", "single-ended", "LINE2R"},
+++++ {"Right Line2R Mux", "differential", "LINE2R"},
+++++
+++++ {"Right PGA Mixer", "Line2R Switch", "Right Line2R Mux"},
+++++ {"Right PGA Mixer", "Mic3L Switch", "MIC3L"},
+++++ {"Right PGA Mixer", "Mic3R Switch", "MIC3R"},
+++++
+++++ {"Right ADC", NULL, "GPIO1 dmic modclk"},
+++++
+++++ /*
+++++ * Logical path between digital mic enable and GPIO1 modulator clock
+++++ * output function
+++++ */
+++++ {"GPIO1 dmic modclk", NULL, "DMic Rate 128"},
+++++ {"GPIO1 dmic modclk", NULL, "DMic Rate 64"},
+++++ {"GPIO1 dmic modclk", NULL, "DMic Rate 32"},
+++++
+++++ /* Left Line Output */
+++++ {"Left Line Mixer", "Line2L Bypass Switch", "Left Line2L Mux"},
+++++ {"Left Line Mixer", "Line2R Bypass Switch", "Right Line2R Mux"},
+++++
+++++ /* Right Line Output */
+++++ {"Right Line Mixer", "Line2L Bypass Switch", "Left Line2L Mux"},
+++++ {"Right Line Mixer", "Line2R Bypass Switch", "Right Line2R Mux"},
+++++
+++++ /* Left HP Output */
+++++ {"Left HP Mixer", "Line2L Bypass Switch", "Left Line2L Mux"},
+++++ {"Left HP Mixer", "Line2R Bypass Switch", "Right Line2R Mux"},
+++++
+++++ /* Right HP Output */
+++++ {"Right HP Mixer", "Line2L Bypass Switch", "Left Line2L Mux"},
+++++ {"Right HP Mixer", "Line2R Bypass Switch", "Right Line2R Mux"},
+++++
+++++ /* Left HPCOM Output */
+++++ {"Left HPCOM Mixer", "Line2L Bypass Switch", "Left Line2L Mux"},
+++++ {"Left HPCOM Mixer", "Line2R Bypass Switch", "Right Line2R Mux"},
+++++
+++++ /* Right HPCOM Output */
+++++ {"Right HPCOM Mixer", "Line2L Bypass Switch", "Left Line2L Mux"},
+++++ {"Right HPCOM Mixer", "Line2R Bypass Switch", "Right Line2R Mux"},
+++++ };
+++++
+++++ /* For tlv320aic3104 */
+++++ static const struct snd_soc_dapm_route intercon_extra_3104[] = {
+++++ /* Left Input */
+++++ {"Left PGA Mixer", "Mic2L Switch", "MIC2L"},
+++++ {"Left PGA Mixer", "Mic2R Switch", "MIC2R"},
+++++
+++++ /* Right Input */
+++++ {"Right PGA Mixer", "Mic2L Switch", "MIC2L"},
+++++ {"Right PGA Mixer", "Mic2R Switch", "MIC2R"},
+++++ };
+++++
static const struct snd_soc_dapm_route intercon_mono[] = {
/* Mono Output */
{"Mono Mixer", "Line2L Bypass Switch", "Left Line2L Mux"},
switch (aic3x->model) {
case AIC3X_MODEL_3X:
case AIC3X_MODEL_33:
+++++ snd_soc_dapm_new_controls(dapm, aic3x_extra_dapm_widgets,
+++++ ARRAY_SIZE(aic3x_extra_dapm_widgets));
+++++ snd_soc_dapm_add_routes(dapm, intercon_extra,
+++++ ARRAY_SIZE(intercon_extra));
snd_soc_dapm_new_controls(dapm, aic3x_dapm_mono_widgets,
ARRAY_SIZE(aic3x_dapm_mono_widgets));
snd_soc_dapm_add_routes(dapm, intercon_mono,
ARRAY_SIZE(intercon_mono));
break;
case AIC3X_MODEL_3007:
+++++ snd_soc_dapm_new_controls(dapm, aic3x_extra_dapm_widgets,
+++++ ARRAY_SIZE(aic3x_extra_dapm_widgets));
+++++ snd_soc_dapm_add_routes(dapm, intercon_extra,
+++++ ARRAY_SIZE(intercon_extra));
snd_soc_dapm_new_controls(dapm, aic3007_dapm_widgets,
ARRAY_SIZE(aic3007_dapm_widgets));
snd_soc_dapm_add_routes(dapm, intercon_3007,
ARRAY_SIZE(intercon_3007));
break;
+++++ case AIC3X_MODEL_3104:
+++++ snd_soc_dapm_new_controls(dapm, aic3104_extra_dapm_widgets,
+++++ ARRAY_SIZE(aic3104_extra_dapm_widgets));
+++++ snd_soc_dapm_add_routes(dapm, intercon_extra_3104,
+++++ ARRAY_SIZE(intercon_extra_3104));
+++++ break;
}
return 0;
delay += aic3x->tdm_delay;
/* Configure data delay */
----- snd_soc_write(codec, AIC3X_ASD_INTF_CTRLC, aic3x->tdm_delay);
+++++ snd_soc_write(codec, AIC3X_ASD_INTF_CTRLC, delay);
return 0;
}
aic3x_init(codec);
if (aic3x->setup) {
----- /* setup GPIO functions */
----- snd_soc_write(codec, AIC3X_GPIO1_REG,
----- (aic3x->setup->gpio_func[0] & 0xf) << 4);
----- snd_soc_write(codec, AIC3X_GPIO2_REG,
----- (aic3x->setup->gpio_func[1] & 0xf) << 4);
+++++ if (aic3x->model != AIC3X_MODEL_3104) {
+++++ /* setup GPIO functions */
+++++ snd_soc_write(codec, AIC3X_GPIO1_REG,
+++++ (aic3x->setup->gpio_func[0] & 0xf) << 4);
+++++ snd_soc_write(codec, AIC3X_GPIO2_REG,
+++++ (aic3x->setup->gpio_func[1] & 0xf) << 4);
+++++ } else {
+++++ dev_warn(codec->dev, "GPIO functionality is not supported on tlv320aic3104\n");
+++++ }
}
switch (aic3x->model) {
case AIC3X_MODEL_3X:
case AIC3X_MODEL_33:
+++++ snd_soc_add_codec_controls(codec, aic3x_extra_snd_controls,
+++++ ARRAY_SIZE(aic3x_extra_snd_controls));
snd_soc_add_codec_controls(codec, aic3x_mono_controls,
ARRAY_SIZE(aic3x_mono_controls));
break;
case AIC3X_MODEL_3007:
+++++ snd_soc_add_codec_controls(codec, aic3x_extra_snd_controls,
+++++ ARRAY_SIZE(aic3x_extra_snd_controls));
snd_soc_add_codec_controls(codec,
&aic3x_classd_amp_gain_ctrl, 1);
break;
+++++ case AIC3X_MODEL_3104:
+++++ break;
}
/* set mic bias voltage */
{ "tlv320aic33", AIC3X_MODEL_33 },
{ "tlv320aic3007", AIC3X_MODEL_3007 },
{ "tlv320aic3106", AIC3X_MODEL_3X },
+++++ { "tlv320aic3104", AIC3X_MODEL_3104 },
{ }
};
MODULE_DEVICE_TABLE(i2c, aic3x_i2c_id);
{ .compatible = "ti,tlv320aic33" },
{ .compatible = "ti,tlv320aic3007" },
{ .compatible = "ti,tlv320aic3106" },
+++++ { .compatible = "ti,tlv320aic3104" },
{},
};
MODULE_DEVICE_TABLE(of, tlv320aic3x_of_match);
static DEVICE_ATTR(pmdown_time, 0644, pmdown_time_show, pmdown_time_set);
+++++static struct attribute *soc_dev_attrs[] = {
+++++ &dev_attr_codec_reg.attr,
+++++ &dev_attr_pmdown_time.attr,
+++++ NULL
+++++};
+++++
+++++static umode_t soc_dev_attr_is_visible(struct kobject *kobj,
+++++ struct attribute *attr, int idx)
+++++{
+++++ struct device *dev = kobj_to_dev(kobj);
+++++ struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev);
+++++
+++++ if (attr == &dev_attr_pmdown_time.attr)
+++++ return attr->mode; /* always visible */
+++++ return rtd->codec ? attr->mode : 0; /* enabled only with codec */
+++++}
+++++
+++++static const struct attribute_group soc_dapm_dev_group = {
+++++ .attrs = soc_dapm_dev_attrs,
+++++ .is_visible = soc_dev_attr_is_visible,
+++++};
+++++
+++++static const struct attribute_group soc_dev_roup = {
+++++ .attrs = soc_dev_attrs,
+++++ .is_visible = soc_dev_attr_is_visible,
+++++};
+++++
+++++static const struct attribute_group *soc_dev_attr_groups[] = {
+++++ &soc_dapm_dev_group,
+++++ &soc_dev_roup,
+++++ NULL
+++++};
+++++
#ifdef CONFIG_DEBUG_FS
static ssize_t codec_reg_read_file(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
/* unregister the rtd device */
if (rtd->dev_registered) {
----- device_remove_file(rtd->dev, &dev_attr_pmdown_time);
----- device_remove_file(rtd->dev, &dev_attr_codec_reg);
device_unregister(rtd->dev);
rtd->dev_registered = 0;
}
device_initialize(rtd->dev);
rtd->dev->parent = rtd->card->dev;
rtd->dev->release = rtd_release;
+++++ rtd->dev->groups = soc_dev_attr_groups;
dev_set_name(rtd->dev, "%s", name);
dev_set_drvdata(rtd->dev, rtd);
mutex_init(&rtd->pcm_mutex);
return ret;
}
rtd->dev_registered = 1;
-----
----- if (rtd->codec) {
----- /* add DAPM sysfs entries for this codec */
----- ret = snd_soc_dapm_sys_add(rtd->dev);
----- if (ret < 0)
----- dev_err(rtd->dev,
----- "ASoC: failed to add codec dapm sysfs entries: %d\n",
----- ret);
-----
----- /* add codec sysfs entries */
----- ret = device_create_file(rtd->dev, &dev_attr_codec_reg);
----- if (ret < 0)
----- dev_err(rtd->dev,
----- "ASoC: failed to add codec sysfs files: %d\n",
----- ret);
----- }
-----
return 0;
}
}
#endif
----- ret = device_create_file(rtd->dev, &dev_attr_pmdown_time);
----- if (ret < 0)
----- dev_warn(rtd->dev, "ASoC: failed to add pmdown_time sysfs: %d\n",
----- ret);
-----
if (cpu_dai->driver->compress_dai) {
/*create compress_device"*/
ret = soc_new_compress(rtd, num);
return 0;
}
+++++/**
+++++ * snd_soc_runtime_set_dai_fmt() - Change DAI link format for a ASoC runtime
+++++ * @rtd: The runtime for which the DAI link format should be changed
+++++ * @dai_fmt: The new DAI link format
+++++ *
+++++ * This function updates the DAI link format for all DAIs connected to the DAI
+++++ * link for the specified runtime.
+++++ *
+++++ * Note: For setups with a static format set the dai_fmt field in the
+++++ * corresponding snd_dai_link struct instead of using this function.
+++++ *
+++++ * Returns 0 on success, otherwise a negative error code.
+++++ */
+++++int snd_soc_runtime_set_dai_fmt(struct snd_soc_pcm_runtime *rtd,
+++++ unsigned int dai_fmt)
+++++{
+++++ struct snd_soc_dai **codec_dais = rtd->codec_dais;
+++++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+++++ unsigned int i;
+++++ int ret;
+++++
+++++ for (i = 0; i < rtd->num_codecs; i++) {
+++++ struct snd_soc_dai *codec_dai = codec_dais[i];
+++++
+++++ ret = snd_soc_dai_set_fmt(codec_dai, dai_fmt);
+++++ if (ret != 0 && ret != -ENOTSUPP) {
+++++ dev_warn(codec_dai->dev,
+++++ "ASoC: Failed to set DAI format: %d\n", ret);
+++++ return ret;
+++++ }
+++++ }
+++++
+++++ /* Flip the polarity for the "CPU" end of a CODEC<->CODEC link */
+++++ if (cpu_dai->codec) {
+++++ unsigned int inv_dai_fmt;
+++++
+++++ inv_dai_fmt = dai_fmt & ~SND_SOC_DAIFMT_MASTER_MASK;
+++++ switch (dai_fmt & SND_SOC_DAIFMT_MASTER_MASK) {
+++++ case SND_SOC_DAIFMT_CBM_CFM:
+++++ inv_dai_fmt |= SND_SOC_DAIFMT_CBS_CFS;
+++++ break;
+++++ case SND_SOC_DAIFMT_CBM_CFS:
+++++ inv_dai_fmt |= SND_SOC_DAIFMT_CBS_CFM;
+++++ break;
+++++ case SND_SOC_DAIFMT_CBS_CFM:
+++++ inv_dai_fmt |= SND_SOC_DAIFMT_CBM_CFS;
+++++ break;
+++++ case SND_SOC_DAIFMT_CBS_CFS:
+++++ inv_dai_fmt |= SND_SOC_DAIFMT_CBM_CFM;
+++++ break;
+++++ }
+++++
+++++ dai_fmt = inv_dai_fmt;
+++++ }
+++++
+++++ ret = snd_soc_dai_set_fmt(cpu_dai, dai_fmt);
+++++ if (ret != 0 && ret != -ENOTSUPP) {
+++++ dev_warn(cpu_dai->dev,
+++++ "ASoC: Failed to set DAI format: %d\n", ret);
+++++ return ret;
+++++ }
+++++
+++++ return 0;
+++++}
+++++EXPORT_SYMBOL_GPL(snd_soc_runtime_set_dai_fmt);
+++++
static int snd_soc_instantiate_card(struct snd_soc_card *card)
{
struct snd_soc_codec *codec;
----- struct snd_soc_dai_link *dai_link;
----- int ret, i, order, dai_fmt;
+++++ int ret, i, order;
mutex_lock_nested(&card->mutex, SND_SOC_CARD_CLASS_INIT);
card->num_dapm_routes);
for (i = 0; i < card->num_links; i++) {
----- struct snd_soc_pcm_runtime *rtd = &card->rtd[i];
----- dai_link = &card->dai_link[i];
----- dai_fmt = dai_link->dai_fmt;
-----
----- if (dai_fmt) {
----- struct snd_soc_dai **codec_dais = rtd->codec_dais;
----- int j;
-----
----- for (j = 0; j < rtd->num_codecs; j++) {
----- struct snd_soc_dai *codec_dai = codec_dais[j];
-----
----- ret = snd_soc_dai_set_fmt(codec_dai, dai_fmt);
----- if (ret != 0 && ret != -ENOTSUPP)
----- dev_warn(codec_dai->dev,
----- "ASoC: Failed to set DAI format: %d\n",
----- ret);
----- }
----- }
-----
----- /* If this is a regular CPU link there will be a platform */
----- if (dai_fmt &&
----- (dai_link->platform_name || dai_link->platform_of_node)) {
----- ret = snd_soc_dai_set_fmt(card->rtd[i].cpu_dai,
----- dai_fmt);
----- if (ret != 0 && ret != -ENOTSUPP)
----- dev_warn(card->rtd[i].cpu_dai->dev,
----- "ASoC: Failed to set DAI format: %d\n",
----- ret);
----- } else if (dai_fmt) {
----- /* Flip the polarity for the "CPU" end */
----- dai_fmt &= ~SND_SOC_DAIFMT_MASTER_MASK;
----- switch (dai_link->dai_fmt &
----- SND_SOC_DAIFMT_MASTER_MASK) {
----- case SND_SOC_DAIFMT_CBM_CFM:
----- dai_fmt |= SND_SOC_DAIFMT_CBS_CFS;
----- break;
----- case SND_SOC_DAIFMT_CBM_CFS:
----- dai_fmt |= SND_SOC_DAIFMT_CBS_CFM;
----- break;
----- case SND_SOC_DAIFMT_CBS_CFM:
----- dai_fmt |= SND_SOC_DAIFMT_CBM_CFS;
----- break;
----- case SND_SOC_DAIFMT_CBS_CFS:
----- dai_fmt |= SND_SOC_DAIFMT_CBM_CFM;
----- break;
----- }
-----
----- ret = snd_soc_dai_set_fmt(card->rtd[i].cpu_dai,
----- dai_fmt);
----- if (ret != 0 && ret != -ENOTSUPP)
----- dev_warn(card->rtd[i].cpu_dai->dev,
----- "ASoC: Failed to set DAI format: %d\n",
----- ret);
----- }
+++++ if (card->dai_link[i].dai_fmt)
+++++ snd_soc_runtime_set_dai_fmt(&card->rtd[i],
+++++ card->dai_link[i].dai_fmt);
}
snprintf(card->snd_card->shortname, sizeof(card->snd_card->shortname),
}
}
----- if (card->fully_routed)
----- snd_soc_dapm_auto_nc_pins(card);
-----
snd_soc_dapm_new_widgets(card);
ret = snd_card_register(card->snd_card);
}
/**
--- -- * snd_soc_dai_set_tdm_slot - configure DAI TDM.
--- -- * @dai: DAI
+++ ++ * snd_soc_dai_set_tdm_slot() - Configures a DAI for TDM operation
+++ ++ * @dai: The DAI to configure
* @tx_mask: bitmask representing active TX slots.
* @rx_mask: bitmask representing active RX slots.
* @slots: Number of slots in use.
* @slot_width: Width in bits for each slot.
*
--- -- * Configures a DAI for TDM operation. Both mask and slots are codec and DAI
--- -- * specific.
+++ ++ * This function configures the specified DAI for TDM operation. @slot contains
+++ ++ * the total number of slots of the TDM stream and @slot_with the width of each
+++ ++ * slot in bit clock cycles. @tx_mask and @rx_mask are bitmasks specifying the
+++ ++ * active slots of the TDM stream for the specified DAI, i.e. which slots the
+++ ++ * DAI should write to or read from. If a bit is set the corresponding slot is
+++ ++ * active, if a bit is cleared the corresponding slot is inactive. Bit 0 maps to
+++ ++ * the first slot, bit 1 to the second slot and so on. The first active slot
+++ ++ * maps to the first channel of the DAI, the second active slot to the second
+++ ++ * channel and so on.
+++ ++ *
+++ ++ * TDM mode can be disabled by passing 0 for @slots. In this case @tx_mask,
+++ ++ * @rx_mask and @slot_width will be ignored.
+++ ++ *
+++ ++ * Returns 0 on success, a negative error code otherwise.
*/
int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai,
unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width)
card->instantiated = false;
snd_soc_dapm_shutdown(card);
soc_cleanup_card_resources(card);
+++++ dev_dbg(card->dev, "ASoC: Unregistered card '%s'\n", card->name);
}
----- dev_dbg(card->dev, "ASoC: Unregistered card '%s'\n", card->name);
return 0;
}
const char *propname)
{
struct device_node *np = card->dev->of_node;
----- int num_routes, old_routes;
+++++ int num_routes;
struct snd_soc_dapm_route *routes;
int i, ret;
return -EINVAL;
}
----- old_routes = card->num_dapm_routes;
----- routes = devm_kzalloc(card->dev,
----- (old_routes + num_routes) * sizeof(*routes),
+++++ routes = devm_kzalloc(card->dev, num_routes * sizeof(*routes),
GFP_KERNEL);
if (!routes) {
dev_err(card->dev,
return -EINVAL;
}
----- memcpy(routes, card->dapm_routes, old_routes * sizeof(*routes));
-----
for (i = 0; i < num_routes; i++) {
ret = of_property_read_string_index(np, propname,
----- 2 * i, &routes[old_routes + i].sink);
+++++ 2 * i, &routes[i].sink);
if (ret) {
dev_err(card->dev,
"ASoC: Property '%s' index %d could not be read: %d\n",
return -EINVAL;
}
ret = of_property_read_string_index(np, propname,
----- (2 * i) + 1, &routes[old_routes + i].source);
+++++ (2 * i) + 1, &routes[i].source);
if (ret) {
dev_err(card->dev,
"ASoC: Property '%s' index %d could not be read: %d\n",
}
}
----- card->num_dapm_routes += num_routes;
+++++ card->num_dapm_routes = num_routes;
card->dapm_routes = routes;
return 0;