Ignore:
Timestamp:
Jul 16, 2008, 11:53:49 AM (17 years ago)
Author:
Paul Smedley
Message:

Update uniaud32-2.0 branch to ALSA 1.0.17

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GPL/branches/uniaud32-2.0/alsa-kernel/pci/maestro3.c

    r325 r358  
    20732073        struct snd_ac97_bus *pbus;
    20742074        struct snd_ac97_template ac97;
    2075         struct snd_ctl_elem_id id;
     2075        struct snd_ctl_elem_id elem_id;
    20762076        int err;
    20772077        static struct snd_ac97_bus_ops ops = {
     
    20932093        snd_ac97_write(chip->ac97, AC97_PCM, 0);
    20942094
    2095         memset(&id, 0, sizeof(id));
    2096         id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
    2097         strcpy(id.name, "Master Playback Switch");
    2098         chip->master_switch = snd_ctl_find_id(chip->card, &id);
    2099         memset(&id, 0, sizeof(id));
    2100         id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
    2101         strcpy(id.name, "Master Playback Volume");
    2102         chip->master_volume = snd_ctl_find_id(chip->card, &id);
     2095        memset(&elem_id, 0, sizeof(elem_id));
     2096        elem_id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
     2097        strcpy(elem_id.name, "Master Playback Switch");
     2098        chip->master_switch = snd_ctl_find_id(chip->card, &elem_id);
     2099        memset(&elem_id, 0, sizeof(elem_id));
     2100        elem_id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
     2101        strcpy(elem_id.name, "Master Playback Volume");
     2102        chip->master_volume = snd_ctl_find_id(chip->card, &elem_id);
    21032103
    21042104        return 0;
     
    24322432}
    24332433
     2434static void
     2435snd_m3_hv_init(struct snd_m3 *chip)
     2436{
     2437        unsigned long io = chip->iobase;
     2438        u16 val = GPI_VOL_DOWN | GPI_VOL_UP;
     2439
     2440        if (!chip->is_omnibook)
     2441                return;
     2442
     2443        /*
     2444         * Volume buttons on some HP OmniBook laptops
     2445         * require some GPIO magic to work correctly.
     2446         */
     2447        outw(0xffff, io + GPIO_MASK);
     2448        outw(0x0000, io + GPIO_DATA);
     2449
     2450        outw(~val, io + GPIO_MASK);
     2451        outw(inw(io + GPIO_DIRECTION) & ~val, io + GPIO_DIRECTION);
     2452        outw(val, io + GPIO_MASK);
     2453
     2454        outw(0xffff, io + GPIO_MASK);
     2455}
     2456
    24342457static int
    24352458snd_m3_chip_init(struct snd_m3 *chip)
     
    24472470        pci_write_config_word(pcidev, PCI_LEGACY_AUDIO_CTRL, w);
    24482471
    2449         if (chip->is_omnibook) {
    2450                 /*
    2451                  * Volume buttons on some HP OmniBook laptops don't work
    2452                  * correctly. This makes them work for the most part.
    2453                  *
    2454                  * Volume up and down buttons on the laptop side work.
    2455                  * Fn+cursor_up (volme up) works.
    2456                  * Fn+cursor_down (volume down) doesn't work.
    2457                  * Fn+F7 (mute) works acts as volume up.
    2458                  */
    2459                 outw(~(GPI_VOL_DOWN|GPI_VOL_UP), io + GPIO_MASK);
    2460                 outw(inw(io + GPIO_DIRECTION) & ~(GPI_VOL_DOWN|GPI_VOL_UP), io + GPIO_DIRECTION);
    2461                 outw((GPI_VOL_DOWN|GPI_VOL_UP), io + GPIO_DATA);
    2462                 outw(0xffff, io + GPIO_MASK);
    2463         }
    24642472        pci_read_config_dword(pcidev, PCI_ALLEGRO_CONFIG, &n);
    24652473        n &= ~(HV_CTRL_ENABLE | REDUCED_DEBOUNCE | HV_BUTTON_FROM_GD);
     
    25472555#endif
    25482556
    2549         if (chip->irq >= 0) {
    2550                 synchronize_irq(chip->irq);
     2557        if (chip->irq >= 0)
    25512558                free_irq(chip->irq, chip);
    2552         }
    25532559
    25542560        if (chip->iobase)
     
    25742580        struct snd_card *card = pci_get_drvdata(pci);
    25752581        struct snd_m3 *chip = card->private_data;
    2576         int i, index;
     2582        int i, dsp_index;
    25772583
    25782584        if (chip->suspend_mem == NULL)
     
    25882594
    25892595        /* save dsp image */
    2590         index = 0;
     2596        dsp_index = 0;
    25912597        for (i = REV_B_CODE_MEMORY_BEGIN; i <= REV_B_CODE_MEMORY_END; i++)
    2592                 chip->suspend_mem[index++] =
     2598                chip->suspend_mem[dsp_index++] =
    25932599                        snd_m3_assp_read(chip, MEMTYPE_INTERNAL_CODE, i);
    25942600        for (i = REV_B_DATA_MEMORY_BEGIN ; i <= REV_B_DATA_MEMORY_END; i++)
    2595                 chip->suspend_mem[index++] =
     2601                chip->suspend_mem[dsp_index++] =
    25962602                        snd_m3_assp_read(chip, MEMTYPE_INTERNAL_DATA, i);
    25972603
     
    26062612        struct snd_card *card = pci_get_drvdata(pci);
    26072613        struct snd_m3 *chip = card->private_data;
    2608         int i, index;
     2614        int i, dsp_index;
    26092615
    26102616        if (chip->suspend_mem == NULL)
     
    26302636
    26312637        /* restore dsp image */
    2632         index = 0;
     2638        dsp_index = 0;
    26332639        for (i = REV_B_CODE_MEMORY_BEGIN; i <= REV_B_CODE_MEMORY_END; i++)
    26342640                snd_m3_assp_write(chip, MEMTYPE_INTERNAL_CODE, i,
    2635                                   chip->suspend_mem[index++]);
     2641                                  chip->suspend_mem[dsp_index++]);
    26362642        for (i = REV_B_DATA_MEMORY_BEGIN ; i <= REV_B_DATA_MEMORY_END; i++)
    26372643                snd_m3_assp_write(chip, MEMTYPE_INTERNAL_DATA, i,
    2638                                   chip->suspend_mem[index++]);
     2644                                  chip->suspend_mem[dsp_index++]);
    26392645
    26402646        /* tell the dma engine to restart itself */
     
    26482654        snd_m3_enable_ints(chip);
    26492655        snd_m3_amp_enable(chip, 1);
     2656
     2657        snd_m3_hv_init(chip);
    26502658
    26512659        snd_power_change_state(card, SNDRV_CTL_POWER_D0);
     
    27922800        snd_m3_amp_enable(chip, 1);
    27932801
     2802        snd_m3_hv_init(chip);
     2803
    27942804        tasklet_init(&chip->hwvol_tq, snd_m3_update_hw_volume, (unsigned long)chip);
    27952805
Note: See TracChangeset for help on using the changeset viewer.