summaryrefslogtreecommitdiff
path: root/sound/pci/hda/patch_analog.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-12-08 17:23:33 +0100
committerTakashi Iwai <tiwai@suse.de>2009-12-08 17:23:33 +0100
commitee6e365e30f7ee89bd214ff1215aaf90e93d4c40 (patch)
tree2e10a2e43bebaa1c0c818cb9c09b2c912b6d1664 /sound/pci/hda/patch_analog.c
parentd11f74c62fb4a1fefd39085570fb6dfa7b9ab2bb (diff)
ALSA: hda - Generalize EAPD inversion check in patch_analog.c
Add a flag to spec field so that the EAPD inversion can be checked outside the relevant control callbacks. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_analog.c')
-rw-r--r--sound/pci/hda/patch_analog.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 455a0494f907..447eda1f6770 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -72,7 +72,8 @@ struct ad198x_spec {
hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
unsigned int jack_present :1;
- unsigned int inv_jack_detect:1;
+ unsigned int inv_jack_detect:1; /* inverted jack-detection */
+ unsigned int inv_eapd:1; /* inverted EAPD implementation */
#ifdef CONFIG_SND_HDA_POWER_SAVE
struct hda_loopback_check loopback;
@@ -458,7 +459,7 @@ static struct hda_codec_ops ad198x_patch_ops = {
/*
* EAPD control
- * the private value = nid | (invert << 8)
+ * the private value = nid
*/
#define ad198x_eapd_info snd_ctl_boolean_mono_info
@@ -467,8 +468,7 @@ static int ad198x_eapd_get(struct snd_kcontrol *kcontrol,
{
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
struct ad198x_spec *spec = codec->spec;
- int invert = (kcontrol->private_value >> 8) & 1;
- if (invert)
+ if (spec->inv_eapd)
ucontrol->value.integer.value[0] = ! spec->cur_eapd;
else
ucontrol->value.integer.value[0] = spec->cur_eapd;
@@ -480,11 +480,10 @@ static int ad198x_eapd_put(struct snd_kcontrol *kcontrol,
{
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
struct ad198x_spec *spec = codec->spec;
- int invert = (kcontrol->private_value >> 8) & 1;
hda_nid_t nid = kcontrol->private_value & 0xff;
unsigned int eapd;
eapd = !!ucontrol->value.integer.value[0];
- if (invert)
+ if (spec->inv_eapd)
eapd = !eapd;
if (eapd == spec->cur_eapd)
return 0;
@@ -705,7 +704,7 @@ static struct snd_kcontrol_new ad1986a_laptop_eapd_mixers[] = {
.info = ad198x_eapd_info,
.get = ad198x_eapd_get,
.put = ad198x_eapd_put,
- .private_value = 0x1b | (1 << 8), /* port-D, inversed */
+ .private_value = 0x1b, /* port-D */
},
{ } /* end */
};
@@ -1074,6 +1073,7 @@ static int patch_ad1986a(struct hda_codec *codec)
spec->loopback.amplist = ad1986a_loopbacks;
#endif
spec->vmaster_nid = 0x1b;
+ spec->inv_eapd = 1; /* AD1986A has the inverted EAPD implementation */
codec->patch_ops = ad198x_patch_ops;
@@ -2124,7 +2124,7 @@ static struct snd_kcontrol_new ad1988_laptop_mixers[] = {
.info = ad198x_eapd_info,
.get = ad198x_eapd_get,
.put = ad198x_eapd_put,
- .private_value = 0x12 | (1 << 8), /* port-D, inversed */
+ .private_value = 0x12, /* port-D */
},
{ } /* end */
@@ -3065,6 +3065,7 @@ static int patch_ad1988(struct hda_codec *codec)
spec->input_mux = &ad1988_laptop_capture_source;
spec->num_mixers = 1;
spec->mixers[0] = ad1988_laptop_mixers;
+ spec->inv_eapd = 1; /* inverted EAPD */
spec->num_init_verbs = 1;
spec->init_verbs[0] = ad1988_laptop_init_verbs;
if (board_config == AD1988_LAPTOP_DIG)