diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-01-22 10:59:20 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-01-22 10:59:20 -0500 |
commit | 8ce8419829998c91b33200894a0db5e1441d6952 (patch) | |
tree | 3986941b723f18eae860decf8e7ac3a41d2109c8 /sound/pci/hda/patch_sigmatel.c | |
parent | 1eaf5c0716d53d3f64da62a09682b1f5ae912ac2 (diff) |
ALSA: hda - Avoid to set the pin control again if already set
Check the present pin control bit and avoid the write if it's already
set in patch_sigmatel.c. This will reduce the number of verb execs at
jack plugging.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_sigmatel.c')
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 0fa6c593d1d3..11634a4478ea 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -4126,7 +4126,9 @@ static void stac92xx_free(struct hda_codec *codec) | |||
4126 | static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid, | 4126 | static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid, |
4127 | unsigned int flag) | 4127 | unsigned int flag) |
4128 | { | 4128 | { |
4129 | unsigned int pin_ctl = snd_hda_codec_read(codec, nid, | 4129 | unsigned int old_ctl, pin_ctl; |
4130 | |||
4131 | pin_ctl = snd_hda_codec_read(codec, nid, | ||
4130 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); | 4132 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); |
4131 | 4133 | ||
4132 | if (pin_ctl & AC_PINCTL_IN_EN) { | 4134 | if (pin_ctl & AC_PINCTL_IN_EN) { |
@@ -4140,14 +4142,17 @@ static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid, | |||
4140 | return; | 4142 | return; |
4141 | } | 4143 | } |
4142 | 4144 | ||
4145 | old_ctl = pin_ctl; | ||
4143 | /* if setting pin direction bits, clear the current | 4146 | /* if setting pin direction bits, clear the current |
4144 | direction bits first */ | 4147 | direction bits first */ |
4145 | if (flag & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)) | 4148 | if (flag & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)) |
4146 | pin_ctl &= ~(AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN); | 4149 | pin_ctl &= ~(AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN); |
4147 | 4150 | ||
4148 | snd_hda_codec_write_cache(codec, nid, 0, | 4151 | pin_ctl |= flag; |
4149 | AC_VERB_SET_PIN_WIDGET_CONTROL, | 4152 | if (old_ctl != pin_ctl) |
4150 | pin_ctl | flag); | 4153 | snd_hda_codec_write_cache(codec, nid, 0, |
4154 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
4155 | pin_ctl); | ||
4151 | } | 4156 | } |
4152 | 4157 | ||
4153 | static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid, | 4158 | static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid, |
@@ -4155,9 +4160,10 @@ static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid, | |||
4155 | { | 4160 | { |
4156 | unsigned int pin_ctl = snd_hda_codec_read(codec, nid, | 4161 | unsigned int pin_ctl = snd_hda_codec_read(codec, nid, |
4157 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); | 4162 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); |
4158 | snd_hda_codec_write_cache(codec, nid, 0, | 4163 | if (pin_ctl & flag) |
4159 | AC_VERB_SET_PIN_WIDGET_CONTROL, | 4164 | snd_hda_codec_write_cache(codec, nid, 0, |
4160 | pin_ctl & ~flag); | 4165 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
4166 | pin_ctl & ~flag); | ||
4161 | } | 4167 | } |
4162 | 4168 | ||
4163 | static int get_pin_presence(struct hda_codec *codec, hda_nid_t nid) | 4169 | static int get_pin_presence(struct hda_codec *codec, hda_nid_t nid) |