alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [alsa-devel] [PATCH AUTOSEL 5.4 001/187] ASoC: rt5682: fix i2c arbitration lost issue
@ 2019-12-27 17:37 Sasha Levin
  2019-12-27 17:37 ` [alsa-devel] [PATCH AUTOSEL 5.4 005/187] ASoC: max98090: remove msleep in PLL unlocked workaround Sasha Levin
                   ` (8 more replies)
  0 siblings, 9 replies; 13+ messages in thread
From: Sasha Levin @ 2019-12-27 17:37 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Shuming Fan, Sasha Levin, alsa-devel, Mark Brown

From: Shuming Fan <shumingf@realtek.com>

[ Upstream commit bc094709de0192a756c6946a7c89c543243ae609 ]

This patch modified the HW initial setting to fix i2c arbitration lost issue.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20191125091940.11953-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/codecs/rt5682.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c
index c50b75ce82e0..05e883a65d7a 100644
--- a/sound/soc/codecs/rt5682.c
+++ b/sound/soc/codecs/rt5682.c
@@ -72,6 +72,7 @@ struct rt5682_priv {
 static const struct reg_sequence patch_list[] = {
 	{RT5682_HP_IMP_SENS_CTRL_19, 0x1000},
 	{RT5682_DAC_ADC_DIG_VOL1, 0xa020},
+	{RT5682_I2C_CTRL, 0x000f},
 };
 
 static const struct reg_default rt5682_reg[] = {
@@ -2481,6 +2482,7 @@ static void rt5682_calibrate(struct rt5682_priv *rt5682)
 	mutex_lock(&rt5682->calibrate_mutex);
 
 	rt5682_reset(rt5682->regmap);
+	regmap_write(rt5682->regmap, RT5682_I2C_CTRL, 0x000f);
 	regmap_write(rt5682->regmap, RT5682_PWR_ANLG_1, 0xa2af);
 	usleep_range(15000, 20000);
 	regmap_write(rt5682->regmap, RT5682_PWR_ANLG_1, 0xf2af);
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH AUTOSEL 5.4 005/187] ASoC: max98090: remove msleep in PLL unlocked workaround
  2019-12-27 17:37 [alsa-devel] [PATCH AUTOSEL 5.4 001/187] ASoC: rt5682: fix i2c arbitration lost issue Sasha Levin
@ 2019-12-27 17:37 ` Sasha Levin
  2019-12-27 22:43   ` Mark Brown
  2019-12-27 17:37 ` [alsa-devel] [PATCH AUTOSEL 5.4 006/187] ASoC: max98090: exit workaround earlier if PLL is locked Sasha Levin
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 13+ messages in thread
From: Sasha Levin @ 2019-12-27 17:37 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Sasha Levin, Tzung-Bi Shih, alsa-devel, Mark Brown, Pierre-Louis Bossart

From: Tzung-Bi Shih <tzungbi@google.com>

[ Upstream commit acb874a7c049ec49d8fc66c893170fb42c01bdf7 ]

It was observed Baytrail-based chromebooks could cause continuous PLL
unlocked when using playback stream and capture stream simultaneously.
Specifically, starting a capture stream after started a playback stream.
As a result, the audio data could corrupt or turn completely silent.

As the datasheet suggested, the maximum PLL lock time should be 7 msec.
The workaround resets the codec softly by toggling SHDN off and on if
PLL failed to lock for 10 msec.  Notably, there is no suggested hold
time for SHDN off.

On Baytrail-based chromebooks, it would easily happen continuous PLL
unlocked if there is a 10 msec delay between SHDN off and on.  Removes
the msleep().

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20191122073114.219945-2-tzungbi@google.com
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/codecs/max98090.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index f6bf4cfbea23..12cb87c0d463 100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -2114,10 +2114,16 @@ static void max98090_pll_work(struct work_struct *work)
 
 	dev_info_ratelimited(component->dev, "PLL unlocked\n");
 
+	/*
+	 * As the datasheet suggested, the maximum PLL lock time should be
+	 * 7 msec.  The workaround resets the codec softly by toggling SHDN
+	 * off and on if PLL failed to lock for 10 msec.  Notably, there is
+	 * no suggested hold time for SHDN off.
+	 */
+
 	/* Toggle shutdown OFF then ON */
 	snd_soc_component_update_bits(component, M98090_REG_DEVICE_SHUTDOWN,
 			    M98090_SHDNN_MASK, 0);
-	msleep(10);
 	snd_soc_component_update_bits(component, M98090_REG_DEVICE_SHUTDOWN,
 			    M98090_SHDNN_MASK, M98090_SHDNN_MASK);
 
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH AUTOSEL 5.4 006/187] ASoC: max98090: exit workaround earlier if PLL is locked
  2019-12-27 17:37 [alsa-devel] [PATCH AUTOSEL 5.4 001/187] ASoC: rt5682: fix i2c arbitration lost issue Sasha Levin
  2019-12-27 17:37 ` [alsa-devel] [PATCH AUTOSEL 5.4 005/187] ASoC: max98090: remove msleep in PLL unlocked workaround Sasha Levin
@ 2019-12-27 17:37 ` Sasha Levin
  2019-12-27 22:44   ` Mark Brown
  2019-12-27 17:37 ` [alsa-devel] [PATCH AUTOSEL 5.4 007/187] ASoC: max98090: fix possible race conditions Sasha Levin
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 13+ messages in thread
From: Sasha Levin @ 2019-12-27 17:37 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Sasha Levin, Tzung-Bi Shih, alsa-devel, Mark Brown, Pierre-Louis Bossart

From: Tzung-Bi Shih <tzungbi@google.com>

[ Upstream commit 6f49919d11690a9b5614445ba30fde18083fdd63 ]

According to the datasheet, PLL lock time typically takes 2 msec and
at most takes 7 msec.

Check the lock status every 1 msec and exit the workaround if PLL is
locked.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20191122073114.219945-3-tzungbi@google.com
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/codecs/max98090.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index 12cb87c0d463..f531e5a11bdd 100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -2108,6 +2108,8 @@ static void max98090_pll_work(struct work_struct *work)
 	struct max98090_priv *max98090 =
 		container_of(work, struct max98090_priv, pll_work);
 	struct snd_soc_component *component = max98090->component;
+	unsigned int pll;
+	int i;
 
 	if (!snd_soc_component_is_active(component))
 		return;
@@ -2127,8 +2129,16 @@ static void max98090_pll_work(struct work_struct *work)
 	snd_soc_component_update_bits(component, M98090_REG_DEVICE_SHUTDOWN,
 			    M98090_SHDNN_MASK, M98090_SHDNN_MASK);
 
-	/* Give PLL time to lock */
-	msleep(10);
+	for (i = 0; i < 10; ++i) {
+		/* Give PLL time to lock */
+		usleep_range(1000, 1200);
+
+		/* Check lock status */
+		pll = snd_soc_component_read32(
+				component, M98090_REG_DEVICE_STATUS);
+		if (!(pll & M98090_ULK_MASK))
+			break;
+	}
 }
 
 static void max98090_jack_work(struct work_struct *work)
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH AUTOSEL 5.4 007/187] ASoC: max98090: fix possible race conditions
  2019-12-27 17:37 [alsa-devel] [PATCH AUTOSEL 5.4 001/187] ASoC: rt5682: fix i2c arbitration lost issue Sasha Levin
  2019-12-27 17:37 ` [alsa-devel] [PATCH AUTOSEL 5.4 005/187] ASoC: max98090: remove msleep in PLL unlocked workaround Sasha Levin
  2019-12-27 17:37 ` [alsa-devel] [PATCH AUTOSEL 5.4 006/187] ASoC: max98090: exit workaround earlier if PLL is locked Sasha Levin
@ 2019-12-27 17:37 ` Sasha Levin
  2019-12-27 17:38 ` [alsa-devel] [PATCH AUTOSEL 5.4 023/187] ASoC: Intel: bytcr_rt5640: Update quirk for Teclast X89 Sasha Levin
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2019-12-27 17:37 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Sasha Levin, Tzung-Bi Shih, alsa-devel, Mark Brown, Pierre-Louis Bossart

From: Tzung-Bi Shih <tzungbi@google.com>

[ Upstream commit 45dfbf56975994822cce00b7475732a49f8aefed ]

max98090_interrupt() and max98090_pll_work() run in 2 different threads.
There are 2 possible races:

Note: M98090_REG_DEVICE_STATUS = 0x01.
Note: ULK == 0, PLL is locked; ULK == 1, PLL is unlocked.

max98090_interrupt      max98090_pll_work
----------------------------------------------
schedule max98090_pll_work
                        restart max98090 codec
receive ULK INT
                        assert ULK == 0
schedule max98090_pll_work (1).

In the case (1), the PLL is locked but max98090_interrupt unnecessarily
schedules another max98090_pll_work.

max98090_interrupt      max98090_pll_work      max98090 codec
----------------------------------------------------------------------
                                               ULK = 1
receive ULK INT
read 0x01
                                               ULK = 0 (clear on read)
schedule max98090_pll_work
                        restart max98090 codec
                                               ULK = 1
receive ULK INT
read 0x01
                                               ULK = 0 (clear on read)
                        read 0x01
                        assert ULK == 0 (2).

In the case (2), both max98090_interrupt and max98090_pll_work read
the same clear-on-read register.  max98090_pll_work would falsely
thought PLL is locked.
Note: the case (2) race is introduced by the previous commit ("ASoC:
max98090: exit workaround earlier if PLL is locked") to check the status
and exit the loop earlier in max98090_pll_work.

There are 2 possible solution options:
A. turn off ULK interrupt before scheduling max98090_pll_work; and turn
on again before exiting max98090_pll_work.
B. remove the second thread of execution.

Option A cannot fix the case (2) race because it still has 2 threads
access the same clear-on-read register simultaneously.  Although we
could suppose the register is volatile and read the status via I2C could
be much slower than the hardware raises the bits.

Option B introduces a maximum 10~12 msec penalty delay in the interrupt
handler.  However, it could only punish the jack detection by extra
10~12 msec.

Adopts option B which is the better solution overall.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20191122073114.219945-4-tzungbi@google.com
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/codecs/max98090.c | 8 ++------
 sound/soc/codecs/max98090.h | 1 -
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index f531e5a11bdd..e46b6ada13b1 100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -2103,10 +2103,8 @@ static void max98090_pll_det_disable_work(struct work_struct *work)
 			    M98090_IULK_MASK, 0);
 }
 
-static void max98090_pll_work(struct work_struct *work)
+static void max98090_pll_work(struct max98090_priv *max98090)
 {
-	struct max98090_priv *max98090 =
-		container_of(work, struct max98090_priv, pll_work);
 	struct snd_soc_component *component = max98090->component;
 	unsigned int pll;
 	int i;
@@ -2275,7 +2273,7 @@ static irqreturn_t max98090_interrupt(int irq, void *data)
 
 	if (active & M98090_ULK_MASK) {
 		dev_dbg(component->dev, "M98090_ULK_MASK\n");
-		schedule_work(&max98090->pll_work);
+		max98090_pll_work(max98090);
 	}
 
 	if (active & M98090_JDET_MASK) {
@@ -2438,7 +2436,6 @@ static int max98090_probe(struct snd_soc_component *component)
 			  max98090_pll_det_enable_work);
 	INIT_WORK(&max98090->pll_det_disable_work,
 		  max98090_pll_det_disable_work);
-	INIT_WORK(&max98090->pll_work, max98090_pll_work);
 
 	/* Enable jack detection */
 	snd_soc_component_write(component, M98090_REG_JACK_DETECT,
@@ -2491,7 +2488,6 @@ static void max98090_remove(struct snd_soc_component *component)
 	cancel_delayed_work_sync(&max98090->jack_work);
 	cancel_delayed_work_sync(&max98090->pll_det_enable_work);
 	cancel_work_sync(&max98090->pll_det_disable_work);
-	cancel_work_sync(&max98090->pll_work);
 	max98090->component = NULL;
 }
 
diff --git a/sound/soc/codecs/max98090.h b/sound/soc/codecs/max98090.h
index 57965cd678b4..a197114b0dad 100644
--- a/sound/soc/codecs/max98090.h
+++ b/sound/soc/codecs/max98090.h
@@ -1530,7 +1530,6 @@ struct max98090_priv {
 	struct delayed_work jack_work;
 	struct delayed_work pll_det_enable_work;
 	struct work_struct pll_det_disable_work;
-	struct work_struct pll_work;
 	struct snd_soc_jack *jack;
 	unsigned int dai_fmt;
 	int tdm_slots;
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH AUTOSEL 5.4 023/187] ASoC: Intel: bytcr_rt5640: Update quirk for Teclast X89
  2019-12-27 17:37 [alsa-devel] [PATCH AUTOSEL 5.4 001/187] ASoC: rt5682: fix i2c arbitration lost issue Sasha Levin
                   ` (2 preceding siblings ...)
  2019-12-27 17:37 ` [alsa-devel] [PATCH AUTOSEL 5.4 007/187] ASoC: max98090: fix possible race conditions Sasha Levin
@ 2019-12-27 17:38 ` Sasha Levin
  2019-12-27 17:38 ` [alsa-devel] [PATCH AUTOSEL 5.4 060/187] ASoC: topology: Check return value for snd_soc_add_dai_link() Sasha Levin
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2019-12-27 17:38 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Sasha Levin, Hans de Goede, alsa-devel, Mark Brown, Pierre-Louis Bossart

From: Hans de Goede <hdegoede@redhat.com>

[ Upstream commit 7eccc05c7101f34cc36afe9405d15de6d4099fb4 ]

When the Teclast X89 quirk was added we did not have jack-detection
support yet.

Note the over-current detection limit is set to 2mA instead of the usual
1.5mA because this tablet tends to give false-positive button-presses
when it is set to 1.5mA.

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

diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c
index 9c1aa4ec9cba..cb511ea3b771 100644
--- a/sound/soc/intel/boards/bytcr_rt5640.c
+++ b/sound/soc/intel/boards/bytcr_rt5640.c
@@ -705,13 +705,17 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = {
 					BYT_RT5640_MCLK_EN),
 	},
 	{
+		/* Teclast X89 */
 		.matches = {
 			DMI_MATCH(DMI_BOARD_VENDOR, "TECLAST"),
 			DMI_MATCH(DMI_BOARD_NAME, "tPAD"),
 		},
 		.driver_data = (void *)(BYT_RT5640_IN3_MAP |
-					BYT_RT5640_MCLK_EN |
-					BYT_RT5640_SSP0_AIF1),
+					BYT_RT5640_JD_SRC_JD1_IN4P |
+					BYT_RT5640_OVCD_TH_2000UA |
+					BYT_RT5640_OVCD_SF_1P0 |
+					BYT_RT5640_SSP0_AIF1 |
+					BYT_RT5640_MCLK_EN),
 	},
 	{	/* Toshiba Satellite Click Mini L9W-B */
 		.matches = {
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH AUTOSEL 5.4 060/187] ASoC: topology: Check return value for snd_soc_add_dai_link()
  2019-12-27 17:37 [alsa-devel] [PATCH AUTOSEL 5.4 001/187] ASoC: rt5682: fix i2c arbitration lost issue Sasha Levin
                   ` (3 preceding siblings ...)
  2019-12-27 17:38 ` [alsa-devel] [PATCH AUTOSEL 5.4 023/187] ASoC: Intel: bytcr_rt5640: Update quirk for Teclast X89 Sasha Levin
@ 2019-12-27 17:38 ` Sasha Levin
  2019-12-27 17:38 ` [alsa-devel] [PATCH AUTOSEL 5.4 061/187] ASoC: topology: Check return value for soc_tplg_pcm_create() Sasha Levin
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2019-12-27 17:38 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Dragos Tarcatu, Sasha Levin, alsa-devel, Ranjani Sridharan,
	Pierre-Louis Bossart, Mark Brown

From: Dragos Tarcatu <dragos_tarcatu@mentor.com>

[ Upstream commit 76d2703649321c296df7ec0dafd50add96215de4 ]

snd_soc_add_dai_link() might fail. This situation occurs for
instance in a very specific use case where a PCM device and a
Back End DAI link are given identical names in the topology.
When this happens, soc_new_pcm_runtime() fails and then
snd_soc_add_dai_link() returns -ENOMEM when called from
soc_tplg_fe_link_create(). Because of that, the link will not
get added into the card list, so any attempt to remove it later
ends up in a panic.

Fix that by checking the return status and free the memory in case
of an error.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Dragos Tarcatu <dragos_tarcatu@mentor.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191210003939.15752-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/soc-topology.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index 0fd032914a31..c92e360d27b8 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -1918,11 +1918,13 @@ static int soc_tplg_fe_link_create(struct soc_tplg *tplg,
 	ret = soc_tplg_dai_link_load(tplg, link, NULL);
 	if (ret < 0) {
 		dev_err(tplg->comp->dev, "ASoC: FE link loading failed\n");
-		kfree(link->name);
-		kfree(link->stream_name);
-		kfree(link->cpus->dai_name);
-		kfree(link);
-		return ret;
+		goto err;
+	}
+
+	ret = snd_soc_add_dai_link(tplg->comp->card, link);
+	if (ret < 0) {
+		dev_err(tplg->comp->dev, "ASoC: adding FE link failed\n");
+		goto err;
 	}
 
 	link->dobj.index = tplg->index;
@@ -1930,8 +1932,13 @@ static int soc_tplg_fe_link_create(struct soc_tplg *tplg,
 	link->dobj.type = SND_SOC_DOBJ_DAI_LINK;
 	list_add(&link->dobj.list, &tplg->comp->dobj_list);
 
-	snd_soc_add_dai_link(tplg->comp->card, link);
 	return 0;
+err:
+	kfree(link->name);
+	kfree(link->stream_name);
+	kfree(link->cpus->dai_name);
+	kfree(link);
+	return ret;
 }
 
 /* create a FE DAI and DAI link from the PCM object */
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH AUTOSEL 5.4 061/187] ASoC: topology: Check return value for soc_tplg_pcm_create()
  2019-12-27 17:37 [alsa-devel] [PATCH AUTOSEL 5.4 001/187] ASoC: rt5682: fix i2c arbitration lost issue Sasha Levin
                   ` (4 preceding siblings ...)
  2019-12-27 17:38 ` [alsa-devel] [PATCH AUTOSEL 5.4 060/187] ASoC: topology: Check return value for snd_soc_add_dai_link() Sasha Levin
@ 2019-12-27 17:38 ` Sasha Levin
  2019-12-27 17:38 ` [alsa-devel] [PATCH AUTOSEL 5.4 062/187] ASoC: SOF: loader: snd_sof_fw_parse_ext_data log warning on unknown header Sasha Levin
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2019-12-27 17:38 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Dragos Tarcatu, Sasha Levin, alsa-devel, Ranjani Sridharan,
	Pierre-Louis Bossart, Mark Brown

From: Dragos Tarcatu <dragos_tarcatu@mentor.com>

[ Upstream commit a3039aef52d9ffeb67e9211899cd3e8a2953a01f ]

The return value of soc_tplg_pcm_create() is currently not checked
in soc_tplg_pcm_elems_load(). If an error is to occur there, the
topology ignores it and continues loading.

Fix that by checking the status and rejecting the topology on error.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Dragos Tarcatu <dragos_tarcatu@mentor.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191210003939.15752-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/soc-topology.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index c92e360d27b8..fd2d22ddc81b 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -2031,6 +2031,7 @@ static int soc_tplg_pcm_elems_load(struct soc_tplg *tplg,
 	int size;
 	int i;
 	bool abi_match;
+	int ret;
 
 	count = le32_to_cpu(hdr->count);
 
@@ -2072,7 +2073,12 @@ static int soc_tplg_pcm_elems_load(struct soc_tplg *tplg,
 		}
 
 		/* create the FE DAIs and DAI links */
-		soc_tplg_pcm_create(tplg, _pcm);
+		ret = soc_tplg_pcm_create(tplg, _pcm);
+		if (ret < 0) {
+			if (!abi_match)
+				kfree(_pcm);
+			return ret;
+		}
 
 		/* offset by version-specific struct size and
 		 * real priv data size
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH AUTOSEL 5.4 062/187] ASoC: SOF: loader: snd_sof_fw_parse_ext_data log warning on unknown header
  2019-12-27 17:37 [alsa-devel] [PATCH AUTOSEL 5.4 001/187] ASoC: rt5682: fix i2c arbitration lost issue Sasha Levin
                   ` (5 preceding siblings ...)
  2019-12-27 17:38 ` [alsa-devel] [PATCH AUTOSEL 5.4 061/187] ASoC: topology: Check return value for soc_tplg_pcm_create() Sasha Levin
@ 2019-12-27 17:38 ` Sasha Levin
  2019-12-27 17:38 ` [alsa-devel] [PATCH AUTOSEL 5.4 063/187] ASoC: SOF: Intel: split cht and byt debug window sizes Sasha Levin
  2019-12-27 17:39 ` [alsa-devel] [PATCH AUTOSEL 5.4 123/187] ASoC: wm8962: fix lambda value Sasha Levin
  8 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2019-12-27 17:38 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Sasha Levin, Mark Brown, Karol Trzcinski, Pierre-Louis Bossart,
	alsa-devel

From: Karol Trzcinski <karolx.trzcinski@linux.intel.com>

[ Upstream commit 8edc95667646a75f0fc97e08ecb180581fdff300 ]

Added warning log when found some unknown FW boot ext header,
to improve debuggability.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191210004854.16845-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/sof/loader.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/soc/sof/loader.c b/sound/soc/sof/loader.c
index 9a9a381a908d..a041adf0669d 100644
--- a/sound/soc/sof/loader.c
+++ b/sound/soc/sof/loader.c
@@ -66,6 +66,8 @@ int snd_sof_fw_parse_ext_data(struct snd_sof_dev *sdev, u32 bar, u32 offset)
 			ret = get_ext_windows(sdev, ext_hdr);
 			break;
 		default:
+			dev_warn(sdev->dev, "warning: unknown ext header type %d size 0x%x\n",
+				 ext_hdr->type, ext_hdr->hdr.size);
 			break;
 		}
 
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH AUTOSEL 5.4 063/187] ASoC: SOF: Intel: split cht and byt debug window sizes
  2019-12-27 17:37 [alsa-devel] [PATCH AUTOSEL 5.4 001/187] ASoC: rt5682: fix i2c arbitration lost issue Sasha Levin
                   ` (6 preceding siblings ...)
  2019-12-27 17:38 ` [alsa-devel] [PATCH AUTOSEL 5.4 062/187] ASoC: SOF: loader: snd_sof_fw_parse_ext_data log warning on unknown header Sasha Levin
