diff options
Diffstat (limited to 'sound/pci/intel8x0m.c')
-rw-r--r-- | sound/pci/intel8x0m.c | 76 |
1 files changed, 2 insertions, 74 deletions
diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c index f655cf914060..bb758c77d211 100644 --- a/sound/pci/intel8x0m.c +++ b/sound/pci/intel8x0m.c | |||
@@ -35,7 +35,6 @@ | |||
35 | #include <sound/pcm.h> | 35 | #include <sound/pcm.h> |
36 | #include <sound/ac97_codec.h> | 36 | #include <sound/ac97_codec.h> |
37 | #include <sound/info.h> | 37 | #include <sound/info.h> |
38 | #include <sound/control.h> | ||
39 | #include <sound/initval.h> | 38 | #include <sound/initval.h> |
40 | 39 | ||
41 | MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); | 40 | MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); |
@@ -292,60 +291,9 @@ static struct pci_device_id snd_intel8x0m_ids[] = { | |||
292 | #endif | 291 | #endif |
293 | { 0, } | 292 | { 0, } |
294 | }; | 293 | }; |
295 | static int snd_intel8x0m_switch_default_get(snd_kcontrol_t *kcontrol, | ||
296 | snd_ctl_elem_value_t *ucontrol); | ||
297 | static int snd_intel8x0m_switch_default_put(snd_kcontrol_t *kcontrol, | ||
298 | snd_ctl_elem_value_t *ucontrol); | ||
299 | static int snd_intel8x0m_switch_default_info(snd_kcontrol_t *kcontrol, | ||
300 | snd_ctl_elem_info_t *uinfo); | ||
301 | |||
302 | #define PRIVATE_VALUE_INITIALIZER(r,m) (((r) & 0xffff) << 16 | ((m) & 0xffff)) | ||
303 | #define PRIVATE_VALUE_MASK(control) ((control)->private_value & 0xffff) | ||
304 | #define PRIVATE_VALUE_REG(control) (((control)->private_value >> 16) & 0xffff) | ||
305 | |||
306 | static snd_kcontrol_new_t snd_intel8x0m_mixer_switches[] __devinitdata = { | ||
307 | { .name = "Off-hook Switch", | ||
308 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
309 | .info = snd_intel8x0m_switch_default_info, | ||
310 | .get = snd_intel8x0m_switch_default_get, | ||
311 | .put = snd_intel8x0m_switch_default_put, | ||
312 | .private_value = PRIVATE_VALUE_INITIALIZER(AC97_GPIO_STATUS,AC97_GPIO_LINE1_OH) | ||
313 | } | ||
314 | }; | ||
315 | 294 | ||
316 | MODULE_DEVICE_TABLE(pci, snd_intel8x0m_ids); | 295 | MODULE_DEVICE_TABLE(pci, snd_intel8x0m_ids); |
317 | 296 | ||
318 | static int snd_intel8x0m_switch_default_info(snd_kcontrol_t *kcontrol, | ||
319 | snd_ctl_elem_info_t *uinfo) | ||
320 | { | ||
321 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; | ||
322 | uinfo->count = 1; | ||
323 | uinfo->value.integer.min = 0; | ||
324 | uinfo->value.integer.max = 1; | ||
325 | return 0; | ||
326 | } | ||
327 | |||
328 | static int snd_intel8x0m_switch_default_get(snd_kcontrol_t *kcontrol, | ||
329 | snd_ctl_elem_value_t *ucontrol) | ||
330 | { | ||
331 | unsigned short mask = PRIVATE_VALUE_MASK(kcontrol); | ||
332 | unsigned short reg = PRIVATE_VALUE_REG(kcontrol); | ||
333 | intel8x0_t *chip = snd_kcontrol_chip(kcontrol); | ||
334 | unsigned int status; | ||
335 | status = snd_ac97_read(chip->ac97, reg) & mask ? 1 : 0; | ||
336 | ucontrol->value.integer.value[0] = status; | ||
337 | return 0; | ||
338 | } | ||
339 | static int snd_intel8x0m_switch_default_put(snd_kcontrol_t *kcontrol, | ||
340 | snd_ctl_elem_value_t *ucontrol) | ||
341 | { | ||
342 | unsigned short mask = PRIVATE_VALUE_MASK(kcontrol); | ||
343 | unsigned short reg = PRIVATE_VALUE_REG(kcontrol); | ||
344 | intel8x0_t *chip = snd_kcontrol_chip(kcontrol); | ||
345 | unsigned short new_status = ucontrol->value.integer.value[0] ? mask : ~mask; | ||
346 | return snd_ac97_update_bits(chip->ac97, reg, | ||
347 | mask, new_status); | ||
348 | } | ||
349 | /* | 297 | /* |
350 | * Lowlevel I/O - busmaster | 298 | * Lowlevel I/O - busmaster |
351 | */ | 299 | */ |
@@ -700,21 +648,6 @@ static snd_pcm_uframes_t snd_intel8x0_pcm_pointer(snd_pcm_substream_t * substrea | |||
700 | return bytes_to_frames(substream->runtime, ptr); | 648 | return bytes_to_frames(substream->runtime, ptr); |
701 | } | 649 | } |
702 | 650 | ||
703 | static int snd_intel8x0m_pcm_trigger(snd_pcm_substream_t *substream, int cmd) | ||
704 | { | ||
705 | /* hook off/on on start/stop */ | ||
706 | /* Moved this to mixer control */ | ||
707 | switch (cmd) { | ||
708 | case SNDRV_PCM_TRIGGER_START: | ||
709 | break; | ||
710 | case SNDRV_PCM_TRIGGER_STOP: | ||
711 | break; | ||
712 | default: | ||
713 | return -EINVAL; | ||
714 | } | ||
715 | return snd_intel8x0_pcm_trigger(substream,cmd); | ||
716 | } | ||
717 | |||
718 | static int snd_intel8x0m_pcm_prepare(snd_pcm_substream_t * substream) | 651 | static int snd_intel8x0m_pcm_prepare(snd_pcm_substream_t * substream) |
719 | { | 652 | { |
720 | intel8x0_t *chip = snd_pcm_substream_chip(substream); | 653 | intel8x0_t *chip = snd_pcm_substream_chip(substream); |
@@ -810,7 +743,7 @@ static snd_pcm_ops_t snd_intel8x0m_playback_ops = { | |||
810 | .hw_params = snd_intel8x0_hw_params, | 743 | .hw_params = snd_intel8x0_hw_params, |
811 | .hw_free = snd_intel8x0_hw_free, | 744 | .hw_free = snd_intel8x0_hw_free, |
812 | .prepare = snd_intel8x0m_pcm_prepare, | 745 | .prepare = snd_intel8x0m_pcm_prepare, |
813 | .trigger = snd_intel8x0m_pcm_trigger, | 746 | .trigger = snd_intel8x0_pcm_trigger, |
814 | .pointer = snd_intel8x0_pcm_pointer, | 747 | .pointer = snd_intel8x0_pcm_pointer, |
815 | }; | 748 | }; |
816 | 749 | ||
@@ -821,7 +754,7 @@ static snd_pcm_ops_t snd_intel8x0m_capture_ops = { | |||
821 | .hw_params = snd_intel8x0_hw_params, | 754 | .hw_params = snd_intel8x0_hw_params, |
822 | .hw_free = snd_intel8x0_hw_free, | 755 | .hw_free = snd_intel8x0_hw_free, |
823 | .prepare = snd_intel8x0m_pcm_prepare, | 756 | .prepare = snd_intel8x0m_pcm_prepare, |
824 | .trigger = snd_intel8x0m_pcm_trigger, | 757 | .trigger = snd_intel8x0_pcm_trigger, |
825 | .pointer = snd_intel8x0_pcm_pointer, | 758 | .pointer = snd_intel8x0_pcm_pointer, |
826 | }; | 759 | }; |
827 | 760 | ||
@@ -949,7 +882,6 @@ static int __devinit snd_intel8x0_mixer(intel8x0_t *chip, int ac97_clock) | |||
949 | ac97_t *x97; | 882 | ac97_t *x97; |
950 | int err; | 883 | int err; |
951 | unsigned int glob_sta = 0; | 884 | unsigned int glob_sta = 0; |
952 | unsigned int idx; | ||
953 | static ac97_bus_ops_t ops = { | 885 | static ac97_bus_ops_t ops = { |
954 | .write = snd_intel8x0_codec_write, | 886 | .write = snd_intel8x0_codec_write, |
955 | .read = snd_intel8x0_codec_read, | 887 | .read = snd_intel8x0_codec_read, |
@@ -985,10 +917,6 @@ static int __devinit snd_intel8x0_mixer(intel8x0_t *chip, int ac97_clock) | |||
985 | chip->ichd[ICHD_MDMIN].ac97 = x97; | 917 | chip->ichd[ICHD_MDMIN].ac97 = x97; |
986 | chip->ichd[ICHD_MDMOUT].ac97 = x97; | 918 | chip->ichd[ICHD_MDMOUT].ac97 = x97; |
987 | } | 919 | } |
988 | for (idx = 0; idx < ARRAY_SIZE(snd_intel8x0m_mixer_switches); idx++) { | ||
989 | if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_intel8x0m_mixer_switches[idx], chip))) < 0) | ||
990 | goto __err; | ||
991 | } | ||
992 | 920 | ||
993 | chip->in_ac97_init = 0; | 921 | chip->in_ac97_init = 0; |
994 | return 0; | 922 | return 0; |