* Re: ATI IXP Modem driver [not found] ` <s5hd631cq5v.wl@alsa2.suse.de> @ 2004-07-12 16:54 ` Sasha Khapyorsky 2004-07-12 16:57 ` Takashi Iwai 0 siblings, 1 reply; 10+ messages in thread From: Sasha Khapyorsky @ 2004-07-12 16:54 UTC (permalink / raw) To: Takashi Iwai; +Cc: unixtricks, alsa-devel On Mon, 12 Jul 2004 15:26:36 +0200 Takashi Iwai <tiwai@suse.de> wrote: > > > > I believe the best way would be to provide "modem" pcm for each > > > driver, so that the user-space app can access uniformly without > > > caring the device number, conversion, etc. > > > > Exactly, this would be best solution. But how to do it? Permanent > > configuration? Changes in PCM layer? > > Adding a system config file such as > /usr/share/alsa/cards/ATIIXP-MODEM.conf. > Simiarly, we can add the definition in ICH-MODEM.conf and > NFORCE-MODEM.conf Great, so simple. > (any other known working modem drivers?) Not yet (hope it will). Best Regards, Sasha. ------------------------------------------------------- This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: ATI IXP Modem driver 2004-07-12 16:54 ` ATI IXP Modem driver Sasha Khapyorsky @ 2004-07-12 16:57 ` Takashi Iwai 2004-07-25 15:21 ` Sasha Khapyorsky 0 siblings, 1 reply; 10+ messages in thread From: Takashi Iwai @ 2004-07-12 16:57 UTC (permalink / raw) To: Sasha Khapyorsky; +Cc: unixtricks, alsa-devel At Mon, 12 Jul 2004 19:54:50 +0300, Sasha Khapyorsky wrote: > > On Mon, 12 Jul 2004 15:26:36 +0200 > Takashi Iwai <tiwai@suse.de> wrote: > > > > > > > I believe the best way would be to provide "modem" pcm for each > > > > driver, so that the user-space app can access uniformly without > > > > caring the device number, conversion, etc. > > > > > > Exactly, this would be best solution. But how to do it? Permanent > > > configuration? Changes in PCM layer? > > > > Adding a system config file such as > > /usr/share/alsa/cards/ATIIXP-MODEM.conf. > > Simiarly, we can add the definition in ICH-MODEM.conf and > > NFORCE-MODEM.conf > > Great, so simple. Hehe, it's the advantage of alsa-lib :) The smlink daemon needs to use just 'modem' pcm. The change is already on CVS. Takashi ------------------------------------------------------- This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: ATI IXP Modem driver 2004-07-12 16:57 ` Takashi Iwai @ 2004-07-25 15:21 ` Sasha Khapyorsky 2004-07-28 16:26 ` Takashi Iwai 0 siblings, 1 reply; 10+ messages in thread From: Sasha Khapyorsky @ 2004-07-25 15:21 UTC (permalink / raw) To: Takashi Iwai; +Cc: unixtricks, alsa-devel, Antonis Tsolomitis, Jacques Goldberg [-- Attachment #1: Type: text/plain, Size: 725 bytes --] Hello Takashi, On Mon, 12 Jul 2004 18:57:30 +0200 Takashi Iwai <tiwai@suse.de> wrote: > > The change is already on CVS. Additional 'atiixp_modem' patch (I cannot upload it to bug#0000259 - it is fixed already) The problem was reported at discuss@linmodems.org (and looks like one that was with intel8x0m in the past) - When modem driver probes codecs for mixer it mutes all sound devices. Solution is same as with 'intel8x0m' - to allocate mixer only for modem codec(MC). The approach is that MC is always last one. This will work with one and two codecs configurations. Not sure about three codecs (are there such in practice?), but if 'not' it would be simply fixed by valid 'codec_num' setup. Best Regards, Sasha. [-- Attachment #2: ati.patch --] [-- Type: text/x-patch, Size: 3899 bytes --] Index: alsa-kernel/pci/atiixp_modem.c =================================================================== RCS file: /cvsroot/alsa/alsa-kernel/pci/atiixp_modem.c,v retrieving revision 1.4 diff -u -b -B -r1.4 atiixp_modem.c --- alsa-kernel/pci/atiixp_modem.c 15 Jul 2004 15:25:22 -0000 1.4 +++ alsa-kernel/pci/atiixp_modem.c 25 Jul 2004 14:39:59 -0000 @@ -246,7 +246,7 @@ int irq; ac97_bus_t *ac97_bus; - ac97_t *ac97[NUM_ATI_CODECS]; + ac97_t *mc97; spinlock_t reg_lock; spinlock_t ac97_lock; @@ -674,7 +674,6 @@ atiixp_t *chip = snd_pcm_substream_chip(substream); atiixp_dma_t *dma = (atiixp_dma_t *)substream->runtime->private_data; unsigned int reg = 0; - int i; snd_assert(dma->ops->enable_transfer && dma->ops->flush_dma, return -EINVAL); @@ -684,12 +683,7 @@ spin_lock(&chip->reg_lock); /* hook off/on: via GPIO_OUT */ - for (i = 0; i < NUM_ATI_CODECS; i++) { - if (chip->ac97[i]) { - reg = snd_ac97_read(chip->ac97[i], AC97_GPIO_STATUS); - break; - } - } + reg = snd_ac97_read(chip->mc97, AC97_GPIO_STATUS); if(cmd == SNDRV_PCM_TRIGGER_START) reg |= AC97_GPIO_LINE1_OH; else @@ -805,7 +799,6 @@ atiixp_t *chip = snd_pcm_substream_chip(substream); atiixp_dma_t *dma = (atiixp_dma_t *)substream->runtime->private_data; int err; - int i; err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); if (err < 0) @@ -820,12 +813,8 @@ return err; /* set up modem rate */ - for (i = 0; i < NUM_ATI_CODECS; i++) { - if (! chip->ac97[i]) - continue; - snd_ac97_write(chip->ac97[i], AC97_LINE1_RATE, params_rate(hw_params)); - snd_ac97_write(chip->ac97[i], AC97_LINE1_LEVEL, 0); - } + snd_ac97_write(chip->mc97, AC97_LINE1_RATE, params_rate(hw_params)); + snd_ac97_write(chip->mc97, AC97_LINE1_LEVEL, 0); return err; } @@ -1065,7 +1054,7 @@ ac97_bus_t *pbus; ac97_template_t ac97; int i, err; - int codec_count; + int codec_num; static ac97_bus_ops_t ops = { .write = snd_atiixp_ac97_write, .read = snd_atiixp_ac97_read, @@ -1084,25 +1073,26 @@ pbus->clock = clock; chip->ac97_bus = pbus; - codec_count = 0; + codec_num = -1; for (i = 0; i < NUM_ATI_CODECS; i++) { if (chip->codec_not_ready_bits & codec_skip[i]) - continue; + break; + codec_num = i; + } + + if(codec_num == -1) { + snd_printk(KERN_ERR "atiixp: no codec available\n"); + return -ENODEV; + } + memset(&ac97, 0, sizeof(ac97)); ac97.private_data = chip; ac97.pci = chip->pci; - ac97.num = i; + ac97.num = codec_num; ac97.scaps = AC97_SCAP_SKIP_AUDIO; - if ((err = snd_ac97_mixer(pbus, &ac97, &chip->ac97[i])) < 0) { - chip->ac97[i] = NULL; /* to be sure */ - snd_printdd("atiixp: codec %d not available for modem\n", i); - continue; - } - codec_count++; - } - - if (! codec_count) { - snd_printk(KERN_ERR "atiixp: no codec available\n"); + if ((err = snd_ac97_mixer(pbus, &ac97, &chip->mc97)) < 0) { + chip->mc97 = NULL; /* to be sure */ + snd_printdd("atiixp: codec %d not available for modem\n",codec_num); return -ENODEV; } @@ -1124,9 +1114,8 @@ for (i = 0; i < NUM_ATI_PCMDEVS; i++) if (chip->pcmdevs[i]) snd_pcm_suspend_all(chip->pcmdevs[i]); - for (i = 0; i < NUM_ATI_CODECS; i++) - if (chip->ac97[i]) - snd_ac97_suspend(chip->ac97[i]); + if (chip->mc97) + snd_ac97_suspend(chip->mc97); snd_atiixp_aclink_down(chip); snd_atiixp_chip_stop(chip); @@ -1139,7 +1128,6 @@ static int snd_atiixp_resume(snd_card_t *card, unsigned int state) { atiixp_t *chip = card->pm_private_data; - int i; pci_enable_device(chip->pci); pci_set_power_state(chip->pci, 0); @@ -1147,9 +1135,8 @@ snd_atiixp_aclink_reset(chip); snd_atiixp_chip_start(chip); - for (i = 0; i < NUM_ATI_CODECS; i++) - if (chip->ac97[i]) - snd_ac97_resume(chip->ac97[i]); + if (chip->mc97) + snd_ac97_resume(chip->mc97); snd_power_change_state(card, SNDRV_CTL_POWER_D0); return 0; ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: ATI IXP Modem driver 2004-07-25 15:21 ` Sasha Khapyorsky @ 2004-07-28 16:26 ` Takashi Iwai 2004-07-29 15:11 ` Takashi Iwai 2004-07-29 15:37 ` Sasha Khapyorsky 0 siblings, 2 replies; 10+ messages in thread From: Takashi Iwai @ 2004-07-28 16:26 UTC (permalink / raw) To: Sasha Khapyorsky Cc: unixtricks, alsa-devel, Antonis Tsolomitis, Jacques Goldberg At Sun, 25 Jul 2004 18:21:54 +0300, Sasha Khapyorsky wrote: > > [1 <text/plain; US-ASCII (7bit)>] > Hello Takashi, > > On Mon, 12 Jul 2004 18:57:30 +0200 > Takashi Iwai <tiwai@suse.de> wrote: > > > > > The change is already on CVS. > > Additional 'atiixp_modem' patch (I cannot upload it to bug#0000259 - it > is fixed already) > > The problem was reported at discuss@linmodems.org (and looks like one > that was with intel8x0m in the past) - When modem driver probes codecs > for mixer it mutes all sound devices. > > Solution is same as with 'intel8x0m' - to allocate mixer only for modem > codec(MC). The approach is that MC is always last one. This will work > with one and two codecs configurations. Not sure about three codecs (are > there such in practice?), but if 'not' it would be simply fixed by valid > 'codec_num' setup. Well, this will be still a problem when the audio driver is loaded after the modem driver. We'll need a way to avoid the double reset on codecs. How about adding a new flag to ac97 struct to indicate the shared chip type? ac97_codec.c holds a static array, such as static ac97_t *ac97_shared_codec[AC97_NUM_SHARED_CHIPS][4]; and when ac97->shared is non-zero, check the existence of the already-initialized codec first, if (ac97->shared && ac97_shared_codec[ac97->shared][ac97->num]) { if (modem_only) ... if (audio_only) ... } and set it when ready if (ac97->shared) ac97_shared_codec[ac97->shared][ac97->num] = ac97; release it in snd_ac97_free(), if (ac97->shared) ac97_shared_codec[ac97->shared][ac97->num] = NULL; Most likely we'll need to protect the above with mutex. Takashi ------------------------------------------------------- This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools! Get your free copy of BEA WebLogic Workshop 8.1 today. http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Re: ATI IXP Modem driver 2004-07-28 16:26 ` Takashi Iwai @ 2004-07-29 15:11 ` Takashi Iwai 2004-07-29 16:27 ` Sasha Khapyorsky 2004-07-29 15:37 ` Sasha Khapyorsky 1 sibling, 1 reply; 10+ messages in thread From: Takashi Iwai @ 2004-07-29 15:11 UTC (permalink / raw) To: Sasha Khapyorsky Cc: unixtricks, alsa-devel, Antonis Tsolomitis, Jacques Goldberg [-- Attachment #1: Type: text/plain, Size: 1275 bytes --] At Wed, 28 Jul 2004 18:26:25 +0200, I wrote: > > At Sun, 25 Jul 2004 18:21:54 +0300, > Sasha Khapyorsky wrote: > > > > [1 <text/plain; US-ASCII (7bit)>] > > Hello Takashi, > > > > On Mon, 12 Jul 2004 18:57:30 +0200 > > Takashi Iwai <tiwai@suse.de> wrote: > > > > > > > > The change is already on CVS. > > > > Additional 'atiixp_modem' patch (I cannot upload it to bug#0000259 - it > > is fixed already) > > > > The problem was reported at discuss@linmodems.org (and looks like one > > that was with intel8x0m in the past) - When modem driver probes codecs > > for mixer it mutes all sound devices. > > > > Solution is same as with 'intel8x0m' - to allocate mixer only for modem > > codec(MC). The approach is that MC is always last one. This will work > > with one and two codecs configurations. Not sure about three codecs (are > > there such in practice?), but if 'not' it would be simply fixed by valid > > 'codec_num' setup. > > Well, this will be still a problem when the audio driver is loaded > after the modem driver. We'll need a way to avoid the double reset on > codecs. > > How about adding a new flag to ac97 struct to indicate the shared chip > type? Ok, I changed the codes on CVS as the following patch. Can anyone try it out? thanks, Takashi [-- Attachment #2: Type: text/plain, Size: 5397 bytes --] Index: alsa-kernel/include/ac97_codec.h =================================================================== RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/include/ac97_codec.h,v retrieving revision 1.47 diff -u -r1.47 ac97_codec.h --- alsa-kernel/include/ac97_codec.h 14 Jul 2004 15:35:01 -0000 1.47 +++ alsa-kernel/include/ac97_codec.h 29 Jul 2004 14:38:53 -0000 @@ -364,6 +364,14 @@ #define AC97_RATES_MIC_ADC 4 #define AC97_RATES_SPDIF 5 +/* shared controllers */ +enum { + AC97_SHARED_TYPE_NONE, + AC97_SHARED_TYPE_ICH, + AC97_SHARED_TYPE_ATIIXP, + AC97_SHARED_TYPES +}; + /* * */ @@ -430,6 +438,7 @@ unsigned short used_slots[2][4]; /* actually used PCM slots */ unsigned short pcms_count; /* count of PCMs */ struct ac97_pcm *pcms; + unsigned int shared_type; /* type of shared controller betwen audio and modem */ ac97_t *codec[4]; snd_info_entry_t *proc; }; Index: alsa-kernel/pci/atiixp.c =================================================================== RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/pci/atiixp.c,v retrieving revision 1.20 diff -u -r1.20 atiixp.c --- alsa-kernel/pci/atiixp.c 15 Jul 2004 14:55:29 -0000 1.20 +++ alsa-kernel/pci/atiixp.c 29 Jul 2004 14:37:30 -0000 @@ -1361,6 +1361,7 @@ if ((err = snd_ac97_bus(chip->card, 0, &ops, chip, &pbus)) < 0) return err; pbus->clock = clock; + pbus->shared_type = AC97_SHARED_TYPE_ATIIXP; /* shared with modem driver */ chip->ac97_bus = pbus; codec_count = 0; Index: alsa-kernel/pci/atiixp_modem.c =================================================================== RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/pci/atiixp_modem.c,v retrieving revision 1.4 diff -u -r1.4 atiixp_modem.c --- alsa-kernel/pci/atiixp_modem.c 15 Jul 2004 14:55:29 -0000 1.4 +++ alsa-kernel/pci/atiixp_modem.c 29 Jul 2004 14:37:45 -0000 @@ -1082,6 +1082,7 @@ if ((err = snd_ac97_bus(chip->card, 0, &ops, chip, &pbus)) < 0) return err; pbus->clock = clock; + pbus->shared_type = AC97_SHARED_TYPE_ATIIXP; /* shared with audio driver */ chip->ac97_bus = pbus; codec_count = 0; Index: alsa-kernel/pci/intel8x0.c =================================================================== RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/pci/intel8x0.c,v retrieving revision 1.150 diff -u -r1.150 intel8x0.c --- alsa-kernel/pci/intel8x0.c 29 Jul 2004 12:17:45 -0000 1.150 +++ alsa-kernel/pci/intel8x0.c 29 Jul 2004 14:38:03 -0000 @@ -1910,6 +1910,7 @@ if ((err = snd_ac97_bus(chip->card, 0, ops, chip, &pbus)) < 0) goto __err; pbus->private_free = snd_intel8x0_mixer_free_ac97_bus; + pbus->shared_type = AC97_SHARED_TYPE_ICH; /* shared with modem driver */ if (ac97_clock >= 8000 && ac97_clock <= 48000) pbus->clock = ac97_clock; /* FIXME: my test board doesn't work well with VRA... */ Index: alsa-kernel/pci/intel8x0m.c =================================================================== RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/pci/intel8x0m.c,v retrieving revision 1.13 diff -u -r1.13 intel8x0m.c --- alsa-kernel/pci/intel8x0m.c 15 Jul 2004 13:16:45 -0000 1.13 +++ alsa-kernel/pci/intel8x0m.c 29 Jul 2004 14:40:10 -0000 @@ -897,6 +897,7 @@ if ((err = snd_ac97_bus(chip->card, 0, &ops, chip, &pbus)) < 0) goto __err; pbus->private_free = snd_intel8x0_mixer_free_ac97_bus; + pbus->shared_type = AC97_SHARED_TYPE_ICH; /* shared with audio driver */ if (ac97_clock >= 8000 && ac97_clock <= 48000) pbus->clock = ac97_clock; chip->ac97_bus = pbus; Index: alsa-kernel/pci/ac97/ac97_codec.c =================================================================== RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/pci/ac97/ac97_codec.c,v retrieving revision 1.132 diff -u -r1.132 ac97_codec.c --- alsa-kernel/pci/ac97/ac97_codec.c 5 Jul 2004 15:23:46 -0000 1.132 +++ alsa-kernel/pci/ac97/ac97_codec.c 29 Jul 2004 14:39:38 -0000 @@ -212,6 +212,13 @@ }; /* + * Shared AC97 controllers (ICH, ATIIXP...) + */ +static DECLARE_MUTEX(shared_codec_mutex); +static ac97_t *shared_codec[AC97_SHARED_TYPES][4]; + + +/* * I/O routines */ @@ -1056,8 +1063,14 @@ { if (ac97) { snd_ac97_proc_done(ac97); - if (ac97->bus) + if (ac97->bus) { ac97->bus->codec[ac97->num] = NULL; + if (ac97->bus->shared_type) { + down(&shared_codec_mutex); + shared_codec[ac97->bus->shared_type-1][ac97->num] = NULL; + up(&shared_codec_mutex); + } + } if (ac97->private_free) ac97->private_free(ac97); kfree(ac97); @@ -1831,6 +1844,22 @@ *rac97 = NULL; snd_assert(bus != NULL && template != NULL, return -EINVAL); snd_assert(template->num < 4 && bus->codec[template->num] == NULL, return -EINVAL); + + snd_assert(bus->shared_type <= AC97_SHARED_TYPES, return -EINVAL); + if (bus->shared_type) { + /* already shared? */ + down(&shared_codec_mutex); + ac97 = shared_codec[bus->shared_type-1][template->num]; + if (ac97) { + if ((ac97_is_audio(ac97) && (template->scaps & AC97_SCAP_SKIP_AUDIO)) || + (ac97_is_modem(ac97) && (template->scaps & AC97_SCAP_SKIP_MODEM))) { + up(&shared_codec_mutex); + return -EACCES; /* skip this */ + } + } + up(&shared_codec_mutex); + } + card = bus->card; ac97 = kcalloc(1, sizeof(*ac97), GFP_KERNEL); if (ac97 == NULL) @@ -2055,6 +2084,13 @@ return err; } *rac97 = ac97; + + if (bus->shared_type) { + down(&shared_codec_mutex); + shared_codec[bus->shared_type-1][ac97->num] = ac97; + up(&shared_codec_mutex); + } + return 0; } ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Re: ATI IXP Modem driver 2004-07-29 15:11 ` Takashi Iwai @ 2004-07-29 16:27 ` Sasha Khapyorsky 2004-07-29 17:03 ` Takashi Iwai 0 siblings, 1 reply; 10+ messages in thread From: Sasha Khapyorsky @ 2004-07-29 16:27 UTC (permalink / raw) To: Takashi Iwai; +Cc: unixtricks, alsa-devel, Antonis Tsolomitis, Jacques Goldberg On Thu, 29 Jul 2004 17:11:45 +0200 Takashi Iwai <tiwai@suse.de> wrote: > > > > How about adding a new flag to ac97 struct to indicate the shared > > chip type? > > Ok, I changed the codes on CVS as the following patch. > Can anyone try it out? Works as expected with 'atiixp'. :) Thanks, Sasha. ------------------------------------------------------- This SF.Net email is sponsored by OSTG. Have you noticed the changes on Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now, one more big change to announce. We are now OSTG- Open Source Technology Group. Come see the changes on the new OSTG site. www.ostg.com ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Re: ATI IXP Modem driver 2004-07-29 16:27 ` Sasha Khapyorsky @ 2004-07-29 17:03 ` Takashi Iwai 0 siblings, 0 replies; 10+ messages in thread From: Takashi Iwai @ 2004-07-29 17:03 UTC (permalink / raw) To: Sasha Khapyorsky Cc: unixtricks, alsa-devel, Antonis Tsolomitis, Jacques Goldberg At Thu, 29 Jul 2004 19:27:39 +0300, Sasha Khapyorsky wrote: > > On Thu, 29 Jul 2004 17:11:45 +0200 > Takashi Iwai <tiwai@suse.de> wrote: > > > > > > > How about adding a new flag to ac97 struct to indicate the shared > > > chip type? > > > > Ok, I changed the codes on CVS as the following patch. > > Can anyone try it out? > > Works as expected with 'atiixp'. :) Thanks for the confirmation! Takashi ------------------------------------------------------- This SF.Net email is sponsored by OSTG. Have you noticed the changes on Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now, one more big change to announce. We are now OSTG- Open Source Technology Group. Come see the changes on the new OSTG site. www.ostg.com ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: ATI IXP Modem driver 2004-07-28 16:26 ` Takashi Iwai 2004-07-29 15:11 ` Takashi Iwai @ 2004-07-29 15:37 ` Sasha Khapyorsky 2004-07-29 15:43 ` Takashi Iwai 1 sibling, 1 reply; 10+ messages in thread From: Sasha Khapyorsky @ 2004-07-29 15:37 UTC (permalink / raw) To: Takashi Iwai; +Cc: unixtricks, alsa-devel, Antonis Tsolomitis, Jacques Goldberg On Wed, 28 Jul 2004 18:26:25 +0200 Takashi Iwai <tiwai@suse.de> wrote: > > Well, this will be still a problem when the audio driver is loaded > after the modem driver. We'll need a way to avoid the double reset on > codecs. > > How about adding a new flag to ac97 struct to indicate the shared chip > type? Basically ac97 (or even ac97_bus) 'sharing' is good idea - it better represents the real configuration. > ac97_codec.c holds a static array, such as > > static ac97_t *ac97_shared_codec[AC97_NUM_SHARED_CHIPS][4]; > > and when ac97->shared is non-zero, check the existence of the > already-initialized codec first, > if (ac97->shared && ac97_shared_codec[ac97->shared][ac97->num]) > { > if (modem_only) > ... > if (audio_only) > ... > } > > and set it when ready > if (ac97->shared) > ac97_shared_codec[ac97->shared][ac97->num] = ac97; > > release it in snd_ac97_free(), > if (ac97->shared) > ac97_shared_codec[ac97->shared][ac97->num] = NULL; > > Most likely we'll need to protect the above with mutex. But one question about such implementation. What non-zero 'ac97-shared' should mean as index: How many shared chips will be possible? If more that one (AC97_NUM_SHARED_CHIPS > 1), which initial value should be used by driver? I mean how driver will know how much 'shared' buses are already in use? Sasha. ------------------------------------------------------- This SF.Net email is sponsored by OSTG. Have you noticed the changes on Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now, one more big change to announce. We are now OSTG- Open Source Technology Group. Come see the changes on the new OSTG site. www.ostg.com ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: ATI IXP Modem driver 2004-07-29 15:37 ` Sasha Khapyorsky @ 2004-07-29 15:43 ` Takashi Iwai 2004-07-29 16:15 ` Sasha Khapyorsky 0 siblings, 1 reply; 10+ messages in thread From: Takashi Iwai @ 2004-07-29 15:43 UTC (permalink / raw) To: Sasha Khapyorsky Cc: unixtricks, alsa-devel, Antonis Tsolomitis, Jacques Goldberg At Thu, 29 Jul 2004 18:37:16 +0300, Sasha Khapyorsky wrote: > > On Wed, 28 Jul 2004 18:26:25 +0200 > Takashi Iwai <tiwai@suse.de> wrote: > > > > > Well, this will be still a problem when the audio driver is loaded > > after the modem driver. We'll need a way to avoid the double reset on > > codecs. > > > > How about adding a new flag to ac97 struct to indicate the shared chip > > type? > > Basically ac97 (or even ac97_bus) 'sharing' is good idea - it better > represents the real configuration. I thought of sharing ac97_bus instance between two drivers but it can't because bus includes the card pointer. But the idea is somewhat similar. > > ac97_codec.c holds a static array, such as > > > > static ac97_t *ac97_shared_codec[AC97_NUM_SHARED_CHIPS][4]; > > > > and when ac97->shared is non-zero, check the existence of the > > already-initialized codec first, > > if (ac97->shared && ac97_shared_codec[ac97->shared][ac97->num]) > > { > > if (modem_only) > > ... > > if (audio_only) > > ... > > } > > > > and set it when ready > > if (ac97->shared) > > ac97_shared_codec[ac97->shared][ac97->num] = ac97; > > > > release it in snd_ac97_free(), > > if (ac97->shared) > > ac97_shared_codec[ac97->shared][ac97->num] = NULL; > > > > Most likely we'll need to protect the above with mutex. > > But one question about such implementation. What non-zero > 'ac97-shared' should mean as index: How many shared chips will be > possible? I think you'll understand more when you read my last patch :) Anyway, so far, only two are defined, ICH and ATIIXP. More come, more will be added. > If more that one (AC97_NUM_SHARED_CHIPS > 1), which initial > value should be used by driver? I mean how driver will know how much > 'shared' buses are already in use? The shared audio/modem drivers set their unique shared type. If the driver isn't shared, simply leave it zero. In theory, multiple chips from the single ich/ati driver could be assigned, but it's not supposed in the real world. If the shared_type is non-zero (i.e. a shareable driver), the driver should also set SKIP_MODEM/AUDIO scaps field bit, too, so that the only audio/modem codecs are assigned. ac97 core skips the audio/modem codec in the probe routine when the codec was already assigned and the codec type is what you want to skip. Maybe we can get rid of these checks. It's just to be sure. Takashi ------------------------------------------------------- This SF.Net email is sponsored by OSTG. Have you noticed the changes on Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now, one more big change to announce. We are now OSTG- Open Source Technology Group. Come see the changes on the new OSTG site. www.ostg.com ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: ATI IXP Modem driver 2004-07-29 15:43 ` Takashi Iwai @ 2004-07-29 16:15 ` Sasha Khapyorsky 0 siblings, 0 replies; 10+ messages in thread From: Sasha Khapyorsky @ 2004-07-29 16:15 UTC (permalink / raw) To: Takashi Iwai; +Cc: unixtricks, alsa-devel, Antonis Tsolomitis, Jacques Goldberg On Thu, 29 Jul 2004 17:43:09 +0200 Takashi Iwai <tiwai@suse.de> wrote: > > I think you'll understand more when you read my last patch :) Yes, I see now (I've sent my question before patch reception) - I'm going to run it. Thanks, Sasha. ------------------------------------------------------- This SF.Net email is sponsored by OSTG. Have you noticed the changes on Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now, one more big change to announce. We are now OSTG- Open Source Technology Group. Come see the changes on the new OSTG site. www.ostg.com ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2004-07-29 17:03 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1083465072.1639.8.camel@server.gowanlea.net>
[not found] ` <20040503163657.668357a9@sashak.lan>
[not found] ` <1087962001.4844.0.camel@server.gowanlea.net>
[not found] ` <20040711191833.462a0b4b@sashak.lan>
[not found] ` <s5hr7rhcztt.wl@alsa2.suse.de>
[not found] ` <20040712162839.2c58e1c3@sashak.lan>
[not found] ` <s5hd631cq5v.wl@alsa2.suse.de>
2004-07-12 16:54 ` ATI IXP Modem driver Sasha Khapyorsky
2004-07-12 16:57 ` Takashi Iwai
2004-07-25 15:21 ` Sasha Khapyorsky
2004-07-28 16:26 ` Takashi Iwai
2004-07-29 15:11 ` Takashi Iwai
2004-07-29 16:27 ` Sasha Khapyorsky
2004-07-29 17:03 ` Takashi Iwai
2004-07-29 15:37 ` Sasha Khapyorsky
2004-07-29 15:43 ` Takashi Iwai
2004-07-29 16:15 ` Sasha Khapyorsky
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.