@ 2019-12-27 17:38 ` Sasha Levin
  2019-12-27 17:39 ` [alsa-devel] [PATCH AUTOSEL 5.4 123/187] ASoC: wm8962: fix lambda value Sasha Levin
  8 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2019-12-27 17:38 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Sasha Levin, Curtis Malainey, Mark Brown, Pierre-Louis Bossart,
	alsa-devel

From: Curtis Malainey <cujomalainey@chromium.org>

[ Upstream commit f84337c3fb8ff4d533ccbed0d2db4e8587d0ff58 ]

Turns out SSP 3-5 are only available on cht, to avoid dumping on
undefined registers let's split the definition.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191210004854.16845-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/sof/intel/byt.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/sound/soc/sof/intel/byt.c b/sound/soc/sof/intel/byt.c
index a1e514f71739..41008c974ac6 100644
--- a/sound/soc/sof/intel/byt.c
+++ b/sound/soc/sof/intel/byt.c
@@ -24,7 +24,8 @@
 #define DRAM_OFFSET		0x100000
 #define DRAM_SIZE		(160 * 1024)
 #define SHIM_OFFSET		0x140000
-#define SHIM_SIZE		0x100
+#define SHIM_SIZE_BYT		0x100
+#define SHIM_SIZE_CHT		0x118
 #define MBOX_OFFSET		0x144000
 #define MBOX_SIZE		0x1000
 #define EXCEPT_OFFSET		0x800
