mirror of https://github.com/torvalds/linux.git
ALSA: ice1712: Use guard() for mutex locks
Replace the manual mutex lock/unlock pairs with guard() for code simplification. Only code refactoring, and no behavior change. Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20250829144342.4290-35-tiwai@suse.de
This commit is contained in:
parent
2b429331f5
commit
9da230b3b2
|
|
@ -358,14 +358,13 @@ static int aureon_ac97_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_ele
|
||||||
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
||||||
unsigned short vol;
|
unsigned short vol;
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
|
|
||||||
vol = aureon_ac97_read(ice, kcontrol->private_value & 0x7F);
|
vol = aureon_ac97_read(ice, kcontrol->private_value & 0x7F);
|
||||||
ucontrol->value.integer.value[0] = 0x1F - (vol & 0x1F);
|
ucontrol->value.integer.value[0] = 0x1F - (vol & 0x1F);
|
||||||
if (kcontrol->private_value & AUREON_AC97_STEREO)
|
if (kcontrol->private_value & AUREON_AC97_STEREO)
|
||||||
ucontrol->value.integer.value[1] = 0x1F - ((vol >> 8) & 0x1F);
|
ucontrol->value.integer.value[1] = 0x1F - ((vol >> 8) & 0x1F);
|
||||||
|
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -401,12 +400,11 @@ static int aureon_ac97_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_el
|
||||||
{
|
{
|
||||||
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
|
|
||||||
ucontrol->value.integer.value[0] = aureon_ac97_read(ice,
|
ucontrol->value.integer.value[0] = aureon_ac97_read(ice,
|
||||||
kcontrol->private_value & 0x7F) & 0x8000 ? 0 : 1;
|
kcontrol->private_value & 0x7F) & 0x8000 ? 0 : 1;
|
||||||
|
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -439,11 +437,10 @@ static int aureon_ac97_micboost_get(struct snd_kcontrol *kcontrol, struct snd_ct
|
||||||
{
|
{
|
||||||
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
|
|
||||||
ucontrol->value.integer.value[0] = aureon_ac97_read(ice, AC97_MIC) & 0x0020 ? 0 : 1;
|
ucontrol->value.integer.value[0] = aureon_ac97_read(ice, AC97_MIC) & 0x0020 ? 0 : 1;
|
||||||
|
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -642,11 +639,10 @@ static int aureon_ac97_mmute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_e
|
||||||
{
|
{
|
||||||
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
|
|
||||||
ucontrol->value.integer.value[0] = (wm_get(ice, WM_OUT_MUX1) >> 1) & 0x01;
|
ucontrol->value.integer.value[0] = (wm_get(ice, WM_OUT_MUX1) >> 1) & 0x01;
|
||||||
|
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -704,9 +700,8 @@ static int wm_pcm_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_va
|
||||||
{
|
{
|
||||||
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
ucontrol->value.integer.value[0] = (wm_get(ice, WM_MUTE) & 0x10) ? 0 : 1;
|
ucontrol->value.integer.value[0] = (wm_get(ice, WM_MUTE) & 0x10) ? 0 : 1;
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -944,11 +939,10 @@ static int wm_pcm_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
|
||||||
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
||||||
unsigned short val;
|
unsigned short val;
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
val = wm_get(ice, WM_DAC_DIG_MASTER_ATTEN) & 0xff;
|
val = wm_get(ice, WM_DAC_DIG_MASTER_ATTEN) & 0xff;
|
||||||
val = val > PCM_MIN ? (val - PCM_MIN) : 0;
|
val = val > PCM_MIN ? (val - PCM_MIN) : 0;
|
||||||
ucontrol->value.integer.value[0] = val;
|
ucontrol->value.integer.value[0] = val;
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -984,12 +978,11 @@ static int wm_adc_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_va
|
||||||
unsigned short val;
|
unsigned short val;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
val = wm_get(ice, WM_ADC_GAIN + i);
|
val = wm_get(ice, WM_ADC_GAIN + i);
|
||||||
ucontrol->value.integer.value[i] = ~val>>5 & 0x1;
|
ucontrol->value.integer.value[i] = ~val>>5 & 0x1;
|
||||||
}
|
}
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1031,13 +1024,12 @@ static int wm_adc_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
|
||||||
int i, idx;
|
int i, idx;
|
||||||
unsigned short vol;
|
unsigned short vol;
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
idx = WM_ADC_GAIN + i;
|
idx = WM_ADC_GAIN + i;
|
||||||
vol = wm_get(ice, idx) & 0x1f;
|
vol = wm_get(ice, idx) & 0x1f;
|
||||||
ucontrol->value.integer.value[i] = vol;
|
ucontrol->value.integer.value[i] = vol;
|
||||||
}
|
}
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1097,11 +1089,10 @@ static int wm_adc_mux_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
|
||||||
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
||||||
unsigned short val;
|
unsigned short val;
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
val = wm_get(ice, WM_ADC_MUX);
|
val = wm_get(ice, WM_ADC_MUX);
|
||||||
ucontrol->value.enumerated.item[0] = val & 7;
|
ucontrol->value.enumerated.item[0] = val & 7;
|
||||||
ucontrol->value.enumerated.item[1] = (val >> 4) & 7;
|
ucontrol->value.enumerated.item[1] = (val >> 4) & 7;
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -126,13 +126,12 @@ static int ap_cs8427_sendbytes(struct snd_i2c_device *device, unsigned char *byt
|
||||||
int res = count;
|
int res = count;
|
||||||
unsigned char tmp;
|
unsigned char tmp;
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
tmp = ap_cs8427_codec_select(ice);
|
tmp = ap_cs8427_codec_select(ice);
|
||||||
ap_cs8427_write_byte(ice, (device->addr << 1) | 0, tmp); /* address + write mode */
|
ap_cs8427_write_byte(ice, (device->addr << 1) | 0, tmp); /* address + write mode */
|
||||||
while (count-- > 0)
|
while (count-- > 0)
|
||||||
ap_cs8427_write_byte(ice, *bytes++, tmp);
|
ap_cs8427_write_byte(ice, *bytes++, tmp);
|
||||||
ap_cs8427_codec_deassert(ice, tmp);
|
ap_cs8427_codec_deassert(ice, tmp);
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -143,13 +142,12 @@ static int ap_cs8427_readbytes(struct snd_i2c_device *device, unsigned char *byt
|
||||||
int res = count;
|
int res = count;
|
||||||
unsigned char tmp;
|
unsigned char tmp;
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
tmp = ap_cs8427_codec_select(ice);
|
tmp = ap_cs8427_codec_select(ice);
|
||||||
ap_cs8427_write_byte(ice, (device->addr << 1) | 1, tmp); /* address + read mode */
|
ap_cs8427_write_byte(ice, (device->addr << 1) | 1, tmp); /* address + read mode */
|
||||||
while (count-- > 0)
|
while (count-- > 0)
|
||||||
*bytes++ = ap_cs8427_read_byte(ice, tmp);
|
*bytes++ = ap_cs8427_read_byte(ice, tmp);
|
||||||
ap_cs8427_codec_deassert(ice, tmp);
|
ap_cs8427_codec_deassert(ice, tmp);
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -176,7 +174,7 @@ static void snd_ice1712_delta_cs8403_spdif_write(struct snd_ice1712 *ice, unsign
|
||||||
/* send byte to transmitter */
|
/* send byte to transmitter */
|
||||||
mask1 = ICE1712_DELTA_SPDIF_OUT_STAT_CLOCK;
|
mask1 = ICE1712_DELTA_SPDIF_OUT_STAT_CLOCK;
|
||||||
mask2 = ICE1712_DELTA_SPDIF_OUT_STAT_DATA;
|
mask2 = ICE1712_DELTA_SPDIF_OUT_STAT_DATA;
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA);
|
tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA);
|
||||||
for (idx = 7; idx >= 0; idx--) {
|
for (idx = 7; idx >= 0; idx--) {
|
||||||
tmp &= ~(mask1 | mask2);
|
tmp &= ~(mask1 | mask2);
|
||||||
|
|
@ -190,7 +188,6 @@ static void snd_ice1712_delta_cs8403_spdif_write(struct snd_ice1712 *ice, unsign
|
||||||
}
|
}
|
||||||
tmp &= ~mask1;
|
tmp &= ~mask1;
|
||||||
snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
|
snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -306,14 +303,13 @@ static void delta_1010_set_rate_val(struct snd_ice1712 *ice, unsigned int rate)
|
||||||
if (rate == 0) /* no hint - S/PDIF input is master, simply return */
|
if (rate == 0) /* no hint - S/PDIF input is master, simply return */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA);
|
tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA);
|
||||||
tmp2 = tmp & ~ICE1712_DELTA_DFS;
|
tmp2 = tmp & ~ICE1712_DELTA_DFS;
|
||||||
if (rate > 48000)
|
if (rate > 48000)
|
||||||
tmp2 |= ICE1712_DELTA_DFS;
|
tmp2 |= ICE1712_DELTA_DFS;
|
||||||
if (tmp != tmp2)
|
if (tmp != tmp2)
|
||||||
snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp2);
|
snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp2);
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -328,9 +324,9 @@ static void delta_ak4524_set_rate_val(struct snd_akm4xxx *ak, unsigned int rate)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* check before reset ak4524 to avoid unnecessary clicks */
|
/* check before reset ak4524 to avoid unnecessary clicks */
|
||||||
mutex_lock(&ice->gpio_mutex);
|
scoped_guard(mutex, &ice->gpio_mutex) {
|
||||||
tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA);
|
tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA);
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
}
|
||||||
tmp2 = tmp & ~ICE1712_DELTA_DFS;
|
tmp2 = tmp & ~ICE1712_DELTA_DFS;
|
||||||
if (rate > 48000)
|
if (rate > 48000)
|
||||||
tmp2 |= ICE1712_DELTA_DFS;
|
tmp2 |= ICE1712_DELTA_DFS;
|
||||||
|
|
@ -339,12 +335,12 @@ static void delta_ak4524_set_rate_val(struct snd_akm4xxx *ak, unsigned int rate)
|
||||||
|
|
||||||
/* do it again */
|
/* do it again */
|
||||||
snd_akm4xxx_reset(ak, 1);
|
snd_akm4xxx_reset(ak, 1);
|
||||||
mutex_lock(&ice->gpio_mutex);
|
scoped_guard(mutex, &ice->gpio_mutex) {
|
||||||
tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA) & ~ICE1712_DELTA_DFS;
|
tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA) & ~ICE1712_DELTA_DFS;
|
||||||
if (rate > 48000)
|
if (rate > 48000)
|
||||||
tmp |= ICE1712_DELTA_DFS;
|
tmp |= ICE1712_DELTA_DFS;
|
||||||
snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
|
snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
}
|
||||||
snd_akm4xxx_reset(ak, 0);
|
snd_akm4xxx_reset(ak, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,35 +41,35 @@ static void snd_ice1712_stdsp24_gpio_write(struct snd_ice1712 *ice, unsigned cha
|
||||||
static void snd_ice1712_stdsp24_darear(struct snd_ice1712 *ice, int activate)
|
static void snd_ice1712_stdsp24_darear(struct snd_ice1712 *ice, int activate)
|
||||||
{
|
{
|
||||||
struct hoontech_spec *spec = ice->spec;
|
struct hoontech_spec *spec = ice->spec;
|
||||||
mutex_lock(&ice->gpio_mutex);
|
|
||||||
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
ICE1712_STDSP24_0_DAREAR(spec->boxbits, activate);
|
ICE1712_STDSP24_0_DAREAR(spec->boxbits, activate);
|
||||||
snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[0]);
|
snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[0]);
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void snd_ice1712_stdsp24_mute(struct snd_ice1712 *ice, int activate)
|
static void snd_ice1712_stdsp24_mute(struct snd_ice1712 *ice, int activate)
|
||||||
{
|
{
|
||||||
struct hoontech_spec *spec = ice->spec;
|
struct hoontech_spec *spec = ice->spec;
|
||||||
mutex_lock(&ice->gpio_mutex);
|
|
||||||
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
ICE1712_STDSP24_3_MUTE(spec->boxbits, activate);
|
ICE1712_STDSP24_3_MUTE(spec->boxbits, activate);
|
||||||
snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[3]);
|
snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[3]);
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void snd_ice1712_stdsp24_insel(struct snd_ice1712 *ice, int activate)
|
static void snd_ice1712_stdsp24_insel(struct snd_ice1712 *ice, int activate)
|
||||||
{
|
{
|
||||||
struct hoontech_spec *spec = ice->spec;
|
struct hoontech_spec *spec = ice->spec;
|
||||||
mutex_lock(&ice->gpio_mutex);
|
|
||||||
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
ICE1712_STDSP24_3_INSEL(spec->boxbits, activate);
|
ICE1712_STDSP24_3_INSEL(spec->boxbits, activate);
|
||||||
snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[3]);
|
snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[3]);
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void snd_ice1712_stdsp24_box_channel(struct snd_ice1712 *ice, int box, int chn, int activate)
|
static void snd_ice1712_stdsp24_box_channel(struct snd_ice1712 *ice, int box, int chn, int activate)
|
||||||
{
|
{
|
||||||
struct hoontech_spec *spec = ice->spec;
|
struct hoontech_spec *spec = ice->spec;
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
|
|
||||||
/* select box */
|
/* select box */
|
||||||
ICE1712_STDSP24_0_BOX(spec->boxbits, box);
|
ICE1712_STDSP24_0_BOX(spec->boxbits, box);
|
||||||
|
|
@ -111,15 +111,13 @@ static void snd_ice1712_stdsp24_box_channel(struct snd_ice1712 *ice, int box, in
|
||||||
|
|
||||||
ICE1712_STDSP24_2_MIDI1(spec->boxbits, 0);
|
ICE1712_STDSP24_2_MIDI1(spec->boxbits, 0);
|
||||||
snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[2]);
|
snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[2]);
|
||||||
|
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void snd_ice1712_stdsp24_box_midi(struct snd_ice1712 *ice, int box, int master)
|
static void snd_ice1712_stdsp24_box_midi(struct snd_ice1712 *ice, int box, int master)
|
||||||
{
|
{
|
||||||
struct hoontech_spec *spec = ice->spec;
|
struct hoontech_spec *spec = ice->spec;
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
|
|
||||||
/* select box */
|
/* select box */
|
||||||
ICE1712_STDSP24_0_BOX(spec->boxbits, box);
|
ICE1712_STDSP24_0_BOX(spec->boxbits, box);
|
||||||
|
|
@ -139,17 +137,15 @@ static void snd_ice1712_stdsp24_box_midi(struct snd_ice1712 *ice, int box, int m
|
||||||
|
|
||||||
ICE1712_STDSP24_2_MIDIIN(spec->boxbits, 1);
|
ICE1712_STDSP24_2_MIDIIN(spec->boxbits, 1);
|
||||||
snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[2]);
|
snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[2]);
|
||||||
|
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void snd_ice1712_stdsp24_midi2(struct snd_ice1712 *ice, int activate)
|
static void snd_ice1712_stdsp24_midi2(struct snd_ice1712 *ice, int activate)
|
||||||
{
|
{
|
||||||
struct hoontech_spec *spec = ice->spec;
|
struct hoontech_spec *spec = ice->spec;
|
||||||
mutex_lock(&ice->gpio_mutex);
|
|
||||||
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
ICE1712_STDSP24_3_MIDI2(spec->boxbits, activate);
|
ICE1712_STDSP24_3_MIDI2(spec->boxbits, activate);
|
||||||
snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[3]);
|
snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[3]);
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hoontech_init(struct snd_ice1712 *ice, bool staudio)
|
static int hoontech_init(struct snd_ice1712 *ice, bool staudio)
|
||||||
|
|
|
||||||
|
|
@ -684,24 +684,21 @@ static int snd_vt1724_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int snd_vt1724_pcm_hw_params(struct snd_pcm_substream *substream,
|
static int __snd_vt1724_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||||
struct snd_pcm_hw_params *hw_params)
|
struct snd_pcm_hw_params *hw_params)
|
||||||
{
|
{
|
||||||
struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
|
struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
|
||||||
int i, chs;
|
int i, chs;
|
||||||
|
|
||||||
chs = params_channels(hw_params);
|
chs = params_channels(hw_params);
|
||||||
mutex_lock(&ice->open_mutex);
|
|
||||||
/* mark surround channels */
|
/* mark surround channels */
|
||||||
if (substream == ice->playback_pro_substream) {
|
if (substream == ice->playback_pro_substream) {
|
||||||
/* PDMA0 can be multi-channel up to 8 */
|
/* PDMA0 can be multi-channel up to 8 */
|
||||||
chs = chs / 2 - 1;
|
chs = chs / 2 - 1;
|
||||||
for (i = 0; i < chs; i++) {
|
for (i = 0; i < chs; i++) {
|
||||||
if (ice->pcm_reserved[i] &&
|
if (ice->pcm_reserved[i] &&
|
||||||
ice->pcm_reserved[i] != substream) {
|
ice->pcm_reserved[i] != substream)
|
||||||
mutex_unlock(&ice->open_mutex);
|
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
|
||||||
ice->pcm_reserved[i] = substream;
|
ice->pcm_reserved[i] = substream;
|
||||||
}
|
}
|
||||||
for (; i < 3; i++) {
|
for (; i < 3; i++) {
|
||||||
|
|
@ -713,16 +710,28 @@ static int snd_vt1724_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||||
/* check individual playback stream */
|
/* check individual playback stream */
|
||||||
if (ice->playback_con_substream_ds[i] == substream) {
|
if (ice->playback_con_substream_ds[i] == substream) {
|
||||||
if (ice->pcm_reserved[i] &&
|
if (ice->pcm_reserved[i] &&
|
||||||
ice->pcm_reserved[i] != substream) {
|
ice->pcm_reserved[i] != substream)
|
||||||
mutex_unlock(&ice->open_mutex);
|
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
|
||||||
ice->pcm_reserved[i] = substream;
|
ice->pcm_reserved[i] = substream;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mutex_unlock(&ice->open_mutex);
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int snd_vt1724_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||||
|
struct snd_pcm_hw_params *hw_params)
|
||||||
|
{
|
||||||
|
struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
|
||||||
|
int err;
|
||||||
|
|
||||||
|
scoped_guard(mutex, &ice->open_mutex) {
|
||||||
|
err = __snd_vt1724_pcm_hw_params(substream, hw_params);
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
return snd_vt1724_set_pro_rate(ice, params_rate(hw_params), 0);
|
return snd_vt1724_set_pro_rate(ice, params_rate(hw_params), 0);
|
||||||
}
|
}
|
||||||
|
|
@ -732,12 +741,11 @@ static int snd_vt1724_pcm_hw_free(struct snd_pcm_substream *substream)
|
||||||
struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
|
struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
mutex_lock(&ice->open_mutex);
|
guard(mutex)(&ice->open_mutex);
|
||||||
/* unmark surround channels */
|
/* unmark surround channels */
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
if (ice->pcm_reserved[i] == substream)
|
if (ice->pcm_reserved[i] == substream)
|
||||||
ice->pcm_reserved[i] = NULL;
|
ice->pcm_reserved[i] = NULL;
|
||||||
mutex_unlock(&ice->open_mutex);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1013,7 +1021,7 @@ static int snd_vt1724_playback_pro_open(struct snd_pcm_substream *substream)
|
||||||
snd_pcm_set_sync(substream);
|
snd_pcm_set_sync(substream);
|
||||||
snd_pcm_hw_constraint_msbits(runtime, 0, 32, 24);
|
snd_pcm_hw_constraint_msbits(runtime, 0, 32, 24);
|
||||||
set_rate_constraints(ice, substream);
|
set_rate_constraints(ice, substream);
|
||||||
mutex_lock(&ice->open_mutex);
|
scoped_guard(mutex, &ice->open_mutex) {
|
||||||
/* calculate the currently available channels */
|
/* calculate the currently available channels */
|
||||||
num_indeps = ice->num_total_dacs / 2 - 1;
|
num_indeps = ice->num_total_dacs / 2 - 1;
|
||||||
for (chs = 0; chs < num_indeps; chs++) {
|
for (chs = 0; chs < num_indeps; chs++) {
|
||||||
|
|
@ -1024,7 +1032,7 @@ static int snd_vt1724_playback_pro_open(struct snd_pcm_substream *substream)
|
||||||
runtime->hw.channels_max = chs;
|
runtime->hw.channels_max = chs;
|
||||||
if (chs > 2) /* channels must be even */
|
if (chs > 2) /* channels must be even */
|
||||||
snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, 2);
|
snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, 2);
|
||||||
mutex_unlock(&ice->open_mutex);
|
}
|
||||||
snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
|
snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
|
||||||
VT1724_BUFFER_ALIGN);
|
VT1724_BUFFER_ALIGN);
|
||||||
snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
|
snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
|
||||||
|
|
@ -1367,13 +1375,11 @@ static int snd_vt1724_playback_indep_open(struct snd_pcm_substream *substream)
|
||||||
struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
|
struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
|
||||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||||
|
|
||||||
mutex_lock(&ice->open_mutex);
|
scoped_guard(mutex, &ice->open_mutex) {
|
||||||
/* already used by PDMA0? */
|
/* already used by PDMA0? */
|
||||||
if (ice->pcm_reserved[substream->number]) {
|
if (ice->pcm_reserved[substream->number])
|
||||||
mutex_unlock(&ice->open_mutex);
|
|
||||||
return -EBUSY; /* FIXME: should handle blocking mode properly */
|
return -EBUSY; /* FIXME: should handle blocking mode properly */
|
||||||
}
|
}
|
||||||
mutex_unlock(&ice->open_mutex);
|
|
||||||
runtime->private_data = (void *)&vt1724_playback_dma_regs[substream->number];
|
runtime->private_data = (void *)&vt1724_playback_dma_regs[substream->number];
|
||||||
ice->playback_con_substream_ds[substream->number] = substream;
|
ice->playback_con_substream_ds[substream->number] = substream;
|
||||||
runtime->hw = snd_vt1724_2ch_stereo;
|
runtime->hw = snd_vt1724_2ch_stereo;
|
||||||
|
|
@ -2220,13 +2226,12 @@ unsigned char snd_vt1724_read_i2c(struct snd_ice1712 *ice,
|
||||||
{
|
{
|
||||||
unsigned char val;
|
unsigned char val;
|
||||||
|
|
||||||
mutex_lock(&ice->i2c_mutex);
|
guard(mutex)(&ice->i2c_mutex);
|
||||||
wait_i2c_busy(ice);
|
wait_i2c_busy(ice);
|
||||||
outb(addr, ICEREG1724(ice, I2C_BYTE_ADDR));
|
outb(addr, ICEREG1724(ice, I2C_BYTE_ADDR));
|
||||||
outb(dev & ~VT1724_I2C_WRITE, ICEREG1724(ice, I2C_DEV_ADDR));
|
outb(dev & ~VT1724_I2C_WRITE, ICEREG1724(ice, I2C_DEV_ADDR));
|
||||||
wait_i2c_busy(ice);
|
wait_i2c_busy(ice);
|
||||||
val = inb(ICEREG1724(ice, I2C_DATA));
|
val = inb(ICEREG1724(ice, I2C_DATA));
|
||||||
mutex_unlock(&ice->i2c_mutex);
|
|
||||||
/*
|
/*
|
||||||
dev_dbg(ice->card->dev, "i2c_read: [0x%x,0x%x] = 0x%x\n", dev, addr, val);
|
dev_dbg(ice->card->dev, "i2c_read: [0x%x,0x%x] = 0x%x\n", dev, addr, val);
|
||||||
*/
|
*/
|
||||||
|
|
@ -2236,7 +2241,7 @@ unsigned char snd_vt1724_read_i2c(struct snd_ice1712 *ice,
|
||||||
void snd_vt1724_write_i2c(struct snd_ice1712 *ice,
|
void snd_vt1724_write_i2c(struct snd_ice1712 *ice,
|
||||||
unsigned char dev, unsigned char addr, unsigned char data)
|
unsigned char dev, unsigned char addr, unsigned char data)
|
||||||
{
|
{
|
||||||
mutex_lock(&ice->i2c_mutex);
|
guard(mutex)(&ice->i2c_mutex);
|
||||||
wait_i2c_busy(ice);
|
wait_i2c_busy(ice);
|
||||||
/*
|
/*
|
||||||
dev_dbg(ice->card->dev, "i2c_write: [0x%x,0x%x] = 0x%x\n", dev, addr, data);
|
dev_dbg(ice->card->dev, "i2c_write: [0x%x,0x%x] = 0x%x\n", dev, addr, data);
|
||||||
|
|
@ -2245,7 +2250,6 @@ void snd_vt1724_write_i2c(struct snd_ice1712 *ice,
|
||||||
outb(data, ICEREG1724(ice, I2C_DATA));
|
outb(data, ICEREG1724(ice, I2C_DATA));
|
||||||
outb(dev | VT1724_I2C_WRITE, ICEREG1724(ice, I2C_DEV_ADDR));
|
outb(dev | VT1724_I2C_WRITE, ICEREG1724(ice, I2C_DEV_ADDR));
|
||||||
wait_i2c_busy(ice);
|
wait_i2c_busy(ice);
|
||||||
mutex_unlock(&ice->i2c_mutex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int snd_vt1724_read_eeprom(struct snd_ice1712 *ice,
|
static int snd_vt1724_read_eeprom(struct snd_ice1712 *ice,
|
||||||
|
|
|
||||||
|
|
@ -175,10 +175,9 @@ static int maya_vol_get(struct snd_kcontrol *kcontrol,
|
||||||
&chip->wm[snd_ctl_get_ioff(kcontrol, &ucontrol->id)];
|
&chip->wm[snd_ctl_get_ioff(kcontrol, &ucontrol->id)];
|
||||||
unsigned int idx = kcontrol->private_value;
|
unsigned int idx = kcontrol->private_value;
|
||||||
|
|
||||||
mutex_lock(&chip->mutex);
|
guard(mutex)(&chip->mutex);
|
||||||
ucontrol->value.integer.value[0] = wm->volumes[idx][0];
|
ucontrol->value.integer.value[0] = wm->volumes[idx][0];
|
||||||
ucontrol->value.integer.value[1] = wm->volumes[idx][1];
|
ucontrol->value.integer.value[1] = wm->volumes[idx][1];
|
||||||
mutex_unlock(&chip->mutex);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -193,7 +192,7 @@ static int maya_vol_put(struct snd_kcontrol *kcontrol,
|
||||||
unsigned int val, data;
|
unsigned int val, data;
|
||||||
int ch, changed = 0;
|
int ch, changed = 0;
|
||||||
|
|
||||||
mutex_lock(&chip->mutex);
|
guard(mutex)(&chip->mutex);
|
||||||
for (ch = 0; ch < 2; ch++) {
|
for (ch = 0; ch < 2; ch++) {
|
||||||
val = ucontrol->value.integer.value[ch];
|
val = ucontrol->value.integer.value[ch];
|
||||||
if (val > vol->maxval)
|
if (val > vol->maxval)
|
||||||
|
|
@ -213,7 +212,6 @@ static int maya_vol_put(struct snd_kcontrol *kcontrol,
|
||||||
val ? 0 : vol->mux_bits[ch]);
|
val ? 0 : vol->mux_bits[ch]);
|
||||||
wm->volumes[idx][ch] = val;
|
wm->volumes[idx][ch] = val;
|
||||||
}
|
}
|
||||||
mutex_unlock(&chip->mutex);
|
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -250,7 +248,7 @@ static int maya_sw_put(struct snd_kcontrol *kcontrol,
|
||||||
unsigned int mask, val;
|
unsigned int mask, val;
|
||||||
int changed;
|
int changed;
|
||||||
|
|
||||||
mutex_lock(&chip->mutex);
|
guard(mutex)(&chip->mutex);
|
||||||
mask = 1 << idx;
|
mask = 1 << idx;
|
||||||
wm->switch_bits &= ~mask;
|
wm->switch_bits &= ~mask;
|
||||||
val = ucontrol->value.integer.value[0];
|
val = ucontrol->value.integer.value[0];
|
||||||
|
|
@ -260,7 +258,6 @@ static int maya_sw_put(struct snd_kcontrol *kcontrol,
|
||||||
changed = wm8776_write_bits(chip->ice, wm,
|
changed = wm8776_write_bits(chip->ice, wm,
|
||||||
GET_SW_VAL_REG(kcontrol->private_value),
|
GET_SW_VAL_REG(kcontrol->private_value),
|
||||||
mask, val ? mask : 0);
|
mask, val ? mask : 0);
|
||||||
mutex_unlock(&chip->mutex);
|
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -315,14 +312,13 @@ static int maya_gpio_sw_put(struct snd_kcontrol *kcontrol,
|
||||||
unsigned int val, mask;
|
unsigned int val, mask;
|
||||||
int changed;
|
int changed;
|
||||||
|
|
||||||
mutex_lock(&chip->mutex);
|
guard(mutex)(&chip->mutex);
|
||||||
mask = 1 << shift;
|
mask = 1 << shift;
|
||||||
val = ucontrol->value.integer.value[0];
|
val = ucontrol->value.integer.value[0];
|
||||||
if (GET_GPIO_VAL_INV(kcontrol->private_value))
|
if (GET_GPIO_VAL_INV(kcontrol->private_value))
|
||||||
val = !val;
|
val = !val;
|
||||||
val = val ? mask : 0;
|
val = val ? mask : 0;
|
||||||
changed = maya_set_gpio_bits(chip->ice, mask, val);
|
changed = maya_set_gpio_bits(chip->ice, mask, val);
|
||||||
mutex_unlock(&chip->mutex);
|
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -369,11 +365,10 @@ static int maya_rec_src_put(struct snd_kcontrol *kcontrol,
|
||||||
int sel = ucontrol->value.enumerated.item[0];
|
int sel = ucontrol->value.enumerated.item[0];
|
||||||
int changed;
|
int changed;
|
||||||
|
|
||||||
mutex_lock(&chip->mutex);
|
guard(mutex)(&chip->mutex);
|
||||||
changed = maya_set_gpio_bits(chip->ice, 1 << GPIO_MIC_RELAY,
|
changed = maya_set_gpio_bits(chip->ice, 1 << GPIO_MIC_RELAY,
|
||||||
sel ? (1 << GPIO_MIC_RELAY) : 0);
|
sel ? (1 << GPIO_MIC_RELAY) : 0);
|
||||||
wm8776_select_input(chip, 0, sel ? MAYA_MIC_IN : MAYA_LINE_IN);
|
wm8776_select_input(chip, 0, sel ? MAYA_MIC_IN : MAYA_LINE_IN);
|
||||||
mutex_unlock(&chip->mutex);
|
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -635,12 +630,11 @@ static void set_rate(struct snd_ice1712 *ice, unsigned int rate)
|
||||||
val |= 8;
|
val |= 8;
|
||||||
val |= ratio << 4;
|
val |= ratio << 4;
|
||||||
|
|
||||||
mutex_lock(&chip->mutex);
|
guard(mutex)(&chip->mutex);
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
wm8776_write_bits(ice, &chip->wm[i],
|
wm8776_write_bits(ice, &chip->wm[i],
|
||||||
WM8776_REG_MASTER_MODE_CONTROL,
|
WM8776_REG_MASTER_MODE_CONTROL,
|
||||||
0x180, val);
|
0x180, val);
|
||||||
mutex_unlock(&chip->mutex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -287,10 +287,9 @@ static int wm_pcm_mute_get(struct snd_kcontrol *kcontrol,
|
||||||
{
|
{
|
||||||
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
ucontrol->value.integer.value[0] = (wm_get(ice, WM_MUTE) & 0x10) ?
|
ucontrol->value.integer.value[0] = (wm_get(ice, WM_MUTE) & 0x10) ?
|
||||||
0 : 1;
|
0 : 1;
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -638,11 +637,10 @@ static int wm_pcm_vol_get(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
||||||
unsigned short val;
|
unsigned short val;
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
val = wm_get(ice, WM_DAC_DIG_MASTER_ATTEN) & 0xff;
|
val = wm_get(ice, WM_DAC_DIG_MASTER_ATTEN) & 0xff;
|
||||||
val = val > PCM_MIN ? (val - PCM_MIN) : 0;
|
val = val > PCM_MIN ? (val - PCM_MIN) : 0;
|
||||||
ucontrol->value.integer.value[0] = val;
|
ucontrol->value.integer.value[0] = val;
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -112,13 +112,12 @@ static int wm_dac_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
|
||||||
unsigned short val;
|
unsigned short val;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
val = wm_get(ice, WM_DAC_ATTEN_L + i) & 0xff;
|
val = wm_get(ice, WM_DAC_ATTEN_L + i) & 0xff;
|
||||||
val = val > DAC_MIN ? (val - DAC_MIN) : 0;
|
val = val > DAC_MIN ? (val - DAC_MIN) : 0;
|
||||||
ucontrol->value.integer.value[i] = val;
|
ucontrol->value.integer.value[i] = val;
|
||||||
}
|
}
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -128,7 +127,7 @@ static int wm_dac_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
|
||||||
unsigned short oval, nval;
|
unsigned short oval, nval;
|
||||||
int i, idx, change = 0;
|
int i, idx, change = 0;
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
nval = ucontrol->value.integer.value[i];
|
nval = ucontrol->value.integer.value[i];
|
||||||
nval = (nval ? (nval + DAC_MIN) : 0) & 0xff;
|
nval = (nval ? (nval + DAC_MIN) : 0) & 0xff;
|
||||||
|
|
@ -140,7 +139,6 @@ static int wm_dac_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
|
||||||
change = 1;
|
change = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -167,13 +165,12 @@ static int wm_adc_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
|
||||||
unsigned short val;
|
unsigned short val;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
val = wm_get(ice, WM_ADC_ATTEN_L + i) & 0xff;
|
val = wm_get(ice, WM_ADC_ATTEN_L + i) & 0xff;
|
||||||
val = val > ADC_MIN ? (val - ADC_MIN) : 0;
|
val = val > ADC_MIN ? (val - ADC_MIN) : 0;
|
||||||
ucontrol->value.integer.value[i] = val;
|
ucontrol->value.integer.value[i] = val;
|
||||||
}
|
}
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -183,7 +180,7 @@ static int wm_adc_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
|
||||||
unsigned short ovol, nvol;
|
unsigned short ovol, nvol;
|
||||||
int i, idx, change = 0;
|
int i, idx, change = 0;
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
nvol = ucontrol->value.integer.value[i];
|
nvol = ucontrol->value.integer.value[i];
|
||||||
nvol = nvol ? (nvol + ADC_MIN) : 0;
|
nvol = nvol ? (nvol + ADC_MIN) : 0;
|
||||||
|
|
@ -194,7 +191,6 @@ static int wm_adc_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
|
||||||
change = 1;
|
change = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -208,9 +204,8 @@ static int wm_adc_mux_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
|
||||||
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
||||||
int bit = kcontrol->private_value;
|
int bit = kcontrol->private_value;
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
ucontrol->value.integer.value[0] = (wm_get(ice, WM_ADC_MUX) & (1 << bit)) ? 1 : 0;
|
ucontrol->value.integer.value[0] = (wm_get(ice, WM_ADC_MUX) & (1 << bit)) ? 1 : 0;
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -221,7 +216,7 @@ static int wm_adc_mux_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
|
||||||
unsigned short oval, nval;
|
unsigned short oval, nval;
|
||||||
int change;
|
int change;
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
nval = oval = wm_get(ice, WM_ADC_MUX);
|
nval = oval = wm_get(ice, WM_ADC_MUX);
|
||||||
if (ucontrol->value.integer.value[0])
|
if (ucontrol->value.integer.value[0])
|
||||||
nval |= (1 << bit);
|
nval |= (1 << bit);
|
||||||
|
|
@ -231,7 +226,6 @@ static int wm_adc_mux_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
|
||||||
if (change) {
|
if (change) {
|
||||||
wm_put(ice, WM_ADC_MUX, nval);
|
wm_put(ice, WM_ADC_MUX, nval);
|
||||||
}
|
}
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -244,9 +238,8 @@ static int wm_bypass_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_valu
|
||||||
{
|
{
|
||||||
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
ucontrol->value.integer.value[0] = (wm_get(ice, WM_OUT_MUX) & 0x04) ? 1 : 0;
|
ucontrol->value.integer.value[0] = (wm_get(ice, WM_OUT_MUX) & 0x04) ? 1 : 0;
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -256,7 +249,7 @@ static int wm_bypass_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_valu
|
||||||
unsigned short val, oval;
|
unsigned short val, oval;
|
||||||
int change = 0;
|
int change = 0;
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
val = oval = wm_get(ice, WM_OUT_MUX);
|
val = oval = wm_get(ice, WM_OUT_MUX);
|
||||||
if (ucontrol->value.integer.value[0])
|
if (ucontrol->value.integer.value[0])
|
||||||
val |= 0x04;
|
val |= 0x04;
|
||||||
|
|
@ -266,7 +259,6 @@ static int wm_bypass_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_valu
|
||||||
wm_put(ice, WM_OUT_MUX, val);
|
wm_put(ice, WM_OUT_MUX, val);
|
||||||
change = 1;
|
change = 1;
|
||||||
}
|
}
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -279,9 +271,8 @@ static int wm_chswap_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_valu
|
||||||
{
|
{
|
||||||
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
ucontrol->value.integer.value[0] = (wm_get(ice, WM_DAC_CTRL1) & 0xf0) != 0x90;
|
ucontrol->value.integer.value[0] = (wm_get(ice, WM_DAC_CTRL1) & 0xf0) != 0x90;
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -291,7 +282,7 @@ static int wm_chswap_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_valu
|
||||||
unsigned short val, oval;
|
unsigned short val, oval;
|
||||||
int change = 0;
|
int change = 0;
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
oval = wm_get(ice, WM_DAC_CTRL1);
|
oval = wm_get(ice, WM_DAC_CTRL1);
|
||||||
val = oval & 0x0f;
|
val = oval & 0x0f;
|
||||||
if (ucontrol->value.integer.value[0])
|
if (ucontrol->value.integer.value[0])
|
||||||
|
|
@ -303,7 +294,6 @@ static int wm_chswap_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_valu
|
||||||
wm_put_nocache(ice, WM_DAC_CTRL1, val);
|
wm_put_nocache(ice, WM_DAC_CTRL1, val);
|
||||||
change = 1;
|
change = 1;
|
||||||
}
|
}
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -410,9 +400,8 @@ static int cs_source_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_valu
|
||||||
{
|
{
|
||||||
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
ucontrol->value.enumerated.item[0] = ice->gpio.saved[0];
|
ucontrol->value.enumerated.item[0] = ice->gpio.saved[0];
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -422,14 +411,13 @@ static int cs_source_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_valu
|
||||||
unsigned char val;
|
unsigned char val;
|
||||||
int change = 0;
|
int change = 0;
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
if (ucontrol->value.enumerated.item[0] != ice->gpio.saved[0]) {
|
if (ucontrol->value.enumerated.item[0] != ice->gpio.saved[0]) {
|
||||||
ice->gpio.saved[0] = ucontrol->value.enumerated.item[0] & 3;
|
ice->gpio.saved[0] = ucontrol->value.enumerated.item[0] & 3;
|
||||||
val = 0x80 | (ice->gpio.saved[0] << 3);
|
val = 0x80 | (ice->gpio.saved[0] << 3);
|
||||||
spi_write(ice, CS_DEV, 0x04, val);
|
spi_write(ice, CS_DEV, 0x04, val);
|
||||||
change = 1;
|
change = 1;
|
||||||
}
|
}
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -449,10 +437,10 @@ static int pontis_gpio_mask_info(struct snd_kcontrol *kcontrol, struct snd_ctl_e
|
||||||
static int pontis_gpio_mask_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
static int pontis_gpio_mask_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
||||||
mutex_lock(&ice->gpio_mutex);
|
|
||||||
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
/* 4-7 reserved */
|
/* 4-7 reserved */
|
||||||
ucontrol->value.integer.value[0] = (~ice->gpio.write_mask & 0xffff) | 0x00f0;
|
ucontrol->value.integer.value[0] = (~ice->gpio.write_mask & 0xffff) | 0x00f0;
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -461,22 +449,22 @@ static int pontis_gpio_mask_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el
|
||||||
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
int changed;
|
int changed;
|
||||||
mutex_lock(&ice->gpio_mutex);
|
|
||||||
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
/* 4-7 reserved */
|
/* 4-7 reserved */
|
||||||
val = (~ucontrol->value.integer.value[0] & 0xffff) | 0x00f0;
|
val = (~ucontrol->value.integer.value[0] & 0xffff) | 0x00f0;
|
||||||
changed = val != ice->gpio.write_mask;
|
changed = val != ice->gpio.write_mask;
|
||||||
ice->gpio.write_mask = val;
|
ice->gpio.write_mask = val;
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pontis_gpio_dir_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
static int pontis_gpio_dir_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
||||||
mutex_lock(&ice->gpio_mutex);
|
|
||||||
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
/* 4-7 reserved */
|
/* 4-7 reserved */
|
||||||
ucontrol->value.integer.value[0] = ice->gpio.direction & 0xff0f;
|
ucontrol->value.integer.value[0] = ice->gpio.direction & 0xff0f;
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -485,23 +473,23 @@ static int pontis_gpio_dir_put(struct snd_kcontrol *kcontrol, struct snd_ctl_ele
|
||||||
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
int changed;
|
int changed;
|
||||||
mutex_lock(&ice->gpio_mutex);
|
|
||||||
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
/* 4-7 reserved */
|
/* 4-7 reserved */
|
||||||
val = ucontrol->value.integer.value[0] & 0xff0f;
|
val = ucontrol->value.integer.value[0] & 0xff0f;
|
||||||
changed = (val != ice->gpio.direction);
|
changed = (val != ice->gpio.direction);
|
||||||
ice->gpio.direction = val;
|
ice->gpio.direction = val;
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pontis_gpio_data_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
static int pontis_gpio_data_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
||||||
mutex_lock(&ice->gpio_mutex);
|
|
||||||
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
snd_ice1712_gpio_set_dir(ice, ice->gpio.direction);
|
snd_ice1712_gpio_set_dir(ice, ice->gpio.direction);
|
||||||
snd_ice1712_gpio_set_mask(ice, ice->gpio.write_mask);
|
snd_ice1712_gpio_set_mask(ice, ice->gpio.write_mask);
|
||||||
ucontrol->value.integer.value[0] = snd_ice1712_gpio_read(ice) & 0xffff;
|
ucontrol->value.integer.value[0] = snd_ice1712_gpio_read(ice) & 0xffff;
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -510,7 +498,8 @@ static int pontis_gpio_data_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el
|
||||||
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
||||||
unsigned int val, nval;
|
unsigned int val, nval;
|
||||||
int changed = 0;
|
int changed = 0;
|
||||||
mutex_lock(&ice->gpio_mutex);
|
|
||||||
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
snd_ice1712_gpio_set_dir(ice, ice->gpio.direction);
|
snd_ice1712_gpio_set_dir(ice, ice->gpio.direction);
|
||||||
snd_ice1712_gpio_set_mask(ice, ice->gpio.write_mask);
|
snd_ice1712_gpio_set_mask(ice, ice->gpio.write_mask);
|
||||||
val = snd_ice1712_gpio_read(ice) & 0xffff;
|
val = snd_ice1712_gpio_read(ice) & 0xffff;
|
||||||
|
|
@ -519,7 +508,6 @@ static int pontis_gpio_data_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el
|
||||||
snd_ice1712_gpio_write(ice, nval);
|
snd_ice1712_gpio_write(ice, nval);
|
||||||
changed = 1;
|
changed = 1;
|
||||||
}
|
}
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -620,14 +608,14 @@ static void wm_proc_regs_write(struct snd_info_entry *entry, struct snd_info_buf
|
||||||
struct snd_ice1712 *ice = entry->private_data;
|
struct snd_ice1712 *ice = entry->private_data;
|
||||||
char line[64];
|
char line[64];
|
||||||
unsigned int reg, val;
|
unsigned int reg, val;
|
||||||
mutex_lock(&ice->gpio_mutex);
|
|
||||||
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
while (!snd_info_get_line(buffer, line, sizeof(line))) {
|
while (!snd_info_get_line(buffer, line, sizeof(line))) {
|
||||||
if (sscanf(line, "%x %x", ®, &val) != 2)
|
if (sscanf(line, "%x %x", ®, &val) != 2)
|
||||||
continue;
|
continue;
|
||||||
if (reg <= 0x17 && val <= 0xffff)
|
if (reg <= 0x17 && val <= 0xffff)
|
||||||
wm_put(ice, reg, val);
|
wm_put(ice, reg, val);
|
||||||
}
|
}
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wm_proc_regs_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
|
static void wm_proc_regs_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
|
||||||
|
|
@ -635,12 +623,11 @@ static void wm_proc_regs_read(struct snd_info_entry *entry, struct snd_info_buff
|
||||||
struct snd_ice1712 *ice = entry->private_data;
|
struct snd_ice1712 *ice = entry->private_data;
|
||||||
int reg, val;
|
int reg, val;
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
for (reg = 0; reg <= 0x17; reg++) {
|
for (reg = 0; reg <= 0x17; reg++) {
|
||||||
val = wm_get(ice, reg);
|
val = wm_get(ice, reg);
|
||||||
snd_iprintf(buffer, "%02x = %04x\n", reg, val);
|
snd_iprintf(buffer, "%02x = %04x\n", reg, val);
|
||||||
}
|
}
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wm_proc_init(struct snd_ice1712 *ice)
|
static void wm_proc_init(struct snd_ice1712 *ice)
|
||||||
|
|
@ -654,14 +641,13 @@ static void cs_proc_regs_read(struct snd_info_entry *entry, struct snd_info_buff
|
||||||
struct snd_ice1712 *ice = entry->private_data;
|
struct snd_ice1712 *ice = entry->private_data;
|
||||||
int reg, val;
|
int reg, val;
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
for (reg = 0; reg <= 0x26; reg++) {
|
for (reg = 0; reg <= 0x26; reg++) {
|
||||||
val = spi_read(ice, CS_DEV, reg);
|
val = spi_read(ice, CS_DEV, reg);
|
||||||
snd_iprintf(buffer, "%02x = %02x\n", reg, val);
|
snd_iprintf(buffer, "%02x = %02x\n", reg, val);
|
||||||
}
|
}
|
||||||
val = spi_read(ice, CS_DEV, 0x7f);
|
val = spi_read(ice, CS_DEV, 0x7f);
|
||||||
snd_iprintf(buffer, "%02x = %02x\n", 0x7f, val);
|
snd_iprintf(buffer, "%02x = %02x\n", 0x7f, val);
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cs_proc_init(struct snd_ice1712 *ice)
|
static void cs_proc_init(struct snd_ice1712 *ice)
|
||||||
|
|
|
||||||
|
|
@ -110,21 +110,19 @@ static int stac9460_dac_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
|
||||||
{
|
{
|
||||||
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
||||||
struct prodigy192_spec *spec = ice->spec;
|
struct prodigy192_spec *spec = ice->spec;
|
||||||
int idx, change;
|
int idx;
|
||||||
|
|
||||||
if (kcontrol->private_value)
|
if (kcontrol->private_value)
|
||||||
idx = STAC946X_MASTER_VOLUME;
|
idx = STAC946X_MASTER_VOLUME;
|
||||||
else
|
else
|
||||||
idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + STAC946X_LF_VOLUME;
|
idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + STAC946X_LF_VOLUME;
|
||||||
/* due to possible conflicts with stac9460_set_rate_val, mutexing */
|
/* due to possible conflicts with stac9460_set_rate_val, mutexing */
|
||||||
mutex_lock(&spec->mute_mutex);
|
guard(mutex)(&spec->mute_mutex);
|
||||||
/*
|
/*
|
||||||
dev_dbg(ice->card->dev, "Mute put: reg 0x%02x, ctrl value: 0x%02x\n", idx,
|
dev_dbg(ice->card->dev, "Mute put: reg 0x%02x, ctrl value: 0x%02x\n", idx,
|
||||||
ucontrol->value.integer.value[0]);
|
ucontrol->value.integer.value[0]);
|
||||||
*/
|
*/
|
||||||
change = stac9460_dac_mute(ice, idx, ucontrol->value.integer.value[0]);
|
return stac9460_dac_mute(ice, idx, ucontrol->value.integer.value[0]);
|
||||||
mutex_unlock(&spec->mute_mutex);
|
|
||||||
return change;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -316,7 +314,7 @@ static void stac9460_set_rate_val(struct snd_ice1712 *ice, unsigned int rate)
|
||||||
return;
|
return;
|
||||||
/* change detected, setting master clock, muting first */
|
/* change detected, setting master clock, muting first */
|
||||||
/* due to possible conflicts with mute controls - mutexing */
|
/* due to possible conflicts with mute controls - mutexing */
|
||||||
mutex_lock(&spec->mute_mutex);
|
guard(mutex)(&spec->mute_mutex);
|
||||||
/* we have to remember current mute status for each DAC */
|
/* we have to remember current mute status for each DAC */
|
||||||
for (idx = 0; idx < 7 ; ++idx)
|
for (idx = 0; idx < 7 ; ++idx)
|
||||||
changed[idx] = stac9460_dac_mute(ice,
|
changed[idx] = stac9460_dac_mute(ice,
|
||||||
|
|
@ -330,7 +328,6 @@ static void stac9460_set_rate_val(struct snd_ice1712 *ice, unsigned int rate)
|
||||||
if (changed[idx])
|
if (changed[idx])
|
||||||
stac9460_dac_mute(ice, STAC946X_MASTER_VOLUME + idx, 1);
|
stac9460_dac_mute(ice, STAC946X_MASTER_VOLUME + idx, 1);
|
||||||
}
|
}
|
||||||
mutex_unlock(&spec->mute_mutex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -268,7 +268,7 @@ static int ak4396_dac_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem
|
||||||
int i;
|
int i;
|
||||||
int change = 0;
|
int change = 0;
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
if (ucontrol->value.integer.value[i] != spec->vol[i]) {
|
if (ucontrol->value.integer.value[i] != spec->vol[i]) {
|
||||||
spec->vol[i] = ucontrol->value.integer.value[i];
|
spec->vol[i] = ucontrol->value.integer.value[i];
|
||||||
|
|
@ -277,7 +277,6 @@ static int ak4396_dac_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem
|
||||||
change = 1;
|
change = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -376,7 +375,7 @@ static int wm_dac_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
|
||||||
struct prodigy_hifi_spec *spec = ice->spec;
|
struct prodigy_hifi_spec *spec = ice->spec;
|
||||||
int i, idx, change = 0;
|
int i, idx, change = 0;
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
if (ucontrol->value.integer.value[i] != spec->vol[2 + i]) {
|
if (ucontrol->value.integer.value[i] != spec->vol[2 + i]) {
|
||||||
idx = WM_DAC_ATTEN_L + i;
|
idx = WM_DAC_ATTEN_L + i;
|
||||||
|
|
@ -386,7 +385,6 @@ static int wm_dac_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
|
||||||
change = 1;
|
change = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -428,7 +426,7 @@ static int wm8766_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
|
||||||
|
|
||||||
voices = kcontrol->private_value >> 8;
|
voices = kcontrol->private_value >> 8;
|
||||||
ofs = kcontrol->private_value & 0xff;
|
ofs = kcontrol->private_value & 0xff;
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
for (i = 0; i < voices; i++) {
|
for (i = 0; i < voices; i++) {
|
||||||
if (ucontrol->value.integer.value[i] != spec->vol[ofs + i]) {
|
if (ucontrol->value.integer.value[i] != spec->vol[ofs + i]) {
|
||||||
idx = WM8766_LDA1 + ofs + i;
|
idx = WM8766_LDA1 + ofs + i;
|
||||||
|
|
@ -439,7 +437,6 @@ static int wm8766_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
|
||||||
change = 1;
|
change = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -474,7 +471,7 @@ static int wm_master_vol_put(struct snd_kcontrol *kcontrol,
|
||||||
struct prodigy_hifi_spec *spec = ice->spec;
|
struct prodigy_hifi_spec *spec = ice->spec;
|
||||||
int ch, change = 0;
|
int ch, change = 0;
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
for (ch = 0; ch < 2; ch++) {
|
for (ch = 0; ch < 2; ch++) {
|
||||||
if (ucontrol->value.integer.value[ch] != spec->master[ch]) {
|
if (ucontrol->value.integer.value[ch] != spec->master[ch]) {
|
||||||
spec->master[ch] = ucontrol->value.integer.value[ch];
|
spec->master[ch] = ucontrol->value.integer.value[ch];
|
||||||
|
|
@ -494,7 +491,6 @@ static int wm_master_vol_put(struct snd_kcontrol *kcontrol,
|
||||||
change = 1;
|
change = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -535,9 +531,8 @@ static int wm_adc_mux_enum_get(struct snd_kcontrol *kcontrol,
|
||||||
{
|
{
|
||||||
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
ucontrol->value.enumerated.item[0] = wm_get(ice, WM_ADC_MUX) & 0x1f;
|
ucontrol->value.enumerated.item[0] = wm_get(ice, WM_ADC_MUX) & 0x1f;
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -548,14 +543,13 @@ static int wm_adc_mux_enum_put(struct snd_kcontrol *kcontrol,
|
||||||
unsigned short oval, nval;
|
unsigned short oval, nval;
|
||||||
int change = 0;
|
int change = 0;
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
oval = wm_get(ice, WM_ADC_MUX);
|
oval = wm_get(ice, WM_ADC_MUX);
|
||||||
nval = (oval & 0xe0) | ucontrol->value.enumerated.item[0];
|
nval = (oval & 0xe0) | ucontrol->value.enumerated.item[0];
|
||||||
if (nval != oval) {
|
if (nval != oval) {
|
||||||
wm_put(ice, WM_ADC_MUX, nval);
|
wm_put(ice, WM_ADC_MUX, nval);
|
||||||
change = 1;
|
change = 1;
|
||||||
}
|
}
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -586,13 +580,12 @@ static int wm_adc_vol_get(struct snd_kcontrol *kcontrol,
|
||||||
unsigned short val;
|
unsigned short val;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
val = wm_get(ice, WM_ADC_ATTEN_L + i) & 0xff;
|
val = wm_get(ice, WM_ADC_ATTEN_L + i) & 0xff;
|
||||||
val = val > ADC_MIN ? (val - ADC_MIN) : 0;
|
val = val > ADC_MIN ? (val - ADC_MIN) : 0;
|
||||||
ucontrol->value.integer.value[i] = val;
|
ucontrol->value.integer.value[i] = val;
|
||||||
}
|
}
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -603,7 +596,7 @@ static int wm_adc_vol_put(struct snd_kcontrol *kcontrol,
|
||||||
unsigned short ovol, nvol;
|
unsigned short ovol, nvol;
|
||||||
int i, idx, change = 0;
|
int i, idx, change = 0;
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
nvol = ucontrol->value.integer.value[i];
|
nvol = ucontrol->value.integer.value[i];
|
||||||
nvol = nvol ? (nvol + ADC_MIN) : 0;
|
nvol = nvol ? (nvol + ADC_MIN) : 0;
|
||||||
|
|
@ -614,7 +607,6 @@ static int wm_adc_vol_put(struct snd_kcontrol *kcontrol,
|
||||||
change = 1;
|
change = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -629,10 +621,9 @@ static int wm_adc_mux_get(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
||||||
int bit = kcontrol->private_value;
|
int bit = kcontrol->private_value;
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
ucontrol->value.integer.value[0] =
|
ucontrol->value.integer.value[0] =
|
||||||
(wm_get(ice, WM_ADC_MUX) & (1 << bit)) ? 1 : 0;
|
(wm_get(ice, WM_ADC_MUX) & (1 << bit)) ? 1 : 0;
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -644,7 +635,7 @@ static int wm_adc_mux_put(struct snd_kcontrol *kcontrol,
|
||||||
unsigned short oval, nval;
|
unsigned short oval, nval;
|
||||||
int change;
|
int change;
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
nval = oval = wm_get(ice, WM_ADC_MUX);
|
nval = oval = wm_get(ice, WM_ADC_MUX);
|
||||||
if (ucontrol->value.integer.value[0])
|
if (ucontrol->value.integer.value[0])
|
||||||
nval |= (1 << bit);
|
nval |= (1 << bit);
|
||||||
|
|
@ -654,7 +645,6 @@ static int wm_adc_mux_put(struct snd_kcontrol *kcontrol,
|
||||||
if (change) {
|
if (change) {
|
||||||
wm_put(ice, WM_ADC_MUX, nval);
|
wm_put(ice, WM_ADC_MUX, nval);
|
||||||
}
|
}
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -668,10 +658,9 @@ static int wm_bypass_get(struct snd_kcontrol *kcontrol,
|
||||||
{
|
{
|
||||||
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
ucontrol->value.integer.value[0] =
|
ucontrol->value.integer.value[0] =
|
||||||
(wm_get(ice, WM_OUT_MUX) & 0x04) ? 1 : 0;
|
(wm_get(ice, WM_OUT_MUX) & 0x04) ? 1 : 0;
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -682,7 +671,7 @@ static int wm_bypass_put(struct snd_kcontrol *kcontrol,
|
||||||
unsigned short val, oval;
|
unsigned short val, oval;
|
||||||
int change = 0;
|
int change = 0;
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
val = oval = wm_get(ice, WM_OUT_MUX);
|
val = oval = wm_get(ice, WM_OUT_MUX);
|
||||||
if (ucontrol->value.integer.value[0])
|
if (ucontrol->value.integer.value[0])
|
||||||
val |= 0x04;
|
val |= 0x04;
|
||||||
|
|
@ -692,7 +681,6 @@ static int wm_bypass_put(struct snd_kcontrol *kcontrol,
|
||||||
wm_put(ice, WM_OUT_MUX, val);
|
wm_put(ice, WM_OUT_MUX, val);
|
||||||
change = 1;
|
change = 1;
|
||||||
}
|
}
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -706,10 +694,9 @@ static int wm_chswap_get(struct snd_kcontrol *kcontrol,
|
||||||
{
|
{
|
||||||
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
ucontrol->value.integer.value[0] =
|
ucontrol->value.integer.value[0] =
|
||||||
(wm_get(ice, WM_DAC_CTRL1) & 0xf0) != 0x90;
|
(wm_get(ice, WM_DAC_CTRL1) & 0xf0) != 0x90;
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -720,7 +707,7 @@ static int wm_chswap_put(struct snd_kcontrol *kcontrol,
|
||||||
unsigned short val, oval;
|
unsigned short val, oval;
|
||||||
int change = 0;
|
int change = 0;
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
oval = wm_get(ice, WM_DAC_CTRL1);
|
oval = wm_get(ice, WM_DAC_CTRL1);
|
||||||
val = oval & 0x0f;
|
val = oval & 0x0f;
|
||||||
if (ucontrol->value.integer.value[0])
|
if (ucontrol->value.integer.value[0])
|
||||||
|
|
@ -732,7 +719,6 @@ static int wm_chswap_put(struct snd_kcontrol *kcontrol,
|
||||||
wm_put_nocache(ice, WM_DAC_CTRL1, val);
|
wm_put_nocache(ice, WM_DAC_CTRL1, val);
|
||||||
change = 1;
|
change = 1;
|
||||||
}
|
}
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -864,14 +850,14 @@ static void wm_proc_regs_write(struct snd_info_entry *entry,
|
||||||
struct snd_ice1712 *ice = entry->private_data;
|
struct snd_ice1712 *ice = entry->private_data;
|
||||||
char line[64];
|
char line[64];
|
||||||
unsigned int reg, val;
|
unsigned int reg, val;
|
||||||
mutex_lock(&ice->gpio_mutex);
|
|
||||||
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
while (!snd_info_get_line(buffer, line, sizeof(line))) {
|
while (!snd_info_get_line(buffer, line, sizeof(line))) {
|
||||||
if (sscanf(line, "%x %x", ®, &val) != 2)
|
if (sscanf(line, "%x %x", ®, &val) != 2)
|
||||||
continue;
|
continue;
|
||||||
if (reg <= 0x17 && val <= 0xffff)
|
if (reg <= 0x17 && val <= 0xffff)
|
||||||
wm_put(ice, reg, val);
|
wm_put(ice, reg, val);
|
||||||
}
|
}
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wm_proc_regs_read(struct snd_info_entry *entry,
|
static void wm_proc_regs_read(struct snd_info_entry *entry,
|
||||||
|
|
@ -880,12 +866,11 @@ static void wm_proc_regs_read(struct snd_info_entry *entry,
|
||||||
struct snd_ice1712 *ice = entry->private_data;
|
struct snd_ice1712 *ice = entry->private_data;
|
||||||
int reg, val;
|
int reg, val;
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
for (reg = 0; reg <= 0x17; reg++) {
|
for (reg = 0; reg <= 0x17; reg++) {
|
||||||
val = wm_get(ice, reg);
|
val = wm_get(ice, reg);
|
||||||
snd_iprintf(buffer, "%02x = %04x\n", reg, val);
|
snd_iprintf(buffer, "%02x = %04x\n", reg, val);
|
||||||
}
|
}
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wm_proc_init(struct snd_ice1712 *ice)
|
static void wm_proc_init(struct snd_ice1712 *ice)
|
||||||
|
|
@ -994,7 +979,7 @@ static int prodigy_hifi_resume(struct snd_ice1712 *ice)
|
||||||
struct prodigy_hifi_spec *spec = ice->spec;
|
struct prodigy_hifi_spec *spec = ice->spec;
|
||||||
int i, ch;
|
int i, ch;
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
|
|
||||||
/* reinitialize WM8776 and re-apply old register values */
|
/* reinitialize WM8776 and re-apply old register values */
|
||||||
wm8776_init(ice);
|
wm8776_init(ice);
|
||||||
|
|
@ -1023,7 +1008,6 @@ static int prodigy_hifi_resume(struct snd_ice1712 *ice)
|
||||||
wm_put(ice, WM_DAC_MUTE, 0x00);
|
wm_put(ice, WM_DAC_MUTE, 0x00);
|
||||||
wm_put(ice, WM_DAC_CTRL1, 0x90);
|
wm_put(ice, WM_DAC_CTRL1, 0x90);
|
||||||
|
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -1134,11 +1118,11 @@ static int prodigy_hd2_resume(struct snd_ice1712 *ice)
|
||||||
/* initialize ak4396 codec and restore previous mixer volumes */
|
/* initialize ak4396 codec and restore previous mixer volumes */
|
||||||
struct prodigy_hifi_spec *spec = ice->spec;
|
struct prodigy_hifi_spec *spec = ice->spec;
|
||||||
int i;
|
int i;
|
||||||
mutex_lock(&ice->gpio_mutex);
|
|
||||||
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
ak4396_init(ice);
|
ak4396_init(ice);
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
ak4396_write(ice, AK4396_LCH_ATT + i, spec->vol[i] & 0xff);
|
ak4396_write(ice, AK4396_LCH_ATT + i, spec->vol[i] & 0xff);
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -396,7 +396,7 @@ static void reg_write(struct snd_ice1712 *ice, unsigned int reg,
|
||||||
{
|
{
|
||||||
unsigned int tmp;
|
unsigned int tmp;
|
||||||
|
|
||||||
mutex_lock(&ice->gpio_mutex);
|
guard(mutex)(&ice->gpio_mutex);
|
||||||
/* set direction of used GPIOs*/
|
/* set direction of used GPIOs*/
|
||||||
/* all outputs */
|
/* all outputs */
|
||||||
tmp = 0x00ffff;
|
tmp = 0x00ffff;
|
||||||
|
|
@ -429,7 +429,6 @@ static void reg_write(struct snd_ice1712 *ice, unsigned int reg,
|
||||||
ice->gpio.set_mask(ice, 0xffffff);
|
ice->gpio.set_mask(ice, 0xffffff);
|
||||||
/* outputs only 8-15 */
|
/* outputs only 8-15 */
|
||||||
ice->gpio.set_dir(ice, 0x00ff00);
|
ice->gpio.set_dir(ice, 0x00ff00);
|
||||||
mutex_unlock(&ice->gpio_mutex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int get_scr(struct snd_ice1712 *ice)
|
static unsigned int get_scr(struct snd_ice1712 *ice)
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ static int stac9460_dac_mute_get(struct snd_kcontrol *kcontrol,
|
||||||
unsigned char val;
|
unsigned char val;
|
||||||
int idx, id;
|
int idx, id;
|
||||||
|
|
||||||
mutex_lock(&spec->mute_mutex);
|
guard(mutex)(&spec->mute_mutex);
|
||||||
|
|
||||||
if (kcontrol->private_value) {
|
if (kcontrol->private_value) {
|
||||||
idx = STAC946X_MASTER_VOLUME;
|
idx = STAC946X_MASTER_VOLUME;
|
||||||
|
|
@ -133,7 +133,6 @@ static int stac9460_dac_mute_get(struct snd_kcontrol *kcontrol,
|
||||||
val = stac9460_2_get(ice, idx - 6);
|
val = stac9460_2_get(ice, idx - 6);
|
||||||
ucontrol->value.integer.value[0] = (~val >> 7) & 0x1;
|
ucontrol->value.integer.value[0] = (~val >> 7) & 0x1;
|
||||||
|
|
||||||
mutex_unlock(&spec->mute_mutex);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -455,7 +454,7 @@ static void stac9460_set_rate_val(struct snd_ice1712 *ice, unsigned int rate)
|
||||||
return;
|
return;
|
||||||
/* change detected, setting master clock, muting first */
|
/* change detected, setting master clock, muting first */
|
||||||
/* due to possible conflicts with mute controls - mutexing */
|
/* due to possible conflicts with mute controls - mutexing */
|
||||||
mutex_lock(&spec->mute_mutex);
|
guard(mutex)(&spec->mute_mutex);
|
||||||
/* we have to remember current mute status for each DAC */
|
/* we have to remember current mute status for each DAC */
|
||||||
changed = 0xFFFF;
|
changed = 0xFFFF;
|
||||||
stac9460_dac_mute_all(ice, 0, &changed);
|
stac9460_dac_mute_all(ice, 0, &changed);
|
||||||
|
|
@ -466,7 +465,6 @@ static void stac9460_set_rate_val(struct snd_ice1712 *ice, unsigned int rate)
|
||||||
/* unmuting - only originally unmuted dacs -
|
/* unmuting - only originally unmuted dacs -
|
||||||
* i.e. those changed when muting */
|
* i.e. those changed when muting */
|
||||||
stac9460_dac_mute_all(ice, 1, &changed);
|
stac9460_dac_mute_all(ice, 1, &changed);
|
||||||
mutex_unlock(&spec->mute_mutex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue