linux-sound.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 6.9 04/40] ASoC: rt722-sdca-sdw: add silence detection register as volatile
       [not found] <20240709162007.30160-1-sashal@kernel.org>
@ 2024-07-09 16:18 ` Sasha Levin
  2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 05/40] ASoC: codecs: ES8326: Solve headphone detection issue Sasha Levin
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Sasha Levin @ 2024-07-09 16:18 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Jack Yu, Mark Brown, Sasha Levin, oder_chiou, lgirdwood, perex,
	tiwai, linux-sound

From: Jack Yu <jack.yu@realtek.com>

[ Upstream commit 968c974c08106fcf911d8d390d0f049af855d348 ]

Including silence detection register as volatile.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://msgid.link/r/c66a6bd6d220426793096b42baf85437@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/codecs/rt722-sdca-sdw.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/soc/codecs/rt722-sdca-sdw.c b/sound/soc/codecs/rt722-sdca-sdw.c
index 65d584c1886e8..0a14198f8a424 100644
--- a/sound/soc/codecs/rt722-sdca-sdw.c
+++ b/sound/soc/codecs/rt722-sdca-sdw.c
@@ -68,6 +68,7 @@ static bool rt722_sdca_mbq_readable_register(struct device *dev, unsigned int re
 	case 0x200007f:
 	case 0x2000082 ... 0x200008e:
 	case 0x2000090 ... 0x2000094:
+	case 0x3110000:
 	case 0x5300000 ... 0x5300002:
 	case 0x5400002:
 	case 0x5600000 ... 0x5600007:
@@ -125,6 +126,7 @@ static bool rt722_sdca_mbq_volatile_register(struct device *dev, unsigned int re
 	case 0x2000067:
 	case 0x2000084:
 	case 0x2000086:
+	case 0x3110000:
 		return true;
 	default:
 		return false;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH AUTOSEL 6.9 05/40] ASoC: codecs: ES8326: Solve headphone detection issue
       [not found] <20240709162007.30160-1-sashal@kernel.org>
  2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 04/40] ASoC: rt722-sdca-sdw: add silence detection register as volatile Sasha Levin
@ 2024-07-09 16:18 ` Sasha Levin
  2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 07/40] ASoC: topology: Fix references to freed memory Sasha Levin
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Sasha Levin @ 2024-07-09 16:18 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Zhang Yi, Mark Brown, Sasha Levin, lgirdwood, perex, tiwai,
	zhuning0077, linux-sound

From: Zhang Yi <zhangyi@everest-semi.com>

[ Upstream commit b7c40988808f8d7426dee1e4d96a4e204de4a8bc ]

When switching between OMTP and CTIA headset, we can hear pop noise.
To solve this issue, We modified the configuration for headphone detection

Signed-off-by: Zhang Yi <zhangyi@everest-semi.com>
Link: https://msgid.link/r/20240604021946.2911-1-zhangyi@everest-semi.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/codecs/es8326.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
index 17bd6b5160772..8b2328d5d0c74 100644
--- a/sound/soc/codecs/es8326.c
+++ b/sound/soc/codecs/es8326.c
@@ -865,12 +865,16 @@ static void es8326_jack_detect_handler(struct work_struct *work)
 			 * set auto-check mode, then restart jack_detect_work after 400ms.
 			 * Don't report jack status.
 			 */
-			regmap_write(es8326->regmap, ES8326_INT_SOURCE,
-					(ES8326_INT_SRC_PIN9 | ES8326_INT_SRC_BUTTON));
+			regmap_write(es8326->regmap, ES8326_INT_SOURCE, 0x00);
 			regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x01);
+			regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x10, 0x00);
 			es8326_enable_micbias(es8326->component);
 			usleep_range(50000, 70000);
 			regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x00);
+			regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x10, 0x10);
+			usleep_range(50000, 70000);
+			regmap_write(es8326->regmap, ES8326_INT_SOURCE,
+					(ES8326_INT_SRC_PIN9 | ES8326_INT_SRC_BUTTON));
 			regmap_write(es8326->regmap, ES8326_SYS_BIAS, 0x1f);
 			regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF, 0x0f, 0x08);
 			queue_delayed_work(system_wq, &es8326->jack_detect_work,
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH AUTOSEL 6.9 07/40] ASoC: topology: Fix references to freed memory
       [not found] <20240709162007.30160-1-sashal@kernel.org>
  2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 04/40] ASoC: rt722-sdca-sdw: add silence detection register as volatile Sasha Levin
  2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 05/40] ASoC: codecs: ES8326: Solve headphone detection issue Sasha Levin
@ 2024-07-09 16:18 ` Sasha Levin
  2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 08/40] ASoC: Intel: avs: Fix route override Sasha Levin
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Sasha Levin @ 2024-07-09 16:18 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Amadeusz Sławiński, Jason Montleon, Cezary Rojewski,
	Mark Brown, Sasha Levin, lgirdwood, perex, tiwai, linux-sound

From: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>

[ Upstream commit 97ab304ecd95c0b1703ff8c8c3956dc6e2afe8e1 ]

Most users after parsing a topology file, release memory used by it, so
having pointer references directly into topology file contents is wrong.
Use devm_kmemdup(), to allocate memory as needed.

Reported-by: Jason Montleon <jmontleo@redhat.com>
Link: https://github.com/thesofproject/avs-topology-xml/issues/22#issuecomment-2127892605
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20240603102818.36165-2-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/soc-topology.c | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)

diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index ba4890991f0d7..7add1dbf1d214 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -1060,15 +1060,32 @@ static int soc_tplg_dapm_graph_elems_load(struct soc_tplg *tplg,
 			break;
 		}
 
-		route->source = elem->source;
-		route->sink = elem->sink;
+		route->source = devm_kmemdup(tplg->dev, elem->source,
+					     min(strlen(elem->source),
+						 SNDRV_CTL_ELEM_ID_NAME_MAXLEN),
+					     GFP_KERNEL);
+		route->sink = devm_kmemdup(tplg->dev, elem->sink,
+					   min(strlen(elem->sink), SNDRV_CTL_ELEM_ID_NAME_MAXLEN),
+					   GFP_KERNEL);
+		if (!route->source || !route->sink) {
+			ret = -ENOMEM;
+			break;
+		}
 
 		/* set to NULL atm for tplg users */
 		route->connected = NULL;
-		if (strnlen(elem->control, SNDRV_CTL_ELEM_ID_NAME_MAXLEN) == 0)
+		if (strnlen(elem->control, SNDRV_CTL_ELEM_ID_NAME_MAXLEN) == 0) {
 			route->control = NULL;
-		else
-			route->control = elem->control;
+		} else {
+			route->control = devm_kmemdup(tplg->dev, elem->control,
+						      min(strlen(elem->control),
+							  SNDRV_CTL_ELEM_ID_NAME_MAXLEN),
+						      GFP_KERNEL);
+			if (!route->control) {
+				ret = -ENOMEM;
+				break;
+			}
+		}
 
 		/* add route dobj to dobj_list */
 		route->dobj.type = SND_SOC_DOBJ_GRAPH;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH AUTOSEL 6.9 08/40] ASoC: Intel: avs: Fix route override
       [not found] <20240709162007.30160-1-sashal@kernel.org>
                   ` (2 preceding siblings ...)
  2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 07/40] ASoC: topology: Fix references to freed memory Sasha Levin
