Merge tag 'sound-6.0-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai...
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 27 Sep 2022 14:14:58 +0000 (07:14 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 27 Sep 2022 14:14:58 +0000 (07:14 -0700)
Pull sound fixes from Takashi Iwai:
 "A few device-specific fixes, mostly for ASoC. All look small / trivial
  enough"

* tag 'sound-6.0-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ALSA: hda: intel-dsp-config: add missing RaptorLake PCI IDs
  ASoC: tas2770: Reinit regcache on reset
  ASoC: nau8824: Fix semaphore is released unexpectedly
  ASoC: Intel: sof_sdw: add support for Dell SKU 0AFF
  ASoC: imx-card: Fix refcount issue with of_node_put
  ASoC: rt5640: Fix the issue of the abnormal JD2 status

sound/hda/intel-dsp-config.c
sound/soc/codecs/nau8824.c
sound/soc/codecs/nau8824.h
sound/soc/codecs/rt5640.c
sound/soc/codecs/rt5640.h
sound/soc/codecs/tas2770.c
sound/soc/fsl/imx-card.c
sound/soc/intel/boards/sof_sdw.c

index d84ffdf47210ebbbb9165c3f4f5b400266ad3e79..5a478649f3381ed5a88f474e685137b225557eb6 100644 (file)
@@ -450,6 +450,16 @@ static const struct config_entry config_table[] = {
                .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE,
                .device = 0x51cb,
        },
+       /* RaptorLake-M */
+       {
+               .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE,
+               .device = 0x51ce,
+       },
+       /* RaptorLake-PX */
+       {
+               .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE,
+               .device = 0x51cf,
+       },
 #endif
 
 };
index 15596452ca374949d47f9cbf7fe76f44e68b04bf..4f19fd9b65d119d7c1eb148bc85056f88e2867fd 100644 (file)
@@ -901,7 +901,10 @@ static void nau8824_jdet_work(struct work_struct *work)
                NAU8824_IRQ_KEY_RELEASE_DIS |
                NAU8824_IRQ_KEY_SHORT_PRESS_DIS, 0);
 
-       nau8824_sema_release(nau8824);
+       if (nau8824->resume_lock) {
+               nau8824_sema_release(nau8824);
+               nau8824->resume_lock = false;
+       }
 }
 
 static void nau8824_setup_auto_irq(struct nau8824 *nau8824)
@@ -966,7 +969,10 @@ static irqreturn_t nau8824_interrupt(int irq, void *data)
                /* release semaphore held after resume,
                 * and cancel jack detection
                 */
