mirror of https://github.com/torvalds/linux.git
ALSA: ice1712: Use guard() for spin locks
Clean up the code using guard() for spin locks. Merely code refactoring, and no behavior change. Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20250829144342.4290-36-tiwai@suse.de
This commit is contained in:
parent
9da230b3b2
commit
d0b8e41904
|
|
@ -202,15 +202,13 @@ static int delta_spdif_default_put(struct snd_ice1712 *ice, struct snd_ctl_elem_
|
||||||
int change;
|
int change;
|
||||||
|
|
||||||
val = snd_cs8403_encode_spdif_bits(&ucontrol->value.iec958);
|
val = snd_cs8403_encode_spdif_bits(&ucontrol->value.iec958);
|
||||||
spin_lock_irq(&ice->reg_lock);
|
scoped_guard(spinlock_irq, &ice->reg_lock) {
|
||||||
change = ice->spdif.cs8403_bits != val;
|
change = ice->spdif.cs8403_bits != val;
|
||||||
ice->spdif.cs8403_bits = val;
|
ice->spdif.cs8403_bits = val;
|
||||||
if (change && ice->playback_pro_substream == NULL) {
|
if (!change || ice->playback_pro_substream)
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
return change;
|
||||||
snd_ice1712_delta_cs8403_spdif_write(ice, val);
|
|
||||||
} else {
|
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
|
||||||
}
|
}
|
||||||
|
snd_ice1712_delta_cs8403_spdif_write(ice, val);
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -225,15 +223,13 @@ static int delta_spdif_stream_put(struct snd_ice1712 *ice, struct snd_ctl_elem_v
|
||||||
int change;
|
int change;
|
||||||
|
|
||||||
val = snd_cs8403_encode_spdif_bits(&ucontrol->value.iec958);
|
val = snd_cs8403_encode_spdif_bits(&ucontrol->value.iec958);
|
||||||
spin_lock_irq(&ice->reg_lock);
|
scoped_guard(spinlock_irq, &ice->reg_lock) {
|
||||||
change = ice->spdif.cs8403_stream_bits != val;
|
change = ice->spdif.cs8403_stream_bits != val;
|
||||||
ice->spdif.cs8403_stream_bits = val;
|
ice->spdif.cs8403_stream_bits = val;
|
||||||
if (change && ice->playback_pro_substream != NULL) {
|
if (!change || ice->playback_pro_substream)
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
return change;
|
||||||
snd_ice1712_delta_cs8403_spdif_write(ice, val);
|
|
||||||
} else {
|
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
|
||||||
}
|
}
|
||||||
|
snd_ice1712_delta_cs8403_spdif_write(ice, val);
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -375,11 +371,10 @@ static void delta_open_spdif(struct snd_ice1712 *ice, struct snd_pcm_substream *
|
||||||
/* set up */
|
/* set up */
|
||||||
static void delta_setup_spdif(struct snd_ice1712 *ice, int rate)
|
static void delta_setup_spdif(struct snd_ice1712 *ice, int rate)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
|
||||||
unsigned int tmp;
|
unsigned int tmp;
|
||||||
int change;
|
int change;
|
||||||
|
|
||||||
spin_lock_irqsave(&ice->reg_lock, flags);
|
scoped_guard(spinlock_irqsave, &ice->reg_lock) {
|
||||||
tmp = ice->spdif.cs8403_stream_bits;
|
tmp = ice->spdif.cs8403_stream_bits;
|
||||||
if (tmp & 0x01) /* consumer */
|
if (tmp & 0x01) /* consumer */
|
||||||
tmp &= (tmp & 0x01) ? ~0x06 : ~0x18;
|
tmp &= (tmp & 0x01) ? ~0x06 : ~0x18;
|
||||||
|
|
@ -391,7 +386,7 @@ static void delta_setup_spdif(struct snd_ice1712 *ice, int rate)
|
||||||
}
|
}
|
||||||
change = ice->spdif.cs8403_stream_bits != tmp;
|
change = ice->spdif.cs8403_stream_bits != tmp;
|
||||||
ice->spdif.cs8403_stream_bits = tmp;
|
ice->spdif.cs8403_stream_bits = tmp;
|
||||||
spin_unlock_irqrestore(&ice->reg_lock, flags);
|
}
|
||||||
if (change)
|
if (change)
|
||||||
snd_ctl_notify(ice->card, SNDRV_CTL_EVENT_MASK_VALUE, &ice->spdif.stream_ctl->id);
|
snd_ctl_notify(ice->card, SNDRV_CTL_EVENT_MASK_VALUE, &ice->spdif.stream_ctl->id);
|
||||||
snd_ice1712_delta_cs8403_spdif_write(ice, tmp);
|
snd_ice1712_delta_cs8403_spdif_write(ice, tmp);
|
||||||
|
|
|
||||||
|
|
@ -260,15 +260,13 @@ static int ews88_spdif_default_put(struct snd_ice1712 *ice, struct snd_ctl_elem_
|
||||||
int change;
|
int change;
|
||||||
|
|
||||||
val = snd_cs8404_encode_spdif_bits(&ucontrol->value.iec958);
|
val = snd_cs8404_encode_spdif_bits(&ucontrol->value.iec958);
|
||||||
spin_lock_irq(&ice->reg_lock);
|
scoped_guard(spinlock_irq, &ice->reg_lock) {
|
||||||
change = ice->spdif.cs8403_bits != val;
|
change = ice->spdif.cs8403_bits != val;
|
||||||
ice->spdif.cs8403_bits = val;
|
ice->spdif.cs8403_bits = val;
|
||||||
if (change && ice->playback_pro_substream == NULL) {
|
if (!change || ice->playback_pro_substream)
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
return change;
|
||||||
snd_ice1712_ews_cs8404_spdif_write(ice, val);
|
|
||||||
} else {
|
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
|
||||||
}
|
}
|
||||||
|
snd_ice1712_ews_cs8404_spdif_write(ice, val);
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -283,15 +281,13 @@ static int ews88_spdif_stream_put(struct snd_ice1712 *ice, struct snd_ctl_elem_v
|
||||||
int change;
|
int change;
|
||||||
|
|
||||||
val = snd_cs8404_encode_spdif_bits(&ucontrol->value.iec958);
|
val = snd_cs8404_encode_spdif_bits(&ucontrol->value.iec958);
|
||||||
spin_lock_irq(&ice->reg_lock);
|
scoped_guard(spinlock_irq, &ice->reg_lock) {
|
||||||
change = ice->spdif.cs8403_stream_bits != val;
|
change = ice->spdif.cs8403_stream_bits != val;
|
||||||
ice->spdif.cs8403_stream_bits = val;
|
ice->spdif.cs8403_stream_bits = val;
|
||||||
if (change && ice->playback_pro_substream != NULL) {
|
if (!change || ice->playback_pro_substream)
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
return change;
|
||||||
snd_ice1712_ews_cs8404_spdif_write(ice, val);
|
|
||||||
} else {
|
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
|
||||||
}
|
}
|
||||||
|
snd_ice1712_ews_cs8404_spdif_write(ice, val);
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -305,11 +301,10 @@ static void ews88_open_spdif(struct snd_ice1712 *ice, struct snd_pcm_substream *
|
||||||
/* set up SPDIF for EWS88MT / EWS88D */
|
/* set up SPDIF for EWS88MT / EWS88D */
|
||||||
static void ews88_setup_spdif(struct snd_ice1712 *ice, int rate)
|
static void ews88_setup_spdif(struct snd_ice1712 *ice, int rate)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
|
||||||
unsigned char tmp;
|
unsigned char tmp;
|
||||||
int change;
|
int change;
|
||||||
|
|
||||||
spin_lock_irqsave(&ice->reg_lock, flags);
|
scoped_guard(spinlock_irqsave, &ice->reg_lock) {
|
||||||
tmp = ice->spdif.cs8403_stream_bits;
|
tmp = ice->spdif.cs8403_stream_bits;
|
||||||
if (tmp & 0x10) /* consumer */
|
if (tmp & 0x10) /* consumer */
|
||||||
tmp &= (tmp & 0x01) ? ~0x06 : ~0x60;
|
tmp &= (tmp & 0x01) ? ~0x06 : ~0x60;
|
||||||
|
|
@ -321,7 +316,7 @@ static void ews88_setup_spdif(struct snd_ice1712 *ice, int rate)
|
||||||
}
|
}
|
||||||
change = ice->spdif.cs8403_stream_bits != tmp;
|
change = ice->spdif.cs8403_stream_bits != tmp;
|
||||||
ice->spdif.cs8403_stream_bits = tmp;
|
ice->spdif.cs8403_stream_bits = tmp;
|
||||||
spin_unlock_irqrestore(&ice->reg_lock, flags);
|
}
|
||||||
if (change)
|
if (change)
|
||||||
snd_ctl_notify(ice->card, SNDRV_CTL_EVENT_MASK_VALUE, &ice->spdif.stream_ctl->id);
|
snd_ctl_notify(ice->card, SNDRV_CTL_EVENT_MASK_VALUE, &ice->spdif.stream_ctl->id);
|
||||||
snd_ice1712_ews_cs8404_spdif_write(ice, tmp);
|
snd_ice1712_ews_cs8404_spdif_write(ice, tmp);
|
||||||
|
|
|
||||||
|
|
@ -249,13 +249,12 @@ static int snd_ice1712_digmix_route_ac97_put(struct snd_kcontrol *kcontrol, stru
|
||||||
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
||||||
unsigned char val, nval;
|
unsigned char val, nval;
|
||||||
|
|
||||||
spin_lock_irq(&ice->reg_lock);
|
guard(spinlock_irq)(&ice->reg_lock);
|
||||||
val = inb(ICEMT(ice, MONITOR_ROUTECTRL));
|
val = inb(ICEMT(ice, MONITOR_ROUTECTRL));
|
||||||
nval = val & ~ICE1712_ROUTE_AC97;
|
nval = val & ~ICE1712_ROUTE_AC97;
|
||||||
if (ucontrol->value.integer.value[0])
|
if (ucontrol->value.integer.value[0])
|
||||||
nval |= ICE1712_ROUTE_AC97;
|
nval |= ICE1712_ROUTE_AC97;
|
||||||
outb(nval, ICEMT(ice, MONITOR_ROUTECTRL));
|
outb(nval, ICEMT(ice, MONITOR_ROUTECTRL));
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
|
||||||
return val != nval;
|
return val != nval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -484,7 +483,7 @@ static int snd_ice1712_playback_trigger(struct snd_pcm_substream *substream,
|
||||||
int result = 0;
|
int result = 0;
|
||||||
u32 tmp;
|
u32 tmp;
|
||||||
|
|
||||||
spin_lock(&ice->reg_lock);
|
guard(spinlock)(&ice->reg_lock);
|
||||||
tmp = snd_ice1712_read(ice, ICE1712_IREG_PBK_CTRL);
|
tmp = snd_ice1712_read(ice, ICE1712_IREG_PBK_CTRL);
|
||||||
if (cmd == SNDRV_PCM_TRIGGER_START) {
|
if (cmd == SNDRV_PCM_TRIGGER_START) {
|
||||||
tmp |= 1;
|
tmp |= 1;
|
||||||
|
|
@ -498,7 +497,6 @@ static int snd_ice1712_playback_trigger(struct snd_pcm_substream *substream,
|
||||||
result = -EINVAL;
|
result = -EINVAL;
|
||||||
}
|
}
|
||||||
snd_ice1712_write(ice, ICE1712_IREG_PBK_CTRL, tmp);
|
snd_ice1712_write(ice, ICE1712_IREG_PBK_CTRL, tmp);
|
||||||
spin_unlock(&ice->reg_lock);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -509,7 +507,7 @@ static int snd_ice1712_playback_ds_trigger(struct snd_pcm_substream *substream,
|
||||||
int result = 0;
|
int result = 0;
|
||||||
u32 tmp;
|
u32 tmp;
|
||||||
|
|
||||||
spin_lock(&ice->reg_lock);
|
guard(spinlock)(&ice->reg_lock);
|
||||||
tmp = snd_ice1712_ds_read(ice, substream->number * 2, ICE1712_DSC_CONTROL);
|
tmp = snd_ice1712_ds_read(ice, substream->number * 2, ICE1712_DSC_CONTROL);
|
||||||
if (cmd == SNDRV_PCM_TRIGGER_START) {
|
if (cmd == SNDRV_PCM_TRIGGER_START) {
|
||||||
tmp |= 1;
|
tmp |= 1;
|
||||||
|
|
@ -523,7 +521,6 @@ static int snd_ice1712_playback_ds_trigger(struct snd_pcm_substream *substream,
|
||||||
result = -EINVAL;
|
result = -EINVAL;
|
||||||
}
|
}
|
||||||
snd_ice1712_ds_write(ice, substream->number * 2, ICE1712_DSC_CONTROL, tmp);
|
snd_ice1712_ds_write(ice, substream->number * 2, ICE1712_DSC_CONTROL, tmp);
|
||||||
spin_unlock(&ice->reg_lock);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -534,7 +531,7 @@ static int snd_ice1712_capture_trigger(struct snd_pcm_substream *substream,
|
||||||
int result = 0;
|
int result = 0;
|
||||||
u8 tmp;
|
u8 tmp;
|
||||||
|
|
||||||
spin_lock(&ice->reg_lock);
|
guard(spinlock)(&ice->reg_lock);
|
||||||
tmp = snd_ice1712_read(ice, ICE1712_IREG_CAP_CTRL);
|
tmp = snd_ice1712_read(ice, ICE1712_IREG_CAP_CTRL);
|
||||||
if (cmd == SNDRV_PCM_TRIGGER_START) {
|
if (cmd == SNDRV_PCM_TRIGGER_START) {
|
||||||
tmp |= 1;
|
tmp |= 1;
|
||||||
|
|
@ -544,7 +541,6 @@ static int snd_ice1712_capture_trigger(struct snd_pcm_substream *substream,
|
||||||
result = -EINVAL;
|
result = -EINVAL;
|
||||||
}
|
}
|
||||||
snd_ice1712_write(ice, ICE1712_IREG_CAP_CTRL, tmp);
|
snd_ice1712_write(ice, ICE1712_IREG_CAP_CTRL, tmp);
|
||||||
spin_unlock(&ice->reg_lock);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -564,7 +560,7 @@ static int snd_ice1712_playback_prepare(struct snd_pcm_substream *substream)
|
||||||
rate = (runtime->rate * 8192) / 375;
|
rate = (runtime->rate * 8192) / 375;
|
||||||
if (rate > 0x000fffff)
|
if (rate > 0x000fffff)
|
||||||
rate = 0x000fffff;
|
rate = 0x000fffff;
|
||||||
spin_lock_irq(&ice->reg_lock);
|
guard(spinlock_irq)(&ice->reg_lock);
|
||||||
outb(0, ice->ddma_port + 15);
|
outb(0, ice->ddma_port + 15);
|
||||||
outb(ICE1712_DMA_MODE_WRITE | ICE1712_DMA_AUTOINIT, ice->ddma_port + 0x0b);
|
outb(ICE1712_DMA_MODE_WRITE | ICE1712_DMA_AUTOINIT, ice->ddma_port + 0x0b);
|
||||||
outl(runtime->dma_addr, ice->ddma_port + 0);
|
outl(runtime->dma_addr, ice->ddma_port + 0);
|
||||||
|
|
@ -577,7 +573,6 @@ static int snd_ice1712_playback_prepare(struct snd_pcm_substream *substream)
|
||||||
snd_ice1712_write(ice, ICE1712_IREG_PBK_COUNT_HI, period_size >> 8);
|
snd_ice1712_write(ice, ICE1712_IREG_PBK_COUNT_HI, period_size >> 8);
|
||||||
snd_ice1712_write(ice, ICE1712_IREG_PBK_LEFT, 0);
|
snd_ice1712_write(ice, ICE1712_IREG_PBK_LEFT, 0);
|
||||||
snd_ice1712_write(ice, ICE1712_IREG_PBK_RIGHT, 0);
|
snd_ice1712_write(ice, ICE1712_IREG_PBK_RIGHT, 0);
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -599,7 +594,7 @@ static int snd_ice1712_playback_ds_prepare(struct snd_pcm_substream *substream)
|
||||||
ice->playback_con_active_buf[substream->number] = 0;
|
ice->playback_con_active_buf[substream->number] = 0;
|
||||||
ice->playback_con_virt_addr[substream->number] = runtime->dma_addr;
|
ice->playback_con_virt_addr[substream->number] = runtime->dma_addr;
|
||||||
chn = substream->number * 2;
|
chn = substream->number * 2;
|
||||||
spin_lock_irq(&ice->reg_lock);
|
guard(spinlock_irq)(&ice->reg_lock);
|
||||||
snd_ice1712_ds_write(ice, chn, ICE1712_DSC_ADDR0, runtime->dma_addr);
|
snd_ice1712_ds_write(ice, chn, ICE1712_DSC_ADDR0, runtime->dma_addr);
|
||||||
snd_ice1712_ds_write(ice, chn, ICE1712_DSC_COUNT0, period_size);
|
snd_ice1712_ds_write(ice, chn, ICE1712_DSC_COUNT0, period_size);
|
||||||
snd_ice1712_ds_write(ice, chn, ICE1712_DSC_ADDR1, runtime->dma_addr + (runtime->periods > 1 ? period_size + 1 : 0));
|
snd_ice1712_ds_write(ice, chn, ICE1712_DSC_ADDR1, runtime->dma_addr + (runtime->periods > 1 ? period_size + 1 : 0));
|
||||||
|
|
@ -611,7 +606,6 @@ static int snd_ice1712_playback_ds_prepare(struct snd_pcm_substream *substream)
|
||||||
snd_ice1712_ds_write(ice, chn + 1, ICE1712_DSC_RATE, rate);
|
snd_ice1712_ds_write(ice, chn + 1, ICE1712_DSC_RATE, rate);
|
||||||
snd_ice1712_ds_write(ice, chn + 1, ICE1712_DSC_VOLUME, 0);
|
snd_ice1712_ds_write(ice, chn + 1, ICE1712_DSC_VOLUME, 0);
|
||||||
}
|
}
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -629,13 +623,13 @@ static int snd_ice1712_capture_prepare(struct snd_pcm_substream *substream)
|
||||||
tmp &= ~0x04;
|
tmp &= ~0x04;
|
||||||
if (runtime->channels == 2)
|
if (runtime->channels == 2)
|
||||||
tmp &= ~0x02;
|
tmp &= ~0x02;
|
||||||
spin_lock_irq(&ice->reg_lock);
|
scoped_guard(spinlock_irq, &ice->reg_lock) {
|
||||||
outl(ice->capture_con_virt_addr = runtime->dma_addr, ICEREG(ice, CONCAP_ADDR));
|
outl(ice->capture_con_virt_addr = runtime->dma_addr, ICEREG(ice, CONCAP_ADDR));
|
||||||
outw(buf_size, ICEREG(ice, CONCAP_COUNT));
|
outw(buf_size, ICEREG(ice, CONCAP_COUNT));
|
||||||
snd_ice1712_write(ice, ICE1712_IREG_CAP_COUNT_HI, period_size >> 8);
|
snd_ice1712_write(ice, ICE1712_IREG_CAP_COUNT_HI, period_size >> 8);
|
||||||
snd_ice1712_write(ice, ICE1712_IREG_CAP_COUNT_LO, period_size & 0xff);
|
snd_ice1712_write(ice, ICE1712_IREG_CAP_COUNT_LO, period_size & 0xff);
|
||||||
snd_ice1712_write(ice, ICE1712_IREG_CAP_CTRL, tmp);
|
snd_ice1712_write(ice, ICE1712_IREG_CAP_CTRL, tmp);
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
}
|
||||||
snd_ac97_set_rate(ice->ac97, AC97_PCM_LR_ADC_RATE, runtime->rate);
|
snd_ac97_set_rate(ice->ac97, AC97_PCM_LR_ADC_RATE, runtime->rate);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -763,10 +757,9 @@ static int snd_ice1712_playback_ds_open(struct snd_pcm_substream *substream)
|
||||||
|
|
||||||
ice->playback_con_substream_ds[substream->number] = substream;
|
ice->playback_con_substream_ds[substream->number] = substream;
|
||||||
runtime->hw = snd_ice1712_playback_ds;
|
runtime->hw = snd_ice1712_playback_ds;
|
||||||
spin_lock_irq(&ice->reg_lock);
|
guard(spinlock_irq)(&ice->reg_lock);
|
||||||
tmp = inw(ICEDS(ice, INTMASK)) & ~(1 << (substream->number * 2));
|
tmp = inw(ICEDS(ice, INTMASK)) & ~(1 << (substream->number * 2));
|
||||||
outw(tmp, ICEDS(ice, INTMASK));
|
outw(tmp, ICEDS(ice, INTMASK));
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -796,10 +789,9 @@ static int snd_ice1712_playback_ds_close(struct snd_pcm_substream *substream)
|
||||||
struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
|
struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
|
||||||
u32 tmp;
|
u32 tmp;
|
||||||
|
|
||||||
spin_lock_irq(&ice->reg_lock);
|
guard(spinlock_irq)(&ice->reg_lock);
|
||||||
tmp = inw(ICEDS(ice, INTMASK)) | (3 << (substream->number * 2));
|
tmp = inw(ICEDS(ice, INTMASK)) | (3 << (substream->number * 2));
|
||||||
outw(tmp, ICEDS(ice, INTMASK));
|
outw(tmp, ICEDS(ice, INTMASK));
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
|
||||||
ice->playback_con_substream_ds[substream->number] = NULL;
|
ice->playback_con_substream_ds[substream->number] = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -911,14 +903,13 @@ static int snd_ice1712_pro_trigger(struct snd_pcm_substream *substream,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
what = ICE1712_PLAYBACK_PAUSE;
|
what = ICE1712_PLAYBACK_PAUSE;
|
||||||
snd_pcm_trigger_done(substream, substream);
|
snd_pcm_trigger_done(substream, substream);
|
||||||
spin_lock(&ice->reg_lock);
|
guard(spinlock)(&ice->reg_lock);
|
||||||
old = inl(ICEMT(ice, PLAYBACK_CONTROL));
|
old = inl(ICEMT(ice, PLAYBACK_CONTROL));
|
||||||
if (cmd == SNDRV_PCM_TRIGGER_PAUSE_PUSH)
|
if (cmd == SNDRV_PCM_TRIGGER_PAUSE_PUSH)
|
||||||
old |= what;
|
old |= what;
|
||||||
else
|
else
|
||||||
old &= ~what;
|
old &= ~what;
|
||||||
outl(old, ICEMT(ice, PLAYBACK_CONTROL));
|
outl(old, ICEMT(ice, PLAYBACK_CONTROL));
|
||||||
spin_unlock(&ice->reg_lock);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SNDRV_PCM_TRIGGER_START:
|
case SNDRV_PCM_TRIGGER_START:
|
||||||
|
|
@ -937,14 +928,13 @@ static int snd_ice1712_pro_trigger(struct snd_pcm_substream *substream,
|
||||||
snd_pcm_trigger_done(s, substream);
|
snd_pcm_trigger_done(s, substream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
spin_lock(&ice->reg_lock);
|
guard(spinlock)(&ice->reg_lock);
|
||||||
old = inl(ICEMT(ice, PLAYBACK_CONTROL));
|
old = inl(ICEMT(ice, PLAYBACK_CONTROL));
|
||||||
if (cmd == SNDRV_PCM_TRIGGER_START)
|
if (cmd == SNDRV_PCM_TRIGGER_START)
|
||||||
old |= what;
|
old |= what;
|
||||||
else
|
else
|
||||||
old &= ~what;
|
old &= ~what;
|
||||||
outl(old, ICEMT(ice, PLAYBACK_CONTROL));
|
outl(old, ICEMT(ice, PLAYBACK_CONTROL));
|
||||||
spin_unlock(&ice->reg_lock);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
@ -957,7 +947,6 @@ static int snd_ice1712_pro_trigger(struct snd_pcm_substream *substream,
|
||||||
*/
|
*/
|
||||||
static void snd_ice1712_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate, int force)
|
static void snd_ice1712_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate, int force)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
|
||||||
unsigned char val, old;
|
unsigned char val, old;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
|
@ -982,24 +971,21 @@ static void snd_ice1712_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
spin_lock_irqsave(&ice->reg_lock, flags);
|
scoped_guard(spinlock_irqsave, &ice->reg_lock) {
|
||||||
if (inb(ICEMT(ice, PLAYBACK_CONTROL)) & (ICE1712_CAPTURE_START_SHADOW|
|
if (inb(ICEMT(ice, PLAYBACK_CONTROL)) & (ICE1712_CAPTURE_START_SHADOW|
|
||||||
ICE1712_PLAYBACK_PAUSE|
|
ICE1712_PLAYBACK_PAUSE|
|
||||||
ICE1712_PLAYBACK_START)) {
|
ICE1712_PLAYBACK_START))
|
||||||
__out:
|
|
||||||
spin_unlock_irqrestore(&ice->reg_lock, flags);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
if (!force && is_pro_rate_locked(ice))
|
if (!force && is_pro_rate_locked(ice))
|
||||||
goto __out;
|
return;
|
||||||
|
|
||||||
old = inb(ICEMT(ice, RATE));
|
old = inb(ICEMT(ice, RATE));
|
||||||
if (!force && old == val)
|
if (!force && old == val)
|
||||||
goto __out;
|
return;
|
||||||
|
|
||||||
ice->cur_rate = rate;
|
ice->cur_rate = rate;
|
||||||
outb(val, ICEMT(ice, RATE));
|
outb(val, ICEMT(ice, RATE));
|
||||||
spin_unlock_irqrestore(&ice->reg_lock, flags);
|
}
|
||||||
|
|
||||||
if (ice->gpio.set_pro_rate)
|
if (ice->gpio.set_pro_rate)
|
||||||
ice->gpio.set_pro_rate(ice, rate);
|
ice->gpio.set_pro_rate(ice, rate);
|
||||||
|
|
@ -1016,11 +1002,10 @@ static int snd_ice1712_playback_pro_prepare(struct snd_pcm_substream *substream)
|
||||||
struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
|
struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
|
||||||
|
|
||||||
ice->playback_pro_size = snd_pcm_lib_buffer_bytes(substream);
|
ice->playback_pro_size = snd_pcm_lib_buffer_bytes(substream);
|
||||||
spin_lock_irq(&ice->reg_lock);
|
guard(spinlock_irq)(&ice->reg_lock);
|
||||||
outl(substream->runtime->dma_addr, ICEMT(ice, PLAYBACK_ADDR));
|
outl(substream->runtime->dma_addr, ICEMT(ice, PLAYBACK_ADDR));
|
||||||
outw((ice->playback_pro_size >> 2) - 1, ICEMT(ice, PLAYBACK_SIZE));
|
outw((ice->playback_pro_size >> 2) - 1, ICEMT(ice, PLAYBACK_SIZE));
|
||||||
outw((snd_pcm_lib_period_bytes(substream) >> 2) - 1, ICEMT(ice, PLAYBACK_COUNT));
|
outw((snd_pcm_lib_period_bytes(substream) >> 2) - 1, ICEMT(ice, PLAYBACK_COUNT));
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -1039,11 +1024,10 @@ static int snd_ice1712_capture_pro_prepare(struct snd_pcm_substream *substream)
|
||||||
struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
|
struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
|
||||||
|
|
||||||
ice->capture_pro_size = snd_pcm_lib_buffer_bytes(substream);
|
ice->capture_pro_size = snd_pcm_lib_buffer_bytes(substream);
|
||||||
spin_lock_irq(&ice->reg_lock);
|
guard(spinlock_irq)(&ice->reg_lock);
|
||||||
outl(substream->runtime->dma_addr, ICEMT(ice, CAPTURE_ADDR));
|
outl(substream->runtime->dma_addr, ICEMT(ice, CAPTURE_ADDR));
|
||||||
outw((ice->capture_pro_size >> 2) - 1, ICEMT(ice, CAPTURE_SIZE));
|
outw((ice->capture_pro_size >> 2) - 1, ICEMT(ice, CAPTURE_SIZE));
|
||||||
outw((snd_pcm_lib_period_bytes(substream) >> 2) - 1, ICEMT(ice, CAPTURE_COUNT));
|
outw((snd_pcm_lib_period_bytes(substream) >> 2) - 1, ICEMT(ice, CAPTURE_COUNT));
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1258,12 +1242,11 @@ static int snd_ice1712_pro_mixer_switch_get(struct snd_kcontrol *kcontrol, struc
|
||||||
int priv_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) +
|
int priv_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) +
|
||||||
kcontrol->private_value;
|
kcontrol->private_value;
|
||||||
|
|
||||||
spin_lock_irq(&ice->reg_lock);
|
guard(spinlock_irq)(&ice->reg_lock);
|
||||||
ucontrol->value.integer.value[0] =
|
ucontrol->value.integer.value[0] =
|
||||||
!((ice->pro_volumes[priv_idx] >> 15) & 1);
|
!((ice->pro_volumes[priv_idx] >> 15) & 1);
|
||||||
ucontrol->value.integer.value[1] =
|
ucontrol->value.integer.value[1] =
|
||||||
!((ice->pro_volumes[priv_idx] >> 31) & 1);
|
!((ice->pro_volumes[priv_idx] >> 31) & 1);
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1276,12 +1259,11 @@ static int snd_ice1712_pro_mixer_switch_put(struct snd_kcontrol *kcontrol, struc
|
||||||
|
|
||||||
nval = (ucontrol->value.integer.value[0] ? 0 : 0x00008000) |
|
nval = (ucontrol->value.integer.value[0] ? 0 : 0x00008000) |
|
||||||
(ucontrol->value.integer.value[1] ? 0 : 0x80000000);
|
(ucontrol->value.integer.value[1] ? 0 : 0x80000000);
|
||||||
spin_lock_irq(&ice->reg_lock);
|
guard(spinlock_irq)(&ice->reg_lock);
|
||||||
nval |= ice->pro_volumes[priv_idx] & ~0x80008000;
|
nval |= ice->pro_volumes[priv_idx] & ~0x80008000;
|
||||||
change = nval != ice->pro_volumes[priv_idx];
|
change = nval != ice->pro_volumes[priv_idx];
|
||||||
ice->pro_volumes[priv_idx] = nval;
|
ice->pro_volumes[priv_idx] = nval;
|
||||||
snd_ice1712_update_volume(ice, priv_idx);
|
snd_ice1712_update_volume(ice, priv_idx);
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1300,12 +1282,11 @@ static int snd_ice1712_pro_mixer_volume_get(struct snd_kcontrol *kcontrol, struc
|
||||||
int priv_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) +
|
int priv_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) +
|
||||||
kcontrol->private_value;
|
kcontrol->private_value;
|
||||||
|
|
||||||
spin_lock_irq(&ice->reg_lock);
|
guard(spinlock_irq)(&ice->reg_lock);
|
||||||
ucontrol->value.integer.value[0] =
|
ucontrol->value.integer.value[0] =
|
||||||
(ice->pro_volumes[priv_idx] >> 0) & 127;
|
(ice->pro_volumes[priv_idx] >> 0) & 127;
|
||||||
ucontrol->value.integer.value[1] =
|
ucontrol->value.integer.value[1] =
|
||||||
(ice->pro_volumes[priv_idx] >> 16) & 127;
|
(ice->pro_volumes[priv_idx] >> 16) & 127;
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1318,12 +1299,11 @@ static int snd_ice1712_pro_mixer_volume_put(struct snd_kcontrol *kcontrol, struc
|
||||||
|
|
||||||
nval = (ucontrol->value.integer.value[0] & 127) |
|
nval = (ucontrol->value.integer.value[0] & 127) |
|
||||||
((ucontrol->value.integer.value[1] & 127) << 16);
|
((ucontrol->value.integer.value[1] & 127) << 16);
|
||||||
spin_lock_irq(&ice->reg_lock);
|
guard(spinlock_irq)(&ice->reg_lock);
|
||||||
nval |= ice->pro_volumes[priv_idx] & ~0x007f007f;
|
nval |= ice->pro_volumes[priv_idx] & ~0x007f007f;
|
||||||
change = nval != ice->pro_volumes[priv_idx];
|
change = nval != ice->pro_volumes[priv_idx];
|
||||||
ice->pro_volumes[priv_idx] = nval;
|
ice->pro_volumes[priv_idx] = nval;
|
||||||
snd_ice1712_update_volume(ice, priv_idx);
|
snd_ice1712_update_volume(ice, priv_idx);
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1781,7 +1761,7 @@ static int snd_ice1712_pro_internal_clock_get(struct snd_kcontrol *kcontrol,
|
||||||
};
|
};
|
||||||
unsigned char val;
|
unsigned char val;
|
||||||
|
|
||||||
spin_lock_irq(&ice->reg_lock);
|
guard(spinlock_irq)(&ice->reg_lock);
|
||||||
if (is_spdif_master(ice)) {
|
if (is_spdif_master(ice)) {
|
||||||
ucontrol->value.enumerated.item[0] = 13;
|
ucontrol->value.enumerated.item[0] = 13;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1792,7 +1772,6 @@ static int snd_ice1712_pro_internal_clock_get(struct snd_kcontrol *kcontrol,
|
||||||
}
|
}
|
||||||
ucontrol->value.enumerated.item[0] = val;
|
ucontrol->value.enumerated.item[0] = val;
|
||||||
}
|
}
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1916,10 +1895,9 @@ static int snd_ice1712_pro_rate_locking_put(struct snd_kcontrol *kcontrol,
|
||||||
int change = 0, nval;
|
int change = 0, nval;
|
||||||
|
|
||||||
nval = ucontrol->value.integer.value[0] ? 1 : 0;
|
nval = ucontrol->value.integer.value[0] ? 1 : 0;
|
||||||
spin_lock_irq(&ice->reg_lock);
|
guard(spinlock_irq)(&ice->reg_lock);
|
||||||
change = PRO_RATE_LOCKED != nval;
|
change = PRO_RATE_LOCKED != nval;
|
||||||
PRO_RATE_LOCKED = nval;
|
PRO_RATE_LOCKED = nval;
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1947,10 +1925,9 @@ static int snd_ice1712_pro_rate_reset_put(struct snd_kcontrol *kcontrol,
|
||||||
int change = 0, nval;
|
int change = 0, nval;
|
||||||
|
|
||||||
nval = ucontrol->value.integer.value[0] ? 1 : 0;
|
nval = ucontrol->value.integer.value[0] ? 1 : 0;
|
||||||
spin_lock_irq(&ice->reg_lock);
|
guard(spinlock_irq)(&ice->reg_lock);
|
||||||
change = PRO_RATE_RESET != nval;
|
change = PRO_RATE_RESET != nval;
|
||||||
PRO_RATE_RESET = nval;
|
PRO_RATE_RESET = nval;
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1986,10 +1963,10 @@ static int snd_ice1712_pro_route_analog_get(struct snd_kcontrol *kcontrol,
|
||||||
int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
|
int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
|
||||||
unsigned int val, cval;
|
unsigned int val, cval;
|
||||||
|
|
||||||
spin_lock_irq(&ice->reg_lock);
|
scoped_guard(spinlock_irq, &ice->reg_lock) {
|
||||||
val = inw(ICEMT(ice, ROUTE_PSDOUT03));
|
val = inw(ICEMT(ice, ROUTE_PSDOUT03));
|
||||||
cval = inl(ICEMT(ice, ROUTE_CAPTURE));
|
cval = inl(ICEMT(ice, ROUTE_CAPTURE));
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
}
|
||||||
|
|
||||||
val >>= ((idx % 2) * 8) + ((idx / 2) * 2);
|
val >>= ((idx % 2) * 8) + ((idx / 2) * 2);
|
||||||
val &= 3;
|
val &= 3;
|
||||||
|
|
@ -2023,19 +2000,19 @@ static int snd_ice1712_pro_route_analog_put(struct snd_kcontrol *kcontrol,
|
||||||
else
|
else
|
||||||
nval = 0; /* pcm */
|
nval = 0; /* pcm */
|
||||||
shift = ((idx % 2) * 8) + ((idx / 2) * 2);
|
shift = ((idx % 2) * 8) + ((idx / 2) * 2);
|
||||||
spin_lock_irq(&ice->reg_lock);
|
scoped_guard(spinlock_irq, &ice->reg_lock) {
|
||||||
val = old_val = inw(ICEMT(ice, ROUTE_PSDOUT03));
|
val = old_val = inw(ICEMT(ice, ROUTE_PSDOUT03));
|
||||||
val &= ~(0x03 << shift);
|
val &= ~(0x03 << shift);
|
||||||
val |= nval << shift;
|
val |= nval << shift;
|
||||||
change = val != old_val;
|
change = val != old_val;
|
||||||
if (change)
|
if (change)
|
||||||
outw(val, ICEMT(ice, ROUTE_PSDOUT03));
|
outw(val, ICEMT(ice, ROUTE_PSDOUT03));
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
}
|
||||||
if (nval < 2) /* dig mixer of pcm */
|
if (nval < 2) /* dig mixer of pcm */
|
||||||
return change;
|
return change;
|
||||||
|
|
||||||
/* update CAPTURE */
|
/* update CAPTURE */
|
||||||
spin_lock_irq(&ice->reg_lock);
|
scoped_guard(spinlock_irq, &ice->reg_lock) {
|
||||||
val = old_val = inl(ICEMT(ice, ROUTE_CAPTURE));
|
val = old_val = inl(ICEMT(ice, ROUTE_CAPTURE));
|
||||||
shift = ((idx / 2) * 8) + ((idx % 2) * 4);
|
shift = ((idx / 2) * 8) + ((idx % 2) * 4);
|
||||||
if (nval == 2) { /* analog in */
|
if (nval == 2) { /* analog in */
|
||||||
|
|
@ -2051,7 +2028,7 @@ static int snd_ice1712_pro_route_analog_put(struct snd_kcontrol *kcontrol,
|
||||||
change = 1;
|
change = 1;
|
||||||
outl(val, ICEMT(ice, ROUTE_CAPTURE));
|
outl(val, ICEMT(ice, ROUTE_CAPTURE));
|
||||||
}
|
}
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
}
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2084,7 +2061,7 @@ static int snd_ice1712_pro_route_spdif_put(struct snd_kcontrol *kcontrol,
|
||||||
unsigned int val, old_val, nval;
|
unsigned int val, old_val, nval;
|
||||||
|
|
||||||
/* update SPDOUT */
|
/* update SPDOUT */
|
||||||
spin_lock_irq(&ice->reg_lock);
|
guard(spinlock_irq)(&ice->reg_lock);
|
||||||
val = old_val = inw(ICEMT(ice, ROUTE_SPDOUT));
|
val = old_val = inw(ICEMT(ice, ROUTE_SPDOUT));
|
||||||
if (ucontrol->value.enumerated.item[0] >= 11)
|
if (ucontrol->value.enumerated.item[0] >= 11)
|
||||||
nval = 1;
|
nval = 1;
|
||||||
|
|
@ -2110,7 +2087,6 @@ static int snd_ice1712_pro_route_spdif_put(struct snd_kcontrol *kcontrol,
|
||||||
change = val != old_val;
|
change = val != old_val;
|
||||||
if (change)
|
if (change)
|
||||||
outw(val, ICEMT(ice, ROUTE_SPDOUT));
|
outw(val, ICEMT(ice, ROUTE_SPDOUT));
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2157,10 +2133,9 @@ static int snd_ice1712_pro_volume_rate_put(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
||||||
int change;
|
int change;
|
||||||
|
|
||||||
spin_lock_irq(&ice->reg_lock);
|
guard(spinlock_irq)(&ice->reg_lock);
|
||||||
change = inb(ICEMT(ice, MONITOR_RATE)) != ucontrol->value.integer.value[0];
|
change = inb(ICEMT(ice, MONITOR_RATE)) != ucontrol->value.integer.value[0];
|
||||||
outb(ucontrol->value.integer.value[0], ICEMT(ice, MONITOR_RATE));
|
outb(ucontrol->value.integer.value[0], ICEMT(ice, MONITOR_RATE));
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2188,12 +2163,11 @@ static int snd_ice1712_pro_peak_get(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
||||||
int idx;
|
int idx;
|
||||||
|
|
||||||
spin_lock_irq(&ice->reg_lock);
|
guard(spinlock_irq)(&ice->reg_lock);
|
||||||
for (idx = 0; idx < 22; idx++) {
|
for (idx = 0; idx < 22; idx++) {
|
||||||
outb(idx, ICEMT(ice, MONITOR_PEAKINDEX));
|
outb(idx, ICEMT(ice, MONITOR_PEAKINDEX));
|
||||||
ucontrol->value.integer.value[idx] = inb(ICEMT(ice, MONITOR_PEAKDATA));
|
ucontrol->value.integer.value[idx] = inb(ICEMT(ice, MONITOR_PEAKDATA));
|
||||||
}
|
}
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2675,11 +2649,11 @@ static int snd_ice1712_suspend(struct device *dev)
|
||||||
|
|
||||||
snd_ac97_suspend(ice->ac97);
|
snd_ac97_suspend(ice->ac97);
|
||||||
|
|
||||||
spin_lock_irq(&ice->reg_lock);
|
scoped_guard(spinlock_irq, &ice->reg_lock) {
|
||||||
ice->pm_saved_is_spdif_master = is_spdif_master(ice);
|
ice->pm_saved_is_spdif_master = is_spdif_master(ice);
|
||||||
ice->pm_saved_spdif_ctrl = inw(ICEMT(ice, ROUTE_SPDOUT));
|
ice->pm_saved_spdif_ctrl = inw(ICEMT(ice, ROUTE_SPDOUT));
|
||||||
ice->pm_saved_route = inw(ICEMT(ice, ROUTE_PSDOUT03));
|
ice->pm_saved_route = inw(ICEMT(ice, ROUTE_PSDOUT03));
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
}
|
||||||
|
|
||||||
if (ice->pm_suspend)
|
if (ice->pm_suspend)
|
||||||
ice->pm_suspend(ice);
|
ice->pm_suspend(ice);
|
||||||
|
|
@ -2712,10 +2686,10 @@ static int snd_ice1712_resume(struct device *dev)
|
||||||
|
|
||||||
if (ice->pm_saved_is_spdif_master) {
|
if (ice->pm_saved_is_spdif_master) {
|
||||||
/* switching to external clock via SPDIF */
|
/* switching to external clock via SPDIF */
|
||||||
spin_lock_irq(&ice->reg_lock);
|
scoped_guard(spinlock_irq, &ice->reg_lock) {
|
||||||
outb(inb(ICEMT(ice, RATE)) | ICE1712_SPDIF_MASTER,
|
outb(inb(ICEMT(ice, RATE)) | ICE1712_SPDIF_MASTER,
|
||||||
ICEMT(ice, RATE));
|
ICEMT(ice, RATE));
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
}
|
||||||
snd_ice1712_set_input_clock_source(ice, 1);
|
snd_ice1712_set_input_clock_source(ice, 1);
|
||||||
} else {
|
} else {
|
||||||
/* internal on-card clock */
|
/* internal on-card clock */
|
||||||
|
|
|
||||||
|
|
@ -288,9 +288,8 @@ static void vt1724_enable_midi_irq(struct snd_rawmidi_substream *substream,
|
||||||
{
|
{
|
||||||
struct snd_ice1712 *ice = substream->rmidi->private_data;
|
struct snd_ice1712 *ice = substream->rmidi->private_data;
|
||||||
|
|
||||||
spin_lock_irq(&ice->reg_lock);
|
guard(spinlock_irq)(&ice->reg_lock);
|
||||||
enable_midi_irq(ice, flag, enable);
|
enable_midi_irq(ice, flag, enable);
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vt1724_midi_output_open(struct snd_rawmidi_substream *s)
|
static int vt1724_midi_output_open(struct snd_rawmidi_substream *s)
|
||||||
|
|
@ -306,9 +305,8 @@ static int vt1724_midi_output_close(struct snd_rawmidi_substream *s)
|
||||||
static void vt1724_midi_output_trigger(struct snd_rawmidi_substream *s, int up)
|
static void vt1724_midi_output_trigger(struct snd_rawmidi_substream *s, int up)
|
||||||
{
|
{
|
||||||
struct snd_ice1712 *ice = s->rmidi->private_data;
|
struct snd_ice1712 *ice = s->rmidi->private_data;
|
||||||
unsigned long flags;
|
|
||||||
|
|
||||||
spin_lock_irqsave(&ice->reg_lock, flags);
|
guard(spinlock_irqsave)(&ice->reg_lock);
|
||||||
if (up) {
|
if (up) {
|
||||||
ice->midi_output = 1;
|
ice->midi_output = 1;
|
||||||
vt1724_midi_write(ice);
|
vt1724_midi_write(ice);
|
||||||
|
|
@ -316,7 +314,6 @@ static void vt1724_midi_output_trigger(struct snd_rawmidi_substream *s, int up)
|
||||||
ice->midi_output = 0;
|
ice->midi_output = 0;
|
||||||
enable_midi_irq(ice, VT1724_IRQ_MPU_TX, 0);
|
enable_midi_irq(ice, VT1724_IRQ_MPU_TX, 0);
|
||||||
}
|
}
|
||||||
spin_unlock_irqrestore(&ice->reg_lock, flags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vt1724_midi_output_drain(struct snd_rawmidi_substream *s)
|
static void vt1724_midi_output_drain(struct snd_rawmidi_substream *s)
|
||||||
|
|
@ -357,16 +354,14 @@ static int vt1724_midi_input_close(struct snd_rawmidi_substream *s)
|
||||||
static void vt1724_midi_input_trigger(struct snd_rawmidi_substream *s, int up)
|
static void vt1724_midi_input_trigger(struct snd_rawmidi_substream *s, int up)
|
||||||
{
|
{
|
||||||
struct snd_ice1712 *ice = s->rmidi->private_data;
|
struct snd_ice1712 *ice = s->rmidi->private_data;
|
||||||
unsigned long flags;
|
|
||||||
|
|
||||||
spin_lock_irqsave(&ice->reg_lock, flags);
|
guard(spinlock_irqsave)(&ice->reg_lock);
|
||||||
if (up) {
|
if (up) {
|
||||||
ice->midi_input = 1;
|
ice->midi_input = 1;
|
||||||
vt1724_midi_read(ice);
|
vt1724_midi_read(ice);
|
||||||
} else {
|
} else {
|
||||||
ice->midi_input = 0;
|
ice->midi_input = 0;
|
||||||
}
|
}
|
||||||
spin_unlock_irqrestore(&ice->reg_lock, flags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct snd_rawmidi_ops vt1724_midi_input_ops = {
|
static const struct snd_rawmidi_ops vt1724_midi_input_ops = {
|
||||||
|
|
@ -394,7 +389,7 @@ static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id)
|
||||||
status &= status_mask;
|
status &= status_mask;
|
||||||
if (status == 0)
|
if (status == 0)
|
||||||
break;
|
break;
|
||||||
spin_lock(&ice->reg_lock);
|
scoped_guard(spinlock, &ice->reg_lock) {
|
||||||
if (++timeout > 10) {
|
if (++timeout > 10) {
|
||||||
status = inb(ICEREG1724(ice, IRQSTAT));
|
status = inb(ICEREG1724(ice, IRQSTAT));
|
||||||
dev_err(ice->card->dev,
|
dev_err(ice->card->dev,
|
||||||
|
|
@ -403,8 +398,7 @@ static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id)
|
||||||
dev_err(ice->card->dev, "Disabling MPU_TX\n");
|
dev_err(ice->card->dev, "Disabling MPU_TX\n");
|
||||||
enable_midi_irq(ice, VT1724_IRQ_MPU_TX, 0);
|
enable_midi_irq(ice, VT1724_IRQ_MPU_TX, 0);
|
||||||
}
|
}
|
||||||
spin_unlock(&ice->reg_lock);
|
goto out;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
handled = 1;
|
handled = 1;
|
||||||
if (status & VT1724_IRQ_MPU_TX) {
|
if (status & VT1724_IRQ_MPU_TX) {
|
||||||
|
|
@ -427,7 +421,7 @@ static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id)
|
||||||
}
|
}
|
||||||
/* ack MPU irq */
|
/* ack MPU irq */
|
||||||
outb(status, ICEREG1724(ice, IRQSTAT));
|
outb(status, ICEREG1724(ice, IRQSTAT));
|
||||||
spin_unlock(&ice->reg_lock);
|
}
|
||||||
if (status & VT1724_IRQ_MTPCM) {
|
if (status & VT1724_IRQ_MTPCM) {
|
||||||
/*
|
/*
|
||||||
* Multi-track PCM
|
* Multi-track PCM
|
||||||
|
|
@ -481,6 +475,7 @@ static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
out:
|
||||||
return IRQ_RETVAL(handled);
|
return IRQ_RETVAL(handled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -539,27 +534,27 @@ static int snd_vt1724_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
|
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
|
||||||
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
|
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
|
||||||
spin_lock(&ice->reg_lock);
|
scoped_guard(spinlock, &ice->reg_lock) {
|
||||||
old = inb(ICEMT1724(ice, DMA_PAUSE));
|
old = inb(ICEMT1724(ice, DMA_PAUSE));
|
||||||
if (cmd == SNDRV_PCM_TRIGGER_PAUSE_PUSH)
|
if (cmd == SNDRV_PCM_TRIGGER_PAUSE_PUSH)
|
||||||
old |= what;
|
old |= what;
|
||||||
else
|
else
|
||||||
old &= ~what;
|
old &= ~what;
|
||||||
outb(old, ICEMT1724(ice, DMA_PAUSE));
|
outb(old, ICEMT1724(ice, DMA_PAUSE));
|
||||||
spin_unlock(&ice->reg_lock);
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SNDRV_PCM_TRIGGER_START:
|
case SNDRV_PCM_TRIGGER_START:
|
||||||
case SNDRV_PCM_TRIGGER_STOP:
|
case SNDRV_PCM_TRIGGER_STOP:
|
||||||
case SNDRV_PCM_TRIGGER_SUSPEND:
|
case SNDRV_PCM_TRIGGER_SUSPEND:
|
||||||
spin_lock(&ice->reg_lock);
|
scoped_guard(spinlock, &ice->reg_lock) {
|
||||||
old = inb(ICEMT1724(ice, DMA_CONTROL));
|
old = inb(ICEMT1724(ice, DMA_CONTROL));
|
||||||
if (cmd == SNDRV_PCM_TRIGGER_START)
|
if (cmd == SNDRV_PCM_TRIGGER_START)
|
||||||
old |= what;
|
old |= what;
|
||||||
else
|
else
|
||||||
old &= ~what;
|
old &= ~what;
|
||||||
outb(old, ICEMT1724(ice, DMA_CONTROL));
|
outb(old, ICEMT1724(ice, DMA_CONTROL));
|
||||||
spin_unlock(&ice->reg_lock);
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SNDRV_PCM_TRIGGER_RESUME:
|
case SNDRV_PCM_TRIGGER_RESUME:
|
||||||
|
|
@ -625,7 +620,6 @@ static unsigned char stdclock_set_mclk(struct snd_ice1712 *ice,
|
||||||
static int snd_vt1724_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate,
|
static int snd_vt1724_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate,
|
||||||
int force)
|
int force)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
|
||||||
unsigned char mclk_change;
|
unsigned char mclk_change;
|
||||||
unsigned int i, old_rate;
|
unsigned int i, old_rate;
|
||||||
bool call_set_rate = false;
|
bool call_set_rate = false;
|
||||||
|
|
@ -633,17 +627,15 @@ static int snd_vt1724_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate,
|
||||||
if (rate > ice->hw_rates->list[ice->hw_rates->count - 1])
|
if (rate > ice->hw_rates->list[ice->hw_rates->count - 1])
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
spin_lock_irqsave(&ice->reg_lock, flags);
|
scoped_guard(spinlock_irqsave, &ice->reg_lock) {
|
||||||
if ((inb(ICEMT1724(ice, DMA_CONTROL)) & DMA_STARTS) ||
|
if ((inb(ICEMT1724(ice, DMA_CONTROL)) & DMA_STARTS) ||
|
||||||
(inb(ICEMT1724(ice, DMA_PAUSE)) & DMA_PAUSES)) {
|
(inb(ICEMT1724(ice, DMA_PAUSE)) & DMA_PAUSES)) {
|
||||||
/* running? we cannot change the rate now... */
|
/* running? we cannot change the rate now... */
|
||||||
spin_unlock_irqrestore(&ice->reg_lock, flags);
|
|
||||||
return ((rate == ice->cur_rate) && !force) ? 0 : -EBUSY;
|
return ((rate == ice->cur_rate) && !force) ? 0 : -EBUSY;
|
||||||
}
|
}
|
||||||
if (!force && is_pro_rate_locked(ice)) {
|
if (!force && is_pro_rate_locked(ice)) {
|
||||||
/* comparing required and current rate - makes sense for
|
/* comparing required and current rate - makes sense for
|
||||||
* internal clock only */
|
* internal clock only */
|
||||||
spin_unlock_irqrestore(&ice->reg_lock, flags);
|
|
||||||
return (rate == ice->cur_rate) ? 0 : -EBUSY;
|
return (rate == ice->cur_rate) ? 0 : -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -654,13 +646,12 @@ static int snd_vt1724_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate,
|
||||||
if (force || (old_rate != rate))
|
if (force || (old_rate != rate))
|
||||||
call_set_rate = true;
|
call_set_rate = true;
|
||||||
else if (rate == ice->cur_rate) {
|
else if (rate == ice->cur_rate) {
|
||||||
spin_unlock_irqrestore(&ice->reg_lock, flags);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ice->cur_rate = rate;
|
ice->cur_rate = rate;
|
||||||
spin_unlock_irqrestore(&ice->reg_lock, flags);
|
}
|
||||||
|
|
||||||
if (call_set_rate)
|
if (call_set_rate)
|
||||||
ice->set_rate(ice, rate);
|
ice->set_rate(ice, rate);
|
||||||
|
|
@ -755,7 +746,7 @@ static int snd_vt1724_playback_pro_prepare(struct snd_pcm_substream *substream)
|
||||||
unsigned char val;
|
unsigned char val;
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
|
|
||||||
spin_lock_irq(&ice->reg_lock);
|
guard(spinlock_irq)(&ice->reg_lock);
|
||||||
val = (8 - substream->runtime->channels) >> 1;
|
val = (8 - substream->runtime->channels) >> 1;
|
||||||
outb(val, ICEMT1724(ice, BURST));
|
outb(val, ICEMT1724(ice, BURST));
|
||||||
|
|
||||||
|
|
@ -770,8 +761,6 @@ static int snd_vt1724_playback_pro_prepare(struct snd_pcm_substream *substream)
|
||||||
outw(size, ICEMT1724(ice, PLAYBACK_COUNT));
|
outw(size, ICEMT1724(ice, PLAYBACK_COUNT));
|
||||||
outb(size >> 16, ICEMT1724(ice, PLAYBACK_COUNT) + 2);
|
outb(size >> 16, ICEMT1724(ice, PLAYBACK_COUNT) + 2);
|
||||||
|
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
dev_dbg(ice->card->dev, "pro prepare: ch = %d, addr = 0x%x, "
|
dev_dbg(ice->card->dev, "pro prepare: ch = %d, addr = 0x%x, "
|
||||||
"buffer = 0x%x, period = 0x%x\n",
|
"buffer = 0x%x, period = 0x%x\n",
|
||||||
|
|
@ -825,13 +814,12 @@ static int snd_vt1724_pcm_prepare(struct snd_pcm_substream *substream)
|
||||||
struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
|
struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
|
||||||
const struct vt1724_pcm_reg *reg = substream->runtime->private_data;
|
const struct vt1724_pcm_reg *reg = substream->runtime->private_data;
|
||||||
|
|
||||||
spin_lock_irq(&ice->reg_lock);
|
guard(spinlock_irq)(&ice->reg_lock);
|
||||||
outl(substream->runtime->dma_addr, ice->profi_port + reg->addr);
|
outl(substream->runtime->dma_addr, ice->profi_port + reg->addr);
|
||||||
outw((snd_pcm_lib_buffer_bytes(substream) >> 2) - 1,
|
outw((snd_pcm_lib_buffer_bytes(substream) >> 2) - 1,
|
||||||
ice->profi_port + reg->size);
|
ice->profi_port + reg->size);
|
||||||
outw((snd_pcm_lib_period_bytes(substream) >> 2) - 1,
|
outw((snd_pcm_lib_period_bytes(substream) >> 2) - 1,
|
||||||
ice->profi_port + reg->count);
|
ice->profi_port + reg->count);
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1160,9 +1148,8 @@ static void update_spdif_bits(struct snd_ice1712 *ice, unsigned int val)
|
||||||
static void update_spdif_rate(struct snd_ice1712 *ice, unsigned int rate)
|
static void update_spdif_rate(struct snd_ice1712 *ice, unsigned int rate)
|
||||||
{
|
{
|
||||||
unsigned int val, nval;
|
unsigned int val, nval;
|
||||||
unsigned long flags;
|
|
||||||
|
|
||||||
spin_lock_irqsave(&ice->reg_lock, flags);
|
guard(spinlock_irqsave)(&ice->reg_lock);
|
||||||
nval = val = inw(ICEMT1724(ice, SPDIF_CTRL));
|
nval = val = inw(ICEMT1724(ice, SPDIF_CTRL));
|
||||||
nval &= ~(7 << 12);
|
nval &= ~(7 << 12);
|
||||||
switch (rate) {
|
switch (rate) {
|
||||||
|
|
@ -1176,7 +1163,6 @@ static void update_spdif_rate(struct snd_ice1712 *ice, unsigned int rate)
|
||||||
}
|
}
|
||||||
if (val != nval)
|
if (val != nval)
|
||||||
update_spdif_bits(ice, nval);
|
update_spdif_bits(ice, nval);
|
||||||
spin_unlock_irqrestore(&ice->reg_lock, flags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int snd_vt1724_playback_spdif_prepare(struct snd_pcm_substream *substream)
|
static int snd_vt1724_playback_spdif_prepare(struct snd_pcm_substream *substream)
|
||||||
|
|
@ -1362,11 +1348,11 @@ static int snd_vt1724_playback_indep_prepare(struct snd_pcm_substream *substream
|
||||||
struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
|
struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
|
||||||
unsigned char val;
|
unsigned char val;
|
||||||
|
|
||||||
spin_lock_irq(&ice->reg_lock);
|
scoped_guard(spinlock_irq, &ice->reg_lock) {
|
||||||
val = 3 - substream->number;
|
val = 3 - substream->number;
|
||||||
if (inb(ICEMT1724(ice, BURST)) < val)
|
if (inb(ICEMT1724(ice, BURST)) < val)
|
||||||
outb(val, ICEMT1724(ice, BURST));
|
outb(val, ICEMT1724(ice, BURST));
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
}
|
||||||
return snd_vt1724_pcm_prepare(substream);
|
return snd_vt1724_pcm_prepare(substream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1664,11 +1650,10 @@ static int snd_vt1724_spdif_default_put(struct snd_kcontrol *kcontrol,
|
||||||
unsigned int val, old;
|
unsigned int val, old;
|
||||||
|
|
||||||
val = encode_spdif_bits(&ucontrol->value.iec958);
|
val = encode_spdif_bits(&ucontrol->value.iec958);
|
||||||
spin_lock_irq(&ice->reg_lock);
|
guard(spinlock_irq)(&ice->reg_lock);
|
||||||
old = inw(ICEMT1724(ice, SPDIF_CTRL));
|
old = inw(ICEMT1724(ice, SPDIF_CTRL));
|
||||||
if (val != old)
|
if (val != old)
|
||||||
update_spdif_bits(ice, val);
|
update_spdif_bits(ice, val);
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
|
||||||
return val != old;
|
return val != old;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1739,14 +1724,13 @@ static int snd_vt1724_spdif_sw_put(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
||||||
unsigned char old, val;
|
unsigned char old, val;
|
||||||
|
|
||||||
spin_lock_irq(&ice->reg_lock);
|
guard(spinlock_irq)(&ice->reg_lock);
|
||||||
old = val = inb(ICEREG1724(ice, SPDIF_CFG));
|
old = val = inb(ICEREG1724(ice, SPDIF_CFG));
|
||||||
val &= ~VT1724_CFG_SPDIF_OUT_EN;
|
val &= ~VT1724_CFG_SPDIF_OUT_EN;
|
||||||
if (ucontrol->value.integer.value[0])
|
if (ucontrol->value.integer.value[0])
|
||||||
val |= VT1724_CFG_SPDIF_OUT_EN;
|
val |= VT1724_CFG_SPDIF_OUT_EN;
|
||||||
if (old != val)
|
if (old != val)
|
||||||
outb(val, ICEREG1724(ice, SPDIF_CFG));
|
outb(val, ICEREG1724(ice, SPDIF_CFG));
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
|
||||||
return old != val;
|
return old != val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1842,7 +1826,7 @@ static int snd_vt1724_pro_internal_clock_get(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
||||||
unsigned int i, rate;
|
unsigned int i, rate;
|
||||||
|
|
||||||
spin_lock_irq(&ice->reg_lock);
|
guard(spinlock_irq)(&ice->reg_lock);
|
||||||
if (ice->is_spdif_master(ice)) {
|
if (ice->is_spdif_master(ice)) {
|
||||||
ucontrol->value.enumerated.item[0] = ice->hw_rates->count +
|
ucontrol->value.enumerated.item[0] = ice->hw_rates->count +
|
||||||
ice->get_spdif_master_type(ice);
|
ice->get_spdif_master_type(ice);
|
||||||
|
|
@ -1856,7 +1840,6 @@ static int snd_vt1724_pro_internal_clock_get(struct snd_kcontrol *kcontrol,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1887,12 +1870,13 @@ static int snd_vt1724_pro_internal_clock_put(struct snd_kcontrol *kcontrol,
|
||||||
unsigned int old_rate, new_rate;
|
unsigned int old_rate, new_rate;
|
||||||
unsigned int item = ucontrol->value.enumerated.item[0];
|
unsigned int item = ucontrol->value.enumerated.item[0];
|
||||||
unsigned int first_ext_clock = ice->hw_rates->count;
|
unsigned int first_ext_clock = ice->hw_rates->count;
|
||||||
|
bool set_pro_rate = false;
|
||||||
|
|
||||||
if (item > first_ext_clock + ice->ext_clock_count - 1)
|
if (item > first_ext_clock + ice->ext_clock_count - 1)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/* if rate = 0 => external clock */
|
/* if rate = 0 => external clock */
|
||||||
spin_lock_irq(&ice->reg_lock);
|
scoped_guard(spinlock_irq, &ice->reg_lock) {
|
||||||
if (ice->is_spdif_master(ice))
|
if (ice->is_spdif_master(ice))
|
||||||
old_rate = 0;
|
old_rate = 0;
|
||||||
else
|
else
|
||||||
|
|
@ -1905,11 +1889,12 @@ static int snd_vt1724_pro_internal_clock_put(struct snd_kcontrol *kcontrol,
|
||||||
/* internal on-card clock */
|
/* internal on-card clock */
|
||||||
new_rate = ice->hw_rates->list[item];
|
new_rate = ice->hw_rates->list[item];
|
||||||
ice->pro_rate_default = new_rate;
|
ice->pro_rate_default = new_rate;
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
set_pro_rate = true;
|
||||||
snd_vt1724_set_pro_rate(ice, ice->pro_rate_default, 1);
|
|
||||||
spin_lock_irq(&ice->reg_lock);
|
|
||||||
}
|
}
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
}
|
||||||
|
|
||||||
|
if (set_pro_rate)
|
||||||
|
snd_vt1724_set_pro_rate(ice, ice->pro_rate_default, 1);
|
||||||
|
|
||||||
/* the first switch to the ext. clock mode? */
|
/* the first switch to the ext. clock mode? */
|
||||||
if (old_rate != new_rate && !new_rate) {
|
if (old_rate != new_rate && !new_rate) {
|
||||||
|
|
@ -1949,10 +1934,9 @@ static int snd_vt1724_pro_rate_locking_put(struct snd_kcontrol *kcontrol,
|
||||||
int change = 0, nval;
|
int change = 0, nval;
|
||||||
|
|
||||||
nval = ucontrol->value.integer.value[0] ? 1 : 0;
|
nval = ucontrol->value.integer.value[0] ? 1 : 0;
|
||||||
spin_lock_irq(&ice->reg_lock);
|
guard(spinlock_irq)(&ice->reg_lock);
|
||||||
change = PRO_RATE_LOCKED != nval;
|
change = PRO_RATE_LOCKED != nval;
|
||||||
PRO_RATE_LOCKED = nval;
|
PRO_RATE_LOCKED = nval;
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1980,10 +1964,9 @@ static int snd_vt1724_pro_rate_reset_put(struct snd_kcontrol *kcontrol,
|
||||||
int change = 0, nval;
|
int change = 0, nval;
|
||||||
|
|
||||||
nval = ucontrol->value.integer.value[0] ? 1 : 0;
|
nval = ucontrol->value.integer.value[0] ? 1 : 0;
|
||||||
spin_lock_irq(&ice->reg_lock);
|
guard(spinlock_irq)(&ice->reg_lock);
|
||||||
change = PRO_RATE_RESET != nval;
|
change = PRO_RATE_RESET != nval;
|
||||||
PRO_RATE_RESET = nval;
|
PRO_RATE_RESET = nval;
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2138,13 +2121,12 @@ static int snd_vt1724_pro_peak_get(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
||||||
int idx;
|
int idx;
|
||||||
|
|
||||||
spin_lock_irq(&ice->reg_lock);
|
guard(spinlock_irq)(&ice->reg_lock);
|
||||||
for (idx = 0; idx < 22; idx++) {
|
for (idx = 0; idx < 22; idx++) {
|
||||||
outb(idx, ICEMT1724(ice, MONITOR_PEAKINDEX));
|
outb(idx, ICEMT1724(ice, MONITOR_PEAKINDEX));
|
||||||
ucontrol->value.integer.value[idx] =
|
ucontrol->value.integer.value[idx] =
|
||||||
inb(ICEMT1724(ice, MONITOR_PEAKDATA));
|
inb(ICEMT1724(ice, MONITOR_PEAKDATA));
|
||||||
}
|
}
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2689,12 +2671,12 @@ static int snd_vt1724_suspend(struct device *dev)
|
||||||
|
|
||||||
snd_ac97_suspend(ice->ac97);
|
snd_ac97_suspend(ice->ac97);
|
||||||
|
|
||||||
spin_lock_irq(&ice->reg_lock);
|
scoped_guard(spinlock_irq, &ice->reg_lock) {
|
||||||
ice->pm_saved_is_spdif_master = ice->is_spdif_master(ice);
|
ice->pm_saved_is_spdif_master = ice->is_spdif_master(ice);
|
||||||
ice->pm_saved_spdif_ctrl = inw(ICEMT1724(ice, SPDIF_CTRL));
|
ice->pm_saved_spdif_ctrl = inw(ICEMT1724(ice, SPDIF_CTRL));
|
||||||
ice->pm_saved_spdif_cfg = inb(ICEREG1724(ice, SPDIF_CFG));
|
ice->pm_saved_spdif_cfg = inb(ICEREG1724(ice, SPDIF_CFG));
|
||||||
ice->pm_saved_route = inl(ICEMT1724(ice, ROUTE_PLAYBACK));
|
ice->pm_saved_route = inl(ICEMT1724(ice, ROUTE_PLAYBACK));
|
||||||
spin_unlock_irq(&ice->reg_lock);
|
}
|
||||||
|
|
||||||
if (ice->pm_suspend)
|
if (ice->pm_suspend)
|
||||||
ice->pm_suspend(ice);
|
ice->pm_suspend(ice);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue