diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-31 23:16:28 (GMT) |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-31 23:16:28 (GMT) |
commit | e1a9c9872dd004617555dff079b357a6ffd945e9 (patch) | |
tree | c34779e59712ff345f8e4ee97e74086a85b34974 /sound/pci/ice1712/hoontech.c | |
parent | fcc3ff4f9d695a80dc6e6058e0d631a3026ed4c3 (diff) | |
parent | 2ecba4ffbbc6c85fce8c3878514be415edace413 (diff) | |
download | linux-fsl-qoriq-e1a9c9872dd004617555dff079b357a6ffd945e9.tar.xz |
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/perex/alsa
* 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/perex/alsa: (299 commits)
[ALSA] version 1.0.16rc2
[ALSA] hda: fix Mic in as output
[ALSA] emu10k1 - Another EMU0404 Board ID
[ALSA] emu10k1 - Fix kthread handling at resume
[ALSA] emu10k1: General cleanup, add new locks, fix alsa bug#3501, kernel bug#9304.
[ALSA] emu10k1 - Use enum for emu_model types
[ALSA] emu10k1 - Don't create emu1010 controls for non-emu boards
[ALSA] emu10k1 - 1616(M) cardbus improvements
[ALSA] snd:emu10k1: E-Mu updates. Fixes to firmware loading and support for 0404.
[ALSA] emu10k1: Add comments regarding E-Mu ins and outs.
[ALSA] oxygen: revert SPI clock frequency change for AK4396/WM8785
[ALSA] es1938 - improve capture hw pointer reads
[ALSA] HDA-Intel - Add support for Intel SCH
[ALSA] hda: Add GPIO mute support to STAC9205
[ALSA] hda-codec - Add Dell T3400 support
[ALSA] hda-codec - Add model for HP DV9553EG laptop
[ALSA] hda-codec - Control SPDIF as slave
[ALSA] hda_intel: ALSA HD Audio patch for Intel ICH10 DeviceID's
[ALSA] Fix Oops with PCM OSS sync
[ALSA] hda-codec - Add speaker automute to ALC262 HP models
...
Diffstat (limited to 'sound/pci/ice1712/hoontech.c')
-rw-r--r-- | sound/pci/ice1712/hoontech.c | 188 |
1 files changed, 103 insertions, 85 deletions
diff --git a/sound/pci/ice1712/hoontech.c b/sound/pci/ice1712/hoontech.c index abcfd1d..cf5c7c0 100644 --- a/sound/pci/ice1712/hoontech.c +++ b/sound/pci/ice1712/hoontech.c @@ -21,7 +21,6 @@ * */ -#include <sound/driver.h> #include <asm/io.h> #include <linux/delay.h> #include <linux/interrupt.h> @@ -34,6 +33,12 @@ #include "ice1712.h" #include "hoontech.h" +/* Hoontech-specific setting */ +struct hoontech_spec { + unsigned char boxbits[4]; + unsigned int config; + unsigned short boxconfig[4]; +}; static void __devinit snd_ice1712_stdsp24_gpio_write(struct snd_ice1712 *ice, unsigned char byte) { @@ -50,169 +55,182 @@ static void __devinit snd_ice1712_stdsp24_gpio_write(struct snd_ice1712 *ice, un static void __devinit snd_ice1712_stdsp24_darear(struct snd_ice1712 *ice, int activate) { + struct hoontech_spec *spec = ice->spec; mutex_lock(&ice->gpio_mutex); - ICE1712_STDSP24_0_DAREAR(ice->spec.hoontech.boxbits, activate); - snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[0]); + ICE1712_STDSP24_0_DAREAR(spec->boxbits, activate); + snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[0]); mutex_unlock(&ice->gpio_mutex); } static void __devinit snd_ice1712_stdsp24_mute(struct snd_ice1712 *ice, int activate) { + struct hoontech_spec *spec = ice->spec; mutex_lock(&ice->gpio_mutex); - ICE1712_STDSP24_3_MUTE(ice->spec.hoontech.boxbits, activate); - snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[3]); + ICE1712_STDSP24_3_MUTE(spec->boxbits, activate); + snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[3]); mutex_unlock(&ice->gpio_mutex); } static void __devinit snd_ice1712_stdsp24_insel(struct snd_ice1712 *ice, int activate) { + struct hoontech_spec *spec = ice->spec; mutex_lock(&ice->gpio_mutex); - ICE1712_STDSP24_3_INSEL(ice->spec.hoontech.boxbits, activate); - snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[3]); + ICE1712_STDSP24_3_INSEL(spec->boxbits, activate); + snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[3]); mutex_unlock(&ice->gpio_mutex); } static void __devinit snd_ice1712_stdsp24_box_channel(struct snd_ice1712 *ice, int box, int chn, int activate) { + struct hoontech_spec *spec = ice->spec; + mutex_lock(&ice->gpio_mutex); /* select box */ - ICE1712_STDSP24_0_BOX(ice->spec.hoontech.boxbits, box); - snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[0]); + ICE1712_STDSP24_0_BOX(spec->boxbits, box); + snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[0]); /* prepare for write */ if (chn == 3) - ICE1712_STDSP24_2_CHN4(ice->spec.hoontech.boxbits, 0); - ICE1712_STDSP24_2_MIDI1(ice->spec.hoontech.boxbits, activate); - snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[2]); - snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[3]); - - ICE1712_STDSP24_1_CHN1(ice->spec.hoontech.boxbits, 1); - ICE1712_STDSP24_1_CHN2(ice->spec.hoontech.boxbits, 1); - ICE1712_STDSP24_1_CHN3(ice->spec.hoontech.boxbits, 1); - ICE1712_STDSP24_2_CHN4(ice->spec.hoontech.boxbits, 1); - snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[1]); - snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[2]); + ICE1712_STDSP24_2_CHN4(spec->boxbits, 0); + ICE1712_STDSP24_2_MIDI1(spec->boxbits, activate); + snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[2]); + snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[3]); + + ICE1712_STDSP24_1_CHN1(spec->boxbits, 1); + ICE1712_STDSP24_1_CHN2(spec->boxbits, 1); + ICE1712_STDSP24_1_CHN3(spec->boxbits, 1); + ICE1712_STDSP24_2_CHN4(spec->boxbits, 1); + snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[1]); + snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[2]); udelay(100); if (chn == 3) { - ICE1712_STDSP24_2_CHN4(ice->spec.hoontech.boxbits, 0); - snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[2]); + ICE1712_STDSP24_2_CHN4(spec->boxbits, 0); + snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[2]); } else { switch (chn) { - case 0: ICE1712_STDSP24_1_CHN1(ice->spec.hoontech.boxbits, 0); break; - case 1: ICE1712_STDSP24_1_CHN2(ice->spec.hoontech.boxbits, 0); break; - case 2: ICE1712_STDSP24_1_CHN3(ice->spec.hoontech.boxbits, 0); break; + case 0: ICE1712_STDSP24_1_CHN1(spec->boxbits, 0); break; + case 1: ICE1712_STDSP24_1_CHN2(spec->boxbits, 0); break; + case 2: ICE1712_STDSP24_1_CHN3(spec->boxbits, 0); break; } - snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[1]); + snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[1]); } udelay(100); - ICE1712_STDSP24_1_CHN1(ice->spec.hoontech.boxbits, 1); - ICE1712_STDSP24_1_CHN2(ice->spec.hoontech.boxbits, 1); - ICE1712_STDSP24_1_CHN3(ice->spec.hoontech.boxbits, 1); - ICE1712_STDSP24_2_CHN4(ice->spec.hoontech.boxbits, 1); - snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[1]); - snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[2]); + ICE1712_STDSP24_1_CHN1(spec->boxbits, 1); + ICE1712_STDSP24_1_CHN2(spec->boxbits, 1); + ICE1712_STDSP24_1_CHN3(spec->boxbits, 1); + ICE1712_STDSP24_2_CHN4(spec->boxbits, 1); + snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[1]); + snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[2]); udelay(100); - ICE1712_STDSP24_2_MIDI1(ice->spec.hoontech.boxbits, 0); - snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[2]); + ICE1712_STDSP24_2_MIDI1(spec->boxbits, 0); + snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[2]); mutex_unlock(&ice->gpio_mutex); } static void __devinit snd_ice1712_stdsp24_box_midi(struct snd_ice1712 *ice, int box, int master) { + struct hoontech_spec *spec = ice->spec; + mutex_lock(&ice->gpio_mutex); /* select box */ - ICE1712_STDSP24_0_BOX(ice->spec.hoontech.boxbits, box); - snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[0]); + ICE1712_STDSP24_0_BOX(spec->boxbits, box); + snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[0]); - ICE1712_STDSP24_2_MIDIIN(ice->spec.hoontech.boxbits, 1); - ICE1712_STDSP24_2_MIDI1(ice->spec.hoontech.boxbits, master); - snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[2]); - snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[3]); + ICE1712_STDSP24_2_MIDIIN(spec->boxbits, 1); + ICE1712_STDSP24_2_MIDI1(spec->boxbits, master); + snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[2]); + snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[3]); udelay(100); - ICE1712_STDSP24_2_MIDIIN(ice->spec.hoontech.boxbits, 0); - snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[2]); + ICE1712_STDSP24_2_MIDIIN(spec->boxbits, 0); + snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[2]); mdelay(10); - ICE1712_STDSP24_2_MIDIIN(ice->spec.hoontech.boxbits, 1); - snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[2]); + ICE1712_STDSP24_2_MIDIIN(spec->boxbits, 1); + snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[2]); mutex_unlock(&ice->gpio_mutex); } static void __devinit snd_ice1712_stdsp24_midi2(struct snd_ice1712 *ice, int activate) { + struct hoontech_spec *spec = ice->spec; mutex_lock(&ice->gpio_mutex); - ICE1712_STDSP24_3_MIDI2(ice->spec.hoontech.boxbits, activate); - snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[3]); + ICE1712_STDSP24_3_MIDI2(spec->boxbits, activate); + snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[3]); mutex_unlock(&ice->gpio_mutex); } static int __devinit snd_ice1712_hoontech_init(struct snd_ice1712 *ice) { + struct hoontech_spec *spec; int box, chn; ice->num_total_dacs = 8; ice->num_total_adcs = 8; - ice->spec.hoontech.boxbits[0] = - ice->spec.hoontech.boxbits[1] = - ice->spec.hoontech.boxbits[2] = - ice->spec.hoontech.boxbits[3] = 0; /* should be already */ - - ICE1712_STDSP24_SET_ADDR(ice->spec.hoontech.boxbits, 0); - ICE1712_STDSP24_CLOCK(ice->spec.hoontech.boxbits, 0, 1); - ICE1712_STDSP24_0_BOX(ice->spec.hoontech.boxbits, 0); - ICE1712_STDSP24_0_DAREAR(ice->spec.hoontech.boxbits, 0); - - ICE1712_STDSP24_SET_ADDR(ice->spec.hoontech.boxbits, 1); - ICE1712_STDSP24_CLOCK(ice->spec.hoontech.boxbits, 1, 1); - ICE1712_STDSP24_1_CHN1(ice->spec.hoontech.boxbits, 1); - ICE1712_STDSP24_1_CHN2(ice->spec.hoontech.boxbits, 1); - ICE1712_STDSP24_1_CHN3(ice->spec.hoontech.boxbits, 1); + spec = kzalloc(sizeof(*spec), GFP_KERNEL); + if (!spec) + return -ENOMEM; + ice->spec = spec; + + ICE1712_STDSP24_SET_ADDR(spec->boxbits, 0); + ICE1712_STDSP24_CLOCK(spec->boxbits, 0, 1); + ICE1712_STDSP24_0_BOX(spec->boxbits, 0); + ICE1712_STDSP24_0_DAREAR(spec->boxbits, 0); + + ICE1712_STDSP24_SET_ADDR(spec->boxbits, 1); + ICE1712_STDSP24_CLOCK(spec->boxbits, 1, 1); + ICE1712_STDSP24_1_CHN1(spec->boxbits, 1); + ICE1712_STDSP24_1_CHN2(spec->boxbits, 1); + ICE1712_STDSP24_1_CHN3(spec->boxbits, 1); - ICE1712_STDSP24_SET_ADDR(ice->spec.hoontech.boxbits, 2); - ICE1712_STDSP24_CLOCK(ice->spec.hoontech.boxbits, 2, 1); - ICE1712_STDSP24_2_CHN4(ice->spec.hoontech.boxbits, 1); - ICE1712_STDSP24_2_MIDIIN(ice->spec.hoontech.boxbits, 1); - ICE1712_STDSP24_2_MIDI1(ice->spec.hoontech.boxbits, 0); - - ICE1712_STDSP24_SET_ADDR(ice->spec.hoontech.boxbits, 3); - ICE1712_STDSP24_CLOCK(ice->spec.hoontech.boxbits, 3, 1); - ICE1712_STDSP24_3_MIDI2(ice->spec.hoontech.boxbits, 0); - ICE1712_STDSP24_3_MUTE(ice->spec.hoontech.boxbits, 1); - ICE1712_STDSP24_3_INSEL(ice->spec.hoontech.boxbits, 0); + ICE1712_STDSP24_SET_ADDR(spec->boxbits, 2); + ICE1712_STDSP24_CLOCK(spec->boxbits, 2, 1); + ICE1712_STDSP24_2_CHN4(spec->boxbits, 1); + ICE1712_STDSP24_2_MIDIIN(spec->boxbits, 1); + ICE1712_STDSP24_2_MIDI1(spec->boxbits, 0); + + ICE1712_STDSP24_SET_ADDR(spec->boxbits, 3); + ICE1712_STDSP24_CLOCK(spec->boxbits, 3, 1); + ICE1712_STDSP24_3_MIDI2(spec->boxbits, 0); + ICE1712_STDSP24_3_MUTE(spec->boxbits, 1); + ICE1712_STDSP24_3_INSEL(spec->boxbits, 0); /* let's go - activate only functions in first box */ - ice->spec.hoontech.config = 0; + spec->config = 0; /* ICE1712_STDSP24_MUTE | ICE1712_STDSP24_INSEL | ICE1712_STDSP24_DAREAR; */ - ice->spec.hoontech.boxconfig[0] = ICE1712_STDSP24_BOX_CHN1 | + spec->boxconfig[0] = ICE1712_STDSP24_BOX_CHN1 | ICE1712_STDSP24_BOX_CHN2 | ICE1712_STDSP24_BOX_CHN3 | ICE1712_STDSP24_BOX_CHN4 | ICE1712_STDSP24_BOX_MIDI1 | ICE1712_STDSP24_BOX_MIDI2; - ice->spec.hoontech.boxconfig[1] = - ice->spec.hoontech.boxconfig[2] = - ice->spec.hoontech.boxconfig[3] = 0; - snd_ice1712_stdsp24_darear(ice, (ice->spec.hoontech.config & ICE1712_STDSP24_DAREAR) ? 1 : 0); - snd_ice1712_stdsp24_mute(ice, (ice->spec.hoontech.config & ICE1712_STDSP24_MUTE) ? 1 : 0); - snd_ice1712_stdsp24_insel(ice, (ice->spec.hoontech.config & ICE1712_STDSP24_INSEL) ? 1 : 0); - for (box = 0; box < 4; box++) { + spec->boxconfig[1] = + spec->boxconfig[2] = + spec->boxconfig[3] = 0; + snd_ice1712_stdsp24_darear(ice, + (spec->config & ICE1712_STDSP24_DAREAR) ? 1 : 0); + snd_ice1712_stdsp24_mute(ice, + (spec->config & ICE1712_STDSP24_MUTE) ? 1 : 0); + snd_ice1712_stdsp24_insel(ice, + (spec->config & ICE1712_STDSP24_INSEL) ? 1 : 0); + for (box = 0; box < 1; box++) { + if (spec->boxconfig[box] & ICE1712_STDSP24_BOX_MIDI2) + snd_ice1712_stdsp24_midi2(ice, 1); for (chn = 0; chn < 4; chn++) - snd_ice1712_stdsp24_box_channel(ice, box, chn, (ice->spec.hoontech.boxconfig[box] & (1 << chn)) ? 1 : 0); + snd_ice1712_stdsp24_box_channel(ice, box, chn, + (spec->boxconfig[box] & (1 << chn)) ? 1 : 0); snd_ice1712_stdsp24_box_midi(ice, box, - (ice->spec.hoontech.boxconfig[box] & ICE1712_STDSP24_BOX_MIDI1) ? 1 : 0); - if (ice->spec.hoontech.boxconfig[box] & ICE1712_STDSP24_BOX_MIDI2) - snd_ice1712_stdsp24_midi2(ice, 1); + (spec->boxconfig[box] & ICE1712_STDSP24_BOX_MIDI1) ? 1 : 0); } return 0; |