@ 2024-07-09 16:18 ` Sasha Levin
  2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 09/40] ASoC: topology: Do not assign fields that are already set Sasha Levin
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Sasha Levin @ 2024-07-09 16:18 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Amadeusz Sławiński, Jason Montleon, Cezary Rojewski,
	Mark Brown, Sasha Levin, pierre-louis.bossart, liam.r.girdwood,
	peter.ujfalusi, yung-chuan.liao, ranjani.sridharan, kai.vehmanen,
	perex, tiwai, justinstitt, alsa-devel, linux-sound

From: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>

[ Upstream commit fd660b1bd015e5aa9a558ee04088f2431010548d ]

Instead of overriding existing memory strings that may be too short,
just allocate needed memory and point the route at it.

Reported-by: Jason Montleon <jmontleo@redhat.com>
Link: https://github.com/thesofproject/avs-topology-xml/issues/22#issuecomment-2127892605
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20240603102818.36165-3-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/intel/avs/topology.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/sound/soc/intel/avs/topology.c b/sound/soc/intel/avs/topology.c
index 42b42903ae9de..691d16ce95a0f 100644
--- a/sound/soc/intel/avs/topology.c
+++ b/sound/soc/intel/avs/topology.c
@@ -1545,8 +1545,8 @@ static int avs_route_load(struct snd_soc_component *comp, int index,
 {
 	struct snd_soc_acpi_mach *mach = dev_get_platdata(comp->card->dev);
 	size_t len = SNDRV_CTL_ELEM_ID_NAME_MAXLEN;
-	char buf[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
 	int ssp_port, tdm_slot;
+	char *buf;
 
 	/* See parse_link_formatted_string() for dynamic naming when(s). */
 	if (!avs_mach_singular_ssp(mach))
@@ -1557,13 +1557,24 @@ static int avs_route_load(struct snd_soc_component *comp, int index,
 		return 0;
 	tdm_slot = avs_mach_ssp_tdm(mach, ssp_port);
 
+	buf = devm_kzalloc(comp->card->dev, len, GFP_KERNEL);
+	if (!buf)
+		return -ENOMEM;
 	avs_ssp_sprint(buf, len, route->source, ssp_port, tdm_slot);
-	strscpy((char *)route->source, buf, len);
+	route->source = buf;
+
+	buf = devm_kzalloc(comp->card->dev, len, GFP_KERNEL);
+	if (!buf)
+		return -ENOMEM;
 	avs_ssp_sprint(buf, len, route->sink, ssp_port, tdm_slot);
-	strscpy((char *)route->sink, buf, len);
+	route->sink = buf;
+
 	if (route->control) {
+		buf = devm_kzalloc(comp->card->dev, len, GFP_KERNEL);
+		if (!buf)
+			return -ENOMEM;
 		avs_ssp_sprint(buf, len, route->control, ssp_port, tdm_slot);
-		strscpy((char *)route->control, buf, len);
+		route->control = buf;
 	}
 
 	return 0;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH AUTOSEL 6.9 09/40] ASoC: topology: Do not assign fields that are already set
       [not found] <20240709162007.30160-1-sashal@kernel.org>
                   ` (3 preceding siblings ...)
  2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 08/40] ASoC: Intel: avs: Fix route override Sasha Levin
@ 2024-07-09 16:18 ` Sasha Levin
  2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 10/40] ASoC: topology: Clean up route loading Sasha Levin
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Sasha Levin @ 2024-07-09 16:18 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Amadeusz Sławiński, Cezary Rojewski, Mark Brown,
	Sasha Levin, lgirdwood, perex, tiwai, linux-sound

From: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>

[ Upstream commit daf0b99d4720c9f05bdb81c73b2efdb43fa9def3 ]

The routes are allocated with kzalloc(), so all fields are zeroed by
default, skip unnecessary assignments.

Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20240603102818.36165-4-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/soc-topology.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index 7add1dbf1d214..ce22613bf9690 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -1072,11 +1072,7 @@ static int soc_tplg_dapm_graph_elems_load(struct soc_tplg *tplg,
 			break;
 		}
 
-		/* set to NULL atm for tplg users */
-		route->connected = NULL;
-		if (strnlen(elem->control, SNDRV_CTL_ELEM_ID_NAME_MAXLEN) == 0) {
-			route->control = NULL;
-		} else {
+		if (strnlen(elem->control, SNDRV_CTL_ELEM_ID_NAME_MAXLEN) != 0) {
 			route->control = devm_kmemdup(tplg->dev, elem->control,
 						      min(strlen(elem->control),
 							  SNDRV_CTL_ELEM_ID_NAME_MAXLEN),
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH AUTOSEL 6.9 10/40] ASoC: topology: Clean up route loading
       [not found] <20240709162007.30160-1-sashal@kernel.org>
                   ` (4 preceding siblings ...)
  2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 09/40] ASoC: topology: Do not assign fields that are already set Sasha Levin
