void notify_dock_status(int status)
{
	if (!the_codec)
		return;

	pr_info("%s: status=%d", __func__, status);
	dock_status = status;

	if (status)
		wm8994_vmid_mode(the_codec, WM8994_VMID_FORCE);
	else
		wm8994_vmid_mode(the_codec, WM8994_VMID_NORMAL);
}
Example #2
0
static int m3_card_resume_post(struct snd_soc_card *card)
{
	struct snd_soc_codec *codec = card->rtd->codec;
	struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
	int reg = 0;

#ifdef CONFIG_SND_USE_LINEOUT_SWITCH
	if (lineout_mode == 1 &&
		wm8994->vmid_mode == WM8994_VMID_NORMAL) {
		dev_info(codec->dev,
			"%s: entering normal vmid mode\n", __func__);
		wm8994_vmid_mode(codec, WM8994_VMID_FORCE);
		gpio_set_value(GPIO_VPS_SOUND_EN, 1);
	}
#endif
	reg = snd_soc_read(codec, WM8994_GPIO_1);
	if ((reg & WM8994_GPN_FN_MASK) != WM8994_GP_FN_IRQ) {
		dev_err(codec->dev, "%s: GPIO1 type 0x%x\n", __func__, reg);
		snd_soc_write(codec, WM8994_GPIO_1, WM8994_GP_FN_IRQ);
	}
#ifdef CONFIG_SEC_DEV_JACK
	snd_soc_dapm_force_enable_pin(&codec->dapm, "AIF1CLK");
#endif

	return 0;
}
static int wm8994_resume_post(struct snd_soc_card *card)
{
	struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(the_codec);

	if (dock_status == 1 && wm8994->vmid_mode == WM8994_VMID_NORMAL) {
		pr_info("%s: entering normal vmid mode\n", __func__);
		wm8994_vmid_mode(the_codec, WM8994_VMID_FORCE);
	}
	return 0;
}
Example #4
0
static int set_lineout_mode(struct snd_kcontrol *kcontrol,
	struct snd_ctl_elem_value *ucontrol)
{
	struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);

	lineout_mode = ucontrol->value.integer.value[0];

#ifdef CONFIG_SND_USE_LINEOUT_SWITCH
	if (lineout_mode) {
		wm8994_vmid_mode(codec, WM8994_VMID_FORCE);
		gpio_set_value(GPIO_VPS_SOUND_EN, 1);
	} else {
		gpio_set_value(GPIO_VPS_SOUND_EN, 0);
		wm8994_vmid_mode(codec, WM8994_VMID_NORMAL);
	}
#endif
	dev_info(codec->dev, "set lineout mode : %s\n",
		lineout_mode_text[lineout_mode]);
	return 0;

}
static int set_lineout_mode(struct snd_kcontrol *kcontrol,
	struct snd_ctl_elem_value *ucontrol)
{
	struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
	struct wm1811_machine_priv *wm1811
		= snd_soc_card_get_drvdata(codec->card);

	lineout_mode = ucontrol->value.integer.value[0];

	if (lineout_mode) {
		wm8994_vmid_mode(codec, WM8994_VMID_FORCE);
		if (wm1811->lineout_switch_f)
			wm1811->lineout_switch_f(1);
	} else {
		if (wm1811->lineout_switch_f)
			wm1811->lineout_switch_f(0);
		wm8994_vmid_mode(codec, WM8994_VMID_NORMAL);
	}

	dev_info(codec->dev, "set lineout mode : %s\n",
		lineout_mode_text[lineout_mode]);
	return 0;

}
static int midas_card_resume_post(struct snd_soc_card *card)
{
	struct snd_soc_codec *codec = card->rtd->codec;
	struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);

#ifdef CONFIG_SND_USE_LINEOUT_SWITCH
	if (lineout_mode == 1 &&
		wm8994->vmid_mode == WM8994_VMID_NORMAL) {
		dev_dbg(codec->dev,
			"%s: entering normal vmid mode\n", __func__);
		wm8994_vmid_mode(codec, WM8994_VMID_FORCE);
		gpio_set_value(GPIO_LINEOUT_EN, 1);
	}
#endif
#ifdef CONFIG_SEC_DEV_JACK
	snd_soc_dapm_force_enable_pin(&codec->dapm, "AIF1CLK");
#endif

	return 0;
}
Example #7
0
static int m3_card_suspend_pre(struct snd_soc_card *card)
{
	struct snd_soc_codec *codec = card->rtd->codec;
	struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);

#ifdef CONFIG_SND_USE_LINEOUT_SWITCH
	if (lineout_mode == 1 &&
		wm8994->vmid_mode == WM8994_VMID_FORCE) {
		dev_info(codec->dev,
			"%s: entering force vmid mode\n", __func__);
		gpio_set_value(GPIO_VPS_SOUND_EN, 0);
		wm8994_vmid_mode(codec, WM8994_VMID_NORMAL);
	}
#endif
#ifdef CONFIG_SEC_DEV_JACK
	snd_soc_dapm_disable_pin(&codec->dapm, "AIF1CLK");
#endif

	return 0;
}
static int t0_card_suspend_pre(struct snd_soc_card *card)
{
	struct snd_soc_codec *codec = card->rtd->codec;
	struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);

#ifdef CONFIG_SND_USE_LINEOUT_SWITCH
	struct wm1811_machine_priv *wm1811
		= snd_soc_card_get_drvdata(codec->card);
	if (lineout_mode == 1 &&
		wm8994->vmid_mode == WM8994_VMID_FORCE) {
		dev_info(codec->dev,
			"%s: entering force vmid mode\n", __func__);
		if (wm1811->lineout_switch_f)
			wm1811->lineout_switch_f(0);
		wm8994_vmid_mode(codec, WM8994_VMID_NORMAL);
	}
#endif
#ifdef CONFIG_SEC_DEV_JACK
	snd_soc_dapm_disable_pin(&codec->dapm, "AIF1CLK");
#endif

	return 0;
}