@@ -75,7 +76,7 @@ static const struct snd_sof_debugfs_map byt_debugfs[] = {
 	 SOF_DEBUGFS_ACCESS_D0_ONLY},
 	{"dram", BYT_DSP_BAR, DRAM_OFFSET, DRAM_SIZE,
 	 SOF_DEBUGFS_ACCESS_D0_ONLY},
-	{"shim", BYT_DSP_BAR, SHIM_OFFSET, SHIM_SIZE,
+	{"shim", BYT_DSP_BAR, SHIM_OFFSET, SHIM_SIZE_BYT,
 	 SOF_DEBUGFS_ACCESS_ALWAYS},
 };
 
@@ -102,7 +103,7 @@ static const struct snd_sof_debugfs_map cht_debugfs[] = {
 	 SOF_DEBUGFS_ACCESS_D0_ONLY},
 	{"dram", BYT_DSP_BAR, DRAM_OFFSET, DRAM_SIZE,
 	 SOF_DEBUGFS_ACCESS_D0_ONLY},
-	{"shim", BYT_DSP_BAR, SHIM_OFFSET, SHIM_SIZE,
+	{"shim", BYT_DSP_BAR, SHIM_OFFSET, SHIM_SIZE_CHT,
 	 SOF_DEBUGFS_ACCESS_ALWAYS},
 };
 
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH AUTOSEL 5.4 123/187] ASoC: wm8962: fix lambda value
  2019-12-27 17:37 [alsa-devel] [PATCH AUTOSEL 5.4 001/187] ASoC: rt5682: fix i2c arbitration lost issue Sasha Levin
                   ` (7 preceding siblings ...)
  2019-12-27 17:38 ` [alsa-devel] [PATCH AUTOSEL 5.4 063/187] ASoC: SOF: Intel: split cht and byt debug window sizes Sasha Levin
