All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: Intel: Get correct usage_count value to load firmware
@ 2015-07-14 18:13 yang.a.fang
  2015-07-14 18:16 ` Mark Brown
  2015-07-14 18:23 ` [PATCH v2] " yang.a.fang
  0 siblings, 2 replies; 8+ messages in thread
From: yang.a.fang @ 2015-07-14 18:13 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: alsa-devel, vinod.koul, sathyanarayana.nujella, kevin.strasser,
	srinivas.sripathi, shilpa.sreeramalu, dinesh.mirche, stable

From: Shilpa Sreeramalu <shilpa.sreeramalu@intel.com>

The usage_count variable was read before it was set to the correct
value, due to which the firmware load was failing. Because of this
IPC messages sent to the firmware were timing out causing a delay
of about 1 second while playing audio from the internal speakers.

With this patch the usage_count is read after the function call
pm_runtime_get_sync which will increment the usage_count variable
and the firmware load is successful and all the IPC messages are
processed correctly.

Cc: stable@vger.kernel.org
Signed-off-by: Shilpa Sreeramalu <shilpa.sreeramalu@intel.com>
---
 sound/soc/intel/atom/sst/sst_drv_interface.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/sound/soc/intel/atom/sst/sst_drv_interface.c b/sound/soc/intel/atom/sst/sst_drv_interface.c
index 620da1d..440b953 100644
--- a/sound/soc/intel/atom/sst/sst_drv_interface.c
+++ b/sound/soc/intel/atom/sst/sst_drv_interface.c
@@ -42,6 +42,11 @@
 #define MIN_FRAGMENT_SIZE (50 * 1024)
 #define MAX_FRAGMENT_SIZE (1024 * 1024)
 #define SST_GET_BYTES_PER_SAMPLE(pcm_wd_sz)  (((pcm_wd_sz + 15) >> 4) << 1)
+#ifdef PM_CONFIG
+#define GET_USAGE_COUNT(dev) (atomic_read(&dev->power.usage_count))
+#else
+#define GET_USAGE_COUNT(dev) 1
+#endif
 
 int free_stream_context(struct intel_sst_drv *ctx, unsigned int str_id)
 {
@@ -141,15 +146,9 @@ static int sst_power_control(struct device *dev, bool state)
 	int ret = 0;
 	int usage_count = 0;
 
-#ifdef CONFIG_PM
-	usage_count = atomic_read(&dev->power.usage_count);
-#else
-	usage_count = 1;
-#endif
-
 	if (state == true) {
 		ret = pm_runtime_get_sync(dev);
-
+		usage_count = GET_USAGE_COUNT(dev);
 		dev_dbg(ctx->dev, "Enable: pm usage count: %d\n", usage_count);
 		if (ret < 0) {
 			dev_err(ctx->dev, "Runtime get failed with err: %d\n", ret);
@@ -164,6 +163,7 @@ static int sst_power_control(struct device *dev, bool state)
 			}
 		}
 	} else {
+		usage_count = GET_USAGE_COUNT(dev);
 		dev_dbg(ctx->dev, "Disable: pm usage count: %d\n", usage_count);
 		return sst_pm_runtime_put(ctx);
 	}
-- 
1.7.9.5


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

* Re: [PATCH] ASoC: Intel: Get correct usage_count value to load firmware
  2015-07-14 18:13 [PATCH] ASoC: Intel: Get correct usage_count value to load firmware yang.a.fang
@ 2015-07-14 18:16 ` Mark Brown
  2015-07-14 18:17     ` Fang, Yang A
  2015-07-14 18:23 ` [PATCH v2] " yang.a.fang
  1 sibling, 1 reply; 8+ messages in thread
From: Mark Brown @ 2015-07-14 18:16 UTC (permalink / raw)
  To: yang.a.fang
  Cc: lgirdwood, alsa-devel, vinod.koul, sathyanarayana.nujella,
	kevin.strasser, srinivas.sripathi, shilpa.sreeramalu,
	dinesh.mirche, stable

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

On Tue, Jul 14, 2015 at 11:13:46AM -0700, yang.a.fang@intel.com wrote:

> +#ifdef PM_CONFIG
> +#define GET_USAGE_COUNT(dev) (atomic_read(&dev->power.usage_count))
> +#else
> +#define GET_USAGE_COUNT(dev) 1
> +#endif

PM_CONFIG?

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* RE: [PATCH] ASoC: Intel: Get correct usage_count value to load firmware
  2015-07-14 18:16 ` Mark Brown
@ 2015-07-14 18:17     ` Fang, Yang A
  0 siblings, 0 replies; 8+ messages in thread
From: Fang, Yang A @ 2015-07-14 18:17 UTC (permalink / raw)
  To: 'Mark Brown'
  Cc: lgirdwood, alsa-devel, Koul, Vinod, Nujella, Sathyanarayana,
	kevin.strasser, Sripathi, Srinivas, Sreeramalu, Shilpa, Mirche,
	Dinesh, stable



> -----Original Message-----
> From: Mark Brown [mailto:broonie@kernel.org]
> Sent: Tuesday, July 14, 2015 11:16 AM
> To: Fang, Yang A
> Cc: lgirdwood@gmail.com; alsa-devel@alsa-project.org; Koul, Vinod; Nujella,
> Sathyanarayana; kevin.strasser@linux.intel.com; Sripathi, Srinivas;
> Sreeramalu, Shilpa; Mirche, Dinesh; stable@vger.kernel.org
> Subject: Re: [PATCH] ASoC: Intel: Get correct usage_count value to load
> firmware
> 
> On Tue, Jul 14, 2015 at 11:13:46AM -0700, yang.a.fang@intel.com wrote:
> 
> > +#ifdef PM_CONFIG
> > +#define GET_USAGE_COUNT(dev) (atomic_read(&dev-
> >power.usage_count))
> > +#else
> > +#define GET_USAGE_COUNT(dev) 1
> > +#endif
> 
> PM_CONFIG?
Sorry for the typo. Will fix that.

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

* Re: [PATCH] ASoC: Intel: Get correct usage_count value to load firmware
@ 2015-07-14 18:17     ` Fang, Yang A
  0 siblings, 0 replies; 8+ messages in thread
From: Fang, Yang A @ 2015-07-14 18:17 UTC (permalink / raw)
  To: 'Mark Brown'
  Cc: alsa-devel, Sripathi, Srinivas, Koul, Vinod, Mirche, Dinesh,
	lgirdwood, stable, Nujella, Sathyanarayana, kevin.strasser,
	Sreeramalu, Shilpa



> -----Original Message-----
> From: Mark Brown [mailto:broonie@kernel.org]
> Sent: Tuesday, July 14, 2015 11:16 AM
> To: Fang, Yang A
> Cc: lgirdwood@gmail.com; alsa-devel@alsa-project.org; Koul, Vinod; Nujella,
> Sathyanarayana; kevin.strasser@linux.intel.com; Sripathi, Srinivas;
> Sreeramalu, Shilpa; Mirche, Dinesh; stable@vger.kernel.org
> Subject: Re: [PATCH] ASoC: Intel: Get correct usage_count value to load
> firmware
> 
> On Tue, Jul 14, 2015 at 11:13:46AM -0700, yang.a.fang@intel.com wrote:
> 
> > +#ifdef PM_CONFIG
> > +#define GET_USAGE_COUNT(dev) (atomic_read(&dev-
> >power.usage_count))
> > +#else
> > +#define GET_USAGE_COUNT(dev) 1
> > +#endif
> 
> PM_CONFIG?
Sorry for the typo. Will fix that.

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

* [PATCH v2] ASoC: Intel: Get correct usage_count value to load firmware
  2015-07-14 18:13 [PATCH] ASoC: Intel: Get correct usage_count value to load firmware yang.a.fang
  2015-07-14 18:16 ` Mark Brown
@ 2015-07-14 18:23 ` yang.a.fang
  2015-07-15 11:52   ` Mark Brown
  2015-07-15 14:58   ` [PATCH v3] " yang.a.fang
  1 sibling, 2 replies; 8+ messages in thread
From: yang.a.fang @ 2015-07-14 18:23 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: alsa-devel, vinod.koul, sathyanarayana.nujella, kevin.strasser,
	srinivas.sripathi, shilpa.sreeramalu, dinesh.mirche, yang.a.fang,
	stable

From: Shilpa Sreeramalu <shilpa.sreeramalu@intel.com>

The usage_count variable was read before it was set to the correct
value, due to which the firmware load was failing. Because of this
IPC messages sent to the firmware were timing out causing a delay
of about 1 second while playing audio from the internal speakers.

