All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: SOF: Update correct LED status at the first time usage of update_mute_led()
@ 2020-04-30  9:11 ` Kai-Heng Feng
  0 siblings, 0 replies; 8+ messages in thread
From: Kai-Heng Feng @ 2020-04-30  9:11 UTC (permalink / raw)
  To: pierre-louis.bossart, lgirdwood, ranjani.sridharan, kai.vehmanen,
	daniel.baluta
  Cc: Kai-Heng Feng, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Jaska Uimonen,
	moderated list:SOUND - SOUND OPEN FIRMWARE (SOF) DRIVERS,
	moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	open list

At the first time update_mute_led() gets called, if channels are already
muted, the temp value equals to led_value as 0, skipping the following
LED setting.

So set led_value to -1 as an uninitialized state, to update the correct
LED status at first time usage.

Fixes: 5d43001ae436 ("ASoC: SOF: acpi led support for switch controls")
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 sound/soc/sof/control.c   | 4 ++--
 sound/soc/sof/sof-audio.h | 2 +-
 sound/soc/sof/topology.c  | 2 ++
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/sound/soc/sof/control.c b/sound/soc/sof/control.c
index dfc412e2d956..6d63768d42aa 100644
--- a/sound/soc/sof/control.c
+++ b/sound/soc/sof/control.c
@@ -19,8 +19,8 @@ static void update_mute_led(struct snd_sof_control *scontrol,
 			    struct snd_kcontrol *kcontrol,
 			    struct snd_ctl_elem_value *ucontrol)
 {
-	unsigned int temp = 0;
-	unsigned int mask;
+	int temp = 0;
+	int mask;
 	int i;
 
 	mask = 1U << snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
diff --git a/sound/soc/sof/sof-audio.h b/sound/soc/sof/sof-audio.h
index bf65f31af858..875a5fc13297 100644
--- a/sound/soc/sof/sof-audio.h
+++ b/sound/soc/sof/sof-audio.h
@@ -56,7 +56,7 @@ struct snd_sof_pcm {
 struct snd_sof_led_control {
 	unsigned int use_led;
 	unsigned int direction;
-	unsigned int led_value;
+	int led_value;
 };
 
 /* ALSA SOF Kcontrol device */
diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c
index fe8ba3e05e08..ab2b69de1d4d 100644
--- a/sound/soc/sof/topology.c
+++ b/sound/soc/sof/topology.c
@@ -1203,6 +1203,8 @@ static int sof_control_load(struct snd_soc_component *scomp, int index,
 		return ret;
 	}
 
+	scontrol->led_ctl.led_value = -1;
+
 	dobj->private = scontrol;
 	list_add(&scontrol->list, &sdev->kcontrol_list);
 	return ret;
-- 
2.17.1


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

* [PATCH] ASoC: SOF: Update correct LED status at the first time usage of update_mute_led()
@ 2020-04-30  9:11 ` Kai-Heng Feng
  0 siblings, 0 replies; 8+ messages in thread
From: Kai-Heng Feng @ 2020-04-30  9:11 UTC (permalink / raw)
  To: pierre-louis.bossart, lgirdwood, ranjani.sridharan, kai.vehmanen,
	daniel.baluta
  Cc: Kai-Heng Feng,
	moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	open list, Takashi Iwai, Mark Brown, Jaska Uimonen,
	moderated list:SOUND - SOUND OPEN FIRMWARE SOF DRIVERS

At the first time update_mute_led() gets called, if channels are already
muted, the temp value equals to led_value as 0, skipping the following
LED setting.

So set led_value to -1 as an uninitialized state, to update the correct
LED status at first time usage.