@ 2019-12-27 17:39 ` Sasha Levin
  8 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2019-12-27 17:39 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Sasha Levin, alsa-devel, Charles Keepax, patches, Shengjiu Wang,
	Mark Brown

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

[ Upstream commit 556672d75ff486e0b6786056da624131679e0576 ]

According to user manual, it is required that FLL_LAMBDA > 0
in all cases (Integer and Franctional modes).

Fixes: 9a76f1ff6e29 ("ASoC: Add initial WM8962 CODEC driver")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/1576065442-19763-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/codecs/wm8962.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index 3e5c69fbc33a..d9d59f45833f 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -2788,7 +2788,7 @@ static int fll_factors(struct _fll_div *fll_div, unsigned int Fref,
 
 	if (target % Fref == 0) {
 		fll_div->theta = 0;
-		fll_div->lambda = 0;
+		fll_div->lambda = 1;
 	} else {
 		gcd_fll = gcd(target, fratio * Fref);
 
@@ -2858,7 +2858,7 @@ static int wm8962_set_fll(struct snd_soc_component *component, int fll_id, int s
 		return -EINVAL;
 	}
 
-	if (fll_div.theta || fll_div.lambda)
+	if (fll_div.theta)
 		fll1 |= WM8962_FLL_FRAC;
 
 	/* Stop the FLL while we reconfigure */
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: [alsa-devel] [PATCH AUTOSEL 5.4 005/187] ASoC: max98090: remove msleep in PLL unlocked workaround
  2019-12-27 17:37 ` [alsa-devel] [PATCH AUTOSEL 5.4 005/187] ASoC: max98090: remove msleep in PLL unlocked workaround Sasha Levin