@ 2024-07-09 16:18 ` Sasha Levin
  2024-07-09 16:34   ` Mark Brown
  2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 11/40] bytcr_rt5640 : inverse jack detect for Archos 101 cesium Sasha Levin
                   ` (11 subsequent siblings)
  17 siblings, 1 reply; 20+ messages in thread
From: Sasha Levin @ 2024-07-09 16:18 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Amadeusz Sławiński, Cezary Rojewski, Mark Brown,
	Sasha Levin, lgirdwood, perex, tiwai, linux-sound

From: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>

[ Upstream commit e0e7bc2cbee93778c4ad7d9a792d425ffb5af6f7 ]

Instead of using very long macro name, assign it to shorter variable
and use it instead. While doing that, we can reduce multiple if checks
using this define to one.

Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20240603102818.36165-5-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/soc-topology.c | 26 ++++++++------------------
 1 file changed, 8 insertions(+), 18 deletions(-)

diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index ce22613bf9690..52752e0a5dc27 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -1021,6 +1021,7 @@ static int soc_tplg_dapm_graph_elems_load(struct soc_tplg *tplg,
 	struct snd_soc_tplg_hdr *hdr)
 {
 	struct snd_soc_dapm_context *dapm = &tplg->comp->dapm;
+	const size_t maxlen = SNDRV_CTL_ELEM_ID_NAME_MAXLEN;
 	struct snd_soc_tplg_dapm_graph_elem *elem;
 	struct snd_soc_dapm_route *route;
 	int count, i;
@@ -1044,38 +1045,27 @@ static int soc_tplg_dapm_graph_elems_load(struct soc_tplg *tplg,
 		tplg->pos += sizeof(struct snd_soc_tplg_dapm_graph_elem);
 
 		/* validate routes */
-		if (strnlen(elem->source, SNDRV_CTL_ELEM_ID_NAME_MAXLEN) ==
-			    SNDRV_CTL_ELEM_ID_NAME_MAXLEN) {
-			ret = -EINVAL;
-			break;
-		}
-		if (strnlen(elem->sink, SNDRV_CTL_ELEM_ID_NAME_MAXLEN) ==
-			    SNDRV_CTL_ELEM_ID_NAME_MAXLEN) {
-			ret = -EINVAL;
-			break;
-		}
-		if (strnlen(elem->control, SNDRV_CTL_ELEM_ID_NAME_MAXLEN) ==
-			    SNDRV_CTL_ELEM_ID_NAME_MAXLEN) {
+		if ((strnlen(elem->source, maxlen) == maxlen) ||
+		    (strnlen(elem->sink, maxlen) == maxlen) ||
+		    (strnlen(elem->control, maxlen) == maxlen)) {
 			ret = -EINVAL;
 			break;
 		}
 
 		route->source = devm_kmemdup(tplg->dev, elem->source,
-					     min(strlen(elem->source),
-						 SNDRV_CTL_ELEM_ID_NAME_MAXLEN),
+					     min(strlen(elem->source), maxlen),
 					     GFP_KERNEL);
 		route->sink = devm_kmemdup(tplg->dev, elem->sink,
-					   min(strlen(elem->sink), SNDRV_CTL_ELEM_ID_NAME_MAXLEN),
+					   min(strlen(elem->sink), maxlen),
 					   GFP_KERNEL);
 		if (!route->source || !route->sink) {
 			ret = -ENOMEM;
 			break;
 		}
 
-		if (strnlen(elem->control, SNDRV_CTL_ELEM_ID_NAME_MAXLEN) != 0) {
+		if (strnlen(elem->control, maxlen) != 0) {
 			route->control = devm_kmemdup(tplg->dev, elem->control,
-						      min(strlen(elem->control),
-							  SNDRV_CTL_ELEM_ID_NAME_MAXLEN),
+						      min(strlen(elem->control), maxlen),
 						      GFP_KERNEL);
 			if (!route->control) {
 				ret = -ENOMEM;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH AUTOSEL 6.9 11/40] bytcr_rt5640 : inverse jack detect for Archos 101 cesium
       [not found] <20240709162007.30160-1-sashal@kernel.org>
                   ` (5 preceding siblings ...)
  2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 10/40] ASoC: topology: Clean up route loading Sasha Levin
@ 2024-07-09 16:18 ` Sasha Levin
  2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 12/40] ALSA: dmaengine: Synchronize dma channel after drop() Sasha Levin
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Sasha Levin @ 2024-07-09 16:18 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Thomas GENTY, Hans de Goede, Pierre-Louis Bossart, Mark Brown,
	Sasha Levin, cezary.rojewski, liam.r.girdwood, peter.ujfalusi,
	yung-chuan.liao, ranjani.sridharan, kai.vehmanen, perex, tiwai,
	kuninori.morimoto.gx, alban.boye, alsa-devel, linux-sound

From: Thomas GENTY <tomlohave@gmail.com>

[ Upstream commit e3209a1827646daaab744aa6a5767b1f57fb5385 ]

When headphones are plugged in, they appear absent; when they are removed,
they appear present.
Add a specific entry in bytcr_rt5640 for this device

Signed-off-by: Thomas GENTY <tomlohave@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20240608170251.99936-1-tomlohave@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/intel/boards/bytcr_rt5640.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c
index b41a1147f1c34..a64d1989e28a5 100644
--- a/sound/soc/intel/boards/bytcr_rt5640.c
+++ b/sound/soc/intel/boards/bytcr_rt5640.c
@@ -610,6 +610,17 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = {
 					BYT_RT5640_SSP0_AIF1 |
 					BYT_RT5640_MCLK_EN),
 	},
+	{
+		.matches = {
+			DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ARCHOS"),
+			DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "ARCHOS 101 CESIUM"),
+		},
+		.driver_data = (void *)(BYTCR_INPUT_DEFAULTS |
+					BYT_RT5640_JD_NOT_INV |
+					BYT_RT5640_DIFF_MIC |
+					BYT_RT5640_SSP0_AIF1 |
+					BYT_RT5640_MCLK_EN),
+	},
 	{
 		.matches = {
 			DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ARCHOS"),
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH AUTOSEL 6.9 12/40] ALSA: dmaengine: Synchronize dma channel after drop()
       [not found] <20240709162007.30160-1-sashal@kernel.org>
                   ` (6 preceding siblings ...)
  2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 11/40] bytcr_rt5640 : inverse jack detect for Archos 101 cesium Sasha Levin