With this patch the usage_count is read after the function call
pm_runtime_get_sync which will increment the usage_count variable
and the firmware load is successful and all the IPC messages are
processed correctly.

Cc: stable@vger.kernel.org
Signed-off-by: Shilpa Sreeramalu <shilpa.sreeramalu@intel.com>
---
 sound/soc/intel/atom/sst/sst_drv_interface.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/sound/soc/intel/atom/sst/sst_drv_interface.c b/sound/soc/intel/atom/sst/sst_drv_interface.c
index 620da1d..0e0e4d9 100644
--- a/sound/soc/intel/atom/sst/sst_drv_interface.c
+++ b/sound/soc/intel/atom/sst/sst_drv_interface.c
@@ -42,6 +42,11 @@
 #define MIN_FRAGMENT_SIZE (50 * 1024)
 #define MAX_FRAGMENT_SIZE (1024 * 1024)
 #define SST_GET_BYTES_PER_SAMPLE(pcm_wd_sz)  (((pcm_wd_sz + 15) >> 4) << 1)
+#ifdef CONFIG_PM
+#define GET_USAGE_COUNT(dev) (atomic_read(&dev->power.usage_count))
+#else
+#define GET_USAGE_COUNT(dev) 1
+#endif
 
 int free_stream_context(struct intel_sst_drv *ctx, unsigned int str_id)
 {
@@ -141,15 +146,9 @@ static int sst_power_control(struct device *dev, bool state)
 	int ret = 0;
 	int usage_count = 0;
 
-#ifdef CONFIG_PM
-	usage_count = atomic_read(&dev->power.usage_count);
-#else
-	usage_count = 1;
-#endif
-
 	if (state == true) {
 		ret = pm_runtime_get_sync(dev);
-
+		usage_count = GET_USAGE_COUNT(dev);
 		dev_dbg(ctx->dev, "Enable: pm usage count: %d\n", usage_count);
 		if (ret < 0) {
 			dev_err(ctx->dev, "Runtime get failed with err: %d\n", ret);
@@ -164,6 +163,7 @@ static int sst_power_control(struct device *dev, bool state)
 			}
 		}
 	} else {
+		usage_count = GET_USAGE_COUNT(dev);
 		dev_dbg(ctx->dev, "Disable: pm usage count: %d\n", usage_count);
 		return sst_pm_runtime_put(ctx);
 	}
-- 
1.7.9.5


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

