static void rk616_codec_capture_work(struct work_struct *work);
static DECLARE_DELAYED_WORK(capture_delayed_work, rk616_codec_capture_work);
static int rk616_codec_work_capture_type = RK616_CODEC_WORK_NULL;
-static bool rk616_for_mid = 1;
+static bool rk616_for_mid = 1, is_hdmi_in = false;
static int board_for_mid(char *str)
{
}
EXPORT_SYMBOL(rk616_headset_mic_detect);
+bool get_hdmi_state(void)
+{
+ return is_hdmi_in;
+}
+
void codec_set_spk(bool on)
{
struct snd_soc_codec *codec = rk616_priv->codec;
snd_soc_dapm_enable_pin(&codec->dapm, "Ext Spk");
}
} else {
+ if (rk616_priv->spk_ctl_gpio != INVALID_GPIO) {
+ DBG("%s : set spk ctl gpio LOW\n", __func__);
+ gpio_set_value(rk616_priv->spk_ctl_gpio, GPIO_LOW);
+ }
+
+ if (rk616_priv->hp_ctl_gpio != INVALID_GPIO) {
+ DBG("%s : set hp ctl gpio LOW\n", __func__);
+ gpio_set_value(rk616_priv->hp_ctl_gpio, GPIO_LOW);
+ snd_soc_write(codec, RK616_CLK_CHPUMP, 0x41);
+ }
+
if (rk616_for_mid)
{
snd_soc_update_bits(codec, RK616_SPKL_CTL,
}
}
snd_soc_dapm_sync(&codec->dapm);
+
+ is_hdmi_in = on ? 0 : 1;
}
EXPORT_SYMBOL_GPL(codec_set_spk);
case RK616_VOICE:
mfd_aif1 |= I2S0_OUT_DISABLE | I2S1_PD_DISABLE;
mfd_aif2 |= I2S1_SI_EN;
- mfd_i2s_ctl |= I2S_CHANNEL_SEL;
+ mfd_i2s_ctl |= I2S_CHANNEL_SEL | PCM_TO_I2S_MUX;
break;
default:
return -EINVAL;
snd_soc_write(codec, RK616_CLK_CHPUMP, 0x41);
}
} else {
- if (rk616_priv && rk616_priv->spk_ctl_gpio != INVALID_GPIO &&
- !is_spk_pd) {
- DBG("%s : set spk ctl gpio HIGH\n", __func__);
- gpio_set_value(rk616_priv->spk_ctl_gpio, GPIO_HIGH);
- }
-
if (rk616_priv && rk616_priv->hp_ctl_gpio != INVALID_GPIO &&
!is_hp_pd) {
- DBG("%s : set hp ctl gpio HIGH\n", __func__);
snd_soc_write(codec, RK616_CLK_CHPUMP, 0x21);
+ msleep(10);
+ DBG("%s : set hp ctl gpio HIGH\n", __func__);
gpio_set_value(rk616_priv->hp_ctl_gpio, GPIO_HIGH);
}
+
+ if (rk616_priv && rk616_priv->spk_ctl_gpio != INVALID_GPIO &&
+ !is_spk_pd) {
+ DBG("%s : set spk ctl gpio HIGH\n", __func__);
+ gpio_set_value(rk616_priv->spk_ctl_gpio, GPIO_HIGH);
+ }
}
return 0;
int ret;\r
\r
DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);\r
- \r
+\r
+ /* MCLK must be 12M when HDMI is in */\r
+ if (get_hdmi_state()) {\r
+ DBG("%s : HDMI is in, do not set sys clk\n",__FUNCTION__);\r
+ }\r
+\r
/* set codec DAI configuration */\r
#if defined (CONFIG_SND_RK29_CODEC_SOC_SLAVE) \r
\r
SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM ); \r
#endif\r
if (ret < 0)\r
- return ret; \r
+ return ret;\r
\r
/* set cpu DAI configuration */\r
#if defined (CONFIG_SND_RK29_CODEC_SOC_SLAVE) \r
ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |\r
SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);\r
#endif \r
- #if defined (CONFIG_SND_RK29_CODEC_SOC_MASTER) \r
+ #if defined (CONFIG_SND_RK29_CODEC_SOC_MASTER)\r
ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |\r
- SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS); \r
- #endif \r
+ SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);\r
+ #endif\r
if (ret < 0)\r
return ret;\r
\r
unsigned int pll_out = 0;\r
int ret;\r
\r
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__); \r
- \r
+ DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);\r
+\r
+ /* MCLK must be 12M when HDMI is in */\r
+ if (get_hdmi_state()) {\r
+ DBG("%s : HDMI is in, do not set sys clk\n",__FUNCTION__);\r
+ }\r
+\r
/* set codec DAI configuration */\r
ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_DSP_A |\r
SND_SOC_DAIFMT_IB_NF | SND_SOC_DAIFMT_CBS_CFS);\r
ret = snd_soc_dai_set_sysclk(codec_dai, 0, pll_out, SND_SOC_CLOCK_IN);\r
\r
if (ret < 0) {\r
- printk("rk_voice_hw_params:failed to set the sysclk for codec side\n"); \r
+ printk("rk_voice_hw_params:failed to set the sysclk for codec side\n");\r
return ret;\r
}\r
\r
ret = snd_soc_dai_set_sysclk(cpu_dai, 0, pll_out, 0);\r
- \r
+\r
return 0;\r
}\r
\r