alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: alsa-devel@alsa-project.org
Cc: tiwai@suse.de, broonie@kernel.org,
	Jaska Uimonen <jaska.uimonen@linux.intel.com>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Subject: [alsa-devel] [PATCH 7/9] ASoC: SOF: enable dual control for pga
Date: Tue,  8 Oct 2019 11:44:41 -0500	[thread overview]
Message-ID: <20191008164443.1358-8-pierre-louis.bossart@linux.intel.com> (raw)
In-Reply-To: <20191008164443.1358-1-pierre-louis.bossart@linux.intel.com>

From: Jaska Uimonen <jaska.uimonen@linux.intel.com>

Currently sof pga element supports only 1 kcontrol and you can't create
for example a mixer element with combined volume slider and mute switch.
So enable sof pga to have more than 1 kcontrol associated with it. Also
check for possible NULL tlv pointer as switch element might not have it.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/sof/topology.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c
index d8172d3f672f..edfb5f1458b7 100644
--- a/sound/soc/sof/topology.c
+++ b/sound/soc/sof/topology.c
@@ -1587,7 +1587,7 @@ static int sof_widget_load_pga(struct snd_soc_component *scomp, int index,
 	if (!volume)
 		return -ENOMEM;
 
-	if (le32_to_cpu(tw->num_kcontrols) != 1) {
+	if (!le32_to_cpu(tw->num_kcontrols)) {
 		dev_err(sdev->dev, "error: invalid kcontrol count %d for volume\n",
 			tw->num_kcontrols);
 		ret = -EINVAL;
@@ -1624,7 +1624,8 @@ static int sof_widget_load_pga(struct snd_soc_component *scomp, int index,
 	swidget->private = volume;
 
 	list_for_each_entry(scontrol, &sdev->kcontrol_list, list) {
-		if (scontrol->comp_id == swidget->comp_id) {
+		if (scontrol->comp_id == swidget->comp_id &&
+		    scontrol->volume_table) {
 			min_step = scontrol->min_volume_step;
 			max_step = scontrol->max_volume_step;
 			volume->min_value = scontrol->volume_table[min_step];
-- 
2.20.1

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

  parent reply	other threads:[~2019-10-08 16:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-08 16:44 [alsa-devel] [PATCH 0/9] ASoC: SOF updates for Intel/i.MX Pierre-Louis Bossart
2019-10-08 16:44 ` [alsa-devel] [PATCH 1/9] ASoC: SOF: enable sync_write in hdac_bus Pierre-Louis Bossart
2019-10-10 14:22   ` [alsa-devel] Applied "ASoC: SOF: enable sync_write in hdac_bus" to the asoc tree Mark Brown
2019-10-08 16:44 ` [alsa-devel] [PATCH 2/9] Revert "ASoC: SOF: Force polling mode on CFL and CNL" Pierre-Louis Bossart
2019-10-10 14:08   ` Mark Brown
2019-10-10 15:41     ` Pierre-Louis Bossart
2019-10-10 14:22   ` [alsa-devel] Applied "Revert "ASoC: SOF: Force polling mode on CFL and CNL"" to the asoc tree Mark Brown
2019-10-08 16:44 ` [alsa-devel] [PATCH 3/9] ASoC: SOF: acpi: add debug module param Pierre-Louis Bossart
2019-10-10 14:22   ` [alsa-devel] Applied "ASoC: SOF: acpi: add debug module param" to the asoc tree Mark Brown
2019-10-08 16:44 ` [alsa-devel] [PATCH 4/9] ASoC: SOF: pci: add debug module param Pierre-Louis Bossart
2019-10-10 14:22   ` [alsa-devel] Applied "ASoC: SOF: pci: add debug module param" to the asoc tree Mark Brown
2019-10-08 16:44 ` [alsa-devel] [PATCH 5/9] ASoC: SOF: imx: Describe ESAI parameters to be sent to DSP Pierre-Louis Bossart
2019-10-10 14:22   ` [alsa-devel] Applied "ASoC: SOF: imx: Describe ESAI parameters to be sent to DSP" to the asoc tree Mark Brown
2019-10-08 16:44 ` [alsa-devel] [PATCH 6/9] ASoC: SOF: imx: Read ESAI parameters and send them to DSP Pierre-Louis Bossart
2019-10-10 14:22   ` [alsa-devel] Applied "ASoC: SOF: imx: Read ESAI parameters and send them to DSP" to the asoc tree Mark Brown
2019-10-08 16:44 ` Pierre-Louis Bossart [this message]
2019-10-10 14:22   ` [alsa-devel] Applied "ASoC: SOF: enable dual control for pga" " Mark Brown
2019-10-08 16:44 ` [alsa-devel] [PATCH 8/9] AsoC: SOF: refactor control load code Pierre-Louis Bossart
2019-10-10 14:22   ` [alsa-devel] Applied "AsoC: SOF: refactor control load code" to the asoc tree Mark Brown
2019-10-08 16:44 ` [alsa-devel] [PATCH 9/9] ASoC: SOF: acpi led support for switch controls Pierre-Louis Bossart
2019-10-10 14:22   ` [alsa-devel] Applied "ASoC: SOF: acpi led support for switch controls" to the asoc tree Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191008164443.1358-8-pierre-louis.bossart@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=jaska.uimonen@linux.intel.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).