Changeset 35


Ignore:
Timestamp:
Dec 13, 2005, 9:08:20 PM (20 years ago)
Author:
vladest
Message:

Fixed UNIAUD API
Added PM support for Yamaha chipsets
Added PM support for Intel chipsets

Location:
GPL/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • GPL/trunk/alsa-kernel/core/pcm_native.c

    r34 r35  
    3131 *  Compatibility
    3232 */
     33//#define RULES_DEBUG
    3334//#define DEBUG_PK
    3435//#define static
     
    125126char *snd_pcm_hw_param_names[] = {
    126127    HW_PARAM(ACCESS),
     128    HW_PARAM(FORMAT),
    127129#ifdef TARGET_OS2
    128130    HW_PARAM(RATE_MASK),
    129131#endif
    130     HW_PARAM(FORMAT),
    131132    HW_PARAM(SUBFORMAT),
    132133    HW_PARAM(SAMPLE_BITS),
  • GPL/trunk/alsa-kernel/pci/intel8x0.c

    r34 r35  
    389389enum { ALID_PCMIN, ALID_PCMOUT, ALID_MIC, ALID_AC97SPDIFOUT, ALID_SPDIFIN, ALID_SPDIFOUT, ALID_LAST = ALID_SPDIFOUT };
    390390
    391 #define get_ichdev(substream) (ichdev_t *)(substream->runtime->private_data)
    392 
    393 typedef struct {
     391#define get_ichdev(substream) (struct ichdev *)(substream->runtime->private_data)
     392
     393typedef struct ichdev {
    394394    unsigned int ichd;                  /* ich device number */
    395395    unsigned long reg_offset;           /* offset to bmaddr */
     
    418418    unsigned int page_attr_changed: 1;
    419419    unsigned int suspended: 1;
    420 } ichdev_t;
    421 
    422 typedef struct _snd_intel8x0 intel8x0_t;
    423 #define chip_t intel8x0_t
    424 
    425 struct _snd_intel8x0 {
     420};
     421
     422struct intel8x0 {
    426423    unsigned int device_type;
    427424
     
    440437    int pcm_devs;
    441438    snd_pcm_t *pcm[6];
    442     ichdev_t ichd[6];
     439    struct ichdev ichd[6];
    443440
    444441    int multi4: 1,
     
    504501 */
    505502
    506 static u8 igetbyte(intel8x0_t *chip, u32 offset)
     503static u8 igetbyte(struct intel8x0 *chip, u32 offset)
    507504{
    508505    if (chip->bm_mmio)
     
    512509}
    513510
    514 static u16 igetword(intel8x0_t *chip, u32 offset)
     511static u16 igetword(struct intel8x0 *chip, u32 offset)
    515512{
    516513    if (chip->bm_mmio)
     
    520517}
    521518
    522 static u32 igetdword(intel8x0_t *chip, u32 offset)
     519static u32 igetdword(struct intel8x0 *chip, u32 offset)
    523520{
    524521    if (chip->bm_mmio)
     
    528525}
    529526
    530 static void iputbyte(intel8x0_t *chip, u32 offset, u8 val)
     527static void iputbyte(struct intel8x0 *chip, u32 offset, u8 val)
    531528{
    532529    if (chip->bm_mmio)
     
    536533}
    537534
    538 static void iputword(intel8x0_t *chip, u32 offset, u16 val)
     535static void iputword(struct intel8x0 *chip, u32 offset, u16 val)
    539536{
    540537    if (chip->bm_mmio)
     
    544541}
    545542
    546 static void iputdword(intel8x0_t *chip, u32 offset, u32 val)
     543static void iputdword(struct intel8x0 *chip, u32 offset, u32 val)
    547544{
    548545    if (chip->bm_mmio)
     
    556553 */
    557554
    558 static u16 iagetword(intel8x0_t *chip, u32 offset)
     555static u16 iagetword(struct intel8x0 *chip, u32 offset)
    559556{
    560557    if (chip->mmio)
     
    564561}
    565562
    566 static void iaputword(intel8x0_t *chip, u32 offset, u16 val)
     563static void iaputword(struct intel8x0 *chip, u32 offset, u16 val)
    567564{
    568565    if (chip->mmio)
     
    581578
    582579/* return the GLOB_STA bit for the corresponding codec */
    583 static unsigned int get_ich_codec_bit(intel8x0_t *chip, unsigned int codec)
     580static unsigned int get_ich_codec_bit(struct intel8x0 *chip, unsigned int codec)
    584581{
    585582    static unsigned int codec_bit[3] = {
     
    593590}
    594591
    595 static int snd_intel8x0_codec_semaphore(intel8x0_t *chip, unsigned int codec)
     592static int snd_intel8x0_codec_semaphore(struct intel8x0 *chip, unsigned int codec)
    596593{
    597594    int time;
     
    633630                                     unsigned short val)
    634631{
    635     intel8x0_t *chip = ac97->private_data;
     632    struct intel8x0 *chip = ac97->private_data;
    636633
    637634    if (snd_intel8x0_codec_semaphore(chip, ac97->num) < 0) {
     
    645642                                              unsigned short reg)
    646643{
    647     intel8x0_t *chip = ac97->private_data;
     644    struct intel8x0 *chip = ac97->private_data;
    648645    unsigned short res;
    649646    unsigned int tmp;
     
    666663}
    667664
    668 static void snd_intel8x0_codec_read_test(intel8x0_t *chip, unsigned int codec)
     665static void snd_intel8x0_codec_read_test(struct intel8x0 *chip, unsigned int codec)
    669666{
    670667    unsigned int tmp;
     
    682679 * access to AC97 for Ali5455
    683680 */
    684 static int snd_intel8x0_ali_codec_ready(intel8x0_t *chip, int mask)
     681static int snd_intel8x0_ali_codec_ready(struct intel8x0 *chip, int mask)
    685682{
    686683    int count = 0;
     
    695692}
    696693
    697 static int snd_intel8x0_ali_codec_semaphore(intel8x0_t *chip)
     694static int snd_intel8x0_ali_codec_semaphore(struct intel8x0 *chip)
    698695{
    699696    int time = 100;
     
    709706static unsigned short snd_intel8x0_ali_codec_read(ac97_t *ac97, unsigned short reg)
    710707{
    711     intel8x0_t *chip = ac97->private_data;
     708    struct intel8x0 *chip = ac97->private_data;
    712709    unsigned short data = 0xffff;
    713710
     
    727724static void snd_intel8x0_ali_codec_write(ac97_t *ac97, unsigned short reg, unsigned short val)
    728725{
    729     intel8x0_t *chip = ac97->private_data;
     726    struct intel8x0 *chip = ac97->private_data;
    730727
    731728    if (snd_intel8x0_ali_codec_semaphore(chip))
     
    742739 * DMA I/O
    743740 */
    744 static void snd_intel8x0_setup_periods(intel8x0_t *chip, ichdev_t *ichdev)
     741static void snd_intel8x0_setup_periods(struct intel8x0 *chip, struct ichdev *ichdev)
    745742{
    746743    int idx;
     
    789786 */
    790787
    791 static inline void snd_intel8x0_update(intel8x0_t *chip, ichdev_t *ichdev)
     788static inline void snd_intel8x0_update(struct intel8x0 *chip, struct ichdev *ichdev)
    792789{
    793790    unsigned long port = ichdev->reg_offset;
     
    839836static irqreturn_t snd_intel8x0_interrupt(int irq, void *dev_id, struct pt_regs *regs)
    840837{
    841     intel8x0_t *chip = dev_id;
    842     ichdev_t *ichdev;
     838    struct intel8x0 *chip = dev_id;
     839    struct ichdev *ichdev;
    843840    unsigned int status;
    844 #ifdef TARGET_OS2
    845     int fOurIrq = FALSE;
    846 #endif
    847841    unsigned int i;
    848842
     
    868862        return IRQ_RETVAL(status);
    869863    }
    870 #ifdef TARGET_OS2
    871     fOurIrq = TRUE;
    872 #endif
    873864
    874865    for (i = 0; i < chip->bdbars_count; i++) {
     
    881872    iputdword(chip, chip->int_sta_reg, status & chip->int_sta_mask);
    882873
    883 #ifdef TARGET_OS2
    884     if (fOurIrq) {
    885         eoi_irq(irq);
    886     }
    887 #endif //TARGET_OS2
    888 
    889874    return IRQ_HANDLED;
    890875}
     
    896881static int snd_intel8x0_pcm_trigger(snd_pcm_substream_t *substream, int cmd)
    897882{
    898     intel8x0_t *chip = snd_pcm_substream_chip(substream);
    899     ichdev_t *ichdev = get_ichdev(substream);
     883    struct intel8x0 *chip = snd_pcm_substream_chip(substream);
     884    struct ichdev *ichdev = get_ichdev(substream);
    900885    unsigned char val = 0;
    901886    unsigned long port = ichdev->reg_offset;
     
    935920static int snd_intel8x0_ali_trigger(snd_pcm_substream_t *substream, int cmd)
    936921{
    937     intel8x0_t *chip = snd_pcm_substream_chip(substream);
    938     ichdev_t *ichdev = get_ichdev(substream);
     922    struct intel8x0 *chip = snd_pcm_substream_chip(substream);
     923    struct ichdev *ichdev = get_ichdev(substream);
    939924    unsigned long port = ichdev->reg_offset;
    940925    static int fiforeg[] = { ICHREG(ALI_FIFOCR1), ICHREG(ALI_FIFOCR2), ICHREG(ALI_FIFOCR3) };
     
    986971                                  snd_pcm_hw_params_t * hw_params)
    987972{
    988     intel8x0_t *chip = snd_pcm_substream_chip(substream);
    989     ichdev_t *ichdev = get_ichdev(substream);
     973    struct intel8x0 *chip = snd_pcm_substream_chip(substream);
     974    struct ichdev *ichdev = get_ichdev(substream);
    990975    int dbl = params_rate(hw_params) > 48000;
    991976    int err;
     
    1012997static int snd_intel8x0_hw_free(snd_pcm_substream_t * substream)
    1013998{
    1014     ichdev_t *ichdev = get_ichdev(substream);
     999    struct ichdev *ichdev = get_ichdev(substream);
    10151000
    10161001    if (ichdev->pcm_open_flag) {
     
    10211006}
    10221007
    1023 static void snd_intel8x0_setup_pcm_out(intel8x0_t *chip,
     1008static void snd_intel8x0_setup_pcm_out(struct intel8x0 *chip,
    10241009                                       snd_pcm_runtime_t *runtime)
    10251010{
     
    10771062static int snd_intel8x0_pcm_prepare(snd_pcm_substream_t * substream)
    10781063{
    1079     intel8x0_t *chip = snd_pcm_substream_chip(substream);
     1064    struct intel8x0 *chip = snd_pcm_substream_chip(substream);
    10801065    snd_pcm_runtime_t *runtime = substream->runtime;
    1081     ichdev_t *ichdev = get_ichdev(substream);
     1066    struct ichdev *ichdev = get_ichdev(substream);
    10821067
    10831068    ichdev->physbuf = runtime->dma_addr;
     
    10961081static snd_pcm_uframes_t snd_intel8x0_pcm_pointer(snd_pcm_substream_t * substream)
    10971082{
    1098     intel8x0_t *chip = snd_pcm_substream_chip(substream);
    1099     ichdev_t *ichdev = get_ichdev(substream);
     1083    struct intel8x0 *chip = snd_pcm_substream_chip(substream);
     1084    struct ichdev *ichdev = get_ichdev(substream);
    11001085    size_t ptr1, ptr;
    11011086    int civ, timeout = 100;
     
    11651150};
    11661151
    1167 static int snd_intel8x0_pcm_open(snd_pcm_substream_t * substream, ichdev_t *ichdev)
    1168 {
    1169     intel8x0_t *chip = snd_pcm_substream_chip(substream);
     1152static int snd_intel8x0_pcm_open(snd_pcm_substream_t * substream, struct ichdev *ichdev)
     1153{
     1154    struct intel8x0 *chip = snd_pcm_substream_chip(substream);
    11701155    snd_pcm_runtime_t *runtime = substream->runtime;
    11711156    int err;
     
    11901175static int snd_intel8x0_playback_open(snd_pcm_substream_t * substream)
    11911176{
    1192     intel8x0_t *chip = snd_pcm_substream_chip(substream);
     1177    struct intel8x0 *chip = snd_pcm_substream_chip(substream);
    11931178    snd_pcm_runtime_t *runtime = substream->runtime;
    11941179    int err;
     
    12141199static int snd_intel8x0_playback_close(snd_pcm_substream_t * substream)
    12151200{
    1216     intel8x0_t *chip = snd_pcm_substream_chip(substream);
     1201    struct intel8x0 *chip = snd_pcm_substream_chip(substream);
    12171202
    12181203    chip->ichd[ICHD_PCMOUT].substream = NULL;
     
    12221207static int snd_intel8x0_capture_open(snd_pcm_substream_t * substream)
    12231208{
    1224     intel8x0_t *chip = snd_pcm_substream_chip(substream);
     1209    struct intel8x0 *chip = snd_pcm_substream_chip(substream);
    12251210
    12261211    return snd_intel8x0_pcm_open(substream, &chip->ichd[ICHD_PCMIN]);
     
    12291214static int snd_intel8x0_capture_close(snd_pcm_substream_t * substream)
    12301215{
    1231     intel8x0_t *chip = snd_pcm_substream_chip(substream);
     1216    struct intel8x0 *chip = snd_pcm_substream_chip(substream);
    12321217
    12331218    chip->ichd[ICHD_PCMIN].substream = NULL;
     
    12371222static int snd_intel8x0_mic_open(snd_pcm_substream_t * substream)
    12381223{
    1239     intel8x0_t *chip = snd_pcm_substream_chip(substream);
     1224    struct intel8x0 *chip = snd_pcm_substream_chip(substream);
    12401225
    12411226    return snd_intel8x0_pcm_open(substream, &chip->ichd[ICHD_MIC]);
     
    12441229static int snd_intel8x0_mic_close(snd_pcm_substream_t * substream)
    12451230{
    1246     intel8x0_t *chip = snd_pcm_substream_chip(substream);
     1231    struct intel8x0 *chip = snd_pcm_substream_chip(substream);
    12471232
    12481233    chip->ichd[ICHD_MIC].substream = NULL;
     
    12521237static int snd_intel8x0_mic2_open(snd_pcm_substream_t * substream)
    12531238{
    1254     intel8x0_t *chip = snd_pcm_substream_chip(substream);
     1239    struct intel8x0 *chip = snd_pcm_substream_chip(substream);
    12551240
    12561241    return snd_intel8x0_pcm_open(substream, &chip->ichd[ICHD_MIC2]);
     
    12591244static int snd_intel8x0_mic2_close(snd_pcm_substream_t * substream)
    12601245{
    1261     intel8x0_t *chip = snd_pcm_substream_chip(substream);
     1246    struct intel8x0 *chip = snd_pcm_substream_chip(substream);
    12621247
    12631248    chip->ichd[ICHD_MIC2].substream = NULL;
     
    12671252static int snd_intel8x0_capture2_open(snd_pcm_substream_t * substream)
    12681253{
    1269     intel8x0_t *chip = snd_pcm_substream_chip(substream);
     1254    struct intel8x0 *chip = snd_pcm_substream_chip(substream);
    12701255
    12711256    return snd_intel8x0_pcm_open(substream, &chip->ichd[ICHD_PCM2IN]);
     
    12741259static int snd_intel8x0_capture2_close(snd_pcm_substream_t * substream)
    12751260{
    1276     intel8x0_t *chip = snd_pcm_substream_chip(substream);
     1261    struct intel8x0 *chip = snd_pcm_substream_chip(substream);
    12771262
    12781263    chip->ichd[ICHD_PCM2IN].substream = NULL;
     
    12821267static int snd_intel8x0_spdif_open(snd_pcm_substream_t * substream)
    12831268{
    1284     intel8x0_t *chip = snd_pcm_substream_chip(substream);
     1269    struct intel8x0 *chip = snd_pcm_substream_chip(substream);
    12851270    int idx = chip->device_type == DEVICE_NFORCE ? NVD_SPBAR : ICHD_SPBAR;
    12861271
     
    12901275static int snd_intel8x0_spdif_close(snd_pcm_substream_t * substream)
    12911276{
    1292     intel8x0_t *chip = snd_pcm_substream_chip(substream);
     1277    struct intel8x0 *chip = snd_pcm_substream_chip(substream);
    12931278    int idx = chip->device_type == DEVICE_NFORCE ? NVD_SPBAR : ICHD_SPBAR;
    12941279
     
    12991284static int snd_intel8x0_ali_ac97spdifout_open(snd_pcm_substream_t * substream)
    13001285{
    1301     intel8x0_t *chip = snd_pcm_substream_chip(substream);
     1286    struct intel8x0 *chip = snd_pcm_substream_chip(substream);
    13021287    unsigned int val;
    13031288
     
    13141299static int snd_intel8x0_ali_ac97spdifout_close(snd_pcm_substream_t * substream)
    13151300{
    1316     intel8x0_t *chip = snd_pcm_substream_chip(substream);
     1301    struct intel8x0 *chip = snd_pcm_substream_chip(substream);
    13171302    unsigned int val;
    13181303
     
    13291314static int snd_intel8x0_ali_spdifin_open(snd_pcm_substream_t * substream)
    13301315{
    1331     intel8x0_t *chip = snd_pcm_substream_chip(substream);
     1316    struct intel8x0 *chip = snd_pcm_substream_chip(substream);
    13321317
    13331318    return snd_intel8x0_pcm_open(substream, &chip->ichd[ALID_SPDIFIN]);
     
    13361321static int snd_intel8x0_ali_spdifin_close(snd_pcm_substream_t * substream)
    13371322{
    1338     intel8x0_t *chip = snd_pcm_substream_chip(substream);
     1323    struct intel8x0 *chip = snd_pcm_substream_chip(substream);
    13391324
    13401325    chip->ichd[ALID_SPDIFIN].substream = NULL;
     
    13451330static int snd_intel8x0_ali_spdifout_open(snd_pcm_substream_t * substream)
    13461331{
    1347     intel8x0_t *chip = snd_pcm_substream_chip(substream);
     1332    struct intel8x0 *chip = snd_pcm_substream_chip(substream);
    13481333
    13491334    return snd_intel8x0_pcm_open(substream, &chip->ichd[ALID_SPDIFOUT]);
     
    13521337static int snd_intel8x0_ali_spdifout_close(snd_pcm_substream_t * substream)
    13531338{
    1354     intel8x0_t *chip = snd_pcm_substream_chip(substream);
     1339    struct intel8x0 *chip = snd_pcm_substream_chip(substream);
    13551340
    13561341    chip->ichd[ALID_SPDIFOUT].substream = NULL;
     
    15031488};
    15041489
    1505 static int __devinit snd_intel8x0_pcm1(intel8x0_t *chip, int device, struct ich_pcm_table *rec)
     1490static int __devinit snd_intel8x0_pcm1(struct intel8x0 *chip, int device, struct ich_pcm_table *rec)
    15061491{
    15071492        snd_pcm_t *pcm;
     
    16311616
    16321617
    1633 static int __devinit snd_intel8x0_pcm(intel8x0_t *chip)
     1618static int __devinit snd_intel8x0_pcm(struct intel8x0 *chip)
    16341619{
    16351620    int i, tblsize, device, err;
     
    16811666static void snd_intel8x0_mixer_free_ac97_bus(ac97_bus_t *bus)
    16821667{
    1683     intel8x0_t *chip = bus->private_data;
     1668    struct intel8x0 *chip = bus->private_data;
    16841669    chip->ac97_bus = NULL;
    16851670}
     
    16871672static void snd_intel8x0_mixer_free_ac97(ac97_t *ac97)
    16881673{
    1689     intel8x0_t *chip = ac97->private_data;
     1674    struct intel8x0 *chip = ac97->private_data;
    16901675    chip->ac97[ac97->num] = NULL;
    16911676}
     
    18911876        },
    18921877        {
    1893                 .subvendor = 0x103c,
     1878            .subvendor = 0x103c,
     1879            .subdevice = 0x0938,
     1880            .name = "HP nc4200",
     1881            .type = AC97_TUNE_HP_MUTE_LED
     1882        },
     1883        {
     1884            .subvendor = 0x103c,
     1885            .subdevice = 0x099c,
     1886            .name = "HP nc6120",
     1887            .type = AC97_TUNE_HP_MUTE_LED
     1888        },
     1889        {
     1890            .subvendor = 0x103c,
     1891            .subdevice = 0x0944,
     1892            .name = "HP nc6220",
     1893            .type = AC97_TUNE_HP_MUTE_LED
     1894        },
     1895        {
     1896            .subvendor = 0x103c,
     1897            .subdevice = 0x0934,
     1898            .name = "HP nc8220",
     1899            .type = AC97_TUNE_HP_MUTE_LED
     1900        },
     1901        {
     1902            .subvendor = 0x103c,
    18941903                .subdevice = 0x12f1,
    18951904                .name = "HP xw8200",    /* AD1981B*/
     
    19451954        },
    19461955        {
     1956            .subvendor = 0x10cf,
     1957            .subdevice = 0x12f2,
     1958            .name = "Fujitsu-Siemens Celsius H320",
     1959            .type = AC97_TUNE_SWAP_HP
     1960        },
     1961        {
    19471962                .subvendor = 0x10f1,
    19481963                .subdevice = 0x2665,
     
    20382053};
    20392054
    2040 static int __devinit snd_intel8x0_mixer(intel8x0_t *chip, int ac97_clock, char *quirk_override)
     2055static int __devinit snd_intel8x0_mixer(struct intel8x0 *chip, int ac97_clock, char *quirk_override)
    20412056{
    20422057    ac97_bus_t *pbus;
     
    22252240 */
    22262241
    2227 static void do_ali_reset(intel8x0_t *chip)
     2242static void do_ali_reset(struct intel8x0 *chip)
    22282243{
    22292244    iputdword(chip, ICHREG(ALI_SCR), ICH_ALI_SC_RESET);
     
    22422257    } while (0)
    22432258
    2244 static int snd_intel8x0_ich_chip_init(intel8x0_t *chip, int probing)
     2259static int snd_intel8x0_ich_chip_init(struct intel8x0 *chip, int probing)
    22452260{
    22462261    unsigned long end_time;
     
    23712386}
    23722387
    2373 static int snd_intel8x0_ali_chip_init(intel8x0_t *chip, int probing)
     2388static int snd_intel8x0_ali_chip_init(struct intel8x0 *chip, int probing)
    23742389{
    23752390    u32 reg;
     
    24062421}
    24072422
    2408 static int snd_intel8x0_chip_init(intel8x0_t *chip, int probing)
     2423static int snd_intel8x0_chip_init(struct intel8x0 *chip, int probing)
    24092424{
    24102425    unsigned int i;
     
    24322447}
    24332448
    2434 static int snd_intel8x0_free(intel8x0_t *chip)
     2449static int snd_intel8x0_free(struct intel8x0 *chip)
    24352450{
    24362451    unsigned int i;
     
    24712486 * power management
    24722487 */
    2473 static int intel8x0_suspend(snd_card_t *card, unsigned int state)
    2474 {
    2475     intel8x0_t *chip = card->pm_private_data;
    2476 #ifdef TARGET_OS2
     2488static int intel8x0_suspend(struct pci_dev *pci, pm_message_t state)
     2489{
     2490    struct snd_card *card = pci_get_drvdata(pci);
     2491    struct intel8x0 *chip = card->private_data;
    24772492    int i;
    2478 #endif
    2479 
    2480 #ifdef TARGET_OS2
    2481     for (i = 0; i < 3; i++)
    2482         if (chip->ac97[i])
    2483             snd_ac97_suspend(chip->ac97[i]);
    2484 #endif
     2493
     2494    snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
     2495
    24852496    for (i = 0; i < chip->pcm_devs; i++)
    24862497        snd_pcm_suspend_all(chip->pcm[i]);
     2498
    24872499    for (i = 0; i < 3; i++)
    2488         if (chip->ac97[i])
    2489             snd_ac97_suspend(chip->ac97[i]);
     2500        snd_ac97_suspend(chip->ac97[i]);
    24902501    if (chip->device_type == DEVICE_INTEL_ICH4 ||
    24912502        chip->device_type == DEVICE_INTEL_ICH5)
     
    24942505    if (chip->irq >= 0)
    24952506        free_irq(chip->irq, (void *)chip);
    2496     pci_disable_device(chip->pci);
     2507    pci_disable_device(pci);
     2508    pci_save_state(pci);
    24972509    return 0;
    24982510}
    24992511
    2500 static int intel8x0_resume(snd_card_t *card, unsigned int state)
    2501 {
    2502     intel8x0_t *chip = card->pm_private_data;
     2512static int intel8x0_resume(struct pci_dev *pci)
     2513{
     2514    struct snd_card *card = pci_get_drvdata(pci);
     2515    struct intel8x0 *chip = card->private_data;
    25032516    int i;
    25042517
    2505     pci_enable_device(chip->pci);
    2506     pci_set_master(chip->pci);
    2507     request_irq(chip->irq, snd_intel8x0_interrupt, SA_INTERRUPT|SA_SHIRQ, card->shortname, (void *)chip);
     2518    pci_restore_state(pci);
     2519    pci_enable_device(pci);
     2520    pci_set_master(pci);
     2521    request_irq(pci->irq, snd_intel8x0_interrupt, SA_INTERRUPT|SA_SHIRQ,
     2522                card->shortname, (void *)chip);
     2523    chip->irq = pci->irq;
    25082524    synchronize_irq(chip->irq);
    25092525    snd_intel8x0_chip_init(chip, 1);
     
    25202536
    25212537    for (i = 0; i < 3; i++)
    2522         if (chip->ac97[i])
    2523             snd_ac97_resume(chip->ac97[i]);
     2538        snd_ac97_resume(chip->ac97[i]);
    25242539    /* resume status */
    25252540    for (i = 0; i < chip->bdbars_count; i++) {
    2526         ichdev_t *ichdev = &chip->ichd[i];
     2541        struct ichdev *ichdev = &chip->ichd[i];
    25272542        unsigned long port = ichdev->reg_offset;
    25282543        if (! ichdev->substream || ! ichdev->suspended)
     
    25352550        iputbyte(chip, port + ichdev->roff_sr, ICH_FIFOE | ICH_BCIS | ICH_LVBCI);
    25362551    }
     2552    snd_power_change_state(card, SNDRV_CTL_POWER_D0);
    25372553    return 0;
    25382554}
     
    25422558#define INTEL8X0_TESTBUF_SIZE   32768   /* enough large for one shot */
    25432559
    2544 static void __devinit intel8x0_measure_ac97_clock(intel8x0_t *chip)
     2560static void __devinit intel8x0_measure_ac97_clock(struct intel8x0 *chip)
    25452561{
    25462562    snd_pcm_substream_t *subs;
    2547     ichdev_t *ichdev;
     2563    struct ichdev *ichdev;
    25482564    unsigned long port;
    25492565    unsigned long pos, t;
     
    26212637}
    26222638
     2639#ifdef CONFIG_PROC_FS
    26232640static void snd_intel8x0_proc_read(snd_info_entry_t * entry,
    26242641                                   snd_info_buffer_t * buffer)
    26252642{
    2626     intel8x0_t *chip = entry->private_data;
     2643    struct intel8x0 *chip = entry->private_data;
    26272644    unsigned int tmp;
    26282645
     
    26492666}
    26502667
    2651 static void __devinit snd_intel8x0_proc_init(intel8x0_t * chip)
     2668static void __devinit snd_intel8x0_proc_init(struct intel8x0 * chip)
    26522669{
    26532670    snd_info_entry_t *entry;
     
    26562673        snd_info_set_text_ops(entry, chip, 1024, snd_intel8x0_proc_read);
    26572674}
    2658 
     2675#else
     2676#define snd_intel8x0_proc_init(x)
     2677#endif
    26592678
    26602679static int snd_intel8x0_dev_free(snd_device_t *device)
    26612680{
    2662     intel8x0_t *chip = device->device_data;
     2681    struct intel8x0 *chip = device->device_data;
    26632682    return snd_intel8x0_free(chip);
    26642683}
     
    26732692                                         struct pci_dev *pci,
    26742693                                         unsigned long device_type,
    2675                                          intel8x0_t ** r_intel8x0)
    2676 {
    2677     intel8x0_t *chip;
     2694                                         struct intel8x0 ** r_intel8x0)
     2695{
     2696    struct intel8x0 *chip;
    26782697    int err;
    26792698    unsigned int i,pci_dword;
     
    26822701    unsigned char pci_byte;
    26832702
    2684     ichdev_t *ichdev;
     2703    struct ichdev *ichdev;
    26852704#ifdef TARGET_OS2
    26862705    static snd_device_ops_t ops = {
     
    29132932    }
    29142933
    2915     snd_card_set_pm_callback(card, intel8x0_suspend, intel8x0_resume, chip);
    2916 
    29172934    if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
    29182935        snd_intel8x0_free(chip);
     
    29582975    static int dev;
    29592976    snd_card_t *card;
    2960     intel8x0_t *chip;
     2977    struct intel8x0 *chip;
    29612978    int err;
    29622979    struct shortname_table *name;
     
    30103027        return err;
    30113028    }
     3029
     3030    card->private_data = chip;
     3031
    30123032    if ((err = snd_intel8x0_mixer(chip, ac97_clock[dev], ac97_quirk[dev])) < 0){
    30133033        snd_card_free(card);
     
    30593079        .id_table = snd_intel8x0_ids,
    30603080        .probe = snd_intel8x0_probe,
    3061         .remove = snd_intel8x0_remove,
    3062         SND_PCI_PM_CALLBACKS
     3081        .remove = snd_intel8x0_remove,
     3082#ifdef CONFIG_PM
     3083        .suspend = intel8x0_suspend,
     3084        .resume = intel8x0_resume,
     3085#endif
    30633086};
    30643087
  • GPL/trunk/alsa-kernel/pci/ymfpci/ymfpci.c

    r34 r35  
    191191        }
    192192        chip->fm_res = fm_res;
    193         chip->mpu_res = mpu_res;
     193        chip->mpu_res = mpu_res;
     194        card->private_data = chip;
     195
    194196        strcpy(card->driver, str);
    195197        sprintf(card->shortname, "Yamaha DS-XG (%s)", str);
     
    270272
    271273static struct pci_driver driver = {
    272         0,0,0,"Yamaha DS-XG PCI",
    273         snd_ymfpci_ids,
    274         snd_card_ymfpci_probe,
    275         snd_card_ymfpci_remove,
    276         SND_PCI_PM_CALLBACKS
     274    .name = "Yamaha DS-1 PCI",
     275    .id_table = snd_ymfpci_ids,
     276    .probe = snd_card_ymfpci_probe,
     277    .remove = snd_card_ymfpci_remove,
     278#ifdef CONFIG_PM
     279    .suspend = snd_ymfpci_suspend,
     280    .resume = snd_ymfpci_resume,
     281#endif
    277282};
     283
    278284
    279285static int __init alsa_card_ymfpci_init(void)
  • GPL/trunk/alsa-kernel/pci/ymfpci/ymfpci_main.c

    r34 r35  
    728728    u32 status, nvoice, mode;
    729729    ymfpci_voice_t *voice;
    730 #ifdef TARGET_OS2
    731     int fOurIrq = FALSE;
    732 #endif
    733730
    734731    status = snd_ymfpci_readl(chip, YDSXGR_STATUS);
    735732    if (status & 0x80000000) {
    736 #ifdef TARGET_OS2
    737         fOurIrq = TRUE;
    738 #endif
    739733        chip->active_bank = snd_ymfpci_readl(chip, YDSXGR_CTRLSELECT) & 1;
    740734        spin_lock(&chip->voice_lock);
     
    775769    if (chip->rawmidi)
    776770        snd_mpu401_uart_interrupt(irq, chip->rawmidi->private_data, regs);
    777 #ifdef TARGET_OS2
    778     if (fOurIrq) {
    779         eoi_irq(irq);
    780     }
    781 #endif //TARGET_OS2
    782771    return IRQ_HANDLED;
    783772}
     
    22262215#define YDSXGR_NUM_SAVED_REGS   ARRAY_SIZE(saved_regs_index)
    22272216
    2228 static int snd_ymfpci_suspend(snd_card_t *card, unsigned int state)
    2229 {
    2230     ymfpci_t *chip = card->pm_private_data;
     2217int snd_ymfpci_suspend(struct pci_dev *pci, pm_message_t state)
     2218{
     2219    struct snd_card *card = pci_get_drvdata(pci);
     2220    struct snd_ymfpci *chip = card->private_data;
    22312221    unsigned int i;
    22322222
     2223    snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
    22332224    snd_pcm_suspend_all(chip->pcm);
    22342225    snd_pcm_suspend_all(chip->pcm2);
     
    22412232    snd_ymfpci_writel(chip, YDSXGR_NATIVEDACOUTVOL, 0);
    22422233    snd_ymfpci_disable_dsp(chip);
    2243     return 0;
    2244 }
    2245 
    2246 static int snd_ymfpci_resume(snd_card_t *card, unsigned int state)
    2247 {
    2248     ymfpci_t *chip = card->pm_private_data;
     2234    pci_disable_device(pci);
     2235    pci_save_state(pci);
     2236    return 0;
     2237}
     2238
     2239int snd_ymfpci_resume(struct pci_dev *pci)
     2240{
     2241    struct snd_card *card = pci_get_drvdata(pci);
     2242    struct snd_ymfpci *chip = card->private_data;
    22492243    unsigned int i;
    22502244
    2251     pci_enable_device(chip->pci);
    2252     pci_set_master(chip->pci);
    2253     snd_ymfpci_aclink_reset(chip->pci);
     2245    pci_restore_state(pci);
     2246    pci_enable_device(pci);
     2247    pci_set_master(pci);
     2248    snd_ymfpci_aclink_reset(pci);
    22542249    snd_ymfpci_codec_ready(chip, 0);
    22552250    snd_ymfpci_download_image(chip);
     
    22682263        spin_unlock_irq(&chip->reg_lock);
    22692264    }
    2270     return 0;
    2271 }
     2265    snd_power_change_state(card, SNDRV_CTL_POWER_D0);
     2266    return 0;
     2267}
     2268
    22722269#endif /* CONFIG_PM */
    22732270
     
    23542351        return -ENOMEM;
    23552352    }
    2356     snd_card_set_pm_callback(card, snd_ymfpci_suspend, snd_ymfpci_resume, chip);
    23572353#endif
    2358 
    2359     snd_ymfpci_proc_init(card, chip);
    23602354
    23612355    if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
     
    23642358    }
    23652359
     2360    snd_ymfpci_proc_init(card, chip);
     2361
    23662362    snd_card_set_dev(card, &pci->dev);
    23672363
  • GPL/trunk/lib32/pci.c

    r34 r35  
    894894}
    895895
     896struct pci_driver_mapping {
     897    struct pci_dev *dev;
     898    struct pci_driver *drv;
     899    unsigned long dma_mask;
     900    void *driver_data;
     901    u32 saved_config[16];
     902};
     903
     904#define PCI_MAX_MAPPINGS 64
     905static struct pci_driver_mapping drvmap [PCI_MAX_MAPPINGS] = { { NULL, } , };
     906
     907
     908static struct pci_driver_mapping *get_pci_driver_mapping(struct pci_dev *dev)
     909{
     910    int i;
     911
     912    for (i = 0; i < PCI_MAX_MAPPINGS; i++)
     913        if (drvmap[i].dev == dev)
     914            return &drvmap[i];
     915    return NULL;
     916}
     917
     918struct pci_driver *snd_pci_compat_get_pci_driver(struct pci_dev *dev)
     919{
     920    struct pci_driver_mapping *map = get_pci_driver_mapping(dev);
     921    if (map)
     922        return map->drv;
     923    return NULL;
     924}
     925#if 0
     926void * pci_get_drvdata (struct pci_dev *dev)
     927{
     928    struct pci_driver_mapping *map = get_pci_driver_mapping(dev);
     929    if (map)
     930        return map->driver_data;
     931    return NULL;
     932}
     933
     934
     935void pci_set_drvdata (struct pci_dev *dev, void *driver_data)
     936{
     937    struct pci_driver_mapping *map = get_pci_driver_mapping(dev);
     938    if (map)
     939        map->driver_data = driver_data;
     940}
     941#endif
Note: See TracChangeset for help on using the changeset viewer.