Skip to content

Commit 2ba7197

Browse files
Sasha KhapyorskyJaroslav Kysela
authored andcommitted
[ALSA] Removing obsolete AC97_SHARED_TYPES
This patch cleans last ac97 audio/modem codec interception in initialization procedures (ac97_mixer_new()) and removes obsolete SHARED_TYPE 'locking' which prevents from AMC codecs to function correctly. Signed-off-by: Sasha Khapyorsky <sashak@smlink.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 6632d19 commit 2ba7197

8 files changed

Lines changed: 3 additions & 52 deletions

File tree

‎include/sound/ac97_codec.h‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -387,15 +387,6 @@
387387
#define AC97_RATES_MIC_ADC 4
388388
#define AC97_RATES_SPDIF 5
389389

390-
/* shared controllers */
391-
enum {
392-
AC97_SHARED_TYPE_NONE,
393-
AC97_SHARED_TYPE_ICH,
394-
AC97_SHARED_TYPE_ATIIXP,
395-
AC97_SHARED_TYPE_VIA,
396-
AC97_SHARED_TYPES
397-
};
398-
399390
/*
400391
*
401392
*/
@@ -468,7 +459,6 @@ struct _snd_ac97_bus {
468459
unsigned short used_slots[2][4]; /* actually used PCM slots */
469460
unsigned short pcms_count; /* count of PCMs */
470461
struct ac97_pcm *pcms;
471-
unsigned int shared_type; /* type of shared controller betwen audio and modem */
472462
ac97_t *codec[4];
473463
snd_info_entry_t *proc;
474464
};

‎sound/pci/ac97/ac97_codec.c‎

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,6 @@ const char *snd_ac97_stereo_enhancements[] =
220220
/* 31 */ "Reserved 31"
221221
};
222222

223-
/*
224-
* Shared AC97 controllers (ICH, ATIIXP...)
225-
*/
226-
static DECLARE_MUTEX(shared_codec_mutex);
227-
static ac97_t *shared_codec[AC97_SHARED_TYPES][4];
228-
229223

230224
/*
231225
* I/O routines
@@ -996,14 +990,8 @@ static int snd_ac97_free(ac97_t *ac97)
996990
{
997991
if (ac97) {
998992
snd_ac97_proc_done(ac97);
999-
if (ac97->bus) {
993+
if (ac97->bus)
1000994
ac97->bus->codec[ac97->num] = NULL;
1001-
if (ac97->bus->shared_type) {
1002-
down(&shared_codec_mutex);
1003-
shared_codec[ac97->bus->shared_type-1][ac97->num] = NULL;
1004-
up(&shared_codec_mutex);
1005-
}
1006-
}
1007995
if (ac97->private_free)
1008996
ac97->private_free(ac97);
1009997
kfree(ac97);
@@ -1889,21 +1877,6 @@ int snd_ac97_mixer(ac97_bus_t *bus, ac97_template_t *template, ac97_t **rac97)
18891877
snd_assert(bus != NULL && template != NULL, return -EINVAL);
18901878
snd_assert(template->num < 4 && bus->codec[template->num] == NULL, return -EINVAL);
18911879

1892-
snd_assert(bus->shared_type <= AC97_SHARED_TYPES, return -EINVAL);
1893-
if (bus->shared_type) {
1894-
/* already shared? */
1895-
down(&shared_codec_mutex);
1896-
ac97 = shared_codec[bus->shared_type-1][template->num];
1897-
if (ac97) {
1898-
if ((ac97_is_audio(ac97) && (template->scaps & AC97_SCAP_SKIP_AUDIO)) ||
1899-
(ac97_is_modem(ac97) && (template->scaps & AC97_SCAP_SKIP_MODEM))) {
1900-
up(&shared_codec_mutex);
1901-
return -EACCES; /* skip this */
1902-
}
1903-
}
1904-
up(&shared_codec_mutex);
1905-
}
1906-
19071880
card = bus->card;
19081881
ac97 = kzalloc(sizeof(*ac97), GFP_KERNEL);
19091882
if (ac97 == NULL)
@@ -2153,7 +2126,7 @@ int snd_ac97_mixer(ac97_bus_t *bus, ac97_template_t *template, ac97_t **rac97)
21532126
}
21542127
}
21552128
/* make sure the proper powerdown bits are cleared */
2156-
if (ac97->scaps) {
2129+
if (ac97->scaps && ac97_is_audio(ac97)) {
21572130
reg = snd_ac97_read(ac97, AC97_EXTENDED_STATUS);
21582131
if (ac97->scaps & AC97_SCAP_SURROUND_DAC)
21592132
reg &= ~AC97_EA_PRJ;
@@ -2167,13 +2140,6 @@ int snd_ac97_mixer(ac97_bus_t *bus, ac97_template_t *template, ac97_t **rac97)
21672140
return err;
21682141
}
21692142
*rac97 = ac97;
2170-
2171-
if (bus->shared_type) {
2172-
down(&shared_codec_mutex);
2173-
shared_codec[bus->shared_type-1][ac97->num] = ac97;
2174-
up(&shared_codec_mutex);
2175-
}
2176-
21772143
return 0;
21782144
}
21792145