Fixes: 5d43001ae436 ("ASoC: SOF: acpi led support for switch controls")
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 sound/soc/sof/control.c   | 4 ++--
 sound/soc/sof/sof-audio.h | 2 +-
 sound/soc/sof/topology.c  | 2 ++
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/sound/soc/sof/control.c b/sound/soc/sof/control.c
index dfc412e2d956..6d63768d42aa 100644
--- a/sound/soc/sof/control.c
+++ b/sound/soc/sof/control.c
@@ -19,8 +19,8 @@ static void update_mute_led(struct snd_sof_control *scontrol,
 			    struct snd_kcontrol *kcontrol,
 			    struct snd_ctl_elem_value *ucontrol)
 {
-	unsigned int temp = 0;
-	unsigned int mask;
+	int temp = 0;
+	int mask;
 	int i;
 
 	mask = 1U << snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
diff --git a/sound/soc/sof/sof-audio.h b/sound/soc/sof/sof-audio.h
index bf65f31af858..875a5fc13297 100644
--- a/sound/soc/sof/sof-audio.h
+++ b/sound/soc/sof/sof-audio.h
@@ -56,7 +56,7 @@ struct snd_sof_pcm {
 struct snd_sof_led_control {
 	unsigned int use_led;
 	unsigned int direction;
-	unsigned int led_value;
+	int led_value;
 };
 
 /* ALSA SOF Kcontrol device */
diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c
index fe8ba3e05e08..ab2b69de1d4d 100644
--- a/sound/soc/sof/topology.c
+++ b/sound/soc/sof/topology.c
@@ -1203,6 +1203,8 @@ static int sof_control_load(struct snd_soc_component *scomp, int index,
 		return ret;
 	}
 
+	scontrol->led_ctl.led_value = -1;
+
 	dobj->private = scontrol;
 	list_add(&scontrol->list, &sdev->kcontrol_list);
 	return ret;
-- 
2.17.1


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

* Re: [PATCH] ASoC: SOF: Update correct LED status at the first time usage of update_mute_led()
  2020-04-30  9:11 ` Kai-Heng Feng
@ 2020-04-30 17:40   ` Kai Vehmanen
  -1 siblings, 0 replies; 8+ messages in thread
From: Kai Vehmanen @ 2020-04-30 17:40 UTC (permalink / raw)
  To: Kai-Heng Feng
  Cc: pierre-louis.bossart, lgirdwood, ranjani.sridharan, kai.vehmanen,
	daniel.baluta, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Jaska Uimonen,
	moderated list:SOUND - SOUND OPEN FIRMWARE (SOF) DRIVERS,
	moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	open list

Hi,

On Thu, 30 Apr 2020, Kai-Heng Feng wrote:

> At the first time update_mute_led() gets called, if channels are already
> muted, the temp value equals to led_value as 0, skipping the following
> LED setting.

thanks, looks good! 

Acked-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>

Br, Kai

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

* Re: [PATCH] ASoC: SOF: Update correct LED status at the first time usage of update_mute_led()
@ 2020-04-30 17:40   ` Kai Vehmanen
  0 siblings, 0 replies; 8+ messages in thread
From: Kai Vehmanen @ 2020-04-30 17:40 UTC (permalink / raw)
  To: Kai-Heng Feng
  Cc: moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	kai.vehmanen, lgirdwood, open list, Takashi Iwai,
	ranjani.sridharan, pierre-louis.bossart, Mark Brown,
	daniel.baluta, Jaska Uimonen,
	moderated list:SOUND - SOUND OPEN FIRMWARE (SOF) DRIVERS

Hi,

On Thu, 30 Apr 2020, Kai-Heng Feng wrote:

> At the first time update_mute_led() gets called, if channels are already
> muted, the temp value equals to led_value as 0, skipping the following
> LED setting.

thanks, looks good! 

Acked-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>

Br, Kai

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

* Re: [PATCH] ASoC: SOF: Update correct LED status at the first time usage of update_mute_led()
  2020-04-30  9:11 ` Kai-Heng Feng
@ 2020-04-30 23:24   ` Ranjani Sridharan
  -1 siblings, 0 replies; 8+ messages in thread
From: Ranjani Sridharan @ 2020-04-30 23:24 UTC (permalink / raw)
  To: Kai-Heng Feng, pierre-louis.bossart, lgirdwood, kai.vehmanen,
	daniel.baluta
  Cc: Mark Brown, Jaroslav Kysela, Takashi Iwai, Jaska Uimonen,
	moderated list:SOUND - SOUND OPEN FIRMWARE (SOF) DRIVERS,
	moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	open list

On Thu, 2020-04-30 at 17:11 +0800, Kai-Heng Feng wrote:
> At the first time update_mute_led() gets called, if channels are
> already
> muted, the temp value equals to led_value as 0, skipping the
> following
> LED setting.
> 
> So set led_value to -1 as an uninitialized state, to update the
> correct
> LED status at first time usage.
> 
> Fixes: 5d43001ae436 ("ASoC: SOF: acpi led support for switch
> controls")
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>

LGTM, thanks!

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>


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

* Re: [PATCH] ASoC: SOF: Update correct LED status at the first time usage of update_mute_led()
@ 2020-04-30 23:24   ` Ranjani Sridharan
  0 siblings, 0 replies; 8+ messages in thread
From: Ranjani Sridharan @ 2020-04-30 23:24 UTC (permalink / raw)
  To: Kai-Heng Feng, pierre-louis.bossart, lgirdwood, kai.vehmanen,
	daniel.baluta
  Cc: moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	open list, Takashi Iwai, Mark Brown, Jaska Uimonen,
	moderated list:SOUND - SOUND OPEN FIRMWARE (SOF) DRIVERS

On Thu, 2020-04-30 at 17:11 +0800, Kai-Heng Feng wrote:
> At the first time update_mute_led() gets called, if channels are
> already
> muted, the temp value equals to led_value as 0, skipping the
> following
> LED setting.
> 
> So set led_value to -1 as an uninitialized state, to update the
> correct
> LED status at first time usage.
> 
> Fixes: 5d43001ae436 ("ASoC: SOF: acpi led support for switch
> controls")
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>

LGTM, thanks!

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>


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

* Re: [PATCH] ASoC: SOF: Update correct LED status at the first time usage of update_mute_led()
  2020-04-30  9:11 ` Kai-Heng Feng
@ 2020-05-01 11:27   ` Mark Brown
  -1 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2020-05-01 11:27 UTC (permalink / raw)
  To: lgirdwood, pierre-louis.bossart, daniel.baluta, kai.vehmanen,
	Kai-Heng Feng, ranjani.sridharan
  Cc: moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	Takashi Iwai, Jaska Uimonen, open list,
	moderated list:SOUND - SOUND OPEN FIRMWARE SOF DRIVERS

On Thu, 30 Apr 2020 17:11:39 +0800, Kai-Heng Feng wrote:
> At the first time update_mute_led() gets called, if channels are already
> muted, the temp value equals to led_value as 0, skipping the following
> LED setting.
> 
> So set led_value to -1 as an uninitialized state, to update the correct
> LED status at first time usage.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.7

Thanks!

[1/1] ASoC: SOF: Update correct LED status at the first time usage of update_mute_led()
      commit: 49c22696348d6e7c8a2ecfd7e60fddfe188ded82

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

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

* Re: [PATCH] ASoC: SOF: Update correct LED status at the first time usage of update_mute_led()
@ 2020-05-01 11:27   ` Mark Brown
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2020-05-01 11:27 UTC (permalink / raw)
  To: lgirdwood, pierre-louis.bossart, daniel.baluta, kai.vehmanen,
	Kai-Heng Feng, ranjani.sridharan
  Cc: open list,
	moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	moderated list:SOUND - SOUND OPEN FIRMWARE SOF DRIVERS,
	Takashi Iwai, Jaska Uimonen

On Thu, 30 Apr 2020 17:11:39 +0800, Kai-Heng Feng wrote:
> At the first time update_mute_led() gets called, if channels are already
> muted, the temp value equals to led_value as 0, skipping the following
> LED setting.
> 
> So set led_value to -1 as an uninitialized state, to update the correct
> LED status at first time usage.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.7

Thanks!

[1/1] ASoC: SOF: Update correct LED status at the first time usage of update_mute_led()
      commit: 49c22696348d6e7c8a2ecfd7e60fddfe188ded82

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

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

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

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-30  9:11 [PATCH] ASoC: SOF: Update correct LED status at the first time usage of update_mute_led() Kai-Heng Feng
2020-04-30  9:11 ` Kai-Heng Feng
2020-04-30 17:40 ` Kai Vehmanen
2020-04-30 17:40   ` Kai Vehmanen
2020-04-30 23:24 ` Ranjani Sridharan
2020-04-30 23:24   ` Ranjani Sridharan
2020-05-01 11:27 ` Mark Brown
2020-05-01 11:27   ` Mark Brown

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.