diff options
author | Pavel Hofman <pavel.hofman@ivitera.com> | 2009-09-16 16:25:38 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-09-21 09:46:19 -0400 |
commit | 494703062b6e6ef5e72364aafc9bcbc172d53dea (patch) | |
tree | 146331d091b4dba7928244cd1a1ed3dbf0fbad9d /sound | |
parent | 42cfa276aebd28e5cc4350ff6c7d75f1cb84dd98 (diff) |
ALSA: ice1724 - adding GPIO routines for mask and direction
* get/set routines for GPIO mask and direction
Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/ice1712/ice1712.c | 12 | ||||
-rw-r--r-- | sound/pci/ice1712/ice1712.h | 7 | ||||
-rw-r--r-- | sound/pci/ice1712/ice1724.c | 19 |
3 files changed, 38 insertions, 0 deletions
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c index cecf1ffeeaaa..56d8d67f1ac3 100644 --- a/sound/pci/ice1712/ice1712.c +++ b/sound/pci/ice1712/ice1712.c | |||
@@ -298,6 +298,16 @@ static void snd_ice1712_set_gpio_dir(struct snd_ice1712 *ice, unsigned int data) | |||
298 | inb(ICEREG(ice, DATA)); /* dummy read for pci-posting */ | 298 | inb(ICEREG(ice, DATA)); /* dummy read for pci-posting */ |
299 | } | 299 | } |
300 | 300 | ||
301 | static unsigned int snd_ice1712_get_gpio_dir(struct snd_ice1712 *ice) | ||
302 | { | ||
303 | return snd_ice1712_read(ice, ICE1712_IREG_GPIO_DIRECTION); | ||
304 | } | ||
305 | |||
306 | static unsigned int snd_ice1712_get_gpio_mask(struct snd_ice1712 *ice) | ||
307 | { | ||
308 | return snd_ice1712_read(ice, ICE1712_IREG_GPIO_WRITE_MASK); | ||
309 | } | ||
310 | |||
301 | static void snd_ice1712_set_gpio_mask(struct snd_ice1712 *ice, unsigned int data) | 311 | static void snd_ice1712_set_gpio_mask(struct snd_ice1712 *ice, unsigned int data) |
302 | { | 312 | { |
303 | snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, data); | 313 | snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, data); |
@@ -2557,7 +2567,9 @@ static int __devinit snd_ice1712_create(struct snd_card *card, | |||
2557 | mutex_init(&ice->i2c_mutex); | 2567 | mutex_init(&ice->i2c_mutex); |
2558 | mutex_init(&ice->open_mutex); | 2568 | mutex_init(&ice->open_mutex); |
2559 | ice->gpio.set_mask = snd_ice1712_set_gpio_mask; | 2569 | ice->gpio.set_mask = snd_ice1712_set_gpio_mask; |
2570 | ice->gpio.get_mask = snd_ice1712_get_gpio_mask; | ||
2560 | ice->gpio.set_dir = snd_ice1712_set_gpio_dir; | 2571 | ice->gpio.set_dir = snd_ice1712_set_gpio_dir; |
2572 | ice->gpio.get_dir = snd_ice1712_get_gpio_dir; | ||
2561 | ice->gpio.set_data = snd_ice1712_set_gpio_data; | 2573 | ice->gpio.set_data = snd_ice1712_set_gpio_data; |
2562 | ice->gpio.get_data = snd_ice1712_get_gpio_data; | 2574 | ice->gpio.get_data = snd_ice1712_get_gpio_data; |
2563 | 2575 | ||
diff --git a/sound/pci/ice1712/ice1712.h b/sound/pci/ice1712/ice1712.h index 9da2dae64c5b..b31a59d0625c 100644 --- a/sound/pci/ice1712/ice1712.h +++ b/sound/pci/ice1712/ice1712.h | |||
@@ -359,7 +359,9 @@ struct snd_ice1712 { | |||
359 | unsigned int saved[2]; /* for ewx_i2c */ | 359 | unsigned int saved[2]; /* for ewx_i2c */ |
360 | /* operators */ | 360 | /* operators */ |
361 | void (*set_mask)(struct snd_ice1712 *ice, unsigned int data); | 361 | void (*set_mask)(struct snd_ice1712 *ice, unsigned int data); |
362 | unsigned int (*get_mask)(struct snd_ice1712 *ice); | ||
362 | void (*set_dir)(struct snd_ice1712 *ice, unsigned int data); | 363 | void (*set_dir)(struct snd_ice1712 *ice, unsigned int data); |
364 | unsigned int (*get_dir)(struct snd_ice1712 *ice); | ||
363 | void (*set_data)(struct snd_ice1712 *ice, unsigned int data); | 365 | void (*set_data)(struct snd_ice1712 *ice, unsigned int data); |
364 | unsigned int (*get_data)(struct snd_ice1712 *ice); | 366 | unsigned int (*get_data)(struct snd_ice1712 *ice); |
365 | /* misc operators - move to another place? */ | 367 | /* misc operators - move to another place? */ |
@@ -399,6 +401,11 @@ static inline void snd_ice1712_gpio_set_dir(struct snd_ice1712 *ice, unsigned in | |||
399 | ice->gpio.set_dir(ice, bits); | 401 | ice->gpio.set_dir(ice, bits); |
400 | } | 402 | } |
401 | 403 | ||
404 | static inline unsigned int snd_ice1712_gpio_get_dir(struct snd_ice1712 *ice) | ||
405 | { | ||
406 | return ice->gpio.get_dir(ice); | ||
407 | } | ||
408 | |||
402 | static inline void snd_ice1712_gpio_set_mask(struct snd_ice1712 *ice, unsigned int bits) | 409 | static inline void snd_ice1712_gpio_set_mask(struct snd_ice1712 *ice, unsigned int bits) |
403 | { | 410 | { |
404 | ice->gpio.set_mask(ice, bits); | 411 | ice->gpio.set_mask(ice, bits); |
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index af6e00148621..2213beec009a 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c | |||
@@ -196,6 +196,12 @@ static void snd_vt1724_set_gpio_dir(struct snd_ice1712 *ice, unsigned int data) | |||
196 | inw(ICEREG1724(ice, GPIO_DIRECTION)); /* dummy read for pci-posting */ | 196 | inw(ICEREG1724(ice, GPIO_DIRECTION)); /* dummy read for pci-posting */ |
197 | } | 197 | } |
198 | 198 | ||
199 | /* get gpio direction 0 = read, 1 = write */ | ||
200 | static unsigned int snd_vt1724_get_gpio_dir(struct snd_ice1712 *ice) | ||
201 | { | ||
202 | return inl(ICEREG1724(ice, GPIO_DIRECTION)); | ||
203 | } | ||
204 | |||
199 | /* set the gpio mask (0 = writable) */ | 205 | /* set the gpio mask (0 = writable) */ |
200 | static void snd_vt1724_set_gpio_mask(struct snd_ice1712 *ice, unsigned int data) | 206 | static void snd_vt1724_set_gpio_mask(struct snd_ice1712 *ice, unsigned int data) |
201 | { | 207 | { |
@@ -205,6 +211,17 @@ static void snd_vt1724_set_gpio_mask(struct snd_ice1712 *ice, unsigned int data) | |||
205 | inw(ICEREG1724(ice, GPIO_WRITE_MASK)); /* dummy read for pci-posting */ | 211 | inw(ICEREG1724(ice, GPIO_WRITE_MASK)); /* dummy read for pci-posting */ |
206 | } | 212 | } |
207 | 213 | ||
214 | static unsigned int snd_vt1724_get_gpio_mask(struct snd_ice1712 *ice) | ||
215 | { | ||
216 | unsigned int mask; | ||
217 | if (!ice->vt1720) | ||
218 | mask = (unsigned int)inb(ICEREG1724(ice, GPIO_WRITE_MASK_22)); | ||
219 | else | ||
220 | mask = 0; | ||
221 | mask = (mask << 16) | inw(ICEREG1724(ice, GPIO_WRITE_MASK)); | ||
222 | return mask; | ||
223 | } | ||
224 | |||
208 | static void snd_vt1724_set_gpio_data(struct snd_ice1712 *ice, unsigned int data) | 225 | static void snd_vt1724_set_gpio_data(struct snd_ice1712 *ice, unsigned int data) |
209 | { | 226 | { |
210 | outw(data, ICEREG1724(ice, GPIO_DATA)); | 227 | outw(data, ICEREG1724(ice, GPIO_DATA)); |
@@ -2434,7 +2451,9 @@ static int __devinit snd_vt1724_create(struct snd_card *card, | |||
2434 | mutex_init(&ice->open_mutex); | 2451 | mutex_init(&ice->open_mutex); |
2435 | mutex_init(&ice->i2c_mutex); | 2452 | mutex_init(&ice->i2c_mutex); |
2436 | ice->gpio.set_mask = snd_vt1724_set_gpio_mask; | 2453 | ice->gpio.set_mask = snd_vt1724_set_gpio_mask; |
2454 | ice->gpio.get_mask = snd_vt1724_get_gpio_mask; | ||
2437 | ice->gpio.set_dir = snd_vt1724_set_gpio_dir; | 2455 | ice->gpio.set_dir = snd_vt1724_set_gpio_dir; |
2456 | ice->gpio.get_dir = snd_vt1724_get_gpio_dir; | ||
2438 | ice->gpio.set_data = snd_vt1724_set_gpio_data; | 2457 | ice->gpio.set_data = snd_vt1724_set_gpio_data; |
2439 | ice->gpio.get_data = snd_vt1724_get_gpio_data; | 2458 | ice->gpio.get_data = snd_vt1724_get_gpio_data; |
2440 | ice->card = card; | 2459 | ice->card = card; |