@ 2019-12-27 22:43   ` Mark Brown
  0 siblings, 0 replies; 13+ messages in thread
From: Mark Brown @ 2019-12-27 22:43 UTC (permalink / raw)
  To: Sasha Levin
  Cc: Tzung-Bi Shih, alsa-devel, linux-kernel, stable, Pierre-Louis Bossart


[-- Attachment #1.1: Type: text/plain, Size: 520 bytes --]

On Fri, Dec 27, 2019 at 12:37:53PM -0500, Sasha Levin wrote:
> From: Tzung-Bi Shih <tzungbi@google.com>
> 
> [ Upstream commit acb874a7c049ec49d8fc66c893170fb42c01bdf7 ]
> 
> It was observed Baytrail-based chromebooks could cause continuous PLL
> unlocked when using playback stream and capture stream simultaneously.
> Specifically, starting a capture stream after started a playback stream.
> As a result, the audio data could corrupt or turn completely silent.

This causes regressions, don't backport it.

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

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: [alsa-devel] [PATCH AUTOSEL 5.4 006/187] ASoC: max98090: exit workaround earlier if PLL is locked
  2019-12-27 17:37 ` [alsa-devel] [PATCH AUTOSEL 5.4 006/187] ASoC: max98090: exit workaround earlier if PLL is locked Sasha Levin
