Skip to content

Commit

Permalink
[ALSA] Don't set gpio mask register in snd_ice1712_gpio_write_bits()
Browse files Browse the repository at this point in the history
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 <fzu@wemgehoertderstaat.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Karsten Wiese authored and Takashi Iwai committed Apr 24, 2008
1 parent 988f066 commit 775c199
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions sound/pci/ice1712/ice1712.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 775c199

Please sign in to comment.