@ 2024-07-09 16:18 ` Sasha Levin
  2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 13/40] ASoC: ti: davinci-mcasp: Set min period size using FIFO config Sasha Levin
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Sasha Levin @ 2024-07-09 16:18 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Jai Luthra, Peter Ujfalusi, Mark Brown, Sasha Levin, lars, perex,
	tiwai, lgirdwood, linux-sound

From: Jai Luthra <j-luthra@ti.com>

[ Upstream commit e8343410ddf08fc36a9b9cc7c51a4e53a262d4c6 ]

Sometimes the stream may be stopped due to XRUN events, in which case
the userspace can call snd_pcm_drop() and snd_pcm_prepare() to stop and
start the stream again.

In these cases, we must wait for the DMA channel to synchronize before
marking the stream as prepared for playback, as the DMA channel gets
stopped by drop() without any synchronization. Make sure the ALSA core
synchronizes the DMA channel by adding a sync_stop() hook.

Reviewed-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Signed-off-by: Jai Luthra <j-luthra@ti.com>
Link: https://lore.kernel.org/r/20240611-asoc_next-v3-1-fcfd84b12164@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 include/sound/dmaengine_pcm.h         |  1 +
 sound/core/pcm_dmaengine.c            | 10 ++++++++++
 sound/soc/soc-generic-dmaengine-pcm.c |  8 ++++++++
 3 files changed, 19 insertions(+)

diff --git a/include/sound/dmaengine_pcm.h b/include/sound/dmaengine_pcm.h
index d70c55f17df7c..94dbb23580f2f 100644
--- a/include/sound/dmaengine_pcm.h
+++ b/include/sound/dmaengine_pcm.h
@@ -36,6 +36,7 @@ snd_pcm_uframes_t snd_dmaengine_pcm_pointer_no_residue(struct snd_pcm_substream
 int snd_dmaengine_pcm_open(struct snd_pcm_substream *substream,
 	struct dma_chan *chan);
 int snd_dmaengine_pcm_close(struct snd_pcm_substream *substream);
+int snd_dmaengine_pcm_sync_stop(struct snd_pcm_substream *substream);
 
 int snd_dmaengine_pcm_open_request_chan(struct snd_pcm_substream *substream,
 	dma_filter_fn filter_fn, void *filter_data);
diff --git a/sound/core/pcm_dmaengine.c b/sound/core/pcm_dmaengine.c
index 494ec0c207fad..d142609570347 100644
--- a/sound/core/pcm_dmaengine.c
+++ b/sound/core/pcm_dmaengine.c
@@ -349,6 +349,16 @@ int snd_dmaengine_pcm_open_request_chan(struct snd_pcm_substream *substream,
 }
 EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_open_request_chan);
 
+int snd_dmaengine_pcm_sync_stop(struct snd_pcm_substream *substream)
+{
+	struct dmaengine_pcm_runtime_data *prtd = substream_to_prtd(substream);
+
+	dmaengine_synchronize(prtd->dma_chan);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_sync_stop);
+
 /**
  * snd_dmaengine_pcm_close - Close a dmaengine based PCM substream
  * @substream: PCM substream
diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c
index 092ca09f36319..7fa75b55c65e2 100644
--- a/sound/soc/soc-generic-dmaengine-pcm.c
+++ b/sound/soc/soc-generic-dmaengine-pcm.c
@@ -318,6 +318,12 @@ static int dmaengine_copy(struct snd_soc_component *component,
 	return 0;
 }
 
+static int dmaengine_pcm_sync_stop(struct snd_soc_component *component,
+				   struct snd_pcm_substream *substream)
+{
+	return snd_dmaengine_pcm_sync_stop(substream);
+}
+
 static const struct snd_soc_component_driver dmaengine_pcm_component = {
 	.name		= SND_DMAENGINE_PCM_DRV_NAME,
 	.probe_order	= SND_SOC_COMP_ORDER_LATE,
@@ -327,6 +333,7 @@ static const struct snd_soc_component_driver dmaengine_pcm_component = {
 	.trigger	= dmaengine_pcm_trigger,
 	.pointer	= dmaengine_pcm_pointer,
 	.pcm_construct	= dmaengine_pcm_new,
+	.sync_stop	= dmaengine_pcm_sync_stop,
 };
 
 static const struct snd_soc_component_driver dmaengine_pcm_component_process = {
@@ -339,6 +346,7 @@ static const struct snd_soc_component_driver dmaengine_pcm_component_process = {
 	.pointer	= dmaengine_pcm_pointer,
 	.copy		= dmaengine_copy,
 	.pcm_construct	= dmaengine_pcm_new,
+	.sync_stop	= dmaengine_pcm_sync_stop,
 };
 
 static const char * const dmaengine_pcm_dma_channel_names[] = {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH AUTOSEL 6.9 13/40] ASoC: ti: davinci-mcasp: Set min period size using FIFO config
       [not found] <20240709162007.30160-1-sashal@kernel.org>
                   ` (7 preceding siblings ...)
  2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 12/40] ALSA: dmaengine: Synchronize dma channel after drop() Sasha Levin
@ 2024-07-09 16:18 ` Sasha Levin
  2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 14/40] ASoC: ti: omap-hdmi: Fix too long driver name Sasha Levin
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Sasha Levin @ 2024-07-09 16:18 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Jai Luthra, Peter Ujfalusi, Mark Brown, Sasha Levin, lgirdwood,
	perex, tiwai, alsa-devel, linux-sound

From: Jai Luthra <j-luthra@ti.com>

[ Upstream commit c5dcf8ab10606e76c1d8a0ec77f27d84a392e874 ]

The minimum period size was enforced to 64 as older devices integrating
McASP with EDMA used an internal FIFO of 64 samples.

With UDMA based platforms this internal McASP FIFO is optional, as the
DMA engine internally does some buffering which is already accounted for
when registering the platform. So we should read the actual FIFO
configuration (txnumevt/rxnumevt) instead of hardcoding frames.min to
64.

Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Signed-off-by: Jai Luthra <j-luthra@ti.com>
Link: https://lore.kernel.org/r/20240611-asoc_next-v3-2-fcfd84b12164@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/ti/davinci-mcasp.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c
index 1e760c3155213..2b1ed91a736c9 100644
--- a/sound/soc/ti/davinci-mcasp.c
+++ b/sound/soc/ti/davinci-mcasp.c
@@ -1472,10 +1472,11 @@ static int davinci_mcasp_hw_rule_min_periodsize(
 {
 	struct snd_interval *period_size = hw_param_interval(params,
 						SNDRV_PCM_HW_PARAM_PERIOD_SIZE);
+	u8 numevt = *((u8 *)rule->private);
 	struct snd_interval frames;
 
 	snd_interval_any(&frames);
-	frames.min = 64;
+	frames.min = numevt;
 	frames.integer = 1;
 
 	return snd_interval_refine(period_size, &frames);
@@ -1490,6 +1491,7 @@ static int davinci_mcasp_startup(struct snd_pcm_substream *substream,
 	u32 max_channels = 0;
 	int i, dir, ret;
 	int tdm_slots = mcasp->tdm_slots;
+	u8 *numevt;
 
 	/* Do not allow more then one stream per direction */
 	if (mcasp->substreams[substream->stream])
@@ -1589,9 +1591,12 @@ static int davinci_mcasp_startup(struct snd_pcm_substream *substream,
 			return ret;
 	}
 
+	numevt = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
+			 &mcasp->txnumevt :
+			 &mcasp->rxnumevt;
 	snd_pcm_hw_rule_add(substream->runtime, 0,
 			    SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
-			    davinci_mcasp_hw_rule_min_periodsize, NULL,
+			    davinci_mcasp_hw_rule_min_periodsize, numevt,
 			    SNDRV_PCM_HW_PARAM_PERIOD_SIZE, -1);
 
 	return 0;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH AUTOSEL 6.9 14/40] ASoC: ti: omap-hdmi: Fix too long driver name
       [not found] <20240709162007.30160-1-sashal@kernel.org>
                   ` (8 preceding siblings ...)
  2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 13/40] ASoC: ti: davinci-mcasp: Set min period size using FIFO config Sasha Levin