‎sound/pci/atiixp.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1372,7 +1372,6 @@ static int __devinit snd_atiixp_mixer_new(atiixp_t *chip, int clock, const char
13721372
if ((err = snd_ac97_bus(chip->card, 0, &ops, chip, &pbus)) < 0)
13731373
return err;
13741374
pbus->clock = clock;
1375-
pbus->shared_type = AC97_SHARED_TYPE_ATIIXP; /* shared with modem driver */
13761375
chip->ac97_bus = pbus;
13771376

13781377
codec_count = 0;

‎sound/pci/atiixp_modem.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,6 @@ static int __devinit snd_atiixp_mixer_new(atiixp_t *chip, int clock)
10681068
if ((err = snd_ac97_bus(chip->card, 0, &ops, chip, &pbus)) < 0)
10691069
return err;
10701070
pbus->clock = clock;
1071-
pbus->shared_type = AC97_SHARED_TYPE_ATIIXP; /* shared with audio driver */
10721071
chip->ac97_bus = pbus;
10731072

10741073
codec_count = 0;

‎sound/pci/intel8x0.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2022,7 +2022,6 @@ static int __devinit snd_intel8x0_mixer(intel8x0_t *chip, int ac97_clock, const
20222022
if ((err = snd_ac97_bus(chip->card, 0, ops, chip, &pbus)) < 0)
20232023
goto __err;
20242024
pbus->private_free = snd_intel8x0_mixer_free_ac97_bus;
2025-
pbus->shared_type = AC97_SHARED_TYPE_ICH; /* shared with modem driver */
20262025
if (ac97_clock >= 8000 && ac97_clock <= 48000)
20272026
pbus->clock = ac97_clock;
20282027
/* FIXME: my test board doesn't work well with VRA... */

‎sound/pci/intel8x0m.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,6 @@ static int __devinit snd_intel8x0_mixer(intel8x0_t *chip, int ac97_clock)
855855
if ((err = snd_ac97_bus(chip->card, 0, &ops, chip, &pbus)) < 0)
856856
goto __err;
857857
pbus->private_free = snd_intel8x0_mixer_free_ac97_bus;
858-
pbus->shared_type = AC97_SHARED_TYPE_ICH; /* shared with audio driver */
859858
if (ac97_clock >= 8000 && ac97_clock <= 48000)
860859
pbus->clock = ac97_clock;
861860
chip->ac97_bus = pbus;

‎sound/pci/via82xx.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1616,12 +1616,12 @@ static int __devinit snd_via82xx_mixer_new(via82xx_t *chip, const char *quirk_ov
16161616
return err;
16171617
chip->ac97_bus->private_free = snd_via82xx_mixer_free_ac97_bus;
16181618
chip->ac97_bus->clock = chip->ac97_clock;
1619-
chip->ac97_bus->shared_type = AC97_SHARED_TYPE_VIA;
16201619

16211620
memset(&ac97, 0, sizeof(ac97));
16221621
ac97.private_data = chip;
16231622
ac97.private_free = snd_via82xx_mixer_free_ac97;
16241623
ac97.pci = chip->pci;
1624+
ac97.scaps = AC97_SCAP_SKIP_MODEM;
16251625
if ((err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97)) < 0)
16261626
return err;
16271627

‎sound/pci/via82xx_modem.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,6 @@ static int __devinit snd_via82xx_mixer_new(via82xx_t *chip)
879879
return err;
880880
chip->ac97_bus->private_free = snd_via82xx_mixer_free_ac97_bus;
881881
chip->ac97_bus->clock = chip->ac97_clock;
882-
chip->ac97_bus->shared_type = AC97_SHARED_TYPE_VIA;
883882

884883
memset(&ac97, 0, sizeof(ac97));
885884
ac97.private_data = chip;

0 commit comments

Comments
 (0)