]> Git Repo - linux.git/commitdiff
ASoC: rt5640: Do not manipulate pin "Platform Clock" if the "Platform Clock" is not...
authorOder Chiou <[email protected]>
Mon, 16 May 2022 10:30:55 +0000 (18:30 +0800)
committerMark Brown <[email protected]>
Tue, 24 May 2022 11:35:08 +0000 (12:35 +0100)
The pin "Platform Clock" was only used by the Intel Byt CR platform. In the
others, the error log will be informed. The patch will set the flag to
avoid the pin "Platform Clock" manipulated by the other platforms.

Signed-off-by: Oder Chiou <[email protected]>
Reported-by: Sameer Pujar <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
sound/soc/codecs/rt5640.c
sound/soc/codecs/rt5640.h
sound/soc/intel/boards/bytcr_rt5640.c

index 12da2bea1a7bcb16111b5d64580bf316019f8274..69c80d80ed9d52be92c49152fe737cabe3dd1de3 100644 (file)
@@ -2094,12 +2094,14 @@ EXPORT_SYMBOL_GPL(rt5640_sel_asrc_clk_src);
 void rt5640_enable_micbias1_for_ovcd(struct snd_soc_component *component)
 {
        struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
+       struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component);
 
        snd_soc_dapm_mutex_lock(dapm);
        snd_soc_dapm_force_enable_pin_unlocked(dapm, "LDO2");
        snd_soc_dapm_force_enable_pin_unlocked(dapm, "MICBIAS1");
        /* OVCD is unreliable when used with RCCLK as sysclk-source */
-       snd_soc_dapm_force_enable_pin_unlocked(dapm, "Platform Clock");
+       if (rt5640->use_platform_clock)
+               snd_soc_dapm_force_enable_pin_unlocked(dapm, "Platform Clock");
        snd_soc_dapm_sync_unlocked(dapm);
        snd_soc_dapm_mutex_unlock(dapm);
 }
@@ -2108,9 +2110,11 @@ EXPORT_SYMBOL_GPL(rt5640_enable_micbias1_for_ovcd);
 void rt5640_disable_micbias1_for_ovcd(struct snd_soc_component *component)
 {
        struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
+       struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component);
 
        snd_soc_dapm_mutex_lock(dapm);
-       snd_soc_dapm_disable_pin_unlocked(dapm, "Platform Clock");
+       if (rt5640->use_platform_clock)
+               snd_soc_dapm_disable_pin_unlocked(dapm, "Platform Clock");
        snd_soc_dapm_disable_pin_unlocked(dapm, "MICBIAS1");
        snd_soc_dapm_disable_pin_unlocked(dapm, "LDO2");
        snd_soc_dapm_sync_unlocked(dapm);
@@ -2535,6 +2539,9 @@ static void rt5640_enable_jack_detect(struct snd_soc_component *component,
                rt5640->jd_gpio_irq_requested = true;
        }
 
+       if (jack_data && jack_data->use_platform_clock)
+               rt5640->use_platform_clock = jack_data->use_platform_clock;
+
        ret = request_irq(rt5640->irq, rt5640_irq,
                          IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
                          "rt5640", rt5640);
index 9e49b9a0ccaad2977cb1a4ef846a1873ec970e59..505c93514051a49cbafe625e54fda0a1db44990a 100644 (file)
@@ -2155,11 +2155,13 @@ struct rt5640_priv {
        bool jd_inverted;
        unsigned int ovcd_th;
        unsigned int ovcd_sf;
+       bool use_platform_clock;
 };
 
 struct rt5640_set_jack_data {
        int codec_irq_override;
        struct gpio_desc *jd_gpio;
+       bool use_platform_clock;
 };
 
 int rt5640_dmic_enable(struct snd_soc_component *component,
index 7b948a219177d2a92bf80821d0b762a693d77558..ed9fa17287227078b9f00fc642aede73da960f67 100644 (file)
@@ -1191,12 +1191,14 @@ static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime)
 {
        struct snd_soc_card *card = runtime->card;
        struct byt_rt5640_private *priv = snd_soc_card_get_drvdata(card);
+       struct rt5640_set_jack_data *jack_data = &priv->jack_data;
        struct snd_soc_component *component = asoc_rtd_to_codec(runtime, 0)->component;
        const struct snd_soc_dapm_route *custom_map = NULL;
        int num_routes = 0;
        int ret;
 
        card->dapm.idle_bias_off = true;
+       jack_data->use_platform_clock = true;
 
        /* Start with RC clk for jack-detect (we disable MCLK below) */
        if (byt_rt5640_quirk & BYT_RT5640_MCLK_EN)
This page took 0.500548 seconds and 4 git commands to generate.