@ 2024-07-09 16:18 ` Sasha Levin
  2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 15/40] ASoC: SOF: sof-audio: Skip unprepare for in-use widgets on error rollback Sasha Levin
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Sasha Levin @ 2024-07-09 16:18 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Primoz Fiser, Peter Ujfalusi, Mark Brown, Sasha Levin,
	jarkko.nikula, lgirdwood, perex, tiwai, alsa-devel, linux-omap,
	linux-sound

From: Primoz Fiser <primoz.fiser@norik.com>

[ Upstream commit 524d3f126362b6033e92cbe107ae2158d7fbff94 ]

Set driver name to "HDMI". This simplifies the code and gets rid of
the following error messages:

  ASoC: driver name too long 'HDMI 58040000.encoder' -> 'HDMI_58040000_e'

Signed-off-by: Primoz Fiser <primoz.fiser@norik.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://lore.kernel.org/r/20240610125847.773394-1-primoz.fiser@norik.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/ti/omap-hdmi.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/sound/soc/ti/omap-hdmi.c b/sound/soc/ti/omap-hdmi.c
index 4513b527ab970..ad8925b6481ca 100644
--- a/sound/soc/ti/omap-hdmi.c
+++ b/sound/soc/ti/omap-hdmi.c
@@ -354,11 +354,7 @@ static int omap_hdmi_audio_probe(struct platform_device *pdev)
 	if (!card)
 		return -ENOMEM;
 
-	card->name = devm_kasprintf(dev, GFP_KERNEL,
-				    "HDMI %s", dev_name(ad->dssdev));
-	if (!card->name)
-		return -ENOMEM;
-
+	card->name = "HDMI";
 	card->owner = THIS_MODULE;
 	card->dai_link =
 		devm_kzalloc(dev, sizeof(*(card->dai_link)), GFP_KERNEL);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH AUTOSEL 6.9 15/40] ASoC: SOF: sof-audio: Skip unprepare for in-use widgets on error rollback
       [not found] <20240709162007.30160-1-sashal@kernel.org>
                   ` (9 preceding siblings ...)
  2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 14/40] ASoC: ti: omap-hdmi: Fix too long driver name Sasha Levin
@ 2024-07-09 16:18 ` Sasha Levin
  2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 16/40] ASoC: rt722-sdca-sdw: add debounce time for type detection Sasha Levin
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Sasha Levin @ 2024-07-09 16:18 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Peter Ujfalusi, Pierre-Louis Bossart, Kai Vehmanen,
	Ranjani Sridharan, Mark Brown, Sasha Levin, lgirdwood,
	yung-chuan.liao, daniel.baluta, perex, tiwai, sound-open-firmware,
	linux-sound

From: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>

[ Upstream commit 6f2a43e3d14f6e31a3b041a1043195d02c54d615 ]

If the ipc_prepare() callback fails for a module instance, on error rewind
we must skip the ipc_unprepare() call for ones that has positive use count.

The positive use count means that the module instance is in active use, it
cannot be unprepared.

The issue affects capture direction paths with branches (single dai with
multiple PCMs), the affected widgets are in the shared part of the paths.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20240612121203.15468-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/sof/sof-audio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c
index e693dcb475e4d..d1a7d867f6a3a 100644
--- a/sound/soc/sof/sof-audio.c
+++ b/sound/soc/sof/sof-audio.c
@@ -485,7 +485,7 @@ sof_prepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget
 			if (ret < 0) {
 				/* unprepare the source widget */
 				if (widget_ops[widget->id].ipc_unprepare &&
-				    swidget && swidget->prepared) {
+				    swidget && swidget->prepared && swidget->use_count == 0) {
 					widget_ops[widget->id].ipc_unprepare(swidget);
 					swidget->prepared = false;
 				}
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH AUTOSEL 6.9 16/40] ASoC: rt722-sdca-sdw: add debounce time for type detection
       [not found] <20240709162007.30160-1-sashal@kernel.org>
                   ` (10 preceding siblings ...)
  2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 15/40] ASoC: SOF: sof-audio: Skip unprepare for in-use widgets on error rollback Sasha Levin
@ 2024-07-09 16:18 ` Sasha Levin
  2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 17/40] ASoC: topology: Fix route memory corruption Sasha Levin
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Sasha Levin @ 2024-07-09 16:18 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Jack Yu, Mark Brown, Sasha Levin, oder_chiou, lgirdwood, perex,
	tiwai, linux-sound

From: Jack Yu <jack.yu@realtek.com>

[ Upstream commit f3b198e4788fcc8d03ed0c8bd5e3856c6a5760c5 ]

Add debounce time in headset type detection for better performance.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/7e502e9a9dd94122a1b60deb5ceb60fb@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/codecs/rt722-sdca-sdw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/rt722-sdca-sdw.c b/sound/soc/codecs/rt722-sdca-sdw.c
index 0a14198f8a424..543a3fa1f5d3c 100644
--- a/sound/soc/codecs/rt722-sdca-sdw.c
+++ b/sound/soc/codecs/rt722-sdca-sdw.c
@@ -352,7 +352,7 @@ static int rt722_sdca_interrupt_callback(struct sdw_slave *slave,
 
 	if (status->sdca_cascade && !rt722->disable_irq)
 		mod_delayed_work(system_power_efficient_wq,
-			&rt722->jack_detect_work, msecs_to_jiffies(30));
+			&rt722->jack_detect_work, msecs_to_jiffies(280));
 
 	mutex_unlock(&rt722->disable_irq_lock);
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH AUTOSEL 6.9 17/40] ASoC: topology: Fix route memory corruption
       [not found] <20240709162007.30160-1-sashal@kernel.org>
                   ` (11 preceding siblings ...)
  2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 16/40] ASoC: rt722-sdca-sdw: add debounce time for type detection Sasha Levin
