diff options
author | Ben Dooks <ben@simtec.co.uk> | 2009-02-26 21:56:05 +0000 |
---|---|---|
committer | Andy Green <agreen@octopus.localdomain> | 2009-02-26 21:56:05 +0000 |
commit | 26ab280dbe65fc7decae4ab31bca9ee7162d3c98 (patch) | |
tree | dec7ca2ed1dd242640c893fd648f33f34ed952ad /sound/soc/s3c24xx/Makefile | |
parent | db557e2343d0dca402bee96eb3f60f84f17f36e2 (diff) |
AUDIO: GTA03 make get/set calls use common code
The GTA03 driver has a number of get and set calls that
can be easily be done by calling a pair of common helper
functions.
Signed-off-by: Ben Dooks <ben@simtec.co.uk>Index: linux.agit/sound/soc/s3c24xx/om_gta03_wm8753.c
===================================================================
--- linux.agit.orig/sound/soc/s3c24xx/om_gta03_wm8753.c 2009-02-26 17:58:18.000000000 +0000
+++ linux.agit/sound/soc/s3c24xx/om_gta03_wm8753.c 2009-02-26 17:59:46.000000000 +0000
@@ -228,8 +228,9 @@ static struct snd_soc_ops om_gta03_voice
.hw_free = om_gta03_voice_hw_free,
};
-static int om_gta03_set_stereo_out(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
+static int common_set_dapm(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol,
+ char *epname)
{
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
int val = ucontrol->value.integer.value[0];
@@ -240,133 +241,89 @@ static int om_gta03_set_stereo_out(struc
return 0;
}
-static int om_gta03_get_stereo_out(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
+static int common_get_dapm(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol,
+ char *name)
{
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
+ int val;
- ucontrol->value.integer.value[0] =
- snd_soc_dapm_get_endpoint(codec, "Stereo Out");
+ val = snd_soc_dapm_get_endpoint(codec, name);
+ ucontrol->value.integer.value[0] = val;
return 0;
}
+static int om_gta03_set_stereo_out(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ return common_set_dapm(kcontrol, ucontrol, "Stereo Out");
+}
+
+static int om_gta03_get_stereo_out(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ return common_get_dapm(kcontrol, ucontrol, "Stereo Out");
+}
static int om_gta03_set_gsm_out(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
- int val = ucontrol->value.integer.value[0];
-
- snd_soc_dapm_set_endpoint(codec, "GSM Line Out", val);
- snd_soc_dapm_sync(codec);
-
- return 0;
+ return common_set_dapm(kcontrol, ucontrol, "GSM Line Out");
}
static int om_gta03_get_gsm_out(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
-
- ucontrol->value.integer.value[0] =
- snd_soc_dapm_get_endpoint(codec, "GSM Line Out");
-
- return 0;
+ return common_get_dapm(kcontrol, ucontrol, "GSM Line Out");
}
static int om_gta03_set_gsm_in(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
- int val = ucontrol->value.integer.value[0];
-
- snd_soc_dapm_set_endpoint(codec, "GSM Line In", val);
- snd_soc_dapm_sync(codec);
-
- return 0;
+ return common_set_dapm(kcontrol, ucontrol, "GSM Line In");
}
static int om_gta03_get_gsm_in(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
-
- ucontrol->value.integer.value[0] =
- snd_soc_dapm_get_endpoint(codec, "GSM Line In");
-
- return 0;
+ return common_get_dapm(kcontrol, ucontrol, "GSM Line In");
}
static int om_gta03_set_headset_mic(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
- int val = ucontrol->value.integer.value[0];
-
- snd_soc_dapm_set_endpoint(codec, "Headset Mic", val);
- snd_soc_dapm_sync(codec);
-
- return 0;
+ return common_set_dapm(kcontrol, ucontrol, "Headset Mic");
}
static int om_gta03_get_headset_mic(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
-
- ucontrol->value.integer.value[0] =
- snd_soc_dapm_get_endpoint(codec, "Headset Mic");
-
- return 0;
+ return common_get_dapm(kcontrol, ucontrol, "Headset Mic");
}
static int om_gta03_set_handset_mic(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
- int val = ucontrol->value.integer.value[0];
-
- snd_soc_dapm_set_endpoint(codec, "Handset Mic", val);
-
- snd_soc_dapm_sync(codec);
-
- return 0;
+ return common_set_dapm(kcontrol, ucontrol, "Handset Mic");
}
static int om_gta03_get_handset_mic(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
-
- ucontrol->value.integer.value[0] =
- snd_soc_dapm_get_endpoint(codec, "Handset Mic");
-
- return 0;
+ return common_get_dapm(kcontrol, ucontrol, "Handset Mic");
}
static int om_gta03_set_handset_spk(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
- int val = ucontrol->value.integer.value[0];
-
- snd_soc_dapm_set_endpoint(codec, "Handset Spk", val);
-
- snd_soc_dapm_sync(codec);
-
- return 0;
+ return common_set_dapm(kcontrol, ucontrol, "Handset Spk");
}
static int om_gta03_get_handset_spk(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
-
- ucontrol->value.integer.value[0] =
- snd_soc_dapm_get_endpoint(codec, "Handset Spk");
-
- return 0;
+ return common_get_dapm(kcontrol, ucontrol, "Handset Spk");
}
static const struct snd_soc_dapm_widget wm8753_dapm_widgets[] = {
--
Ben (ben@fluff.org, http://www.fluff.org/)
'a smiley only costs 4 bytes'
Diffstat (limited to 'sound/soc/s3c24xx/Makefile')
0 files changed, 0 insertions, 0 deletions