diff options
author | Xing Zheng <zhengxing@rock-chips.com> | 2019-06-24 18:34:48 +0800 |
---|---|---|
committer | Tao Huang <huangtao@rock-chips.com> | 2019-06-25 19:24:43 +0800 |
commit | fae9e5d462687f6c6c6fb164f63ac8e5c0b06669 (patch) | |
tree | e0ed3ff8a418f64060b9a7f4cd6327b9ef9bee76 /sound | |
parent | c30a2677148ad272553b5bb9647c8968571b3e06 (diff) |
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>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/codecs/rk3308_codec.c | 12 | ||||
-rw-r--r-- | sound/soc/codecs/rk3308_codec_provider.h | 9 | ||||
-rw-r--r-- | sound/soc/rockchip/rockchip_multicodecs.c | 3 |
3 files changed, 14 insertions, 10 deletions
diff --git a/sound/soc/codecs/rk3308_codec.c b/sound/soc/codecs/rk3308_codec.c index 82eeedf1fe4c..aadcd7f698fb 100644 --- a/sound/soc/codecs/rk3308_codec.c +++ b/sound/soc/codecs/rk3308_codec.c @@ -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) diff --git a/sound/soc/codecs/rk3308_codec_provider.h b/sound/soc/codecs/rk3308_codec_provider.h index a447f3a92ff4..68042b1328dc 100644 --- a/sound/soc/codecs/rk3308_codec_provider.h +++ b/sound/soc/codecs/rk3308_codec_provider.h @@ -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__ */ diff --git a/sound/soc/rockchip/rockchip_multicodecs.c b/sound/soc/rockchip/rockchip_multicodecs.c index 70b640131b8c..9b2a953f82a7 100644 --- a/sound/soc/rockchip/rockchip_multicodecs.c +++ b/sound/soc/rockchip/rockchip_multicodecs.c @@ -104,7 +104,8 @@ static int rk_dailink_init(struct snd_soc_pcm_runtime *rtd) ARRAY_SIZE(mc_hp_jack_pins)); #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 #ifdef CONFIG_RK_HEADSET |