Ignore:
Timestamp:
Apr 19, 2025, 8:08:37 PM (5 months ago)
Author:
David Azarewicz
Message:

Merge in changes from 6.6-LTS branch.
Fixed additional 25+ problems.

Location:
GPL/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • GPL/trunk

  • GPL/trunk/alsa-kernel/pci/emu10k1/irq.c

    r679 r772  
    44 *                   Creative Labs, Inc.
    55 *  Routines for IRQ control of EMU10K1 chips
    6  *
    7  *  BUGS:
    8  *    --
    9  *
    10  *  TODO:
    11  *    --
    126 */
    137
     
    1913{
    2014        struct snd_emu10k1 *emu = dev_id;
    21         unsigned int status, status2, orig_status, orig_status2;
     15        unsigned int status, orig_status;
    2216        int handled = 0;
    2317        int timeout = 0;
    2418
    25         while (((status = inl(emu->port + IPR)) != 0) && (timeout < 1000)) {
    26                 timeout++;
    27                 orig_status = status;
     19        while ((status = inl(emu->port + IPR)) != 0) {
    2820                handled = 1;
    2921                if ((status & 0xffffffff) == 0xffffffff) {
     
    3224                        break;
    3325                }
     26                if (++timeout == 1000) {
     27                        dev_info(emu->card->dev, "emu10k1 irq routine failure\n");
     28                        break;
     29                }
     30                orig_status = status;
    3431                if (status & IPR_PCIERROR) {
    3532                        dev_err(emu->card->dev, "interrupt: PCI error\n");
     
    4542                }
    4643                if (status & IPR_CHANNELLOOP) {
     44                        struct snd_emu10k1_voice *pvoice;
    4745                        int voice;
    4846                        int voice_max = status & IPR_CHANNELNUMBERMASK;
    4947                        u32 val;
    50                         struct snd_emu10k1_voice *pvoice = emu->voices;
    5148
    5249                        val = snd_emu10k1_ptr_read(emu, CLIPL, 0);
     50                        pvoice = emu->voices;
    5351                        for (voice = 0; voice <= voice_max; voice++) {
    5452                                if (voice == 0x20)
     
    6664                        }
    6765                        val = snd_emu10k1_ptr_read(emu, HLIPL, 0);
     66                        pvoice = emu->voices;
    6867                        for (voice = 0; voice <= voice_max; voice++) {
    6968                                if (voice == 0x20)
     
    8079                                pvoice++;
    8180                        }
    82                         status &= ~IPR_CHANNELLOOP;
     81                        status &= ~(IPR_CHANNELLOOP | IPR_CHANNELNUMBERMASK);
    8382                }
    84                 status &= ~IPR_CHANNELNUMBERMASK;
    8583                if (status & (IPR_ADCBUFFULL|IPR_ADCBUFHALFFULL)) {
    8684                        if (emu->capture_interrupt)
     
    140138                }
    141139                if (status & IPR_P16V) {
    142                         while ((status2 = inl(emu->port + IPR2)) != 0) {
    143                                 u32 mask = INTE2_PLAYBACK_CH_0_LOOP;  /* Full Loop */
    144                                 struct snd_emu10k1_voice *pvoice = &(emu->p16v_voices[0]);
    145                                 struct snd_emu10k1_voice *cvoice = &(emu->p16v_capture_voice);
    146 
    147                                 /* dev_dbg(emu->card->dev, "status2=0x%x\n", status2); */
    148                                 orig_status2 = status2;
    149                                 if(status2 & mask) {
    150                                         if(pvoice->use) {
    151                                                 snd_pcm_period_elapsed(pvoice->epcm->substream);
    152                                         } else {
    153                                                 dev_err(emu->card->dev,
    154                                                         "p16v: status: 0x%08x, mask=0x%08x, pvoice=%p, use=%d\n",
    155                                                         status2, mask, pvoice,
    156                                                         pvoice->use);
    157                                         }
    158                                 }
    159                                 if(status2 & 0x110000) {
    160                                         /* dev_info(emu->card->dev, "capture int found\n"); */
    161                                         if(cvoice->use) {
    162                                                 /* dev_info(emu->card->dev, "capture period_elapsed\n"); */
    163                                                 snd_pcm_period_elapsed(cvoice->epcm->substream);
    164                                         }
    165                                 }
    166                                 outl(orig_status2, emu->port + IPR2); /* ack all */
    167                         }
     140                        if (emu->p16v_interrupt)
     141                                emu->p16v_interrupt(emu);
     142                        else
     143                                outl(0, emu->port + INTE2);
    168144                        status &= ~IPR_P16V;
     145                }
     146                if (status & IPR_A_GPIO) {
     147                        if (emu->gpio_interrupt)
     148                                emu->gpio_interrupt(emu);
     149                        else
     150                                snd_emu10k1_intr_disable(emu, INTE_A_GPIOENABLE);
     151                        status &= ~IPR_A_GPIO;
    169152                }
    170153
    171154                if (status) {
    172                         unsigned int bits;
    173155                        dev_err(emu->card->dev,
    174156                                "unhandled interrupt: 0x%08x\n", status);
    175                         //make sure any interrupts we don't handle are disabled:
    176                         bits = INTE_FXDSPENABLE |
    177                                 INTE_PCIERRORENABLE |
    178                                 INTE_VOLINCRENABLE |
    179                                 INTE_VOLDECRENABLE |
    180                                 INTE_MUTEENABLE |
    181                                 INTE_MICBUFENABLE |
    182                                 INTE_ADCBUFENABLE |
    183                                 INTE_EFXBUFENABLE |
    184                                 INTE_GPSPDIFENABLE |
    185                                 INTE_CDSPDIFENABLE |
    186                                 INTE_INTERVALTIMERENB |
    187                                 INTE_MIDITXENABLE |
    188                                 INTE_MIDIRXENABLE;
    189                         if (emu->audigy)
    190                                 bits |= INTE_A_MIDITXENABLE2 | INTE_A_MIDIRXENABLE2;
    191                         snd_emu10k1_intr_disable(emu, bits);
    192157                }
    193158                outl(orig_status, emu->port + IPR); /* ack all */
    194159        }
    195         if (timeout == 1000)
    196                 dev_info(emu->card->dev, "emu10k1 irq routine failure\n");
    197160
    198161        return IRQ_RETVAL(handled);
Note: See TracChangeset for help on using the changeset viewer.