/* set optimum DL1 output path gain for ABE -> McPDM -> twl6040 */ static int omap_abe_set_pdm_dl1_gains(struct snd_soc_dapm_context *dapm) { int gain_dB = 0, gain; struct snd_soc_card *card = dapm->card; struct omap_abe_data *abe_data = snd_soc_card_get_drvdata(card); struct snd_soc_codec *codec = abe_data->twl6040_codec; struct snd_soc_platform *platform = abe_data->abe_platform; struct omap_abe *abe = snd_soc_platform_get_drvdata(platform); if (codec) { #if !defined(CONFIG_SND_OMAP_SOC_ABE_DL2) gain_dB = twl6040_get_dl2_gain(codec); #endif if (!gain_dB) gain_dB = twl6040_get_dl1_gain(codec); } switch (gain_dB) { case -8: gain = GAIN_M8dB; break; case -7: gain = GAIN_M7dB; break; case -1: gain = GAIN_M1dB; break; default: gain = GAIN_0dB; break; } omap_aess_write_gain(abe->aess, OMAP_AESS_GAIN_DL1_LEFT, gain); omap_aess_write_gain(abe->aess, OMAP_AESS_GAIN_DL1_RIGHT, gain); return 0; }
/* set optimum DL1 output path gain for ABE -> McPDM -> twl6040 */ static int omap_abe_set_pdm_dl1_gains(struct snd_soc_dapm_context *dapm) { int gain_dB, gain; gain_dB = twl6040_get_dl1_gain(dapm->codec); switch (gain_dB) { case -8: gain = GAIN_M8dB; break; case -1: gain = GAIN_M1dB; break; default: gain = GAIN_0dB; break; } abe_write_gain(GAINS_DL1, gain, RAMP_2MS, GAIN_LEFT_OFFSET); abe_write_gain(GAINS_DL1, gain, RAMP_2MS, GAIN_RIGHT_OFFSET); return 0; }