Lines Matching +full:adc +full:- +full:joystick
1 // SPDX-License-Identifier: GPL-2.0-or-later
8 /* Power-Management-Code ( CONFIG_PM )
11 * using https://www.kernel.org/doc/html/latest/sound/kernel-api/writing-an-alsa-driver.html
64 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
71 static bool joystick[SNDRV_CARDS]; variable
88 MODULE_PARM_DESC(joystick_port, "Joystick port address.");
90 module_param_array(joystick, bool, NULL, 0444);
91 MODULE_PARM_DESC(joystick, "Enable joystick.");
96 MODULE_PARM_DESC(spdif, "S/PDIF output (-1 = none, 0 = auto, 1 = force).");
111 #define CT5880REV_CT5880_D 0x03 /* ??? -jk */
121 #define ES_REG(ensoniq, x) ((ensoniq)->port + ES_REG_##x)
132 #define ES_1371_JOY_ASEL(o) (((o)&0x03)<<24)/* joystick port mapping */
135 #define ES_1371_GPIO_IN(i) (((i)>>20)&0x0f)/* GPIO in [3:0] pins - R/O */
139 #define ES_1371_GPIO_OUT(o) (((o)&0x0f)<<16)/* GPIO out [3:0] pins - W/R */
142 #define ES_1370_M_SBB (1<<14) /* clock source for DAC - 0 = clock generator; 1 = MPEG clocks */
149 #define ES_1371_M_CB (1<<11) /* capture clock source; 0 = AC'97 ADC; 1 = I2S */
151 #define ES_1370_M_CB (1<<9) /* capture clock source; 0 = ADC; 1 = MPEG */
158 #define ES_ADC_EN (1<<4) /* ADC capture channel enable */
160 #define ES_JYSTK_EN (1<<2) /* Joystick module enable */
168 #define ES_1373_REAR_BIT27 (1<<27) /* rear bits: 000 - front, 010 - mirror, 101 - separate */
171 #define ES_1373_GPIO_INT_EN(o)(((o)&0x0f)<<20)/* GPIO [3:0] pins - interrupt enable */
175 #define ES_1373_GPIO_INT(i) (((i)&0x0f)>>12)/* GPIO [3:0] pins - interrupt pending */
187 #define ES_ADC (1<<0) /* ADC channel interrupt pending */
204 #define ES_MEM_PAGEO(o) (((o)&0x0f)<<0) /* memory page select - out */
206 #define ES_MEM_PAGEI(i) (((i)>>0)&0x0f) /* memory page select - in */
233 #define ES_1371_JFAST (1<<31) /* fast joystick timing */
256 #define ES_REG_CHANNEL_STATUS 0x1c /* R/W: first 32-bits from S/PDIF channel status block, es1373 */
266 #define ES_R1_LOOP_SEL (1<<15) /* ADC; 0 - loop mode; 1 = stop mode */
267 #define ES_P2_LOOP_SEL (1<<14) /* DAC2; 0 - loop mode; 1 = stop mode */
268 #define ES_P1_LOOP_SEL (1<<13) /* DAC1; 0 - loop mode; 1 = stop mode */
269 #define ES_P2_PAUSE (1<<12) /* DAC2; 0 - play mode; 1 = pause mode */
270 #define ES_P1_PAUSE (1<<11) /* DAC1; 0 - play mode; 1 = pause mode */
271 #define ES_R1_INT_EN (1<<10) /* ADC interrupt enable */
275 #define ES_P2_DAC_SEN (1<<6) /* when stop mode: 0 - DAC2 play back zeros; 1 = DAC2 play back la…
276 …efine ES_R1_MODEO(o) (((o)&0x03)<<4) /* ADC mode; 0 = 8-bit mono; 1 = 8-bit stereo; 2 = 16-bit m…
279 #define ES_P2_MODEO(o) (((o)&0x03)<<2) /* DAC2 mode; -- '' -- */
282 #define ES_P1_MODEO(o) (((o)&0x03)<<0) /* DAC1 mode; -- '' -- */
288 #define ES_REG_ADC_COUNT 0x2c /* R/W: ADC sample count register */
298 #define ES_REG_ADC_FRAME 0x30 /* R/W: PAGE 0x0d; ADC frame address */
299 #define ES_REG_ADC_SIZE 0x34 /* R/W: PAGE 0x0d; ADC frame size */
345 #define ES_1370_SRTODIV(x) (ES_1370_SRCLOCK/(x)-2)
397 struct snd_pcm *pcm1; /* DAC1/ADC PCM */
433 { PCI_VDEVICE(ENSONIQ, 0x5880), 0, }, /* ES1373 - CT5880 */
506 dev_err(ensoniq->card->dev, "wait src ready timeout 0x%lx [0x%x]\n", in snd_es1371_wait_src_ready()
564 struct ensoniq *ensoniq = ak4531->private_data; in snd_es1370_codec_write()
568 dev_dbg(ensoniq->card->dev, in snd_es1370_codec_write()
579 dev_err(ensoniq->card->dev, "codec write timeout, status = 0x%x\n", in snd_es1370_codec_write()
589 return ensoniq->pci->device == 0x8938; in is_ev1938()
595 struct ensoniq *ensoniq = ac97->private_data; in snd_es1371_codec_write()
599 mutex_lock(&ensoniq->src_mutex); in snd_es1371_codec_write()
625 mutex_unlock(&ensoniq->src_mutex); in snd_es1371_codec_write()
629 mutex_unlock(&ensoniq->src_mutex); in snd_es1371_codec_write()
630 dev_err(ensoniq->card->dev, "codec write timeout at 0x%lx [0x%x]\n", in snd_es1371_codec_write()
637 struct ensoniq *ensoniq = ac97->private_data; in snd_es1371_codec_read()
642 mutex_lock(&ensoniq->src_mutex); in snd_es1371_codec_read()
682 mutex_unlock(&ensoniq->src_mutex); in snd_es1371_codec_read()
686 mutex_unlock(&ensoniq->src_mutex); in snd_es1371_codec_read()
688 dev_err(ensoniq->card->dev, in snd_es1371_codec_read()
697 mutex_unlock(&ensoniq->src_mutex); in snd_es1371_codec_read()
698 dev_err(ensoniq->card->dev, "codec read timeout at 0x%lx [0x%x]\n", in snd_es1371_codec_read()
716 mutex_lock(&ensoniq->src_mutex); in snd_es1371_adc_rate()
719 n--; in snd_es1371_adc_rate()
720 truncm = (21 * n - 1) | 1; in snd_es1371_adc_rate()
726 (((239 - truncm) >> 1) << 9) | (n << 4)); in snd_es1371_adc_rate()
731 0x8000 | (((119 - truncm) >> 1) << 9) | (n << 4)); in snd_es1371_adc_rate()
740 mutex_unlock(&ensoniq->src_mutex); in snd_es1371_adc_rate()
747 mutex_lock(&ensoniq->src_mutex); in snd_es1371_dac1_rate()
761 mutex_unlock(&ensoniq->src_mutex); in snd_es1371_dac1_rate()
768 mutex_lock(&ensoniq->src_mutex); in snd_es1371_dac2_rate()
783 mutex_unlock(&ensoniq->src_mutex); in snd_es1371_dac2_rate()
798 if (s == ensoniq->playback1_substream) { in snd_ensoniq_trigger()
801 } else if (s == ensoniq->playback2_substream) { in snd_ensoniq_trigger()
804 } else if (s == ensoniq->capture_substream) in snd_ensoniq_trigger()
805 return -EINVAL; in snd_ensoniq_trigger()
807 spin_lock(&ensoniq->reg_lock); in snd_ensoniq_trigger()
809 ensoniq->sctrl |= what; in snd_ensoniq_trigger()
811 ensoniq->sctrl &= ~what; in snd_ensoniq_trigger()
812 outl(ensoniq->sctrl, ES_REG(ensoniq, SERIAL)); in snd_ensoniq_trigger()
813 spin_unlock(&ensoniq->reg_lock); in snd_ensoniq_trigger()
822 if (s == ensoniq->playback1_substream) { in snd_ensoniq_trigger()
825 } else if (s == ensoniq->playback2_substream) { in snd_ensoniq_trigger()
828 } else if (s == ensoniq->capture_substream) { in snd_ensoniq_trigger()
833 spin_lock(&ensoniq->reg_lock); in snd_ensoniq_trigger()
835 ensoniq->ctrl |= what; in snd_ensoniq_trigger()
837 ensoniq->ctrl &= ~what; in snd_ensoniq_trigger()
838 outl(ensoniq->ctrl, ES_REG(ensoniq, CONTROL)); in snd_ensoniq_trigger()
839 spin_unlock(&ensoniq->reg_lock); in snd_ensoniq_trigger()
843 return -EINVAL; in snd_ensoniq_trigger()
855 struct snd_pcm_runtime *runtime = substream->runtime; in snd_ensoniq_playback1_prepare()
858 ensoniq->p1_dma_size = snd_pcm_lib_buffer_bytes(substream); in snd_ensoniq_playback1_prepare()
859 ensoniq->p1_period_size = snd_pcm_lib_period_bytes(substream); in snd_ensoniq_playback1_prepare()
860 if (snd_pcm_format_width(runtime->format) == 16) in snd_ensoniq_playback1_prepare()
862 if (runtime->channels > 1) in snd_ensoniq_playback1_prepare()
864 spin_lock_irq(&ensoniq->reg_lock); in snd_ensoniq_playback1_prepare()
865 ensoniq->ctrl &= ~ES_DAC1_EN; in snd_ensoniq_playback1_prepare()
867 /* 48k doesn't need SRC (it breaks AC3-passthru) */ in snd_ensoniq_playback1_prepare()
868 if (runtime->rate == 48000) in snd_ensoniq_playback1_prepare()
869 ensoniq->ctrl |= ES_1373_BYPASS_P1; in snd_ensoniq_playback1_prepare()
871 ensoniq->ctrl &= ~ES_1373_BYPASS_P1; in snd_ensoniq_playback1_prepare()
873 outl(ensoniq->ctrl, ES_REG(ensoniq, CONTROL)); in snd_ensoniq_playback1_prepare()
875 outl(runtime->dma_addr, ES_REG(ensoniq, DAC1_FRAME)); in snd_ensoniq_playback1_prepare()
876 outl((ensoniq->p1_dma_size >> 2) - 1, ES_REG(ensoniq, DAC1_SIZE)); in snd_ensoniq_playback1_prepare()
877 ensoniq->sctrl &= ~(ES_P1_LOOP_SEL | ES_P1_PAUSE | ES_P1_SCT_RLD | ES_P1_MODEM); in snd_ensoniq_playback1_prepare()
878 ensoniq->sctrl |= ES_P1_INT_EN | ES_P1_MODEO(mode); in snd_ensoniq_playback1_prepare()
879 outl(ensoniq->sctrl, ES_REG(ensoniq, SERIAL)); in snd_ensoniq_playback1_prepare()
880 outl((ensoniq->p1_period_size >> snd_ensoniq_sample_shift[mode]) - 1, in snd_ensoniq_playback1_prepare()
883 ensoniq->ctrl &= ~ES_1370_WTSRSELM; in snd_ensoniq_playback1_prepare()
884 switch (runtime->rate) { in snd_ensoniq_playback1_prepare()
885 case 5512: ensoniq->ctrl |= ES_1370_WTSRSEL(0); break; in snd_ensoniq_playback1_prepare()
886 case 11025: ensoniq->ctrl |= ES_1370_WTSRSEL(1); break; in snd_ensoniq_playback1_prepare()
887 case 22050: ensoniq->ctrl |= ES_1370_WTSRSEL(2); break; in snd_ensoniq_playback1_prepare()
888 case 44100: ensoniq->ctrl |= ES_1370_WTSRSEL(3); break; in snd_ensoniq_playback1_prepare()
892 outl(ensoniq->ctrl, ES_REG(ensoniq, CONTROL)); in snd_ensoniq_playback1_prepare()
893 spin_unlock_irq(&ensoniq->reg_lock); in snd_ensoniq_playback1_prepare()
895 snd_es1371_dac1_rate(ensoniq, runtime->rate); in snd_ensoniq_playback1_prepare()
903 struct snd_pcm_runtime *runtime = substream->runtime; in snd_ensoniq_playback2_prepare()
906 ensoniq->p2_dma_size = snd_pcm_lib_buffer_bytes(substream); in snd_ensoniq_playback2_prepare()
907 ensoniq->p2_period_size = snd_pcm_lib_period_bytes(substream); in snd_ensoniq_playback2_prepare()
908 if (snd_pcm_format_width(runtime->format) == 16) in snd_ensoniq_playback2_prepare()
910 if (runtime->channels > 1) in snd_ensoniq_playback2_prepare()
912 spin_lock_irq(&ensoniq->reg_lock); in snd_ensoniq_playback2_prepare()
913 ensoniq->ctrl &= ~ES_DAC2_EN; in snd_ensoniq_playback2_prepare()
914 outl(ensoniq->ctrl, ES_REG(ensoniq, CONTROL)); in snd_ensoniq_playback2_prepare()
916 outl(runtime->dma_addr, ES_REG(ensoniq, DAC2_FRAME)); in snd_ensoniq_playback2_prepare()
917 outl((ensoniq->p2_dma_size >> 2) - 1, ES_REG(ensoniq, DAC2_SIZE)); in snd_ensoniq_playback2_prepare()
918 ensoniq->sctrl &= ~(ES_P2_LOOP_SEL | ES_P2_PAUSE | ES_P2_DAC_SEN | in snd_ensoniq_playback2_prepare()
920 ensoniq->sctrl |= ES_P2_INT_EN | ES_P2_MODEO(mode) | in snd_ensoniq_playback2_prepare()
922 outl(ensoniq->sctrl, ES_REG(ensoniq, SERIAL)); in snd_ensoniq_playback2_prepare()
923 outl((ensoniq->p2_period_size >> snd_ensoniq_sample_shift[mode]) - 1, in snd_ensoniq_playback2_prepare()
926 if (!(ensoniq->u.es1370.pclkdiv_lock & ES_MODE_CAPTURE)) { in snd_ensoniq_playback2_prepare()
927 ensoniq->ctrl &= ~ES_1370_PCLKDIVM; in snd_ensoniq_playback2_prepare()
928 ensoniq->ctrl |= ES_1370_PCLKDIVO(ES_1370_SRTODIV(runtime->rate)); in snd_ensoniq_playback2_prepare()
929 ensoniq->u.es1370.pclkdiv_lock |= ES_MODE_PLAY2; in snd_ensoniq_playback2_prepare()
932 outl(ensoniq->ctrl, ES_REG(ensoniq, CONTROL)); in snd_ensoniq_playback2_prepare()
933 spin_unlock_irq(&ensoniq->reg_lock); in snd_ensoniq_playback2_prepare()
935 snd_es1371_dac2_rate(ensoniq, runtime->rate); in snd_ensoniq_playback2_prepare()
943 struct snd_pcm_runtime *runtime = substream->runtime; in snd_ensoniq_capture_prepare()
946 ensoniq->c_dma_size = snd_pcm_lib_buffer_bytes(substream); in snd_ensoniq_capture_prepare()
947 ensoniq->c_period_size = snd_pcm_lib_period_bytes(substream); in snd_ensoniq_capture_prepare()
948 if (snd_pcm_format_width(runtime->format) == 16) in snd_ensoniq_capture_prepare()
950 if (runtime->channels > 1) in snd_ensoniq_capture_prepare()
952 spin_lock_irq(&ensoniq->reg_lock); in snd_ensoniq_capture_prepare()
953 ensoniq->ctrl &= ~ES_ADC_EN; in snd_ensoniq_capture_prepare()
954 outl(ensoniq->ctrl, ES_REG(ensoniq, CONTROL)); in snd_ensoniq_capture_prepare()
956 outl(runtime->dma_addr, ES_REG(ensoniq, ADC_FRAME)); in snd_ensoniq_capture_prepare()
957 outl((ensoniq->c_dma_size >> 2) - 1, ES_REG(ensoniq, ADC_SIZE)); in snd_ensoniq_capture_prepare()
958 ensoniq->sctrl &= ~(ES_R1_LOOP_SEL | ES_R1_MODEM); in snd_ensoniq_capture_prepare()
959 ensoniq->sctrl |= ES_R1_INT_EN | ES_R1_MODEO(mode); in snd_ensoniq_capture_prepare()
960 outl(ensoniq->sctrl, ES_REG(ensoniq, SERIAL)); in snd_ensoniq_capture_prepare()
961 outl((ensoniq->c_period_size >> snd_ensoniq_sample_shift[mode]) - 1, in snd_ensoniq_capture_prepare()
964 if (!(ensoniq->u.es1370.pclkdiv_lock & ES_MODE_PLAY2)) { in snd_ensoniq_capture_prepare()
965 ensoniq->ctrl &= ~ES_1370_PCLKDIVM; in snd_ensoniq_capture_prepare()
966 ensoniq->ctrl |= ES_1370_PCLKDIVO(ES_1370_SRTODIV(runtime->rate)); in snd_ensoniq_capture_prepare()
967 ensoniq->u.es1370.pclkdiv_lock |= ES_MODE_CAPTURE; in snd_ensoniq_capture_prepare()
970 outl(ensoniq->ctrl, ES_REG(ensoniq, CONTROL)); in snd_ensoniq_capture_prepare()
971 spin_unlock_irq(&ensoniq->reg_lock); in snd_ensoniq_capture_prepare()
973 snd_es1371_adc_rate(ensoniq, runtime->rate); in snd_ensoniq_capture_prepare()
983 spin_lock(&ensoniq->reg_lock); in snd_ensoniq_playback1_pointer()
987 ptr = bytes_to_frames(substream->runtime, ptr); in snd_ensoniq_playback1_pointer()
991 spin_unlock(&ensoniq->reg_lock); in snd_ensoniq_playback1_pointer()
1000 spin_lock(&ensoniq->reg_lock); in snd_ensoniq_playback2_pointer()
1004 ptr = bytes_to_frames(substream->runtime, ptr); in snd_ensoniq_playback2_pointer()
1008 spin_unlock(&ensoniq->reg_lock); in snd_ensoniq_playback2_pointer()
1017 spin_lock(&ensoniq->reg_lock); in snd_ensoniq_capture_pointer()
1021 ptr = bytes_to_frames(substream->runtime, ptr); in snd_ensoniq_capture_pointer()
1025 spin_unlock(&ensoniq->reg_lock); in snd_ensoniq_capture_pointer()
1098 struct snd_pcm_runtime *runtime = substream->runtime; in snd_ensoniq_playback1_open()
1100 ensoniq->mode |= ES_MODE_PLAY1; in snd_ensoniq_playback1_open()
1101 ensoniq->playback1_substream = substream; in snd_ensoniq_playback1_open()
1102 runtime->hw = snd_ensoniq_playback1; in snd_ensoniq_playback1_open()
1104 spin_lock_irq(&ensoniq->reg_lock); in snd_ensoniq_playback1_open()
1105 if (ensoniq->spdif && ensoniq->playback2_substream == NULL) in snd_ensoniq_playback1_open()
1106 ensoniq->spdif_stream = ensoniq->spdif_default; in snd_ensoniq_playback1_open()
1107 spin_unlock_irq(&ensoniq->reg_lock); in snd_ensoniq_playback1_open()
1121 struct snd_pcm_runtime *runtime = substream->runtime; in snd_ensoniq_playback2_open()
1123 ensoniq->mode |= ES_MODE_PLAY2; in snd_ensoniq_playback2_open()
1124 ensoniq->playback2_substream = substream; in snd_ensoniq_playback2_open()
1125 runtime->hw = snd_ensoniq_playback2; in snd_ensoniq_playback2_open()
1127 spin_lock_irq(&ensoniq->reg_lock); in snd_ensoniq_playback2_open()
1128 if (ensoniq->spdif && ensoniq->playback1_substream == NULL) in snd_ensoniq_playback2_open()
1129 ensoniq->spdif_stream = ensoniq->spdif_default; in snd_ensoniq_playback2_open()
1130 spin_unlock_irq(&ensoniq->reg_lock); in snd_ensoniq_playback2_open()
1144 struct snd_pcm_runtime *runtime = substream->runtime; in snd_ensoniq_capture_open()
1146 ensoniq->mode |= ES_MODE_CAPTURE; in snd_ensoniq_capture_open()
1147 ensoniq->capture_substream = substream; in snd_ensoniq_capture_open()
1148 runtime->hw = snd_ensoniq_capture; in snd_ensoniq_capture_open()
1164 ensoniq->playback1_substream = NULL; in snd_ensoniq_playback1_close()
1165 ensoniq->mode &= ~ES_MODE_PLAY1; in snd_ensoniq_playback1_close()
1173 ensoniq->playback2_substream = NULL; in snd_ensoniq_playback2_close()
1174 spin_lock_irq(&ensoniq->reg_lock); in snd_ensoniq_playback2_close()
1176 ensoniq->u.es1370.pclkdiv_lock &= ~ES_MODE_PLAY2; in snd_ensoniq_playback2_close()
1178 ensoniq->mode &= ~ES_MODE_PLAY2; in snd_ensoniq_playback2_close()
1179 spin_unlock_irq(&ensoniq->reg_lock); in snd_ensoniq_playback2_close()
1187 ensoniq->capture_substream = NULL; in snd_ensoniq_capture_close()
1188 spin_lock_irq(&ensoniq->reg_lock); in snd_ensoniq_capture_close()
1190 ensoniq->u.es1370.pclkdiv_lock &= ~ES_MODE_CAPTURE; in snd_ensoniq_capture_close()
1192 ensoniq->mode &= ~ES_MODE_CAPTURE; in snd_ensoniq_capture_close()
1193 spin_unlock_irq(&ensoniq->reg_lock); in snd_ensoniq_capture_close()
1234 err = snd_pcm_new(ensoniq->card, CHIP_NAME "/1", device, 1, 1, &pcm); in snd_ensoniq_pcm()
1245 pcm->private_data = ensoniq; in snd_ensoniq_pcm()
1246 pcm->info_flags = 0; in snd_ensoniq_pcm()
1247 strcpy(pcm->name, CHIP_NAME " DAC2/ADC"); in snd_ensoniq_pcm()
1248 ensoniq->pcm1 = pcm; in snd_ensoniq_pcm()
1251 &ensoniq->pci->dev, 64*1024, 128*1024); in snd_ensoniq_pcm()
1268 err = snd_pcm_new(ensoniq->card, CHIP_NAME "/2", device, 1, 0, &pcm); in snd_ensoniq_pcm2()
1277 pcm->private_data = ensoniq; in snd_ensoniq_pcm2()
1278 pcm->info_flags = 0; in snd_ensoniq_pcm2()
1279 strcpy(pcm->name, CHIP_NAME " DAC1"); in snd_ensoniq_pcm2()
1280 ensoniq->pcm2 = pcm; in snd_ensoniq_pcm2()
1283 &ensoniq->pci->dev, 64*1024, 128*1024); in snd_ensoniq_pcm2()
1306 uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; in snd_ens1373_spdif_info()
1307 uinfo->count = 1; in snd_ens1373_spdif_info()
1315 spin_lock_irq(&ensoniq->reg_lock); in snd_ens1373_spdif_default_get()
1316 ucontrol->value.iec958.status[0] = (ensoniq->spdif_default >> 0) & 0xff; in snd_ens1373_spdif_default_get()
1317 ucontrol->value.iec958.status[1] = (ensoniq->spdif_default >> 8) & 0xff; in snd_ens1373_spdif_default_get()
1318 ucontrol->value.iec958.status[2] = (ensoniq->spdif_default >> 16) & 0xff; in snd_ens1373_spdif_default_get()
1319 ucontrol->value.iec958.status[3] = (ensoniq->spdif_default >> 24) & 0xff; in snd_ens1373_spdif_default_get()
1320 spin_unlock_irq(&ensoniq->reg_lock); in snd_ens1373_spdif_default_get()
1331 val = ((u32)ucontrol->value.iec958.status[0] << 0) | in snd_ens1373_spdif_default_put()
1332 ((u32)ucontrol->value.iec958.status[1] << 8) | in snd_ens1373_spdif_default_put()
1333 ((u32)ucontrol->value.iec958.status[2] << 16) | in snd_ens1373_spdif_default_put()
1334 ((u32)ucontrol->value.iec958.status[3] << 24); in snd_ens1373_spdif_default_put()
1335 spin_lock_irq(&ensoniq->reg_lock); in snd_ens1373_spdif_default_put()
1336 change = ensoniq->spdif_default != val; in snd_ens1373_spdif_default_put()
1337 ensoniq->spdif_default = val; in snd_ens1373_spdif_default_put()
1338 if (change && ensoniq->playback1_substream == NULL && in snd_ens1373_spdif_default_put()
1339 ensoniq->playback2_substream == NULL) in snd_ens1373_spdif_default_put()
1341 spin_unlock_irq(&ensoniq->reg_lock); in snd_ens1373_spdif_default_put()
1348 ucontrol->value.iec958.status[0] = 0xff; in snd_ens1373_spdif_mask_get()
1349 ucontrol->value.iec958.status[1] = 0xff; in snd_ens1373_spdif_mask_get()
1350 ucontrol->value.iec958.status[2] = 0xff; in snd_ens1373_spdif_mask_get()
1351 ucontrol->value.iec958.status[3] = 0xff; in snd_ens1373_spdif_mask_get()
1359 spin_lock_irq(&ensoniq->reg_lock); in snd_ens1373_spdif_stream_get()
1360 ucontrol->value.iec958.status[0] = (ensoniq->spdif_stream >> 0) & 0xff; in snd_ens1373_spdif_stream_get()
1361 ucontrol->value.iec958.status[1] = (ensoniq->spdif_stream >> 8) & 0xff; in snd_ens1373_spdif_stream_get()
1362 ucontrol->value.iec958.status[2] = (ensoniq->spdif_stream >> 16) & 0xff; in snd_ens1373_spdif_stream_get()
1363 ucontrol->value.iec958.status[3] = (ensoniq->spdif_stream >> 24) & 0xff; in snd_ens1373_spdif_stream_get()
1364 spin_unlock_irq(&ensoniq->reg_lock); in snd_ens1373_spdif_stream_get()
1375 val = ((u32)ucontrol->value.iec958.status[0] << 0) | in snd_ens1373_spdif_stream_put()
1376 ((u32)ucontrol->value.iec958.status[1] << 8) | in snd_ens1373_spdif_stream_put()
1377 ((u32)ucontrol->value.iec958.status[2] << 16) | in snd_ens1373_spdif_stream_put()
1378 ((u32)ucontrol->value.iec958.status[3] << 24); in snd_ens1373_spdif_stream_put()
1379 spin_lock_irq(&ensoniq->reg_lock); in snd_ens1373_spdif_stream_put()
1380 change = ensoniq->spdif_stream != val; in snd_ens1373_spdif_stream_put()
1381 ensoniq->spdif_stream = val; in snd_ens1373_spdif_stream_put()
1382 if (change && (ensoniq->playback1_substream != NULL || in snd_ens1373_spdif_stream_put()
1383 ensoniq->playback2_substream != NULL)) in snd_ens1373_spdif_stream_put()
1385 spin_unlock_irq(&ensoniq->reg_lock); in snd_ens1373_spdif_stream_put()
1400 spin_lock_irq(&ensoniq->reg_lock); in snd_es1371_spdif_get()
1401 ucontrol->value.integer.value[0] = ensoniq->ctrl & ES_1373_SPDIF_THRU ? 1 : 0; in snd_es1371_spdif_get()
1402 spin_unlock_irq(&ensoniq->reg_lock); in snd_es1371_spdif_get()
1413 nval1 = ucontrol->value.integer.value[0] ? ES_1373_SPDIF_THRU : 0; in snd_es1371_spdif_put()
1414 nval2 = ucontrol->value.integer.value[0] ? ES_1373_SPDIF_EN : 0; in snd_es1371_spdif_put()
1415 spin_lock_irq(&ensoniq->reg_lock); in snd_es1371_spdif_put()
1416 change = (ensoniq->ctrl & ES_1373_SPDIF_THRU) != nval1; in snd_es1371_spdif_put()
1417 ensoniq->ctrl &= ~ES_1373_SPDIF_THRU; in snd_es1371_spdif_put()
1418 ensoniq->ctrl |= nval1; in snd_es1371_spdif_put()
1419 ensoniq->cssr &= ~ES_1373_SPDIF_EN; in snd_es1371_spdif_put()
1420 ensoniq->cssr |= nval2; in snd_es1371_spdif_put()
1421 outl(ensoniq->ctrl, ES_REG(ensoniq, CONTROL)); in snd_es1371_spdif_put()
1422 outl(ensoniq->cssr, ES_REG(ensoniq, STATUS)); in snd_es1371_spdif_put()
1423 spin_unlock_irq(&ensoniq->reg_lock); in snd_es1371_spdif_put()
1463 spin_lock_irq(&ensoniq->reg_lock); in snd_es1373_rear_get()
1464 if ((ensoniq->cssr & (ES_1373_REAR_BIT27|ES_1373_REAR_BIT26| in snd_es1373_rear_get()
1467 ucontrol->value.integer.value[0] = val; in snd_es1373_rear_get()
1468 spin_unlock_irq(&ensoniq->reg_lock); in snd_es1373_rear_get()
1479 nval1 = ucontrol->value.integer.value[0] ? in snd_es1373_rear_put()
1481 spin_lock_irq(&ensoniq->reg_lock); in snd_es1373_rear_put()
1482 change = (ensoniq->cssr & (ES_1373_REAR_BIT27| in snd_es1373_rear_put()
1484 ensoniq->cssr &= ~(ES_1373_REAR_BIT27|ES_1373_REAR_BIT26|ES_1373_REAR_BIT24); in snd_es1373_rear_put()
1485 ensoniq->cssr |= nval1; in snd_es1373_rear_put()
1486 outl(ensoniq->cssr, ES_REG(ensoniq, STATUS)); in snd_es1373_rear_put()
1487 spin_unlock_irq(&ensoniq->reg_lock); in snd_es1373_rear_put()
1494 .name = "AC97 2ch->4ch Copy Switch",
1508 spin_lock_irq(&ensoniq->reg_lock); in snd_es1373_line_get()
1509 if (ensoniq->ctrl & ES_1371_GPIO_OUT(4)) in snd_es1373_line_get()
1511 ucontrol->value.integer.value[0] = val; in snd_es1373_line_get()
1512 spin_unlock_irq(&ensoniq->reg_lock); in snd_es1373_line_get()
1523 spin_lock_irq(&ensoniq->reg_lock); in snd_es1373_line_put()
1524 ctrl = ensoniq->ctrl; in snd_es1373_line_put()
1525 if (ucontrol->value.integer.value[0]) in snd_es1373_line_put()
1526 ensoniq->ctrl |= ES_1371_GPIO_OUT(4); /* switch line-in -> rear out */ in snd_es1373_line_put()
1528 ensoniq->ctrl &= ~ES_1371_GPIO_OUT(4); in snd_es1373_line_put()
1529 changed = (ctrl != ensoniq->ctrl); in snd_es1373_line_put()
1531 outl(ensoniq->ctrl, ES_REG(ensoniq, CONTROL)); in snd_es1373_line_put()
1532 spin_unlock_irq(&ensoniq->reg_lock); in snd_es1373_line_put()
1539 .name = "Line In->Rear Out Switch",
1547 struct ensoniq *ensoniq = ac97->private_data; in snd_ensoniq_mixer_free_ac97()
1548 ensoniq->u.es1371.ac97 = NULL; in snd_ensoniq_mixer_free_ac97()
1560 while (list->vid != (unsigned short)PCI_ANY_ID) { in es1371_quirk_lookup()
1561 if (ensoniq->pci->vendor == list->vid && in es1371_quirk_lookup()
1562 ensoniq->pci->device == list->did && in es1371_quirk_lookup()
1563 ensoniq->rev == list->rev) in es1371_quirk_lookup()
1580 SND_PCI_QUIRK_ID(0x1274, 0x2000), /* GA-7DXR */
1581 SND_PCI_QUIRK_ID(0x1458, 0xa000), /* GA-8IEXP */
1588 struct snd_card *card = ensoniq->card; in snd_ensoniq_1371_mixer()
1605 ac97.pci = ensoniq->pci; in snd_ensoniq_1371_mixer()
1607 err = snd_ac97_mixer(pbus, &ac97, &ensoniq->u.es1371.ac97); in snd_ensoniq_1371_mixer()
1615 ensoniq->spdif_default = ensoniq->spdif_stream = in snd_ensoniq_1371_mixer()
1617 outl(ensoniq->spdif_default, ES_REG(ensoniq, CHANNEL_STATUS)); in snd_ensoniq_1371_mixer()
1619 if (ensoniq->u.es1371.ac97->ext_id & AC97_EI_SPDIF) in snd_ensoniq_1371_mixer()
1625 return -ENOMEM; in snd_ensoniq_1371_mixer()
1626 kctl->id.index = is_spdif; in snd_ensoniq_1371_mixer()
1632 if (ensoniq->u.es1371.ac97->ext_id & AC97_EI_SDAC) { in snd_ensoniq_1371_mixer()
1634 ensoniq->cssr &= ~(ES_1373_REAR_BIT27|ES_1373_REAR_BIT24); in snd_ensoniq_1371_mixer()
1635 ensoniq->cssr |= ES_1373_REAR_BIT26; in snd_ensoniq_1371_mixer()
1641 snd_pci_quirk_lookup(ensoniq->pci, ens1373_line_quirk)) { in snd_ensoniq_1371_mixer()
1666 int mask = kcontrol->private_value; in snd_ensoniq_control_get()
1668 spin_lock_irq(&ensoniq->reg_lock); in snd_ensoniq_control_get()
1669 ucontrol->value.integer.value[0] = ensoniq->ctrl & mask ? 1 : 0; in snd_ensoniq_control_get()
1670 spin_unlock_irq(&ensoniq->reg_lock); in snd_ensoniq_control_get()
1678 int mask = kcontrol->private_value; in snd_ensoniq_control_put()
1682 nval = ucontrol->value.integer.value[0] ? mask : 0; in snd_ensoniq_control_put()
1683 spin_lock_irq(&ensoniq->reg_lock); in snd_ensoniq_control_put()
1684 change = (ensoniq->ctrl & mask) != nval; in snd_ensoniq_control_put()
1685 ensoniq->ctrl &= ~mask; in snd_ensoniq_control_put()
1686 ensoniq->ctrl |= nval; in snd_ensoniq_control_put()
1687 outl(ensoniq->ctrl, ES_REG(ensoniq, CONTROL)); in snd_ensoniq_control_put()
1688 spin_unlock_irq(&ensoniq->reg_lock); in snd_ensoniq_control_put()
1697 ENSONIQ_CONTROL("PCM 0 Output also on Line-In Jack", ES_1370_XCTL0),
1705 struct ensoniq *ensoniq = ak4531->private_data; in snd_ensoniq_mixer_free_ak4531()
1706 ensoniq->u.es1370.ak4531 = NULL; in snd_ensoniq_mixer_free_ak4531()
1711 struct snd_card *card = ensoniq->card; in snd_ensoniq_1370_mixer()
1728 err = snd_ak4531_mixer(card, &ak4531, &ensoniq->u.es1370.ak4531); in snd_ensoniq_1370_mixer()
1748 case 1: /* auto-detect */ in snd_ensoniq_get_joystick_port()
1756 dev_err(ensoniq->card->dev, in snd_ensoniq_get_joystick_port()
1757 "invalid joystick port %#x", joystick_port[dev]); in snd_ensoniq_get_joystick_port()
1764 return joystick[dev] ? 0x200 : 0; in snd_ensoniq_get_joystick_port()
1777 return -ENOSYS; in snd_ensoniq_create_gameport()
1784 dev_warn(ensoniq->card->dev, in snd_ensoniq_create_gameport()
1786 return -EBUSY; in snd_ensoniq_create_gameport()
1792 dev_warn(ensoniq->card->dev, in snd_ensoniq_create_gameport()
1795 return -EBUSY; in snd_ensoniq_create_gameport()
1800 ensoniq->gameport = gp = gameport_allocate_port(); in snd_ensoniq_create_gameport()
1802 dev_err(ensoniq->card->dev, in snd_ensoniq_create_gameport()
1805 return -ENOMEM; in snd_ensoniq_create_gameport()
1809 gameport_set_phys(gp, "pci%s/gameport0", pci_name(ensoniq->pci)); in snd_ensoniq_create_gameport()
1810 gameport_set_dev_parent(gp, &ensoniq->pci->dev); in snd_ensoniq_create_gameport()
1811 gp->io = io_port; in snd_ensoniq_create_gameport()
1813 ensoniq->ctrl |= ES_JYSTK_EN; in snd_ensoniq_create_gameport()
1815 ensoniq->ctrl &= ~ES_1371_JOY_ASELM; in snd_ensoniq_create_gameport()
1816 ensoniq->ctrl |= ES_1371_JOY_ASEL((io_port - 0x200) / 8); in snd_ensoniq_create_gameport()
1818 outl(ensoniq->ctrl, ES_REG(ensoniq, CONTROL)); in snd_ensoniq_create_gameport()
1820 gameport_register_port(ensoniq->gameport); in snd_ensoniq_create_gameport()
1827 if (ensoniq->gameport) { in snd_ensoniq_free_gameport()
1828 int port = ensoniq->gameport->io; in snd_ensoniq_free_gameport()
1830 gameport_unregister_port(ensoniq->gameport); in snd_ensoniq_free_gameport()
1831 ensoniq->gameport = NULL; in snd_ensoniq_free_gameport()
1832 ensoniq->ctrl &= ~ES_JYSTK_EN; in snd_ensoniq_free_gameport()
1833 outl(ensoniq->ctrl, ES_REG(ensoniq, CONTROL)); in snd_ensoniq_free_gameport()
1838 static inline int snd_ensoniq_create_gameport(struct ensoniq *ensoniq, long port) { return -ENOSYS;… in snd_ensoniq_create_gameport()
1849 struct ensoniq *ensoniq = entry->private_data; in snd_ensoniq_proc_read()
1852 snd_iprintf(buffer, "Joystick enable : %s\n", in snd_ensoniq_proc_read()
1853 ensoniq->ctrl & ES_JYSTK_EN ? "on" : "off"); in snd_ensoniq_proc_read()
1856 ensoniq->ctrl & ES_1370_XCTL1 ? "on" : "off"); in snd_ensoniq_proc_read()
1858 ensoniq->ctrl & ES_1370_XCTL0 ? "on" : "off"); in snd_ensoniq_proc_read()
1860 snd_iprintf(buffer, "Joystick port : 0x%x\n", in snd_ensoniq_proc_read()
1861 (ES_1371_JOY_ASELI(ensoniq->ctrl) * 8) + 0x200); in snd_ensoniq_proc_read()
1867 snd_card_ro_proc_new(ensoniq->card, "audiopci", ensoniq, in snd_ensoniq_proc_init()
1877 struct ensoniq *ensoniq = card->private_data; in snd_ensoniq_free()
1892 SND_PCI_QUIRK_ID(0x13bd, 0x100c), /* EV1938 on Mebius PC-MJ100V */
1917 outl(ensoniq->ctrl, ES_REG(ensoniq, CONTROL)); in snd_ensoniq_chip_init()
1918 outl(ensoniq->sctrl, ES_REG(ensoniq, SERIAL)); in snd_ensoniq_chip_init()
1920 outl(ensoniq->dma_bug->addr, ES_REG(ensoniq, PHANTOM_FRAME)); in snd_ensoniq_chip_init()
1923 outl(ensoniq->ctrl, ES_REG(ensoniq, CONTROL)); in snd_ensoniq_chip_init()
1924 outl(ensoniq->sctrl, ES_REG(ensoniq, SERIAL)); in snd_ensoniq_chip_init()
1927 outl(ensoniq->cssr, ES_REG(ensoniq, STATUS)); in snd_ensoniq_chip_init()
1933 outl(ensoniq->ctrl | ES_1371_SYNC_RES, ES_REG(ensoniq, CONTROL)); in snd_ensoniq_chip_init()
1936 outl(ensoniq->ctrl, ES_REG(ensoniq, CONTROL)); in snd_ensoniq_chip_init()
1959 * power cycle) - Thomas Sailer in snd_ensoniq_chip_init()
1966 outb(ensoniq->uartc = 0x00, ES_REG(ensoniq, UART_CONTROL)); in snd_ensoniq_chip_init()
1968 outl(ensoniq->cssr, ES_REG(ensoniq, STATUS)); in snd_ensoniq_chip_init()
1975 struct ensoniq *ensoniq = card->private_data; in snd_ensoniq_suspend()
1980 snd_ac97_suspend(ensoniq->u.es1371.ac97); in snd_ensoniq_suspend()
1989 snd_ak4531_suspend(ensoniq->u.es1370.ak4531); in snd_ensoniq_suspend()
1997 struct ensoniq *ensoniq = card->private_data; in snd_ensoniq_resume()
2002 snd_ac97_resume(ensoniq->u.es1371.ac97); in snd_ensoniq_resume()
2004 snd_ak4531_resume(ensoniq->u.es1370.ak4531); in snd_ensoniq_resume()
2019 struct ensoniq *ensoniq = card->private_data; in snd_ensoniq_create()
2025 spin_lock_init(&ensoniq->reg_lock); in snd_ensoniq_create()
2026 mutex_init(&ensoniq->src_mutex); in snd_ensoniq_create()
2027 ensoniq->card = card; in snd_ensoniq_create()
2028 ensoniq->pci = pci; in snd_ensoniq_create()
2029 ensoniq->irq = -1; in snd_ensoniq_create()
2033 ensoniq->port = pci_resource_start(pci, 0); in snd_ensoniq_create()
2034 if (devm_request_irq(&pci->dev, pci->irq, snd_audiopci_interrupt, in snd_ensoniq_create()
2036 dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq); in snd_ensoniq_create()
2037 return -EBUSY; in snd_ensoniq_create()
2039 ensoniq->irq = pci->irq; in snd_ensoniq_create()
2040 card->sync_irq = ensoniq->irq; in snd_ensoniq_create()
2042 ensoniq->dma_bug = in snd_ensoniq_create()
2043 snd_devm_alloc_pages(&pci->dev, SNDRV_DMA_TYPE_DEV, 16); in snd_ensoniq_create()
2044 if (!ensoniq->dma_bug) in snd_ensoniq_create()
2045 return -ENOMEM; in snd_ensoniq_create()
2048 ensoniq->rev = pci->revision; in snd_ensoniq_create()
2051 ensoniq->ctrl = ES_1370_CDC_EN | ES_1370_SERR_DISABLE | in snd_ensoniq_create()
2054 ensoniq->ctrl = ES_1370_CDC_EN | ES_1370_PCLKDIVO(ES_1370_SRTODIV(8000)); in snd_ensoniq_create()
2056 ensoniq->sctrl = 0; in snd_ensoniq_create()
2058 ensoniq->ctrl = 0; in snd_ensoniq_create()
2059 ensoniq->sctrl = 0; in snd_ensoniq_create()
2060 ensoniq->cssr = 0; in snd_ensoniq_create()
2062 ensoniq->ctrl |= ES_1371_GPIO_OUT(1); /* turn amplifier on */ in snd_ensoniq_create()
2065 ensoniq->cssr |= ES_1371_ST_AC97_RST; in snd_ensoniq_create()
2068 card->private_free = snd_ensoniq_free; in snd_ensoniq_create()
2081 struct snd_rawmidi *rmidi = ensoniq->rmidi; in snd_ensoniq_midi_interrupt()
2087 spin_lock(&ensoniq->reg_lock); in snd_ensoniq_midi_interrupt()
2088 mask = ensoniq->uartm & ES_MODE_INPUT ? ES_RXRDY : 0; in snd_ensoniq_midi_interrupt()
2094 snd_rawmidi_receive(ensoniq->midi_input, &byte, 1); in snd_ensoniq_midi_interrupt()
2096 spin_unlock(&ensoniq->reg_lock); in snd_ensoniq_midi_interrupt()
2099 spin_lock(&ensoniq->reg_lock); in snd_ensoniq_midi_interrupt()
2100 mask = ensoniq->uartm & ES_MODE_OUTPUT ? ES_TXRDY : 0; in snd_ensoniq_midi_interrupt()
2105 if (snd_rawmidi_transmit(ensoniq->midi_output, &byte, 1) != 1) { in snd_ensoniq_midi_interrupt()
2106 ensoniq->uartc &= ~ES_TXINTENM; in snd_ensoniq_midi_interrupt()
2107 outb(ensoniq->uartc, ES_REG(ensoniq, UART_CONTROL)); in snd_ensoniq_midi_interrupt()
2113 spin_unlock(&ensoniq->reg_lock); in snd_ensoniq_midi_interrupt()
2118 struct ensoniq *ensoniq = substream->rmidi->private_data; in snd_ensoniq_midi_input_open()
2120 spin_lock_irq(&ensoniq->reg_lock); in snd_ensoniq_midi_input_open()
2121 ensoniq->uartm |= ES_MODE_INPUT; in snd_ensoniq_midi_input_open()
2122 ensoniq->midi_input = substream; in snd_ensoniq_midi_input_open()
2123 if (!(ensoniq->uartm & ES_MODE_OUTPUT)) { in snd_ensoniq_midi_input_open()
2125 outb(ensoniq->uartc = 0, ES_REG(ensoniq, UART_CONTROL)); in snd_ensoniq_midi_input_open()
2126 outl(ensoniq->ctrl |= ES_UART_EN, ES_REG(ensoniq, CONTROL)); in snd_ensoniq_midi_input_open()
2128 spin_unlock_irq(&ensoniq->reg_lock); in snd_ensoniq_midi_input_open()
2134 struct ensoniq *ensoniq = substream->rmidi->private_data; in snd_ensoniq_midi_input_close()
2136 spin_lock_irq(&ensoniq->reg_lock); in snd_ensoniq_midi_input_close()
2137 if (!(ensoniq->uartm & ES_MODE_OUTPUT)) { in snd_ensoniq_midi_input_close()
2138 outb(ensoniq->uartc = 0, ES_REG(ensoniq, UART_CONTROL)); in snd_ensoniq_midi_input_close()
2139 outl(ensoniq->ctrl &= ~ES_UART_EN, ES_REG(ensoniq, CONTROL)); in snd_ensoniq_midi_input_close()
2141 outb(ensoniq->uartc &= ~ES_RXINTEN, ES_REG(ensoniq, UART_CONTROL)); in snd_ensoniq_midi_input_close()
2143 ensoniq->midi_input = NULL; in snd_ensoniq_midi_input_close()
2144 ensoniq->uartm &= ~ES_MODE_INPUT; in snd_ensoniq_midi_input_close()
2145 spin_unlock_irq(&ensoniq->reg_lock); in snd_ensoniq_midi_input_close()
2151 struct ensoniq *ensoniq = substream->rmidi->private_data; in snd_ensoniq_midi_output_open()
2153 spin_lock_irq(&ensoniq->reg_lock); in snd_ensoniq_midi_output_open()
2154 ensoniq->uartm |= ES_MODE_OUTPUT; in snd_ensoniq_midi_output_open()
2155 ensoniq->midi_output = substream; in snd_ensoniq_midi_output_open()
2156 if (!(ensoniq->uartm & ES_MODE_INPUT)) { in snd_ensoniq_midi_output_open()
2158 outb(ensoniq->uartc = 0, ES_REG(ensoniq, UART_CONTROL)); in snd_ensoniq_midi_output_open()
2159 outl(ensoniq->ctrl |= ES_UART_EN, ES_REG(ensoniq, CONTROL)); in snd_ensoniq_midi_output_open()
2161 spin_unlock_irq(&ensoniq->reg_lock); in snd_ensoniq_midi_output_open()
2167 struct ensoniq *ensoniq = substream->rmidi->private_data; in snd_ensoniq_midi_output_close()
2169 spin_lock_irq(&ensoniq->reg_lock); in snd_ensoniq_midi_output_close()
2170 if (!(ensoniq->uartm & ES_MODE_INPUT)) { in snd_ensoniq_midi_output_close()
2171 outb(ensoniq->uartc = 0, ES_REG(ensoniq, UART_CONTROL)); in snd_ensoniq_midi_output_close()
2172 outl(ensoniq->ctrl &= ~ES_UART_EN, ES_REG(ensoniq, CONTROL)); in snd_ensoniq_midi_output_close()
2174 outb(ensoniq->uartc &= ~ES_TXINTENM, ES_REG(ensoniq, UART_CONTROL)); in snd_ensoniq_midi_output_close()
2176 ensoniq->midi_output = NULL; in snd_ensoniq_midi_output_close()
2177 ensoniq->uartm &= ~ES_MODE_OUTPUT; in snd_ensoniq_midi_output_close()
2178 spin_unlock_irq(&ensoniq->reg_lock); in snd_ensoniq_midi_output_close()
2185 struct ensoniq *ensoniq = substream->rmidi->private_data; in snd_ensoniq_midi_input_trigger()
2188 spin_lock_irqsave(&ensoniq->reg_lock, flags); in snd_ensoniq_midi_input_trigger()
2190 if ((ensoniq->uartc & ES_RXINTEN) == 0) { in snd_ensoniq_midi_input_trigger()
2194 ensoniq->uartc |= ES_RXINTEN; in snd_ensoniq_midi_input_trigger()
2195 outb(ensoniq->uartc, ES_REG(ensoniq, UART_CONTROL)); in snd_ensoniq_midi_input_trigger()
2198 if (ensoniq->uartc & ES_RXINTEN) { in snd_ensoniq_midi_input_trigger()
2199 ensoniq->uartc &= ~ES_RXINTEN; in snd_ensoniq_midi_input_trigger()
2200 outb(ensoniq->uartc, ES_REG(ensoniq, UART_CONTROL)); in snd_ensoniq_midi_input_trigger()
2203 spin_unlock_irqrestore(&ensoniq->reg_lock, flags); in snd_ensoniq_midi_input_trigger()
2209 struct ensoniq *ensoniq = substream->rmidi->private_data; in snd_ensoniq_midi_output_trigger()
2212 spin_lock_irqsave(&ensoniq->reg_lock, flags); in snd_ensoniq_midi_output_trigger()
2214 if (ES_TXINTENI(ensoniq->uartc) == 0) { in snd_ensoniq_midi_output_trigger()
2215 ensoniq->uartc |= ES_TXINTENO(1); in snd_ensoniq_midi_output_trigger()
2217 while (ES_TXINTENI(ensoniq->uartc) == 1 && in snd_ensoniq_midi_output_trigger()
2220 ensoniq->uartc &= ~ES_TXINTENM; in snd_ensoniq_midi_output_trigger()
2225 outb(ensoniq->uartc, ES_REG(ensoniq, UART_CONTROL)); in snd_ensoniq_midi_output_trigger()
2228 if (ES_TXINTENI(ensoniq->uartc) == 1) { in snd_ensoniq_midi_output_trigger()
2229 ensoniq->uartc &= ~ES_TXINTENM; in snd_ensoniq_midi_output_trigger()
2230 outb(ensoniq->uartc, ES_REG(ensoniq, UART_CONTROL)); in snd_ensoniq_midi_output_trigger()
2233 spin_unlock_irqrestore(&ensoniq->reg_lock, flags); in snd_ensoniq_midi_output_trigger()
2255 err = snd_rawmidi_new(ensoniq->card, "ES1370/1", device, 1, 1, &rmidi); in snd_ensoniq_midi()
2258 strcpy(rmidi->name, CHIP_NAME); in snd_ensoniq_midi()
2261 rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT | in snd_ensoniq_midi()
2263 rmidi->private_data = ensoniq; in snd_ensoniq_midi()
2264 ensoniq->rmidi = rmidi; in snd_ensoniq_midi()
2284 spin_lock(&ensoniq->reg_lock); in snd_audiopci_interrupt()
2285 sctrl = ensoniq->sctrl; in snd_audiopci_interrupt()
2293 outl(ensoniq->sctrl, ES_REG(ensoniq, SERIAL)); in snd_audiopci_interrupt()
2294 spin_unlock(&ensoniq->reg_lock); in snd_audiopci_interrupt()
2298 if ((status & ES_DAC2) && ensoniq->playback2_substream) in snd_audiopci_interrupt()
2299 snd_pcm_period_elapsed(ensoniq->playback2_substream); in snd_audiopci_interrupt()
2300 if ((status & ES_ADC) && ensoniq->capture_substream) in snd_audiopci_interrupt()
2301 snd_pcm_period_elapsed(ensoniq->capture_substream); in snd_audiopci_interrupt()
2302 if ((status & ES_DAC1) && ensoniq->playback1_substream) in snd_audiopci_interrupt()
2303 snd_pcm_period_elapsed(ensoniq->playback1_substream); in snd_audiopci_interrupt()
2316 return -ENODEV; in __snd_audiopci_probe()
2319 return -ENOENT; in __snd_audiopci_probe()
2322 err = snd_devm_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE, in __snd_audiopci_probe()
2326 ensoniq = card->private_data; in __snd_audiopci_probe()
2354 strcpy(card->driver, DRIVER_NAME); in __snd_audiopci_probe()
2356 strcpy(card->shortname, "Ensoniq AudioPCI"); in __snd_audiopci_probe()
2357 sprintf(card->longname, "%s %s at 0x%lx, irq %i", in __snd_audiopci_probe()
2358 card->shortname, in __snd_audiopci_probe()
2359 card->driver, in __snd_audiopci_probe()
2360 ensoniq->port, in __snd_audiopci_probe()
2361 ensoniq->irq); in __snd_audiopci_probe()
2375 return snd_card_free_on_error(&pci->dev, __snd_audiopci_probe(pci, pci_id)); in snd_audiopci_probe()