Skip to content

Commit

Permalink
ASoC: rt5670: export jack suspend/resume APIs
Browse files Browse the repository at this point in the history
We force enable "Mic Det Power" when a jack is inserted. Also, we
set codec idle_bias_off = true. As a result, codec driver will not
suspend as we expect.

On Braswell, we don't need the jack detection when suspend but need
it after resume, so export the jack suspend/resume APIs which are
provided for machine driver to control during suspend/resume.

Signed-off-by: Jie Yang <yang.jie@intel.com>
Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Bard Liao authored and Mark Brown committed Mar 11, 2015
1 parent d3ef705 commit cc3c340
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
18 changes: 18 additions & 0 deletions sound/soc/codecs/rt5670.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,24 @@ static int rt5670_headset_detect(struct snd_soc_codec *codec, int jack_insert)
return rt5670->jack_type;
}

void rt5670_jack_suspend(struct snd_soc_codec *codec)
{
struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec);

rt5670->jack_type_saved = rt5670->jack_type;
rt5670_headset_detect(codec, 0);
}
EXPORT_SYMBOL_GPL(rt5670_jack_suspend);

void rt5670_jack_resume(struct snd_soc_codec *codec)
{
struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec);

if (rt5670->jack_type_saved)
rt5670_headset_detect(codec, 1);
}
EXPORT_SYMBOL_GPL(rt5670_jack_resume);

static int rt5670_button_detect(struct snd_soc_codec *codec)
{
int btn_type, val;
Expand Down
3 changes: 3 additions & 0 deletions sound/soc/codecs/rt5670.h
Original file line number Diff line number Diff line change
Expand Up @@ -2004,8 +2004,11 @@ struct rt5670_priv {
int dsp_sw; /* expected parameter setting */
int dsp_rate;
int jack_type;
int jack_type_saved;
};

void rt5670_jack_suspend(struct snd_soc_codec *codec);
void rt5670_jack_resume(struct snd_soc_codec *codec);
int rt5670_set_jack_detect(struct snd_soc_codec *codec,
struct snd_soc_jack *jack);
#endif /* __RT5670_H__ */

0 comments on commit cc3c340

Please sign in to comment.