From 775c199e6af5e4212bfa7ebeadee09563c14694b Mon Sep 17 00:00:00 2001 From: Karsten Wiese Date: Tue, 22 Apr 2008 12:52:45 +0200 Subject: [ALSA] Don't set gpio mask register in snd_ice1712_gpio_write_bits() Some calls to snd_ice1712_gpio_write() go wrong, if snd_ice1712_gpio_write_bits() ran before and changed the gpio mask register. Read the actual gpio value and combine it with the to be set bits in the cpu instead. Signed-off-by: Karsten Wiese Signed-off-by: Takashi Iwai --- sound/pci/ice1712/ice1712.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/pci/ice1712/ice1712.h b/sound/pci/ice1712/ice1712.h index a3bea2247c7..3208901c740 100644 --- a/sound/pci/ice1712/ice1712.h +++ b/sound/pci/ice1712/ice1712.h @@ -438,10 +438,14 @@ int snd_ice1712_gpio_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_valu static inline void snd_ice1712_gpio_write_bits(struct snd_ice1712 *ice, unsigned int mask, unsigned int bits) { + unsigned val; + ice->gpio.direction |= mask; snd_ice1712_gpio_set_dir(ice, ice->gpio.direction); - snd_ice1712_gpio_set_mask(ice, ~mask); - snd_ice1712_gpio_write(ice, mask & bits); + val = snd_ice1712_gpio_read(ice); + val &= ~mask; + val |= mask & bits; + snd_ice1712_gpio_write(ice, val); } static inline int snd_ice1712_gpio_read_bits(struct snd_ice1712 *ice, -- cgit v1.2.3