@ 2024-07-09 16:18 ` Sasha Levin
  2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 18/40] ASoC: cs35l56: Disconnect ASP1 TX sources when ASP1 DAI is hooked up Sasha Levin
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Sasha Levin @ 2024-07-09 16:18 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Amadeusz Sławiński, Pierre-Louis Bossart,
	Péter Ujfalusi, Mark Brown, Sasha Levin, lgirdwood, perex,
	tiwai, linux-sound

From: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>

[ Upstream commit 0298f51652be47b79780833e0b63194e1231fa34 ]

It was reported that recent fix for memory corruption during topology
load, causes corruption in other cases. Instead of being overeager with
checking topology, assume that it is properly formatted and just
duplicate strings.

Reported-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Closes: https://lore.kernel.org/linux-sound/171812236450.201359.3019210915105428447.b4-ty@kernel.org/T/#m8c4bd5abf453960fde6f826c4b7f84881da63e9d
Suggested-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20240613090126.841189-1-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/soc-topology.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index 52752e0a5dc27..27aba69894b17 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -1052,21 +1052,15 @@ static int soc_tplg_dapm_graph_elems_load(struct soc_tplg *tplg,
 			break;
 		}
 
-		route->source = devm_kmemdup(tplg->dev, elem->source,
-					     min(strlen(elem->source), maxlen),
-					     GFP_KERNEL);
-		route->sink = devm_kmemdup(tplg->dev, elem->sink,
-					   min(strlen(elem->sink), maxlen),
-					   GFP_KERNEL);
+		route->source = devm_kstrdup(tplg->dev, elem->source, GFP_KERNEL);
+		route->sink = devm_kstrdup(tplg->dev, elem->sink, GFP_KERNEL);
 		if (!route->source || !route->sink) {
 			ret = -ENOMEM;
 			break;
 		}
 
 		if (strnlen(elem->control, maxlen) != 0) {
-			route->control = devm_kmemdup(tplg->dev, elem->control,
-						      min(strlen(elem->control), maxlen),
-						      GFP_KERNEL);
+			route->control = devm_kstrdup(tplg->dev, elem->control, GFP_KERNEL);
 			if (!route->control) {
 				ret = -ENOMEM;
 				break;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH AUTOSEL 6.9 18/40] ASoC: cs35l56: Disconnect ASP1 TX sources when ASP1 DAI is hooked up
       [not found] <20240709162007.30160-1-sashal@kernel.org>
                   ` (12 preceding siblings ...)
  2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 17/40] ASoC: topology: Fix route memory corruption Sasha Levin
@ 2024-07-09 16:18 ` Sasha Levin
  2024-07-09 16:19 ` [PATCH AUTOSEL 6.9 34/40] ALSA: PCM: Allow resume only for suspended streams Sasha Levin
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Sasha Levin @ 2024-07-09 16:18 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Richard Fitzgerald, Mark Brown, Sasha Levin, david.rhodes,
	lgirdwood, perex, tiwai, alsa-devel, patches, linux-sound

From: Richard Fitzgerald <rf@opensource.cirrus.com>

[ Upstream commit 8af49868e51ed1ba117b74728af12abe1eda82e5 ]

If the ASP1 DAI is hooked up by the machine driver the ASP TX mixer
sources should be initialized to disconnected. There aren't currently
any available products using the ASP so this doesn't affect any
existing systems.

The cs35l56 does not have any fixed default for the mixer source
registers. When the cs35l56 boots, its firmware patches these registers
to setup a system-specific routing; this is so that Windows can use
generic SDCA drivers instead of needing knowledge of chip-specific
registers. The setup varies between end-products, which each have
customized firmware, and so the default register state varies between
end-products. It can also change if the firmware on an end-product is
upgraded - for example if a change was needed to the routing for Windows
use-cases. It must be emphasized that the settings applied by the
firmware are not internal magic tuning; they are statically implementing
use-case setup that on Linux would be done via ALSA controls.

The driver is currently syncing the mixer controls with whatever
initial state the firmware wrote to the registers, so that they report
the actual audio routing. But if the ASP DAI is hooked up this can create
a powered-up DAPM graph without anything intentionally setting up a path.
This can lead to parts of the audio system powering up unexpectedly.

For example when cs35l56 is connected to cs42l43 using a codec-codec link,
this can create a complete DAPM graph which then powers-up cs42l43. But
the cs42l43 can only be clocked from its SoundWire bus so this causes a
bunch of errors in the kernel log where cs42l43 is unexpectedly powered-up
without a clock.

If the host is taking ownership of the ASP (either directly or as a
codec-to-codec link) there is no need to keep the mixer settings that the
firmware wrote. The driver has ALSA controls for setting these using
standard Linux mechanisms. So if the machine driver hooks up the ASP the
ASP mixers are initialized to "None" (no input). This prevents unintended
DAPM-graph power-ups, and means the initial state of the mixers is
always going to be None.

