summaryrefslogtreecommitdiff
path: root/sound/pci/hda/patch_realtek.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2018-06-19 23:28:22 +0300
committerTakashi Iwai <tiwai@suse.de>2018-06-25 11:04:22 +0300
commitaaf312de4eb915e5b45c65c2da7304bf34b5ab47 (patch)
treee2abac2dd460f4b9aa781d86529bd402b7bda59a /sound/pci/hda/patch_realtek.c
parent5579cd6f6629bc1e09b3b2d13ab7a1ed371c5ac2 (diff)
downloadlinux-aaf312de4eb915e5b45c65c2da7304bf34b5ab47.tar.xz
ALSA: hda/realtek - Add GPIO data update helper
For updating GPIO bits dynamically, provide a new helper, and use it from the alc260 automute hook. This helper will be used by other places in future, too. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r--sound/pci/hda/patch_realtek.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 489075b23652..bd54d9e25440 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -241,6 +241,20 @@ static void alc_write_gpio_data(struct hda_codec *codec)
spec->gpio_data);
}
+static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
+ bool on)
+{
+ struct alc_spec *spec = codec->spec;
+ unsigned int oldval = spec->gpio_data;
+
+ if (on)
+ spec->gpio_data |= mask;
+ else
+ spec->gpio_data &= ~mask;
+ if (oldval != spec->gpio_data)
+ alc_write_gpio_data(codec);
+}
+
static void alc_write_gpio(struct hda_codec *codec)
{
struct alc_spec *spec = codec->spec;
@@ -1577,8 +1591,8 @@ enum {
static void alc260_gpio1_automute(struct hda_codec *codec)
{
struct alc_spec *spec = codec->spec;
- snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
- spec->gen.hp_jack_present);
+
+ alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
}
static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,