From: han.lu@intel.com
To: broonie@kernel.org, alsa-devel@alsa-project.org,
liam.r.girdwood@intel.com
Cc: "Lu, Han" <han.lu@intel.com>
Subject: [PATCH v2 4/8] ASoC: Intel: add kcontrol to enable/disable sound effect module waves
Date: Tue, 10 Mar 2015 10:41:23 +0800 [thread overview]
Message-ID: <1425955287-29661-4-git-send-email-han.lu@intel.com> (raw)
In-Reply-To: <1425955287-29661-1-git-send-email-han.lu@intel.com>
From: "Lu, Han" <han.lu@intel.com>
Add kcontrol to enable/disable module waves. IPC is valid only when module
is loaded.
Signed-off-by: Lu, Han <han.lu@intel.com>
diff --git a/sound/soc/intel/sst-haswell-pcm.c b/sound/soc/intel/sst-haswell-pcm.c
index a604cc4..3d10acc 100644
--- a/sound/soc/intel/sst-haswell-pcm.c
+++ b/sound/soc/intel/sst-haswell-pcm.c
@@ -318,6 +318,42 @@ static int hsw_volume_get(struct snd_kcontrol *kcontrol,
return 0;
}
+static int hsw_waves_switch_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_platform *platform = snd_soc_kcontrol_platform(kcontrol);
+ struct hsw_priv_data *pdata = snd_soc_platform_get_drvdata(platform);
+ struct sst_hsw *hsw = pdata->hsw;
+ enum sst_hsw_module_id id = SST_HSW_MODULE_WAVES;
+
+ ucontrol->value.integer.value[0] = sst_hsw_is_module_active(hsw, id);
+ return 0;
+}
+
+static int hsw_waves_switch_put(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_platform *platform = snd_soc_kcontrol_platform(kcontrol);
+ struct hsw_priv_data *pdata = snd_soc_platform_get_drvdata(platform);
+ struct sst_hsw *hsw = pdata->hsw;
+ int ret = 0;
+ enum sst_hsw_module_id id = SST_HSW_MODULE_WAVES;
+ bool switch_on = (bool)ucontrol->value.integer.value[0];
+
+ if (sst_hsw_is_module_loaded(hsw, id)) {
+ if (switch_on == sst_hsw_is_module_active(hsw, id))
+ return 0;
+
+ /* ipc is valid only when module is loaded */
+ if (switch_on)
+ ret = sst_hsw_module_enable(hsw, id, 0);
+ else
+ ret = sst_hsw_module_disable(hsw, id, 0);
+ }
+
+ return ret;
+}
+
/* TLV used by both global and stream volumes */
static const DECLARE_TLV_DB_SCALE(hsw_vol_tlv, -9000, 300, 1);
@@ -339,6 +375,9 @@ static const struct snd_kcontrol_new hsw_volume_controls[] = {
SOC_DOUBLE_EXT_TLV("Mic Capture Volume", 4, 0, 8,
ARRAY_SIZE(volume_map) - 1, 0,
hsw_stream_volume_get, hsw_stream_volume_put, hsw_vol_tlv),
+ /* enable/disable module waves */
+ SOC_SINGLE_BOOL_EXT("Waves Switch", 0,
+ hsw_waves_switch_get, hsw_waves_switch_put),
};
/* Create DMA buffer page table for DSP */
--
1.9.1
next prev parent reply other threads:[~2015-03-10 2:41 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-10 2:41 [PATCH v2 1/8] ASoC: Intel: add function to load firmware image han.lu
2015-03-10 2:41 ` [PATCH v2 2/8] ASoC: Intel: add function to load sound effect module waves han.lu
2015-03-10 2:41 ` [PATCH v2 3/8] ASoC: Intel: add function to enable/disable " han.lu
2015-03-10 2:41 ` han.lu [this message]
2015-03-10 20:37 ` [PATCH v2 4/8] ASoC: Intel: add kcontrol " Mark Brown
2015-03-11 7:07 ` Lu, Han
2015-03-11 12:57 ` Mark Brown
2015-03-10 2:41 ` [PATCH v2 5/8] ASoC: Intel: track module state on RTD3 han.lu
2015-03-10 2:41 ` [PATCH v2 6/8] ASoC: Intel: add function to set parameter to sound effect module waves han.lu
2015-03-10 2:41 ` [PATCH v2 7/8] ASoC: Intel: add kcontrol " han.lu
2015-03-10 2:41 ` [PATCH v2 8/8] ASoC: Intel: enable parameter restore for " han.lu
2015-03-10 20:38 ` [PATCH v2 1/8] ASoC: Intel: add function to load firmware image Mark Brown
2015-03-11 6:48 ` Lu, Han
2015-03-11 12:54 ` 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=1425955287-29661-4-git-send-email-han.lu@intel.com \
--to=han.lu@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=liam.r.girdwood@intel.com \
/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