static int ak4642_dai_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { int is_play = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; struct snd_soc_codec *codec = dai->codec; if (is_play) { /* * start headphone output * * PLL, Master Mode * Audio I/F Format :MSB justified (ADC & DAC) * Bass Boost Level : Middle * * This operation came from example code of * "ASAHI KASEI AK4642" (japanese) manual p97. */ snd_soc_update_bits(codec, MD_CTL4, DACH, DACH); snd_soc_update_bits(codec, MD_CTL3, BST1, BST1); ak4642_write(codec, L_IVC, 0x91); /* volume */ ak4642_write(codec, R_IVC, 0x91); /* volume */ snd_soc_update_bits(codec, PW_MGMT1, PMVCM | PMMIN | PMDAC, PMVCM | PMMIN | PMDAC); snd_soc_update_bits(codec, PW_MGMT2, PMHP_MASK, PMHP); snd_soc_update_bits(codec, PW_MGMT2, HPMTN, HPMTN); } else { /* * start stereo input * * PLL Master Mode * Audio I/F Format:MSB justified (ADC & DAC) * Pre MIC AMP:+20dB * MIC Power On * ALC setting:Refer to Table 35 * ALC bit=“1” * * This operation came from example code of * "ASAHI KASEI AK4642" (japanese) manual p94. */ ak4642_write(codec, SG_SL1, PMMP | MGAIN0); ak4642_write(codec, TIMER, ZTM(0x3) | WTM(0x3)); ak4642_write(codec, ALC_CTL1, ALC | LMTH0); snd_soc_update_bits(codec, PW_MGMT1, PMVCM | PMADL, PMVCM | PMADL); snd_soc_update_bits(codec, PW_MGMT3, PMADR, PMADR); } return 0; }
static int ak4642_dai_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { int is_play = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; struct snd_soc_codec *codec = dai->codec; if (is_play) { snd_soc_write(codec, L_IVC, 0x91); snd_soc_write(codec, R_IVC, 0x91); } else { snd_soc_write(codec, SG_SL1, PMMP | MGAIN0); snd_soc_write(codec, TIMER, ZTM(0x3) | WTM(0x3)); snd_soc_write(codec, ALC_CTL1, ALC | LMTH0); snd_soc_update_bits(codec, PW_MGMT1, PMADL, PMADL); snd_soc_update_bits(codec, PW_MGMT3, PMADR, PMADR); } return 0; }