Since the initial state of the mixers can vary from system to system and
potentially between firmware upgrades, no use-case manager can currently
assume that cs35l56 has a known initial state. The firmware could just as
easily default them to "None" as to any input source. So defaulting them
to "None" in the driver is not increasing the entropy of the system.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20240613132527.46537-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/codecs/cs35l56-shared.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sound/soc/codecs/cs35l56-shared.c b/sound/soc/codecs/cs35l56-shared.c
index fd02b621da52c..d29878af2a80d 100644
--- a/sound/soc/codecs/cs35l56-shared.c
+++ b/sound/soc/codecs/cs35l56-shared.c
@@ -214,6 +214,10 @@ static const struct reg_sequence cs35l56_asp1_defaults[] = {
 	REG_SEQ0(CS35L56_ASP1_FRAME_CONTROL5,	0x00020100),
 	REG_SEQ0(CS35L56_ASP1_DATA_CONTROL1,	0x00000018),
 	REG_SEQ0(CS35L56_ASP1_DATA_CONTROL5,	0x00000018),
+	REG_SEQ0(CS35L56_ASP1TX1_INPUT,		0x00000000),
+	REG_SEQ0(CS35L56_ASP1TX2_INPUT,		0x00000000),
+	REG_SEQ0(CS35L56_ASP1TX3_INPUT,		0x00000000),
+	REG_SEQ0(CS35L56_ASP1TX4_INPUT,		0x00000000),
 };
 
 /*
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH AUTOSEL 6.9 34/40] ALSA: PCM: Allow resume only for suspended streams
       [not found] <20240709162007.30160-1-sashal@kernel.org>
                   ` (13 preceding siblings ...)
  2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 18/40] ASoC: cs35l56: Disconnect ASP1 TX sources when ASP1 DAI is hooked up Sasha Levin
@ 2024-07-09 16:19 ` Sasha Levin
  2024-07-09 16:19 ` [PATCH AUTOSEL 6.9 35/40] ALSA: hda/relatek: Enable Mute LED on HP Laptop 15-gw0xxx Sasha Levin
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Sasha Levin @ 2024-07-09 16:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Takashi Iwai, Sasha Levin, perex, tiwai, broonie, pavel.hofman,
	dhowells, linux-sound

From: Takashi Iwai <tiwai@suse.de>

[ Upstream commit 1225675ca74c746f09211528588e83b3def1ff6a ]

snd_pcm_resume() should bail out if the stream isn't in a suspended
state.  Otherwise it'd allow doubly resume.

Link: https://patch.msgid.link/20240624125443.27808-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/core/pcm_native.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 0b76e76823d28..353ecd960a1f5 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -1775,6 +1775,8 @@ static int snd_pcm_pre_resume(struct snd_pcm_substream *substream,
 			      snd_pcm_state_t state)
 {
 	struct snd_pcm_runtime *runtime = substream->runtime;
+	if (runtime->state != SNDRV_PCM_STATE_SUSPENDED)
+		return -EBADFD;
 	if (!(runtime->info & SNDRV_PCM_INFO_RESUME))
 		return -ENOSYS;
 	runtime->trigger_master = substream;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH AUTOSEL 6.9 35/40] ALSA: hda/relatek: Enable Mute LED on HP Laptop 15-gw0xxx
       [not found] <20240709162007.30160-1-sashal@kernel.org>
                   ` (14 preceding siblings ...)
  2024-07-09 16:19 ` [PATCH AUTOSEL 6.9 34/40] ALSA: PCM: Allow resume only for suspended streams Sasha Levin
@ 2024-07-09 16:19 ` Sasha Levin
  2024-07-09 16:19 ` [PATCH AUTOSEL 6.9 36/40] ALSA: dmaengine_pcm: terminate dmaengine before synchronize Sasha Levin
  2024-07-09 16:19 ` [PATCH AUTOSEL 6.9 39/40] ASoC: amd: yc: Fix non-functional mic on ASUS M5602RA Sasha Levin
  17 siblings, 0 replies; 20+ messages in thread
From: Sasha Levin @ 2024-07-09 16:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Aivaz Latypov, Takashi Iwai, Sasha Levin, perex, tiwai, kailang,
	sbinding, shenghao-ding, simont, foss, rf, linux-sound

From: Aivaz Latypov <reichaivaz@gmail.com>

[ Upstream commit 1d091a98c399c17d0571fa1d91a7123a698446e4 ]

This HP Laptop uses ALC236 codec with COEF 0x07 controlling
the mute LED. Enable existing quirk for this device.

Signed-off-by: Aivaz Latypov <reichaivaz@gmail.com>
Link: https://patch.msgid.link/20240625081217.1049-1-reichaivaz@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/pci/hda/patch_realtek.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 3e6de1d86022f..b3f429990e554 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -10034,6 +10034,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
 	SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
 	SND_PCI_QUIRK(0x103c, 0x87b7, "HP Laptop 14-fq0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
 	SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
+	SND_PCI_QUIRK(0x103c, 0x87d3, "HP Laptop 15-gw0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
 	SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
 	SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
 	SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH AUTOSEL 6.9 36/40] ALSA: dmaengine_pcm: terminate dmaengine before synchronize
       [not found] <20240709162007.30160-1-sashal@kernel.org>
                   ` (15 preceding siblings ...)
  2024-07-09 16:19 ` [PATCH AUTOSEL 6.9 35/40] ALSA: hda/relatek: Enable Mute LED on HP Laptop 15-gw0xxx Sasha Levin
@ 2024-07-09 16:19 ` Sasha Levin
  2024-07-09 16:19 ` [PATCH AUTOSEL 6.9 39/40] ASoC: amd: yc: Fix non-functional mic on ASUS M5602RA Sasha Levin
  17 siblings, 0 replies; 20+ messages in thread
From: Sasha Levin @ 2024-07-09 16:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Shengjiu Wang, Takashi Iwai, Sasha Levin, lars, perex, tiwai,
	linux-sound

From: Shengjiu Wang <shengjiu.wang@nxp.com>

[ Upstream commit 6a7db25aad8ce6512b366d2ce1d0e60bac00a09d ]

When dmaengine supports pause function, in suspend state,
dmaengine_pause() is called instead of dmaengine_terminate_async(),

In end of playback stream, the runtime->state will go to
SNDRV_PCM_STATE_DRAINING, if system suspend & resume happen
at this time, application will not resume playback stream, the
stream will be closed directly, the dmaengine_terminate_async()
will not be called before the dmaengine_synchronize(), which
violates the call sequence for dmaengine_synchronize().

This behavior also happens for capture streams, but there is no
SNDRV_PCM_STATE_DRAINING state for capture. So use
dmaengine_tx_status() to check the DMA status if the status is
DMA_PAUSED, then call dmaengine_terminate_async() to terminate
dmaengine before dmaengine_synchronize().

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://patch.msgid.link/1718851218-27803-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/core/pcm_dmaengine.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/sound/core/pcm_dmaengine.c b/sound/core/pcm_dmaengine.c
index d142609570347..e299e8634751f 100644
--- a/sound/core/pcm_dmaengine.c
+++ b/sound/core/pcm_dmaengine.c
@@ -368,6 +368,12 @@ EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_sync_stop);
 int snd_dmaengine_pcm_close(struct snd_pcm_substream *substream)
 {
 	struct dmaengine_pcm_runtime_data *prtd = substream_to_prtd(substream);
+	struct dma_tx_state state;
+	enum dma_status status;
+
+	status = dmaengine_tx_status(prtd->dma_chan, prtd->cookie, &state);
+	if (status == DMA_PAUSED)
+		dmaengine_terminate_async(prtd->dma_chan);
 
 	dmaengine_synchronize(prtd->dma_chan);
 	kfree(prtd);
@@ -388,6 +394,12 @@ EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_close);
 int snd_dmaengine_pcm_close_release_chan(struct snd_pcm_substream *substream)
 {
 	struct dmaengine_pcm_runtime_data *prtd = substream_to_prtd(substream);
+	struct dma_tx_state state;
+	enum dma_status status;
+
+	status = dmaengine_tx_status(prtd->dma_chan, prtd->cookie, &state);
+	if (status == DMA_PAUSED)
+		dmaengine_terminate_async(prtd->dma_chan);
 
 	dmaengine_synchronize(prtd->dma_chan);
 	dma_release_channel(prtd->dma_chan);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH AUTOSEL 6.9 39/40] ASoC: amd: yc: Fix non-functional mic on ASUS M5602RA
       [not found] <20240709162007.30160-1-sashal@kernel.org>
                   ` (16 preceding siblings ...)
  2024-07-09 16:19 ` [PATCH AUTOSEL 6.9 36/40] ALSA: dmaengine_pcm: terminate dmaengine before synchronize Sasha Levin
@ 2024-07-09 16:19 ` Sasha Levin
  17 siblings, 0 replies; 20+ messages in thread
From: Sasha Levin @ 2024-07-09 16:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Vyacheslav Frantsishko, Mario Limonciello, Mark Brown,
	Sasha Levin, lgirdwood, perex, tiwai, me, end.to.start, git,
	linux-sound

From: Vyacheslav Frantsishko <itmymaill@gmail.com>

[ Upstream commit 63b47f026cc841bd3d3438dd6fccbc394dfead87 ]

The Vivobook S 16X IPS needs a quirks-table entry for the internal microphone to function properly.

Signed-off-by: Vyacheslav Frantsishko <itmymaill@gmail.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://patch.msgid.link/20240626070334.45633-1-itmymaill@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/amd/yc/acp6x-mach.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sound/soc/amd/yc/acp6x-mach.c b/sound/soc/amd/yc/acp6x-mach.c
index 1760b5d42460a..4e3a8ce690a45 100644
--- a/sound/soc/amd/yc/acp6x-mach.c
+++ b/sound/soc/amd/yc/acp6x-mach.c
@@ -283,6 +283,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "M5402RA"),
 		}
 	},
+        {
+		.driver_data = &acp6x_card,
+		.matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK COMPUTER INC."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "M5602RA"),
+		}
+	},
 	{
 		.driver_data = &acp6x_card,
 		.matches = {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH AUTOSEL 6.9 10/40] ASoC: topology: Clean up route loading
  2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 10/40] ASoC: topology: Clean up route loading Sasha Levin
@ 2024-07-09 16:34   ` Mark Brown
  2024-07-22 12:49     ` Sasha Levin
  0 siblings, 1 reply; 20+ messages in thread
From: Mark Brown @ 2024-07-09 16:34 UTC (permalink / raw)
  To: Sasha Levin
  Cc: linux-kernel, stable, Amadeusz Sławiński,
	Cezary Rojewski, lgirdwood, perex, tiwai, linux-sound

[-- Attachment #1: Type: text/plain, Size: 831 bytes --]

On Tue, Jul 09, 2024 at 12:18:50PM -0400, Sasha Levin wrote:
> From: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
> 
> [ Upstream commit e0e7bc2cbee93778c4ad7d9a792d425ffb5af6f7 ]
> 
> Instead of using very long macro name, assign it to shorter variable
> and use it instead. While doing that, we can reduce multiple if checks
> using this define to one.
> 
> Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
> Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
> Link: https://lore.kernel.org/r/20240603102818.36165-5-amadeuszx.slawinski@linux.intel.com
> Signed-off-by: Mark Brown <broonie@kernel.org>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---

This is clearly a code cleanup, there is nothing here that looks in the
slightest bit like stable material.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH AUTOSEL 6.9 10/40] ASoC: topology: Clean up route loading
  2024-07-09 16:34   ` Mark Brown
@ 2024-07-22 12:49     ` Sasha Levin
  0 siblings, 0 replies; 20+ messages in thread
From: Sasha Levin @ 2024-07-22 12:49 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-kernel, stable, Amadeusz Sławiński,
	Cezary Rojewski, lgirdwood, perex, tiwai, linux-sound

On Tue, Jul 09, 2024 at 05:34:51PM +0100, Mark Brown wrote:
>On Tue, Jul 09, 2024 at 12:18:50PM -0400, Sasha Levin wrote:
>> From: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
>>
>> [ Upstream commit e0e7bc2cbee93778c4ad7d9a792d425ffb5af6f7 ]
>>
>> Instead of using very long macro name, assign it to shorter variable
>> and use it instead. While doing that, we can reduce multiple if checks
>> using this define to one.
>>
>> Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
>> Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
>> Link: https://lore.kernel.org/r/20240603102818.36165-5-amadeuszx.slawinski@linux.intel.com
>> Signed-off-by: Mark Brown <broonie@kernel.org>
>> Signed-off-by: Sasha Levin <sashal@kernel.org>
>> ---
>
>This is clearly a code cleanup, there is nothing here that looks in the
>slightest bit like stable material.

Dropped, thanks!

-- 
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2024-07-22 12:49 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20240709162007.30160-1-sashal@kernel.org>
2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 04/40] ASoC: rt722-sdca-sdw: add silence detection register as volatile Sasha Levin
2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 05/40] ASoC: codecs: ES8326: Solve headphone detection issue Sasha Levin
2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 07/40] ASoC: topology: Fix references to freed memory Sasha Levin
2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 08/40] ASoC: Intel: avs: Fix route override Sasha Levin
2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 09/40] ASoC: topology: Do not assign fields that are already set Sasha Levin
2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 10/40] ASoC: topology: Clean up route loading Sasha Levin
2024-07-09 16:34   ` Mark Brown
2024-07-22 12:49     ` Sasha Levin
2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 11/40] bytcr_rt5640 : inverse jack detect for Archos 101 cesium Sasha Levin
2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 12/40] ALSA: dmaengine: Synchronize dma channel after drop() Sasha Levin
2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 13/40] ASoC: ti: davinci-mcasp: Set min period size using FIFO config Sasha Levin
2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 14/40] ASoC: ti: omap-hdmi: Fix too long driver name Sasha Levin
2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 15/40] ASoC: SOF: sof-audio: Skip unprepare for in-use widgets on error rollback Sasha Levin
2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 16/40] ASoC: rt722-sdca-sdw: add debounce time for type detection Sasha Levin
2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 17/40] ASoC: topology: Fix route memory corruption Sasha Levin
2024-07-09 16:18 ` [PATCH AUTOSEL 6.9 18/40] ASoC: cs35l56: Disconnect ASP1 TX sources when ASP1 DAI is hooked up Sasha Levin
2024-07-09 16:19 ` [PATCH AUTOSEL 6.9 34/40] ALSA: PCM: Allow resume only for suspended streams Sasha Levin
2024-07-09 16:19 ` [PATCH AUTOSEL 6.9 35/40] ALSA: hda/relatek: Enable Mute LED on HP Laptop 15-gw0xxx Sasha Levin
2024-07-09 16:19 ` [PATCH AUTOSEL 6.9 36/40] ALSA: dmaengine_pcm: terminate dmaengine before synchronize Sasha Levin
2024-07-09 16:19 ` [PATCH AUTOSEL 6.9 39/40] ASoC: amd: yc: Fix non-functional mic on ASUS M5602RA Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).