ASoC: multicodecs&rk3308_codec: handle the request during no codec instance and hp det

If there is no codec instance or headphone jack, we
should not request headphone jack from machine driver.

Change-Id: If05ac2f4bbfd3fc495a75c0701a44a325e5010cd
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
This commit is contained in:
Xing Zheng
2019-06-24 18:34:48 +08:00
committed by Sugar Zhang
parent ab30c1bf0d
commit e5ec404571
3 changed files with 14 additions and 10 deletions

View File

@@ -4251,7 +4251,11 @@ static irqreturn_t rk3308_codec_hpdet_isr(int irq, void *data)
return IRQ_HANDLED;
}
void rk3308_codec_set_jack_detect(struct snd_soc_codec *codec,
void (*rk3308_codec_set_jack_detect_cb)(struct snd_soc_codec *codec,
struct snd_soc_jack *hpdet_jack);
EXPORT_SYMBOL_GPL(rk3308_codec_set_jack_detect_cb);
static void rk3308_codec_set_jack_detect(struct snd_soc_codec *codec,
struct snd_soc_jack *hpdet_jack)
{
struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
@@ -4262,8 +4266,10 @@ void rk3308_codec_set_jack_detect(struct snd_soc_codec *codec,
disable_irq_nosync(rk3308->irq);
queue_delayed_work(system_power_efficient_wq,
&rk3308->hpdet_work, msecs_to_jiffies(10));
dev_info(rk3308->plat_dev, "%s: Request detect hp jack once\n",
__func__);
}
EXPORT_SYMBOL_GPL(rk3308_codec_set_jack_detect);
static const struct regmap_config rk3308_codec_regmap_config = {
.reg_bits = 32,
@@ -4964,6 +4970,8 @@ static int rk3308_platform_probe(struct platform_device *pdev)
(HPDET_BOTH_NEG_POS << 16) |
HPDET_BOTH_NEG_POS);
}
rk3308_codec_set_jack_detect_cb = rk3308_codec_set_jack_detect;
}
if (rk3308->codec_ver == ACODEC_VERSION_A)

View File

@@ -21,13 +21,8 @@
#define __RK3308_CODEC_PROVIDER_H__
#ifdef CONFIG_SND_SOC_RK3308
void rk3308_codec_set_jack_detect(struct snd_soc_codec *codec,
struct snd_soc_jack *hpdet_jack);
#else
static inline void rk3308_codec_set_jack_detect(struct snd_soc_codec *codec,
struct snd_soc_jack *hpdet_jack)
{
}
extern void (*rk3308_codec_set_jack_detect_cb)(struct snd_soc_codec *codec,
struct snd_soc_jack *hpdet_jack);
#endif
#endif /* __RK3308_CODEC_PROVIDER_H__ */

View File

@@ -87,7 +87,8 @@ static int rk_dailink_init(struct snd_soc_pcm_runtime *rtd)
&mc_hp_jack, NULL, 0);
#ifdef CONFIG_SND_SOC_RK3308
rk3308_codec_set_jack_detect(rtd->codec, &mc_hp_jack);
if (rk3308_codec_set_jack_detect_cb)
rk3308_codec_set_jack_detect_cb(rtd->codec, &mc_hp_jack);
#endif
}