* Re: [PATCH v2] ASoC: Intel: Get correct usage_count value to load firmware
  2015-07-14 18:23 ` [PATCH v2] " yang.a.fang
@ 2015-07-15 11:52   ` Mark Brown
  2015-07-15 14:58   ` [PATCH v3] " yang.a.fang
  1 sibling, 0 replies; 8+ messages in thread
From: Mark Brown @ 2015-07-15 11:52 UTC (permalink / raw)
  To: yang.a.fang
  Cc: lgirdwood, alsa-devel, vinod.koul, sathyanarayana.nujella,
	kevin.strasser, srinivas.sripathi, shilpa.sreeramalu,
	dinesh.mirche, stable

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

On Tue, Jul 14, 2015 at 11:23:51AM -0700, yang.a.fang@intel.com wrote:

> Cc: stable@vger.kernel.org
> Signed-off-by: Shilpa Sreeramalu <shilpa.sreeramalu@intel.com>
> ---

I can't apply this, you've not signed off the patch.  Please see
Documentation/SubmittingPatches.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* [PATCH v3] ASoC: Intel: Get correct usage_count value to load firmware
  2015-07-14 18:23 ` [PATCH v2] " yang.a.fang
  2015-07-15 11:52   ` Mark Brown
@ 2015-07-15 14:58   ` yang.a.fang
  2015-07-15 16:16     ` Vinod Koul
  1 sibling, 1 reply; 8+ messages in thread
From: yang.a.fang @ 2015-07-15 14:58 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: alsa-devel, vinod.koul, sathyanarayana.nujella, kevin.strasser,
	srinivas.sripathi, shilpa.sreeramalu, dinesh.mirche, yang.a.fang,
	stable

From: Shilpa Sreeramalu <shilpa.sreeramalu@intel.com>

The usage_count variable was read before it was set to the correct
value, due to which the firmware load was failing. Because of this
IPC messages sent to the firmware were timing out causing a delay
of about 1 second while playing audio from the internal speakers.

With this patch the usage_count is read after the function call
pm_runtime_get_sync which will increment the usage_count variable
and the firmware load is successful and all the IPC messages are
processed correctly.

Cc: stable@vger.kernel.org
Signed-off-by: Shilpa Sreeramalu <shilpa.sreeramalu@intel.com>
Signed-off-by: Fang, Yang A <yang.a.fang@intel.com>
---
 sound/soc/intel/atom/sst/sst_drv_interface.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/sound/soc/intel/atom/sst/sst_drv_interface.c b/sound/soc/intel/atom/sst/sst_drv_interface.c
index 620da1d..0e0e4d9 100644
--- a/sound/soc/intel/atom/sst/sst_drv_interface.c
+++ b/sound/soc/intel/atom/sst/sst_drv_interface.c
@@ -42,6 +42,11 @@
 #define MIN_FRAGMENT_SIZE (50 * 1024)
 #define MAX_FRAGMENT_SIZE (1024 * 1024)
 #define SST_GET_BYTES_PER_SAMPLE(pcm_wd_sz)  (((pcm_wd_sz + 15) >> 4) << 1)
+#ifdef CONFIG_PM
+#define GET_USAGE_COUNT(dev) (atomic_read(&dev->power.usage_count))
+#else
+#define GET_USAGE_COUNT(dev) 1
+#endif
 
 int free_stream_context(struct intel_sst_drv *ctx, unsigned int str_id)
 {
@@ -141,15 +146,9 @@ static int sst_power_control(struct device *dev, bool state)
 	int ret = 0;
 	int usage_count = 0;
 
-#ifdef CONFIG_PM
-	usage_count = atomic_read(&dev->power.usage_count);
-#else
-	usage_count = 1;
-#endif
-
 	if (state == true) {
 		ret = pm_runtime_get_sync(dev);
-
+		usage_count = GET_USAGE_COUNT(dev);
 		dev_dbg(ctx->dev, "Enable: pm usage count: %d\n", usage_count);
 		if (ret < 0) {
 			dev_err(ctx->dev, "Runtime get failed with err: %d\n", ret);
@@ -164,6 +163,7 @@ static int sst_power_control(struct device *dev, bool state)
 			}
 		}
 	} else {
+		usage_count = GET_USAGE_COUNT(dev);
 		dev_dbg(ctx->dev, "Disable: pm usage count: %d\n", usage_count);
 		return sst_pm_runtime_put(ctx);
 	}
-- 
1.7.9.5


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

* Re: [PATCH v3] ASoC: Intel: Get correct usage_count value to load firmware
  2015-07-15 14:58   ` [PATCH v3] " yang.a.fang
@ 2015-07-15 16:16     ` Vinod Koul
  0 siblings, 0 replies; 8+ messages in thread
From: Vinod Koul @ 2015-07-15 16:16 UTC (permalink / raw)
  To: yang.a.fang
  Cc: broonie, lgirdwood, alsa-devel, sathyanarayana.nujella,
	kevin.strasser, srinivas.sripathi, shilpa.sreeramalu,
	dinesh.mirche, stable

On Wed, Jul 15, 2015 at 07:58:09AM -0700, yang.a.fang@intel.com wrote:
> From: Shilpa Sreeramalu <shilpa.sreeramalu@intel.com>
> 
> The usage_count variable was read before it was set to the correct
> value, due to which the firmware load was failing. Because of this
> IPC messages sent to the firmware were timing out causing a delay
> of about 1 second while playing audio from the internal speakers.
> 
> With this patch the usage_count is read after the function call
> pm_runtime_get_sync which will increment the usage_count variable
> and the firmware load is successful and all the IPC messages are
> processed correctly.

Acked-by: Vinod Koul <vinod.koul@intel.com>

-- 
~Vinod


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

end of thread, other threads:[~2015-07-15 16:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-14 18:13 [PATCH] ASoC: Intel: Get correct usage_count value to load firmware yang.a.fang
2015-07-14 18:16 ` Mark Brown
2015-07-14 18:17   ` Fang, Yang A
2015-07-14 18:17     ` Fang, Yang A
2015-07-14 18:23 ` [PATCH v2] " yang.a.fang
2015-07-15 11:52   ` Mark Brown
2015-07-15 14:58   ` [PATCH v3] " yang.a.fang
2015-07-15 16:16     ` Vinod Koul

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.