ensoniq           129 sound/pci/ens1370.c #define ES_REG(ensoniq, x) ((ensoniq)->port + ES_REG_##x)
ensoniq           504 sound/pci/ens1370.c static unsigned int snd_es1371_wait_src_ready(struct ensoniq * ensoniq)
ensoniq           509 sound/pci/ens1370.c 		r = inl(ES_REG(ensoniq, 1371_SMPRATE));
ensoniq           514 sound/pci/ens1370.c 	dev_err(ensoniq->card->dev, "wait src ready timeout 0x%lx [0x%x]\n",
ensoniq           515 sound/pci/ens1370.c 		   ES_REG(ensoniq, 1371_SMPRATE), r);
ensoniq           519 sound/pci/ens1370.c static unsigned int snd_es1371_src_read(struct ensoniq * ensoniq, unsigned short reg)
ensoniq           524 sound/pci/ens1370.c 	temp = orig = snd_es1371_wait_src_ready(ensoniq);
ensoniq           530 sound/pci/ens1370.c 	outl(r, ES_REG(ensoniq, 1371_SMPRATE));
ensoniq           533 sound/pci/ens1370.c 	temp = snd_es1371_wait_src_ready(ensoniq);
ensoniq           538 sound/pci/ens1370.c 			temp = inl(ES_REG(ensoniq, 1371_SMPRATE));
ensoniq           548 sound/pci/ens1370.c 	outl(r, ES_REG(ensoniq, 1371_SMPRATE));
ensoniq           553 sound/pci/ens1370.c static void snd_es1371_src_write(struct ensoniq * ensoniq,
ensoniq           558 sound/pci/ens1370.c 	r = snd_es1371_wait_src_ready(ensoniq) &
ensoniq           562 sound/pci/ens1370.c 	outl(r | ES_1371_SRC_RAM_WE, ES_REG(ensoniq, 1371_SMPRATE));
ensoniq           572 sound/pci/ens1370.c 	struct ensoniq *ensoniq = ak4531->private_data;
ensoniq           576 sound/pci/ens1370.c 	dev_dbg(ensoniq->card->dev,
ensoniq           578 sound/pci/ens1370.c 	       reg, val, ES_1370_CODEC_WRITE(reg, val), ES_REG(ensoniq, 1370_CODEC));
ensoniq           581 sound/pci/ens1370.c 		if (!(inl(ES_REG(ensoniq, STATUS)) & ES_1370_CSTAT)) {
ensoniq           582 sound/pci/ens1370.c 			outw(ES_1370_CODEC_WRITE(reg, val), ES_REG(ensoniq, 1370_CODEC));
ensoniq           587 sound/pci/ens1370.c 	dev_err(ensoniq->card->dev, "codec write timeout, status = 0x%x\n",
ensoniq           588 sound/pci/ens1370.c 		   inl(ES_REG(ensoniq, STATUS)));
ensoniq           595 sound/pci/ens1370.c static inline bool is_ev1938(struct ensoniq *ensoniq)
ensoniq           597 sound/pci/ens1370.c 	return ensoniq->pci->device == 0x8938;
ensoniq           603 sound/pci/ens1370.c 	struct ensoniq *ensoniq = ac97->private_data;
ensoniq           606 sound/pci/ens1370.c 	flag = is_ev1938(ensoniq) ? EV_1938_CODEC_MAGIC : 0;
ensoniq           607 sound/pci/ens1370.c 	mutex_lock(&ensoniq->src_mutex);
ensoniq           609 sound/pci/ens1370.c 		if (!(inl(ES_REG(ensoniq, 1371_CODEC)) & ES_1371_CODEC_WIP)) {
ensoniq           611 sound/pci/ens1370.c 			x = snd_es1371_wait_src_ready(ensoniq);
ensoniq           614 sound/pci/ens1370.c 			     ES_REG(ensoniq, 1371_SMPRATE));
ensoniq           618 sound/pci/ens1370.c 				if ((inl(ES_REG(ensoniq, 1371_SMPRATE)) & 0x00870000) ==
ensoniq           624 sound/pci/ens1370.c 				if ((inl(ES_REG(ensoniq, 1371_SMPRATE)) & 0x00870000) ==
ensoniq           629 sound/pci/ens1370.c 			     ES_REG(ensoniq, 1371_CODEC));
ensoniq           631 sound/pci/ens1370.c 			snd_es1371_wait_src_ready(ensoniq);
ensoniq           632 sound/pci/ens1370.c 			outl(x, ES_REG(ensoniq, 1371_SMPRATE));
ensoniq           633 sound/pci/ens1370.c 			mutex_unlock(&ensoniq->src_mutex);
ensoniq           637 sound/pci/ens1370.c 	mutex_unlock(&ensoniq->src_mutex);
ensoniq           638 sound/pci/ens1370.c 	dev_err(ensoniq->card->dev, "codec write timeout at 0x%lx [0x%x]\n",
ensoniq           639 sound/pci/ens1370.c 		   ES_REG(ensoniq, 1371_CODEC), inl(ES_REG(ensoniq, 1371_CODEC)));
ensoniq           645 sound/pci/ens1370.c 	struct ensoniq *ensoniq = ac97->private_data;
ensoniq           648 sound/pci/ens1370.c 	flag = is_ev1938(ensoniq) ? EV_1938_CODEC_MAGIC : 0;
ensoniq           650 sound/pci/ens1370.c 	mutex_lock(&ensoniq->src_mutex);
ensoniq           652 sound/pci/ens1370.c 		if (!(inl(ES_REG(ensoniq, 1371_CODEC)) & ES_1371_CODEC_WIP)) {
ensoniq           654 sound/pci/ens1370.c 			x = snd_es1371_wait_src_ready(ensoniq);
ensoniq           657 sound/pci/ens1370.c 			     ES_REG(ensoniq, 1371_SMPRATE));
ensoniq           661 sound/pci/ens1370.c 				if ((inl(ES_REG(ensoniq, 1371_SMPRATE)) & 0x00870000) ==
ensoniq           667 sound/pci/ens1370.c 				if ((inl(ES_REG(ensoniq, 1371_SMPRATE)) & 0x00870000) ==
ensoniq           672 sound/pci/ens1370.c 			     ES_REG(ensoniq, 1371_CODEC));
ensoniq           674 sound/pci/ens1370.c 			snd_es1371_wait_src_ready(ensoniq);
ensoniq           675 sound/pci/ens1370.c 			outl(x, ES_REG(ensoniq, 1371_SMPRATE));
ensoniq           678 sound/pci/ens1370.c 				if (!(inl(ES_REG(ensoniq, 1371_CODEC)) & ES_1371_CODEC_WIP))
ensoniq           683 sound/pci/ens1370.c 				if ((x = inl(ES_REG(ensoniq, 1371_CODEC))) & ES_1371_CODEC_RDY) {
ensoniq           684 sound/pci/ens1370.c 					if (is_ev1938(ensoniq)) {
ensoniq           686 sound/pci/ens1370.c 							inl(ES_REG(ensoniq, CONTROL));
ensoniq           687 sound/pci/ens1370.c 						x = inl(ES_REG(ensoniq, 1371_CODEC));
ensoniq           689 sound/pci/ens1370.c 					mutex_unlock(&ensoniq->src_mutex);
ensoniq           693 sound/pci/ens1370.c 			mutex_unlock(&ensoniq->src_mutex);
ensoniq           695 sound/pci/ens1370.c 				dev_err(ensoniq->card->dev,
ensoniq           697 sound/pci/ens1370.c 					   ES_REG(ensoniq, 1371_CODEC), reg,
ensoniq           698 sound/pci/ens1370.c 					   inl(ES_REG(ensoniq, 1371_CODEC)));
ensoniq           704 sound/pci/ens1370.c 	mutex_unlock(&ensoniq->src_mutex);
ensoniq           705 sound/pci/ens1370.c 	dev_err(ensoniq->card->dev, "codec read timeout at 0x%lx [0x%x]\n",
ensoniq           706 sound/pci/ens1370.c 		   ES_REG(ensoniq, 1371_CODEC), inl(ES_REG(ensoniq, 1371_CODEC)));
ensoniq           719 sound/pci/ens1370.c static void snd_es1371_adc_rate(struct ensoniq * ensoniq, unsigned int rate)
ensoniq           723 sound/pci/ens1370.c 	mutex_lock(&ensoniq->src_mutex);
ensoniq           732 sound/pci/ens1370.c 		snd_es1371_src_write(ensoniq, ES_SMPREG_ADC + ES_SMPREG_TRUNC_N,
ensoniq           737 sound/pci/ens1370.c 		snd_es1371_src_write(ensoniq, ES_SMPREG_ADC + ES_SMPREG_TRUNC_N,
ensoniq           740 sound/pci/ens1370.c 	snd_es1371_src_write(ensoniq, ES_SMPREG_ADC + ES_SMPREG_INT_REGS,
ensoniq           741 sound/pci/ens1370.c 			     (snd_es1371_src_read(ensoniq, ES_SMPREG_ADC +
ensoniq           744 sound/pci/ens1370.c 	snd_es1371_src_write(ensoniq, ES_SMPREG_ADC + ES_SMPREG_VFREQ_FRAC, freq & 0x7fff);
ensoniq           745 sound/pci/ens1370.c 	snd_es1371_src_write(ensoniq, ES_SMPREG_VOL_ADC, n << 8);
ensoniq           746 sound/pci/ens1370.c 	snd_es1371_src_write(ensoniq, ES_SMPREG_VOL_ADC + 1, n << 8);
ensoniq           747 sound/pci/ens1370.c 	mutex_unlock(&ensoniq->src_mutex);
ensoniq           750 sound/pci/ens1370.c static void snd_es1371_dac1_rate(struct ensoniq * ensoniq, unsigned int rate)
ensoniq           754 sound/pci/ens1370.c 	mutex_lock(&ensoniq->src_mutex);
ensoniq           756 sound/pci/ens1370.c 	r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE |
ensoniq           759 sound/pci/ens1370.c 	outl(r, ES_REG(ensoniq, 1371_SMPRATE));
ensoniq           760 sound/pci/ens1370.c 	snd_es1371_src_write(ensoniq, ES_SMPREG_DAC1 + ES_SMPREG_INT_REGS,
ensoniq           761 sound/pci/ens1370.c 			     (snd_es1371_src_read(ensoniq, ES_SMPREG_DAC1 +
ensoniq           764 sound/pci/ens1370.c 	snd_es1371_src_write(ensoniq, ES_SMPREG_DAC1 + ES_SMPREG_VFREQ_FRAC, freq & 0x7fff);
ensoniq           765 sound/pci/ens1370.c 	r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE |
ensoniq           767 sound/pci/ens1370.c 	outl(r, ES_REG(ensoniq, 1371_SMPRATE));
ensoniq           768 sound/pci/ens1370.c 	mutex_unlock(&ensoniq->src_mutex);
ensoniq           771 sound/pci/ens1370.c static void snd_es1371_dac2_rate(struct ensoniq * ensoniq, unsigned int rate)
ensoniq           775 sound/pci/ens1370.c 	mutex_lock(&ensoniq->src_mutex);
ensoniq           777 sound/pci/ens1370.c 	r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE |
ensoniq           780 sound/pci/ens1370.c 	outl(r, ES_REG(ensoniq, 1371_SMPRATE));
ensoniq           781 sound/pci/ens1370.c 	snd_es1371_src_write(ensoniq, ES_SMPREG_DAC2 + ES_SMPREG_INT_REGS,
ensoniq           782 sound/pci/ens1370.c 			     (snd_es1371_src_read(ensoniq, ES_SMPREG_DAC2 +
ensoniq           785 sound/pci/ens1370.c 	snd_es1371_src_write(ensoniq, ES_SMPREG_DAC2 + ES_SMPREG_VFREQ_FRAC,
ensoniq           787 sound/pci/ens1370.c 	r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE |
ensoniq           789 sound/pci/ens1370.c 	outl(r, ES_REG(ensoniq, 1371_SMPRATE));
ensoniq           790 sound/pci/ens1370.c 	mutex_unlock(&ensoniq->src_mutex);
ensoniq           797 sound/pci/ens1370.c 	struct ensoniq *ensoniq = snd_pcm_substream_chip(substream);
ensoniq           805 sound/pci/ens1370.c 			if (s == ensoniq->playback1_substream) {
ensoniq           808 sound/pci/ens1370.c 			} else if (s == ensoniq->playback2_substream) {
ensoniq           811 sound/pci/ens1370.c 			} else if (s == ensoniq->capture_substream)
ensoniq           814 sound/pci/ens1370.c 		spin_lock(&ensoniq->reg_lock);
ensoniq           816 sound/pci/ens1370.c 			ensoniq->sctrl |= what;
ensoniq           818 sound/pci/ens1370.c 			ensoniq->sctrl &= ~what;
ensoniq           819 sound/pci/ens1370.c 		outl(ensoniq->sctrl, ES_REG(ensoniq, SERIAL));
ensoniq           820 sound/pci/ens1370.c 		spin_unlock(&ensoniq->reg_lock);
ensoniq           829 sound/pci/ens1370.c 			if (s == ensoniq->playback1_substream) {
ensoniq           832 sound/pci/ens1370.c 			} else if (s == ensoniq->playback2_substream) {
ensoniq           835 sound/pci/ens1370.c 			} else if (s == ensoniq->capture_substream) {
ensoniq           840 sound/pci/ens1370.c 		spin_lock(&ensoniq->reg_lock);
ensoniq           842 sound/pci/ens1370.c 			ensoniq->ctrl |= what;
ensoniq           844 sound/pci/ens1370.c 			ensoniq->ctrl &= ~what;
ensoniq           845 sound/pci/ens1370.c 		outl(ensoniq->ctrl, ES_REG(ensoniq, CONTROL));
ensoniq           846 sound/pci/ens1370.c 		spin_unlock(&ensoniq->reg_lock);
ensoniq           872 sound/pci/ens1370.c 	struct ensoniq *ensoniq = snd_pcm_substream_chip(substream);
ensoniq           876 sound/pci/ens1370.c 	ensoniq->p1_dma_size = snd_pcm_lib_buffer_bytes(substream);
ensoniq           877 sound/pci/ens1370.c 	ensoniq->p1_period_size = snd_pcm_lib_period_bytes(substream);
ensoniq           882 sound/pci/ens1370.c 	spin_lock_irq(&ensoniq->reg_lock);
ensoniq           883 sound/pci/ens1370.c 	ensoniq->ctrl &= ~ES_DAC1_EN;
ensoniq           887 sound/pci/ens1370.c 		ensoniq->ctrl |= ES_1373_BYPASS_P1;
ensoniq           889 sound/pci/ens1370.c 		ensoniq->ctrl &= ~ES_1373_BYPASS_P1;
ensoniq           891 sound/pci/ens1370.c 	outl(ensoniq->ctrl, ES_REG(ensoniq, CONTROL));
ensoniq           892 sound/pci/ens1370.c 	outl(ES_MEM_PAGEO(ES_PAGE_DAC), ES_REG(ensoniq, MEM_PAGE));
ensoniq           893 sound/pci/ens1370.c 	outl(runtime->dma_addr, ES_REG(ensoniq, DAC1_FRAME));
ensoniq           894 sound/pci/ens1370.c 	outl((ensoniq->p1_dma_size >> 2) - 1, ES_REG(ensoniq, DAC1_SIZE));
ensoniq           895 sound/pci/ens1370.c 	ensoniq->sctrl &= ~(ES_P1_LOOP_SEL | ES_P1_PAUSE | ES_P1_SCT_RLD | ES_P1_MODEM);
ensoniq           896 sound/pci/ens1370.c 	ensoniq->sctrl |= ES_P1_INT_EN | ES_P1_MODEO(mode);
ensoniq           897 sound/pci/ens1370.c 	outl(ensoniq->sctrl, ES_REG(ensoniq, SERIAL));
ensoniq           898 sound/pci/ens1370.c 	outl((ensoniq->p1_period_size >> snd_ensoniq_sample_shift[mode]) - 1,
ensoniq           899 sound/pci/ens1370.c 	     ES_REG(ensoniq, DAC1_COUNT));
ensoniq           901 sound/pci/ens1370.c 	ensoniq->ctrl &= ~ES_1370_WTSRSELM;
ensoniq           903 sound/pci/ens1370.c 	case 5512: ensoniq->ctrl |= ES_1370_WTSRSEL(0); break;
ensoniq           904 sound/pci/ens1370.c 	case 11025: ensoniq->ctrl |= ES_1370_WTSRSEL(1); break;
ensoniq           905 sound/pci/ens1370.c 	case 22050: ensoniq->ctrl |= ES_1370_WTSRSEL(2); break;
ensoniq           906 sound/pci/ens1370.c 	case 44100: ensoniq->ctrl |= ES_1370_WTSRSEL(3); break;
ensoniq           910 sound/pci/ens1370.c 	outl(ensoniq->ctrl, ES_REG(ensoniq, CONTROL));
ensoniq           911 sound/pci/ens1370.c 	spin_unlock_irq(&ensoniq->reg_lock);
ensoniq           913 sound/pci/ens1370.c 	snd_es1371_dac1_rate(ensoniq, runtime->rate);
ensoniq           920 sound/pci/ens1370.c 	struct ensoniq *ensoniq = snd_pcm_substream_chip(substream);
ensoniq           924 sound/pci/ens1370.c 	ensoniq->p2_dma_size = snd_pcm_lib_buffer_bytes(substream);
ensoniq           925 sound/pci/ens1370.c 	ensoniq->p2_period_size = snd_pcm_lib_period_bytes(substream);
ensoniq           930 sound/pci/ens1370.c 	spin_lock_irq(&ensoniq->reg_lock);
ensoniq           931 sound/pci/ens1370.c 	ensoniq->ctrl &= ~ES_DAC2_EN;
ensoniq           932 sound/pci/ens1370.c 	outl(ensoniq->ctrl, ES_REG(ensoniq, CONTROL));
ensoniq           933 sound/pci/ens1370.c 	outl(ES_MEM_PAGEO(ES_PAGE_DAC), ES_REG(ensoniq, MEM_PAGE));
ensoniq           934 sound/pci/ens1370.c 	outl(runtime->dma_addr, ES_REG(ensoniq, DAC2_FRAME));
ensoniq           935 sound/pci/ens1370.c 	outl((ensoniq->p2_dma_size >> 2) - 1, ES_REG(ensoniq, DAC2_SIZE));
ensoniq           936 sound/pci/ens1370.c 	ensoniq->sctrl &= ~(ES_P2_LOOP_SEL | ES_P2_PAUSE | ES_P2_DAC_SEN |
ensoniq           938 sound/pci/ens1370.c 	ensoniq->sctrl |= ES_P2_INT_EN | ES_P2_MODEO(mode) |
ensoniq           940 sound/pci/ens1370.c 	outl(ensoniq->sctrl, ES_REG(ensoniq, SERIAL));
ensoniq           941 sound/pci/ens1370.c 	outl((ensoniq->p2_period_size >> snd_ensoniq_sample_shift[mode]) - 1,
ensoniq           942 sound/pci/ens1370.c 	     ES_REG(ensoniq, DAC2_COUNT));
ensoniq           944 sound/pci/ens1370.c 	if (!(ensoniq->u.es1370.pclkdiv_lock & ES_MODE_CAPTURE)) {
ensoniq           945 sound/pci/ens1370.c 		ensoniq->ctrl &= ~ES_1370_PCLKDIVM;
ensoniq           946 sound/pci/ens1370.c 		ensoniq->ctrl |= ES_1370_PCLKDIVO(ES_1370_SRTODIV(runtime->rate));
ensoniq           947 sound/pci/ens1370.c 		ensoniq->u.es1370.pclkdiv_lock |= ES_MODE_PLAY2;
ensoniq           950 sound/pci/ens1370.c 	outl(ensoniq->ctrl, ES_REG(ensoniq, CONTROL));
ensoniq           951 sound/pci/ens1370.c 	spin_unlock_irq(&ensoniq->reg_lock);
ensoniq           953 sound/pci/ens1370.c 	snd_es1371_dac2_rate(ensoniq, runtime->rate);
ensoniq           960 sound/pci/ens1370.c 	struct ensoniq *ensoniq = snd_pcm_substream_chip(substream);
ensoniq           964 sound/pci/ens1370.c 	ensoniq->c_dma_size = snd_pcm_lib_buffer_bytes(substream);
ensoniq           965 sound/pci/ens1370.c 	ensoniq->c_period_size = snd_pcm_lib_period_bytes(substream);
ensoniq           970 sound/pci/ens1370.c 	spin_lock_irq(&ensoniq->reg_lock);
ensoniq           971 sound/pci/ens1370.c 	ensoniq->ctrl &= ~ES_ADC_EN;
ensoniq           972 sound/pci/ens1370.c 	outl(ensoniq->ctrl, ES_REG(ensoniq, CONTROL));
ensoniq           973 sound/pci/ens1370.c 	outl(ES_MEM_PAGEO(ES_PAGE_ADC), ES_REG(ensoniq, MEM_PAGE));
ensoniq           974 sound/pci/ens1370.c 	outl(runtime->dma_addr, ES_REG(ensoniq, ADC_FRAME));
ensoniq           975 sound/pci/ens1370.c 	outl((ensoniq->c_dma_size >> 2) - 1, ES_REG(ensoniq, ADC_SIZE));
ensoniq           976 sound/pci/ens1370.c 	ensoniq->sctrl &= ~(ES_R1_LOOP_SEL | ES_R1_MODEM);
ensoniq           977 sound/pci/ens1370.c 	ensoniq->sctrl |= ES_R1_INT_EN | ES_R1_MODEO(mode);
ensoniq           978 sound/pci/ens1370.c 	outl(ensoniq->sctrl, ES_REG(ensoniq, SERIAL));
ensoniq           979 sound/pci/ens1370.c 	outl((ensoniq->c_period_size >> snd_ensoniq_sample_shift[mode]) - 1,
ensoniq           980 sound/pci/ens1370.c 	     ES_REG(ensoniq, ADC_COUNT));
ensoniq           982 sound/pci/ens1370.c 	if (!(ensoniq->u.es1370.pclkdiv_lock & ES_MODE_PLAY2)) {
ensoniq           983 sound/pci/ens1370.c 		ensoniq->ctrl &= ~ES_1370_PCLKDIVM;
ensoniq           984 sound/pci/ens1370.c 		ensoniq->ctrl |= ES_1370_PCLKDIVO(ES_1370_SRTODIV(runtime->rate));
ensoniq           985 sound/pci/ens1370.c 		ensoniq->u.es1370.pclkdiv_lock |= ES_MODE_CAPTURE;
ensoniq           988 sound/pci/ens1370.c 	outl(ensoniq->ctrl, ES_REG(ensoniq, CONTROL));
ensoniq           989 sound/pci/ens1370.c 	spin_unlock_irq(&ensoniq->reg_lock);
ensoniq           991 sound/pci/ens1370.c 	snd_es1371_adc_rate(ensoniq, runtime->rate);
ensoniq           998 sound/pci/ens1370.c 	struct ensoniq *ensoniq = snd_pcm_substream_chip(substream);
ensoniq          1001 sound/pci/ens1370.c 	spin_lock(&ensoniq->reg_lock);
ensoniq          1002 sound/pci/ens1370.c 	if (inl(ES_REG(ensoniq, CONTROL)) & ES_DAC1_EN) {
ensoniq          1003 sound/pci/ens1370.c 		outl(ES_MEM_PAGEO(ES_PAGE_DAC), ES_REG(ensoniq, MEM_PAGE));
ensoniq          1004 sound/pci/ens1370.c 		ptr = ES_REG_FCURR_COUNTI(inl(ES_REG(ensoniq, DAC1_SIZE)));
ensoniq          1009 sound/pci/ens1370.c 	spin_unlock(&ensoniq->reg_lock);
ensoniq          1015 sound/pci/ens1370.c 	struct ensoniq *ensoniq = snd_pcm_substream_chip(substream);
ensoniq          1018 sound/pci/ens1370.c 	spin_lock(&ensoniq->reg_lock);
ensoniq          1019 sound/pci/ens1370.c 	if (inl(ES_REG(ensoniq, CONTROL)) & ES_DAC2_EN) {
ensoniq          1020 sound/pci/ens1370.c 		outl(ES_MEM_PAGEO(ES_PAGE_DAC), ES_REG(ensoniq, MEM_PAGE));
ensoniq          1021 sound/pci/ens1370.c 		ptr = ES_REG_FCURR_COUNTI(inl(ES_REG(ensoniq, DAC2_SIZE)));
ensoniq          1026 sound/pci/ens1370.c 	spin_unlock(&ensoniq->reg_lock);
ensoniq          1032 sound/pci/ens1370.c 	struct ensoniq *ensoniq = snd_pcm_substream_chip(substream);
ensoniq          1035 sound/pci/ens1370.c 	spin_lock(&ensoniq->reg_lock);
ensoniq          1036 sound/pci/ens1370.c 	if (inl(ES_REG(ensoniq, CONTROL)) & ES_ADC_EN) {
ensoniq          1037 sound/pci/ens1370.c 		outl(ES_MEM_PAGEO(ES_PAGE_ADC), ES_REG(ensoniq, MEM_PAGE));
ensoniq          1038 sound/pci/ens1370.c 		ptr = ES_REG_FCURR_COUNTI(inl(ES_REG(ensoniq, ADC_SIZE)));
ensoniq          1043 sound/pci/ens1370.c 	spin_unlock(&ensoniq->reg_lock);
ensoniq          1115 sound/pci/ens1370.c 	struct ensoniq *ensoniq = snd_pcm_substream_chip(substream);
ensoniq          1118 sound/pci/ens1370.c 	ensoniq->mode |= ES_MODE_PLAY1;
ensoniq          1119 sound/pci/ens1370.c 	ensoniq->playback1_substream = substream;
ensoniq          1122 sound/pci/ens1370.c 	spin_lock_irq(&ensoniq->reg_lock);
ensoniq          1123 sound/pci/ens1370.c 	if (ensoniq->spdif && ensoniq->playback2_substream == NULL)
ensoniq          1124 sound/pci/ens1370.c 		ensoniq->spdif_stream = ensoniq->spdif_default;
ensoniq          1125 sound/pci/ens1370.c 	spin_unlock_irq(&ensoniq->reg_lock);
ensoniq          1138 sound/pci/ens1370.c 	struct ensoniq *ensoniq = snd_pcm_substream_chip(substream);
ensoniq          1141 sound/pci/ens1370.c 	ensoniq->mode |= ES_MODE_PLAY2;
ensoniq          1142 sound/pci/ens1370.c 	ensoniq->playback2_substream = substream;
ensoniq          1145 sound/pci/ens1370.c 	spin_lock_irq(&ensoniq->reg_lock);
ensoniq          1146 sound/pci/ens1370.c 	if (ensoniq->spdif && ensoniq->playback1_substream == NULL)
ensoniq          1147 sound/pci/ens1370.c 		ensoniq->spdif_stream = ensoniq->spdif_default;
ensoniq          1148 sound/pci/ens1370.c 	spin_unlock_irq(&ensoniq->reg_lock);
ensoniq          1161 sound/pci/ens1370.c 	struct ensoniq *ensoniq = snd_pcm_substream_chip(substream);
ensoniq          1164 sound/pci/ens1370.c 	ensoniq->mode |= ES_MODE_CAPTURE;
ensoniq          1165 sound/pci/ens1370.c 	ensoniq->capture_substream = substream;
ensoniq          1180 sound/pci/ens1370.c 	struct ensoniq *ensoniq = snd_pcm_substream_chip(substream);
ensoniq          1182 sound/pci/ens1370.c 	ensoniq->playback1_substream = NULL;
ensoniq          1183 sound/pci/ens1370.c 	ensoniq->mode &= ~ES_MODE_PLAY1;
ensoniq          1189 sound/pci/ens1370.c 	struct ensoniq *ensoniq = snd_pcm_substream_chip(substream);
ensoniq          1191 sound/pci/ens1370.c 	ensoniq->playback2_substream = NULL;
ensoniq          1192 sound/pci/ens1370.c 	spin_lock_irq(&ensoniq->reg_lock);
ensoniq          1194 sound/pci/ens1370.c 	ensoniq->u.es1370.pclkdiv_lock &= ~ES_MODE_PLAY2;
ensoniq          1196 sound/pci/ens1370.c 	ensoniq->mode &= ~ES_MODE_PLAY2;
ensoniq          1197 sound/pci/ens1370.c 	spin_unlock_irq(&ensoniq->reg_lock);
ensoniq          1203 sound/pci/ens1370.c 	struct ensoniq *ensoniq = snd_pcm_substream_chip(substream);
ensoniq          1205 sound/pci/ens1370.c 	ensoniq->capture_substream = NULL;
ensoniq          1206 sound/pci/ens1370.c 	spin_lock_irq(&ensoniq->reg_lock);
ensoniq          1208 sound/pci/ens1370.c 	ensoniq->u.es1370.pclkdiv_lock &= ~ES_MODE_CAPTURE;
ensoniq          1210 sound/pci/ens1370.c 	ensoniq->mode &= ~ES_MODE_CAPTURE;
ensoniq          1211 sound/pci/ens1370.c 	spin_unlock_irq(&ensoniq->reg_lock);
ensoniq          1256 sound/pci/ens1370.c static int snd_ensoniq_pcm(struct ensoniq *ensoniq, int device)
ensoniq          1261 sound/pci/ens1370.c 	err = snd_pcm_new(ensoniq->card, CHIP_NAME "/1", device, 1, 1, &pcm);
ensoniq          1272 sound/pci/ens1370.c 	pcm->private_data = ensoniq;
ensoniq          1275 sound/pci/ens1370.c 	ensoniq->pcm1 = pcm;
ensoniq          1278 sound/pci/ens1370.c 					      snd_dma_pci_data(ensoniq->pci), 64*1024, 128*1024);
ensoniq          1290 sound/pci/ens1370.c static int snd_ensoniq_pcm2(struct ensoniq *ensoniq, int device)
ensoniq          1295 sound/pci/ens1370.c 	err = snd_pcm_new(ensoniq->card, CHIP_NAME "/2", device, 1, 0, &pcm);
ensoniq          1304 sound/pci/ens1370.c 	pcm->private_data = ensoniq;
ensoniq          1307 sound/pci/ens1370.c 	ensoniq->pcm2 = pcm;
ensoniq          1310 sound/pci/ens1370.c 					      snd_dma_pci_data(ensoniq->pci), 64*1024, 128*1024);
ensoniq          1341 sound/pci/ens1370.c 	struct ensoniq *ensoniq = snd_kcontrol_chip(kcontrol);
ensoniq          1342 sound/pci/ens1370.c 	spin_lock_irq(&ensoniq->reg_lock);
ensoniq          1343 sound/pci/ens1370.c 	ucontrol->value.iec958.status[0] = (ensoniq->spdif_default >> 0) & 0xff;
ensoniq          1344 sound/pci/ens1370.c 	ucontrol->value.iec958.status[1] = (ensoniq->spdif_default >> 8) & 0xff;
ensoniq          1345 sound/pci/ens1370.c 	ucontrol->value.iec958.status[2] = (ensoniq->spdif_default >> 16) & 0xff;
ensoniq          1346 sound/pci/ens1370.c 	ucontrol->value.iec958.status[3] = (ensoniq->spdif_default >> 24) & 0xff;
ensoniq          1347 sound/pci/ens1370.c 	spin_unlock_irq(&ensoniq->reg_lock);
ensoniq          1354 sound/pci/ens1370.c 	struct ensoniq *ensoniq = snd_kcontrol_chip(kcontrol);
ensoniq          1362 sound/pci/ens1370.c 	spin_lock_irq(&ensoniq->reg_lock);
ensoniq          1363 sound/pci/ens1370.c 	change = ensoniq->spdif_default != val;
ensoniq          1364 sound/pci/ens1370.c 	ensoniq->spdif_default = val;
ensoniq          1365 sound/pci/ens1370.c 	if (change && ensoniq->playback1_substream == NULL &&
ensoniq          1366 sound/pci/ens1370.c 	    ensoniq->playback2_substream == NULL)
ensoniq          1367 sound/pci/ens1370.c 		outl(val, ES_REG(ensoniq, CHANNEL_STATUS));
ensoniq          1368 sound/pci/ens1370.c 	spin_unlock_irq(&ensoniq->reg_lock);
ensoniq          1385 sound/pci/ens1370.c 	struct ensoniq *ensoniq = snd_kcontrol_chip(kcontrol);
ensoniq          1386 sound/pci/ens1370.c 	spin_lock_irq(&ensoniq->reg_lock);
ensoniq          1387 sound/pci/ens1370.c 	ucontrol->value.iec958.status[0] = (ensoniq->spdif_stream >> 0) & 0xff;
ensoniq          1388 sound/pci/ens1370.c 	ucontrol->value.iec958.status[1] = (ensoniq->spdif_stream >> 8) & 0xff;
ensoniq          1389 sound/pci/ens1370.c 	ucontrol->value.iec958.status[2] = (ensoniq->spdif_stream >> 16) & 0xff;
ensoniq          1390 sound/pci/ens1370.c 	ucontrol->value.iec958.status[3] = (ensoniq->spdif_stream >> 24) & 0xff;
ensoniq          1391 sound/pci/ens1370.c 	spin_unlock_irq(&ensoniq->reg_lock);
ensoniq          1398 sound/pci/ens1370.c 	struct ensoniq *ensoniq = snd_kcontrol_chip(kcontrol);
ensoniq          1406 sound/pci/ens1370.c 	spin_lock_irq(&ensoniq->reg_lock);
ensoniq          1407 sound/pci/ens1370.c 	change = ensoniq->spdif_stream != val;
ensoniq          1408 sound/pci/ens1370.c 	ensoniq->spdif_stream = val;
ensoniq          1409 sound/pci/ens1370.c 	if (change && (ensoniq->playback1_substream != NULL ||
ensoniq          1410 sound/pci/ens1370.c 		       ensoniq->playback2_substream != NULL))
ensoniq          1411 sound/pci/ens1370.c 		outl(val, ES_REG(ensoniq, CHANNEL_STATUS));
ensoniq          1412 sound/pci/ens1370.c 	spin_unlock_irq(&ensoniq->reg_lock);
ensoniq          1425 sound/pci/ens1370.c 	struct ensoniq *ensoniq = snd_kcontrol_chip(kcontrol);
ensoniq          1427 sound/pci/ens1370.c 	spin_lock_irq(&ensoniq->reg_lock);
ensoniq          1428 sound/pci/ens1370.c 	ucontrol->value.integer.value[0] = ensoniq->ctrl & ES_1373_SPDIF_THRU ? 1 : 0;
ensoniq          1429 sound/pci/ens1370.c 	spin_unlock_irq(&ensoniq->reg_lock);
ensoniq          1436 sound/pci/ens1370.c 	struct ensoniq *ensoniq = snd_kcontrol_chip(kcontrol);
ensoniq          1442 sound/pci/ens1370.c 	spin_lock_irq(&ensoniq->reg_lock);
ensoniq          1443 sound/pci/ens1370.c 	change = (ensoniq->ctrl & ES_1373_SPDIF_THRU) != nval1;
ensoniq          1444 sound/pci/ens1370.c 	ensoniq->ctrl &= ~ES_1373_SPDIF_THRU;
ensoniq          1445 sound/pci/ens1370.c 	ensoniq->ctrl |= nval1;
ensoniq          1446 sound/pci/ens1370.c 	ensoniq->cssr &= ~ES_1373_SPDIF_EN;
ensoniq          1447 sound/pci/ens1370.c 	ensoniq->cssr |= nval2;
ensoniq          1448 sound/pci/ens1370.c 	outl(ensoniq->ctrl, ES_REG(ensoniq, CONTROL));
ensoniq          1449 sound/pci/ens1370.c 	outl(ensoniq->cssr, ES_REG(ensoniq, STATUS));
ensoniq          1450 sound/pci/ens1370.c 	spin_unlock_irq(&ensoniq->reg_lock);
ensoniq          1487 sound/pci/ens1370.c 	struct ensoniq *ensoniq = snd_kcontrol_chip(kcontrol);
ensoniq          1490 sound/pci/ens1370.c 	spin_lock_irq(&ensoniq->reg_lock);
ensoniq          1491 sound/pci/ens1370.c 	if ((ensoniq->cssr & (ES_1373_REAR_BIT27|ES_1373_REAR_BIT26|
ensoniq          1495 sound/pci/ens1370.c 	spin_unlock_irq(&ensoniq->reg_lock);
ensoniq          1502 sound/pci/ens1370.c 	struct ensoniq *ensoniq = snd_kcontrol_chip(kcontrol);
ensoniq          1508 sound/pci/ens1370.c 	spin_lock_irq(&ensoniq->reg_lock);
ensoniq          1509 sound/pci/ens1370.c 	change = (ensoniq->cssr & (ES_1373_REAR_BIT27|
ensoniq          1511 sound/pci/ens1370.c 	ensoniq->cssr &= ~(ES_1373_REAR_BIT27|ES_1373_REAR_BIT26|ES_1373_REAR_BIT24);
ensoniq          1512 sound/pci/ens1370.c 	ensoniq->cssr |= nval1;
ensoniq          1513 sound/pci/ens1370.c 	outl(ensoniq->cssr, ES_REG(ensoniq, STATUS));
ensoniq          1514 sound/pci/ens1370.c 	spin_unlock_irq(&ensoniq->reg_lock);
ensoniq          1532 sound/pci/ens1370.c 	struct ensoniq *ensoniq = snd_kcontrol_chip(kcontrol);
ensoniq          1535 sound/pci/ens1370.c 	spin_lock_irq(&ensoniq->reg_lock);
ensoniq          1536 sound/pci/ens1370.c 	if (ensoniq->ctrl & ES_1371_GPIO_OUT(4))
ensoniq          1539 sound/pci/ens1370.c 	spin_unlock_irq(&ensoniq->reg_lock);
ensoniq          1546 sound/pci/ens1370.c 	struct ensoniq *ensoniq = snd_kcontrol_chip(kcontrol);
ensoniq          1550 sound/pci/ens1370.c 	spin_lock_irq(&ensoniq->reg_lock);
ensoniq          1551 sound/pci/ens1370.c 	ctrl = ensoniq->ctrl;
ensoniq          1553 sound/pci/ens1370.c 		ensoniq->ctrl |= ES_1371_GPIO_OUT(4);	/* switch line-in -> rear out */
ensoniq          1555 sound/pci/ens1370.c 		ensoniq->ctrl &= ~ES_1371_GPIO_OUT(4);
ensoniq          1556 sound/pci/ens1370.c 	changed = (ctrl != ensoniq->ctrl);
ensoniq          1558 sound/pci/ens1370.c 		outl(ensoniq->ctrl, ES_REG(ensoniq, CONTROL));
ensoniq          1559 sound/pci/ens1370.c 	spin_unlock_irq(&ensoniq->reg_lock);
ensoniq          1574 sound/pci/ens1370.c 	struct ensoniq *ensoniq = ac97->private_data;
ensoniq          1575 sound/pci/ens1370.c 	ensoniq->u.es1371.ac97 = NULL;
ensoniq          1584 sound/pci/ens1370.c static int es1371_quirk_lookup(struct ensoniq *ensoniq,
ensoniq          1588 sound/pci/ens1370.c 		if (ensoniq->pci->vendor == list->vid &&
ensoniq          1589 sound/pci/ens1370.c 		    ensoniq->pci->device == list->did &&
ensoniq          1590 sound/pci/ens1370.c 		    ensoniq->rev == list->rev)
ensoniq          1612 sound/pci/ens1370.c static int snd_ensoniq_1371_mixer(struct ensoniq *ensoniq,
ensoniq          1615 sound/pci/ens1370.c 	struct snd_card *card = ensoniq->card;
ensoniq          1629 sound/pci/ens1370.c 	ac97.private_data = ensoniq;
ensoniq          1631 sound/pci/ens1370.c 	ac97.pci = ensoniq->pci;
ensoniq          1633 sound/pci/ens1370.c 	if ((err = snd_ac97_mixer(pbus, &ac97, &ensoniq->u.es1371.ac97)) < 0)
ensoniq          1636 sound/pci/ens1370.c 	    (!has_spdif && es1371_quirk_lookup(ensoniq, es1371_spdif_present))) {
ensoniq          1640 sound/pci/ens1370.c 		ensoniq->spdif_default = ensoniq->spdif_stream =
ensoniq          1642 sound/pci/ens1370.c 		outl(ensoniq->spdif_default, ES_REG(ensoniq, CHANNEL_STATUS));
ensoniq          1644 sound/pci/ens1370.c 		if (ensoniq->u.es1371.ac97->ext_id & AC97_EI_SPDIF)
ensoniq          1648 sound/pci/ens1370.c 			kctl = snd_ctl_new1(&snd_es1371_mixer_spdif[i], ensoniq);
ensoniq          1657 sound/pci/ens1370.c 	if (ensoniq->u.es1371.ac97->ext_id & AC97_EI_SDAC) {
ensoniq          1659 sound/pci/ens1370.c 		ensoniq->cssr &= ~(ES_1373_REAR_BIT27|ES_1373_REAR_BIT24);
ensoniq          1660 sound/pci/ens1370.c 		ensoniq->cssr |= ES_1373_REAR_BIT26;
ensoniq          1661 sound/pci/ens1370.c 		err = snd_ctl_add(card, snd_ctl_new1(&snd_ens1373_rear, ensoniq));
ensoniq          1666 sound/pci/ens1370.c 	    snd_pci_quirk_lookup(ensoniq->pci, ens1373_line_quirk)) {
ensoniq          1668 sound/pci/ens1370.c 						      ensoniq));
ensoniq          1690 sound/pci/ens1370.c 	struct ensoniq *ensoniq = snd_kcontrol_chip(kcontrol);
ensoniq          1693 sound/pci/ens1370.c 	spin_lock_irq(&ensoniq->reg_lock);
ensoniq          1694 sound/pci/ens1370.c 	ucontrol->value.integer.value[0] = ensoniq->ctrl & mask ? 1 : 0;
ensoniq          1695 sound/pci/ens1370.c 	spin_unlock_irq(&ensoniq->reg_lock);
ensoniq          1702 sound/pci/ens1370.c 	struct ensoniq *ensoniq = snd_kcontrol_chip(kcontrol);
ensoniq          1708 sound/pci/ens1370.c 	spin_lock_irq(&ensoniq->reg_lock);
ensoniq          1709 sound/pci/ens1370.c 	change = (ensoniq->ctrl & mask) != nval;
ensoniq          1710 sound/pci/ens1370.c 	ensoniq->ctrl &= ~mask;
ensoniq          1711 sound/pci/ens1370.c 	ensoniq->ctrl |= nval;
ensoniq          1712 sound/pci/ens1370.c 	outl(ensoniq->ctrl, ES_REG(ensoniq, CONTROL));
ensoniq          1713 sound/pci/ens1370.c 	spin_unlock_irq(&ensoniq->reg_lock);
ensoniq          1730 sound/pci/ens1370.c 	struct ensoniq *ensoniq = ak4531->private_data;
ensoniq          1731 sound/pci/ens1370.c 	ensoniq->u.es1370.ak4531 = NULL;
ensoniq          1734 sound/pci/ens1370.c static int snd_ensoniq_1370_mixer(struct ensoniq *ensoniq)
ensoniq          1736 sound/pci/ens1370.c 	struct snd_card *card = ensoniq->card;
ensoniq          1742 sound/pci/ens1370.c 	outw(ES_1370_CODEC_WRITE(AK4531_RESET, 0x02), ES_REG(ensoniq, 1370_CODEC));
ensoniq          1743 sound/pci/ens1370.c 	inw(ES_REG(ensoniq, 1370_CODEC));
ensoniq          1745 sound/pci/ens1370.c 	outw(ES_1370_CODEC_WRITE(AK4531_RESET, 0x03), ES_REG(ensoniq, 1370_CODEC));
ensoniq          1746 sound/pci/ens1370.c 	inw(ES_REG(ensoniq, 1370_CODEC));
ensoniq          1751 sound/pci/ens1370.c 	ak4531.private_data = ensoniq;
ensoniq          1753 sound/pci/ens1370.c 	if ((err = snd_ak4531_mixer(card, &ak4531, &ensoniq->u.es1370.ak4531)) < 0)
ensoniq          1756 sound/pci/ens1370.c 		err = snd_ctl_add(card, snd_ctl_new1(&snd_es1370_controls[idx], ensoniq));
ensoniq          1768 sound/pci/ens1370.c static int snd_ensoniq_get_joystick_port(struct ensoniq *ensoniq, int dev)
ensoniq          1780 sound/pci/ens1370.c 		dev_err(ensoniq->card->dev,
ensoniq          1786 sound/pci/ens1370.c static int snd_ensoniq_get_joystick_port(struct ensoniq *ensoniq, int dev)
ensoniq          1792 sound/pci/ens1370.c static int snd_ensoniq_create_gameport(struct ensoniq *ensoniq, int dev)
ensoniq          1797 sound/pci/ens1370.c 	io_port = snd_ensoniq_get_joystick_port(ensoniq, dev);
ensoniq          1808 sound/pci/ens1370.c 			dev_warn(ensoniq->card->dev,
ensoniq          1816 sound/pci/ens1370.c 			dev_warn(ensoniq->card->dev,
ensoniq          1824 sound/pci/ens1370.c 	ensoniq->gameport = gp = gameport_allocate_port();
ensoniq          1826 sound/pci/ens1370.c 		dev_err(ensoniq->card->dev,
ensoniq          1833 sound/pci/ens1370.c 	gameport_set_phys(gp, "pci%s/gameport0", pci_name(ensoniq->pci));
ensoniq          1834 sound/pci/ens1370.c 	gameport_set_dev_parent(gp, &ensoniq->pci->dev);
ensoniq          1837 sound/pci/ens1370.c 	ensoniq->ctrl |= ES_JYSTK_EN;
ensoniq          1839 sound/pci/ens1370.c 	ensoniq->ctrl &= ~ES_1371_JOY_ASELM;
ensoniq          1840 sound/pci/ens1370.c 	ensoniq->ctrl |= ES_1371_JOY_ASEL((io_port - 0x200) / 8);
ensoniq          1842 sound/pci/ens1370.c 	outl(ensoniq->ctrl, ES_REG(ensoniq, CONTROL));
ensoniq          1844 sound/pci/ens1370.c 	gameport_register_port(ensoniq->gameport);
ensoniq          1849 sound/pci/ens1370.c static void snd_ensoniq_free_gameport(struct ensoniq *ensoniq)
ensoniq          1851 sound/pci/ens1370.c 	if (ensoniq->gameport) {
ensoniq          1852 sound/pci/ens1370.c 		int port = ensoniq->gameport->io;
ensoniq          1854 sound/pci/ens1370.c 		gameport_unregister_port(ensoniq->gameport);
ensoniq          1855 sound/pci/ens1370.c 		ensoniq->gameport = NULL;
ensoniq          1856 sound/pci/ens1370.c 		ensoniq->ctrl &= ~ES_JYSTK_EN;
ensoniq          1857 sound/pci/ens1370.c 		outl(ensoniq->ctrl, ES_REG(ensoniq, CONTROL));
ensoniq          1862 sound/pci/ens1370.c static inline int snd_ensoniq_create_gameport(struct ensoniq *ensoniq, long port) { return -ENOSYS; }
ensoniq          1863 sound/pci/ens1370.c static inline void snd_ensoniq_free_gameport(struct ensoniq *ensoniq) { }
ensoniq          1873 sound/pci/ens1370.c 	struct ensoniq *ensoniq = entry->private_data;
ensoniq          1877 sound/pci/ens1370.c 		    ensoniq->ctrl & ES_JYSTK_EN ? "on" : "off");
ensoniq          1880 sound/pci/ens1370.c 		    ensoniq->ctrl & ES_1370_XCTL1 ? "on" : "off");
ensoniq          1882 sound/pci/ens1370.c 		    ensoniq->ctrl & ES_1370_XCTL0 ? "on" : "off");
ensoniq          1885 sound/pci/ens1370.c 		    (ES_1371_JOY_ASELI(ensoniq->ctrl) * 8) + 0x200);
ensoniq          1889 sound/pci/ens1370.c static void snd_ensoniq_proc_init(struct ensoniq *ensoniq)
ensoniq          1891 sound/pci/ens1370.c 	snd_card_ro_proc_new(ensoniq->card, "audiopci", ensoniq,
ensoniq          1899 sound/pci/ens1370.c static int snd_ensoniq_free(struct ensoniq *ensoniq)
ensoniq          1901 sound/pci/ens1370.c 	snd_ensoniq_free_gameport(ensoniq);
ensoniq          1902 sound/pci/ens1370.c 	if (ensoniq->irq < 0)
ensoniq          1905 sound/pci/ens1370.c 	outl(ES_1370_SERR_DISABLE, ES_REG(ensoniq, CONTROL));	/* switch everything off */
ensoniq          1906 sound/pci/ens1370.c 	outl(0, ES_REG(ensoniq, SERIAL));	/* clear serial interface */
ensoniq          1908 sound/pci/ens1370.c 	outl(0, ES_REG(ensoniq, CONTROL));	/* switch everything off */
ensoniq          1909 sound/pci/ens1370.c 	outl(0, ES_REG(ensoniq, SERIAL));	/* clear serial interface */
ensoniq          1911 sound/pci/ens1370.c 	if (ensoniq->irq >= 0)
ensoniq          1912 sound/pci/ens1370.c 		synchronize_irq(ensoniq->irq);
ensoniq          1913 sound/pci/ens1370.c 	pci_set_power_state(ensoniq->pci, PCI_D3hot);
ensoniq          1916 sound/pci/ens1370.c 	if (ensoniq->dma_bug.area)
ensoniq          1917 sound/pci/ens1370.c 		snd_dma_free_pages(&ensoniq->dma_bug);
ensoniq          1919 sound/pci/ens1370.c 	if (ensoniq->irq >= 0)
ensoniq          1920 sound/pci/ens1370.c 		free_irq(ensoniq->irq, ensoniq);
ensoniq          1921 sound/pci/ens1370.c 	pci_release_regions(ensoniq->pci);
ensoniq          1922 sound/pci/ens1370.c 	pci_disable_device(ensoniq->pci);
ensoniq          1923 sound/pci/ens1370.c 	kfree(ensoniq);
ensoniq          1929 sound/pci/ens1370.c 	struct ensoniq *ensoniq = device->device_data;
ensoniq          1930 sound/pci/ens1370.c 	return snd_ensoniq_free(ensoniq);
ensoniq          1952 sound/pci/ens1370.c static void snd_ensoniq_chip_init(struct ensoniq *ensoniq)
ensoniq          1961 sound/pci/ens1370.c 	outl(ensoniq->ctrl, ES_REG(ensoniq, CONTROL));
ensoniq          1962 sound/pci/ens1370.c 	outl(ensoniq->sctrl, ES_REG(ensoniq, SERIAL));
ensoniq          1963 sound/pci/ens1370.c 	outl(ES_MEM_PAGEO(ES_PAGE_ADC), ES_REG(ensoniq, MEM_PAGE));
ensoniq          1964 sound/pci/ens1370.c 	outl(ensoniq->dma_bug.addr, ES_REG(ensoniq, PHANTOM_FRAME));
ensoniq          1965 sound/pci/ens1370.c 	outl(0, ES_REG(ensoniq, PHANTOM_COUNT));
ensoniq          1967 sound/pci/ens1370.c 	outl(ensoniq->ctrl, ES_REG(ensoniq, CONTROL));
ensoniq          1968 sound/pci/ens1370.c 	outl(ensoniq->sctrl, ES_REG(ensoniq, SERIAL));
ensoniq          1969 sound/pci/ens1370.c 	outl(0, ES_REG(ensoniq, 1371_LEGACY));
ensoniq          1970 sound/pci/ens1370.c 	if (es1371_quirk_lookup(ensoniq, es1371_ac97_reset_hack)) {
ensoniq          1971 sound/pci/ens1370.c 	    outl(ensoniq->cssr, ES_REG(ensoniq, STATUS));
ensoniq          1977 sound/pci/ens1370.c 	outl(ensoniq->ctrl | ES_1371_SYNC_RES, ES_REG(ensoniq, CONTROL));
ensoniq          1978 sound/pci/ens1370.c 	inl(ES_REG(ensoniq, CONTROL));
ensoniq          1980 sound/pci/ens1370.c 	outl(ensoniq->ctrl, ES_REG(ensoniq, CONTROL));
ensoniq          1982 sound/pci/ens1370.c 	snd_es1371_wait_src_ready(ensoniq);	
ensoniq          1983 sound/pci/ens1370.c 	outl(ES_1371_SRC_DISABLE, ES_REG(ensoniq, 1371_SMPRATE));
ensoniq          1985 sound/pci/ens1370.c 		snd_es1371_src_write(ensoniq, idx, 0);
ensoniq          1986 sound/pci/ens1370.c 	snd_es1371_src_write(ensoniq, ES_SMPREG_DAC1 + ES_SMPREG_TRUNC_N, 16 << 4);
ensoniq          1987 sound/pci/ens1370.c 	snd_es1371_src_write(ensoniq, ES_SMPREG_DAC1 + ES_SMPREG_INT_REGS, 16 << 10);
ensoniq          1988 sound/pci/ens1370.c 	snd_es1371_src_write(ensoniq, ES_SMPREG_DAC2 + ES_SMPREG_TRUNC_N, 16 << 4);
ensoniq          1989 sound/pci/ens1370.c 	snd_es1371_src_write(ensoniq, ES_SMPREG_DAC2 + ES_SMPREG_INT_REGS, 16 << 10);
ensoniq          1990 sound/pci/ens1370.c 	snd_es1371_src_write(ensoniq, ES_SMPREG_VOL_ADC, 1 << 12);
ensoniq          1991 sound/pci/ens1370.c 	snd_es1371_src_write(ensoniq, ES_SMPREG_VOL_ADC + 1, 1 << 12);
ensoniq          1992 sound/pci/ens1370.c 	snd_es1371_src_write(ensoniq, ES_SMPREG_VOL_DAC1, 1 << 12);
ensoniq          1993 sound/pci/ens1370.c 	snd_es1371_src_write(ensoniq, ES_SMPREG_VOL_DAC1 + 1, 1 << 12);
ensoniq          1994 sound/pci/ens1370.c 	snd_es1371_src_write(ensoniq, ES_SMPREG_VOL_DAC2, 1 << 12);
ensoniq          1995 sound/pci/ens1370.c 	snd_es1371_src_write(ensoniq, ES_SMPREG_VOL_DAC2 + 1, 1 << 12);
ensoniq          1996 sound/pci/ens1370.c 	snd_es1371_adc_rate(ensoniq, 22050);
ensoniq          1997 sound/pci/ens1370.c 	snd_es1371_dac1_rate(ensoniq, 22050);
ensoniq          1998 sound/pci/ens1370.c 	snd_es1371_dac2_rate(ensoniq, 22050);
ensoniq          2005 sound/pci/ens1370.c 	snd_es1371_wait_src_ready(ensoniq);
ensoniq          2006 sound/pci/ens1370.c 	outl(0, ES_REG(ensoniq, 1371_SMPRATE));
ensoniq          2008 sound/pci/ens1370.c 	outl(ES_1371_CODEC_WRITE(0, 0), ES_REG(ensoniq, 1371_CODEC));
ensoniq          2010 sound/pci/ens1370.c 	outb(ensoniq->uartc = 0x00, ES_REG(ensoniq, UART_CONTROL));
ensoniq          2011 sound/pci/ens1370.c 	outb(0x00, ES_REG(ensoniq, UART_RES));
ensoniq          2012 sound/pci/ens1370.c 	outl(ensoniq->cssr, ES_REG(ensoniq, STATUS));
ensoniq          2013 sound/pci/ens1370.c 	synchronize_irq(ensoniq->irq);
ensoniq          2020 sound/pci/ens1370.c 	struct ensoniq *ensoniq = card->private_data;
ensoniq          2025 sound/pci/ens1370.c 	snd_ac97_suspend(ensoniq->u.es1371.ac97);
ensoniq          2028 sound/pci/ens1370.c 	outw(ES_1370_CODEC_WRITE(AK4531_RESET, 0x02), ES_REG(ensoniq, 1370_CODEC));
ensoniq          2029 sound/pci/ens1370.c 	inw(ES_REG(ensoniq, 1370_CODEC));
ensoniq          2031 sound/pci/ens1370.c 	outw(ES_1370_CODEC_WRITE(AK4531_RESET, 0x03), ES_REG(ensoniq, 1370_CODEC));
ensoniq          2032 sound/pci/ens1370.c 	inw(ES_REG(ensoniq, 1370_CODEC));
ensoniq          2034 sound/pci/ens1370.c 	snd_ak4531_suspend(ensoniq->u.es1370.ak4531);
ensoniq          2042 sound/pci/ens1370.c 	struct ensoniq *ensoniq = card->private_data;
ensoniq          2044 sound/pci/ens1370.c 	snd_ensoniq_chip_init(ensoniq);
ensoniq          2047 sound/pci/ens1370.c 	snd_ac97_resume(ensoniq->u.es1371.ac97);
ensoniq          2049 sound/pci/ens1370.c 	snd_ak4531_resume(ensoniq->u.es1370.ak4531);
ensoniq          2063 sound/pci/ens1370.c 			      struct ensoniq **rensoniq)
ensoniq          2065 sound/pci/ens1370.c 	struct ensoniq *ensoniq;
ensoniq          2074 sound/pci/ens1370.c 	ensoniq = kzalloc(sizeof(*ensoniq), GFP_KERNEL);
ensoniq          2075 sound/pci/ens1370.c 	if (ensoniq == NULL) {
ensoniq          2079 sound/pci/ens1370.c 	spin_lock_init(&ensoniq->reg_lock);
ensoniq          2080 sound/pci/ens1370.c 	mutex_init(&ensoniq->src_mutex);
ensoniq          2081 sound/pci/ens1370.c 	ensoniq->card = card;
ensoniq          2082 sound/pci/ens1370.c 	ensoniq->pci = pci;
ensoniq          2083 sound/pci/ens1370.c 	ensoniq->irq = -1;
ensoniq          2085 sound/pci/ens1370.c 		kfree(ensoniq);
ensoniq          2089 sound/pci/ens1370.c 	ensoniq->port = pci_resource_start(pci, 0);
ensoniq          2091 sound/pci/ens1370.c 			KBUILD_MODNAME, ensoniq)) {
ensoniq          2093 sound/pci/ens1370.c 		snd_ensoniq_free(ensoniq);
ensoniq          2096 sound/pci/ens1370.c 	ensoniq->irq = pci->irq;
ensoniq          2099 sound/pci/ens1370.c 				16, &ensoniq->dma_bug) < 0) {
ensoniq          2101 sound/pci/ens1370.c 		snd_ensoniq_free(ensoniq);
ensoniq          2106 sound/pci/ens1370.c 	ensoniq->rev = pci->revision;
ensoniq          2109 sound/pci/ens1370.c 	ensoniq->ctrl = ES_1370_CDC_EN | ES_1370_SERR_DISABLE |
ensoniq          2112 sound/pci/ens1370.c 	ensoniq->ctrl = ES_1370_CDC_EN | ES_1370_PCLKDIVO(ES_1370_SRTODIV(8000));
ensoniq          2114 sound/pci/ens1370.c 	ensoniq->sctrl = 0;
ensoniq          2116 sound/pci/ens1370.c 	ensoniq->ctrl = 0;
ensoniq          2117 sound/pci/ens1370.c 	ensoniq->sctrl = 0;
ensoniq          2118 sound/pci/ens1370.c 	ensoniq->cssr = 0;
ensoniq          2120 sound/pci/ens1370.c 		ensoniq->ctrl |= ES_1371_GPIO_OUT(1);	/* turn amplifier on */
ensoniq          2122 sound/pci/ens1370.c 	if (es1371_quirk_lookup(ensoniq, es1371_ac97_reset_hack))
ensoniq          2123 sound/pci/ens1370.c 		ensoniq->cssr |= ES_1371_ST_AC97_RST;
ensoniq          2126 sound/pci/ens1370.c 	snd_ensoniq_chip_init(ensoniq);
ensoniq          2128 sound/pci/ens1370.c 	if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, ensoniq, &ops)) < 0) {
ensoniq          2129 sound/pci/ens1370.c 		snd_ensoniq_free(ensoniq);
ensoniq          2133 sound/pci/ens1370.c 	snd_ensoniq_proc_init(ensoniq);
ensoniq          2135 sound/pci/ens1370.c 	*rensoniq = ensoniq;
ensoniq          2143 sound/pci/ens1370.c static void snd_ensoniq_midi_interrupt(struct ensoniq * ensoniq)
ensoniq          2145 sound/pci/ens1370.c 	struct snd_rawmidi *rmidi = ensoniq->rmidi;
ensoniq          2151 sound/pci/ens1370.c 	spin_lock(&ensoniq->reg_lock);
ensoniq          2152 sound/pci/ens1370.c 	mask = ensoniq->uartm & ES_MODE_INPUT ? ES_RXRDY : 0;
ensoniq          2154 sound/pci/ens1370.c 		status = inb(ES_REG(ensoniq, UART_STATUS));
ensoniq          2157 sound/pci/ens1370.c 		byte = inb(ES_REG(ensoniq, UART_DATA));
ensoniq          2158 sound/pci/ens1370.c 		snd_rawmidi_receive(ensoniq->midi_input, &byte, 1);
ensoniq          2160 sound/pci/ens1370.c 	spin_unlock(&ensoniq->reg_lock);
ensoniq          2163 sound/pci/ens1370.c 	spin_lock(&ensoniq->reg_lock);
ensoniq          2164 sound/pci/ens1370.c 	mask = ensoniq->uartm & ES_MODE_OUTPUT ? ES_TXRDY : 0;
ensoniq          2166 sound/pci/ens1370.c 		status = inb(ES_REG(ensoniq, UART_STATUS));
ensoniq          2169 sound/pci/ens1370.c 		if (snd_rawmidi_transmit(ensoniq->midi_output, &byte, 1) != 1) {
ensoniq          2170 sound/pci/ens1370.c 			ensoniq->uartc &= ~ES_TXINTENM;
ensoniq          2171 sound/pci/ens1370.c 			outb(ensoniq->uartc, ES_REG(ensoniq, UART_CONTROL));
ensoniq          2174 sound/pci/ens1370.c 			outb(byte, ES_REG(ensoniq, UART_DATA));
ensoniq          2177 sound/pci/ens1370.c 	spin_unlock(&ensoniq->reg_lock);
ensoniq          2182 sound/pci/ens1370.c 	struct ensoniq *ensoniq = substream->rmidi->private_data;
ensoniq          2184 sound/pci/ens1370.c 	spin_lock_irq(&ensoniq->reg_lock);
ensoniq          2185 sound/pci/ens1370.c 	ensoniq->uartm |= ES_MODE_INPUT;
ensoniq          2186 sound/pci/ens1370.c 	ensoniq->midi_input = substream;
ensoniq          2187 sound/pci/ens1370.c 	if (!(ensoniq->uartm & ES_MODE_OUTPUT)) {
ensoniq          2188 sound/pci/ens1370.c 		outb(ES_CNTRL(3), ES_REG(ensoniq, UART_CONTROL));
ensoniq          2189 sound/pci/ens1370.c 		outb(ensoniq->uartc = 0, ES_REG(ensoniq, UART_CONTROL));
ensoniq          2190 sound/pci/ens1370.c 		outl(ensoniq->ctrl |= ES_UART_EN, ES_REG(ensoniq, CONTROL));
ensoniq          2192 sound/pci/ens1370.c 	spin_unlock_irq(&ensoniq->reg_lock);
ensoniq          2198 sound/pci/ens1370.c 	struct ensoniq *ensoniq = substream->rmidi->private_data;
ensoniq          2200 sound/pci/ens1370.c 	spin_lock_irq(&ensoniq->reg_lock);
ensoniq          2201 sound/pci/ens1370.c 	if (!(ensoniq->uartm & ES_MODE_OUTPUT)) {
ensoniq          2202 sound/pci/ens1370.c 		outb(ensoniq->uartc = 0, ES_REG(ensoniq, UART_CONTROL));
ensoniq          2203 sound/pci/ens1370.c 		outl(ensoniq->ctrl &= ~ES_UART_EN, ES_REG(ensoniq, CONTROL));
ensoniq          2205 sound/pci/ens1370.c 		outb(ensoniq->uartc &= ~ES_RXINTEN, ES_REG(ensoniq, UART_CONTROL));
ensoniq          2207 sound/pci/ens1370.c 	ensoniq->midi_input = NULL;
ensoniq          2208 sound/pci/ens1370.c 	ensoniq->uartm &= ~ES_MODE_INPUT;
ensoniq          2209 sound/pci/ens1370.c 	spin_unlock_irq(&ensoniq->reg_lock);
ensoniq          2215 sound/pci/ens1370.c 	struct ensoniq *ensoniq = substream->rmidi->private_data;
ensoniq          2217 sound/pci/ens1370.c 	spin_lock_irq(&ensoniq->reg_lock);
ensoniq          2218 sound/pci/ens1370.c 	ensoniq->uartm |= ES_MODE_OUTPUT;
ensoniq          2219 sound/pci/ens1370.c 	ensoniq->midi_output = substream;
ensoniq          2220 sound/pci/ens1370.c 	if (!(ensoniq->uartm & ES_MODE_INPUT)) {
ensoniq          2221 sound/pci/ens1370.c 		outb(ES_CNTRL(3), ES_REG(ensoniq, UART_CONTROL));
ensoniq          2222 sound/pci/ens1370.c 		outb(ensoniq->uartc = 0, ES_REG(ensoniq, UART_CONTROL));
ensoniq          2223 sound/pci/ens1370.c 		outl(ensoniq->ctrl |= ES_UART_EN, ES_REG(ensoniq, CONTROL));
ensoniq          2225 sound/pci/ens1370.c 	spin_unlock_irq(&ensoniq->reg_lock);
ensoniq          2231 sound/pci/ens1370.c 	struct ensoniq *ensoniq = substream->rmidi->private_data;
ensoniq          2233 sound/pci/ens1370.c 	spin_lock_irq(&ensoniq->reg_lock);
ensoniq          2234 sound/pci/ens1370.c 	if (!(ensoniq->uartm & ES_MODE_INPUT)) {
ensoniq          2235 sound/pci/ens1370.c 		outb(ensoniq->uartc = 0, ES_REG(ensoniq, UART_CONTROL));
ensoniq          2236 sound/pci/ens1370.c 		outl(ensoniq->ctrl &= ~ES_UART_EN, ES_REG(ensoniq, CONTROL));
ensoniq          2238 sound/pci/ens1370.c 		outb(ensoniq->uartc &= ~ES_TXINTENM, ES_REG(ensoniq, UART_CONTROL));
ensoniq          2240 sound/pci/ens1370.c 	ensoniq->midi_output = NULL;
ensoniq          2241 sound/pci/ens1370.c 	ensoniq->uartm &= ~ES_MODE_OUTPUT;
ensoniq          2242 sound/pci/ens1370.c 	spin_unlock_irq(&ensoniq->reg_lock);
ensoniq          2249 sound/pci/ens1370.c 	struct ensoniq *ensoniq = substream->rmidi->private_data;
ensoniq          2252 sound/pci/ens1370.c 	spin_lock_irqsave(&ensoniq->reg_lock, flags);
ensoniq          2254 sound/pci/ens1370.c 		if ((ensoniq->uartc & ES_RXINTEN) == 0) {
ensoniq          2257 sound/pci/ens1370.c 				inb(ES_REG(ensoniq, UART_DATA));
ensoniq          2258 sound/pci/ens1370.c 			ensoniq->uartc |= ES_RXINTEN;
ensoniq          2259 sound/pci/ens1370.c 			outb(ensoniq->uartc, ES_REG(ensoniq, UART_CONTROL));
ensoniq          2262 sound/pci/ens1370.c 		if (ensoniq->uartc & ES_RXINTEN) {
ensoniq          2263 sound/pci/ens1370.c 			ensoniq->uartc &= ~ES_RXINTEN;
ensoniq          2264 sound/pci/ens1370.c 			outb(ensoniq->uartc, ES_REG(ensoniq, UART_CONTROL));
ensoniq          2267 sound/pci/ens1370.c 	spin_unlock_irqrestore(&ensoniq->reg_lock, flags);
ensoniq          2273 sound/pci/ens1370.c 	struct ensoniq *ensoniq = substream->rmidi->private_data;
ensoniq          2276 sound/pci/ens1370.c 	spin_lock_irqsave(&ensoniq->reg_lock, flags);
ensoniq          2278 sound/pci/ens1370.c 		if (ES_TXINTENI(ensoniq->uartc) == 0) {
ensoniq          2279 sound/pci/ens1370.c 			ensoniq->uartc |= ES_TXINTENO(1);
ensoniq          2281 sound/pci/ens1370.c 			while (ES_TXINTENI(ensoniq->uartc) == 1 &&
ensoniq          2282 sound/pci/ens1370.c 			       (inb(ES_REG(ensoniq, UART_STATUS)) & ES_TXRDY)) {
ensoniq          2284 sound/pci/ens1370.c 					ensoniq->uartc &= ~ES_TXINTENM;
ensoniq          2286 sound/pci/ens1370.c 					outb(byte, ES_REG(ensoniq, UART_DATA));
ensoniq          2289 sound/pci/ens1370.c 			outb(ensoniq->uartc, ES_REG(ensoniq, UART_CONTROL));
ensoniq          2292 sound/pci/ens1370.c 		if (ES_TXINTENI(ensoniq->uartc) == 1) {
ensoniq          2293 sound/pci/ens1370.c 			ensoniq->uartc &= ~ES_TXINTENM;
ensoniq          2294 sound/pci/ens1370.c 			outb(ensoniq->uartc, ES_REG(ensoniq, UART_CONTROL));
ensoniq          2297 sound/pci/ens1370.c 	spin_unlock_irqrestore(&ensoniq->reg_lock, flags);
ensoniq          2314 sound/pci/ens1370.c static int snd_ensoniq_midi(struct ensoniq *ensoniq, int device)
ensoniq          2319 sound/pci/ens1370.c 	if ((err = snd_rawmidi_new(ensoniq->card, "ES1370/1", device, 1, 1, &rmidi)) < 0)
ensoniq          2326 sound/pci/ens1370.c 	rmidi->private_data = ensoniq;
ensoniq          2327 sound/pci/ens1370.c 	ensoniq->rmidi = rmidi;
ensoniq          2337 sound/pci/ens1370.c 	struct ensoniq *ensoniq = dev_id;
ensoniq          2340 sound/pci/ens1370.c 	if (ensoniq == NULL)
ensoniq          2343 sound/pci/ens1370.c 	status = inl(ES_REG(ensoniq, STATUS));
ensoniq          2347 sound/pci/ens1370.c 	spin_lock(&ensoniq->reg_lock);
ensoniq          2348 sound/pci/ens1370.c 	sctrl = ensoniq->sctrl;
ensoniq          2355 sound/pci/ens1370.c 	outl(sctrl, ES_REG(ensoniq, SERIAL));
ensoniq          2356 sound/pci/ens1370.c 	outl(ensoniq->sctrl, ES_REG(ensoniq, SERIAL));
ensoniq          2357 sound/pci/ens1370.c 	spin_unlock(&ensoniq->reg_lock);
ensoniq          2360 sound/pci/ens1370.c 		snd_ensoniq_midi_interrupt(ensoniq);
ensoniq          2361 sound/pci/ens1370.c 	if ((status & ES_DAC2) && ensoniq->playback2_substream)
ensoniq          2362 sound/pci/ens1370.c 		snd_pcm_period_elapsed(ensoniq->playback2_substream);
ensoniq          2363 sound/pci/ens1370.c 	if ((status & ES_ADC) && ensoniq->capture_substream)
ensoniq          2364 sound/pci/ens1370.c 		snd_pcm_period_elapsed(ensoniq->capture_substream);
ensoniq          2365 sound/pci/ens1370.c 	if ((status & ES_DAC1) && ensoniq->playback1_substream)
ensoniq          2366 sound/pci/ens1370.c 		snd_pcm_period_elapsed(ensoniq->playback1_substream);
ensoniq          2375 sound/pci/ens1370.c 	struct ensoniq *ensoniq;
ensoniq          2390 sound/pci/ens1370.c 	if ((err = snd_ensoniq_create(card, pci, &ensoniq)) < 0) {
ensoniq          2394 sound/pci/ens1370.c 	card->private_data = ensoniq;
ensoniq          2397 sound/pci/ens1370.c 	if ((err = snd_ensoniq_1370_mixer(ensoniq)) < 0) {
ensoniq          2403 sound/pci/ens1370.c 	if ((err = snd_ensoniq_1371_mixer(ensoniq, spdif[dev], lineio[dev])) < 0) {
ensoniq          2408 sound/pci/ens1370.c 	if ((err = snd_ensoniq_pcm(ensoniq, 0)) < 0) {
ensoniq          2412 sound/pci/ens1370.c 	if ((err = snd_ensoniq_pcm2(ensoniq, 1)) < 0) {
ensoniq          2416 sound/pci/ens1370.c 	if ((err = snd_ensoniq_midi(ensoniq, 0)) < 0) {
ensoniq          2421 sound/pci/ens1370.c 	snd_ensoniq_create_gameport(ensoniq, dev);
ensoniq          2429 sound/pci/ens1370.c 		ensoniq->port,
ensoniq          2430 sound/pci/ens1370.c 		ensoniq->irq);