Commit 46452d37 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
parents a1375562 c35fbea4
Loading
Loading
Loading
Loading
+10 −0
Original line number Original line Diff line number Diff line
@@ -450,6 +450,16 @@ static const struct config_entry config_table[] = {
		.flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE,
		.flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE,
		.device = 0x51cb,
		.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
#endif


};
};
+14 −3
Original line number Original line Diff line number Diff line
@@ -901,7 +901,10 @@ static void nau8824_jdet_work(struct work_struct *work)
		NAU8824_IRQ_KEY_RELEASE_DIS |
		NAU8824_IRQ_KEY_RELEASE_DIS |
		NAU8824_IRQ_KEY_SHORT_PRESS_DIS, 0);
		NAU8824_IRQ_KEY_SHORT_PRESS_DIS, 0);


	if (nau8824->resume_lock) {
		nau8824_sema_release(nau8824);
		nau8824_sema_release(nau8824);
		nau8824->resume_lock = false;
	}
}
}


static void nau8824_setup_auto_irq(struct nau8824 *nau8824)
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,
		/* release semaphore held after resume,
		 * and cancel jack detection
		 * and cancel jack detection
		 */
		 */
		if (nau8824->resume_lock) {
			nau8824_sema_release(nau8824);
			nau8824_sema_release(nau8824);
			nau8824->resume_lock = false;
		}
		cancel_work_sync(&nau8824->jdet_work);
		cancel_work_sync(&nau8824->jdet_work);
	} else if (active_irq & NAU8824_KEY_SHORT_PRESS_IRQ) {
	} else if (active_irq & NAU8824_KEY_SHORT_PRESS_IRQ) {
		int key_status, button_pressed;
		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)
static int __maybe_unused nau8824_resume(struct snd_soc_component *component)
{
{
	struct nau8824 *nau8824 = snd_soc_component_get_drvdata(component);
	struct nau8824 *nau8824 = snd_soc_component_get_drvdata(component);
	int ret;


	regcache_cache_only(nau8824->regmap, false);
	regcache_cache_only(nau8824->regmap, false);
	regcache_sync(nau8824->regmap);
	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
		/* Hold semaphore to postpone playback happening
		 * until jack detection done.
		 * 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);
		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);
	nau8824->regmap = devm_regmap_init_i2c(i2c, &nau8824_regmap_config);
	if (IS_ERR(nau8824->regmap))
	if (IS_ERR(nau8824->regmap))
		return PTR_ERR(nau8824->regmap);
		return PTR_ERR(nau8824->regmap);
	nau8824->resume_lock = false;
	nau8824->dev = dev;
	nau8824->dev = dev;
	nau8824->irq = i2c->irq;
	nau8824->irq = i2c->irq;
	sema_init(&nau8824->jd_sem, 1);
	sema_init(&nau8824->jd_sem, 1);
+1 −0
Original line number Original line Diff line number Diff line
@@ -436,6 +436,7 @@ struct nau8824 {
	struct semaphore jd_sem;
	struct semaphore jd_sem;
	int fs;
	int fs;
	int irq;
	int irq;
	int resume_lock;
	int micbias_voltage;
	int micbias_voltage;
	int vref_impedance;
	int vref_impedance;
	int jkdet_polarity;
	int jkdet_polarity;
+45 −19
Original line number Original line Diff line number Diff line
@@ -2494,7 +2494,7 @@ static void rt5640_enable_jack_detect(struct snd_soc_component *component,


	/* Select JD-source */
	/* Select JD-source */
	snd_soc_component_update_bits(component, RT5640_JD_CTRL,
	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 */
	/* Selecting GPIO01 as an interrupt */
	snd_soc_component_update_bits(component, RT5640_GPIO_CTRL1,
	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,
	snd_soc_component_update_bits(component, RT5640_GPIO_CTRL3,
		RT5640_GP1_PF_MASK, RT5640_GP1_PF_OUT);
		RT5640_GP1_PF_MASK, RT5640_GP1_PF_OUT);


	/* Enabling jd2 in general control 1 */
	snd_soc_component_write(component, RT5640_DUMMY1, 0x3f41);
	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);
	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
	 * 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.
	 * on systems where the hardware does not already do this.
	 */
	 */
	if (rt5640->jd_inverted)
	if (rt5640->jd_inverted) {
		if (rt5640->jd_src == RT5640_JD_SRC_JD1_IN4P)
			snd_soc_component_write(component, RT5640_IRQ_CTRL1,
			snd_soc_component_write(component, RT5640_IRQ_CTRL1,
				RT5640_IRQ_JD_NOR);
				RT5640_IRQ_JD_NOR);
	else
		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,
			snd_soc_component_write(component, RT5640_IRQ_CTRL1,
				RT5640_IRQ_JD_NOR | RT5640_JD_P_INV);
				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;
	rt5640->jack = jack;
	if (rt5640->jack->status & SND_JACK_MICROPHONE) {
	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,
	if (device_property_read_u32(component->dev,
				     "realtek,jack-detect-source", &val) == 0) {
				     "realtek,jack-detect-source", &val) == 0) {
		if (val <= RT5640_JD_SRC_GPIO4)
		if (val <= RT5640_JD_SRC_HDA_HEADER)
			rt5640->jd_src = val << RT5640_JD_SFT;
			rt5640->jd_src = val;
		else if (val == RT5640_JD_SRC_HDA_HEADER)
			rt5640->jd_src = RT5640_JD_SRC_HDA_HEADER;
		else
		else
			dev_warn(component->dev, "Warning: Invalid jack-detect-source value: %d, leaving jack-detect disabled\n",
			dev_warn(component->dev, "Warning: Invalid jack-detect-source value: %d, leaving jack-detect disabled\n",
				 val);
				 val);
@@ -2809,12 +2816,31 @@ static int rt5640_resume(struct snd_soc_component *component)
	regcache_sync(rt5640->regmap);
	regcache_sync(rt5640->regmap);


	if (rt5640->jack) {
	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,
			snd_soc_component_update_bits(component,
				RT5640_DUMMY2, 0x1100, 0x1100);
				RT5640_DUMMY2, 0x1100, 0x1100);
		else
		} else {
			snd_soc_component_write(component, RT5640_DUMMY2,
			if (rt5640->jd_inverted) {
				0x4001);
				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);
		queue_delayed_work(system_long_wq, &rt5640->jack_work, 0);
	}
	}
+14 −0
Original line number Original line Diff line number Diff line
@@ -1984,6 +1984,20 @@
#define RT5640_M_MONO_ADC_R_SFT			12
#define RT5640_M_MONO_ADC_R_SFT			12
#define RT5640_MCLK_DET				(0x1 << 11)
#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 */
/* Codec Private Register definition */


/* MIC Over current threshold scale factor (0x15) */
/* MIC Over current threshold scale factor (0x15) */
Loading