-               nau8824_sema_release(nau8824);
+               if (nau8824->resume_lock) {
+                       nau8824_sema_release(nau8824);
+                       nau8824->resume_lock = false;
+               }
                cancel_work_sync(&nau8824->jdet_work);
        } else if (active_irq & NAU8824_KEY_SHORT_PRESS_IRQ) {
                int key_status, button_pressed;
@@ -1524,6 +1530,7 @@ static int __maybe_unused nau8824_suspend(struct snd_soc_component *component)
 static int __maybe_unused nau8824_resume(struct snd_soc_component *component)
 {
        struct nau8824 *nau8824 = snd_soc_component_get_drvdata(component);
+       int ret;
 
        regcache_cache_only(nau8824->regmap, false);
        regcache_sync(nau8824->regmap);
@@ -1531,7 +1538,10 @@ static int __maybe_unused nau8824_resume(struct snd_soc_component *component)
                /* Hold semaphore to postpone playback happening
                 * until jack detection done.
                 */
-               nau8824_sema_acquire(nau8824, 0);
+               nau8824->resume_lock = true;
+               ret = nau8824_sema_acquire(nau8824, 0);
+               if (ret)
+                       nau8824->resume_lock = false;
                enable_irq(nau8824->irq);
        }
 
@@ -1940,6 +1950,7 @@ static int nau8824_i2c_probe(struct i2c_client *i2c)
        nau8824->regmap = devm_regmap_init_i2c(i2c, &nau8824_regmap_config);
        if (IS_ERR(nau8824->regmap))
                return PTR_ERR(nau8824->regmap);
+       nau8824->resume_lock = false;
        nau8824->dev = dev;
        nau8824->irq = i2c->irq;
        sema_init(&nau8824->jd_sem, 1);
index de4bae8281d01d6bb030e247315bd5dcf48a00ef..5fcfc43dfc85587c3353b566a7f8beb12838d693 100644 (file)
@@ -436,6 +436,7 @@ struct nau8824 {
        struct semaphore jd_sem;
        int fs;
        int irq;
+       int resume_lock;
        int micbias_voltage;
        int vref_impedance;
        int jkdet_polarity;
index 5a844329800f0ccb7209af1800322d0e2c96f244..0f8e6dd214b0ded89171e9951ff09c7e4a999c7e 100644 (file)
@@ -2494,7 +2494,7 @@ static void rt5640_enable_jack_detect(struct snd_soc_component *component,
 
        /* Select JD-source */
        snd_soc_component_update_bits(component, RT5640_JD_CTRL,
-               RT5640_JD_MASK, rt5640->jd_src);
+               RT5640_JD_MASK, rt5640->jd_src << RT5640_JD_SFT);
 
        /* Selecting GPIO01 as an interrupt */
        snd_soc_component_update_bits(component, RT5640_GPIO_CTRL1,
@@ -2504,12 +2504,8 @@ static void rt5640_enable_jack_detect(struct snd_soc_component *component,
        snd_soc_component_update_bits(component, RT5640_GPIO_CTRL3,
                RT5640_GP1_PF_MASK, RT5640_GP1_PF_OUT);
 
-       /* Enabling jd2 in general control 1 */
        snd_soc_component_write(component, RT5640_DUMMY1, 0x3f41);
 
-       /* Enabling jd2 in general control 2 */
-       snd_soc_component_write(component, RT5640_DUMMY2, 0x4001);
-
        rt5640_set_ovcd_params(component);
 
        /*
@@ -2518,12 +2514,25 @@ static void rt5640_enable_jack_detect(struct snd_soc_component *component,
         * pin 0/1 instead of it being stuck to 1. So we invert the JD polarity
         * on systems where the hardware does not already do this.
         */
-       if (rt5640->jd_inverted)
-               snd_soc_component_write(component, RT5640_IRQ_CTRL1,
-                                       RT5640_IRQ_JD_NOR);
-       else
-               snd_soc_component_write(component, RT5640_IRQ_CTRL1,
-                                       RT5640_IRQ_JD_NOR | RT5640_JD_P_INV);
+       if (rt5640->jd_inverted) {
+               if (rt5640->jd_src == RT5640_JD_SRC_JD1_IN4P)
+                       snd_soc_component_write(component, RT5640_IRQ_CTRL1,
+                               RT5640_IRQ_JD_NOR);
+               else if (rt5640->jd_src == RT5640_JD_SRC_JD2_IN4N)
+                       snd_soc_component_update_bits(component, RT5640_DUMMY2,
+                               RT5640_IRQ_JD2_MASK | RT5640_JD2_MASK,
+                               RT5640_IRQ_JD2_NOR | RT5640_JD2_EN);
+       } else {
+               if (rt5640->jd_src == RT5640_JD_SRC_JD1_IN4P)
+                       snd_soc_component_write(component, RT5640_IRQ_CTRL1,
+                               RT5640_IRQ_JD_NOR | RT5640_JD_P_INV);
+               else if (rt5640->jd_src == RT5640_JD_SRC_JD2_IN4N)
+                       snd_soc_component_update_bits(component, RT5640_DUMMY2,
+                               RT5640_IRQ_JD2_MASK | RT5640_JD2_P_MASK |
+                               RT5640_JD2_MASK,
+                               RT5640_IRQ_JD2_NOR | RT5640_JD2_P_INV |
+                               RT5640_JD2_EN);
+       }
 
        rt5640->jack = jack;
        if (rt5640->jack->status & SND_JACK_MICROPHONE) {
@@ -2725,10 +2734,8 @@ static int rt5640_probe(struct snd_soc_component *component)
 
        if (device_property_read_u32(component->dev,
                                     "realtek,jack-detect-source", &val) == 0) {
-               if (val <= RT5640_JD_SRC_GPIO4)
-                       rt5640->jd_src = val << RT5640_JD_SFT;
-               else if (val == RT5640_JD_SRC_HDA_HEADER)
-                       rt5640->jd_src = RT5640_JD_SRC_HDA_HEADER;
+               if (val <= RT5640_JD_SRC_HDA_HEADER)
+                       rt5640->jd_src = val;
                else
                        dev_warn(component->dev, "Warning: Invalid jack-detect-source value: %d, leaving jack-detect disabled\n",
                                 val);
@@ -2809,12 +2816,31 @@ static int rt5640_resume(struct snd_soc_component *component)
        regcache_sync(rt5640->regmap);
 
        if (rt5640->jack) {
-               if (rt5640->jd_src == RT5640_JD_SRC_HDA_HEADER)
+               if (rt5640->jd_src == RT5640_JD_SRC_HDA_HEADER) {
                        snd_soc_component_update_bits(component,
                                RT5640_DUMMY2, 0x1100, 0x1100);
-               else
-                       snd_soc_component_write(component, RT5640_DUMMY2,
-                               0x4001);
+               } else {
+                       if (rt5640->jd_inverted) {
+                               if (rt5640->jd_src == RT5640_JD_SRC_JD2_IN4N)
+                                       snd_soc_component_update_bits(
+                                               component, RT5640_DUMMY2,
+                                               RT5640_IRQ_JD2_MASK |
+                                               RT5640_JD2_MASK,
+                                               RT5640_IRQ_JD2_NOR |
+                                               RT5640_JD2_EN);
+
+                       } else {
+                               if (rt5640->jd_src == RT5640_JD_SRC_JD2_IN4N)
+                                       snd_soc_component_update_bits(
+                                               component, RT5640_DUMMY2,
+                                               RT5640_IRQ_JD2_MASK |
+                                               RT5640_JD2_P_MASK |
+                                               RT5640_JD2_MASK,
+                                               RT5640_IRQ_JD2_NOR |
+                                               RT5640_JD2_P_INV |
+                                               RT5640_JD2_EN);
+                       }
+               }
 
                queue_delayed_work(system_long_wq, &rt5640->jack_work, 0);
        }
index 505c93514051a49cbafe625e54fda0a1db44990a..f58b88e3325b5c3de692548463562c49e5daebc8 100644 (file)
 #define RT5640_M_MONO_ADC_R_SFT                        12
 #define RT5640_MCLK_DET                                (0x1 << 11)
 
+/* General Control 1 (0xfb) */
+#define RT5640_IRQ_JD2_MASK                    (0x1 << 12)
+#define RT5640_IRQ_JD2_SFT                     12
+#define RT5640_IRQ_JD2_BP                      (0x0 << 12)
+#define RT5640_IRQ_JD2_NOR                     (0x1 << 12)
+#define RT5640_JD2_P_MASK                      (0x1 << 10)
+#define RT5640_JD2_P_SFT                       10
+#define RT5640_JD2_P_NOR                       (0x0 << 10)
+#define RT5640_JD2_P_INV                       (0x1 << 10)
+#define RT5640_JD2_MASK                                (0x1 << 8)
+#define RT5640_JD2_SFT                         8
+#define RT5640_JD2_DIS                         (0x0 << 8)
+#define RT5640_JD2_EN                          (0x1 << 8)
+
 /* Codec Private Register definition */
 
 /* MIC Over current threshold scale factor (0x15) */
index bb653b6641466c4c974d1bc26c4fd43fe415e0cf..b6765235a4b3d8e000bcbeef735fdcfc26c3d99c 100644 (file)
@@ -495,6 +495,8 @@ static struct snd_soc_dai_driver tas2770_dai_driver[] = {
        },
 };
 
+static const struct regmap_config tas2770_i2c_regmap;
+
 static int tas2770_codec_probe(struct snd_soc_component *component)
 {
        struct tas2770_priv *tas2770 =
@@ -508,6 +510,7 @@ static int tas2770_codec_probe(struct snd_soc_component *component)
        }
 
        tas2770_reset(tas2770);
+       regmap_reinit_cache(tas2770->regmap, &tas2770_i2c_regmap);
 
        return 0;
 }
index 14be29530fb5dfb47db422be2d356aa4f0f67a18..3f128ced418098521355fad94f02350041736256 100644 (file)
@@ -698,6 +698,10 @@ static int imx_card_parse_of(struct imx_card_data *data)
                of_node_put(cpu);
                of_node_put(codec);
                of_node_put(platform);
+
+               cpu = NULL;
+               codec = NULL;
+               platform = NULL;
        }
 
        return 0;
index a49bfaab6b21fa8c41cd63bea0cc5c933d47d6e7..2ff30b40a1e4cf94a3e53624a551893f7d080864 100644 (file)
@@ -266,6 +266,16 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = {
                .driver_data = (void *)(SOF_SDW_TGL_HDMI |
                                        SOF_SDW_FOUR_SPK),
        },
+       {
+               .callback = sof_sdw_quirk_cb,
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"),
+                       DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "0AFF")
+               },
+               .driver_data = (void *)(SOF_SDW_TGL_HDMI |
+                                       RT711_JD2 |
+                                       SOF_SDW_FOUR_SPK),
+       },
        {
                .callback = sof_sdw_quirk_cb,
                .matches = {