alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] ALSA: hda: avoid reset of sdo_limit
@ 2020-08-19 15:32 Sameer Pujar
  2020-08-19 15:38 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Sameer Pujar @ 2020-08-19 15:32 UTC (permalink / raw)
  To: tiwai, perex
  Cc: alsa-devel, kai.vehmanen, Sameer Pujar, yang.jie,
	pierre-louis.bossart, stable, linux-kernel

By default 'sdo_limit' is initialized with a default value of '8'
as per spec. This is overridden in cases where a different value is
required. However this is getting reset when snd_hdac_bus_init_chip()
is called again, which happens during runtime PM cycle.

Avoid this reset by moving 'sdo_limit' setup to 'snd_hdac_bus_init()'
function which would be called only once.

Fixes: 67ae482a59e9 ("ALSA: hda: add member to store ratio for stripe control")
Cc: <stable@vger.kernel.org>
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
---
 sound/hda/hdac_bus.c        | 12 ++++++++++++
 sound/hda/hdac_controller.c | 11 -----------
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/sound/hda/hdac_bus.c b/sound/hda/hdac_bus.c
index 09ddab5..9766f6a 100644
--- a/sound/hda/hdac_bus.c
+++ b/sound/hda/hdac_bus.c
@@ -46,6 +46,18 @@ int snd_hdac_bus_init(struct hdac_bus *bus, struct device *dev,
 	INIT_LIST_HEAD(&bus->hlink_list);
 	init_waitqueue_head(&bus->rirb_wq);
 	bus->irq = -1;
+
+	/*
+	 * Default value of '8' is as per the HD audio specification (Rev 1.0a).
+	 * Following relation is used to derive STRIPE control value.
+	 *  For sample rate <= 48K:
+	 *   { ((num_channels * bits_per_sample) / number of SDOs) >= 8 }
+	 *  For sample rate > 48K:
+	 *   { ((num_channels * bits_per_sample * rate/48000) /
+	 *	number of SDOs) >= 8 }
+	 */
+	bus->sdo_limit = 8;
+
 	return 0;
 }
 EXPORT_SYMBOL_GPL(snd_hdac_bus_init);
diff --git a/sound/hda/hdac_controller.c b/sound/hda/hdac_controller.c
index 011b17c..b98449f 100644
--- a/sound/hda/hdac_controller.c
+++ b/sound/hda/hdac_controller.c
@@ -529,17 +529,6 @@ bool snd_hdac_bus_init_chip(struct hdac_bus *bus, bool full_reset)
 
 	bus->chip_init = true;
 
-	/*
-	 * Default value of '8' is as per the HD audio specification (Rev 1.0a).
-	 * Following relation is used to derive STRIPE control value.
-	 *  For sample rate <= 48K:
-	 *   { ((num_channels * bits_per_sample) / number of SDOs) >= 8 }
-	 *  For sample rate > 48K:
-	 *   { ((num_channels * bits_per_sample * rate/48000) /
-	 *	number of SDOs) >= 8 }
-	 */
-	bus->sdo_limit = 8;
-
 	return true;
 }
 EXPORT_SYMBOL_GPL(snd_hdac_bus_init_chip);
-- 
2.7.4


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

* Re: [PATCH v2] ALSA: hda: avoid reset of sdo_limit
  2020-08-19 15:32 [PATCH v2] ALSA: hda: avoid reset of sdo_limit Sameer Pujar
@ 2020-08-19 15:38 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2020-08-19 15:38 UTC (permalink / raw)
  To: Sameer Pujar
  Cc: alsa-devel, kai.vehmanen, linux-kernel, yang.jie,
	pierre-louis.bossart, stable, tiwai

On Wed, 19 Aug 2020 17:32:10 +0200,
Sameer Pujar wrote:
> 
> By default 'sdo_limit' is initialized with a default value of '8'
> as per spec. This is overridden in cases where a different value is
> required. However this is getting reset when snd_hdac_bus_init_chip()
> is called again, which happens during runtime PM cycle.
> 
> Avoid this reset by moving 'sdo_limit' setup to 'snd_hdac_bus_init()'
> function which would be called only once.
> 
> Fixes: 67ae482a59e9 ("ALSA: hda: add member to store ratio for stripe control")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Sameer Pujar <spujar@nvidia.com>

Applied now.  Thanks.


Takashi

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

end of thread, other threads:[~2020-08-19 15:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-19 15:32 [PATCH v2] ALSA: hda: avoid reset of sdo_limit Sameer Pujar
2020-08-19 15:38 ` Takashi Iwai

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).