@ 2019-12-27 22:44   ` Mark Brown
  2020-01-05 15:30     ` Sasha Levin
  0 siblings, 1 reply; 13+ messages in thread
From: Mark Brown @ 2019-12-27 22:44 UTC (permalink / raw)
  To: Sasha Levin
  Cc: Tzung-Bi Shih, alsa-devel, linux-kernel, stable, Pierre-Louis Bossart


[-- Attachment #1.1: Type: text/plain, Size: 359 bytes --]

On Fri, Dec 27, 2019 at 12:37:54PM -0500, Sasha Levin wrote:
> From: Tzung-Bi Shih <tzungbi@google.com>
> 
> [ Upstream commit 6f49919d11690a9b5614445ba30fde18083fdd63 ]
> 
> According to the datasheet, PLL lock time typically takes 2 msec and
> at most takes 7 msec.

Same here and for the other max98090 patch - once things are
fixed it'll be OK.

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

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: [alsa-devel] [PATCH AUTOSEL 5.4 006/187] ASoC: max98090: exit workaround earlier if PLL is locked
  2019-12-27 22:44   ` Mark Brown
@ 2020-01-05 15:30     ` Sasha Levin
  0 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2020-01-05 15:30 UTC (permalink / raw)
  To: Mark Brown
  Cc: Tzung-Bi Shih, alsa-devel, linux-kernel, stable, Pierre-Louis Bossart

On Fri, Dec 27, 2019 at 10:44:30PM +0000, Mark Brown wrote:
>On Fri, Dec 27, 2019 at 12:37:54PM -0500, Sasha Levin wrote:
>> From: Tzung-Bi Shih <tzungbi@google.com>
>>
>> [ Upstream commit 6f49919d11690a9b5614445ba30fde18083fdd63 ]
>>
>> According to the datasheet, PLL lock time typically takes 2 msec and
>> at most takes 7 msec.
>
>Same here and for the other max98090 patch - once things are
>fixed it'll be OK.

I've dropped both. Could you ping me when this is settled and I'll grab
these and any follow up fixes?

-- 
Thanks,
Sasha
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

end of thread, other threads:[~2020-01-05 16:06 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-27 17:37 [alsa-devel] [PATCH AUTOSEL 5.4 001/187] ASoC: rt5682: fix i2c arbitration lost issue Sasha Levin
2019-12-27 17:37 ` [alsa-devel] [PATCH AUTOSEL 5.4 005/187] ASoC: max98090: remove msleep in PLL unlocked workaround Sasha Levin
2019-12-27 22:43   ` Mark Brown
2019-12-27 17:37 ` [alsa-devel] [PATCH AUTOSEL 5.4 006/187] ASoC: max98090: exit workaround earlier if PLL is locked Sasha Levin
2019-12-27 22:44   ` Mark Brown
2020-01-05 15:30     ` Sasha Levin
2019-12-27 17:37 ` [alsa-devel] [PATCH AUTOSEL 5.4 007/187] ASoC: max98090: fix possible race conditions Sasha Levin
2019-12-27 17:38 ` [alsa-devel] [PATCH AUTOSEL 5.4 023/187] ASoC: Intel: bytcr_rt5640: Update quirk for Teclast X89 Sasha Levin
2019-12-27 17:38 ` [alsa-devel] [PATCH AUTOSEL 5.4 060/187] ASoC: topology: Check return value for snd_soc_add_dai_link() Sasha Levin
2019-12-27 17:38 ` [alsa-devel] [PATCH AUTOSEL 5.4 061/187] ASoC: topology: Check return value for soc_tplg_pcm_create() Sasha Levin
2019-12-27 17:38 ` [alsa-devel] [PATCH AUTOSEL 5.4 062/187] ASoC: SOF: loader: snd_sof_fw_parse_ext_data log warning on unknown header Sasha Levin
2019-12-27 17:38 ` [alsa-devel] [PATCH AUTOSEL 5.4 063/187] ASoC: SOF: Intel: split cht and byt debug window sizes Sasha Levin
2019-12-27 17:39 ` [alsa-devel] [PATCH AUTOSEL 5.4 123/187] ASoC: wm8962: fix lambda value 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).