aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/ac97/ac97_codec.c2
-rw-r--r--sound/pci/ad1889.c2
-rw-r--r--sound/pci/ali5451/ali5451.c4
-rw-r--r--sound/pci/als300.c9
-rw-r--r--sound/pci/als4000.c2
-rw-r--r--sound/pci/asihpi/asihpi.c294
-rw-r--r--sound/pci/asihpi/hpi.h74
-rw-r--r--sound/pci/asihpi/hpi6000.c61
-rw-r--r--sound/pci/asihpi/hpi6000.h2
-rw-r--r--sound/pci/asihpi/hpi6205.c57
-rw-r--r--sound/pci/asihpi/hpi_internal.h115
-rw-r--r--sound/pci/asihpi/hpi_version.h32
-rw-r--r--sound/pci/asihpi/hpicmn.c32
-rw-r--r--sound/pci/asihpi/hpicmn.h13
-rw-r--r--sound/pci/asihpi/hpidebug.c2
-rw-r--r--sound/pci/asihpi/hpidebug.h2
-rw-r--r--sound/pci/asihpi/hpidspcd.c30
-rw-r--r--sound/pci/asihpi/hpidspcd.h4
-rw-r--r--sound/pci/asihpi/hpifunc.c10
-rw-r--r--sound/pci/asihpi/hpimsginit.c2
-rw-r--r--sound/pci/asihpi/hpimsginit.h2
-rw-r--r--sound/pci/asihpi/hpimsgx.c3
-rw-r--r--sound/pci/asihpi/hpimsgx.h2
-rw-r--r--sound/pci/asihpi/hpioctl.c63
-rw-r--r--sound/pci/asihpi/hpioctl.h2
-rw-r--r--sound/pci/asihpi/hpios.c2
-rw-r--r--sound/pci/asihpi/hpios.h16
-rw-r--r--sound/pci/asihpi/hpipcida.h2
-rw-r--r--sound/pci/atiixp.c4
-rw-r--r--sound/pci/atiixp_modem.c2
-rw-r--r--sound/pci/au88x0/au88x0.c2
-rw-r--r--sound/pci/au88x0/au88x0_core.c10
-rw-r--r--sound/pci/au88x0/au88x0_pcm.c7
-rw-r--r--sound/pci/au88x0/au88x0_xtalk.c151
-rw-r--r--sound/pci/aw2/aw2-alsa.c2
-rw-r--r--sound/pci/azt3328.c2
-rw-r--r--sound/pci/bt87x.c4
-rw-r--r--sound/pci/ca0106/ca0106_main.c2
-rw-r--r--sound/pci/cmipci.c4
-rw-r--r--sound/pci/cs4281.c4
-rw-r--r--sound/pci/cs46xx/cs46xx.c8
-rw-r--r--sound/pci/cs5530.c9
-rw-r--r--sound/pci/cs5535audio/cs5535audio.c2
-rw-r--r--sound/pci/cs5535audio/cs5535audio_pcm.c2
-rw-r--r--sound/pci/ctxfi/ctsrc.c2
-rw-r--r--sound/pci/ctxfi/cttimer.c4
-rw-r--r--sound/pci/ctxfi/xfi.c2
-rw-r--r--sound/pci/echoaudio/echoaudio.c2
-rw-r--r--sound/pci/emu10k1/emu10k1.c4
-rw-r--r--sound/pci/emu10k1/emu10k1_main.c12
-rw-r--r--sound/pci/emu10k1/emu10k1x.c2
-rw-r--r--sound/pci/ens1370.c4
-rw-r--r--sound/pci/es1938.c2
-rw-r--r--sound/pci/es1968.c4
-rw-r--r--sound/pci/fm801.c2
-rw-r--r--sound/pci/hda/hda_codec.c6
-rw-r--r--sound/pci/hda/hda_eld.c28
-rw-r--r--sound/pci/hda/hda_intel.c9
-rw-r--r--sound/pci/hda/patch_cirrus.c32
-rw-r--r--sound/pci/hda/patch_hdmi.c16
-rw-r--r--sound/pci/hda/patch_realtek.c34
-rw-r--r--sound/pci/hda/patch_sigmatel.c24
-rw-r--r--sound/pci/hda/patch_via.c76
-rw-r--r--sound/pci/ice1712/amp.c7
-rw-r--r--sound/pci/ice1712/envy24ht.h1
-rw-r--r--sound/pci/ice1712/ice1712.c4
-rw-r--r--sound/pci/ice1712/ice1724.c65
-rw-r--r--sound/pci/intel8x0.c6
-rw-r--r--sound/pci/intel8x0m.c2
-rw-r--r--sound/pci/korg1212/korg1212.c2
-rw-r--r--sound/pci/lola/lola.c2
-rw-r--r--sound/pci/lx6464es/lx6464es.c2
-rw-r--r--sound/pci/lx6464es/lx_core.c23
-rw-r--r--sound/pci/lx6464es/lx_core.h3
-rw-r--r--sound/pci/maestro3.c4
-rw-r--r--sound/pci/mixart/mixart.c2
-rw-r--r--sound/pci/nm256/nm256.c12
-rw-r--r--sound/pci/oxygen/oxygen.c2
-rw-r--r--sound/pci/oxygen/virtuoso.c2
-rw-r--r--sound/pci/oxygen/xonar_cs43xx.c1
-rw-r--r--sound/pci/oxygen/xonar_dg.c3
-rw-r--r--sound/pci/oxygen/xonar_wm87x6.c6
-rw-r--r--sound/pci/pcxhr/pcxhr.c4
-rw-r--r--sound/pci/riptide/riptide.c2
-rw-r--r--sound/pci/rme32.c4
-rw-r--r--sound/pci/rme96.c2
-rw-r--r--sound/pci/rme9652/hdsp.c5
-rw-r--r--sound/pci/rme9652/hdspm.c34
-rw-r--r--sound/pci/rme9652/rme9652.c4
-rw-r--r--sound/pci/sis7019.c89
-rw-r--r--sound/pci/sonicvibes.c6
-rw-r--r--sound/pci/trident/trident.c2
-rw-r--r--sound/pci/via82xx.c4
-rw-r--r--sound/pci/via82xx_modem.c2
-rw-r--r--sound/pci/vx222/vx222.c4
-rw-r--r--sound/pci/ymfpci/ymfpci.c4
96 files changed, 903 insertions, 733 deletions
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index fac51eef2725..9473fca9681d 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -42,7 +42,7 @@ MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>");
42MODULE_DESCRIPTION("Universal interface for Audio Codec '97"); 42MODULE_DESCRIPTION("Universal interface for Audio Codec '97");
43MODULE_LICENSE("GPL"); 43MODULE_LICENSE("GPL");
44 44
45static int enable_loopback; 45static bool enable_loopback;
46 46
47module_param(enable_loopback, bool, 0444); 47module_param(enable_loopback, bool, 0444);
48MODULE_PARM_DESC(enable_loopback, "Enable AC97 ADC/DAC Loopback Control"); 48MODULE_PARM_DESC(enable_loopback, "Enable AC97 ADC/DAC Loopback Control");
diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c
index 6e311184bb10..9d91d61902b4 100644
--- a/sound/pci/ad1889.c
+++ b/sound/pci/ad1889.c
@@ -66,7 +66,7 @@ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
66module_param_array(id, charp, NULL, 0444); 66module_param_array(id, charp, NULL, 0444);
67MODULE_PARM_DESC(id, "ID string for the AD1889 soundcard."); 67MODULE_PARM_DESC(id, "ID string for the AD1889 soundcard.");
68 68
69static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 69static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
70module_param_array(enable, bool, NULL, 0444); 70module_param_array(enable, bool, NULL, 0444);
71MODULE_PARM_DESC(enable, "Enable AD1889 soundcard."); 71MODULE_PARM_DESC(enable, "Enable AD1889 soundcard.");
72 72
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index ef85ac5d9007..bdd6164e9c7e 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -48,7 +48,7 @@ MODULE_SUPPORTED_DEVICE("{{ALI,M5451,pci},{ALI,M5451}}");
48static int index = SNDRV_DEFAULT_IDX1; /* Index */ 48static int index = SNDRV_DEFAULT_IDX1; /* Index */
49static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ 49static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */
50static int pcm_channels = 32; 50static int pcm_channels = 32;
51static int spdif; 51static bool spdif;
52 52
53module_param(index, int, 0444); 53module_param(index, int, 0444);
54MODULE_PARM_DESC(index, "Index value for ALI M5451 PCI Audio."); 54MODULE_PARM_DESC(index, "Index value for ALI M5451 PCI Audio.");
@@ -60,7 +60,7 @@ module_param(spdif, bool, 0444);
60MODULE_PARM_DESC(spdif, "Support SPDIF I/O"); 60MODULE_PARM_DESC(spdif, "Support SPDIF I/O");
61 61
62/* just for backward compatibility */ 62/* just for backward compatibility */
63static int enable; 63static bool enable;
64module_param(enable, bool, 0444); 64module_param(enable, bool, 0444);
65 65
66 66
diff --git a/sound/pci/als300.c b/sound/pci/als300.c
index 8dc77a0a5d8b..8196e229b2df 100644
--- a/sound/pci/als300.c
+++ b/sound/pci/als300.c
@@ -115,7 +115,14 @@ MODULE_SUPPORTED_DEVICE("{{Avance Logic,ALS300},{Avance Logic,ALS300+}}");
115 115
116static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 116static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
117static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 117static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
118static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 118static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
119
120module_param_array(index, int, NULL, 0444);
121MODULE_PARM_DESC(index, "Index value for ALS300 sound card.");
122module_param_array(id, charp, NULL, 0444);
123MODULE_PARM_DESC(id, "ID string for ALS300 sound card.");
124module_param_array(enable, bool, NULL, 0444);
125MODULE_PARM_DESC(enable, "Enable ALS300 sound card.");
119 126
120struct snd_als300 { 127struct snd_als300 {
121 unsigned long port; 128 unsigned long port;
diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c
index 28ef40e01cc2..3269b8011ea9 100644
--- a/sound/pci/als4000.c
+++ b/sound/pci/als4000.c
@@ -90,7 +90,7 @@ MODULE_SUPPORTED_DEVICE("{{Avance Logic,ALS4000}}");
90 90
91static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 91static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
92static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 92static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
93static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 93static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
94#ifdef SUPPORT_JOYSTICK 94#ifdef SUPPORT_JOYSTICK
95static int joystick_port[SNDRV_CARDS]; 95static int joystick_port[SNDRV_CARDS];
96#endif 96#endif
diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c
index f4b9e2b7ae87..e8de831f98bc 100644
--- a/sound/pci/asihpi/asihpi.c
+++ b/sound/pci/asihpi/asihpi.c
@@ -23,8 +23,11 @@
23 */ 23 */
24 24
25#include "hpi_internal.h" 25#include "hpi_internal.h"
26#include "hpi_version.h"
26#include "hpimsginit.h" 27#include "hpimsginit.h"
27#include "hpioctl.h" 28#include "hpioctl.h"
29#include "hpicmn.h"
30
28 31
29#include <linux/pci.h> 32#include <linux/pci.h>
30#include <linux/init.h> 33#include <linux/init.h>
@@ -44,7 +47,8 @@
44 47
45MODULE_LICENSE("GPL"); 48MODULE_LICENSE("GPL");
46MODULE_AUTHOR("AudioScience inc. <support@audioscience.com>"); 49MODULE_AUTHOR("AudioScience inc. <support@audioscience.com>");
47MODULE_DESCRIPTION("AudioScience ALSA ASI5000 ASI6000 ASI87xx ASI89xx"); 50MODULE_DESCRIPTION("AudioScience ALSA ASI5000 ASI6000 ASI87xx ASI89xx "
51 HPI_VER_STRING);
48 52
49#if defined CONFIG_SND_DEBUG_VERBOSE 53#if defined CONFIG_SND_DEBUG_VERBOSE
50/** 54/**
@@ -63,8 +67,8 @@ MODULE_DESCRIPTION("AudioScience ALSA ASI5000 ASI6000 ASI87xx ASI89xx");
63 67
64static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* index 0-MAX */ 68static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* index 0-MAX */
65static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 69static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
66static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 70static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
67static int enable_hpi_hwdep = 1; 71static bool enable_hpi_hwdep = 1;
68 72
69module_param_array(index, int, NULL, S_IRUGO); 73module_param_array(index, int, NULL, S_IRUGO);
70MODULE_PARM_DESC(index, "ALSA index value for AudioScience soundcard."); 74MODULE_PARM_DESC(index, "ALSA index value for AudioScience soundcard.");
@@ -119,12 +123,7 @@ struct clk_cache {
119struct snd_card_asihpi { 123struct snd_card_asihpi {
120 struct snd_card *card; 124 struct snd_card *card;
121 struct pci_dev *pci; 125 struct pci_dev *pci;
122 u16 adapter_index; 126 struct hpi_adapter *hpi;
123 u32 serial_number;
124 u16 type;
125 u16 version;
126 u16 num_outstreams;
127 u16 num_instreams;
128 127
129 u32 h_mixer; 128 u32 h_mixer;
130 struct clk_cache cc; 129 struct clk_cache cc;
@@ -135,6 +134,8 @@ struct snd_card_asihpi {
135 u16 update_interval_frames; 134 u16 update_interval_frames;
136 u16 in_max_chans; 135 u16 in_max_chans;
137 u16 out_max_chans; 136 u16 out_max_chans;
137 u16 in_min_chans;
138 u16 out_min_chans;
138}; 139};
139 140
140/* Per stream data */ 141/* Per stream data */
@@ -495,6 +496,7 @@ static int snd_card_asihpi_pcm_hw_params(struct snd_pcm_substream *substream,
495 496
496 snd_printdd("stream_host_buffer_attach status 0x%x\n", 497 snd_printdd("stream_host_buffer_attach status 0x%x\n",
497 dpcm->hpi_buffer_attached); 498 dpcm->hpi_buffer_attached);
499
498 } 500 }
499 bytes_per_sec = params_rate(params) * params_channels(params); 501 bytes_per_sec = params_rate(params) * params_channels(params);
500 width = snd_pcm_format_width(params_format(params)); 502 width = snd_pcm_format_width(params_format(params));
@@ -757,8 +759,7 @@ static void snd_card_asihpi_timer_function(unsigned long data)
757 if (s->stream == SNDRV_PCM_STREAM_PLAYBACK) { 759 if (s->stream == SNDRV_PCM_STREAM_PLAYBACK) {
758 pcm_buf_dma_ofs = ds->pcm_buf_host_rw_ofs - bytes_avail; 760 pcm_buf_dma_ofs = ds->pcm_buf_host_rw_ofs - bytes_avail;
759 if (state == HPI_STATE_STOPPED) { 761 if (state == HPI_STATE_STOPPED) {
760 if ((bytes_avail == 0) && 762 if (bytes_avail == 0) {
761 (on_card_bytes < ds->pcm_buf_host_rw_ofs)) {
762 hpi_handle_error(hpi_stream_start(ds->h_stream)); 763 hpi_handle_error(hpi_stream_start(ds->h_stream));
763 snd_printdd("P%d start\n", s->number); 764 snd_printdd("P%d start\n", s->number);
764 ds->drained_count = 0; 765 ds->drained_count = 0;
@@ -767,7 +768,7 @@ static void snd_card_asihpi_timer_function(unsigned long data)
767 snd_printd(KERN_WARNING "P%d drained\n", 768 snd_printd(KERN_WARNING "P%d drained\n",
768 s->number); 769 s->number);
769 ds->drained_count++; 770 ds->drained_count++;
770 if (ds->drained_count > 2) { 771 if (ds->drained_count > 20) {
771 snd_pcm_stop(s, SNDRV_PCM_STATE_XRUN); 772 snd_pcm_stop(s, SNDRV_PCM_STATE_XRUN);
772 continue; 773 continue;
773 } 774 }
@@ -888,8 +889,8 @@ static void snd_card_asihpi_timer_function(unsigned long data)
888 pd, xfer2)); 889 pd, xfer2));
889 } 890 }
890 } 891 }
891 ds->pcm_buf_host_rw_ofs = ds->pcm_buf_host_rw_ofs + xfercount; 892 ds->pcm_buf_host_rw_ofs += xfercount;
892 ds->pcm_buf_elapsed_dma_ofs = pcm_buf_dma_ofs; 893 ds->pcm_buf_elapsed_dma_ofs += xfercount;
893 snd_pcm_period_elapsed(s); 894 snd_pcm_period_elapsed(s);
894 } 895 }
895 } 896 }
@@ -902,7 +903,9 @@ static void snd_card_asihpi_timer_function(unsigned long data)
902static int snd_card_asihpi_playback_ioctl(struct snd_pcm_substream *substream, 903static int snd_card_asihpi_playback_ioctl(struct snd_pcm_substream *substream,
903 unsigned int cmd, void *arg) 904 unsigned int cmd, void *arg)
904{ 905{
905 snd_printddd(KERN_INFO "P%d ioctl %d\n", substream->number, cmd); 906 char name[16];
907 snd_pcm_debug_name(substream, name, sizeof(name));
908 snd_printddd(KERN_INFO "%s ioctl %d\n", name, cmd);
906 return snd_pcm_lib_ioctl(substream, cmd, arg); 909 return snd_pcm_lib_ioctl(substream, cmd, arg);
907} 910}
908 911
@@ -927,21 +930,23 @@ snd_card_asihpi_playback_pointer(struct snd_pcm_substream *substream)
927 struct snd_pcm_runtime *runtime = substream->runtime; 930 struct snd_pcm_runtime *runtime = substream->runtime;
928 struct snd_card_asihpi_pcm *dpcm = runtime->private_data; 931 struct snd_card_asihpi_pcm *dpcm = runtime->private_data;
929 snd_pcm_uframes_t ptr; 932 snd_pcm_uframes_t ptr;
933 char name[16];
934 snd_pcm_debug_name(substream, name, sizeof(name));
930 935
931 ptr = bytes_to_frames(runtime, dpcm->pcm_buf_dma_ofs % dpcm->buffer_bytes); 936 ptr = bytes_to_frames(runtime, dpcm->pcm_buf_dma_ofs % dpcm->buffer_bytes);
932 snd_printddd("P%d pointer = 0x%04lx\n", substream->number, (unsigned long)ptr); 937 snd_printddd("%s pointer = 0x%04lx\n", name, (unsigned long)ptr);
933 return ptr; 938 return ptr;
934} 939}
935 940
936static void snd_card_asihpi_playback_format(struct snd_card_asihpi *asihpi, 941static u64 snd_card_asihpi_playback_formats(struct snd_card_asihpi *asihpi,
937 u32 h_stream, 942 u32 h_stream)
938 struct snd_pcm_hardware *pcmhw)
939{ 943{
940 struct hpi_format hpi_format; 944 struct hpi_format hpi_format;
941 u16 format; 945 u16 format;
942 u16 err; 946 u16 err;
943 u32 h_control; 947 u32 h_control;
944 u32 sample_rate = 48000; 948 u32 sample_rate = 48000;
949 u64 formats = 0;
945 950
946 /* on cards without SRC, must query at valid rate, 951 /* on cards without SRC, must query at valid rate,
947 * maybe set by external sync 952 * maybe set by external sync
@@ -956,41 +961,29 @@ static void snd_card_asihpi_playback_format(struct snd_card_asihpi *asihpi,
956 961
957 for (format = HPI_FORMAT_PCM8_UNSIGNED; 962 for (format = HPI_FORMAT_PCM8_UNSIGNED;
958 format <= HPI_FORMAT_PCM24_SIGNED; format++) { 963 format <= HPI_FORMAT_PCM24_SIGNED; format++) {
959 err = hpi_format_create(&hpi_format, 964 err = hpi_format_create(&hpi_format, asihpi->out_max_chans,
960 2, format, sample_rate, 128000, 0); 965 format, sample_rate, 128000, 0);
961 if (!err) 966 if (!err)
962 err = hpi_outstream_query_format(h_stream, 967 err = hpi_outstream_query_format(h_stream, &hpi_format);
963 &hpi_format);
964 if (!err && (hpi_to_alsa_formats[format] != -1)) 968 if (!err && (hpi_to_alsa_formats[format] != -1))
965 pcmhw->formats |= 969 formats |= (1ULL << hpi_to_alsa_formats[format]);
966 (1ULL << hpi_to_alsa_formats[format]);
967 } 970 }
971 return formats;
968} 972}
969 973
970static struct snd_pcm_hardware snd_card_asihpi_playback = {
971 .channels_min = 1,
972 .channels_max = 2,
973 .buffer_bytes_max = BUFFER_BYTES_MAX,
974 .period_bytes_min = PERIOD_BYTES_MIN,
975 .period_bytes_max = BUFFER_BYTES_MAX / PERIODS_MIN,
976 .periods_min = PERIODS_MIN,
977 .periods_max = BUFFER_BYTES_MAX / PERIOD_BYTES_MIN,
978 .fifo_size = 0,
979};
980
981static int snd_card_asihpi_playback_open(struct snd_pcm_substream *substream) 974static int snd_card_asihpi_playback_open(struct snd_pcm_substream *substream)
982{ 975{
983 struct snd_pcm_runtime *runtime = substream->runtime; 976 struct snd_pcm_runtime *runtime = substream->runtime;
984 struct snd_card_asihpi_pcm *dpcm; 977 struct snd_card_asihpi_pcm *dpcm;
985 struct snd_card_asihpi *card = snd_pcm_substream_chip(substream); 978 struct snd_card_asihpi *card = snd_pcm_substream_chip(substream);
979 struct snd_pcm_hardware snd_card_asihpi_playback;
986 int err; 980 int err;
987 981
988 dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL); 982 dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL);
989 if (dpcm == NULL) 983 if (dpcm == NULL)
990 return -ENOMEM; 984 return -ENOMEM;
991 985
992 err = 986 err = hpi_outstream_open(card->hpi->adapter->index,
993 hpi_outstream_open(card->adapter_index,
994 substream->number, &dpcm->h_stream); 987 substream->number, &dpcm->h_stream);
995 hpi_handle_error(err); 988 hpi_handle_error(err);
996 if (err) 989 if (err)
@@ -1012,12 +1005,19 @@ static int snd_card_asihpi_playback_open(struct snd_pcm_substream *substream)
1012 runtime->private_data = dpcm; 1005 runtime->private_data = dpcm;
1013 runtime->private_free = snd_card_asihpi_runtime_free; 1006 runtime->private_free = snd_card_asihpi_runtime_free;
1014 1007
1015 snd_card_asihpi_playback.channels_max = card->out_max_chans; 1008 memset(&snd_card_asihpi_playback, 0, sizeof(snd_card_asihpi_playback));
1009 snd_card_asihpi_playback.buffer_bytes_max = BUFFER_BYTES_MAX;
1010 snd_card_asihpi_playback.period_bytes_min = PERIOD_BYTES_MIN;
1016 /*?snd_card_asihpi_playback.period_bytes_min = 1011 /*?snd_card_asihpi_playback.period_bytes_min =
1017 card->out_max_chans * 4096; */ 1012 card->out_max_chans * 4096; */
1018 1013 snd_card_asihpi_playback.period_bytes_max = BUFFER_BYTES_MAX / PERIODS_MIN;
1019 snd_card_asihpi_playback_format(card, dpcm->h_stream, 1014 snd_card_asihpi_playback.periods_min = PERIODS_MIN;
1020 &snd_card_asihpi_playback); 1015 snd_card_asihpi_playback.periods_max = BUFFER_BYTES_MAX / PERIOD_BYTES_MIN;
1016 /* snd_card_asihpi_playback.fifo_size = 0; */
1017 snd_card_asihpi_playback.channels_max = card->out_max_chans;
1018 snd_card_asihpi_playback.channels_min = card->out_min_chans;
1019 snd_card_asihpi_playback.formats =
1020 snd_card_asihpi_playback_formats(card, dpcm->h_stream);
1021 1021
1022 snd_card_asihpi_pcm_samplerates(card, &snd_card_asihpi_playback); 1022 snd_card_asihpi_pcm_samplerates(card, &snd_card_asihpi_playback);
1023 1023
@@ -1029,8 +1029,10 @@ static int snd_card_asihpi_playback_open(struct snd_pcm_substream *substream)
1029 SNDRV_PCM_INFO_MMAP | 1029 SNDRV_PCM_INFO_MMAP |
1030 SNDRV_PCM_INFO_MMAP_VALID; 1030 SNDRV_PCM_INFO_MMAP_VALID;
1031 1031
1032 if (card->support_grouping) 1032 if (card->support_grouping) {
1033 snd_card_asihpi_playback.info |= SNDRV_PCM_INFO_SYNC_START; 1033 snd_card_asihpi_playback.info |= SNDRV_PCM_INFO_SYNC_START;
1034 snd_pcm_set_sync(substream);
1035 }
1034 1036
1035 /* struct is copied, so can create initializer dynamically */ 1037 /* struct is copied, so can create initializer dynamically */
1036 runtime->hw = snd_card_asihpi_playback; 1038 runtime->hw = snd_card_asihpi_playback;
@@ -1047,8 +1049,6 @@ static int snd_card_asihpi_playback_open(struct snd_pcm_substream *substream)
1047 snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 1049 snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
1048 card->update_interval_frames * 2, UINT_MAX); 1050 card->update_interval_frames * 2, UINT_MAX);
1049 1051
1050 snd_pcm_set_sync(substream);
1051
1052 snd_printdd("playback open\n"); 1052 snd_printdd("playback open\n");
1053 1053
1054 return 0; 1054 return 0;
@@ -1114,15 +1114,15 @@ static int snd_card_asihpi_capture_prepare(struct snd_pcm_substream *substream)
1114 1114
1115 1115
1116 1116
1117static void snd_card_asihpi_capture_format(struct snd_card_asihpi *asihpi, 1117static u64 snd_card_asihpi_capture_formats(struct snd_card_asihpi *asihpi,
1118 u32 h_stream, 1118 u32 h_stream)
1119 struct snd_pcm_hardware *pcmhw)
1120{ 1119{
1121 struct hpi_format hpi_format; 1120 struct hpi_format hpi_format;
1122 u16 format; 1121 u16 format;
1123 u16 err; 1122 u16 err;
1124 u32 h_control; 1123 u32 h_control;
1125 u32 sample_rate = 48000; 1124 u32 sample_rate = 48000;
1125 u64 formats = 0;
1126 1126
1127 /* on cards without SRC, must query at valid rate, 1127 /* on cards without SRC, must query at valid rate,
1128 maybe set by external sync */ 1128 maybe set by external sync */
@@ -1137,34 +1137,22 @@ static void snd_card_asihpi_capture_format(struct snd_card_asihpi *asihpi,
1137 for (format = HPI_FORMAT_PCM8_UNSIGNED; 1137 for (format = HPI_FORMAT_PCM8_UNSIGNED;
1138 format <= HPI_FORMAT_PCM24_SIGNED; format++) { 1138 format <= HPI_FORMAT_PCM24_SIGNED; format++) {
1139 1139
1140 err = hpi_format_create(&hpi_format, 2, format, 1140 err = hpi_format_create(&hpi_format, asihpi->in_max_chans,
1141 sample_rate, 128000, 0); 1141 format, sample_rate, 128000, 0);
1142 if (!err) 1142 if (!err)
1143 err = hpi_instream_query_format(h_stream, 1143 err = hpi_instream_query_format(h_stream, &hpi_format);
1144 &hpi_format);
1145 if (!err) 1144 if (!err)
1146 pcmhw->formats |= 1145 formats |= (1ULL << hpi_to_alsa_formats[format]);
1147 (1ULL << hpi_to_alsa_formats[format]);
1148 } 1146 }
1147 return formats;
1149} 1148}
1150 1149
1151
1152static struct snd_pcm_hardware snd_card_asihpi_capture = {
1153 .channels_min = 1,
1154 .channels_max = 2,
1155 .buffer_bytes_max = BUFFER_BYTES_MAX,
1156 .period_bytes_min = PERIOD_BYTES_MIN,
1157 .period_bytes_max = BUFFER_BYTES_MAX / PERIODS_MIN,
1158 .periods_min = PERIODS_MIN,
1159 .periods_max = BUFFER_BYTES_MAX / PERIOD_BYTES_MIN,
1160 .fifo_size = 0,
1161};
1162
1163static int snd_card_asihpi_capture_open(struct snd_pcm_substream *substream) 1150static int snd_card_asihpi_capture_open(struct snd_pcm_substream *substream)
1164{ 1151{
1165 struct snd_pcm_runtime *runtime = substream->runtime; 1152 struct snd_pcm_runtime *runtime = substream->runtime;
1166 struct snd_card_asihpi *card = snd_pcm_substream_chip(substream); 1153 struct snd_card_asihpi *card = snd_pcm_substream_chip(substream);
1167 struct snd_card_asihpi_pcm *dpcm; 1154 struct snd_card_asihpi_pcm *dpcm;
1155 struct snd_pcm_hardware snd_card_asihpi_capture;
1168 int err; 1156 int err;
1169 1157
1170 dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL); 1158 dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL);
@@ -1172,10 +1160,10 @@ static int snd_card_asihpi_capture_open(struct snd_pcm_substream *substream)
1172 return -ENOMEM; 1160 return -ENOMEM;
1173 1161
1174 snd_printdd("capture open adapter %d stream %d\n", 1162 snd_printdd("capture open adapter %d stream %d\n",
1175 card->adapter_index, substream->number); 1163 card->hpi->adapter->index, substream->number);
1176 1164
1177 err = hpi_handle_error( 1165 err = hpi_handle_error(
1178 hpi_instream_open(card->adapter_index, 1166 hpi_instream_open(card->hpi->adapter->index,
1179 substream->number, &dpcm->h_stream)); 1167 substream->number, &dpcm->h_stream));
1180 if (err) 1168 if (err)
1181 kfree(dpcm); 1169 kfree(dpcm);
@@ -1184,7 +1172,6 @@ static int snd_card_asihpi_capture_open(struct snd_pcm_substream *substream)
1184 if (err) 1172 if (err)
1185 return -EIO; 1173 return -EIO;
1186 1174
1187
1188 init_timer(&dpcm->timer); 1175 init_timer(&dpcm->timer);
1189 dpcm->timer.data = (unsigned long) dpcm; 1176 dpcm->timer.data = (unsigned long) dpcm;
1190 dpcm->timer.function = snd_card_asihpi_timer_function; 1177 dpcm->timer.function = snd_card_asihpi_timer_function;
@@ -1192,9 +1179,17 @@ static int snd_card_asihpi_capture_open(struct snd_pcm_substream *substream)
1192 runtime->private_data = dpcm; 1179 runtime->private_data = dpcm;
1193 runtime->private_free = snd_card_asihpi_runtime_free; 1180 runtime->private_free = snd_card_asihpi_runtime_free;
1194 1181
1182 memset(&snd_card_asihpi_capture, 0, sizeof(snd_card_asihpi_capture));
1183 snd_card_asihpi_capture.buffer_bytes_max = BUFFER_BYTES_MAX;
1184 snd_card_asihpi_capture.period_bytes_min = PERIOD_BYTES_MIN;
1185 snd_card_asihpi_capture.period_bytes_max = BUFFER_BYTES_MAX / PERIODS_MIN;
1186 snd_card_asihpi_capture.periods_min = PERIODS_MIN;
1187 snd_card_asihpi_capture.periods_max = BUFFER_BYTES_MAX / PERIOD_BYTES_MIN;
1188 /* snd_card_asihpi_capture.fifo_size = 0; */
1195 snd_card_asihpi_capture.channels_max = card->in_max_chans; 1189 snd_card_asihpi_capture.channels_max = card->in_max_chans;
1196 snd_card_asihpi_capture_format(card, dpcm->h_stream, 1190 snd_card_asihpi_capture.channels_min = card->in_min_chans;
1197 &snd_card_asihpi_capture); 1191 snd_card_asihpi_capture.formats =
1192 snd_card_asihpi_capture_formats(card, dpcm->h_stream);
1198 snd_card_asihpi_pcm_samplerates(card, &snd_card_asihpi_capture); 1193 snd_card_asihpi_pcm_samplerates(card, &snd_card_asihpi_capture);
1199 snd_card_asihpi_capture.info = SNDRV_PCM_INFO_INTERLEAVED | 1194 snd_card_asihpi_capture.info = SNDRV_PCM_INFO_INTERLEAVED |
1200 SNDRV_PCM_INFO_MMAP | 1195 SNDRV_PCM_INFO_MMAP |
@@ -1240,15 +1235,20 @@ static struct snd_pcm_ops snd_card_asihpi_capture_mmap_ops = {
1240 .pointer = snd_card_asihpi_capture_pointer, 1235 .pointer = snd_card_asihpi_capture_pointer,
1241}; 1236};
1242 1237
1243static int __devinit snd_card_asihpi_pcm_new(struct snd_card_asihpi *asihpi, 1238static int __devinit snd_card_asihpi_pcm_new(
1244 int device, int substreams) 1239 struct snd_card_asihpi *asihpi, int device)
1245{ 1240{
1246 struct snd_pcm *pcm; 1241 struct snd_pcm *pcm;
1247 int err; 1242 int err;
1243 u16 num_instreams, num_outstreams, x16;
1244 u32 x32;
1245
1246 err = hpi_adapter_get_info(asihpi->hpi->adapter->index,
1247 &num_outstreams, &num_instreams,
1248 &x16, &x32, &x16);
1248 1249
1249 err = snd_pcm_new(asihpi->card, "Asihpi PCM", device, 1250 err = snd_pcm_new(asihpi->card, "Asihpi PCM", device,
1250 asihpi->num_outstreams, asihpi->num_instreams, 1251 num_outstreams, num_instreams, &pcm);
1251 &pcm);
1252 if (err < 0) 1252 if (err < 0)
1253 return err; 1253 return err;
1254 /* pointer to ops struct is stored, dont change ops afterwards! */ 1254 /* pointer to ops struct is stored, dont change ops afterwards! */
@@ -1314,7 +1314,7 @@ static const char * const asihpi_src_names[] = {
1314 "Analog", 1314 "Analog",
1315 "Adapter", 1315 "Adapter",
1316 "RTP", 1316 "RTP",
1317 "GPI", 1317 "Internal"
1318}; 1318};
1319 1319
1320compile_time_assert( 1320compile_time_assert(
@@ -1332,7 +1332,6 @@ static const char * const asihpi_dst_names[] = {
1332 "Net", 1332 "Net",
1333 "Analog", 1333 "Analog",
1334 "RTP", 1334 "RTP",
1335 "GPO",
1336}; 1335};
1337 1336
1338compile_time_assert( 1337compile_time_assert(
@@ -1410,6 +1409,7 @@ static int snd_asihpi_volume_info(struct snd_kcontrol *kcontrol,
1410 struct snd_ctl_elem_info *uinfo) 1409 struct snd_ctl_elem_info *uinfo)
1411{ 1410{
1412 u32 h_control = kcontrol->private_value; 1411 u32 h_control = kcontrol->private_value;
1412 u32 count;
1413 u16 err; 1413 u16 err;
1414 /* native gains are in millibels */ 1414 /* native gains are in millibels */
1415 short min_gain_mB; 1415 short min_gain_mB;
@@ -1424,8 +1424,12 @@ static int snd_asihpi_volume_info(struct snd_kcontrol *kcontrol,
1424 step_gain_mB = VOL_STEP_mB; 1424 step_gain_mB = VOL_STEP_mB;
1425 } 1425 }
1426 1426
1427 err = hpi_meter_query_channels(h_control, &count);
1428 if (err)
1429 count = HPI_MAX_CHANNELS;
1430
1427 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 1431 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
1428 uinfo->count = 2; 1432 uinfo->count = count;
1429 uinfo->value.integer.min = min_gain_mB / VOL_STEP_mB; 1433 uinfo->value.integer.min = min_gain_mB / VOL_STEP_mB;
1430 uinfo->value.integer.max = max_gain_mB / VOL_STEP_mB; 1434 uinfo->value.integer.max = max_gain_mB / VOL_STEP_mB;
1431 uinfo->value.integer.step = step_gain_mB / VOL_STEP_mB; 1435 uinfo->value.integer.step = step_gain_mB / VOL_STEP_mB;
@@ -2033,8 +2037,15 @@ static int __devinit snd_asihpi_tuner_add(struct snd_card_asihpi *asihpi,
2033static int snd_asihpi_meter_info(struct snd_kcontrol *kcontrol, 2037static int snd_asihpi_meter_info(struct snd_kcontrol *kcontrol,
2034 struct snd_ctl_elem_info *uinfo) 2038 struct snd_ctl_elem_info *uinfo)
2035{ 2039{
2040 u32 h_control = kcontrol->private_value;
2041 u32 count;
2042 u16 err;
2043 err = hpi_meter_query_channels(h_control, &count);
2044 if (err)
2045 count = HPI_MAX_CHANNELS;
2046
2036 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 2047 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
2037 uinfo->count = HPI_MAX_CHANNELS; 2048 uinfo->count = count;
2038 uinfo->value.integer.min = 0; 2049 uinfo->value.integer.min = 0;
2039 uinfo->value.integer.max = 0x7FFFFFFF; 2050 uinfo->value.integer.max = 0x7FFFFFFF;
2040 return 0; 2051 return 0;
@@ -2248,6 +2259,9 @@ static int snd_asihpi_cmode_info(struct snd_kcontrol *kcontrol,
2248 valid_modes++; 2259 valid_modes++;
2249 } 2260 }
2250 2261
2262 if (!valid_modes)
2263 return -EINVAL;
2264
2251 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 2265 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2252 uinfo->count = 1; 2266 uinfo->count = 1;
2253 uinfo->value.enumerated.items = valid_modes; 2267 uinfo->value.enumerated.items = valid_modes;
@@ -2547,7 +2561,7 @@ static int __devinit snd_card_asihpi_mixer_new(struct snd_card_asihpi *asihpi)
2547 strcpy(card->mixername, "Asihpi Mixer"); 2561 strcpy(card->mixername, "Asihpi Mixer");
2548 2562
2549 err = 2563 err =
2550 hpi_mixer_open(asihpi->adapter_index, 2564 hpi_mixer_open(asihpi->hpi->adapter->index,
2551 &asihpi->h_mixer); 2565 &asihpi->h_mixer);
2552 hpi_handle_error(err); 2566 hpi_handle_error(err);
2553 if (err) 2567 if (err)
@@ -2665,24 +2679,33 @@ snd_asihpi_proc_read(struct snd_info_entry *entry,
2665 struct snd_info_buffer *buffer) 2679 struct snd_info_buffer *buffer)
2666{ 2680{
2667 struct snd_card_asihpi *asihpi = entry->private_data; 2681 struct snd_card_asihpi *asihpi = entry->private_data;
2668 u16 version;
2669 u32 h_control; 2682 u32 h_control;
2670 u32 rate = 0; 2683 u32 rate = 0;
2671 u16 source = 0; 2684 u16 source = 0;
2685
2686 u16 num_outstreams;
2687 u16 num_instreams;
2688 u16 version;
2689 u32 serial_number;
2690 u16 type;
2691
2672 int err; 2692 int err;
2673 2693
2674 snd_iprintf(buffer, "ASIHPI driver proc file\n"); 2694 snd_iprintf(buffer, "ASIHPI driver proc file\n");
2695
2696 hpi_handle_error(hpi_adapter_get_info(asihpi->hpi->adapter->index,
2697 &num_outstreams, &num_instreams,
2698 &version, &serial_number, &type));
2699
2675 snd_iprintf(buffer, 2700 snd_iprintf(buffer,
2676 "adapter ID=%4X\n_index=%d\n" 2701 "Adapter type ASI%4X\nHardware Index %d\n"
2677 "num_outstreams=%d\n_num_instreams=%d\n", 2702 "%d outstreams\n%d instreams\n",
2678 asihpi->type, asihpi->adapter_index, 2703 type, asihpi->hpi->adapter->index,
2679 asihpi->num_outstreams, asihpi->num_instreams); 2704 num_outstreams, num_instreams);
2680 2705
2681 version = asihpi->version;
2682 snd_iprintf(buffer, 2706 snd_iprintf(buffer,
2683 "serial#=%d\n_hw version %c%d\nDSP code version %03d\n", 2707 "Serial#%d\nHardware version %c%d\nDSP code version %03d\n",
2684 asihpi->serial_number, ((version >> 3) & 0xf) + 'A', 2708 serial_number, ((version >> 3) & 0xf) + 'A', version & 0x7,
2685 version & 0x7,
2686 ((version >> 13) * 100) + ((version >> 7) & 0x3f)); 2709 ((version >> 13) * 100) + ((version >> 7) & 0x3f));
2687 2710
2688 err = hpi_mixer_get_control(asihpi->h_mixer, 2711 err = hpi_mixer_get_control(asihpi->h_mixer,
@@ -2690,18 +2713,15 @@ snd_asihpi_proc_read(struct snd_info_entry *entry,
2690 HPI_CONTROL_SAMPLECLOCK, &h_control); 2713 HPI_CONTROL_SAMPLECLOCK, &h_control);
2691 2714
2692 if (!err) { 2715 if (!err) {
2693 err = hpi_sample_clock_get_sample_rate( 2716 err = hpi_sample_clock_get_sample_rate(h_control, &rate);
2694 h_control, &rate);
2695 err += hpi_sample_clock_get_source(h_control, &source); 2717 err += hpi_sample_clock_get_source(h_control, &source);
2696 2718
2697 if (!err) 2719 if (!err)
2698 snd_iprintf(buffer, "sample_clock=%d_hz, source %s\n", 2720 snd_iprintf(buffer, "Sample Clock %dHz, source %s\n",
2699 rate, sampleclock_sources[source]); 2721 rate, sampleclock_sources[source]);
2700 } 2722 }
2701
2702} 2723}
2703 2724
2704
2705static void __devinit snd_asihpi_proc_init(struct snd_card_asihpi *asihpi) 2725static void __devinit snd_asihpi_proc_init(struct snd_card_asihpi *asihpi)
2706{ 2726{
2707 struct snd_info_entry *entry; 2727 struct snd_info_entry *entry;
@@ -2773,35 +2793,34 @@ static int __devinit snd_asihpi_probe(struct pci_dev *pci_dev,
2773 const struct pci_device_id *pci_id) 2793 const struct pci_device_id *pci_id)
2774{ 2794{
2775 int err; 2795 int err;
2776 2796 struct hpi_adapter *hpi;
2777 u16 version;
2778 int pcm_substreams;
2779
2780 struct hpi_adapter *hpi_card;
2781 struct snd_card *card; 2797 struct snd_card *card;
2782 struct snd_card_asihpi *asihpi; 2798 struct snd_card_asihpi *asihpi;
2783 2799
2784 u32 h_control; 2800 u32 h_control;
2785 u32 h_stream; 2801 u32 h_stream;
2802 u32 adapter_index;
2786 2803
2787 static int dev; 2804 static int dev;
2788 if (dev >= SNDRV_CARDS) 2805 if (dev >= SNDRV_CARDS)
2789 return -ENODEV; 2806 return -ENODEV;
2790 2807
2791 /* Should this be enable[hpi_card->index] ? */ 2808 /* Should this be enable[hpi->index] ? */
2792 if (!enable[dev]) { 2809 if (!enable[dev]) {
2793 dev++; 2810 dev++;
2794 return -ENOENT; 2811 return -ENOENT;
2795 } 2812 }
2796 2813
2814 /* Initialise low-level HPI driver */
2797 err = asihpi_adapter_probe(pci_dev, pci_id); 2815 err = asihpi_adapter_probe(pci_dev, pci_id);
2798 if (err < 0) 2816 if (err < 0)
2799 return err; 2817 return err;
2800 2818
2801 hpi_card = pci_get_drvdata(pci_dev); 2819 hpi = pci_get_drvdata(pci_dev);
2820 adapter_index = hpi->adapter->index;
2802 /* first try to give the card the same index as its hardware index */ 2821 /* first try to give the card the same index as its hardware index */
2803 err = snd_card_create(hpi_card->index, 2822 err = snd_card_create(adapter_index,
2804 id[hpi_card->index], THIS_MODULE, 2823 id[adapter_index], THIS_MODULE,
2805 sizeof(struct snd_card_asihpi), 2824 sizeof(struct snd_card_asihpi),
2806 &card); 2825 &card);
2807 if (err < 0) { 2826 if (err < 0) {
@@ -2815,50 +2834,32 @@ static int __devinit snd_asihpi_probe(struct pci_dev *pci_dev,
2815 return err; 2834 return err;
2816 snd_printk(KERN_WARNING 2835 snd_printk(KERN_WARNING
2817 "**** WARNING **** Adapter index %d->ALSA index %d\n", 2836 "**** WARNING **** Adapter index %d->ALSA index %d\n",
2818 hpi_card->index, card->number); 2837 adapter_index, card->number);
2819 } 2838 }
2820 2839
2821 snd_card_set_dev(card, &pci_dev->dev); 2840 snd_card_set_dev(card, &pci_dev->dev);
2822 2841
2823 asihpi = (struct snd_card_asihpi *) card->private_data; 2842 asihpi = card->private_data;
2824 asihpi->card = card; 2843 asihpi->card = card;
2825 asihpi->pci = pci_dev; 2844 asihpi->pci = pci_dev;
2826 asihpi->adapter_index = hpi_card->index; 2845 asihpi->hpi = hpi;
2827 hpi_handle_error(hpi_adapter_get_info( 2846
2828 asihpi->adapter_index, 2847 snd_printk(KERN_INFO "adapter ID=%4X index=%d\n",
2829 &asihpi->num_outstreams, 2848 asihpi->hpi->adapter->type, adapter_index);
2830 &asihpi->num_instreams, 2849
2831 &asihpi->version, 2850 err = hpi_adapter_get_property(adapter_index,
2832 &asihpi->serial_number, &asihpi->type));
2833
2834 version = asihpi->version;
2835 snd_printk(KERN_INFO "adapter ID=%4X index=%d num_outstreams=%d "
2836 "num_instreams=%d S/N=%d\n"
2837 "Hw Version %c%d DSP code version %03d\n",
2838 asihpi->type, asihpi->adapter_index,
2839 asihpi->num_outstreams,
2840 asihpi->num_instreams, asihpi->serial_number,
2841 ((version >> 3) & 0xf) + 'A',
2842 version & 0x7,
2843 ((version >> 13) * 100) + ((version >> 7) & 0x3f));
2844
2845 pcm_substreams = asihpi->num_outstreams;
2846 if (pcm_substreams < asihpi->num_instreams)
2847 pcm_substreams = asihpi->num_instreams;
2848
2849 err = hpi_adapter_get_property(asihpi->adapter_index,
2850 HPI_ADAPTER_PROPERTY_CAPS1, 2851 HPI_ADAPTER_PROPERTY_CAPS1,
2851 NULL, &asihpi->support_grouping); 2852 NULL, &asihpi->support_grouping);
2852 if (err) 2853 if (err)
2853 asihpi->support_grouping = 0; 2854 asihpi->support_grouping = 0;
2854 2855
2855 err = hpi_adapter_get_property(asihpi->adapter_index, 2856 err = hpi_adapter_get_property(adapter_index,
2856 HPI_ADAPTER_PROPERTY_CAPS2, 2857 HPI_ADAPTER_PROPERTY_CAPS2,
2857 &asihpi->support_mrx, NULL); 2858 &asihpi->support_mrx, NULL);
2858 if (err) 2859 if (err)
2859 asihpi->support_mrx = 0; 2860 asihpi->support_mrx = 0;
2860 2861
2861 err = hpi_adapter_get_property(asihpi->adapter_index, 2862 err = hpi_adapter_get_property(adapter_index,
2862 HPI_ADAPTER_PROPERTY_INTERVAL, 2863 HPI_ADAPTER_PROPERTY_INTERVAL,
2863 NULL, &asihpi->update_interval_frames); 2864 NULL, &asihpi->update_interval_frames);
2864 if (err) 2865 if (err)
@@ -2867,7 +2868,7 @@ static int __devinit snd_asihpi_probe(struct pci_dev *pci_dev,
2867 if (!asihpi->can_dma) 2868 if (!asihpi->can_dma)
2868 asihpi->update_interval_frames *= 2; 2869 asihpi->update_interval_frames *= 2;
2869 2870
2870 hpi_handle_error(hpi_instream_open(asihpi->adapter_index, 2871 hpi_handle_error(hpi_instream_open(adapter_index,
2871 0, &h_stream)); 2872 0, &h_stream));
2872 2873
2873 err = hpi_instream_host_buffer_free(h_stream); 2874 err = hpi_instream_host_buffer_free(h_stream);
@@ -2875,7 +2876,7 @@ static int __devinit snd_asihpi_probe(struct pci_dev *pci_dev,
2875 2876
2876 hpi_handle_error(hpi_instream_close(h_stream)); 2877 hpi_handle_error(hpi_instream_close(h_stream));
2877 2878
2878 err = hpi_adapter_get_property(asihpi->adapter_index, 2879 err = hpi_adapter_get_property(adapter_index,
2879 HPI_ADAPTER_PROPERTY_CURCHANNELS, 2880 HPI_ADAPTER_PROPERTY_CURCHANNELS,
2880 &asihpi->in_max_chans, &asihpi->out_max_chans); 2881 &asihpi->in_max_chans, &asihpi->out_max_chans);
2881 if (err) { 2882 if (err) {
@@ -2883,13 +2884,22 @@ static int __devinit snd_asihpi_probe(struct pci_dev *pci_dev,
2883 asihpi->out_max_chans = 2; 2884 asihpi->out_max_chans = 2;
2884 } 2885 }
2885 2886
2886 snd_printk(KERN_INFO "has dma:%d, grouping:%d, mrx:%d\n", 2887 if (asihpi->out_max_chans > 2) { /* assume LL mode */
2888 asihpi->out_min_chans = asihpi->out_max_chans;
2889 asihpi->in_min_chans = asihpi->in_max_chans;
2890 asihpi->support_grouping = 0;
2891 } else {
2892 asihpi->out_min_chans = 1;
2893 asihpi->in_min_chans = 1;
2894 }
2895
2896 snd_printk(KERN_INFO "Has dma:%d, grouping:%d, mrx:%d\n",
2887 asihpi->can_dma, 2897 asihpi->can_dma,
2888 asihpi->support_grouping, 2898 asihpi->support_grouping,
2889 asihpi->support_mrx 2899 asihpi->support_mrx
2890 ); 2900 );
2891 2901
2892 err = snd_card_asihpi_pcm_new(asihpi, 0, pcm_substreams); 2902 err = snd_card_asihpi_pcm_new(asihpi, 0);
2893 if (err < 0) { 2903 if (err < 0) {
2894 snd_printk(KERN_ERR "pcm_new failed\n"); 2904 snd_printk(KERN_ERR "pcm_new failed\n");
2895 goto __nodev; 2905 goto __nodev;
@@ -2916,13 +2926,14 @@ static int __devinit snd_asihpi_probe(struct pci_dev *pci_dev,
2916 2926
2917 strcpy(card->driver, "ASIHPI"); 2927 strcpy(card->driver, "ASIHPI");
2918 2928
2919 sprintf(card->shortname, "AudioScience ASI%4X", asihpi->type); 2929 sprintf(card->shortname, "AudioScience ASI%4X",
2930 asihpi->hpi->adapter->type);
2920 sprintf(card->longname, "%s %i", 2931 sprintf(card->longname, "%s %i",
2921 card->shortname, asihpi->adapter_index); 2932 card->shortname, adapter_index);
2922 err = snd_card_register(card); 2933 err = snd_card_register(card);
2923 2934
2924 if (!err) { 2935 if (!err) {
2925 hpi_card->snd_card_asihpi = card; 2936 hpi->snd_card = card;
2926 dev++; 2937 dev++;
2927 return 0; 2938 return 0;
2928 } 2939 }
@@ -2935,10 +2946,9 @@ __nodev:
2935 2946
2936static void __devexit snd_asihpi_remove(struct pci_dev *pci_dev) 2947static void __devexit snd_asihpi_remove(struct pci_dev *pci_dev)
2937{ 2948{
2938 struct hpi_adapter *hpi_card = pci_get_drvdata(pci_dev); 2949 struct hpi_adapter *hpi = pci_get_drvdata(pci_dev);
2939 2950 snd_card_free(hpi->snd_card);
2940 snd_card_free(hpi_card->snd_card_asihpi); 2951 hpi->snd_card = NULL;
2941 hpi_card->snd_card_asihpi = NULL;
2942 asihpi_adapter_remove(pci_dev); 2952 asihpi_adapter_remove(pci_dev);
2943} 2953}
2944 2954
diff --git a/sound/pci/asihpi/hpi.h b/sound/pci/asihpi/hpi.h
index f20727288994..20887241a3ae 100644
--- a/sound/pci/asihpi/hpi.h
+++ b/sound/pci/asihpi/hpi.h
@@ -30,26 +30,8 @@
30 30
31#ifndef _HPI_H_ 31#ifndef _HPI_H_
32#define _HPI_H_ 32#define _HPI_H_
33/* HPI Version
34If HPI_VER_MINOR is odd then its a development release not intended for the
35public. If HPI_VER_MINOR is even then is a release version
36i.e 3.05.02 is a development version
37*/
38#define HPI_VERSION_CONSTRUCTOR(maj, min, rel) \
39 ((maj << 16) + (min << 8) + rel)
40
41#define HPI_VER_MAJOR(v) ((int)(v >> 16))
42#define HPI_VER_MINOR(v) ((int)((v >> 8) & 0xFF))
43#define HPI_VER_RELEASE(v) ((int)(v & 0xFF))
44
45#define HPI_VER HPI_VERSION_CONSTRUCTOR(4L, 8, 0)
46#define HPI_VER_STRING "4.08.00"
47
48/* Library version as documented in hpi-api-versions.txt */
49#define HPI_LIB_VER HPI_VERSION_CONSTRUCTOR(10, 0, 0)
50 33
51#include <linux/types.h> 34#include <linux/types.h>
52#define HPI_BUILD_EXCLUDE_DEPRECATED
53#define HPI_BUILD_KERNEL_MODE 35#define HPI_BUILD_KERNEL_MODE
54 36
55/******************************************************************************/ 37/******************************************************************************/
@@ -213,7 +195,7 @@ enum HPI_SOURCENODES {
213 /** RTP stream input node - This node is a destination for 195 /** RTP stream input node - This node is a destination for
214 packets of RTP audio samples from other devices. */ 196 packets of RTP audio samples from other devices. */
215 HPI_SOURCENODE_RTP_DESTINATION = 112, 197 HPI_SOURCENODE_RTP_DESTINATION = 112,
216 HPI_SOURCENODE_GP_IN = 113, /**< general purpose input. */ 198 HPI_SOURCENODE_INTERNAL = 113, /**< node internal to the device. */
217 /* !!!Update this AND hpidebug.h if you add a new sourcenode type!!! */ 199 /* !!!Update this AND hpidebug.h if you add a new sourcenode type!!! */
218 HPI_SOURCENODE_LAST_INDEX = 113 /**< largest ID */ 200 HPI_SOURCENODE_LAST_INDEX = 113 /**< largest ID */
219 /* AX6 max sourcenode types = 15 */ 201 /* AX6 max sourcenode types = 15 */
@@ -242,9 +224,8 @@ enum HPI_DESTNODES {
242 /** RTP stream output node - This node is a source for 224 /** RTP stream output node - This node is a source for
243 packets of RTP audio samples that are sent to other devices. */ 225 packets of RTP audio samples that are sent to other devices. */
244 HPI_DESTNODE_RTP_SOURCE = 208, 226 HPI_DESTNODE_RTP_SOURCE = 208,
245 HPI_DESTNODE_GP_OUT = 209, /**< general purpose output node. */
246 /* !!!Update this AND hpidebug.h if you add a new destnode type!!! */ 227 /* !!!Update this AND hpidebug.h if you add a new destnode type!!! */
247 HPI_DESTNODE_LAST_INDEX = 209 /**< largest ID */ 228 HPI_DESTNODE_LAST_INDEX = 208 /**< largest ID */
248 /* AX6 max destnode types = 15 */ 229 /* AX6 max destnode types = 15 */
249}; 230};
250 231
@@ -450,7 +431,19 @@ Indicates that the adapter in it's current mode supports interrupts
450across the host bus. Note, this does not imply that interrupts are 431across the host bus. Note, this does not imply that interrupts are
451enabled. Instead it indicates that they can be enabled. 432enabled. Instead it indicates that they can be enabled.
452*/ 433*/
453 HPI_ADAPTER_PROPERTY_SUPPORTS_IRQ = 272 434 HPI_ADAPTER_PROPERTY_SUPPORTS_IRQ = 272,
435/** Readonly supports firmware updating.
436Indicates that the adapter implements an interface to update firmware
437on the adapter.
438*/
439 HPI_ADAPTER_PROPERTY_SUPPORTS_FW_UPDATE = 273,
440/** Readonly Firmware IDs
441Identifiy firmware independent of individual adapter type.
442May be used as a filter for firmware update images.
443Property 1 = Bootloader ID
444Property 2 = Main program ID
445*/
446 HPI_ADAPTER_PROPERTY_FIRMWARE_ID = 274
454}; 447};
455 448
456/** Adapter mode commands 449/** Adapter mode commands
@@ -638,7 +631,7 @@ enum HPI_MIXER_STORE_COMMAND {
638 HPI_MIXER_STORE_ENABLE = 4, 631 HPI_MIXER_STORE_ENABLE = 4,
639/** Disable auto storage of some control settings. */ 632/** Disable auto storage of some control settings. */
640 HPI_MIXER_STORE_DISABLE = 5, 633 HPI_MIXER_STORE_DISABLE = 5,
641/** Save the attributes of a single control. */ 634/** Unimplemented - save the attributes of a single control. */
642 HPI_MIXER_STORE_SAVE_SINGLE = 6 635 HPI_MIXER_STORE_SAVE_SINGLE = 6
643}; 636};
644 637
@@ -941,7 +934,7 @@ enum HPI_ERROR_CODES {
941 HPI_ERROR_BAD_ADAPTER_NUMBER = 202, 934 HPI_ERROR_BAD_ADAPTER_NUMBER = 202,
942 /** 2 adapters with the same adapter number. */ 935 /** 2 adapters with the same adapter number. */
943 HPI_ERROR_DUPLICATE_ADAPTER_NUMBER = 203, 936 HPI_ERROR_DUPLICATE_ADAPTER_NUMBER = 203,
944 /** DSP code failed to bootload. (unused?) */ 937 /** DSP code failed to bootload. Usually a DSP memory test failure. */
945 HPI_ERROR_DSP_BOOTLOAD = 204, 938 HPI_ERROR_DSP_BOOTLOAD = 204,
946 /** Couldn't find or open the DSP code file. */ 939 /** Couldn't find or open the DSP code file. */
947 HPI_ERROR_DSP_FILE_NOT_FOUND = 206, 940 HPI_ERROR_DSP_FILE_NOT_FOUND = 206,
@@ -978,6 +971,9 @@ enum HPI_ERROR_CODES {
978 HPI_ERROR_FLASH_VERIFY = 225, 971 HPI_ERROR_FLASH_VERIFY = 225,
979 HPI_ERROR_FLASH_TYPE = 226, 972 HPI_ERROR_FLASH_TYPE = 226,
980 HPI_ERROR_FLASH_START = 227, 973 HPI_ERROR_FLASH_START = 227,
974 HPI_ERROR_FLASH_READ = 228,
975 HPI_ERROR_FLASH_READ_NO_FILE = 229,
976 HPI_ERROR_FLASH_SIZE = 230,
981 977
982 /** Reserved for OEMs. */ 978 /** Reserved for OEMs. */
983 HPI_ERROR_RESERVED_1 = 290, 979 HPI_ERROR_RESERVED_1 = 290,
@@ -1020,6 +1016,8 @@ enum HPI_ERROR_CODES {
1020 HPI_ERROR_NO_INTERDSP_GROUPS = 315, 1016 HPI_ERROR_NO_INTERDSP_GROUPS = 315,
1021 /** Stream wait cancelled before threshold reached. */ 1017 /** Stream wait cancelled before threshold reached. */
1022 HPI_ERROR_WAIT_CANCELLED = 316, 1018 HPI_ERROR_WAIT_CANCELLED = 316,
1019 /** A character string is invalid. */
1020 HPI_ERROR_INVALID_STRING = 317,
1023 1021
1024 /** Invalid mixer node for this adapter. */ 1022 /** Invalid mixer node for this adapter. */
1025 HPI_ERROR_INVALID_NODE = 400, 1023 HPI_ERROR_INVALID_NODE = 400,
@@ -1046,11 +1044,15 @@ enum HPI_ERROR_CODES {
1046 /** I2C */ 1044 /** I2C */
1047 HPI_ERROR_I2C_BAD_ADR = 460, 1045 HPI_ERROR_I2C_BAD_ADR = 460,
1048 1046
1049 /** Entity errors */ 1047 /** Entity type did not match requested type */
1050 HPI_ERROR_ENTITY_TYPE_MISMATCH = 470, 1048 HPI_ERROR_ENTITY_TYPE_MISMATCH = 470,
1049 /** Entity item count did not match requested count */
1051 HPI_ERROR_ENTITY_ITEM_COUNT = 471, 1050 HPI_ERROR_ENTITY_ITEM_COUNT = 471,
1051 /** Entity type is not one of the valid types */
1052 HPI_ERROR_ENTITY_TYPE_INVALID = 472, 1052 HPI_ERROR_ENTITY_TYPE_INVALID = 472,
1053 /** Entity role is not one of the valid roles */
1053 HPI_ERROR_ENTITY_ROLE_INVALID = 473, 1054 HPI_ERROR_ENTITY_ROLE_INVALID = 473,
1055 /** Entity size doesn't match target size */
1054 HPI_ERROR_ENTITY_SIZE_MISMATCH = 474, 1056 HPI_ERROR_ENTITY_SIZE_MISMATCH = 474,
1055 1057
1056 /* AES18 specific errors were 500..507 */ 1058 /* AES18 specific errors were 500..507 */
@@ -1078,8 +1080,7 @@ enum HPI_ERROR_CODES {
1078/** \defgroup maximums HPI maximum values 1080/** \defgroup maximums HPI maximum values
1079\{ 1081\{
1080*/ 1082*/
1081/** Maximum number of adapters per HPI sub-system 1083/** Maximum number of PCI HPI adapters */
1082 WARNING: modifying this value changes the response structure size.*/
1083#define HPI_MAX_ADAPTERS 20 1084#define HPI_MAX_ADAPTERS 20
1084/** Maximum number of in or out streams per adapter */ 1085/** Maximum number of in or out streams per adapter */
1085#define HPI_MAX_STREAMS 16 1086#define HPI_MAX_STREAMS 16
@@ -1090,6 +1091,9 @@ enum HPI_ERROR_CODES {
1090#define HPI_MAX_ANC_BYTES_PER_FRAME (64) 1091#define HPI_MAX_ANC_BYTES_PER_FRAME (64)
1091#define HPI_STRING_LEN 16 1092#define HPI_STRING_LEN 16
1092 1093
1094/** Networked adapters have index >= 100 */
1095#define HPI_MIN_NETWORK_ADAPTER_IDX 100
1096
1093/** Velocity units */ 1097/** Velocity units */
1094#define HPI_OSTREAM_VELOCITY_UNITS 4096 1098#define HPI_OSTREAM_VELOCITY_UNITS 4096
1095/** OutStream timescale units */ 1099/** OutStream timescale units */
@@ -1111,14 +1115,14 @@ enum HPI_ERROR_CODES {
1111struct hpi_format { 1115struct hpi_format {
1112 u32 sample_rate; 1116 u32 sample_rate;
1113 /**< 11025, 32000, 44100 ... */ 1117 /**< 11025, 32000, 44100 ... */
1114 u32 bit_rate; /**< for MPEG */ 1118 u32 bit_rate; /**< for MPEG */
1115 u32 attributes; 1119 u32 attributes;
1116 /**< Stereo/JointStereo/Mono */ 1120 /**< Stereo/JointStereo/Mono */
1117 u16 mode_legacy; 1121 u16 mode_legacy;
1118 /**< Legacy ancillary mode or idle bit */ 1122 /**< Legacy ancillary mode or idle bit */
1119 u16 unused; /**< Unused */ 1123 u16 unused; /**< Unused */
1120 u16 channels; /**< 1,2..., (or ancillary mode or idle bit */ 1124 u16 channels; /**< 1,2..., (or ancillary mode or idle bit */
1121 u16 format; /**< HPI_FORMAT_PCM16, _MPEG etc. see #HPI_FORMATS. */ 1125 u16 format; /**< HPI_FORMAT_PCM16, _MPEG etc. see #HPI_FORMATS. */
1122}; 1126};
1123 1127
1124struct hpi_anc_frame { 1128struct hpi_anc_frame {
@@ -1144,9 +1148,6 @@ struct hpi_async_event {
1144 } u; 1148 } u;
1145}; 1149};
1146 1150
1147/* skip host side function declarations for
1148 DSP compile and documentation extraction */
1149
1150#ifndef DISABLE_PRAGMA_PACK1 1151#ifndef DISABLE_PRAGMA_PACK1
1151#pragma pack(pop) 1152#pragma pack(pop)
1152#endif 1153#endif
@@ -1357,7 +1358,7 @@ u16 hpi_volume_get_mute(u32 h_control, u32 *mute);
1357u16 hpi_volume_query_range(u32 h_control, short *min_gain_01dB, 1358u16 hpi_volume_query_range(u32 h_control, short *min_gain_01dB,
1358 short *max_gain_01dB, short *step_gain_01dB); 1359 short *max_gain_01dB, short *step_gain_01dB);
1359 1360
1360u16 hpi_volume_query_channels(const u32 h_volume, u32 *p_channels); 1361u16 hpi_volume_query_channels(const u32 h_control, u32 *p_channels);
1361 1362
1362u16 hpi_volume_auto_fade(u32 h_control, 1363u16 hpi_volume_auto_fade(u32 h_control,
1363 short an_stop_gain0_01dB[HPI_MAX_CHANNELS], u32 duration_ms); 1364 short an_stop_gain0_01dB[HPI_MAX_CHANNELS], u32 duration_ms);
@@ -1366,6 +1367,9 @@ u16 hpi_volume_auto_fade_profile(u32 h_control,
1366 short an_stop_gain0_01dB[HPI_MAX_CHANNELS], u32 duration_ms, 1367 short an_stop_gain0_01dB[HPI_MAX_CHANNELS], u32 duration_ms,
1367 u16 profile); 1368 u16 profile);
1368 1369
1370u16 hpi_volume_query_auto_fade_profile(const u32 h_control, const u32 i,
1371 u16 *profile);
1372
1369/*****************/ 1373/*****************/
1370/* Level control */ 1374/* Level control */
1371/*****************/ 1375/*****************/
diff --git a/sound/pci/asihpi/hpi6000.c b/sound/pci/asihpi/hpi6000.c
index 3cc6f11c20aa..2414d7a2239d 100644
--- a/sound/pci/asihpi/hpi6000.c
+++ b/sound/pci/asihpi/hpi6000.c
@@ -1,7 +1,7 @@
1/****************************************************************************** 1/******************************************************************************
2 2
3 AudioScience HPI driver 3 AudioScience HPI driver
4 Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as 7 it under the terms of version 2 of the GNU General Public License as
@@ -231,6 +231,8 @@ static void subsys_message(struct hpi_message *phm, struct hpi_response *phr)
231static void control_message(struct hpi_adapter_obj *pao, 231static void control_message(struct hpi_adapter_obj *pao,
232 struct hpi_message *phm, struct hpi_response *phr) 232 struct hpi_message *phm, struct hpi_response *phr)
233{ 233{
234 struct hpi_hw_obj *phw = pao->priv;
235
234 switch (phm->function) { 236 switch (phm->function) {
235 case HPI_CONTROL_GET_STATE: 237 case HPI_CONTROL_GET_STATE:
236 if (pao->has_control_cache) { 238 if (pao->has_control_cache) {
@@ -248,17 +250,14 @@ static void control_message(struct hpi_adapter_obj *pao,
248 break; 250 break;
249 } 251 }
250 252
251 if (hpi_check_control_cache(((struct hpi_hw_obj *) 253 if (hpi_check_control_cache(phw->p_cache, phm, phr))
252 pao->priv)->p_cache, phm,
253 phr))
254 break; 254 break;
255 } 255 }
256 hw_message(pao, phm, phr); 256 hw_message(pao, phm, phr);
257 break; 257 break;
258 case HPI_CONTROL_SET_STATE: 258 case HPI_CONTROL_SET_STATE:
259 hw_message(pao, phm, phr); 259 hw_message(pao, phm, phr);
260 hpi_cmn_control_cache_sync_to_msg(((struct hpi_hw_obj *)pao-> 260 hpi_cmn_control_cache_sync_to_msg(phw->p_cache, phm, phr);
261 priv)->p_cache, phm, phr);
262 break; 261 break;
263 262
264 case HPI_CONTROL_GET_INFO: 263 case HPI_CONTROL_GET_INFO:
@@ -451,11 +450,11 @@ static void subsys_create_adapter(struct hpi_message *phm,
451 } 450 }
452 451
453 for (dsp_index = 0; dsp_index < MAX_DSPS; dsp_index++) { 452 for (dsp_index = 0; dsp_index < MAX_DSPS; dsp_index++) {
454 struct hpi_hw_obj *phw = (struct hpi_hw_obj *)pao->priv; 453 struct hpi_hw_obj *phw = pao->priv;
455 phw->ado[dsp_index].pa_parent_adapter = pao; 454 phw->ado[dsp_index].pa_parent_adapter = pao;
456 } 455 }
457 456
458 phr->u.s.adapter_type = ao.adapter_type; 457 phr->u.s.adapter_type = ao.type;
459 phr->u.s.adapter_index = ao.index; 458 phr->u.s.adapter_index = ao.index;
460 phr->error = 0; 459 phr->error = 0;
461} 460}
@@ -476,7 +475,7 @@ static short create_adapter_obj(struct hpi_adapter_obj *pao,
476 u32 dsp_index = 0; 475 u32 dsp_index = 0;
477 u32 control_cache_size = 0; 476 u32 control_cache_size = 0;
478 u32 control_cache_count = 0; 477 u32 control_cache_count = 0;
479 struct hpi_hw_obj *phw = (struct hpi_hw_obj *)pao->priv; 478 struct hpi_hw_obj *phw = pao->priv;
480 479
481 /* The PCI2040 has the following address map */ 480 /* The PCI2040 has the following address map */
482 /* BAR0 - 4K = HPI control and status registers on PCI2040 (HPI CSR) */ 481 /* BAR0 - 4K = HPI control and status registers on PCI2040 (HPI CSR) */
@@ -559,7 +558,7 @@ static short create_adapter_obj(struct hpi_adapter_obj *pao,
559 if (error) 558 if (error)
560 return error; 559 return error;
561 } 560 }
562 pao->adapter_type = hr0.u.ax.info.adapter_type; 561 pao->type = hr0.u.ax.info.adapter_type;
563 pao->index = hr0.u.ax.info.adapter_index; 562 pao->index = hr0.u.ax.info.adapter_index;
564 } 563 }
565 564
@@ -584,9 +583,8 @@ static short create_adapter_obj(struct hpi_adapter_obj *pao,
584 pao->has_control_cache = 1; 583 pao->has_control_cache = 1;
585 } 584 }
586 585
587 HPI_DEBUG_LOG(DEBUG, "get adapter info ASI%04X index %d\n", 586 HPI_DEBUG_LOG(DEBUG, "get adapter info ASI%04X index %d\n", pao->type,
588 pao->adapter_type, pao->index); 587 pao->index);
589 pao->open = 0; /* upon creation the adapter is closed */
590 588
591 if (phw->p_cache) 589 if (phw->p_cache)
592 phw->p_cache->adap_idx = pao->index; 590 phw->p_cache->adap_idx = pao->index;
@@ -596,7 +594,7 @@ static short create_adapter_obj(struct hpi_adapter_obj *pao,
596 594
597static void delete_adapter_obj(struct hpi_adapter_obj *pao) 595static void delete_adapter_obj(struct hpi_adapter_obj *pao)
598{ 596{
599 struct hpi_hw_obj *phw = (struct hpi_hw_obj *)pao->priv; 597 struct hpi_hw_obj *phw = pao->priv;
600 598
601 if (pao->has_control_cache) 599 if (pao->has_control_cache)
602 hpi_free_control_cache(phw->p_cache); 600 hpi_free_control_cache(phw->p_cache);
@@ -639,7 +637,7 @@ static void adapter_get_asserts(struct hpi_adapter_obj *pao,
639static short hpi6000_adapter_boot_load_dsp(struct hpi_adapter_obj *pao, 637static short hpi6000_adapter_boot_load_dsp(struct hpi_adapter_obj *pao,
640 u32 *pos_error_code) 638 u32 *pos_error_code)
641{ 639{
642 struct hpi_hw_obj *phw = (struct hpi_hw_obj *)pao->priv; 640 struct hpi_hw_obj *phw = pao->priv;
643 short error; 641 short error;
644 u32 timeout; 642 u32 timeout;
645 u32 read = 0; 643 u32 read = 0;
@@ -1220,8 +1218,8 @@ static void hpi_read_block(struct dsp_obj *pdo, u32 address, u32 *pdata,
1220static u16 hpi6000_dsp_block_write32(struct hpi_adapter_obj *pao, 1218static u16 hpi6000_dsp_block_write32(struct hpi_adapter_obj *pao,
1221 u16 dsp_index, u32 hpi_address, u32 *source, u32 count) 1219 u16 dsp_index, u32 hpi_address, u32 *source, u32 count)
1222{ 1220{
1223 struct dsp_obj *pdo = 1221 struct hpi_hw_obj *phw = pao->priv;
1224 &(*(struct hpi_hw_obj *)pao->priv).ado[dsp_index]; 1222 struct dsp_obj *pdo = &phw->ado[dsp_index];
1225 u32 time_out = PCI_TIMEOUT; 1223 u32 time_out = PCI_TIMEOUT;
1226 int c6711_burst_size = 128; 1224 int c6711_burst_size = 128;
1227 u32 local_hpi_address = hpi_address; 1225 u32 local_hpi_address = hpi_address;
@@ -1258,8 +1256,8 @@ static u16 hpi6000_dsp_block_write32(struct hpi_adapter_obj *pao,
1258static u16 hpi6000_dsp_block_read32(struct hpi_adapter_obj *pao, 1256static u16 hpi6000_dsp_block_read32(struct hpi_adapter_obj *pao,
1259 u16 dsp_index, u32 hpi_address, u32 *dest, u32 count) 1257 u16 dsp_index, u32 hpi_address, u32 *dest, u32 count)
1260{ 1258{
1261 struct dsp_obj *pdo = 1259 struct hpi_hw_obj *phw = pao->priv;
1262 &(*(struct hpi_hw_obj *)pao->priv).ado[dsp_index]; 1260 struct dsp_obj *pdo = &phw->ado[dsp_index];
1263 u32 time_out = PCI_TIMEOUT; 1261 u32 time_out = PCI_TIMEOUT;
1264 int c6711_burst_size = 16; 1262 int c6711_burst_size = 16;
1265 u32 local_hpi_address = hpi_address; 1263 u32 local_hpi_address = hpi_address;
@@ -1298,7 +1296,7 @@ static u16 hpi6000_dsp_block_read32(struct hpi_adapter_obj *pao,
1298static short hpi6000_message_response_sequence(struct hpi_adapter_obj *pao, 1296static short hpi6000_message_response_sequence(struct hpi_adapter_obj *pao,
1299 u16 dsp_index, struct hpi_message *phm, struct hpi_response *phr) 1297 u16 dsp_index, struct hpi_message *phm, struct hpi_response *phr)
1300{ 1298{
1301 struct hpi_hw_obj *phw = (struct hpi_hw_obj *)pao->priv; 1299 struct hpi_hw_obj *phw = pao->priv;
1302 struct dsp_obj *pdo = &phw->ado[dsp_index]; 1300 struct dsp_obj *pdo = &phw->ado[dsp_index];
1303 u32 timeout; 1301 u32 timeout;
1304 u16 ack; 1302 u16 ack;
@@ -1414,8 +1412,8 @@ static short hpi6000_send_data_check_adr(u32 address, u32 length_in_dwords)
1414static short hpi6000_send_data(struct hpi_adapter_obj *pao, u16 dsp_index, 1412static short hpi6000_send_data(struct hpi_adapter_obj *pao, u16 dsp_index,
1415 struct hpi_message *phm, struct hpi_response *phr) 1413 struct hpi_message *phm, struct hpi_response *phr)
1416{ 1414{
1417 struct dsp_obj *pdo = 1415 struct hpi_hw_obj *phw = pao->priv;
1418 &(*(struct hpi_hw_obj *)pao->priv).ado[dsp_index]; 1416 struct dsp_obj *pdo = &phw->ado[dsp_index];
1419 u32 data_sent = 0; 1417 u32 data_sent = 0;
1420 u16 ack; 1418 u16 ack;
1421 u32 length, address; 1419 u32 length, address;
@@ -1487,8 +1485,8 @@ static short hpi6000_send_data(struct hpi_adapter_obj *pao, u16 dsp_index,
1487static short hpi6000_get_data(struct hpi_adapter_obj *pao, u16 dsp_index, 1485static short hpi6000_get_data(struct hpi_adapter_obj *pao, u16 dsp_index,
1488 struct hpi_message *phm, struct hpi_response *phr) 1486 struct hpi_message *phm, struct hpi_response *phr)
1489{ 1487{
1490 struct dsp_obj *pdo = 1488 struct hpi_hw_obj *phw = pao->priv;
1491 &(*(struct hpi_hw_obj *)pao->priv).ado[dsp_index]; 1489 struct dsp_obj *pdo = &phw->ado[dsp_index];
1492 u32 data_got = 0; 1490 u32 data_got = 0;
1493 u16 ack; 1491 u16 ack;
1494 u32 length, address; 1492 u32 length, address;
@@ -1551,8 +1549,8 @@ static void hpi6000_send_dsp_interrupt(struct dsp_obj *pdo)
1551static short hpi6000_send_host_command(struct hpi_adapter_obj *pao, 1549static short hpi6000_send_host_command(struct hpi_adapter_obj *pao,
1552 u16 dsp_index, u32 host_cmd) 1550 u16 dsp_index, u32 host_cmd)
1553{ 1551{
1554 struct dsp_obj *pdo = 1552 struct hpi_hw_obj *phw = pao->priv;
1555 &(*(struct hpi_hw_obj *)pao->priv).ado[dsp_index]; 1553 struct dsp_obj *pdo = &phw->ado[dsp_index];
1556 u32 timeout = TIMEOUT; 1554 u32 timeout = TIMEOUT;
1557 1555
1558 /* set command */ 1556 /* set command */
@@ -1577,7 +1575,7 @@ static short hpi6000_check_PCI2040_error_flag(struct hpi_adapter_obj *pao,
1577{ 1575{
1578 u32 hPI_error; 1576 u32 hPI_error;
1579 1577
1580 struct hpi_hw_obj *phw = (struct hpi_hw_obj *)pao->priv; 1578 struct hpi_hw_obj *phw = pao->priv;
1581 1579
1582 /* read the error bits from the PCI2040 */ 1580 /* read the error bits from the PCI2040 */
1583 hPI_error = ioread32(phw->dw2040_HPICSR + HPI_ERROR_REPORT); 1581 hPI_error = ioread32(phw->dw2040_HPICSR + HPI_ERROR_REPORT);
@@ -1597,8 +1595,8 @@ static short hpi6000_check_PCI2040_error_flag(struct hpi_adapter_obj *pao,
1597static short hpi6000_wait_dsp_ack(struct hpi_adapter_obj *pao, u16 dsp_index, 1595static short hpi6000_wait_dsp_ack(struct hpi_adapter_obj *pao, u16 dsp_index,
1598 u32 ack_value) 1596 u32 ack_value)
1599{ 1597{
1600 struct dsp_obj *pdo = 1598 struct hpi_hw_obj *phw = pao->priv;
1601 &(*(struct hpi_hw_obj *)pao->priv).ado[dsp_index]; 1599 struct dsp_obj *pdo = &phw->ado[dsp_index];
1602 u32 ack = 0L; 1600 u32 ack = 0L;
1603 u32 timeout; 1601 u32 timeout;
1604 u32 hPIC = 0L; 1602 u32 hPIC = 0L;
@@ -1640,7 +1638,7 @@ static short hpi6000_update_control_cache(struct hpi_adapter_obj *pao,
1640 struct hpi_message *phm) 1638 struct hpi_message *phm)
1641{ 1639{
1642 const u16 dsp_index = 0; 1640 const u16 dsp_index = 0;
1643 struct hpi_hw_obj *phw = (struct hpi_hw_obj *)pao->priv; 1641 struct hpi_hw_obj *phw = pao->priv;
1644 struct dsp_obj *pdo = &phw->ado[dsp_index]; 1642 struct dsp_obj *pdo = &phw->ado[dsp_index];
1645 u32 timeout; 1643 u32 timeout;
1646 u32 cache_dirty_flag; 1644 u32 cache_dirty_flag;
@@ -1740,7 +1738,8 @@ static void hw_message(struct hpi_adapter_obj *pao, struct hpi_message *phm,
1740{ 1738{
1741 u16 error = 0; 1739 u16 error = 0;
1742 u16 dsp_index = 0; 1740 u16 dsp_index = 0;
1743 u16 num_dsp = ((struct hpi_hw_obj *)pao->priv)->num_dsp; 1741 struct hpi_hw_obj *phw = pao->priv;
1742 u16 num_dsp = phw->num_dsp;
1744 1743
1745 if (num_dsp < 2) 1744 if (num_dsp < 2)
1746 dsp_index = 0; 1745 dsp_index = 0;
diff --git a/sound/pci/asihpi/hpi6000.h b/sound/pci/asihpi/hpi6000.h
index 4c7d507c0ecd..7e0deeff5e7c 100644
--- a/sound/pci/asihpi/hpi6000.h
+++ b/sound/pci/asihpi/hpi6000.h
@@ -1,7 +1,7 @@
1/***************************************************************************** 1/*****************************************************************************
2 2
3 AudioScience HPI driver 3 AudioScience HPI driver
4 Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as 7 it under the terms of version 2 of the GNU General Public License as
diff --git a/sound/pci/asihpi/hpi6205.c b/sound/pci/asihpi/hpi6205.c
index e041a6ae1c5a..4f2873880b16 100644
--- a/sound/pci/asihpi/hpi6205.c
+++ b/sound/pci/asihpi/hpi6205.c
@@ -1,7 +1,7 @@
1/****************************************************************************** 1/******************************************************************************
2 2
3 AudioScience HPI driver 3 AudioScience HPI driver
4 Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as 7 it under the terms of version 2 of the GNU General Public License as
@@ -45,18 +45,21 @@
45#define HPI6205_ERROR_MSG_RESP_TIMEOUT 1016 45#define HPI6205_ERROR_MSG_RESP_TIMEOUT 1016
46 46
47/* initialization/bootload errors */ 47/* initialization/bootload errors */
48#define HPI6205_ERROR_6205_NO_IRQ 1002 48#define HPI6205_ERROR_6205_NO_IRQ 1002
49#define HPI6205_ERROR_6205_INIT_FAILED 1003 49#define HPI6205_ERROR_6205_INIT_FAILED 1003
50#define HPI6205_ERROR_6205_REG 1006 50#define HPI6205_ERROR_6205_REG 1006
51#define HPI6205_ERROR_6205_DSPPAGE 1007 51#define HPI6205_ERROR_6205_DSPPAGE 1007
52#define HPI6205_ERROR_C6713_HPIC 1009 52#define HPI6205_ERROR_C6713_HPIC 1009
53#define HPI6205_ERROR_C6713_HPIA 1010 53#define HPI6205_ERROR_C6713_HPIA 1010
54#define HPI6205_ERROR_C6713_PLL 1011 54#define HPI6205_ERROR_C6713_PLL 1011
55#define HPI6205_ERROR_DSP_INTMEM 1012 55#define HPI6205_ERROR_DSP_INTMEM 1012
56#define HPI6205_ERROR_DSP_EXTMEM 1013 56#define HPI6205_ERROR_DSP_EXTMEM 1013
57#define HPI6205_ERROR_DSP_PLD 1014 57#define HPI6205_ERROR_DSP_PLD 1014
58#define HPI6205_ERROR_6205_EEPROM 1017 58#define HPI6205_ERROR_6205_EEPROM 1017
59#define HPI6205_ERROR_DSP_EMIF 1018 59#define HPI6205_ERROR_DSP_EMIF1 1018
60#define HPI6205_ERROR_DSP_EMIF2 1019
61#define HPI6205_ERROR_DSP_EMIF3 1020
62#define HPI6205_ERROR_DSP_EMIF4 1021
60 63
61/*****************************************************************************/ 64/*****************************************************************************/
62/* for C6205 PCI i/f */ 65/* for C6205 PCI i/f */
@@ -488,7 +491,7 @@ static void subsys_create_adapter(struct hpi_message *phm,
488 return; 491 return;
489 } 492 }
490 493
491 phr->u.s.adapter_type = ao.adapter_type; 494 phr->u.s.adapter_type = ao.type;
492 phr->u.s.adapter_index = ao.index; 495 phr->u.s.adapter_index = ao.index;
493 phr->error = 0; 496 phr->error = 0;
494} 497}
@@ -503,7 +506,7 @@ static void adapter_delete(struct hpi_adapter_obj *pao,
503 phr->error = HPI_ERROR_INVALID_OBJ_INDEX; 506 phr->error = HPI_ERROR_INVALID_OBJ_INDEX;
504 return; 507 return;
505 } 508 }
506 phw = (struct hpi_hw_obj *)pao->priv; 509 phw = pao->priv;
507 /* reset adapter h/w */ 510 /* reset adapter h/w */
508 /* Reset C6713 #1 */ 511 /* Reset C6713 #1 */
509 boot_loader_write_mem32(pao, 0, C6205_BAR0_TIMER1_CTL, 0); 512 boot_loader_write_mem32(pao, 0, C6205_BAR0_TIMER1_CTL, 0);
@@ -652,7 +655,7 @@ static u16 create_adapter_obj(struct hpi_adapter_obj *pao,
652 if (hr.error) 655 if (hr.error)
653 return hr.error; 656 return hr.error;
654 657
655 pao->adapter_type = hr.u.ax.info.adapter_type; 658 pao->type = hr.u.ax.info.adapter_type;
656 pao->index = hr.u.ax.info.adapter_index; 659 pao->index = hr.u.ax.info.adapter_index;
657 660
658 max_streams = 661 max_streams =
@@ -665,8 +668,6 @@ static u16 create_adapter_obj(struct hpi_adapter_obj *pao,
665 hr.u.ax.info.serial_number); 668 hr.u.ax.info.serial_number);
666 } 669 }
667 670
668 pao->open = 0; /* upon creation the adapter is closed */
669
670 if (phw->p_cache) 671 if (phw->p_cache)
671 phw->p_cache->adap_idx = pao->index; 672 phw->p_cache->adap_idx = pao->index;
672 673
@@ -803,8 +804,8 @@ static void outstream_host_buffer_allocate(struct hpi_adapter_obj *pao,
803 obj_index]; 804 obj_index];
804 status->samples_processed = 0; 805 status->samples_processed = 0;
805 status->stream_state = HPI_STATE_STOPPED; 806 status->stream_state = HPI_STATE_STOPPED;
806 status->dSP_index = 0; 807 status->dsp_index = 0;
807 status->host_index = status->dSP_index; 808 status->host_index = status->dsp_index;
808 status->size_in_bytes = phm->u.d.u.buffer.buffer_size; 809 status->size_in_bytes = phm->u.d.u.buffer.buffer_size;
809 status->auxiliary_data_available = 0; 810 status->auxiliary_data_available = 0;
810 811
@@ -878,7 +879,7 @@ static void outstream_host_buffer_free(struct hpi_adapter_obj *pao,
878static u32 outstream_get_space_available(struct hpi_hostbuffer_status *status) 879static u32 outstream_get_space_available(struct hpi_hostbuffer_status *status)
879{ 880{
880 return status->size_in_bytes - (status->host_index - 881 return status->size_in_bytes - (status->host_index -
881 status->dSP_index); 882 status->dsp_index);
882} 883}
883 884
884static void outstream_write(struct hpi_adapter_obj *pao, 885static void outstream_write(struct hpi_adapter_obj *pao,
@@ -1080,8 +1081,8 @@ static void instream_host_buffer_allocate(struct hpi_adapter_obj *pao,
1080 obj_index]; 1081 obj_index];
1081 status->samples_processed = 0; 1082 status->samples_processed = 0;
1082 status->stream_state = HPI_STATE_STOPPED; 1083 status->stream_state = HPI_STATE_STOPPED;
1083 status->dSP_index = 0; 1084 status->dsp_index = 0;
1084 status->host_index = status->dSP_index; 1085 status->host_index = status->dsp_index;
1085 status->size_in_bytes = phm->u.d.u.buffer.buffer_size; 1086 status->size_in_bytes = phm->u.d.u.buffer.buffer_size;
1086 status->auxiliary_data_available = 0; 1087 status->auxiliary_data_available = 0;
1087 1088
@@ -1162,7 +1163,7 @@ static void instream_start(struct hpi_adapter_obj *pao,
1162 1163
1163static u32 instream_get_bytes_available(struct hpi_hostbuffer_status *status) 1164static u32 instream_get_bytes_available(struct hpi_hostbuffer_status *status)
1164{ 1165{
1165 return status->dSP_index - status->host_index; 1166 return status->dsp_index - status->host_index;
1166} 1167}
1167 1168
1168static void instream_read(struct hpi_adapter_obj *pao, 1169static void instream_read(struct hpi_adapter_obj *pao,
@@ -1614,7 +1615,7 @@ static u16 boot_loader_config_emif(struct hpi_adapter_obj *pao, int dsp_index)
1614 boot_loader_write_mem32(pao, dsp_index, 0x01800008, setting); 1615 boot_loader_write_mem32(pao, dsp_index, 0x01800008, setting);
1615 if (setting != boot_loader_read_mem32(pao, dsp_index, 1616 if (setting != boot_loader_read_mem32(pao, dsp_index,
1616 0x01800008)) 1617 0x01800008))
1617 return HPI6205_ERROR_DSP_EMIF; 1618 return HPI6205_ERROR_DSP_EMIF1;
1618 1619
1619 /* EMIF CE1 setup - 32 bit async. This is 6713 #1 HPI, */ 1620 /* EMIF CE1 setup - 32 bit async. This is 6713 #1 HPI, */
1620 /* which occupies D15..0. 6713 starts at 27MHz, so need */ 1621 /* which occupies D15..0. 6713 starts at 27MHz, so need */
@@ -1627,7 +1628,7 @@ static u16 boot_loader_config_emif(struct hpi_adapter_obj *pao, int dsp_index)
1627 boot_loader_write_mem32(pao, dsp_index, 0x01800004, setting); 1628 boot_loader_write_mem32(pao, dsp_index, 0x01800004, setting);
1628 if (setting != boot_loader_read_mem32(pao, dsp_index, 1629 if (setting != boot_loader_read_mem32(pao, dsp_index,
1629 0x01800004)) 1630 0x01800004))
1630 return HPI6205_ERROR_DSP_EMIF; 1631 return HPI6205_ERROR_DSP_EMIF2;
1631 1632
1632 /* EMIF CE2 setup - 32 bit async. This is 6713 #2 HPI, */ 1633 /* EMIF CE2 setup - 32 bit async. This is 6713 #2 HPI, */
1633 /* which occupies D15..0. 6713 starts at 27MHz, so need */ 1634 /* which occupies D15..0. 6713 starts at 27MHz, so need */
@@ -1639,7 +1640,7 @@ static u16 boot_loader_config_emif(struct hpi_adapter_obj *pao, int dsp_index)
1639 boot_loader_write_mem32(pao, dsp_index, 0x01800010, setting); 1640 boot_loader_write_mem32(pao, dsp_index, 0x01800010, setting);
1640 if (setting != boot_loader_read_mem32(pao, dsp_index, 1641 if (setting != boot_loader_read_mem32(pao, dsp_index,
1641 0x01800010)) 1642 0x01800010))
1642 return HPI6205_ERROR_DSP_EMIF; 1643 return HPI6205_ERROR_DSP_EMIF3;
1643 1644
1644 /* EMIF CE3 setup - 32 bit async. */ 1645 /* EMIF CE3 setup - 32 bit async. */
1645 /* This is the PLD on the ASI5000 cards only */ 1646 /* This is the PLD on the ASI5000 cards only */
@@ -1650,7 +1651,7 @@ static u16 boot_loader_config_emif(struct hpi_adapter_obj *pao, int dsp_index)
1650 boot_loader_write_mem32(pao, dsp_index, 0x01800014, setting); 1651 boot_loader_write_mem32(pao, dsp_index, 0x01800014, setting);
1651 if (setting != boot_loader_read_mem32(pao, dsp_index, 1652 if (setting != boot_loader_read_mem32(pao, dsp_index,
1652 0x01800014)) 1653 0x01800014))
1653 return HPI6205_ERROR_DSP_EMIF; 1654 return HPI6205_ERROR_DSP_EMIF4;
1654 1655
1655 /* set EMIF SDRAM control for 2Mx32 SDRAM (512x32x4 bank) */ 1656 /* set EMIF SDRAM control for 2Mx32 SDRAM (512x32x4 bank) */
1656 /* need to use this else DSP code crashes? */ 1657 /* need to use this else DSP code crashes? */
diff --git a/sound/pci/asihpi/hpi_internal.h b/sound/pci/asihpi/hpi_internal.h
index d497030c160f..4cc315daeda0 100644
--- a/sound/pci/asihpi/hpi_internal.h
+++ b/sound/pci/asihpi/hpi_internal.h
@@ -25,6 +25,7 @@ HPI internal definitions
25#define _HPI_INTERNAL_H_ 25#define _HPI_INTERNAL_H_
26 26
27#include "hpi.h" 27#include "hpi.h"
28
28/** maximum number of memory regions mapped to an adapter */ 29/** maximum number of memory regions mapped to an adapter */
29#define HPI_MAX_ADAPTER_MEM_SPACES (2) 30#define HPI_MAX_ADAPTER_MEM_SPACES (2)
30 31
@@ -220,8 +221,6 @@ enum HPI_CONTROL_ATTRIBUTES {
220 221
221 HPI_COBRANET_SET = HPI_CTL_ATTR(COBRANET, 1), 222 HPI_COBRANET_SET = HPI_CTL_ATTR(COBRANET, 1),
222 HPI_COBRANET_GET = HPI_CTL_ATTR(COBRANET, 2), 223 HPI_COBRANET_GET = HPI_CTL_ATTR(COBRANET, 2),
223 /*HPI_COBRANET_SET_DATA = HPI_CTL_ATTR(COBRANET, 3), */
224 /*HPI_COBRANET_GET_DATA = HPI_CTL_ATTR(COBRANET, 4), */
225 HPI_COBRANET_GET_STATUS = HPI_CTL_ATTR(COBRANET, 5), 224 HPI_COBRANET_GET_STATUS = HPI_CTL_ATTR(COBRANET, 5),
226 HPI_COBRANET_SEND_PACKET = HPI_CTL_ATTR(COBRANET, 6), 225 HPI_COBRANET_SEND_PACKET = HPI_CTL_ATTR(COBRANET, 6),
227 HPI_COBRANET_GET_PACKET = HPI_CTL_ATTR(COBRANET, 7), 226 HPI_COBRANET_GET_PACKET = HPI_CTL_ATTR(COBRANET, 7),
@@ -241,7 +240,9 @@ enum HPI_CONTROL_ATTRIBUTES {
241 HPI_PAD_PROGRAM_TYPE = HPI_CTL_ATTR(PAD, 5), 240 HPI_PAD_PROGRAM_TYPE = HPI_CTL_ATTR(PAD, 5),
242 HPI_PAD_PROGRAM_ID = HPI_CTL_ATTR(PAD, 6), 241 HPI_PAD_PROGRAM_ID = HPI_CTL_ATTR(PAD, 6),
243 HPI_PAD_TA_SUPPORT = HPI_CTL_ATTR(PAD, 7), 242 HPI_PAD_TA_SUPPORT = HPI_CTL_ATTR(PAD, 7),
244 HPI_PAD_TA_ACTIVE = HPI_CTL_ATTR(PAD, 8) 243 HPI_PAD_TA_ACTIVE = HPI_CTL_ATTR(PAD, 8),
244
245 HPI_UNIVERSAL_ENTITY = HPI_CTL_ATTR(UNIVERSAL, 1)
245}; 246};
246 247
247#define HPI_POLARITY_POSITIVE 0 248#define HPI_POLARITY_POSITIVE 0
@@ -393,14 +394,10 @@ enum HPI_FUNCTION_IDS {
393 HPI_SUBSYS_OPEN = HPI_FUNC_ID(SUBSYSTEM, 1), 394 HPI_SUBSYS_OPEN = HPI_FUNC_ID(SUBSYSTEM, 1),
394 HPI_SUBSYS_GET_VERSION = HPI_FUNC_ID(SUBSYSTEM, 2), 395 HPI_SUBSYS_GET_VERSION = HPI_FUNC_ID(SUBSYSTEM, 2),
395 HPI_SUBSYS_GET_INFO = HPI_FUNC_ID(SUBSYSTEM, 3), 396 HPI_SUBSYS_GET_INFO = HPI_FUNC_ID(SUBSYSTEM, 3),
396 /* HPI_SUBSYS_FIND_ADAPTERS = HPI_FUNC_ID(SUBSYSTEM, 4), */
397 HPI_SUBSYS_CREATE_ADAPTER = HPI_FUNC_ID(SUBSYSTEM, 5), 397 HPI_SUBSYS_CREATE_ADAPTER = HPI_FUNC_ID(SUBSYSTEM, 5),
398 HPI_SUBSYS_CLOSE = HPI_FUNC_ID(SUBSYSTEM, 6), 398 HPI_SUBSYS_CLOSE = HPI_FUNC_ID(SUBSYSTEM, 6),
399 /* HPI_SUBSYS_DELETE_ADAPTER = HPI_FUNC_ID(SUBSYSTEM, 7), */
400 HPI_SUBSYS_DRIVER_LOAD = HPI_FUNC_ID(SUBSYSTEM, 8), 399 HPI_SUBSYS_DRIVER_LOAD = HPI_FUNC_ID(SUBSYSTEM, 8),
401 HPI_SUBSYS_DRIVER_UNLOAD = HPI_FUNC_ID(SUBSYSTEM, 9), 400 HPI_SUBSYS_DRIVER_UNLOAD = HPI_FUNC_ID(SUBSYSTEM, 9),
402 /* HPI_SUBSYS_READ_PORT_8 = HPI_FUNC_ID(SUBSYSTEM, 10), */
403 /* HPI_SUBSYS_WRITE_PORT_8 = HPI_FUNC_ID(SUBSYSTEM, 11), */
404 HPI_SUBSYS_GET_NUM_ADAPTERS = HPI_FUNC_ID(SUBSYSTEM, 12), 401 HPI_SUBSYS_GET_NUM_ADAPTERS = HPI_FUNC_ID(SUBSYSTEM, 12),
405 HPI_SUBSYS_GET_ADAPTER = HPI_FUNC_ID(SUBSYSTEM, 13), 402 HPI_SUBSYS_GET_ADAPTER = HPI_FUNC_ID(SUBSYSTEM, 13),
406 HPI_SUBSYS_SET_NETWORK_INTERFACE = HPI_FUNC_ID(SUBSYSTEM, 14), 403 HPI_SUBSYS_SET_NETWORK_INTERFACE = HPI_FUNC_ID(SUBSYSTEM, 14),
@@ -430,7 +427,10 @@ enum HPI_FUNCTION_IDS {
430 HPI_ADAPTER_IRQ_QUERY_AND_CLEAR = HPI_FUNC_ID(ADAPTER, 19), 427 HPI_ADAPTER_IRQ_QUERY_AND_CLEAR = HPI_FUNC_ID(ADAPTER, 19),
431 HPI_ADAPTER_IRQ_CALLBACK = HPI_FUNC_ID(ADAPTER, 20), 428 HPI_ADAPTER_IRQ_CALLBACK = HPI_FUNC_ID(ADAPTER, 20),
432 HPI_ADAPTER_DELETE = HPI_FUNC_ID(ADAPTER, 21), 429 HPI_ADAPTER_DELETE = HPI_FUNC_ID(ADAPTER, 21),
433#define HPI_ADAPTER_FUNCTION_COUNT 21 430 HPI_ADAPTER_READ_FLASH = HPI_FUNC_ID(ADAPTER, 22),
431 HPI_ADAPTER_END_FLASH = HPI_FUNC_ID(ADAPTER, 23),
432 HPI_ADAPTER_FILESTORE_DELETE_ALL = HPI_FUNC_ID(ADAPTER, 24),
433#define HPI_ADAPTER_FUNCTION_COUNT 24
434 434
435 HPI_OSTREAM_OPEN = HPI_FUNC_ID(OSTREAM, 1), 435 HPI_OSTREAM_OPEN = HPI_FUNC_ID(OSTREAM, 1),
436 HPI_OSTREAM_CLOSE = HPI_FUNC_ID(OSTREAM, 2), 436 HPI_OSTREAM_CLOSE = HPI_FUNC_ID(OSTREAM, 2),
@@ -495,7 +495,9 @@ enum HPI_FUNCTION_IDS {
495 HPI_MIXER_GET_CONTROL_MULTIPLE_VALUES = HPI_FUNC_ID(MIXER, 10), 495 HPI_MIXER_GET_CONTROL_MULTIPLE_VALUES = HPI_FUNC_ID(MIXER, 10),
496 HPI_MIXER_STORE = HPI_FUNC_ID(MIXER, 11), 496 HPI_MIXER_STORE = HPI_FUNC_ID(MIXER, 11),
497 HPI_MIXER_GET_CACHE_INFO = HPI_FUNC_ID(MIXER, 12), 497 HPI_MIXER_GET_CACHE_INFO = HPI_FUNC_ID(MIXER, 12),
498#define HPI_MIXER_FUNCTION_COUNT 12 498 HPI_MIXER_GET_BLOCK_HANDLE = HPI_FUNC_ID(MIXER, 13),
499 HPI_MIXER_GET_PARAMETER_HANDLE = HPI_FUNC_ID(MIXER, 14),
500#define HPI_MIXER_FUNCTION_COUNT 14
499 501
500 HPI_CONTROL_GET_INFO = HPI_FUNC_ID(CONTROL, 1), 502 HPI_CONTROL_GET_INFO = HPI_FUNC_ID(CONTROL, 1),
501 HPI_CONTROL_GET_STATE = HPI_FUNC_ID(CONTROL, 2), 503 HPI_CONTROL_GET_STATE = HPI_FUNC_ID(CONTROL, 2),
@@ -618,7 +620,7 @@ struct hpi_hostbuffer_status {
618 u32 auxiliary_data_available; 620 u32 auxiliary_data_available;
619 u32 stream_state; 621 u32 stream_state;
620 /* DSP index in to the host bus master buffer. */ 622 /* DSP index in to the host bus master buffer. */
621 u32 dSP_index; 623 u32 dsp_index;
622 /* Host index in to the host bus master buffer. */ 624 /* Host index in to the host bus master buffer. */
623 u32 host_index; 625 u32 host_index;
624 u32 size_in_bytes; 626 u32 size_in_bytes;
@@ -661,13 +663,6 @@ union hpi_adapterx_msg {
661 u16 index; 663 u16 index;
662 } module_info; 664 } module_info;
663 struct { 665 struct {
664 u32 checksum;
665 u16 sequence;
666 u16 length;
667 u16 offset; /**< offset from start of msg to data */
668 u16 unused;
669 } program_flash;
670 struct {
671 u16 index; 666 u16 index;
672 u16 what; 667 u16 what;
673 u16 property_index; 668 u16 property_index;
@@ -678,25 +673,18 @@ union hpi_adapterx_msg {
678 u16 parameter2; 673 u16 parameter2;
679 } property_set; 674 } property_set;
680 struct { 675 struct {
681 u32 offset;
682 } query_flash;
683 struct {
684 u32 pad32; 676 u32 pad32;
685 u16 key1; 677 u16 key1;
686 u16 key2; 678 u16 key2;
687 } restart; 679 } restart;
688 struct { 680 struct {
689 u32 offset;
690 u32 length;
691 u32 key;
692 } start_flash;
693 struct {
694 u32 pad32; 681 u32 pad32;
695 u16 value; 682 u16 value;
696 } test_assert; 683 } test_assert;
697 struct { 684 struct {
698 u32 yes; 685 u32 yes;
699 } irq_query; 686 } irq_query;
687 u32 pad[3];
700}; 688};
701 689
702struct hpi_adapter_res { 690struct hpi_adapter_res {
@@ -724,18 +712,10 @@ union hpi_adapterx_res {
724 u32 adapter_mode; 712 u32 adapter_mode;
725 } mode; 713 } mode;
726 struct { 714 struct {
727 u16 sequence;
728 } program_flash;
729 struct {
730 u16 parameter1; 715 u16 parameter1;
731 u16 parameter2; 716 u16 parameter2;
732 } property_get; 717 } property_get;
733 struct { 718 struct {
734 u32 checksum;
735 u32 length;
736 u32 version;
737 } query_flash;
738 struct {
739 u32 yes; 719 u32 yes;
740 } irq_query; 720 } irq_query;
741}; 721};
@@ -1150,74 +1130,9 @@ struct hpi_res_adapter_get_info {
1150 struct hpi_adapter_res p; 1130 struct hpi_adapter_res p;
1151}; 1131};
1152 1132
1153/* padding is so these are same size as v0 hpi_message */
1154struct hpi_msg_adapter_query_flash {
1155 struct hpi_message_header h;
1156 u32 offset;
1157 u8 pad_to_version0_size[sizeof(struct hpi_message) - /* V0 res */
1158 sizeof(struct hpi_message_header) - 1 * sizeof(u32)];
1159};
1160
1161/* padding is so these are same size as v0 hpi_response */
1162struct hpi_res_adapter_query_flash {
1163 struct hpi_response_header h;
1164 u32 checksum;
1165 u32 length;
1166 u32 version;
1167 u8 pad_to_version0_size[sizeof(struct hpi_response) - /* V0 res */
1168 sizeof(struct hpi_response_header) - 3 * sizeof(u32)];
1169};
1170
1171struct hpi_msg_adapter_start_flash {
1172 struct hpi_message_header h;
1173 u32 offset;
1174 u32 length;
1175 u32 key;
1176 u8 pad_to_version0_size[sizeof(struct hpi_message) - /* V0 res */
1177 sizeof(struct hpi_message_header) - 3 * sizeof(u32)];
1178};
1179
1180struct hpi_res_adapter_start_flash {
1181 struct hpi_response_header h;
1182 u8 pad_to_version0_size[sizeof(struct hpi_response) - /* V0 res */
1183 sizeof(struct hpi_response_header)];
1184};
1185
1186struct hpi_msg_adapter_program_flash_payload {
1187 u32 checksum;
1188 u16 sequence;
1189 u16 length;
1190 u16 offset; /**< offset from start of msg to data */
1191 u16 unused;
1192 /* ensure sizeof(header + payload) == sizeof(hpi_message_V0)
1193 because old firmware expects data after message of this size */
1194 u8 pad_to_version0_size[sizeof(struct hpi_message) - /* V0 message */
1195 sizeof(struct hpi_message_header) - sizeof(u32) -
1196 4 * sizeof(u16)];
1197};
1198
1199struct hpi_msg_adapter_program_flash {
1200 struct hpi_message_header h;
1201 struct hpi_msg_adapter_program_flash_payload p;
1202 u32 data[256];
1203};
1204
1205struct hpi_res_adapter_program_flash {
1206 struct hpi_response_header h;
1207 u16 sequence;
1208 u8 pad_to_version0_size[sizeof(struct hpi_response) - /* V0 res */
1209 sizeof(struct hpi_response_header) - sizeof(u16)];
1210};
1211
1212struct hpi_msg_adapter_debug_read {
1213 struct hpi_message_header h;
1214 u32 dsp_address;
1215 u32 count_bytes;
1216};
1217
1218struct hpi_res_adapter_debug_read { 1133struct hpi_res_adapter_debug_read {
1219 struct hpi_response_header h; 1134 struct hpi_response_header h;
1220 u8 bytes[256]; 1135 u8 bytes[1024];
1221}; 1136};
1222 1137
1223struct hpi_msg_cobranet_hmi { 1138struct hpi_msg_cobranet_hmi {
@@ -1461,7 +1376,7 @@ struct hpi_control_cache_pad {
1461/* 2^N sized FIFO buffer (internal to HPI<->DSP interaction) */ 1376/* 2^N sized FIFO buffer (internal to HPI<->DSP interaction) */
1462struct hpi_fifo_buffer { 1377struct hpi_fifo_buffer {
1463 u32 size; 1378 u32 size;
1464 u32 dSP_index; 1379 u32 dsp_index;
1465 u32 host_index; 1380 u32 host_index;
1466}; 1381};
1467 1382
diff --git a/sound/pci/asihpi/hpi_version.h b/sound/pci/asihpi/hpi_version.h
new file mode 100644
index 000000000000..e9146e53bd50
--- /dev/null
+++ b/sound/pci/asihpi/hpi_version.h
@@ -0,0 +1,32 @@
1/** HPI Version Definitions
2Development releases have odd minor version.
3Production releases have even minor version.
4
5\file hpi_version.h
6*/
7
8#ifndef _HPI_VERSION_H
9#define _HPI_VERSION_H
10
11/* Use single digits for versions less that 10 to avoid octal. */
12/* *** HPI_VER is the only edit required to update version *** */
13/** HPI version */
14#define HPI_VER HPI_VERSION_CONSTRUCTOR(4, 10, 1)
15
16/** HPI version string in dotted decimal format */
17#define HPI_VER_STRING "4.10.01"
18
19/** Library version as documented in hpi-api-versions.txt */
20#define HPI_LIB_VER HPI_VERSION_CONSTRUCTOR(10, 2, 0)
21
22/** Construct hpi version number from major, minor, release numbers */
23#define HPI_VERSION_CONSTRUCTOR(maj, min, r) ((maj << 16) + (min << 8) + r)
24
25/** Extract major version from hpi version number */
26#define HPI_VER_MAJOR(v) ((int)(v >> 16))
27/** Extract minor version from hpi version number */
28#define HPI_VER_MINOR(v) ((int)((v >> 8) & 0xFF))
29/** Extract release from hpi version number */
30#define HPI_VER_RELEASE(v) ((int)(v & 0xFF))
31
32#endif
diff --git a/sound/pci/asihpi/hpicmn.c b/sound/pci/asihpi/hpicmn.c
index bd47521b24ec..7ed5c26c3737 100644
--- a/sound/pci/asihpi/hpicmn.c
+++ b/sound/pci/asihpi/hpicmn.c
@@ -1,7 +1,7 @@
1/****************************************************************************** 1/******************************************************************************
2 2
3 AudioScience HPI driver 3 AudioScience HPI driver
4 Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as 7 it under the terms of version 2 of the GNU General Public License as
@@ -68,7 +68,7 @@ u16 hpi_validate_response(struct hpi_message *phm, struct hpi_response *phr)
68u16 hpi_add_adapter(struct hpi_adapter_obj *pao) 68u16 hpi_add_adapter(struct hpi_adapter_obj *pao)
69{ 69{
70 u16 retval = 0; 70 u16 retval = 0;
71 /*HPI_ASSERT(pao->wAdapterType); */ 71 /*HPI_ASSERT(pao->type); */
72 72
73 hpios_alistlock_lock(&adapters); 73 hpios_alistlock_lock(&adapters);
74 74
@@ -77,13 +77,13 @@ u16 hpi_add_adapter(struct hpi_adapter_obj *pao)
77 goto unlock; 77 goto unlock;
78 } 78 }
79 79
80 if (adapters.adapter[pao->index].adapter_type) { 80 if (adapters.adapter[pao->index].type) {
81 int a; 81 int a;
82 for (a = HPI_MAX_ADAPTERS - 1; a >= 0; a--) { 82 for (a = HPI_MAX_ADAPTERS - 1; a >= 0; a--) {
83 if (!adapters.adapter[a].adapter_type) { 83 if (!adapters.adapter[a].type) {
84 HPI_DEBUG_LOG(WARNING, 84 HPI_DEBUG_LOG(WARNING,
85 "ASI%X duplicate index %d moved to %d\n", 85 "ASI%X duplicate index %d moved to %d\n",
86 pao->adapter_type, pao->index, a); 86 pao->type, pao->index, a);
87 pao->index = a; 87 pao->index = a;
88 break; 88 break;
89 } 89 }
@@ -104,13 +104,13 @@ unlock:
104 104
105void hpi_delete_adapter(struct hpi_adapter_obj *pao) 105void hpi_delete_adapter(struct hpi_adapter_obj *pao)
106{ 106{
107 if (!pao->adapter_type) { 107 if (!pao->type) {
108 HPI_DEBUG_LOG(ERROR, "removing null adapter?\n"); 108 HPI_DEBUG_LOG(ERROR, "removing null adapter?\n");
109 return; 109 return;
110 } 110 }
111 111
112 hpios_alistlock_lock(&adapters); 112 hpios_alistlock_lock(&adapters);
113 if (adapters.adapter[pao->index].adapter_type) 113 if (adapters.adapter[pao->index].type)
114 adapters.gw_num_adapters--; 114 adapters.gw_num_adapters--;
115 memset(&adapters.adapter[pao->index], 0, sizeof(adapters.adapter[0])); 115 memset(&adapters.adapter[pao->index], 0, sizeof(adapters.adapter[0]));
116 hpios_alistlock_unlock(&adapters); 116 hpios_alistlock_unlock(&adapters);
@@ -132,7 +132,7 @@ struct hpi_adapter_obj *hpi_find_adapter(u16 adapter_index)
132 } 132 }
133 133
134 pao = &adapters.adapter[adapter_index]; 134 pao = &adapters.adapter[adapter_index];
135 if (pao->adapter_type != 0) { 135 if (pao->type != 0) {
136 /* 136 /*
137 HPI_DEBUG_LOG(VERBOSE, "Found adapter index %d\n", 137 HPI_DEBUG_LOG(VERBOSE, "Found adapter index %d\n",
138 wAdapterIndex); 138 wAdapterIndex);
@@ -165,7 +165,7 @@ static void subsys_get_adapter(struct hpi_message *phm,
165 165
166 /* find the nCount'th nonzero adapter in array */ 166 /* find the nCount'th nonzero adapter in array */
167 for (index = 0; index < HPI_MAX_ADAPTERS; index++) { 167 for (index = 0; index < HPI_MAX_ADAPTERS; index++) {
168 if (adapters.adapter[index].adapter_type) { 168 if (adapters.adapter[index].type) {
169 if (!count) 169 if (!count)
170 break; 170 break;
171 count--; 171 count--;
@@ -174,11 +174,11 @@ static void subsys_get_adapter(struct hpi_message *phm,
174 174
175 if (index < HPI_MAX_ADAPTERS) { 175 if (index < HPI_MAX_ADAPTERS) {
176 phr->u.s.adapter_index = adapters.adapter[index].index; 176 phr->u.s.adapter_index = adapters.adapter[index].index;
177 phr->u.s.adapter_type = adapters.adapter[index].adapter_type; 177 phr->u.s.adapter_type = adapters.adapter[index].type;
178 } else { 178 } else {
179 phr->u.s.adapter_index = 0; 179 phr->u.s.adapter_index = 0;
180 phr->u.s.adapter_type = 0; 180 phr->u.s.adapter_type = 0;
181 phr->error = HPI_ERROR_BAD_ADAPTER_NUMBER; 181 phr->error = HPI_ERROR_INVALID_OBJ_INDEX;
182 } 182 }
183} 183}
184 184
@@ -324,6 +324,8 @@ short hpi_check_control_cache(struct hpi_control_cache *p_cache,
324 } 324 }
325 325
326 phr->error = 0; 326 phr->error = 0;
327 phr->specific_error = 0;
328 phr->version = 0;
327 329
328 /* set the default response size */ 330 /* set the default response size */
329 response_size = 331 response_size =
@@ -531,8 +533,12 @@ short hpi_check_control_cache(struct hpi_control_cache *p_cache,
531 found ? "Cached" : "Uncached", phm->adapter_index, 533 found ? "Cached" : "Uncached", phm->adapter_index,
532 pI->control_index, pI->control_type, phm->u.c.attribute); 534 pI->control_index, pI->control_type, phm->u.c.attribute);
533 535
534 if (found) 536 if (found) {
535 phr->size = (u16)response_size; 537 phr->size = (u16)response_size;
538 phr->type = HPI_TYPE_RESPONSE;
539 phr->object = phm->object;
540 phr->function = phm->function;
541 }
536 542
537 return found; 543 return found;
538} 544}
@@ -631,7 +637,7 @@ struct hpi_control_cache *hpi_alloc_control_cache(const u32 control_count,
631 if (!p_cache) 637 if (!p_cache)
632 return NULL; 638 return NULL;
633 639
634 p_cache->p_info = kzalloc(sizeof(*p_cache->p_info) * control_count, 640 p_cache->p_info = kcalloc(control_count, sizeof(*p_cache->p_info),
635 GFP_KERNEL); 641 GFP_KERNEL);
636 if (!p_cache->p_info) { 642 if (!p_cache->p_info) {
637 kfree(p_cache); 643 kfree(p_cache);
diff --git a/sound/pci/asihpi/hpicmn.h b/sound/pci/asihpi/hpicmn.h
index d53cdf6e535f..e44121283047 100644
--- a/sound/pci/asihpi/hpicmn.h
+++ b/sound/pci/asihpi/hpicmn.h
@@ -1,7 +1,7 @@
1/** 1/**
2 2
3 AudioScience HPI driver 3 AudioScience HPI driver
4 Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as 7 it under the terms of version 2 of the GNU General Public License as
@@ -18,12 +18,15 @@
18 18
19*/ 19*/
20 20
21struct hpi_adapter_obj;
22
23/* a function that takes an adapter obj and returns an int */
24typedef int adapter_int_func(struct hpi_adapter_obj *pao);
25
21struct hpi_adapter_obj { 26struct hpi_adapter_obj {
22 struct hpi_pci pci; /* PCI info - bus#,dev#,address etc */ 27 struct hpi_pci pci; /* PCI info - bus#,dev#,address etc */
23 u16 adapter_type; /* ASI6701 etc */ 28 u16 type; /* 0x6644 == ASI6644 etc */
24 u16 index; /* */ 29 u16 index;
25 u16 open; /* =1 when adapter open */
26 u16 mixer_open;
27 30
28 struct hpios_spinlock dsp_lock; 31 struct hpios_spinlock dsp_lock;
29 32
diff --git a/sound/pci/asihpi/hpidebug.c b/sound/pci/asihpi/hpidebug.c
index b52baf62791e..ac86a1f1d3bf 100644
--- a/sound/pci/asihpi/hpidebug.c
+++ b/sound/pci/asihpi/hpidebug.c
@@ -1,7 +1,7 @@
1/************************************************************************ 1/************************************************************************
2 2
3 AudioScience HPI driver 3 AudioScience HPI driver
4 Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as 7 it under the terms of version 2 of the GNU General Public License as
diff --git a/sound/pci/asihpi/hpidebug.h b/sound/pci/asihpi/hpidebug.h
index 940f54c3c538..2c9af2329d36 100644
--- a/sound/pci/asihpi/hpidebug.h
+++ b/sound/pci/asihpi/hpidebug.h
@@ -1,7 +1,7 @@
1/***************************************************************************** 1/*****************************************************************************
2 2
3 AudioScience HPI driver 3 AudioScience HPI driver
4 Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as 7 it under the terms of version 2 of the GNU General Public License as
diff --git a/sound/pci/asihpi/hpidspcd.c b/sound/pci/asihpi/hpidspcd.c
index 71d32c868c92..456a758f04f6 100644
--- a/sound/pci/asihpi/hpidspcd.c
+++ b/sound/pci/asihpi/hpidspcd.c
@@ -25,6 +25,7 @@ hotplug firmware loader from individual dsp code files
25#define SOURCEFILE_NAME "hpidspcd.c" 25#define SOURCEFILE_NAME "hpidspcd.c"
26#include "hpidspcd.h" 26#include "hpidspcd.h"
27#include "hpidebug.h" 27#include "hpidebug.h"
28#include "hpi_version.h"
28 29
29struct dsp_code_private { 30struct dsp_code_private {
30 /** Firmware descriptor */ 31 /** Firmware descriptor */
@@ -32,9 +33,6 @@ struct dsp_code_private {
32 struct pci_dev *dev; 33 struct pci_dev *dev;
33}; 34};
34 35
35#define HPI_VER_DECIMAL ((int)(HPI_VER_MAJOR(HPI_VER) * 10000 + \
36 HPI_VER_MINOR(HPI_VER) * 100 + HPI_VER_RELEASE(HPI_VER)))
37
38/*-------------------------------------------------------------------*/ 36/*-------------------------------------------------------------------*/
39short hpi_dsp_code_open(u32 adapter, void *os_data, struct dsp_code *dsp_code, 37short hpi_dsp_code_open(u32 adapter, void *os_data, struct dsp_code *dsp_code,
40 u32 *os_error_code) 38 u32 *os_error_code)
@@ -66,22 +64,25 @@ short hpi_dsp_code_open(u32 adapter, void *os_data, struct dsp_code *dsp_code,
66 if ((header.type != 0x45444F43) || /* "CODE" */ 64 if ((header.type != 0x45444F43) || /* "CODE" */
67 (header.adapter != adapter) 65 (header.adapter != adapter)
68 || (header.size != firmware->size)) { 66 || (header.size != firmware->size)) {
69 dev_printk(KERN_ERR, &dev->dev, "Invalid firmware file\n"); 67 dev_printk(KERN_ERR, &dev->dev,
68 "Invalid firmware header size %d != file %zd\n",
69 header.size, firmware->size);
70 goto error2; 70 goto error2;
71 } 71 }
72 72
73 if ((header.version / 100 & ~1) != (HPI_VER_DECIMAL / 100 & ~1)) { 73 if ((header.version >> 9) != (HPI_VER >> 9)) {
74 /* Consider even and subsequent odd minor versions to be compatible */
74 dev_printk(KERN_ERR, &dev->dev, 75 dev_printk(KERN_ERR, &dev->dev,
75 "Incompatible firmware version " 76 "Incompatible firmware version "
76 "DSP image %d != Driver %d\n", header.version, 77 "DSP image %X != Driver %X\n", header.version,
77 HPI_VER_DECIMAL); 78 HPI_VER);
78 goto error2; 79 goto error2;
79 } 80 }
80 81
81 if (header.version != HPI_VER_DECIMAL) { 82 if (header.version != HPI_VER) {
82 dev_printk(KERN_WARNING, &dev->dev, 83 dev_printk(KERN_INFO, &dev->dev,
83 "Firmware: release version mismatch DSP image %d != Driver %d\n", 84 "Firmware: release version mismatch DSP image %X != Driver %X\n",
84 header.version, HPI_VER_DECIMAL); 85 header.version, HPI_VER);
85 } 86 }
86 87
87 HPI_DEBUG_LOG(DEBUG, "dsp code %s opened\n", fw_name); 88 HPI_DEBUG_LOG(DEBUG, "dsp code %s opened\n", fw_name);
@@ -108,11 +109,8 @@ error1:
108/*-------------------------------------------------------------------*/ 109/*-------------------------------------------------------------------*/
109void hpi_dsp_code_close(struct dsp_code *dsp_code) 110void hpi_dsp_code_close(struct dsp_code *dsp_code)
110{ 111{
111 if (dsp_code->pvt->firmware) { 112 HPI_DEBUG_LOG(DEBUG, "dsp code closed\n");
112 HPI_DEBUG_LOG(DEBUG, "dsp code closed\n"); 113 release_firmware(dsp_code->pvt->firmware);
113 release_firmware(dsp_code->pvt->firmware);
114 dsp_code->pvt->firmware = NULL;
115 }
116 kfree(dsp_code->pvt); 114 kfree(dsp_code->pvt);
117} 115}
118 116
diff --git a/sound/pci/asihpi/hpidspcd.h b/sound/pci/asihpi/hpidspcd.h
index b22881122f19..659d19ca6d42 100644
--- a/sound/pci/asihpi/hpidspcd.h
+++ b/sound/pci/asihpi/hpidspcd.h
@@ -27,10 +27,6 @@ Functions for reading DSP code to load into DSP
27 27
28#include "hpi_internal.h" 28#include "hpi_internal.h"
29 29
30/** Code header version is decimal encoded e.g. 4.06.10 is 40601 */
31#define HPI_VER_DECIMAL ((int)(HPI_VER_MAJOR(HPI_VER) * 10000 + \
32HPI_VER_MINOR(HPI_VER) * 100 + HPI_VER_RELEASE(HPI_VER)))
33
34/** Header structure for dsp firmware file 30/** Header structure for dsp firmware file
35 This structure must match that used in s2bin.c for generation of asidsp.bin 31 This structure must match that used in s2bin.c for generation of asidsp.bin
36 */ 32 */
diff --git a/sound/pci/asihpi/hpifunc.c b/sound/pci/asihpi/hpifunc.c
index ebb568d695f1..510e56cffd31 100644
--- a/sound/pci/asihpi/hpifunc.c
+++ b/sound/pci/asihpi/hpifunc.c
@@ -2826,6 +2826,16 @@ u16 hpi_volume_auto_fade(u32 h_control,
2826 duration_ms, HPI_VOLUME_AUTOFADE_LOG); 2826 duration_ms, HPI_VOLUME_AUTOFADE_LOG);
2827} 2827}
2828 2828
2829u16 hpi_volume_query_auto_fade_profile(const u32 h_volume, const u32 i,
2830 u16 *profile)
2831{
2832 u16 e;
2833 u32 u;
2834 e = hpi_control_query(h_volume, HPI_VOLUME_AUTOFADE, i, 0, &u);
2835 *profile = (u16)u;
2836 return e;
2837}
2838
2829u16 hpi_vox_set_threshold(u32 h_control, short an_gain0_01dB) 2839u16 hpi_vox_set_threshold(u32 h_control, short an_gain0_01dB)
2830{ 2840{
2831 struct hpi_message hm; 2841 struct hpi_message hm;
diff --git a/sound/pci/asihpi/hpimsginit.c b/sound/pci/asihpi/hpimsginit.c
index 52400a6b5f15..032d563e3708 100644
--- a/sound/pci/asihpi/hpimsginit.c
+++ b/sound/pci/asihpi/hpimsginit.c
@@ -1,7 +1,7 @@
1/****************************************************************************** 1/******************************************************************************
2 2
3 AudioScience HPI driver 3 AudioScience HPI driver
4 Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as 7 it under the terms of version 2 of the GNU General Public License as
diff --git a/sound/pci/asihpi/hpimsginit.h b/sound/pci/asihpi/hpimsginit.h
index bfd330d78b58..5b48708c7d1e 100644
--- a/sound/pci/asihpi/hpimsginit.h
+++ b/sound/pci/asihpi/hpimsginit.h
@@ -1,7 +1,7 @@
1/****************************************************************************** 1/******************************************************************************
2 2
3 AudioScience HPI driver 3 AudioScience HPI driver
4 Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as 7 it under the terms of version 2 of the GNU General Public License as
diff --git a/sound/pci/asihpi/hpimsgx.c b/sound/pci/asihpi/hpimsgx.c
index 2e779421a618..d4790ddc225c 100644
--- a/sound/pci/asihpi/hpimsgx.c
+++ b/sound/pci/asihpi/hpimsgx.c
@@ -1,7 +1,7 @@
1/****************************************************************************** 1/******************************************************************************
2 2
3 AudioScience HPI driver 3 AudioScience HPI driver
4 Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as 7 it under the terms of version 2 of the GNU General Public License as
@@ -22,6 +22,7 @@ Extended Message Function With Response Caching
22*****************************************************************************/ 22*****************************************************************************/
23#define SOURCEFILE_NAME "hpimsgx.c" 23#define SOURCEFILE_NAME "hpimsgx.c"
24#include "hpi_internal.h" 24#include "hpi_internal.h"
25#include "hpi_version.h"
25#include "hpimsginit.h" 26#include "hpimsginit.h"
26#include "hpicmn.h" 27#include "hpicmn.h"
27#include "hpimsgx.h" 28#include "hpimsgx.h"
diff --git a/sound/pci/asihpi/hpimsgx.h b/sound/pci/asihpi/hpimsgx.h
index fd49e7542a88..37f3efd95a70 100644
--- a/sound/pci/asihpi/hpimsgx.h
+++ b/sound/pci/asihpi/hpimsgx.h
@@ -1,7 +1,7 @@
1/****************************************************************************** 1/******************************************************************************
2 2
3 AudioScience HPI driver 3 AudioScience HPI driver
4 Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as 7 it under the terms of version 2 of the GNU General Public License as
diff --git a/sound/pci/asihpi/hpioctl.c b/sound/pci/asihpi/hpioctl.c
index f6b9517b4696..609156205562 100644
--- a/sound/pci/asihpi/hpioctl.c
+++ b/sound/pci/asihpi/hpioctl.c
@@ -21,6 +21,7 @@ Common Linux HPI ioctl and module probe/remove functions
21#define SOURCEFILE_NAME "hpioctl.c" 21#define SOURCEFILE_NAME "hpioctl.c"
22 22
23#include "hpi_internal.h" 23#include "hpi_internal.h"
24#include "hpi_version.h"
24#include "hpimsginit.h" 25#include "hpimsginit.h"
25#include "hpidebug.h" 26#include "hpidebug.h"
26#include "hpimsgx.h" 27#include "hpimsgx.h"
@@ -65,9 +66,7 @@ static struct hpi_adapter adapters[HPI_MAX_ADAPTERS];
65static void hpi_send_recv_f(struct hpi_message *phm, struct hpi_response *phr, 66static void hpi_send_recv_f(struct hpi_message *phm, struct hpi_response *phr,
66 struct file *file) 67 struct file *file)
67{ 68{
68 int adapter = phm->adapter_index; 69 if ((phm->adapter_index >= HPI_MAX_ADAPTERS)
69
70 if ((adapter >= HPI_MAX_ADAPTERS || adapter < 0)
71 && (phm->object != HPI_OBJ_SUBSYSTEM)) 70 && (phm->object != HPI_OBJ_SUBSYSTEM))
72 phr->error = HPI_ERROR_INVALID_OBJ_INDEX; 71 phr->error = HPI_ERROR_INVALID_OBJ_INDEX;
73 else 72 else
@@ -178,19 +177,14 @@ long asihpi_hpi_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
178 } else { 177 } else {
179 u16 __user *ptr = NULL; 178 u16 __user *ptr = NULL;
180 u32 size = 0; 179 u32 size = 0;
181 u32 adapter_present;
182 /* -1=no data 0=read from user mem, 1=write to user mem */ 180 /* -1=no data 0=read from user mem, 1=write to user mem */
183 int wrflag = -1; 181 int wrflag = -1;
184 struct hpi_adapter *pa; 182 struct hpi_adapter *pa = NULL;
185 183
186 if (hm->h.adapter_index < HPI_MAX_ADAPTERS) { 184 if (hm->h.adapter_index < ARRAY_SIZE(adapters))
187 pa = &adapters[hm->h.adapter_index]; 185 pa = &adapters[hm->h.adapter_index];
188 adapter_present = pa->type;
189 } else {
190 adapter_present = 0;
191 }
192 186
193 if (!adapter_present) { 187 if (!pa || !pa->adapter || !pa->adapter->type) {
194 hpi_init_response(&hr->r0, hm->h.object, 188 hpi_init_response(&hr->r0, hm->h.object,
195 hm->h.function, HPI_ERROR_BAD_ADAPTER_NUMBER); 189 hm->h.function, HPI_ERROR_BAD_ADAPTER_NUMBER);
196 190
@@ -317,6 +311,7 @@ int __devinit asihpi_adapter_probe(struct pci_dev *pci_dev,
317 const struct pci_device_id *pci_id) 311 const struct pci_device_id *pci_id)
318{ 312{
319 int idx, nm; 313 int idx, nm;
314 int adapter_index;
320 unsigned int memlen; 315 unsigned int memlen;
321 struct hpi_message hm; 316 struct hpi_message hm;
322 struct hpi_response hr; 317 struct hpi_response hr;
@@ -345,8 +340,6 @@ int __devinit asihpi_adapter_probe(struct pci_dev *pci_dev,
345 340
346 hm.adapter_index = HPI_ADAPTER_INDEX_INVALID; 341 hm.adapter_index = HPI_ADAPTER_INDEX_INVALID;
347 342
348 adapter.pci = pci_dev;
349
350 nm = HPI_MAX_ADAPTER_MEM_SPACES; 343 nm = HPI_MAX_ADAPTER_MEM_SPACES;
351 344
352 for (idx = 0; idx < nm; idx++) { 345 for (idx = 0; idx < nm; idx++) {
@@ -355,18 +348,16 @@ int __devinit asihpi_adapter_probe(struct pci_dev *pci_dev,
355 348
356 if (pci_resource_flags(pci_dev, idx) & IORESOURCE_MEM) { 349 if (pci_resource_flags(pci_dev, idx) & IORESOURCE_MEM) {
357 memlen = pci_resource_len(pci_dev, idx); 350 memlen = pci_resource_len(pci_dev, idx);
358 adapter.ap_remapped_mem_base[idx] = 351 pci.ap_mem_base[idx] =
359 ioremap(pci_resource_start(pci_dev, idx), 352 ioremap(pci_resource_start(pci_dev, idx),
360 memlen); 353 memlen);
361 if (!adapter.ap_remapped_mem_base[idx]) { 354 if (!pci.ap_mem_base[idx]) {
362 HPI_DEBUG_LOG(ERROR, 355 HPI_DEBUG_LOG(ERROR,
363 "ioremap failed, aborting\n"); 356 "ioremap failed, aborting\n");
364 /* unmap previously mapped pci mem space */ 357 /* unmap previously mapped pci mem space */
365 goto err; 358 goto err;
366 } 359 }
367 } 360 }
368
369 pci.ap_mem_base[idx] = adapter.ap_remapped_mem_base[idx];
370 } 361 }
371 362
372 pci.pci_dev = pci_dev; 363 pci.pci_dev = pci_dev;
@@ -378,6 +369,9 @@ int __devinit asihpi_adapter_probe(struct pci_dev *pci_dev,
378 if (hr.error) 369 if (hr.error)
379 goto err; 370 goto err;
380 371
372 adapter_index = hr.u.s.adapter_index;
373 adapter.adapter = hpi_find_adapter(adapter_index);
374
381 if (prealloc_stream_buf) { 375 if (prealloc_stream_buf) {
382 adapter.p_buffer = vmalloc(prealloc_stream_buf); 376 adapter.p_buffer = vmalloc(prealloc_stream_buf);
383 if (!adapter.p_buffer) { 377 if (!adapter.p_buffer) {
@@ -389,36 +383,32 @@ int __devinit asihpi_adapter_probe(struct pci_dev *pci_dev,
389 } 383 }
390 } 384 }
391 385
392 adapter.index = hr.u.s.adapter_index;
393 adapter.type = hr.u.s.adapter_type;
394
395 hpi_init_message_response(&hm, &hr, HPI_OBJ_ADAPTER, 386 hpi_init_message_response(&hm, &hr, HPI_OBJ_ADAPTER,
396 HPI_ADAPTER_OPEN); 387 HPI_ADAPTER_OPEN);
397 hm.adapter_index = adapter.index; 388 hm.adapter_index = adapter.adapter->index;
398 hpi_send_recv_ex(&hm, &hr, HOWNER_KERNEL); 389 hpi_send_recv_ex(&hm, &hr, HOWNER_KERNEL);
399 390
400 if (hr.error) 391 if (hr.error)
401 goto err; 392 goto err;
402 393
403 adapter.snd_card_asihpi = NULL;
404 /* WARNING can't init mutex in 'adapter' 394 /* WARNING can't init mutex in 'adapter'
405 * and then copy it to adapters[] ?!?! 395 * and then copy it to adapters[] ?!?!
406 */ 396 */
407 adapters[adapter.index] = adapter; 397 adapters[adapter_index] = adapter;
408 mutex_init(&adapters[adapter.index].mutex); 398 mutex_init(&adapters[adapter_index].mutex);
409 pci_set_drvdata(pci_dev, &adapters[adapter.index]); 399 pci_set_drvdata(pci_dev, &adapters[adapter_index]);
410 400
411 dev_printk(KERN_INFO, &pci_dev->dev, 401 dev_printk(KERN_INFO, &pci_dev->dev,
412 "probe succeeded for ASI%04X HPI index %d\n", adapter.type, 402 "probe succeeded for ASI%04X HPI index %d\n",
413 adapter.index); 403 adapter.adapter->type, adapter_index);
414 404
415 return 0; 405 return 0;
416 406
417err: 407err:
418 for (idx = 0; idx < HPI_MAX_ADAPTER_MEM_SPACES; idx++) { 408 for (idx = 0; idx < HPI_MAX_ADAPTER_MEM_SPACES; idx++) {
419 if (adapter.ap_remapped_mem_base[idx]) { 409 if (pci.ap_mem_base[idx]) {
420 iounmap(adapter.ap_remapped_mem_base[idx]); 410 iounmap(pci.ap_mem_base[idx]);
421 adapter.ap_remapped_mem_base[idx] = NULL; 411 pci.ap_mem_base[idx] = NULL;
422 } 412 }
423 } 413 }
424 414
@@ -437,19 +427,20 @@ void __devexit asihpi_adapter_remove(struct pci_dev *pci_dev)
437 struct hpi_message hm; 427 struct hpi_message hm;
438 struct hpi_response hr; 428 struct hpi_response hr;
439 struct hpi_adapter *pa; 429 struct hpi_adapter *pa;
430 struct hpi_pci pci;
431
440 pa = pci_get_drvdata(pci_dev); 432 pa = pci_get_drvdata(pci_dev);
433 pci = pa->adapter->pci;
441 434
442 hpi_init_message_response(&hm, &hr, HPI_OBJ_ADAPTER, 435 hpi_init_message_response(&hm, &hr, HPI_OBJ_ADAPTER,
443 HPI_ADAPTER_DELETE); 436 HPI_ADAPTER_DELETE);
444 hm.adapter_index = pa->index; 437 hm.adapter_index = pa->adapter->index;
445 hpi_send_recv_ex(&hm, &hr, HOWNER_KERNEL); 438 hpi_send_recv_ex(&hm, &hr, HOWNER_KERNEL);
446 439
447 /* unmap PCI memory space, mapped during device init. */ 440 /* unmap PCI memory space, mapped during device init. */
448 for (idx = 0; idx < HPI_MAX_ADAPTER_MEM_SPACES; idx++) { 441 for (idx = 0; idx < HPI_MAX_ADAPTER_MEM_SPACES; idx++) {
449 if (pa->ap_remapped_mem_base[idx]) { 442 if (pci.ap_mem_base[idx])
450 iounmap(pa->ap_remapped_mem_base[idx]); 443 iounmap(pci.ap_mem_base[idx]);
451 pa->ap_remapped_mem_base[idx] = NULL;
452 }
453 } 444 }
454 445
455 if (pa->p_buffer) 446 if (pa->p_buffer)
@@ -461,7 +452,7 @@ void __devexit asihpi_adapter_remove(struct pci_dev *pci_dev)
461 "remove %04x:%04x,%04x:%04x,%04x," " HPI index %d.\n", 452 "remove %04x:%04x,%04x:%04x,%04x," " HPI index %d.\n",
462 pci_dev->vendor, pci_dev->device, 453 pci_dev->vendor, pci_dev->device,
463 pci_dev->subsystem_vendor, pci_dev->subsystem_device, 454 pci_dev->subsystem_vendor, pci_dev->subsystem_device,
464 pci_dev->devfn, pa->index); 455 pci_dev->devfn, pa->adapter->index);
465 456
466 memset(pa, 0, sizeof(*pa)); 457 memset(pa, 0, sizeof(*pa));
467} 458}
diff --git a/sound/pci/asihpi/hpioctl.h b/sound/pci/asihpi/hpioctl.h
index 847f72f03fe1..2614aff672e2 100644
--- a/sound/pci/asihpi/hpioctl.h
+++ b/sound/pci/asihpi/hpioctl.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 AudioScience HPI driver 3 AudioScience HPI driver
4 Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as 7 it under the terms of version 2 of the GNU General Public License as
diff --git a/sound/pci/asihpi/hpios.c b/sound/pci/asihpi/hpios.c
index ff2a19b544fa..2d7d1c2e1d0d 100644
--- a/sound/pci/asihpi/hpios.c
+++ b/sound/pci/asihpi/hpios.c
@@ -1,7 +1,7 @@
1/****************************************************************************** 1/******************************************************************************
2 2
3 AudioScience HPI driver 3 AudioScience HPI driver
4 Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as 7 it under the terms of version 2 of the GNU General Public License as
diff --git a/sound/pci/asihpi/hpios.h b/sound/pci/asihpi/hpios.h
index 2f605e34bad0..c5cef113c209 100644
--- a/sound/pci/asihpi/hpios.h
+++ b/sound/pci/asihpi/hpios.h
@@ -1,7 +1,7 @@
1/****************************************************************************** 1/******************************************************************************
2 2
3 AudioScience HPI driver 3 AudioScience HPI driver
4 Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as 7 it under the terms of version 2 of the GNU General Public License as
@@ -149,20 +149,18 @@ static inline void cond_unlock(struct hpios_spinlock *l)
149#define hpios_alistlock_lock(obj) spin_lock(&((obj)->list_lock.lock)) 149#define hpios_alistlock_lock(obj) spin_lock(&((obj)->list_lock.lock))
150#define hpios_alistlock_unlock(obj) spin_unlock(&((obj)->list_lock.lock)) 150#define hpios_alistlock_unlock(obj) spin_unlock(&((obj)->list_lock.lock))
151 151
152struct snd_card;
153
154/** pci drvdata points to an instance of this struct */
152struct hpi_adapter { 155struct hpi_adapter {
156 struct hpi_adapter_obj *adapter;
157 struct snd_card *snd_card;
158
153 /* mutex prevents contention for one card 159 /* mutex prevents contention for one card
154 between multiple user programs (via ioctl) */ 160 between multiple user programs (via ioctl) */
155 struct mutex mutex; 161 struct mutex mutex;
156 u16 index;
157 u16 type;
158
159 /* ALSA card structure */
160 void *snd_card_asihpi;
161
162 char *p_buffer; 162 char *p_buffer;
163 size_t buffer_size; 163 size_t buffer_size;
164 struct pci_dev *pci;
165 void __iomem *ap_remapped_mem_base[HPI_MAX_ADAPTER_MEM_SPACES];
166}; 164};
167 165
168#endif 166#endif
diff --git a/sound/pci/asihpi/hpipcida.h b/sound/pci/asihpi/hpipcida.h
index bb30868ce1a3..db570ddf64b3 100644
--- a/sound/pci/asihpi/hpipcida.h
+++ b/sound/pci/asihpi/hpipcida.h
@@ -1,7 +1,7 @@
1/****************************************************************************** 1/******************************************************************************
2 2
3 AudioScience HPI driver 3 AudioScience HPI driver
4 Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as 7 it under the terms of version 2 of the GNU General Public License as
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c
index 15e4e5ee3881..590682f115ef 100644
--- a/sound/pci/atiixp.c
+++ b/sound/pci/atiixp.c
@@ -43,7 +43,7 @@ static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */
43static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ 43static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */
44static int ac97_clock = 48000; 44static int ac97_clock = 48000;
45static char *ac97_quirk; 45static char *ac97_quirk;
46static int spdif_aclink = 1; 46static bool spdif_aclink = 1;
47static int ac97_codec = -1; 47static int ac97_codec = -1;
48 48
49module_param(index, int, 0444); 49module_param(index, int, 0444);
@@ -60,7 +60,7 @@ module_param(spdif_aclink, bool, 0444);
60MODULE_PARM_DESC(spdif_aclink, "S/PDIF over AC-link."); 60MODULE_PARM_DESC(spdif_aclink, "S/PDIF over AC-link.");
61 61
62/* just for backward compatibility */ 62/* just for backward compatibility */
63static int enable; 63static bool enable;
64module_param(enable, bool, 0444); 64module_param(enable, bool, 0444);
65 65
66 66
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c
index 57bf8f4bc7a8..524d35f31232 100644
--- a/sound/pci/atiixp_modem.c
+++ b/sound/pci/atiixp_modem.c
@@ -51,7 +51,7 @@ module_param(ac97_clock, int, 0444);
51MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (default 48000Hz)."); 51MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (default 48000Hz).");
52 52
53/* just for backward compatibility */ 53/* just for backward compatibility */
54static int enable; 54static bool enable;
55module_param(enable, bool, 0444); 55module_param(enable, bool, 0444);
56 56
57 57
diff --git a/sound/pci/au88x0/au88x0.c b/sound/pci/au88x0/au88x0.c
index dc326be58c4b..762bb108c51c 100644
--- a/sound/pci/au88x0/au88x0.c
+++ b/sound/pci/au88x0/au88x0.c
@@ -26,7 +26,7 @@
26// module parameters (see "Module Parameters") 26// module parameters (see "Module Parameters")
27static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 27static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
28static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 28static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
29static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 29static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
30static int pcifix[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 255 }; 30static int pcifix[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 255 };
31 31
32module_param_array(index, int, NULL, 0444); 32module_param_array(index, int, NULL, 0444);
diff --git a/sound/pci/au88x0/au88x0_core.c b/sound/pci/au88x0/au88x0_core.c
index 489150380eac..6933a27a5d76 100644
--- a/sound/pci/au88x0/au88x0_core.c
+++ b/sound/pci/au88x0/au88x0_core.c
@@ -805,7 +805,7 @@ static void vortex_fifo_setadbvalid(vortex_t * vortex, int fifo, int en)
805} 805}
806 806
807static void 807static void
808vortex_fifo_setadbctrl(vortex_t * vortex, int fifo, int b, int priority, 808vortex_fifo_setadbctrl(vortex_t * vortex, int fifo, int stereo, int priority,
809 int empty, int valid, int f) 809 int empty, int valid, int f)
810{ 810{
811 int temp, lifeboat = 0; 811 int temp, lifeboat = 0;
@@ -837,7 +837,7 @@ vortex_fifo_setadbctrl(vortex_t * vortex, int fifo, int b, int priority,
837#else 837#else
838 temp = (this_4 & 0x3f) << 0xc; 838 temp = (this_4 & 0x3f) << 0xc;
839#endif 839#endif
840 temp = (temp & 0xfffffffd) | ((b & 1) << 1); 840 temp = (temp & 0xfffffffd) | ((stereo & 1) << 1);
841 temp = (temp & 0xfffffff3) | ((priority & 3) << 2); 841 temp = (temp & 0xfffffff3) | ((priority & 3) << 2);
842 temp = (temp & 0xffffffef) | ((valid & 1) << 4); 842 temp = (temp & 0xffffffef) | ((valid & 1) << 4);
843 temp |= FIFO_U1; 843 temp |= FIFO_U1;
@@ -1148,11 +1148,11 @@ vortex_adbdma_setbuffers(vortex_t * vortex, int adbdma,
1148 1148
1149static void 1149static void
1150vortex_adbdma_setmode(vortex_t * vortex, int adbdma, int ie, int dir, 1150vortex_adbdma_setmode(vortex_t * vortex, int adbdma, int ie, int dir,
1151 int fmt, int d, u32 offset) 1151 int fmt, int stereo, u32 offset)
1152{ 1152{
1153 stream_t *dma = &vortex->dma_adb[adbdma]; 1153 stream_t *dma = &vortex->dma_adb[adbdma];
1154 1154
1155 dma->dma_unknown = d; 1155 dma->dma_unknown = stereo;
1156 dma->dma_ctrl = 1156 dma->dma_ctrl =
1157 ((offset & OFFSET_MASK) | (dma->dma_ctrl & ~OFFSET_MASK)); 1157 ((offset & OFFSET_MASK) | (dma->dma_ctrl & ~OFFSET_MASK));
1158 /* Enable PCMOUT interrupts. */ 1158 /* Enable PCMOUT interrupts. */
@@ -1336,7 +1336,6 @@ static void vortex_adbdma_pausefifo(vortex_t * vortex, int adbdma)
1336 dma->fifo_status = FIFO_PAUSE; 1336 dma->fifo_status = FIFO_PAUSE;
1337} 1337}
1338 1338
1339#if 0 // Using pause instead
1340static void vortex_adbdma_stopfifo(vortex_t * vortex, int adbdma) 1339static void vortex_adbdma_stopfifo(vortex_t * vortex, int adbdma)
1341{ 1340{
1342 stream_t *dma = &vortex->dma_adb[adbdma]; 1341 stream_t *dma = &vortex->dma_adb[adbdma];
@@ -1351,7 +1350,6 @@ static void vortex_adbdma_stopfifo(vortex_t * vortex, int adbdma)
1351 dma->fifo_enabled = 0; 1350 dma->fifo_enabled = 0;
1352} 1351}
1353 1352
1354#endif
1355/* WTDMA */ 1353/* WTDMA */
1356 1354
1357#ifndef CHIP_AU8810 1355#ifndef CHIP_AU8810
diff --git a/sound/pci/au88x0/au88x0_pcm.c b/sound/pci/au88x0/au88x0_pcm.c
index c5f7ae46afef..0488633ea874 100644
--- a/sound/pci/au88x0/au88x0_pcm.c
+++ b/sound/pci/au88x0/au88x0_pcm.c
@@ -307,8 +307,8 @@ static int snd_vortex_pcm_prepare(struct snd_pcm_substream *substream)
307 fmt = vortex_alsafmt_aspfmt(runtime->format); 307 fmt = vortex_alsafmt_aspfmt(runtime->format);
308 spin_lock_irq(&chip->lock); 308 spin_lock_irq(&chip->lock);
309 if (VORTEX_PCM_TYPE(substream->pcm) != VORTEX_PCM_WT) { 309 if (VORTEX_PCM_TYPE(substream->pcm) != VORTEX_PCM_WT) {
310 vortex_adbdma_setmode(chip, dma, 1, dir, fmt, 0 /*? */ , 310 vortex_adbdma_setmode(chip, dma, 1, dir, fmt,
311 0); 311 runtime->channels == 1 ? 0 : 1, 0);
312 vortex_adbdma_setstartbuffer(chip, dma, 0); 312 vortex_adbdma_setstartbuffer(chip, dma, 0);
313 if (VORTEX_PCM_TYPE(substream->pcm) != VORTEX_PCM_SPDIF) 313 if (VORTEX_PCM_TYPE(substream->pcm) != VORTEX_PCM_SPDIF)
314 vortex_adb_setsrc(chip, dma, runtime->rate, dir); 314 vortex_adb_setsrc(chip, dma, runtime->rate, dir);
@@ -353,8 +353,7 @@ static int snd_vortex_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
353 //printk(KERN_INFO "vortex: stop %d\n", dma); 353 //printk(KERN_INFO "vortex: stop %d\n", dma);
354 stream->fifo_enabled = 0; 354 stream->fifo_enabled = 0;
355 if (VORTEX_PCM_TYPE(substream->pcm) != VORTEX_PCM_WT) 355 if (VORTEX_PCM_TYPE(substream->pcm) != VORTEX_PCM_WT)
356 vortex_adbdma_pausefifo(chip, dma); 356 vortex_adbdma_stopfifo(chip, dma);
357 //vortex_adbdma_stopfifo(chip, dma);
358#ifndef CHIP_AU8810 357#ifndef CHIP_AU8810
359 else { 358 else {
360 printk(KERN_INFO "vortex: wt stop %d\n", dma); 359 printk(KERN_INFO "vortex: wt stop %d\n", dma);
diff --git a/sound/pci/au88x0/au88x0_xtalk.c b/sound/pci/au88x0/au88x0_xtalk.c
index b4151e208b71..b278e285fd40 100644
--- a/sound/pci/au88x0/au88x0_xtalk.c
+++ b/sound/pci/au88x0/au88x0_xtalk.c
@@ -48,43 +48,61 @@ static unsigned short const wXtalkNarrowLeftDelay = 0x7;
48static unsigned short const wXtalkNarrowRightDelay = 0x7; 48static unsigned short const wXtalkNarrowRightDelay = 0x7;
49 49
50static xtalk_gains_t const asXtalkGainsDefault = { 50static xtalk_gains_t const asXtalkGainsDefault = {
51 0x4000, 0x4000, 4000, 0x4000, 4000, 0x4000, 4000, 0x4000, 4000, 51 0x4000, 0x4000, 0x4000, 0x4000, 0x4000,
52 0x4000 52 0x4000, 0x4000, 0x4000, 0x4000, 0x4000
53}; 53};
54 54
55static xtalk_gains_t const asXtalkGainsTest = { 55static xtalk_gains_t const asXtalkGainsTest = {
56 0x8000, 0x7FFF, 0, 0xFFFF, 0x0001, 0xC000, 0x4000, 0xFFFE, 0x0002, 56 0x7fff, 0x8000, 0x0000, 0x0000, 0x0001,
57 0 57 0xffff, 0x4000, 0xc000, 0x0002, 0xfffe
58}; 58};
59
59static xtalk_gains_t const asXtalkGains1Chan = { 60static xtalk_gains_t const asXtalkGains1Chan = {
60 0x7FFF, 0, 0, 0, 0x7FFF, 0, 0, 0, 0, 0 61 0x7FFF, 0, 0, 0, 0,
62 0x7FFF, 0, 0, 0, 0,
61}; 63};
62 64
63// Input gain for 4 A3D slices. One possible input pair is left zero. 65// Input gain for 4 A3D slices. One possible input pair is left zero.
64static xtalk_gains_t const asXtalkGainsAllChan = { 66static xtalk_gains_t const asXtalkGainsAllChan = {
65 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 67 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0,
66 0 68 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0
67 //0x7FFF,0x7FFF,0x7FFF,0x7FFF,0x7fff,0x7FFF,0x7FFF,0x7FFF,0x7FFF,0x7fff 69};
70
71static xtalk_gains_t const asXtalkGainsZeros = {
72 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
68}; 73};
69static xtalk_gains_t const asXtalkGainsZeros;
70 74
71static xtalk_dline_t const alXtalkDlineZeros; 75static xtalk_dline_t const alXtalkDlineZeros = {
76 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
77 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
78};
72static xtalk_dline_t const alXtalkDlineTest = { 79static xtalk_dline_t const alXtalkDlineTest = {
73 0xFC18, 0x03E8FFFF, 0x186A0, 0x7960FFFE, 1, 0xFFFFFFFF, 80 0x0000fc18, 0xfff03e8, 0x000186a0, 0xfffe7960, 1, 0xffffffff, 0, 0,
74 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
82 0, 0, 0, 0, 0, 0, 0, 0
83};
84
85static xtalk_instate_t const asXtalkInStateZeros = {
75 0, 0, 0, 0 86 0, 0, 0, 0
76}; 87};
77 88
78static xtalk_instate_t const asXtalkInStateZeros; 89static xtalk_instate_t const asXtalkInStateTest = {
79static xtalk_instate_t const asXtalkInStateTest = 90 0x0080, 0xff80, 0x0001, 0xffff
80 { 0xFF80, 0x0080, 0xFFFF, 0x0001 }; 91};
81static xtalk_state_t const asXtalkOutStateZeros; 92
93static xtalk_state_t const asXtalkOutStateZeros = {
94 {0, 0, 0, 0},
95 {0, 0, 0, 0},
96 {0, 0, 0, 0},
97 {0, 0, 0, 0},
98 {0, 0, 0, 0}
99};
82 100
83static short const sDiamondKLeftEq = 0x401d; 101static short const sDiamondKLeftEq = 0x401d;
84static short const sDiamondKRightEq = 0x401d; 102static short const sDiamondKRightEq = 0x401d;
85static short const sDiamondKLeftXt = 0xF90E; 103static short const sDiamondKLeftXt = 0xF90E;
86static short const sDiamondKRightXt = 0xF90E; 104static short const sDiamondKRightXt = 0xF90E;
87static short const sDiamondShiftLeftEq = 1; /* 0xF90E Is this a bug ??? */ 105static short const sDiamondShiftLeftEq = 1;
88static short const sDiamondShiftRightEq = 1; 106static short const sDiamondShiftRightEq = 1;
89static short const sDiamondShiftLeftXt = 0; 107static short const sDiamondShiftLeftXt = 0;
90static short const sDiamondShiftRightXt = 0; 108static short const sDiamondShiftRightXt = 0;
@@ -94,29 +112,29 @@ static unsigned short const wDiamondRightDelay = 0xb;
94static xtalk_coefs_t const asXtalkWideCoefsLeftEq = { 112static xtalk_coefs_t const asXtalkWideCoefsLeftEq = {
95 {0xEC4C, 0xDCE9, 0xFDC2, 0xFEEC, 0}, 113 {0xEC4C, 0xDCE9, 0xFDC2, 0xFEEC, 0},
96 {0x5F60, 0xCBCB, 0xFC26, 0x0305, 0}, 114 {0x5F60, 0xCBCB, 0xFC26, 0x0305, 0},
97 {0x340B, 0xf504, 0x6CE8, 0x0D23, 0x00E4}, 115 {0x340B, 0xe8f5, 0x236c, 0xe40d, 0},
98 {0xD500, 0x8D76, 0xACC7, 0x5B05, 0x00FA}, 116 {0x76d5, 0xc78d, 0x05ac, 0xfa5b, 0},
99 {0x7F04, 0xC0FA, 0x0263, 0xFDA2, 0} 117 {0x7F04, 0xC0FA, 0x0263, 0xFDA2, 0}
100}; 118};
101static xtalk_coefs_t const asXtalkWideCoefsRightEq = { 119static xtalk_coefs_t const asXtalkWideCoefsRightEq = {
102 {0xEC4C, 0xDCE9, 0xFDC2, 0xFEEC, 0}, 120 {0xEC4C, 0xDCE9, 0xFDC2, 0xFEEC, 0},
103 {0x5F60, 0xCBCB, 0xFC26, 0x0305, 0}, 121 {0x5F60, 0xCBCB, 0xFC26, 0x0305, 0},
104 {0x340B, 0xF504, 0x6CE8, 0x0D23, 0x00E4}, 122 {0x340B, 0xe8f5, 0x236c, 0xe40d, 0},
105 {0xD500, 0x8D76, 0xACC7, 0x5B05, 0x00FA}, 123 {0x76d5, 0xc78d, 0x05ac, 0xfa5b, 0},
106 {0x7F04, 0xC0FA, 0x0263, 0xFDA2, 0} 124 {0x7F04, 0xC0FA, 0x0263, 0xFDA2, 0}
107}; 125};
108static xtalk_coefs_t const asXtalkWideCoefsLeftXt = { 126static xtalk_coefs_t const asXtalkWideCoefsLeftXt = {
109 {0x86C3, 0x7B55, 0x89C3, 0x005B, 0x0047}, 127 {0x55c6, 0xc97b, 0x005b, 0x0047, 0},
110 {0x6000, 0x206A, 0xC6CA, 0x40FF, 0}, 128 {0x6a60, 0xca20, 0xffc6, 0x0040, 0},
111 {0x1100, 0x1164, 0xA1D7, 0x90FC, 0x0001}, 129 {0x6411, 0xd711, 0xfca1, 0x0190, 0},
112 {0xDC00, 0x9E77, 0xB8C7, 0x0AFF, 0}, 130 {0x77dc, 0xc79e, 0xffb8, 0x000a, 0},
113 {0, 0, 0, 0, 0} 131 {0, 0, 0, 0, 0}
114}; 132};
115static xtalk_coefs_t const asXtalkWideCoefsRightXt = { 133static xtalk_coefs_t const asXtalkWideCoefsRightXt = {
116 {0x86C3, 0x7B55, 0x89C3, 0x005B, 0x0047}, 134 {0x55c6, 0xc97b, 0x005b, 0x0047, 0},
117 {0x6000, 0x206A, 0xC6CA, 0x40FF, 0}, 135 {0x6a60, 0xca20, 0xffc6, 0x0040, 0},
118 {0x1100, 0x1164, 0xA1D7, 0x90FC, 0x0001}, 136 {0x6411, 0xd711, 0xfca1, 0x0190, 0},
119 {0xDC00, 0x9E77, 0xB8C7, 0x0AFF, 0}, 137 {0x77dc, 0xc79e, 0xffb8, 0x000a, 0},
120 {0, 0, 0, 0, 0} 138 {0, 0, 0, 0, 0}
121}; 139};
122static xtalk_coefs_t const asXtalkNarrowCoefsLeftEq = { 140static xtalk_coefs_t const asXtalkNarrowCoefsLeftEq = {
@@ -151,7 +169,14 @@ static xtalk_coefs_t const asXtalkNarrowCoefsRightXt = {
151 {0, 0, 0, 0, 0} 169 {0, 0, 0, 0, 0}
152}; 170};
153 171
154static xtalk_coefs_t const asXtalkCoefsZeros; 172static xtalk_coefs_t const asXtalkCoefsZeros = {
173 {0, 0, 0, 0, 0},
174 {0, 0, 0, 0, 0},
175 {0, 0, 0, 0, 0},
176 {0, 0, 0, 0, 0},
177 {0, 0, 0, 0, 0}
178};
179
155static xtalk_coefs_t const asXtalkCoefsPipe = { 180static xtalk_coefs_t const asXtalkCoefsPipe = {
156 {0, 0, 0x0FA0, 0, 0}, 181 {0, 0, 0x0FA0, 0, 0},
157 {0, 0, 0x0FA0, 0, 0}, 182 {0, 0, 0x0FA0, 0, 0},
@@ -186,7 +211,7 @@ static xtalk_coefs_t const asXtalkCoefsDenTest = {
186static xtalk_state_t const asXtalkOutStateTest = { 211static xtalk_state_t const asXtalkOutStateTest = {
187 {0x7FFF, 0x0004, 0xFFFC, 0}, 212 {0x7FFF, 0x0004, 0xFFFC, 0},
188 {0xFE00, 0x0008, 0xFFF8, 0x4000}, 213 {0xFE00, 0x0008, 0xFFF8, 0x4000},
189 {0x200, 0x0010, 0xFFF0, 0xC000}, 214 {0x0200, 0x0010, 0xFFF0, 0xC000},
190 {0x8000, 0x0020, 0xFFE0, 0}, 215 {0x8000, 0x0020, 0xFFE0, 0},
191 {0, 0, 0, 0} 216 {0, 0, 0, 0}
192}; 217};
@@ -306,10 +331,10 @@ vortex_XtalkHw_SetLeftEQStates(vortex_t * vortex,
306 hwwrite(vortex->mmio, 0x2421C + i * 0x24, coefs[i][2]); 331 hwwrite(vortex->mmio, 0x2421C + i * 0x24, coefs[i][2]);
307 hwwrite(vortex->mmio, 0x24220 + i * 0x24, coefs[i][3]); 332 hwwrite(vortex->mmio, 0x24220 + i * 0x24, coefs[i][3]);
308 } 333 }
309 hwwrite(vortex->mmio, 0x244F8 + i * 0x24, arg_0[0]); 334 hwwrite(vortex->mmio, 0x244F8, arg_0[0]);
310 hwwrite(vortex->mmio, 0x244FC + i * 0x24, arg_0[1]); 335 hwwrite(vortex->mmio, 0x244FC, arg_0[1]);
311 hwwrite(vortex->mmio, 0x24500 + i * 0x24, arg_0[2]); 336 hwwrite(vortex->mmio, 0x24500, arg_0[2]);
312 hwwrite(vortex->mmio, 0x24504 + i * 0x24, arg_0[3]); 337 hwwrite(vortex->mmio, 0x24504, arg_0[3]);
313} 338}
314 339
315static void 340static void
@@ -325,10 +350,10 @@ vortex_XtalkHw_SetRightEQStates(vortex_t * vortex,
325 hwwrite(vortex->mmio, 0x242D0 + i * 0x24, coefs[i][2]); 350 hwwrite(vortex->mmio, 0x242D0 + i * 0x24, coefs[i][2]);
326 hwwrite(vortex->mmio, 0x244D4 + i * 0x24, coefs[i][3]); 351 hwwrite(vortex->mmio, 0x244D4 + i * 0x24, coefs[i][3]);
327 } 352 }
328 hwwrite(vortex->mmio, 0x24508 + i * 0x24, arg_0[0]); 353 hwwrite(vortex->mmio, 0x24508, arg_0[0]);
329 hwwrite(vortex->mmio, 0x2450C + i * 0x24, arg_0[1]); 354 hwwrite(vortex->mmio, 0x2450C, arg_0[1]);
330 hwwrite(vortex->mmio, 0x24510 + i * 0x24, arg_0[2]); 355 hwwrite(vortex->mmio, 0x24510, arg_0[2]);
331 hwwrite(vortex->mmio, 0x24514 + i * 0x24, arg_0[3]); 356 hwwrite(vortex->mmio, 0x24514, arg_0[3]);
332} 357}
333 358
334static void 359static void
@@ -344,10 +369,10 @@ vortex_XtalkHw_SetLeftXTStates(vortex_t * vortex,
344 hwwrite(vortex->mmio, 0x24384 + i * 0x24, coefs[i][2]); 369 hwwrite(vortex->mmio, 0x24384 + i * 0x24, coefs[i][2]);
345 hwwrite(vortex->mmio, 0x24388 + i * 0x24, coefs[i][3]); 370 hwwrite(vortex->mmio, 0x24388 + i * 0x24, coefs[i][3]);
346 } 371 }
347 hwwrite(vortex->mmio, 0x24518 + i * 0x24, arg_0[0]); 372 hwwrite(vortex->mmio, 0x24518, arg_0[0]);
348 hwwrite(vortex->mmio, 0x2451C + i * 0x24, arg_0[1]); 373 hwwrite(vortex->mmio, 0x2451C, arg_0[1]);
349 hwwrite(vortex->mmio, 0x24520 + i * 0x24, arg_0[2]); 374 hwwrite(vortex->mmio, 0x24520, arg_0[2]);
350 hwwrite(vortex->mmio, 0x24524 + i * 0x24, arg_0[3]); 375 hwwrite(vortex->mmio, 0x24524, arg_0[3]);
351} 376}
352 377
353static void 378static void
@@ -363,10 +388,10 @@ vortex_XtalkHw_SetRightXTStates(vortex_t * vortex,
363 hwwrite(vortex->mmio, 0x24438 + i * 0x24, coefs[i][2]); 388 hwwrite(vortex->mmio, 0x24438 + i * 0x24, coefs[i][2]);
364 hwwrite(vortex->mmio, 0x2443C + i * 0x24, coefs[i][3]); 389 hwwrite(vortex->mmio, 0x2443C + i * 0x24, coefs[i][3]);
365 } 390 }
366 hwwrite(vortex->mmio, 0x24528 + i * 0x24, arg_0[0]); 391 hwwrite(vortex->mmio, 0x24528, arg_0[0]);
367 hwwrite(vortex->mmio, 0x2452C + i * 0x24, arg_0[1]); 392 hwwrite(vortex->mmio, 0x2452C, arg_0[1]);
368 hwwrite(vortex->mmio, 0x24530 + i * 0x24, arg_0[2]); 393 hwwrite(vortex->mmio, 0x24530, arg_0[2]);
369 hwwrite(vortex->mmio, 0x24534 + i * 0x24, arg_0[3]); 394 hwwrite(vortex->mmio, 0x24534, arg_0[3]);
370} 395}
371 396
372#if 0 397#if 0
@@ -450,10 +475,10 @@ vortex_XtalkHw_GetLeftEQStates(vortex_t * vortex, xtalk_instate_t arg_0,
450 coefs[i][2] = hwread(vortex->mmio, 0x2421C + i * 0x24); 475 coefs[i][2] = hwread(vortex->mmio, 0x2421C + i * 0x24);
451 coefs[i][3] = hwread(vortex->mmio, 0x24220 + i * 0x24); 476 coefs[i][3] = hwread(vortex->mmio, 0x24220 + i * 0x24);
452 } 477 }
453 arg_0[0] = hwread(vortex->mmio, 0x244F8 + i * 0x24); 478 arg_0[0] = hwread(vortex->mmio, 0x244F8);
454 arg_0[1] = hwread(vortex->mmio, 0x244FC + i * 0x24); 479 arg_0[1] = hwread(vortex->mmio, 0x244FC);
455 arg_0[2] = hwread(vortex->mmio, 0x24500 + i * 0x24); 480 arg_0[2] = hwread(vortex->mmio, 0x24500);
456 arg_0[3] = hwread(vortex->mmio, 0x24504 + i * 0x24); 481 arg_0[3] = hwread(vortex->mmio, 0x24504);
457} 482}
458 483
459static void 484static void
@@ -468,10 +493,10 @@ vortex_XtalkHw_GetRightEQStates(vortex_t * vortex, xtalk_instate_t arg_0,
468 coefs[i][2] = hwread(vortex->mmio, 0x242D0 + i * 0x24); 493 coefs[i][2] = hwread(vortex->mmio, 0x242D0 + i * 0x24);
469 coefs[i][3] = hwread(vortex->mmio, 0x242D4 + i * 0x24); 494 coefs[i][3] = hwread(vortex->mmio, 0x242D4 + i * 0x24);
470 } 495 }
471 arg_0[0] = hwread(vortex->mmio, 0x24508 + i * 0x24); 496 arg_0[0] = hwread(vortex->mmio, 0x24508);
472 arg_0[1] = hwread(vortex->mmio, 0x2450C + i * 0x24); 497 arg_0[1] = hwread(vortex->mmio, 0x2450C);
473 arg_0[2] = hwread(vortex->mmio, 0x24510 + i * 0x24); 498 arg_0[2] = hwread(vortex->mmio, 0x24510);
474 arg_0[3] = hwread(vortex->mmio, 0x24514 + i * 0x24); 499 arg_0[3] = hwread(vortex->mmio, 0x24514);
475} 500}
476 501
477static void 502static void
@@ -486,10 +511,10 @@ vortex_XtalkHw_GetLeftXTStates(vortex_t * vortex, xtalk_instate_t arg_0,
486 coefs[i][2] = hwread(vortex->mmio, 0x24384 + i * 0x24); 511 coefs[i][2] = hwread(vortex->mmio, 0x24384 + i * 0x24);
487 coefs[i][3] = hwread(vortex->mmio, 0x24388 + i * 0x24); 512 coefs[i][3] = hwread(vortex->mmio, 0x24388 + i * 0x24);
488 } 513 }
489 arg_0[0] = hwread(vortex->mmio, 0x24518 + i * 0x24); 514 arg_0[0] = hwread(vortex->mmio, 0x24518);
490 arg_0[1] = hwread(vortex->mmio, 0x2451C + i * 0x24); 515 arg_0[1] = hwread(vortex->mmio, 0x2451C);
491 arg_0[2] = hwread(vortex->mmio, 0x24520 + i * 0x24); 516 arg_0[2] = hwread(vortex->mmio, 0x24520);
492 arg_0[3] = hwread(vortex->mmio, 0x24524 + i * 0x24); 517 arg_0[3] = hwread(vortex->mmio, 0x24524);
493} 518}
494 519
495static void 520static void
@@ -504,10 +529,10 @@ vortex_XtalkHw_GetRightXTStates(vortex_t * vortex, xtalk_instate_t arg_0,
504 coefs[i][2] = hwread(vortex->mmio, 0x24438 + i * 0x24); 529 coefs[i][2] = hwread(vortex->mmio, 0x24438 + i * 0x24);
505 coefs[i][3] = hwread(vortex->mmio, 0x2443C + i * 0x24); 530 coefs[i][3] = hwread(vortex->mmio, 0x2443C + i * 0x24);
506 } 531 }
507 arg_0[0] = hwread(vortex->mmio, 0x24528 + i * 0x24); 532 arg_0[0] = hwread(vortex->mmio, 0x24528);
508 arg_0[1] = hwread(vortex->mmio, 0x2452C + i * 0x24); 533 arg_0[1] = hwread(vortex->mmio, 0x2452C);
509 arg_0[2] = hwread(vortex->mmio, 0x24530 + i * 0x24); 534 arg_0[2] = hwread(vortex->mmio, 0x24530);
510 arg_0[3] = hwread(vortex->mmio, 0x24534 + i * 0x24); 535 arg_0[3] = hwread(vortex->mmio, 0x24534);
511} 536}
512 537
513#endif 538#endif
diff --git a/sound/pci/aw2/aw2-alsa.c b/sound/pci/aw2/aw2-alsa.c
index 7a581151db0d..1c5231931462 100644
--- a/sound/pci/aw2/aw2-alsa.c
+++ b/sound/pci/aw2/aw2-alsa.c
@@ -153,7 +153,7 @@ static int snd_aw2_control_switch_capture_put(struct snd_kcontrol *kcontrol,
153 ********************************/ 153 ********************************/
154static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 154static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
155static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 155static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
156static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 156static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
157 157
158module_param_array(index, int, NULL, 0444); 158module_param_array(index, int, NULL, 0444);
159MODULE_PARM_DESC(index, "Index value for Audiowerk2 soundcard."); 159MODULE_PARM_DESC(index, "Index value for Audiowerk2 soundcard.");
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c
index bc1e6830b50d..95ffa6a9db6e 100644
--- a/sound/pci/azt3328.c
+++ b/sound/pci/azt3328.c
@@ -301,7 +301,7 @@ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
301module_param_array(id, charp, NULL, 0444); 301module_param_array(id, charp, NULL, 0444);
302MODULE_PARM_DESC(id, "ID string for AZF3328 soundcard."); 302MODULE_PARM_DESC(id, "ID string for AZF3328 soundcard.");
303 303
304static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 304static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
305module_param_array(enable, bool, NULL, 0444); 305module_param_array(enable, bool, NULL, 0444);
306MODULE_PARM_DESC(enable, "Enable AZF3328 soundcard."); 306MODULE_PARM_DESC(enable, "Enable AZF3328 soundcard.");
307 307
diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c
index c1c2d0c1c7f0..62d6163fc9d9 100644
--- a/sound/pci/bt87x.c
+++ b/sound/pci/bt87x.c
@@ -42,9 +42,9 @@ MODULE_SUPPORTED_DEVICE("{{Brooktree,Bt878},"
42 42
43static int index[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -2}; /* Exclude the first card */ 43static int index[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -2}; /* Exclude the first card */
44static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 44static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
45static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 45static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
46static int digital_rate[SNDRV_CARDS]; /* digital input rate */ 46static int digital_rate[SNDRV_CARDS]; /* digital input rate */
47static int load_all; /* allow to load the non-whitelisted cards */ 47static bool load_all; /* allow to load the non-whitelisted cards */
48 48
49module_param_array(index, int, NULL, 0444); 49module_param_array(index, int, NULL, 0444);
50MODULE_PARM_DESC(index, "Index value for Bt87x soundcard"); 50MODULE_PARM_DESC(index, "Index value for Bt87x soundcard");
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c
index fe99fdeaf15f..08d6ebfe5a61 100644
--- a/sound/pci/ca0106/ca0106_main.c
+++ b/sound/pci/ca0106/ca0106_main.c
@@ -156,7 +156,7 @@ MODULE_SUPPORTED_DEVICE("{{Creative,SB CA0106 chip}}");
156// module parameters (see "Module Parameters") 156// module parameters (see "Module Parameters")
157static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 157static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
158static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 158static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
159static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 159static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
160static uint subsystem[SNDRV_CARDS]; /* Force card subsystem model */ 160static uint subsystem[SNDRV_CARDS]; /* Force card subsystem model */
161 161
162module_param_array(index, int, NULL, 0444); 162module_param_array(index, int, NULL, 0444);
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index 954c9934748a..19b06269adc2 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -54,10 +54,10 @@ MODULE_SUPPORTED_DEVICE("{{C-Media,CMI8738},"
54 54
55static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 55static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
56static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 56static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
57static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */ 57static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */
58static long mpu_port[SNDRV_CARDS]; 58static long mpu_port[SNDRV_CARDS];
59static long fm_port[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)]=1}; 59static long fm_port[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)]=1};
60static int soft_ac3[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)]=1}; 60static bool soft_ac3[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)]=1};
61#ifdef SUPPORT_JOYSTICK 61#ifdef SUPPORT_JOYSTICK
62static int joystick_port[SNDRV_CARDS]; 62static int joystick_port[SNDRV_CARDS];
63#endif 63#endif
diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c
index a6c6c5c53af9..a9f368f60df6 100644
--- a/sound/pci/cs4281.c
+++ b/sound/pci/cs4281.c
@@ -44,8 +44,8 @@ MODULE_SUPPORTED_DEVICE("{{Cirrus Logic,CS4281}}");
44 44
45static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 45static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
46static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 46static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
47static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */ 47static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */
48static int dual_codec[SNDRV_CARDS]; /* dual codec */ 48static bool dual_codec[SNDRV_CARDS]; /* dual codec */
49 49
50module_param_array(index, int, NULL, 0444); 50module_param_array(index, int, NULL, 0444);
51MODULE_PARM_DESC(index, "Index value for CS4281 soundcard."); 51MODULE_PARM_DESC(index, "Index value for CS4281 soundcard.");
diff --git a/sound/pci/cs46xx/cs46xx.c b/sound/pci/cs46xx/cs46xx.c
index a4ecb40f8507..819d79d0586d 100644
--- a/sound/pci/cs46xx/cs46xx.c
+++ b/sound/pci/cs46xx/cs46xx.c
@@ -46,10 +46,10 @@ MODULE_SUPPORTED_DEVICE("{{Cirrus Logic,Sound Fusion (CS4280)},"
46 46
47static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 47static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
48static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 48static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
49static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 49static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
50static int external_amp[SNDRV_CARDS]; 50static bool external_amp[SNDRV_CARDS];
51static int thinkpad[SNDRV_CARDS]; 51static bool thinkpad[SNDRV_CARDS];
52static int mmap_valid[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 52static bool mmap_valid[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
53 53
54module_param_array(index, int, NULL, 0444); 54module_param_array(index, int, NULL, 0444);
55MODULE_PARM_DESC(index, "Index value for the CS46xx soundcard."); 55MODULE_PARM_DESC(index, "Index value for the CS46xx soundcard.");
diff --git a/sound/pci/cs5530.c b/sound/pci/cs5530.c
index 958f4949e973..c47cabff2bfa 100644
--- a/sound/pci/cs5530.c
+++ b/sound/pci/cs5530.c
@@ -50,7 +50,14 @@ MODULE_LICENSE("GPL");
50 50
51static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 51static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
52static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 52static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
53static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 53static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
54
55module_param_array(index, int, NULL, 0444);
56MODULE_PARM_DESC(index, "Index value for CS5530 Audio driver.");
57module_param_array(id, charp, NULL, 0444);
58MODULE_PARM_DESC(id, "ID string for CS5530 Audio driver.");
59module_param_array(enable, bool, NULL, 0444);
60MODULE_PARM_DESC(enable, "Enable CS5530 Audio driver.");
54 61
55struct snd_cs5530 { 62struct snd_cs5530 {
56 struct snd_card *card; 63 struct snd_card *card;
diff --git a/sound/pci/cs5535audio/cs5535audio.c b/sound/pci/cs5535audio/cs5535audio.c
index b8959d2c804b..a2fb2173e980 100644
--- a/sound/pci/cs5535audio/cs5535audio.c
+++ b/sound/pci/cs5535audio/cs5535audio.c
@@ -57,7 +57,7 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = {
57 57
58static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 58static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
59static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 59static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
60static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 60static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
61 61
62module_param_array(index, int, NULL, 0444); 62module_param_array(index, int, NULL, 0444);
63MODULE_PARM_DESC(index, "Index value for " DRIVER_NAME); 63MODULE_PARM_DESC(index, "Index value for " DRIVER_NAME);
diff --git a/sound/pci/cs5535audio/cs5535audio_pcm.c b/sound/pci/cs5535audio/cs5535audio_pcm.c
index e083122ca55a..dbf94b189e75 100644
--- a/sound/pci/cs5535audio/cs5535audio_pcm.c
+++ b/sound/pci/cs5535audio/cs5535audio_pcm.c
@@ -148,7 +148,7 @@ static int cs5535audio_build_dma_packets(struct cs5535audio *cs5535au,
148 struct cs5535audio_dma_desc *desc = 148 struct cs5535audio_dma_desc *desc =
149 &((struct cs5535audio_dma_desc *) dma->desc_buf.area)[i]; 149 &((struct cs5535audio_dma_desc *) dma->desc_buf.area)[i];
150 desc->addr = cpu_to_le32(addr); 150 desc->addr = cpu_to_le32(addr);
151 desc->size = cpu_to_le32(period_bytes); 151 desc->size = cpu_to_le16(period_bytes);
152 desc->ctlreserved = cpu_to_le16(PRD_EOP); 152 desc->ctlreserved = cpu_to_le16(PRD_EOP);
153 desc_addr += sizeof(struct cs5535audio_dma_desc); 153 desc_addr += sizeof(struct cs5535audio_dma_desc);
154 addr += period_bytes; 154 addr += period_bytes;
diff --git a/sound/pci/ctxfi/ctsrc.c b/sound/pci/ctxfi/ctsrc.c
index e134b3a5780d..6e77e86307c2 100644
--- a/sound/pci/ctxfi/ctsrc.c
+++ b/sound/pci/ctxfi/ctsrc.c
@@ -437,7 +437,7 @@ get_src_rsc(struct src_mgr *mgr, const struct src_desc *desc, struct src **rsrc)
437 437
438 /* Allocate mem for master src resource */ 438 /* Allocate mem for master src resource */
439 if (MEMRD == desc->mode) 439 if (MEMRD == desc->mode)
440 src = kzalloc(sizeof(*src)*desc->multi, GFP_KERNEL); 440 src = kcalloc(desc->multi, sizeof(*src), GFP_KERNEL);
441 else 441 else
442 src = kzalloc(sizeof(*src), GFP_KERNEL); 442 src = kzalloc(sizeof(*src), GFP_KERNEL);
443 443
diff --git a/sound/pci/ctxfi/cttimer.c b/sound/pci/ctxfi/cttimer.c
index 93b0aedc36d4..03fb909085af 100644
--- a/sound/pci/ctxfi/cttimer.c
+++ b/sound/pci/ctxfi/cttimer.c
@@ -15,8 +15,8 @@
15#include "cthardware.h" 15#include "cthardware.h"
16#include "cttimer.h" 16#include "cttimer.h"
17 17
18static int use_system_timer; 18static bool use_system_timer;
19MODULE_PARM_DESC(use_system_timer, "Foce to use system-timer"); 19MODULE_PARM_DESC(use_system_timer, "Force to use system-timer");
20module_param(use_system_timer, bool, S_IRUGO); 20module_param(use_system_timer, bool, S_IRUGO);
21 21
22struct ct_timer_ops { 22struct ct_timer_ops {
diff --git a/sound/pci/ctxfi/xfi.c b/sound/pci/ctxfi/xfi.c
index 33931ef5e129..15d95d2bacee 100644
--- a/sound/pci/ctxfi/xfi.c
+++ b/sound/pci/ctxfi/xfi.c
@@ -32,7 +32,7 @@ module_param(multiple, uint, S_IRUGO);
32 32
33static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 33static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
34static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 34static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
35static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 35static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
36static unsigned int subsystem[SNDRV_CARDS]; 36static unsigned int subsystem[SNDRV_CARDS];
37 37
38module_param_array(index, int, NULL, 0444); 38module_param_array(index, int, NULL, 0444);
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c
index 9fd694c61866..595c11f904bb 100644
--- a/sound/pci/echoaudio/echoaudio.c
+++ b/sound/pci/echoaudio/echoaudio.c
@@ -26,7 +26,7 @@ MODULE_DEVICE_TABLE(pci, snd_echo_ids);
26 26
27static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 27static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
28static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 28static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
29static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 29static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
30 30
31module_param_array(index, int, NULL, 0444); 31module_param_array(index, int, NULL, 0444);
32MODULE_PARM_DESC(index, "Index value for " ECHOCARD_NAME " soundcard."); 32MODULE_PARM_DESC(index, "Index value for " ECHOCARD_NAME " soundcard.");
diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c
index eaa198e122c0..790c65d980c8 100644
--- a/sound/pci/emu10k1/emu10k1.c
+++ b/sound/pci/emu10k1/emu10k1.c
@@ -44,13 +44,13 @@ MODULE_SUPPORTED_DEVICE("{{Creative Labs,SB Live!/PCI512/E-mu APS},"
44 44
45static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 45static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
46static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 46static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
47static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 47static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
48static int extin[SNDRV_CARDS]; 48static int extin[SNDRV_CARDS];
49static int extout[SNDRV_CARDS]; 49static int extout[SNDRV_CARDS];
50static int seq_ports[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 4}; 50static int seq_ports[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 4};
51static int max_synth_voices[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 64}; 51static int max_synth_voices[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 64};
52static int max_buffer_size[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 128}; 52static int max_buffer_size[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 128};
53static int enable_ir[SNDRV_CARDS]; 53static bool enable_ir[SNDRV_CARDS];
54static uint subsystem[SNDRV_CARDS]; /* Force card subsystem model */ 54static uint subsystem[SNDRV_CARDS]; /* Force card subsystem model */
55static uint delay_pcm_irq[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2}; 55static uint delay_pcm_irq[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2};
56 56
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
index 6a3e5677f591..754924081d0a 100644
--- a/sound/pci/emu10k1/emu10k1_main.c
+++ b/sound/pci/emu10k1/emu10k1_main.c
@@ -1480,6 +1480,18 @@ static struct snd_emu_chip_details emu_chip_details[] = {
1480 .spdif_bug = 1, 1480 .spdif_bug = 1,
1481 .invert_shared_spdif = 1, /* digital/analog switch swapped */ 1481 .invert_shared_spdif = 1, /* digital/analog switch swapped */
1482 .ac97_chip = 1} , 1482 .ac97_chip = 1} ,
1483 /* 0x20051102 also has SB0350 written on it, treated as Audigy 2 ZS by
1484 Creative's Windows driver */
1485 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20051102,
1486 .driver = "Audigy2", .name = "SB Audigy 2 ZS [SB0350a]",
1487 .id = "Audigy2",
1488 .emu10k2_chip = 1,
1489 .ca0102_chip = 1,
1490 .ca0151_chip = 1,
1491 .spk71 = 1,
1492 .spdif_bug = 1,
1493 .invert_shared_spdif = 1, /* digital/analog switch swapped */
1494 .ac97_chip = 1} ,
1483 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20021102, 1495 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20021102,
1484 .driver = "Audigy2", .name = "SB Audigy 2 ZS [SB0350]", 1496 .driver = "Audigy2", .name = "SB Audigy 2 ZS [SB0350]",
1485 .id = "Audigy2", 1497 .id = "Audigy2",
diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c
index 2228be9f30e6..47a651cb6e84 100644
--- a/sound/pci/emu10k1/emu10k1x.c
+++ b/sound/pci/emu10k1/emu10k1x.c
@@ -50,7 +50,7 @@ MODULE_SUPPORTED_DEVICE("{{Dell Creative Labs,SB Live!}");
50// module parameters (see "Module Parameters") 50// module parameters (see "Module Parameters")
51static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 51static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
52static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 52static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
53static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 53static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
54 54
55module_param_array(index, int, NULL, 0444); 55module_param_array(index, int, NULL, 0444);
56MODULE_PARM_DESC(index, "Index value for the EMU10K1X soundcard."); 56MODULE_PARM_DESC(index, "Index value for the EMU10K1X soundcard.");
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index d085ad03efe8..47a245e84190 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -83,12 +83,12 @@ MODULE_SUPPORTED_DEVICE("{{Ensoniq,AudioPCI ES1371/73},"
83 83
84static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 84static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
85static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 85static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
86static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */ 86static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */
87#ifdef SUPPORT_JOYSTICK 87#ifdef SUPPORT_JOYSTICK
88#ifdef CHIP1371 88#ifdef CHIP1371
89static int joystick_port[SNDRV_CARDS]; 89static int joystick_port[SNDRV_CARDS];
90#else 90#else
91static int joystick[SNDRV_CARDS]; 91static bool joystick[SNDRV_CARDS];
92#endif 92#endif
93#endif 93#endif
94#ifdef CHIP1371 94#ifdef CHIP1371
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c
index 04cc21f5d014..53eb76b41108 100644
--- a/sound/pci/es1938.c
+++ b/sound/pci/es1938.c
@@ -79,7 +79,7 @@ MODULE_SUPPORTED_DEVICE("{{ESS,ES1938},"
79 79
80static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 80static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
81static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 81static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
82static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 82static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
83 83
84module_param_array(index, int, NULL, 0444); 84module_param_array(index, int, NULL, 0444);
85MODULE_PARM_DESC(index, "Index value for ESS Solo-1 soundcard."); 85MODULE_PARM_DESC(index, "Index value for ESS Solo-1 soundcard.");
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
index 297a151bdba9..cb557c603a80 100644
--- a/sound/pci/es1968.c
+++ b/sound/pci/es1968.c
@@ -132,7 +132,7 @@ MODULE_SUPPORTED_DEVICE("{{ESS,Maestro 2e},"
132 132
133static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 1-MAX */ 133static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 1-MAX */
134static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 134static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
135static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 135static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
136static int total_bufsize[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1024 }; 136static int total_bufsize[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1024 };
137static int pcm_substreams_p[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 4 }; 137static int pcm_substreams_p[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 4 };
138static int pcm_substreams_c[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1 }; 138static int pcm_substreams_c[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1 };
@@ -140,7 +140,7 @@ static int clock[SNDRV_CARDS];
140static int use_pm[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2}; 140static int use_pm[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2};
141static int enable_mpu[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2}; 141static int enable_mpu[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2};
142#ifdef SUPPORT_JOYSTICK 142#ifdef SUPPORT_JOYSTICK
143static int joystick[SNDRV_CARDS]; 143static bool joystick[SNDRV_CARDS];
144#endif 144#endif
145 145
146module_param_array(index, int, NULL, 0444); 146module_param_array(index, int, NULL, 0444);
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c
index ec05ef5a5abf..9597ef1eccca 100644
--- a/sound/pci/fm801.c
+++ b/sound/pci/fm801.c
@@ -48,7 +48,7 @@ MODULE_SUPPORTED_DEVICE("{{ForteMedia,FM801},"
48 48
49static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 49static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
50static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 50static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
51static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 51static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
52/* 52/*
53 * Enable TEA575x tuner 53 * Enable TEA575x tuner
54 * 1 = MediaForte 256-PCS 54 * 1 = MediaForte 256-PCS
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index e44b107fdc75..4562e9de6a1a 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -4046,9 +4046,9 @@ int snd_hda_check_board_codec_sid_config(struct hda_codec *codec,
4046 4046
4047 /* Search for codec ID */ 4047 /* Search for codec ID */
4048 for (q = tbl; q->subvendor; q++) { 4048 for (q = tbl; q->subvendor; q++) {
4049 unsigned long vendorid = (q->subdevice) | (q->subvendor << 16); 4049 unsigned int mask = 0xffff0000 | q->subdevice_mask;
4050 4050 unsigned int id = (q->subdevice | (q->subvendor << 16)) & mask;
4051 if (vendorid == codec->subsystem_id) 4051 if ((codec->subsystem_id & mask) == id)
4052 break; 4052 break;
4053 } 4053 }
4054 4054
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c
index 7ae7578bdcc0..c1da422e085a 100644
--- a/sound/pci/hda/hda_eld.c
+++ b/sound/pci/hda/hda_eld.c
@@ -347,18 +347,28 @@ int snd_hdmi_get_eld(struct hdmi_eld *eld,
347 347
348 for (i = 0; i < size; i++) { 348 for (i = 0; i < size; i++) {
349 unsigned int val = hdmi_get_eld_data(codec, nid, i); 349 unsigned int val = hdmi_get_eld_data(codec, nid, i);
350 /*
351 * Graphics driver might be writing to ELD buffer right now.
352 * Just abort. The caller will repoll after a while.
353 */
350 if (!(val & AC_ELDD_ELD_VALID)) { 354 if (!(val & AC_ELDD_ELD_VALID)) {
351 if (!i) {
352 snd_printd(KERN_INFO
353 "HDMI: invalid ELD data\n");
354 ret = -EINVAL;
355 goto error;
356 }
357 snd_printd(KERN_INFO 355 snd_printd(KERN_INFO
358 "HDMI: invalid ELD data byte %d\n", i); 356 "HDMI: invalid ELD data byte %d\n", i);
359 val = 0; 357 ret = -EINVAL;
360 } else 358 goto error;
361 val &= AC_ELDD_ELD_DATA; 359 }
360 val &= AC_ELDD_ELD_DATA;
361 /*
362 * The first byte cannot be zero. This can happen on some DVI
363 * connections. Some Intel chips may also need some 250ms delay
364 * to return non-zero ELD data, even when the graphics driver
365 * correctly writes ELD content before setting ELD_valid bit.
366 */
367 if (!val && !i) {
368 snd_printdd(KERN_INFO "HDMI: 0 ELD data\n");
369 ret = -EINVAL;
370 goto error;
371 }
362 buf[i] = val; 372 buf[i] = val;
363 } 373 }
364 374
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 096507d2ca9a..06fe2c546ee4 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -58,13 +58,13 @@
58 58
59static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 59static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
60static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 60static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
61static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 61static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
62static char *model[SNDRV_CARDS]; 62static char *model[SNDRV_CARDS];
63static int position_fix[SNDRV_CARDS]; 63static int position_fix[SNDRV_CARDS];
64static int bdl_pos_adj[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1}; 64static int bdl_pos_adj[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1};
65static int probe_mask[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1}; 65static int probe_mask[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1};
66static int probe_only[SNDRV_CARDS]; 66static int probe_only[SNDRV_CARDS];
67static int single_cmd; 67static bool single_cmd;
68static int enable_msi = -1; 68static int enable_msi = -1;
69#ifdef CONFIG_SND_HDA_PATCH_LOADER 69#ifdef CONFIG_SND_HDA_PATCH_LOADER
70static char *patch[SNDRV_CARDS]; 70static char *patch[SNDRV_CARDS];
@@ -116,12 +116,12 @@ MODULE_PARM_DESC(power_save, "Automatic power-saving timeout "
116 * this may give more power-saving, but will take longer time to 116 * this may give more power-saving, but will take longer time to
117 * wake up. 117 * wake up.
118 */ 118 */
119static int power_save_controller = 1; 119static bool power_save_controller = 1;
120module_param(power_save_controller, bool, 0644); 120module_param(power_save_controller, bool, 0644);
121MODULE_PARM_DESC(power_save_controller, "Reset controller in power save mode."); 121MODULE_PARM_DESC(power_save_controller, "Reset controller in power save mode.");
122#endif 122#endif
123 123
124static int align_buffer_size = 1; 124static bool align_buffer_size = 1;
125module_param(align_buffer_size, bool, 0644); 125module_param(align_buffer_size, bool, 0644);
126MODULE_PARM_DESC(align_buffer_size, 126MODULE_PARM_DESC(align_buffer_size,
127 "Force buffer and period sizes to be multiple of 128 bytes."); 127 "Force buffer and period sizes to be multiple of 128 bytes.");
@@ -2508,7 +2508,6 @@ static struct snd_pci_quirk position_fix_list[] __devinitdata = {
2508 SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB), 2508 SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB),
2509 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS M2V", POS_FIX_LPIB), 2509 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS M2V", POS_FIX_LPIB),
2510 SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB), 2510 SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB),
2511 SND_PCI_QUIRK(0x1106, 0x3288, "ASUS M2V-MX SE", POS_FIX_LPIB),
2512 SND_PCI_QUIRK(0x1297, 0x3166, "Shuttle", POS_FIX_LPIB), 2511 SND_PCI_QUIRK(0x1297, 0x3166, "Shuttle", POS_FIX_LPIB),
2513 SND_PCI_QUIRK(0x1458, 0xa022, "ga-ma770-ud3", POS_FIX_LPIB), 2512 SND_PCI_QUIRK(0x1458, 0xa022, "ga-ma770-ud3", POS_FIX_LPIB),
2514 SND_PCI_QUIRK(0x1462, 0x1002, "MSI Wind U115", POS_FIX_LPIB), 2513 SND_PCI_QUIRK(0x1462, 0x1002, "MSI Wind U115", POS_FIX_LPIB),
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
index 2fbab8e29576..70a7abda7e22 100644
--- a/sound/pci/hda/patch_cirrus.c
+++ b/sound/pci/hda/patch_cirrus.c
@@ -58,6 +58,8 @@ struct cs_spec {
58 unsigned int gpio_mask; 58 unsigned int gpio_mask;
59 unsigned int gpio_dir; 59 unsigned int gpio_dir;
60 unsigned int gpio_data; 60 unsigned int gpio_data;
61 unsigned int gpio_eapd_hp; /* EAPD GPIO bit for headphones */
62 unsigned int gpio_eapd_speaker; /* EAPD GPIO bit for speakers */
61 63
62 struct hda_pcm pcm_rec[2]; /* PCM information */ 64 struct hda_pcm pcm_rec[2]; /* PCM information */
63 65
@@ -76,6 +78,7 @@ enum {
76 CS420X_MBP53, 78 CS420X_MBP53,
77 CS420X_MBP55, 79 CS420X_MBP55,
78 CS420X_IMAC27, 80 CS420X_IMAC27,
81 CS420X_APPLE,
79 CS420X_AUTO, 82 CS420X_AUTO,
80 CS420X_MODELS 83 CS420X_MODELS
81}; 84};
@@ -928,10 +931,9 @@ static void cs_automute(struct hda_codec *codec)
928 spdif_present ? 0 : PIN_OUT); 931 spdif_present ? 0 : PIN_OUT);
929 } 932 }
930 } 933 }
931 if (spec->board_config == CS420X_MBP53 || 934 if (spec->gpio_eapd_hp) {
932 spec->board_config == CS420X_MBP55 || 935 unsigned int gpio = hp_present ?
933 spec->board_config == CS420X_IMAC27) { 936 spec->gpio_eapd_hp : spec->gpio_eapd_speaker;
934 unsigned int gpio = hp_present ? 0x02 : 0x08;
935 snd_hda_codec_write(codec, 0x01, 0, 937 snd_hda_codec_write(codec, 0x01, 0,
936 AC_VERB_SET_GPIO_DATA, gpio); 938 AC_VERB_SET_GPIO_DATA, gpio);
937 } 939 }
@@ -1276,6 +1278,7 @@ static const char * const cs420x_models[CS420X_MODELS] = {
1276 [CS420X_MBP53] = "mbp53", 1278 [CS420X_MBP53] = "mbp53",
1277 [CS420X_MBP55] = "mbp55", 1279 [CS420X_MBP55] = "mbp55",
1278 [CS420X_IMAC27] = "imac27", 1280 [CS420X_IMAC27] = "imac27",
1281 [CS420X_APPLE] = "apple",
1279 [CS420X_AUTO] = "auto", 1282 [CS420X_AUTO] = "auto",
1280}; 1283};
1281 1284
@@ -1285,7 +1288,13 @@ static const struct snd_pci_quirk cs420x_cfg_tbl[] = {
1285 SND_PCI_QUIRK(0x10de, 0x0d94, "MacBookAir 3,1(2)", CS420X_MBP55), 1288 SND_PCI_QUIRK(0x10de, 0x0d94, "MacBookAir 3,1(2)", CS420X_MBP55),
1286 SND_PCI_QUIRK(0x10de, 0xcb79, "MacBookPro 5,5", CS420X_MBP55), 1289 SND_PCI_QUIRK(0x10de, 0xcb79, "MacBookPro 5,5", CS420X_MBP55),
1287 SND_PCI_QUIRK(0x10de, 0xcb89, "MacBookPro 7,1", CS420X_MBP55), 1290 SND_PCI_QUIRK(0x10de, 0xcb89, "MacBookPro 7,1", CS420X_MBP55),
1288 SND_PCI_QUIRK(0x8086, 0x7270, "IMac 27 Inch", CS420X_IMAC27), 1291 /* this conflicts with too many other models */
1292 /*SND_PCI_QUIRK(0x8086, 0x7270, "IMac 27 Inch", CS420X_IMAC27),*/
1293 {} /* terminator */
1294};
1295
1296static const struct snd_pci_quirk cs420x_codec_cfg_tbl[] = {
1297 SND_PCI_QUIRK_VENDOR(0x106b, "Apple", CS420X_APPLE),
1289 {} /* terminator */ 1298 {} /* terminator */
1290}; 1299};
1291 1300
@@ -1367,6 +1376,10 @@ static int patch_cs420x(struct hda_codec *codec)
1367 spec->board_config = 1376 spec->board_config =
1368 snd_hda_check_board_config(codec, CS420X_MODELS, 1377 snd_hda_check_board_config(codec, CS420X_MODELS,
1369 cs420x_models, cs420x_cfg_tbl); 1378 cs420x_models, cs420x_cfg_tbl);
1379 if (spec->board_config < 0)
1380 spec->board_config =
1381 snd_hda_check_board_codec_sid_config(codec,
1382 CS420X_MODELS, NULL, cs420x_codec_cfg_tbl);
1370 if (spec->board_config >= 0) 1383 if (spec->board_config >= 0)
1371 fix_pincfg(codec, spec->board_config, cs_pincfgs); 1384 fix_pincfg(codec, spec->board_config, cs_pincfgs);
1372 1385
@@ -1374,10 +1387,11 @@ static int patch_cs420x(struct hda_codec *codec)
1374 case CS420X_IMAC27: 1387 case CS420X_IMAC27:
1375 case CS420X_MBP53: 1388 case CS420X_MBP53:
1376 case CS420X_MBP55: 1389 case CS420X_MBP55:
1377 /* GPIO1 = headphones */ 1390 case CS420X_APPLE:
1378 /* GPIO3 = speakers */ 1391 spec->gpio_eapd_hp = 2; /* GPIO1 = headphones */
1379 spec->gpio_mask = 0x0a; 1392 spec->gpio_eapd_speaker = 8; /* GPIO3 = speakers */
1380 spec->gpio_dir = 0x0a; 1393 spec->gpio_mask = spec->gpio_dir =
1394 spec->gpio_eapd_hp | spec->gpio_eapd_speaker;
1381 break; 1395 break;
1382 } 1396 }
1383 1397
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 9850c5b481ea..c505fd5d338c 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -69,6 +69,7 @@ struct hdmi_spec_per_pin {
69 struct hda_codec *codec; 69 struct hda_codec *codec;
70 struct hdmi_eld sink_eld; 70 struct hdmi_eld sink_eld;
71 struct delayed_work work; 71 struct delayed_work work;
72 int repoll_count;
72}; 73};
73 74
74struct hdmi_spec { 75struct hdmi_spec {
@@ -748,7 +749,7 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, int pin_idx,
748 * Unsolicited events 749 * Unsolicited events
749 */ 750 */
750 751
751static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, bool retry); 752static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll);
752 753
753static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) 754static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res)
754{ 755{
@@ -766,7 +767,7 @@ static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res)
766 if (pin_idx < 0) 767 if (pin_idx < 0)
767 return; 768 return;
768 769
769 hdmi_present_sense(&spec->pins[pin_idx], true); 770 hdmi_present_sense(&spec->pins[pin_idx], 1);
770} 771}
771 772
772static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res) 773static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res)
@@ -960,7 +961,7 @@ static int hdmi_read_pin_conn(struct hda_codec *codec, int pin_idx)
960 return 0; 961 return 0;
961} 962}
962 963
963static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, bool retry) 964static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll)
964{ 965{
965 struct hda_codec *codec = per_pin->codec; 966 struct hda_codec *codec = per_pin->codec;
966 struct hdmi_eld *eld = &per_pin->sink_eld; 967 struct hdmi_eld *eld = &per_pin->sink_eld;
@@ -989,7 +990,7 @@ static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, bool retry)
989 if (eld_valid) { 990 if (eld_valid) {
990 if (!snd_hdmi_get_eld(eld, codec, pin_nid)) 991 if (!snd_hdmi_get_eld(eld, codec, pin_nid))
991 snd_hdmi_show_eld(eld); 992 snd_hdmi_show_eld(eld);
992 else if (retry) { 993 else if (repoll) {
993 queue_delayed_work(codec->bus->workq, 994 queue_delayed_work(codec->bus->workq,
994 &per_pin->work, 995 &per_pin->work,
995 msecs_to_jiffies(300)); 996 msecs_to_jiffies(300));
@@ -1004,7 +1005,10 @@ static void hdmi_repoll_eld(struct work_struct *work)
1004 struct hdmi_spec_per_pin *per_pin = 1005 struct hdmi_spec_per_pin *per_pin =
1005 container_of(to_delayed_work(work), struct hdmi_spec_per_pin, work); 1006 container_of(to_delayed_work(work), struct hdmi_spec_per_pin, work);
1006 1007
1007 hdmi_present_sense(per_pin, false); 1008 if (per_pin->repoll_count++ > 6)
1009 per_pin->repoll_count = 0;
1010
1011 hdmi_present_sense(per_pin, per_pin->repoll_count);
1008} 1012}
1009 1013
1010static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid) 1014static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid)
@@ -1235,7 +1239,7 @@ static int generic_hdmi_build_jack(struct hda_codec *codec, int pin_idx)
1235 if (err < 0) 1239 if (err < 0)
1236 return err; 1240 return err;
1237 1241
1238 hdmi_present_sense(per_pin, false); 1242 hdmi_present_sense(per_pin, 0);
1239 return 0; 1243 return 0;
1240} 1244}
1241 1245
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 336d14eb72af..cbde019d3d52 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -277,6 +277,12 @@ static bool alc_dyn_adc_pcm_resetup(struct hda_codec *codec, int cur)
277 return false; 277 return false;
278} 278}
279 279
280static inline hda_nid_t get_capsrc(struct alc_spec *spec, int idx)
281{
282 return spec->capsrc_nids ?
283 spec->capsrc_nids[idx] : spec->adc_nids[idx];
284}
285
280/* select the given imux item; either unmute exclusively or select the route */ 286/* select the given imux item; either unmute exclusively or select the route */
281static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx, 287static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx,
282 unsigned int idx, bool force) 288 unsigned int idx, bool force)
@@ -303,8 +309,7 @@ static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx,
303 adc_idx = spec->dyn_adc_idx[idx]; 309 adc_idx = spec->dyn_adc_idx[idx];
304 } 310 }
305 311
306 nid = spec->capsrc_nids ? 312 nid = get_capsrc(spec, adc_idx);
307 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
308 313
309 /* no selection? */ 314 /* no selection? */
310 num_conns = snd_hda_get_conn_list(codec, nid, NULL); 315 num_conns = snd_hda_get_conn_list(codec, nid, NULL);
@@ -1054,8 +1059,19 @@ static bool alc_rebuild_imux_for_auto_mic(struct hda_codec *codec)
1054 spec->imux_pins[2] = spec->dock_mic_pin; 1059 spec->imux_pins[2] = spec->dock_mic_pin;
1055 for (i = 0; i < 3; i++) { 1060 for (i = 0; i < 3; i++) {
1056 strcpy(imux->items[i].label, texts[i]); 1061 strcpy(imux->items[i].label, texts[i]);
1057 if (spec->imux_pins[i]) 1062 if (spec->imux_pins[i]) {
1063 hda_nid_t pin = spec->imux_pins[i];
1064 int c;
1065 for (c = 0; c < spec->num_adc_nids; c++) {
1066 hda_nid_t cap = get_capsrc(spec, c);
1067 int idx = get_connection_index(codec, cap, pin);
1068 if (idx >= 0) {
1069 imux->items[i].index = idx;
1070 break;
1071 }
1072 }
1058 imux->num_items = i + 1; 1073 imux->num_items = i + 1;
1074 }
1059 } 1075 }
1060 spec->num_mux_defs = 1; 1076 spec->num_mux_defs = 1;
1061 spec->input_mux = imux; 1077 spec->input_mux = imux;
@@ -1957,10 +1973,8 @@ static int alc_build_controls(struct hda_codec *codec)
1957 if (!kctl) 1973 if (!kctl)
1958 kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); 1974 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
1959 for (i = 0; kctl && i < kctl->count; i++) { 1975 for (i = 0; kctl && i < kctl->count; i++) {
1960 const hda_nid_t *nids = spec->capsrc_nids; 1976 err = snd_hda_add_nid(codec, kctl, i,
1961 if (!nids) 1977 get_capsrc(spec, i));
1962 nids = spec->adc_nids;
1963 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
1964 if (err < 0) 1978 if (err < 0)
1965 return err; 1979 return err;
1966 } 1980 }
@@ -2747,8 +2761,7 @@ static int alc_auto_create_input_ctls(struct hda_codec *codec)
2747 } 2761 }
2748 2762
2749 for (c = 0; c < num_adcs; c++) { 2763 for (c = 0; c < num_adcs; c++) {
2750 hda_nid_t cap = spec->capsrc_nids ? 2764 hda_nid_t cap = get_capsrc(spec, c);
2751 spec->capsrc_nids[c] : spec->adc_nids[c];
2752 idx = get_connection_index(codec, cap, pin); 2765 idx = get_connection_index(codec, cap, pin);
2753 if (idx >= 0) { 2766 if (idx >= 0) {
2754 spec->imux_pins[imux->num_items] = pin; 2767 spec->imux_pins[imux->num_items] = pin;
@@ -3694,8 +3707,7 @@ static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin)
3694 if (!pin) 3707 if (!pin)
3695 return 0; 3708 return 0;
3696 for (i = 0; i < spec->num_adc_nids; i++) { 3709 for (i = 0; i < spec->num_adc_nids; i++) {
3697 hda_nid_t cap = spec->capsrc_nids ? 3710 hda_nid_t cap = get_capsrc(spec, i);
3698 spec->capsrc_nids[i] : spec->adc_nids[i];
3699 int idx; 3711 int idx;
3700 3712
3701 idx = get_connection_index(codec, cap, pin); 3713 idx = get_connection_index(codec, cap, pin);
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 470f6f286e81..d8d2f9dccd9b 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -1641,6 +1641,8 @@ static const struct snd_pci_quirk stac92hd73xx_codec_id_cfg_tbl[] = {
1641 "Alienware M17x", STAC_ALIENWARE_M17X), 1641 "Alienware M17x", STAC_ALIENWARE_M17X),
1642 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x043a, 1642 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x043a,
1643 "Alienware M17x", STAC_ALIENWARE_M17X), 1643 "Alienware M17x", STAC_ALIENWARE_M17X),
1644 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0490,
1645 "Alienware M17x", STAC_ALIENWARE_M17X),
1644 {} /* terminator */ 1646 {} /* terminator */
1645}; 1647};
1646 1648
@@ -4439,7 +4441,9 @@ static int stac92xx_init(struct hda_codec *codec)
4439 int pinctl, def_conf; 4441 int pinctl, def_conf;
4440 4442
4441 /* power on when no jack detection is available */ 4443 /* power on when no jack detection is available */
4442 if (!spec->hp_detect) { 4444 /* or when the VREF is used for controlling LED */
4445 if (!spec->hp_detect ||
4446 (spec->gpio_led > 8 && spec->gpio_led == nid)) {
4443 stac_toggle_power_map(codec, nid, 1); 4447 stac_toggle_power_map(codec, nid, 1);
4444 continue; 4448 continue;
4445 } 4449 }
@@ -5053,20 +5057,6 @@ static int stac92xx_pre_resume(struct hda_codec *codec)
5053 return 0; 5057 return 0;
5054} 5058}
5055 5059
5056static int stac92xx_post_suspend(struct hda_codec *codec)
5057{
5058 struct sigmatel_spec *spec = codec->spec;
5059 if (spec->gpio_led > 8) {
5060 /* with vref-out pin used for mute led control
5061 * codec AFG is prevented from D3 state, but on
5062 * system suspend it can (and should) be used
5063 */
5064 snd_hda_codec_read(codec, codec->afg, 0,
5065 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
5066 }
5067 return 0;
5068}
5069
5070static void stac92xx_set_power_state(struct hda_codec *codec, hda_nid_t fg, 5060static void stac92xx_set_power_state(struct hda_codec *codec, hda_nid_t fg,
5071 unsigned int power_state) 5061 unsigned int power_state)
5072{ 5062{
@@ -5666,8 +5656,6 @@ again:
5666 } else { 5656 } else {
5667 codec->patch_ops.set_power_state = 5657 codec->patch_ops.set_power_state =
5668 stac92xx_set_power_state; 5658 stac92xx_set_power_state;
5669 codec->patch_ops.post_suspend =
5670 stac92xx_post_suspend;
5671 } 5659 }
5672 codec->patch_ops.pre_resume = stac92xx_pre_resume; 5660 codec->patch_ops.pre_resume = stac92xx_pre_resume;
5673 codec->patch_ops.check_power_status = 5661 codec->patch_ops.check_power_status =
@@ -5981,8 +5969,6 @@ again:
5981 } else { 5969 } else {
5982 codec->patch_ops.set_power_state = 5970 codec->patch_ops.set_power_state =
5983 stac92xx_set_power_state; 5971 stac92xx_set_power_state;
5984 codec->patch_ops.post_suspend =
5985 stac92xx_post_suspend;
5986 } 5972 }
5987 codec->patch_ops.pre_resume = stac92xx_pre_resume; 5973 codec->patch_ops.pre_resume = stac92xx_pre_resume;
5988 codec->patch_ops.check_power_status = 5974 codec->patch_ops.check_power_status =
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
index 431c0d417eeb..b5137629f8e9 100644
--- a/sound/pci/hda/patch_via.c
+++ b/sound/pci/hda/patch_via.c
@@ -208,6 +208,7 @@ struct via_spec {
208 /* work to check hp jack state */ 208 /* work to check hp jack state */
209 struct hda_codec *codec; 209 struct hda_codec *codec;
210 struct delayed_work vt1708_hp_work; 210 struct delayed_work vt1708_hp_work;
211 int hp_work_active;
211 int vt1708_jack_detect; 212 int vt1708_jack_detect;
212 int vt1708_hp_present; 213 int vt1708_hp_present;
213 214
@@ -305,27 +306,35 @@ enum {
305static void analog_low_current_mode(struct hda_codec *codec); 306static void analog_low_current_mode(struct hda_codec *codec);
306static bool is_aa_path_mute(struct hda_codec *codec); 307static bool is_aa_path_mute(struct hda_codec *codec);
307 308
308static void vt1708_start_hp_work(struct via_spec *spec) 309#define hp_detect_with_aa(codec) \
310 (snd_hda_get_bool_hint(codec, "analog_loopback_hp_detect") == 1 && \
311 !is_aa_path_mute(codec))
312
313static void vt1708_stop_hp_work(struct via_spec *spec)
309{ 314{
310 if (spec->codec_type != VT1708 || spec->autocfg.hp_pins[0] == 0) 315 if (spec->codec_type != VT1708 || spec->autocfg.hp_pins[0] == 0)
311 return; 316 return;
312 snd_hda_codec_write(spec->codec, 0x1, 0, 0xf81, 317 if (spec->hp_work_active) {
313 !spec->vt1708_jack_detect); 318 snd_hda_codec_write(spec->codec, 0x1, 0, 0xf81, 1);
314 if (!delayed_work_pending(&spec->vt1708_hp_work)) 319 cancel_delayed_work_sync(&spec->vt1708_hp_work);
315 schedule_delayed_work(&spec->vt1708_hp_work, 320 spec->hp_work_active = 0;
316 msecs_to_jiffies(100)); 321 }
317} 322}
318 323
319static void vt1708_stop_hp_work(struct via_spec *spec) 324static void vt1708_update_hp_work(struct via_spec *spec)
320{ 325{
321 if (spec->codec_type != VT1708 || spec->autocfg.hp_pins[0] == 0) 326 if (spec->codec_type != VT1708 || spec->autocfg.hp_pins[0] == 0)
322 return; 327 return;
323 if (snd_hda_get_bool_hint(spec->codec, "analog_loopback_hp_detect") == 1 328 if (spec->vt1708_jack_detect &&
324 && !is_aa_path_mute(spec->codec)) 329 (spec->active_streams || hp_detect_with_aa(spec->codec))) {
325 return; 330 if (!spec->hp_work_active) {
326 snd_hda_codec_write(spec->codec, 0x1, 0, 0xf81, 331 snd_hda_codec_write(spec->codec, 0x1, 0, 0xf81, 0);
327 !spec->vt1708_jack_detect); 332 schedule_delayed_work(&spec->vt1708_hp_work,
328 cancel_delayed_work_sync(&spec->vt1708_hp_work); 333 msecs_to_jiffies(100));
334 spec->hp_work_active = 1;
335 }
336 } else if (!hp_detect_with_aa(spec->codec))
337 vt1708_stop_hp_work(spec);
329} 338}
330 339
331static void set_widgets_power_state(struct hda_codec *codec) 340static void set_widgets_power_state(struct hda_codec *codec)
@@ -343,12 +352,7 @@ static int analog_input_switch_put(struct snd_kcontrol *kcontrol,
343 352
344 set_widgets_power_state(codec); 353 set_widgets_power_state(codec);
345 analog_low_current_mode(snd_kcontrol_chip(kcontrol)); 354 analog_low_current_mode(snd_kcontrol_chip(kcontrol));
346 if (snd_hda_get_bool_hint(codec, "analog_loopback_hp_detect") == 1) { 355 vt1708_update_hp_work(codec->spec);
347 if (is_aa_path_mute(codec))
348 vt1708_start_hp_work(codec->spec);
349 else
350 vt1708_stop_hp_work(codec->spec);
351 }
352 return change; 356 return change;
353} 357}
354 358
@@ -1154,7 +1158,7 @@ static int via_playback_multi_pcm_prepare(struct hda_pcm_stream *hinfo,
1154 spec->cur_dac_stream_tag = stream_tag; 1158 spec->cur_dac_stream_tag = stream_tag;
1155 spec->cur_dac_format = format; 1159 spec->cur_dac_format = format;
1156 mutex_unlock(&spec->config_mutex); 1160 mutex_unlock(&spec->config_mutex);
1157 vt1708_start_hp_work(spec); 1161 vt1708_update_hp_work(spec);
1158 return 0; 1162 return 0;
1159} 1163}
1160 1164
@@ -1174,7 +1178,7 @@ static int via_playback_hp_pcm_prepare(struct hda_pcm_stream *hinfo,
1174 spec->cur_hp_stream_tag = stream_tag; 1178 spec->cur_hp_stream_tag = stream_tag;
1175 spec->cur_hp_format = format; 1179 spec->cur_hp_format = format;
1176 mutex_unlock(&spec->config_mutex); 1180 mutex_unlock(&spec->config_mutex);
1177 vt1708_start_hp_work(spec); 1181 vt1708_update_hp_work(spec);
1178 return 0; 1182 return 0;
1179} 1183}
1180 1184
@@ -1188,7 +1192,7 @@ static int via_playback_multi_pcm_cleanup(struct hda_pcm_stream *hinfo,
1188 snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); 1192 snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
1189 spec->active_streams &= ~STREAM_MULTI_OUT; 1193 spec->active_streams &= ~STREAM_MULTI_OUT;
1190 mutex_unlock(&spec->config_mutex); 1194 mutex_unlock(&spec->config_mutex);
1191 vt1708_stop_hp_work(spec); 1195 vt1708_update_hp_work(spec);
1192 return 0; 1196 return 0;
1193} 1197}
1194 1198
@@ -1203,7 +1207,7 @@ static int via_playback_hp_pcm_cleanup(struct hda_pcm_stream *hinfo,
1203 snd_hda_codec_setup_stream(codec, spec->hp_dac_nid, 0, 0, 0); 1207 snd_hda_codec_setup_stream(codec, spec->hp_dac_nid, 0, 0, 0);
1204 spec->active_streams &= ~STREAM_INDEP_HP; 1208 spec->active_streams &= ~STREAM_INDEP_HP;
1205 mutex_unlock(&spec->config_mutex); 1209 mutex_unlock(&spec->config_mutex);
1206 vt1708_stop_hp_work(spec); 1210 vt1708_update_hp_work(spec);
1207 return 0; 1211 return 0;
1208} 1212}
1209 1213
@@ -1645,7 +1649,8 @@ static void via_hp_automute(struct hda_codec *codec)
1645 int nums; 1649 int nums;
1646 struct via_spec *spec = codec->spec; 1650 struct via_spec *spec = codec->spec;
1647 1651
1648 if (!spec->hp_independent_mode && spec->autocfg.hp_pins[0]) 1652 if (!spec->hp_independent_mode && spec->autocfg.hp_pins[0] &&
1653 (spec->codec_type != VT1708 || spec->vt1708_jack_detect))
1649 present = snd_hda_jack_detect(codec, spec->autocfg.hp_pins[0]); 1654 present = snd_hda_jack_detect(codec, spec->autocfg.hp_pins[0]);
1650 1655
1651 if (spec->smart51_enabled) 1656 if (spec->smart51_enabled)
@@ -2612,8 +2617,6 @@ static int vt1708_jack_detect_get(struct snd_kcontrol *kcontrol,
2612 2617
2613 if (spec->codec_type != VT1708) 2618 if (spec->codec_type != VT1708)
2614 return 0; 2619 return 0;
2615 spec->vt1708_jack_detect =
2616 !((snd_hda_codec_read(codec, 0x1, 0, 0xf84, 0) >> 8) & 0x1);
2617 ucontrol->value.integer.value[0] = spec->vt1708_jack_detect; 2620 ucontrol->value.integer.value[0] = spec->vt1708_jack_detect;
2618 return 0; 2621 return 0;
2619} 2622}
@@ -2623,18 +2626,22 @@ static int vt1708_jack_detect_put(struct snd_kcontrol *kcontrol,
2623{ 2626{
2624 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 2627 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2625 struct via_spec *spec = codec->spec; 2628 struct via_spec *spec = codec->spec;
2626 int change; 2629 int val;
2627 2630
2628 if (spec->codec_type != VT1708) 2631 if (spec->codec_type != VT1708)
2629 return 0; 2632 return 0;
2630 spec->vt1708_jack_detect = ucontrol->value.integer.value[0]; 2633 val = !!ucontrol->value.integer.value[0];
2631 change = (0x1 & (snd_hda_codec_read(codec, 0x1, 0, 0xf84, 0) >> 8)) 2634 if (spec->vt1708_jack_detect == val)
2632 == !spec->vt1708_jack_detect; 2635 return 0;
2633 if (spec->vt1708_jack_detect) { 2636 spec->vt1708_jack_detect = val;
2637 if (spec->vt1708_jack_detect &&
2638 snd_hda_get_bool_hint(codec, "analog_loopback_hp_detect") != 1) {
2634 mute_aa_path(codec, 1); 2639 mute_aa_path(codec, 1);
2635 notify_aa_path_ctls(codec); 2640 notify_aa_path_ctls(codec);
2636 } 2641 }
2637 return change; 2642 via_hp_automute(codec);
2643 vt1708_update_hp_work(spec);
2644 return 1;
2638} 2645}
2639 2646
2640static const struct snd_kcontrol_new vt1708_jack_detect_ctl = { 2647static const struct snd_kcontrol_new vt1708_jack_detect_ctl = {
@@ -2771,6 +2778,7 @@ static int via_init(struct hda_codec *codec)
2771 via_auto_init_unsol_event(codec); 2778 via_auto_init_unsol_event(codec);
2772 2779
2773 via_hp_automute(codec); 2780 via_hp_automute(codec);
2781 vt1708_update_hp_work(spec);
2774 2782
2775 return 0; 2783 return 0;
2776} 2784}
@@ -2787,7 +2795,9 @@ static void vt1708_update_hp_jack_state(struct work_struct *work)
2787 spec->vt1708_hp_present ^= 1; 2795 spec->vt1708_hp_present ^= 1;
2788 via_hp_automute(spec->codec); 2796 via_hp_automute(spec->codec);
2789 } 2797 }
2790 vt1708_start_hp_work(spec); 2798 if (spec->vt1708_jack_detect)
2799 schedule_delayed_work(&spec->vt1708_hp_work,
2800 msecs_to_jiffies(100));
2791} 2801}
2792 2802
2793static int get_mux_nids(struct hda_codec *codec) 2803static int get_mux_nids(struct hda_codec *codec)
diff --git a/sound/pci/ice1712/amp.c b/sound/pci/ice1712/amp.c
index e328cfb7620c..e525da2673be 100644
--- a/sound/pci/ice1712/amp.c
+++ b/sound/pci/ice1712/amp.c
@@ -68,8 +68,11 @@ static int __devinit snd_vt1724_amp_init(struct snd_ice1712 *ice)
68 68
69static int __devinit snd_vt1724_amp_add_controls(struct snd_ice1712 *ice) 69static int __devinit snd_vt1724_amp_add_controls(struct snd_ice1712 *ice)
70{ 70{
71 /* we use pins 39 and 41 of the VT1616 for left and right read outputs */ 71 if (ice->ac97)
72 snd_ac97_write_cache(ice->ac97, 0x5a, snd_ac97_read(ice->ac97, 0x5a) & ~0x8000); 72 /* we use pins 39 and 41 of the VT1616 for left and right
73 read outputs */
74 snd_ac97_write_cache(ice->ac97, 0x5a,
75 snd_ac97_read(ice->ac97, 0x5a) & ~0x8000);
73 return 0; 76 return 0;
74} 77}
75 78
diff --git a/sound/pci/ice1712/envy24ht.h b/sound/pci/ice1712/envy24ht.h
index a0c5e009bb4a..4ca33a800bc8 100644
--- a/sound/pci/ice1712/envy24ht.h
+++ b/sound/pci/ice1712/envy24ht.h
@@ -66,6 +66,7 @@ enum {
66#define VT1724_CFG_CLOCK384 0x40 /* 16.9344Mhz, 44.1kHz*384 */ 66#define VT1724_CFG_CLOCK384 0x40 /* 16.9344Mhz, 44.1kHz*384 */
67#define VT1724_CFG_MPU401 0x20 /* MPU401 UARTs */ 67#define VT1724_CFG_MPU401 0x20 /* MPU401 UARTs */
68#define VT1724_CFG_ADC_MASK 0x0c /* one, two or one and S/PDIF, stereo ADCs */ 68#define VT1724_CFG_ADC_MASK 0x0c /* one, two or one and S/PDIF, stereo ADCs */
69#define VT1724_CFG_ADC_NONE 0x0c /* no ADCs */
69#define VT1724_CFG_DAC_MASK 0x03 /* one, two, three, four stereo DACs */ 70#define VT1724_CFG_DAC_MASK 0x03 /* one, two, three, four stereo DACs */
70 71
71#define VT1724_REG_AC97_CFG 0x05 /* byte */ 72#define VT1724_REG_AC97_CFG 0x05 /* byte */
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
index 44446f2222d9..132a86e09d07 100644
--- a/sound/pci/ice1712/ice1712.c
+++ b/sound/pci/ice1712/ice1712.c
@@ -84,9 +84,9 @@ MODULE_SUPPORTED_DEVICE("{"
84 84
85static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 85static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
86static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 86static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
87static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */ 87static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */
88static char *model[SNDRV_CARDS]; 88static char *model[SNDRV_CARDS];
89static int omni[SNDRV_CARDS]; /* Delta44 & 66 Omni I/O support */ 89static bool omni[SNDRV_CARDS]; /* Delta44 & 66 Omni I/O support */
90static int cs8427_timeout[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = 500}; /* CS8427 S/PDIF transceiver reset timeout value in msec */ 90static int cs8427_timeout[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = 500}; /* CS8427 S/PDIF transceiver reset timeout value in msec */
91static int dxr_enable[SNDRV_CARDS]; /* DXR enable for DMX6FIRE */ 91static int dxr_enable[SNDRV_CARDS]; /* DXR enable for DMX6FIRE */
92 92
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c
index 4353e76bf0a6..92362973764d 100644
--- a/sound/pci/ice1712/ice1724.c
+++ b/sound/pci/ice1712/ice1724.c
@@ -80,7 +80,7 @@ MODULE_SUPPORTED_DEVICE("{"
80 80
81static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 81static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
82static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 82static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
83static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 83static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
84static char *model[SNDRV_CARDS]; 84static char *model[SNDRV_CARDS];
85 85
86module_param_array(index, int, NULL, 0444); 86module_param_array(index, int, NULL, 0444);
@@ -1117,14 +1117,21 @@ static struct snd_pcm_ops snd_vt1724_capture_pro_ops = {
1117static int __devinit snd_vt1724_pcm_profi(struct snd_ice1712 *ice, int device) 1117static int __devinit snd_vt1724_pcm_profi(struct snd_ice1712 *ice, int device)
1118{ 1118{
1119 struct snd_pcm *pcm; 1119 struct snd_pcm *pcm;
1120 int err; 1120 int capt, err;
1121 1121
1122 err = snd_pcm_new(ice->card, "ICE1724", device, 1, 1, &pcm); 1122 if ((ice->eeprom.data[ICE_EEP2_SYSCONF] & VT1724_CFG_ADC_MASK) ==
1123 VT1724_CFG_ADC_NONE)
1124 capt = 0;
1125 else
1126 capt = 1;
1127 err = snd_pcm_new(ice->card, "ICE1724", device, 1, capt, &pcm);
1123 if (err < 0) 1128 if (err < 0)
1124 return err; 1129 return err;
1125 1130
1126 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_vt1724_playback_pro_ops); 1131 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_vt1724_playback_pro_ops);
1127 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_vt1724_capture_pro_ops); 1132 if (capt)
1133 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
1134 &snd_vt1724_capture_pro_ops);
1128 1135
1129 pcm->private_data = ice; 1136 pcm->private_data = ice;
1130 pcm->info_flags = 0; 1137 pcm->info_flags = 0;
@@ -1825,7 +1832,12 @@ static int snd_vt1724_pro_internal_clock_info(struct snd_kcontrol *kcontrol,
1825 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 1832 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
1826 uinfo->count = 1; 1833 uinfo->count = 1;
1827 1834
1828 uinfo->value.enumerated.items = hw_rates_count + ice->ext_clock_count; 1835 /* internal clocks */
1836 uinfo->value.enumerated.items = hw_rates_count;
1837 /* external clocks */
1838 if (ice->force_rdma1 ||
1839 (ice->eeprom.data[ICE_EEP2_SPDIF] & VT1724_CFG_SPDIF_IN))
1840 uinfo->value.enumerated.items += ice->ext_clock_count;
1829 /* upper limit - keep at top */ 1841 /* upper limit - keep at top */
1830 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) 1842 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
1831 uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; 1843 uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
@@ -2173,6 +2185,40 @@ static struct snd_kcontrol_new snd_vt1724_mixer_pro_peak __devinitdata = {
2173 2185
2174static struct snd_ice1712_card_info no_matched __devinitdata; 2186static struct snd_ice1712_card_info no_matched __devinitdata;
2175 2187
2188
2189/*
2190 ooAoo cards with no controls
2191*/
2192static unsigned char ooaoo_sq210_eeprom[] __devinitdata = {
2193 [ICE_EEP2_SYSCONF] = 0x4c, /* 49MHz crystal, no mpu401, no ADC,
2194 1xDACs */
2195 [ICE_EEP2_ACLINK] = 0x80, /* I2S */
2196 [ICE_EEP2_I2S] = 0x78, /* no volume, 96k, 24bit, 192k */
2197 [ICE_EEP2_SPDIF] = 0xc1, /* out-en, out-int, out-ext */
2198 [ICE_EEP2_GPIO_DIR] = 0x00, /* no GPIOs are used */
2199 [ICE_EEP2_GPIO_DIR1] = 0x00,
2200 [ICE_EEP2_GPIO_DIR2] = 0x00,
2201 [ICE_EEP2_GPIO_MASK] = 0xff,
2202 [ICE_EEP2_GPIO_MASK1] = 0xff,
2203 [ICE_EEP2_GPIO_MASK2] = 0xff,
2204
2205 [ICE_EEP2_GPIO_STATE] = 0x00, /* inputs */
2206 [ICE_EEP2_GPIO_STATE1] = 0x00, /* all 1, but GPIO_CPLD_RW
2207 and GPIO15 always zero */
2208 [ICE_EEP2_GPIO_STATE2] = 0x00, /* inputs */
2209};
2210
2211
2212struct snd_ice1712_card_info snd_vt1724_ooaoo_cards[] __devinitdata = {
2213 {
2214 .name = "ooAoo SQ210a",
2215 .model = "sq210a",
2216 .eeprom_size = sizeof(ooaoo_sq210_eeprom),
2217 .eeprom_data = ooaoo_sq210_eeprom,
2218 },
2219 { } /* terminator */
2220};
2221
2176static struct snd_ice1712_card_info *card_tables[] __devinitdata = { 2222static struct snd_ice1712_card_info *card_tables[] __devinitdata = {
2177 snd_vt1724_revo_cards, 2223 snd_vt1724_revo_cards,
2178 snd_vt1724_amp_cards, 2224 snd_vt1724_amp_cards,
@@ -2187,6 +2233,7 @@ static struct snd_ice1712_card_info *card_tables[] __devinitdata = {
2187 snd_vt1724_wtm_cards, 2233 snd_vt1724_wtm_cards,
2188 snd_vt1724_se_cards, 2234 snd_vt1724_se_cards,
2189 snd_vt1724_qtet_cards, 2235 snd_vt1724_qtet_cards,
2236 snd_vt1724_ooaoo_cards,
2190 NULL, 2237 NULL,
2191}; 2238};
2192 2239
@@ -2270,7 +2317,7 @@ static int __devinit snd_vt1724_read_eeprom(struct snd_ice1712 *ice,
2270 } 2317 }
2271 } 2318 }
2272 for (tbl = card_tables; *tbl; tbl++) { 2319 for (tbl = card_tables; *tbl; tbl++) {
2273 for (c = *tbl; c->subvendor; c++) { 2320 for (c = *tbl; c->name; c++) {
2274 if (modelname && c->model && 2321 if (modelname && c->model &&
2275 !strcmp(modelname, c->model)) { 2322 !strcmp(modelname, c->model)) {
2276 printk(KERN_INFO "ice1724: Using board model %s\n", 2323 printk(KERN_INFO "ice1724: Using board model %s\n",
@@ -2579,8 +2626,10 @@ static int __devinit snd_vt1724_probe(struct pci_dev *pci,
2579 ice->ext_clock_count = 0; 2626 ice->ext_clock_count = 0;
2580 2627
2581 for (tbl = card_tables; *tbl; tbl++) { 2628 for (tbl = card_tables; *tbl; tbl++) {
2582 for (c = *tbl; c->subvendor; c++) { 2629 for (c = *tbl; c->name; c++) {
2583 if (c->subvendor == ice->eeprom.subvendor) { 2630 if ((model[dev] && c->model &&
2631 !strcmp(model[dev], c->model)) ||
2632 (c->subvendor == ice->eeprom.subvendor)) {
2584 strcpy(card->shortname, c->name); 2633 strcpy(card->shortname, c->name);
2585 if (c->driver) /* specific driver? */ 2634 if (c->driver) /* specific driver? */
2586 strcpy(card->driver, c->driver); 2635 strcpy(card->driver, c->driver);
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index 11718b49b2e2..40b181bab930 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -79,9 +79,9 @@ static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */
79static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ 79static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */
80static int ac97_clock; 80static int ac97_clock;
81static char *ac97_quirk; 81static char *ac97_quirk;
82static int buggy_semaphore; 82static bool buggy_semaphore;
83static int buggy_irq = -1; /* auto-check */ 83static int buggy_irq = -1; /* auto-check */
84static int xbox; 84static bool xbox;
85static int spdif_aclink = -1; 85static int spdif_aclink = -1;
86static int inside_vm = -1; 86static int inside_vm = -1;
87 87
@@ -105,7 +105,7 @@ module_param(inside_vm, bool, 0444);
105MODULE_PARM_DESC(inside_vm, "KVM/Parallels optimization."); 105MODULE_PARM_DESC(inside_vm, "KVM/Parallels optimization.");
106 106
107/* just for backward compatibility */ 107/* just for backward compatibility */
108static int enable; 108static bool enable;
109module_param(enable, bool, 0444); 109module_param(enable, bool, 0444);
110static int joystick; 110static int joystick;
111module_param(joystick, int, 0444); 111module_param(joystick, int, 0444);
diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c
index 0f7041ec7ddc..d689913a61be 100644
--- a/sound/pci/intel8x0m.c
+++ b/sound/pci/intel8x0m.c
@@ -68,7 +68,7 @@ module_param(ac97_clock, int, 0444);
68MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (0 = auto-detect)."); 68MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (0 = auto-detect).");
69 69
70/* just for backward compatibility */ 70/* just for backward compatibility */
71static int enable; 71static bool enable;
72module_param(enable, bool, 0444); 72module_param(enable, bool, 0444);
73 73
74/* 74/*
diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c
index 841864b6b371..8fea45ab5882 100644
--- a/sound/pci/korg1212/korg1212.c
+++ b/sound/pci/korg1212/korg1212.c
@@ -408,7 +408,7 @@ MODULE_FIRMWARE("korg/k1212.dsp");
408 408
409static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 409static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
410static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 410static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
411static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 411static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */
412 412
413module_param_array(index, int, NULL, 0444); 413module_param_array(index, int, NULL, 0444);
414MODULE_PARM_DESC(index, "Index value for Korg 1212 soundcard."); 414MODULE_PARM_DESC(index, "Index value for Korg 1212 soundcard.");
diff --git a/sound/pci/lola/lola.c b/sound/pci/lola/lola.c
index 924168ef1ed6..375982736858 100644
--- a/sound/pci/lola/lola.c
+++ b/sound/pci/lola/lola.c
@@ -35,7 +35,7 @@
35/* Standard options */ 35/* Standard options */
36static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 36static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
37static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 37static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
38static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 38static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
39 39
40module_param_array(index, int, NULL, 0444); 40module_param_array(index, int, NULL, 0444);
41MODULE_PARM_DESC(index, "Index value for Digigram Lola driver."); 41MODULE_PARM_DESC(index, "Index value for Digigram Lola driver.");
diff --git a/sound/pci/lx6464es/lx6464es.c b/sound/pci/lx6464es/lx6464es.c
index 04ae84b2a107..d94c0c292bd0 100644
--- a/sound/pci/lx6464es/lx6464es.c
+++ b/sound/pci/lx6464es/lx6464es.c
@@ -42,7 +42,7 @@ MODULE_SUPPORTED_DEVICE("{digigram lx6464es{}}");
42 42
43static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 43static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
44static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 44static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
45static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 45static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
46 46
47module_param_array(index, int, NULL, 0444); 47module_param_array(index, int, NULL, 0444);
48MODULE_PARM_DESC(index, "Index value for Digigram LX6464ES interface."); 48MODULE_PARM_DESC(index, "Index value for Digigram LX6464ES interface.");
diff --git a/sound/pci/lx6464es/lx_core.c b/sound/pci/lx6464es/lx_core.c
index 5c8717e29eeb..8c3e7fcefd99 100644
--- a/sound/pci/lx6464es/lx_core.c
+++ b/sound/pci/lx6464es/lx_core.c
@@ -78,10 +78,15 @@ unsigned long lx_dsp_reg_read(struct lx6464es *chip, int port)
78 return ioread32(address); 78 return ioread32(address);
79} 79}
80 80
81void lx_dsp_reg_readbuf(struct lx6464es *chip, int port, u32 *data, u32 len) 81static void lx_dsp_reg_readbuf(struct lx6464es *chip, int port, u32 *data,
82 u32 len)
82{ 83{
83 void __iomem *address = lx_dsp_register(chip, port); 84 u32 __iomem *address = lx_dsp_register(chip, port);
84 memcpy_fromio(data, address, len*sizeof(u32)); 85 int i;
86
87 /* we cannot use memcpy_fromio */
88 for (i = 0; i != len; ++i)
89 data[i] = ioread32(address + i);
85} 90}
86 91
87 92
@@ -91,11 +96,15 @@ void lx_dsp_reg_write(struct lx6464es *chip, int port, unsigned data)
91 iowrite32(data, address); 96 iowrite32(data, address);
92} 97}
93 98
94void lx_dsp_reg_writebuf(struct lx6464es *chip, int port, const u32 *data, 99static void lx_dsp_reg_writebuf(struct lx6464es *chip, int port,
95 u32 len) 100 const u32 *data, u32 len)
96{ 101{
97 void __iomem *address = lx_dsp_register(chip, port); 102 u32 __iomem *address = lx_dsp_register(chip, port);
98 memcpy_toio(address, data, len*sizeof(u32)); 103 int i;
104
105 /* we cannot use memcpy_to */
106 for (i = 0; i != len; ++i)
107 iowrite32(data[i], address + i);
99} 108}
100 109
101 110
diff --git a/sound/pci/lx6464es/lx_core.h b/sound/pci/lx6464es/lx_core.h
index 1dd562980b6c..4d7ff797a646 100644
--- a/sound/pci/lx6464es/lx_core.h
+++ b/sound/pci/lx6464es/lx_core.h
@@ -72,10 +72,7 @@ enum {
72}; 72};
73 73
74unsigned long lx_dsp_reg_read(struct lx6464es *chip, int port); 74unsigned long lx_dsp_reg_read(struct lx6464es *chip, int port);
75void lx_dsp_reg_readbuf(struct lx6464es *chip, int port, u32 *data, u32 len);
76void lx_dsp_reg_write(struct lx6464es *chip, int port, unsigned data); 75void lx_dsp_reg_write(struct lx6464es *chip, int port, unsigned data);
77void lx_dsp_reg_writebuf(struct lx6464es *chip, int port, const u32 *data,
78 u32 len);
79 76
80/* plx register access */ 77/* plx register access */
81enum { 78enum {
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c
index 863c8bdaecd6..78229b0dad2b 100644
--- a/sound/pci/maestro3.c
+++ b/sound/pci/maestro3.c
@@ -64,8 +64,8 @@ MODULE_FIRMWARE("ess/maestro3_assp_minisrc.fw");
64 64
65static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 65static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
66static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 66static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
67static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* all enabled */ 67static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* all enabled */
68static int external_amp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 68static bool external_amp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
69static int amp_gpio[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -1}; 69static int amp_gpio[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -1};
70 70
71module_param_array(index, int, NULL, 0444); 71module_param_array(index, int, NULL, 0444);
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c
index a0bd1d99793f..487837c01c9f 100644
--- a/sound/pci/mixart/mixart.c
+++ b/sound/pci/mixart/mixart.c
@@ -49,7 +49,7 @@ MODULE_SUPPORTED_DEVICE("{{Digigram," CARD_NAME "}}");
49 49
50static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 50static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
51static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 51static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
52static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 52static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
53 53
54module_param_array(index, int, NULL, 0444); 54module_param_array(index, int, NULL, 0444);
55MODULE_PARM_DESC(index, "Index value for Digigram " CARD_NAME " soundcard."); 55MODULE_PARM_DESC(index, "Index value for Digigram " CARD_NAME " soundcard.");
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c
index c6c45d979f7a..ade2c64bd606 100644
--- a/sound/pci/nm256/nm256.c
+++ b/sound/pci/nm256/nm256.c
@@ -57,12 +57,12 @@ static int index = SNDRV_DEFAULT_IDX1; /* Index */
57static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ 57static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */
58static int playback_bufsize = 16; 58static int playback_bufsize = 16;
59static int capture_bufsize = 16; 59static int capture_bufsize = 16;
60static int force_ac97; /* disabled as default */ 60static bool force_ac97; /* disabled as default */
61static int buffer_top; /* not specified */ 61static int buffer_top; /* not specified */
62static int use_cache; /* disabled */ 62static bool use_cache; /* disabled */
63static int vaio_hack; /* disabled */ 63static bool vaio_hack; /* disabled */
64static int reset_workaround; 64static bool reset_workaround;
65static int reset_workaround_2; 65static bool reset_workaround_2;
66 66
67module_param(index, int, 0444); 67module_param(index, int, 0444);
68MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard."); 68MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard.");
@@ -86,7 +86,7 @@ module_param(reset_workaround_2, bool, 0444);
86MODULE_PARM_DESC(reset_workaround_2, "Enable extended AC97 RESET workaround for some other laptops."); 86MODULE_PARM_DESC(reset_workaround_2, "Enable extended AC97 RESET workaround for some other laptops.");
87 87
88/* just for backward compatibility */ 88/* just for backward compatibility */
89static int enable; 89static bool enable;
90module_param(enable, bool, 0444); 90module_param(enable, bool, 0444);
91 91
92 92
diff --git a/sound/pci/oxygen/oxygen.c b/sound/pci/oxygen/oxygen.c
index 5f3a13d4369d..eab663eef117 100644
--- a/sound/pci/oxygen/oxygen.c
+++ b/sound/pci/oxygen/oxygen.c
@@ -74,7 +74,7 @@ MODULE_SUPPORTED_DEVICE("{{C-Media,CMI8786}"
74 74
75static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 75static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
76static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 76static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
77static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 77static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
78 78
79module_param_array(index, int, NULL, 0444); 79module_param_array(index, int, NULL, 0444);
80MODULE_PARM_DESC(index, "card index"); 80MODULE_PARM_DESC(index, "card index");
diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c
index 4149a0cb8b73..3fdee4950174 100644
--- a/sound/pci/oxygen/virtuoso.c
+++ b/sound/pci/oxygen/virtuoso.c
@@ -32,7 +32,7 @@ MODULE_SUPPORTED_DEVICE("{{Asus,AV66},{Asus,AV100},{Asus,AV200}}");
32 32
33static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 33static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
34static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 34static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
35static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 35static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
36 36
37module_param_array(index, int, NULL, 0444); 37module_param_array(index, int, NULL, 0444);
38MODULE_PARM_DESC(index, "card index"); 38MODULE_PARM_DESC(index, "card index");
diff --git a/sound/pci/oxygen/xonar_cs43xx.c b/sound/pci/oxygen/xonar_cs43xx.c
index 252719101c42..c8febf4b9bd6 100644
--- a/sound/pci/oxygen/xonar_cs43xx.c
+++ b/sound/pci/oxygen/xonar_cs43xx.c
@@ -418,6 +418,7 @@ static const struct oxygen_model model_xonar_d1 = {
418 .device_config = PLAYBACK_0_TO_I2S | 418 .device_config = PLAYBACK_0_TO_I2S |
419 PLAYBACK_1_TO_SPDIF | 419 PLAYBACK_1_TO_SPDIF |
420 CAPTURE_0_FROM_I2S_2 | 420 CAPTURE_0_FROM_I2S_2 |
421 CAPTURE_1_FROM_SPDIF |
421 AC97_FMIC_SWITCH, 422 AC97_FMIC_SWITCH,
422 .dac_channels_pcm = 8, 423 .dac_channels_pcm = 8,
423 .dac_channels_mixer = 8, 424 .dac_channels_mixer = 8,
diff --git a/sound/pci/oxygen/xonar_dg.c b/sound/pci/oxygen/xonar_dg.c
index bc6eb58be380..793bdf03d7e0 100644
--- a/sound/pci/oxygen/xonar_dg.c
+++ b/sound/pci/oxygen/xonar_dg.c
@@ -597,7 +597,8 @@ struct oxygen_model model_xonar_dg = {
597 .model_data_size = sizeof(struct dg), 597 .model_data_size = sizeof(struct dg),
598 .device_config = PLAYBACK_0_TO_I2S | 598 .device_config = PLAYBACK_0_TO_I2S |
599 PLAYBACK_1_TO_SPDIF | 599 PLAYBACK_1_TO_SPDIF |
600 CAPTURE_0_FROM_I2S_2, 600 CAPTURE_0_FROM_I2S_2 |
601 CAPTURE_1_FROM_SPDIF,
601 .dac_channels_pcm = 6, 602 .dac_channels_pcm = 6,
602 .dac_channels_mixer = 0, 603 .dac_channels_mixer = 0,
603 .function_flags = OXYGEN_FUNCTION_SPI, 604 .function_flags = OXYGEN_FUNCTION_SPI,
diff --git a/sound/pci/oxygen/xonar_wm87x6.c b/sound/pci/oxygen/xonar_wm87x6.c
index 42d1ab136217..478303e6c2b0 100644
--- a/sound/pci/oxygen/xonar_wm87x6.c
+++ b/sound/pci/oxygen/xonar_wm87x6.c
@@ -1274,7 +1274,8 @@ static const struct oxygen_model model_xonar_ds = {
1274 .model_data_size = sizeof(struct xonar_wm87x6), 1274 .model_data_size = sizeof(struct xonar_wm87x6),
1275 .device_config = PLAYBACK_0_TO_I2S | 1275 .device_config = PLAYBACK_0_TO_I2S |
1276 PLAYBACK_1_TO_SPDIF | 1276 PLAYBACK_1_TO_SPDIF |
1277 CAPTURE_0_FROM_I2S_1, 1277 CAPTURE_0_FROM_I2S_1 |
1278 CAPTURE_1_FROM_SPDIF,
1278 .dac_channels_pcm = 8, 1279 .dac_channels_pcm = 8,
1279 .dac_channels_mixer = 8, 1280 .dac_channels_mixer = 8,
1280 .dac_volume_min = 255 - 2*60, 1281 .dac_volume_min = 255 - 2*60,
@@ -1306,7 +1307,8 @@ static const struct oxygen_model model_xonar_hdav_slim = {
1306 .model_data_size = sizeof(struct xonar_wm87x6), 1307 .model_data_size = sizeof(struct xonar_wm87x6),
1307 .device_config = PLAYBACK_0_TO_I2S | 1308 .device_config = PLAYBACK_0_TO_I2S |
1308 PLAYBACK_1_TO_SPDIF | 1309 PLAYBACK_1_TO_SPDIF |
1309 CAPTURE_0_FROM_I2S_1, 1310 CAPTURE_0_FROM_I2S_1 |
1311 CAPTURE_1_FROM_SPDIF,
1310 .dac_channels_pcm = 8, 1312 .dac_channels_pcm = 8,
1311 .dac_channels_mixer = 2, 1313 .dac_channels_mixer = 2,
1312 .dac_volume_min = 255 - 2*60, 1314 .dac_volume_min = 255 - 2*60,
diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c
index 56a52659742d..fd1809ab73b4 100644
--- a/sound/pci/pcxhr/pcxhr.c
+++ b/sound/pci/pcxhr/pcxhr.c
@@ -52,8 +52,8 @@ MODULE_SUPPORTED_DEVICE("{{Digigram," DRIVER_NAME "}}");
52 52
53static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 53static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
54static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 54static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
55static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */ 55static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */
56static int mono[SNDRV_CARDS]; /* capture mono only */ 56static bool mono[SNDRV_CARDS]; /* capture mono only */
57 57
58module_param_array(index, int, NULL, 0444); 58module_param_array(index, int, NULL, 0444);
59MODULE_PARM_DESC(index, "Index value for Digigram " DRIVER_NAME " soundcard"); 59MODULE_PARM_DESC(index, "Index value for Digigram " DRIVER_NAME " soundcard");
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
index dcbedd33a629..0481d94aac9b 100644
--- a/sound/pci/riptide/riptide.c
+++ b/sound/pci/riptide/riptide.c
@@ -122,7 +122,7 @@ MODULE_FIRMWARE("riptide.hex");
122 122
123static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 123static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
124static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 124static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
125static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; 125static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE;
126 126
127#ifdef SUPPORT_JOYSTICK 127#ifdef SUPPORT_JOYSTICK
128static int joystick_port[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS - 1)] = 0x200 }; 128static int joystick_port[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS - 1)] = 0x200 };
diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c
index 21bcb47fab50..b4819d5e41db 100644
--- a/sound/pci/rme32.c
+++ b/sound/pci/rme32.c
@@ -89,8 +89,8 @@
89 89
90static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 90static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
91static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 91static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
92static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 92static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
93static int fullduplex[SNDRV_CARDS]; // = {[0 ... (SNDRV_CARDS - 1)] = 1}; 93static bool fullduplex[SNDRV_CARDS]; // = {[0 ... (SNDRV_CARDS - 1)] = 1};
94 94
95module_param_array(index, int, NULL, 0444); 95module_param_array(index, int, NULL, 0444);
96MODULE_PARM_DESC(index, "Index value for RME Digi32 soundcard."); 96MODULE_PARM_DESC(index, "Index value for RME Digi32 soundcard.");
diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c
index 4585c9729fea..ba894158e76c 100644
--- a/sound/pci/rme96.c
+++ b/sound/pci/rme96.c
@@ -53,7 +53,7 @@ MODULE_SUPPORTED_DEVICE("{{RME,Digi96},"
53 53
54static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 54static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
55static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 55static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
56static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 56static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
57 57
58module_param_array(index, int, NULL, 0444); 58module_param_array(index, int, NULL, 0444);
59MODULE_PARM_DESC(index, "Index value for RME Digi96 soundcard."); 59MODULE_PARM_DESC(index, "Index value for RME Digi96 soundcard.");
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c
index f2a3758dac52..b68cdec03b9e 100644
--- a/sound/pci/rme9652/hdsp.c
+++ b/sound/pci/rme9652/hdsp.c
@@ -45,7 +45,7 @@
45 45
46static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 46static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
47static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 47static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
48static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 48static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
49 49
50module_param_array(index, int, NULL, 0444); 50module_param_array(index, int, NULL, 0444);
51MODULE_PARM_DESC(index, "Index value for RME Hammerfall DSP interface."); 51MODULE_PARM_DESC(index, "Index value for RME Hammerfall DSP interface.");
@@ -2640,8 +2640,7 @@ static int snd_hdsp_info_pref_sync_ref(struct snd_kcontrol *kcontrol, struct snd
2640 uinfo->value.enumerated.items = 3; 2640 uinfo->value.enumerated.items = 3;
2641 break; 2641 break;
2642 default: 2642 default:
2643 uinfo->value.enumerated.items = 0; 2643 return -EINVAL;
2644 break;
2645 } 2644 }
2646 2645
2647 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) 2646 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index e760adad9523..cc9f6c83d661 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -61,7 +61,7 @@
61 61
62static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 62static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
63static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 63static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
64static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */ 64static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */
65 65
66module_param_array(index, int, NULL, 0444); 66module_param_array(index, int, NULL, 0444);
67MODULE_PARM_DESC(index, "Index value for RME HDSPM interface."); 67MODULE_PARM_DESC(index, "Index value for RME HDSPM interface.");
@@ -941,6 +941,8 @@ struct hdspm {
941 941
942 cycles_t last_interrupt; 942 cycles_t last_interrupt;
943 943
944 unsigned int serial;
945
944 struct hdspm_peak_rms peak_rms; 946 struct hdspm_peak_rms peak_rms;
945}; 947};
946 948
@@ -4694,7 +4696,7 @@ snd_hdspm_proc_read_madi(struct snd_info_entry * entry,
4694 4696
4695 snd_iprintf(buffer, "HW Serial: 0x%06x%06x\n", 4697 snd_iprintf(buffer, "HW Serial: 0x%06x%06x\n",
4696 (hdspm_read(hdspm, HDSPM_midiStatusIn1)>>8) & 0xFFFFFF, 4698 (hdspm_read(hdspm, HDSPM_midiStatusIn1)>>8) & 0xFFFFFF,
4697 (hdspm_read(hdspm, HDSPM_midiStatusIn0)>>8) & 0xFFFFFF); 4699 hdspm->serial);
4698 4700
4699 snd_iprintf(buffer, "IRQ: %d Registers bus: 0x%lx VM: 0x%lx\n", 4701 snd_iprintf(buffer, "IRQ: %d Registers bus: 0x%lx VM: 0x%lx\n",
4700 hdspm->irq, hdspm->port, (unsigned long)hdspm->iobase); 4702 hdspm->irq, hdspm->port, (unsigned long)hdspm->iobase);
@@ -6266,8 +6268,7 @@ static int snd_hdspm_hwdep_ioctl(struct snd_hwdep *hw, struct file *file,
6266 hdspm_version.card_type = hdspm->io_type; 6268 hdspm_version.card_type = hdspm->io_type;
6267 strncpy(hdspm_version.cardname, hdspm->card_name, 6269 strncpy(hdspm_version.cardname, hdspm->card_name,
6268 sizeof(hdspm_version.cardname)); 6270 sizeof(hdspm_version.cardname));
6269 hdspm_version.serial = (hdspm_read(hdspm, 6271 hdspm_version.serial = hdspm->serial;
6270 HDSPM_midiStatusIn0)>>8) & 0xFFFFFF;
6271 hdspm_version.firmware_rev = hdspm->firmware_rev; 6272 hdspm_version.firmware_rev = hdspm->firmware_rev;
6272 hdspm_version.addons = 0; 6273 hdspm_version.addons = 0;
6273 if (hdspm->tco) 6274 if (hdspm->tco)
@@ -6518,7 +6519,7 @@ static int __devinit snd_hdspm_create(struct snd_card *card,
6518 hdspm->io_type = AES32; 6519 hdspm->io_type = AES32;
6519 hdspm->card_name = "RME AES32"; 6520 hdspm->card_name = "RME AES32";
6520 hdspm->midiPorts = 2; 6521 hdspm->midiPorts = 2;
6521 } else if ((hdspm->firmware_rev == 0xd5) || 6522 } else if ((hdspm->firmware_rev == 0xd2) ||
6522 ((hdspm->firmware_rev >= 0xc8) && 6523 ((hdspm->firmware_rev >= 0xc8) &&
6523 (hdspm->firmware_rev <= 0xcf))) { 6524 (hdspm->firmware_rev <= 0xcf))) {
6524 hdspm->io_type = MADI; 6525 hdspm->io_type = MADI;
@@ -6782,6 +6783,25 @@ static int __devinit snd_hdspm_create(struct snd_card *card,
6782 tasklet_init(&hdspm->midi_tasklet, 6783 tasklet_init(&hdspm->midi_tasklet,
6783 hdspm_midi_tasklet, (unsigned long) hdspm); 6784 hdspm_midi_tasklet, (unsigned long) hdspm);
6784 6785
6786
6787 if (hdspm->io_type != MADIface) {
6788 hdspm->serial = (hdspm_read(hdspm,
6789 HDSPM_midiStatusIn0)>>8) & 0xFFFFFF;
6790 /* id contains either a user-provided value or the default
6791 * NULL. If it's the default, we're safe to
6792 * fill card->id with the serial number.
6793 *
6794 * If the serial number is 0xFFFFFF, then we're dealing with
6795 * an old PCI revision that comes without a sane number. In
6796 * this case, we don't set card->id to avoid collisions
6797 * when running with multiple cards.
6798 */
6799 if (NULL == id[hdspm->dev] && hdspm->serial != 0xFFFFFF) {
6800 sprintf(card->id, "HDSPMx%06x", hdspm->serial);
6801 snd_card_set_id(card, card->id);
6802 }
6803 }
6804
6785 snd_printdd("create alsa devices.\n"); 6805 snd_printdd("create alsa devices.\n");
6786 err = snd_hdspm_create_alsa_devices(card, hdspm); 6806 err = snd_hdspm_create_alsa_devices(card, hdspm);
6787 if (err < 0) 6807 if (err < 0)
@@ -6868,10 +6888,10 @@ static int __devinit snd_hdspm_probe(struct pci_dev *pci,
6868 if (hdspm->io_type != MADIface) { 6888 if (hdspm->io_type != MADIface) {
6869 sprintf(card->shortname, "%s_%x", 6889 sprintf(card->shortname, "%s_%x",
6870 hdspm->card_name, 6890 hdspm->card_name,
6871 (hdspm_read(hdspm, HDSPM_midiStatusIn0)>>8) & 0xFFFFFF); 6891 hdspm->serial);
6872 sprintf(card->longname, "%s S/N 0x%x at 0x%lx, irq %d", 6892 sprintf(card->longname, "%s S/N 0x%x at 0x%lx, irq %d",
6873 hdspm->card_name, 6893 hdspm->card_name,
6874 (hdspm_read(hdspm, HDSPM_midiStatusIn0)>>8) & 0xFFFFFF, 6894 hdspm->serial,
6875 hdspm->port, hdspm->irq); 6895 hdspm->port, hdspm->irq);
6876 } else { 6896 } else {
6877 sprintf(card->shortname, "%s", hdspm->card_name); 6897 sprintf(card->shortname, "%s", hdspm->card_name);
diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c
index 732c5e837437..b737d1619cc7 100644
--- a/sound/pci/rme9652/rme9652.c
+++ b/sound/pci/rme9652/rme9652.c
@@ -38,8 +38,8 @@
38 38
39static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 39static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
40static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 40static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
41static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 41static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
42static int precise_ptr[SNDRV_CARDS]; /* Enable precise pointer */ 42static bool precise_ptr[SNDRV_CARDS]; /* Enable precise pointer */
43 43
44module_param_array(index, int, NULL, 0444); 44module_param_array(index, int, NULL, 0444);
45MODULE_PARM_DESC(index, "Index value for RME Digi9652 (Hammerfall) soundcard."); 45MODULE_PARM_DESC(index, "Index value for RME Digi9652 (Hammerfall) soundcard.");
diff --git a/sound/pci/sis7019.c b/sound/pci/sis7019.c
index a391e622a192..ff500a87f769 100644
--- a/sound/pci/sis7019.c
+++ b/sound/pci/sis7019.c
@@ -40,7 +40,8 @@ MODULE_SUPPORTED_DEVICE("{{SiS,SiS7019 Audio Accelerator}}");
40 40
41static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ 41static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */
42static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ 42static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */
43static int enable = 1; 43static bool enable = 1;
44static int codecs = 1;
44 45
45module_param(index, int, 0444); 46module_param(index, int, 0444);
46MODULE_PARM_DESC(index, "Index value for SiS7019 Audio Accelerator."); 47MODULE_PARM_DESC(index, "Index value for SiS7019 Audio Accelerator.");
@@ -48,6 +49,8 @@ module_param(id, charp, 0444);
48MODULE_PARM_DESC(id, "ID string for SiS7019 Audio Accelerator."); 49MODULE_PARM_DESC(id, "ID string for SiS7019 Audio Accelerator.");
49module_param(enable, bool, 0444); 50module_param(enable, bool, 0444);
50MODULE_PARM_DESC(enable, "Enable SiS7019 Audio Accelerator."); 51MODULE_PARM_DESC(enable, "Enable SiS7019 Audio Accelerator.");
52module_param(codecs, int, 0444);
53MODULE_PARM_DESC(codecs, "Set bit to indicate that codec number is expected to be present (default 1)");
51 54
52static DEFINE_PCI_DEVICE_TABLE(snd_sis7019_ids) = { 55static DEFINE_PCI_DEVICE_TABLE(snd_sis7019_ids) = {
53 { PCI_DEVICE(PCI_VENDOR_ID_SI, 0x7019) }, 56 { PCI_DEVICE(PCI_VENDOR_ID_SI, 0x7019) },
@@ -140,6 +143,9 @@ struct sis7019 {
140 dma_addr_t silence_dma_addr; 143 dma_addr_t silence_dma_addr;
141}; 144};
142 145
146/* These values are also used by the module param 'codecs' to indicate
147 * which codecs should be present.
148 */
143#define SIS_PRIMARY_CODEC_PRESENT 0x0001 149#define SIS_PRIMARY_CODEC_PRESENT 0x0001
144#define SIS_SECONDARY_CODEC_PRESENT 0x0002 150#define SIS_SECONDARY_CODEC_PRESENT 0x0002
145#define SIS_TERTIARY_CODEC_PRESENT 0x0004 151#define SIS_TERTIARY_CODEC_PRESENT 0x0004
@@ -977,7 +983,7 @@ timeout:
977 mutex_unlock(&sis->ac97_mutex); 983 mutex_unlock(&sis->ac97_mutex);
978 984
979 if (!count) { 985 if (!count) {
980 printk(KERN_ERR "sis7019: ac97 codec %d timeout cmd 0x%08x\n", 986 dev_err(&sis->pci->dev, "ac97 codec %d timeout cmd 0x%08x\n",
981 codec, cmd); 987 codec, cmd);
982 } 988 }
983 989
@@ -1078,6 +1084,7 @@ static int sis_chip_init(struct sis7019 *sis)
1078{ 1084{
1079 unsigned long io = sis->ioport; 1085 unsigned long io = sis->ioport;
1080 void __iomem *ioaddr = sis->ioaddr; 1086 void __iomem *ioaddr = sis->ioaddr;
1087 unsigned long timeout;
1081 u16 status; 1088 u16 status;
1082 int count; 1089 int count;
1083 int i; 1090 int i;
@@ -1104,21 +1111,45 @@ static int sis_chip_init(struct sis7019 *sis)
1104 while ((inw(io + SIS_AC97_STATUS) & SIS_AC97_STATUS_BUSY) && --count) 1111 while ((inw(io + SIS_AC97_STATUS) & SIS_AC97_STATUS_BUSY) && --count)
1105 udelay(1); 1112 udelay(1);
1106 1113
1114 /* Command complete, we can let go of the semaphore now.
1115 */
1116 outl(SIS_AC97_SEMA_RELEASE, io + SIS_AC97_SEMA);
1117 if (!count)
1118 return -EIO;
1119
1107 /* Now that we've finished the reset, find out what's attached. 1120 /* Now that we've finished the reset, find out what's attached.
1121 * There are some codec/board combinations that take an extremely
1122 * long time to come up. 350+ ms has been observed in the field,
1123 * so we'll give them up to 500ms.
1108 */ 1124 */
1109 status = inl(io + SIS_AC97_STATUS); 1125 sis->codecs_present = 0;
1110 if (status & SIS_AC97_STATUS_CODEC_READY) 1126 timeout = msecs_to_jiffies(500) + jiffies;
1111 sis->codecs_present |= SIS_PRIMARY_CODEC_PRESENT; 1127 while (time_before_eq(jiffies, timeout)) {
1112 if (status & SIS_AC97_STATUS_CODEC2_READY) 1128 status = inl(io + SIS_AC97_STATUS);
1113 sis->codecs_present |= SIS_SECONDARY_CODEC_PRESENT; 1129 if (status & SIS_AC97_STATUS_CODEC_READY)
1114 if (status & SIS_AC97_STATUS_CODEC3_READY) 1130 sis->codecs_present |= SIS_PRIMARY_CODEC_PRESENT;
1115 sis->codecs_present |= SIS_TERTIARY_CODEC_PRESENT; 1131 if (status & SIS_AC97_STATUS_CODEC2_READY)
1116 1132 sis->codecs_present |= SIS_SECONDARY_CODEC_PRESENT;
1117 /* All done, let go of the semaphore, and check for errors 1133 if (status & SIS_AC97_STATUS_CODEC3_READY)
1134 sis->codecs_present |= SIS_TERTIARY_CODEC_PRESENT;
1135
1136 if (sis->codecs_present == codecs)
1137 break;
1138
1139 msleep(1);
1140 }
1141
1142 /* All done, check for errors.
1118 */ 1143 */
1119 outl(SIS_AC97_SEMA_RELEASE, io + SIS_AC97_SEMA); 1144 if (!sis->codecs_present) {
1120 if (!sis->codecs_present || !count) 1145 dev_err(&sis->pci->dev, "could not find any codecs\n");
1121 return -EIO; 1146 return -EIO;
1147 }
1148
1149 if (sis->codecs_present != codecs) {
1150 dev_warn(&sis->pci->dev, "missing codecs, found %0x, expected %0x\n",
1151 sis->codecs_present, codecs);
1152 }
1122 1153
1123 /* Let the hardware know that the audio driver is alive, 1154 /* Let the hardware know that the audio driver is alive,
1124 * and enable PCM slots on the AC-link for L/R playback (3 & 4) and 1155 * and enable PCM slots on the AC-link for L/R playback (3 & 4) and
@@ -1225,18 +1256,18 @@ static int sis_resume(struct pci_dev *pci)
1225 pci_restore_state(pci); 1256 pci_restore_state(pci);
1226 1257
1227 if (pci_enable_device(pci) < 0) { 1258 if (pci_enable_device(pci) < 0) {
1228 printk(KERN_ERR "sis7019: unable to re-enable device\n"); 1259 dev_err(&pci->dev, "unable to re-enable device\n");
1229 goto error; 1260 goto error;
1230 } 1261 }
1231 1262
1232 if (sis_chip_init(sis)) { 1263 if (sis_chip_init(sis)) {
1233 printk(KERN_ERR "sis7019: unable to re-init controller\n"); 1264 dev_err(&pci->dev, "unable to re-init controller\n");
1234 goto error; 1265 goto error;
1235 } 1266 }
1236 1267
1237 if (request_irq(pci->irq, sis_interrupt, IRQF_SHARED, 1268 if (request_irq(pci->irq, sis_interrupt, IRQF_SHARED,
1238 KBUILD_MODNAME, sis)) { 1269 KBUILD_MODNAME, sis)) {
1239 printk(KERN_ERR "sis7019: unable to regain IRQ %d\n", pci->irq); 1270 dev_err(&pci->dev, "unable to regain IRQ %d\n", pci->irq);
1240 goto error; 1271 goto error;
1241 } 1272 }
1242 1273
@@ -1304,8 +1335,7 @@ static int __devinit sis_chip_create(struct snd_card *card,
1304 goto error_out; 1335 goto error_out;
1305 1336
1306 if (pci_set_dma_mask(pci, DMA_BIT_MASK(30)) < 0) { 1337 if (pci_set_dma_mask(pci, DMA_BIT_MASK(30)) < 0) {
1307 printk(KERN_ERR "sis7019: architecture does not support " 1338 dev_err(&pci->dev, "architecture does not support 30-bit PCI busmaster DMA");
1308 "30-bit PCI busmaster DMA");
1309 goto error_out_enabled; 1339 goto error_out_enabled;
1310 } 1340 }
1311 1341
@@ -1319,20 +1349,20 @@ static int __devinit sis_chip_create(struct snd_card *card,
1319 1349
1320 rc = pci_request_regions(pci, "SiS7019"); 1350 rc = pci_request_regions(pci, "SiS7019");
1321 if (rc) { 1351 if (rc) {
1322 printk(KERN_ERR "sis7019: unable request regions\n"); 1352 dev_err(&pci->dev, "unable request regions\n");
1323 goto error_out_enabled; 1353 goto error_out_enabled;
1324 } 1354 }
1325 1355
1326 rc = -EIO; 1356 rc = -EIO;
1327 sis->ioaddr = ioremap_nocache(pci_resource_start(pci, 1), 0x4000); 1357 sis->ioaddr = ioremap_nocache(pci_resource_start(pci, 1), 0x4000);
1328 if (!sis->ioaddr) { 1358 if (!sis->ioaddr) {
1329 printk(KERN_ERR "sis7019: unable to remap MMIO, aborting\n"); 1359 dev_err(&pci->dev, "unable to remap MMIO, aborting\n");
1330 goto error_out_cleanup; 1360 goto error_out_cleanup;
1331 } 1361 }
1332 1362
1333 rc = sis_alloc_suspend(sis); 1363 rc = sis_alloc_suspend(sis);
1334 if (rc < 0) { 1364 if (rc < 0) {
1335 printk(KERN_ERR "sis7019: unable to allocate state storage\n"); 1365 dev_err(&pci->dev, "unable to allocate state storage\n");
1336 goto error_out_cleanup; 1366 goto error_out_cleanup;
1337 } 1367 }
1338 1368
@@ -1340,9 +1370,9 @@ static int __devinit sis_chip_create(struct snd_card *card,
1340 if (rc) 1370 if (rc)
1341 goto error_out_cleanup; 1371 goto error_out_cleanup;
1342 1372
1343 if (request_irq(pci->irq, sis_interrupt, IRQF_SHARED, 1373 if (request_irq(pci->irq, sis_interrupt, IRQF_SHARED, KBUILD_MODNAME,
1344 KBUILD_MODNAME, sis)) { 1374 sis)) {
1345 printk(KERN_ERR "unable to allocate irq %d\n", sis->irq); 1375 dev_err(&pci->dev, "unable to allocate irq %d\n", sis->irq);
1346 goto error_out_cleanup; 1376 goto error_out_cleanup;
1347 } 1377 }
1348 1378
@@ -1390,6 +1420,17 @@ static int __devinit snd_sis7019_probe(struct pci_dev *pci,
1390 if (!enable) 1420 if (!enable)
1391 goto error_out; 1421 goto error_out;
1392 1422
1423 /* The user can specify which codecs should be present so that we
1424 * can wait for them to show up if they are slow to recover from
1425 * the AC97 cold reset. We default to a single codec, the primary.
1426 *
1427 * We assume that SIS_PRIMARY_*_PRESENT matches bits 0-2.
1428 */
1429 codecs &= SIS_PRIMARY_CODEC_PRESENT | SIS_SECONDARY_CODEC_PRESENT |
1430 SIS_TERTIARY_CODEC_PRESENT;
1431 if (!codecs)
1432 codecs = SIS_PRIMARY_CODEC_PRESENT;
1433
1393 rc = snd_card_create(index, id, THIS_MODULE, sizeof(*sis), &card); 1434 rc = snd_card_create(index, id, THIS_MODULE, sizeof(*sis), &card);
1394 if (rc < 0) 1435 if (rc < 0)
1395 goto error_out; 1436 goto error_out;
diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c
index 31b6ad3ab1dc..54cc802050f7 100644
--- a/sound/pci/sonicvibes.c
+++ b/sound/pci/sonicvibes.c
@@ -52,9 +52,9 @@ MODULE_SUPPORTED_DEVICE("{{S3,SonicVibes PCI}}");
52 52
53static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 53static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
54static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 54static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
55static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 55static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
56static int reverb[SNDRV_CARDS]; 56static bool reverb[SNDRV_CARDS];
57static int mge[SNDRV_CARDS]; 57static bool mge[SNDRV_CARDS];
58static unsigned int dmaio = 0x7a00; /* DDMA i/o address */ 58static unsigned int dmaio = 0x7a00; /* DDMA i/o address */
59 59
60module_param_array(index, int, NULL, 0444); 60module_param_array(index, int, NULL, 0444);
diff --git a/sound/pci/trident/trident.c b/sound/pci/trident/trident.c
index deb04b924122..5f1def7f45e5 100644
--- a/sound/pci/trident/trident.c
+++ b/sound/pci/trident/trident.c
@@ -47,7 +47,7 @@ MODULE_SUPPORTED_DEVICE("{{Trident,4DWave DX},"
47 47
48static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 48static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
49static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 49static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
50static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 50static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
51static int pcm_channels[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 32}; 51static int pcm_channels[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 32};
52static int wavetable_size[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 8192}; 52static int wavetable_size[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 8192};
53 53
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index ae98d56d05bd..75630408c6db 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -80,7 +80,7 @@ static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */
80static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ 80static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */
81static long mpu_port; 81static long mpu_port;
82#ifdef SUPPORT_JOYSTICK 82#ifdef SUPPORT_JOYSTICK
83static int joystick; 83static bool joystick;
84#endif 84#endif
85static int ac97_clock = 48000; 85static int ac97_clock = 48000;
86static char *ac97_quirk; 86static char *ac97_quirk;
@@ -110,7 +110,7 @@ module_param(nodelay, int, 0444);
110MODULE_PARM_DESC(nodelay, "Disable 500ms init delay"); 110MODULE_PARM_DESC(nodelay, "Disable 500ms init delay");
111 111
112/* just for backward compatibility */ 112/* just for backward compatibility */
113static int enable; 113static bool enable;
114module_param(enable, bool, 0444); 114module_param(enable, bool, 0444);
115 115
116 116
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c
index 80a9c2bf3301..5efcbcac506a 100644
--- a/sound/pci/via82xx_modem.c
+++ b/sound/pci/via82xx_modem.c
@@ -66,7 +66,7 @@ module_param(ac97_clock, int, 0444);
66MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (default 48000Hz)."); 66MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (default 48000Hz).");
67 67
68/* just for backward compatibility */ 68/* just for backward compatibility */
69static int enable; 69static bool enable;
70module_param(enable, bool, 0444); 70module_param(enable, bool, 0444);
71 71
72 72
diff --git a/sound/pci/vx222/vx222.c b/sound/pci/vx222/vx222.c
index 6765822fb3b7..6a534bfe1274 100644
--- a/sound/pci/vx222/vx222.c
+++ b/sound/pci/vx222/vx222.c
@@ -37,8 +37,8 @@ MODULE_SUPPORTED_DEVICE("{{Digigram," CARD_NAME "}}");
37 37
38static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 38static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
39static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 39static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
40static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 40static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
41static int mic[SNDRV_CARDS]; /* microphone */ 41static bool mic[SNDRV_CARDS]; /* microphone */
42static int ibl[SNDRV_CARDS]; /* microphone */ 42static int ibl[SNDRV_CARDS]; /* microphone */
43 43
44module_param_array(index, int, NULL, 0444); 44module_param_array(index, int, NULL, 0444);
diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c
index e97ddcac0d37..e57b89e8aa89 100644
--- a/sound/pci/ymfpci/ymfpci.c
+++ b/sound/pci/ymfpci/ymfpci.c
@@ -41,13 +41,13 @@ MODULE_SUPPORTED_DEVICE("{{Yamaha,YMF724},"
41 41
42static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 42static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
43static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 43static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
44static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 44static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
45static long fm_port[SNDRV_CARDS]; 45static long fm_port[SNDRV_CARDS];
46static long mpu_port[SNDRV_CARDS]; 46static long mpu_port[SNDRV_CARDS];
47#ifdef SUPPORT_JOYSTICK 47#ifdef SUPPORT_JOYSTICK
48static long joystick_port[SNDRV_CARDS]; 48static long joystick_port[SNDRV_CARDS];
49#endif 49#endif
50static int rear_switch[SNDRV_CARDS]; 50static bool rear_switch[SNDRV_CARDS];
51 51
52module_param_array(index, int, NULL, 0444); 52module_param_array(index, int, NULL, 0444);
53MODULE_PARM_DESC(index, "Index value for the Yamaha DS-1 PCI soundcard."); 53MODULE_PARM_DESC(index, "Index value for the Yamaha DS-1 PCI soundcard.");