ALSA: oxygen: use a copy of the model struct
authorClemens Ladisch <clemens@ladisch.de>
Mon, 22 Sep 2008 06:55:19 +0000 (08:55 +0200)
committerClemens Ladisch <clemens@ladisch.de>
Mon, 22 Sep 2008 06:55:19 +0000 (08:55 +0200)
Put a copy of the model structure into the chip structure so that model-
specific drivers can modify it depending on a particular device
instance.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
sound/pci/oxygen/oxygen.h
sound/pci/oxygen/oxygen_lib.c
sound/pci/oxygen/oxygen_mixer.c
sound/pci/oxygen/oxygen_pcm.c

index 74a6448..5f3fbf8 100644 (file)
@@ -51,42 +51,7 @@ struct snd_pcm_hardware;
 struct snd_pcm_hw_params;
 struct snd_kcontrol_new;
 struct snd_rawmidi;
-struct oxygen_model;
-
-struct oxygen {
-       unsigned long addr;
-       spinlock_t reg_lock;
-       struct mutex mutex;
-       struct snd_card *card;
-       struct pci_dev *pci;
-       struct snd_rawmidi *midi;
-       int irq;
-       const struct oxygen_model *model;
-       void *model_data;
-       unsigned int interrupt_mask;
-       u8 dac_volume[8];
-       u8 dac_mute;
-       u8 pcm_active;
-       u8 pcm_running;
-       u8 dac_routing;
-       u8 spdif_playback_enable;
-       u8 revision;
-       u8 has_ac97_0;
-       u8 has_ac97_1;
-       u32 spdif_bits;
-       u32 spdif_pcm_bits;
-       struct snd_pcm_substream *streams[PCM_COUNT];
-       struct snd_kcontrol *controls[CONTROL_COUNT];
-       struct work_struct spdif_input_bits_work;
-       struct work_struct gpio_work;
-       wait_queue_head_t ac97_waitqueue;
-       union {
-               u8 _8[OXYGEN_IO_SIZE];
-               __le16 _16[OXYGEN_IO_SIZE / 2];
-               __le32 _32[OXYGEN_IO_SIZE / 4];
-       } saved_registers;
-       u16 saved_ac97_registers[2][0x40];
-};
+struct oxygen;
 
 struct oxygen_model {
        const char *shortname;
@@ -122,6 +87,41 @@ struct oxygen_model {
        u16 adc_i2s_format;
 };
 
+struct oxygen {
+       unsigned long addr;
+       spinlock_t reg_lock;
+       struct mutex mutex;
+       struct snd_card *card;
+       struct pci_dev *pci;
+       struct snd_rawmidi *midi;
+       int irq;
+       void *model_data;
+       unsigned int interrupt_mask;
+       u8 dac_volume[8];
+       u8 dac_mute;
+       u8 pcm_active;
+       u8 pcm_running;
+       u8 dac_routing;
+       u8 spdif_playback_enable;
+       u8 revision;
+       u8 has_ac97_0;
+       u8 has_ac97_1;
+       u32 spdif_bits;
+       u32 spdif_pcm_bits;
+       struct snd_pcm_substream *streams[PCM_COUNT];
+       struct snd_kcontrol *controls[CONTROL_COUNT];
+       struct work_struct spdif_input_bits_work;
+       struct work_struct gpio_work;
+       wait_queue_head_t ac97_waitqueue;
+       union {
+               u8 _8[OXYGEN_IO_SIZE];
+               __le16 _16[OXYGEN_IO_SIZE / 2];
+               __le32 _32[OXYGEN_IO_SIZE / 4];
+       } saved_registers;
+       u16 saved_ac97_registers[2][0x40];
+       struct oxygen_model model;
+};
+
 /* oxygen_lib.c */
 
 int oxygen_pci_probe(struct pci_dev *pci, int index, char *id,
index 22f3785..07b0563 100644 (file)
@@ -161,8 +161,8 @@ static void oxygen_gpio_changed(struct work_struct *work)
 {
        struct oxygen *chip = container_of(work, struct oxygen, gpio_work);
 
-       if (chip->model->gpio_changed)
-               chip->model->gpio_changed(chip);
+       if (chip->model.gpio_changed)
+               chip->model.gpio_changed(chip);
 }
 
 #ifdef CONFIG_PROC_FS
@@ -221,7 +221,7 @@ static void oxygen_init(struct oxygen *chip)
 
        chip->dac_routing = 1;
        for (i = 0; i < 8; ++i)
-               chip->dac_volume[i] = chip->model->dac_volume_min;
+               chip->dac_volume[i] = chip->model.dac_volume_min;
        chip->dac_mute = 1;
        chip->spdif_playback_enable = 1;
        chip->spdif_bits = OXYGEN_SPDIF_C | OXYGEN_SPDIF_ORIGINAL |
@@ -243,7 +243,7 @@ static void oxygen_init(struct oxygen *chip)
 
        oxygen_write8_masked(chip, OXYGEN_FUNCTION,
                             OXYGEN_FUNCTION_RESET_CODEC |
-                            chip->model->function_flags,
+                            chip->model.function_flags,
                             OXYGEN_FUNCTION_RESET_CODEC |
                             OXYGEN_FUNCTION_2WIRE_SPI_MASK |
                             OXYGEN_FUNCTION_ENABLE_SPI_4_5);
@@ -255,7 +255,7 @@ static void oxygen_init(struct oxygen *chip)
                      OXYGEN_DMA_MULTICH_BURST_8);
        oxygen_write16(chip, OXYGEN_INTERRUPT_MASK, 0);
        oxygen_write8_masked(chip, OXYGEN_MISC,
-                            chip->model->misc_flags,
+                            chip->model.misc_flags,
                             OXYGEN_MISC_WRITE_PCI_SUBID |
                             OXYGEN_MISC_REC_C_FROM_SPDIF |
                             OXYGEN_MISC_REC_B_FROM_AC97 |
@@ -270,21 +270,21 @@ static void oxygen_init(struct oxygen *chip)
                      (OXYGEN_FORMAT_16 << OXYGEN_MULTICH_FORMAT_SHIFT));
        oxygen_write8(chip, OXYGEN_REC_CHANNELS, OXYGEN_REC_CHANNELS_2_2_2);
        oxygen_write16(chip, OXYGEN_I2S_MULTICH_FORMAT,
-                      OXYGEN_RATE_48000 | chip->model->dac_i2s_format |
+                      OXYGEN_RATE_48000 | chip->model.dac_i2s_format |
                       OXYGEN_I2S_MCLK_256 | OXYGEN_I2S_BITS_16 |
                       OXYGEN_I2S_MASTER | OXYGEN_I2S_BCLK_64);
-       if (chip->model->pcm_dev_cfg & CAPTURE_0_FROM_I2S_1)
+       if (chip->model.pcm_dev_cfg & CAPTURE_0_FROM_I2S_1)
                oxygen_write16(chip, OXYGEN_I2S_A_FORMAT,
-                              OXYGEN_RATE_48000 | chip->model->adc_i2s_format |
+                              OXYGEN_RATE_48000 | chip->model.adc_i2s_format |
                               OXYGEN_I2S_MCLK_256 | OXYGEN_I2S_BITS_16 |
                               OXYGEN_I2S_MASTER | OXYGEN_I2S_BCLK_64);
        else
                oxygen_write16(chip, OXYGEN_I2S_A_FORMAT,
                               OXYGEN_I2S_MASTER | OXYGEN_I2S_MUTE_MCLK);
-       if (chip->model->pcm_dev_cfg & (CAPTURE_0_FROM_I2S_2 |
-                                       CAPTURE_2_FROM_I2S_2))
+       if (chip->model.pcm_dev_cfg & (CAPTURE_0_FROM_I2S_2 |
+                                      CAPTURE_2_FROM_I2S_2))
                oxygen_write16(chip, OXYGEN_I2S_B_FORMAT,
-                              OXYGEN_RATE_48000 | chip->model->adc_i2s_format |
+                              OXYGEN_RATE_48000 | chip->model.adc_i2s_format |
                               OXYGEN_I2S_MCLK_256 | OXYGEN_I2S_BITS_16 |
                               OXYGEN_I2S_MASTER | OXYGEN_I2S_BCLK_64);
        else
@@ -295,7 +295,7 @@ static void oxygen_init(struct oxygen *chip)
        oxygen_clear_bits32(chip, OXYGEN_SPDIF_CONTROL,
                            OXYGEN_SPDIF_OUT_ENABLE |
                            OXYGEN_SPDIF_LOOPBACK);
-       if (chip->model->pcm_dev_cfg & CAPTURE_1_FROM_SPDIF)
+       if (chip->model.pcm_dev_cfg & CAPTURE_1_FROM_SPDIF)
                oxygen_write32_masked(chip, OXYGEN_SPDIF_CONTROL,
                                      OXYGEN_SPDIF_SENSE_MASK |
                                      OXYGEN_SPDIF_LOCK_MASK |
@@ -417,7 +417,7 @@ static void oxygen_card_free(struct snd_card *card)
        if (chip->irq >= 0)
                free_irq(chip->irq, chip);
        flush_scheduled_work();
-       chip->model->cleanup(chip);
+       chip->model.cleanup(chip);
        mutex_destroy(&chip->mutex);
        pci_release_regions(chip->pci);
        pci_disable_device(chip->pci);
@@ -439,7 +439,7 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id,
        chip->card = card;
        chip->pci = pci;
        chip->irq = -1;
-       chip->model = model;
+       chip->model = *model;
        chip->model_data = chip + 1;
        spin_lock_init(&chip->reg_lock);
        mutex_init(&chip->mutex);
@@ -471,22 +471,22 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id,
        card->private_free = oxygen_card_free;
 
        oxygen_init(chip);
-       model->init(chip);
+       chip->model.init(chip);
 
        err = request_irq(pci->irq, oxygen_interrupt, IRQF_SHARED,
-                         model->chip, chip);
+                         chip->model.chip, chip);
        if (err < 0) {
                snd_printk(KERN_ERR "cannot grab interrupt %d\n", pci->irq);
                goto err_card;
        }
        chip->irq = pci->irq;
 
-       strcpy(card->driver, model->chip);
-       strcpy(card->shortname, model->shortname);
+       strcpy(card->driver, chip->model.chip);
+       strcpy(card->shortname, chip->model.shortname);
        sprintf(card->longname, "%s (rev %u) at %#lx, irq %i",
-               model->longname, chip->revision, chip->addr, chip->irq);
-       strcpy(card->mixername, model->chip);
-       snd_component_add(card, model->chip);
+               chip->model.longname, chip->revision, chip->addr, chip->irq);
+       strcpy(card->mixername, chip->model.chip);
+       snd_component_add(card, chip->model.chip);
 
        err = oxygen_pcm_init(chip);
        if (err < 0)
@@ -496,7 +496,7 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id,
        if (err < 0)
                goto err_card;
 
-       if (model->misc_flags & OXYGEN_MISC_MIDI) {
+       if (chip->model.misc_flags & OXYGEN_MISC_MIDI) {
                err = snd_mpu401_uart_new(card, 0, MPU401_HW_CMIPCI,
                                          chip->addr + OXYGEN_MPU401,
                                          MPU401_INFO_INTEGRATED, 0, 0,
@@ -508,7 +508,7 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id,
        oxygen_proc_init(chip);
 
        spin_lock_irq(&chip->reg_lock);
-       if (chip->model->pcm_dev_cfg & CAPTURE_1_FROM_SPDIF)
+       if (chip->model.pcm_dev_cfg & CAPTURE_1_FROM_SPDIF)
                chip->interrupt_mask |= OXYGEN_INT_SPDIF_IN_DETECT;
        if (chip->has_ac97_0 | chip->has_ac97_1)
                chip->interrupt_mask |= OXYGEN_INT_AC97;
@@ -552,8 +552,8 @@ int oxygen_pci_suspend(struct pci_dev *pci, pm_message_t state)
                if (chip->streams[i])
                        snd_pcm_suspend(chip->streams[i]);
 
-       if (chip->model->suspend)
-               chip->model->suspend(chip);
+       if (chip->model.suspend)
+               chip->model.suspend(chip);
 
        spin_lock_irq(&chip->reg_lock);
        saved_interrupt_mask = chip->interrupt_mask;
@@ -624,8 +624,8 @@ int oxygen_pci_resume(struct pci_dev *pci)
        if (chip->has_ac97_1)
                oxygen_restore_ac97(chip, 1);
 
-       if (chip->model->resume)
-               chip->model->resume(chip);
+       if (chip->model.resume)
+               chip->model.resume(chip);
 
        oxygen_write16(chip, OXYGEN_INTERRUPT_MASK, chip->interrupt_mask);
 
index 99c422c..b7226b6 100644 (file)
@@ -31,9 +31,9 @@ static int dac_volume_info(struct snd_kcontrol *ctl,
        struct oxygen *chip = ctl->private_data;
 
        info->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
-       info->count = chip->model->dac_channels;
-       info->value.integer.min = chip->model->dac_volume_min;
-       info->value.integer.max = chip->model->dac_volume_max;
+       info->count = chip->model.dac_channels;
+       info->value.integer.min = chip->model.dac_volume_min;
+       info->value.integer.max = chip->model.dac_volume_max;
        return 0;
 }
 
@@ -44,7 +44,7 @@ static int dac_volume_get(struct snd_kcontrol *ctl,
        unsigned int i;
 
        mutex_lock(&chip->mutex);
-       for (i = 0; i < chip->model->dac_channels; ++i)
+       for (i = 0; i < chip->model.dac_channels; ++i)
                value->value.integer.value[i] = chip->dac_volume[i];
        mutex_unlock(&chip->mutex);
        return 0;
@@ -59,13 +59,13 @@ static int dac_volume_put(struct snd_kcontrol *ctl,
 
        changed = 0;
        mutex_lock(&chip->mutex);
-       for (i = 0; i < chip->model->dac_channels; ++i)
+       for (i = 0; i < chip->model.dac_channels; ++i)
                if (value->value.integer.value[i] != chip->dac_volume[i]) {
                        chip->dac_volume[i] = value->value.integer.value[i];
                        changed = 1;
                }
        if (changed)
-               chip->model->update_dac_volume(chip);
+               chip->model.update_dac_volume(chip);
        mutex_unlock(&chip->mutex);
        return changed;
 }
@@ -91,7 +91,7 @@ static int dac_mute_put(struct snd_kcontrol *ctl,
        changed = !value->value.integer.value[0] != chip->dac_mute;
        if (changed) {
                chip->dac_mute = !value->value.integer.value[0];
-               chip->model->update_dac_mute(chip);
+               chip->model.update_dac_mute(chip);
        }
        mutex_unlock(&chip->mutex);
        return changed;
@@ -103,7 +103,7 @@ static int upmix_info(struct snd_kcontrol *ctl, struct snd_ctl_elem_info *info)
                "Front", "Front+Surround", "Front+Surround+Back"
        };
        struct oxygen *chip = ctl->private_data;
-       unsigned int count = 2 + (chip->model->dac_channels == 8);
+       unsigned int count = 2 + (chip->model.dac_channels == 8);
 
        info->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
        info->count = 1;
@@ -172,7 +172,7 @@ void oxygen_update_dac_routing(struct oxygen *chip)
 static int upmix_put(struct snd_kcontrol *ctl, struct snd_ctl_elem_value *value)
 {
        struct oxygen *chip = ctl->private_data;
-       unsigned int count = 2 + (chip->model->dac_channels == 8);
+       unsigned int count = 2 + (chip->model.dac_channels == 8);
        int changed;
 
        mutex_lock(&chip->mutex);
@@ -521,8 +521,8 @@ static void mute_ac97_ctl(struct oxygen *chip, unsigned int control)
        value = oxygen_read_ac97(chip, 0, priv_idx);
        if (!(value & 0x8000)) {
                oxygen_write_ac97(chip, 0, priv_idx, value | 0x8000);
-               if (chip->model->ac97_switch)
-                       chip->model->ac97_switch(chip, priv_idx, 0x8000);
+               if (chip->model.ac97_switch)
+                       chip->model.ac97_switch(chip, priv_idx, 0x8000);
                snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
                               &chip->controls[control]->id);
        }
@@ -549,8 +549,8 @@ static int ac97_switch_put(struct snd_kcontrol *ctl,
        change = newreg != oldreg;
        if (change) {
                oxygen_write_ac97(chip, codec, index, newreg);
-               if (codec == 0 && chip->model->ac97_switch)
-                       chip->model->ac97_switch(chip, index, newreg & 0x8000);
+               if (codec == 0 && chip->model.ac97_switch)
+                       chip->model.ac97_switch(chip, index, newreg & 0x8000);
                if (index == AC97_LINE) {
                        oxygen_write_ac97_masked(chip, 0, CM9780_GPIO_STATUS,
                                                 newreg & 0x8000 ?
@@ -939,16 +939,16 @@ static int add_controls(struct oxygen *chip,
 
        for (i = 0; i < count; ++i) {
                template = controls[i];
-               if (chip->model->control_filter) {
-                       err = chip->model->control_filter(&template);
+               if (chip->model.control_filter) {
+                       err = chip->model.control_filter(&template);
                        if (err < 0)
                                return err;
                        if (err == 1)
                                continue;
                }
                if (!strcmp(template.name, "Master Playback Volume") &&
-                   chip->model->dac_tlv) {
-                       template.tlv.p = chip->model->dac_tlv;
+                   chip->model.dac_tlv) {
+                       template.tlv.p = chip->model.dac_tlv;
                        template.access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ;
                }
                ctl = snd_ctl_new1(&template, chip);
@@ -974,14 +974,14 @@ int oxygen_mixer_init(struct oxygen *chip)
        err = add_controls(chip, controls, ARRAY_SIZE(controls));
        if (err < 0)
                return err;
-       if (chip->model->pcm_dev_cfg & CAPTURE_1_FROM_SPDIF) {
+       if (chip->model.pcm_dev_cfg & CAPTURE_1_FROM_SPDIF) {
                err = add_controls(chip, spdif_input_controls,
                                   ARRAY_SIZE(spdif_input_controls));
                if (err < 0)
                        return err;
        }
        for (i = 0; i < ARRAY_SIZE(monitor_controls); ++i) {
-               if (!(chip->model->pcm_dev_cfg & monitor_controls[i].pcm_dev))
+               if (!(chip->model.pcm_dev_cfg & monitor_controls[i].pcm_dev))
                        continue;
                err = add_controls(chip, monitor_controls[i].controls,
                                   ARRAY_SIZE(monitor_controls[i].controls));
@@ -1000,5 +1000,5 @@ int oxygen_mixer_init(struct oxygen *chip)
                if (err < 0)
                        return err;
        }
-       return chip->model->mixer_init ? chip->model->mixer_init(chip) : 0;
+       return chip->model.mixer_init ? chip->model.mixer_init(chip) : 0;
 }
index c4ad65a..5e8071a 100644 (file)
@@ -129,7 +129,7 @@ static int oxygen_open(struct snd_pcm_substream *substream,
 
        runtime->private_data = (void *)(uintptr_t)channel;
        if (channel == PCM_B && chip->has_ac97_1 &&
-           (chip->model->pcm_dev_cfg & CAPTURE_2_FROM_AC97_1))
+           (chip->model.pcm_dev_cfg & CAPTURE_2_FROM_AC97_1))
                runtime->hw = oxygen_ac97_hardware;
        else
                runtime->hw = *oxygen_hardware[channel];
@@ -140,11 +140,11 @@ static int oxygen_open(struct snd_pcm_substream *substream,
                runtime->hw.rate_min = 44100;
                break;
        case PCM_MULTICH:
-               runtime->hw.channels_max = chip->model->dac_channels;
+               runtime->hw.channels_max = chip->model.dac_channels;
                break;
        }
-       if (chip->model->pcm_hardware_filter)
-               chip->model->pcm_hardware_filter(channel, &runtime->hw);
+       if (chip->model.pcm_hardware_filter)
+               chip->model.pcm_hardware_filter(channel, &runtime->hw);
        err = snd_pcm_hw_constraint_step(runtime, 0,
                                         SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 32);
        if (err < 0)
@@ -355,7 +355,7 @@ static int oxygen_rec_a_hw_params(struct snd_pcm_substream *substream,
        oxygen_write16_masked(chip, OXYGEN_I2S_A_FORMAT,
                              oxygen_rate(hw_params) |
                              oxygen_i2s_mclk(hw_params) |
-                             chip->model->adc_i2s_format |
+                             chip->model.adc_i2s_format |
                              oxygen_i2s_bits(hw_params),
                              OXYGEN_I2S_RATE_MASK |
                              OXYGEN_I2S_FORMAT_MASK |
@@ -364,7 +364,7 @@ static int oxygen_rec_a_hw_params(struct snd_pcm_substream *substream,
        spin_unlock_irq(&chip->reg_lock);
 
        mutex_lock(&chip->mutex);
-       chip->model->set_adc_params(chip, hw_params);
+       chip->model.set_adc_params(chip, hw_params);
        mutex_unlock(&chip->mutex);
        return 0;
 }
@@ -381,7 +381,7 @@ static int oxygen_rec_b_hw_params(struct snd_pcm_substream *substream,
                return err;
 
        is_ac97 = chip->has_ac97_1 &&
-               (chip->model->pcm_dev_cfg & CAPTURE_2_FROM_AC97_1);
+               (chip->model.pcm_dev_cfg & CAPTURE_2_FROM_AC97_1);
 
        spin_lock_irq(&chip->reg_lock);
        oxygen_write8_masked(chip, OXYGEN_REC_FORMAT,
@@ -391,7 +391,7 @@ static int oxygen_rec_b_hw_params(struct snd_pcm_substream *substream,
                oxygen_write16_masked(chip, OXYGEN_I2S_B_FORMAT,
                                      oxygen_rate(hw_params) |
                                      oxygen_i2s_mclk(hw_params) |
-                                     chip->model->adc_i2s_format |
+                                     chip->model.adc_i2s_format |
                                      oxygen_i2s_bits(hw_params),
                                      OXYGEN_I2S_RATE_MASK |
                                      OXYGEN_I2S_FORMAT_MASK |
@@ -401,7 +401,7 @@ static int oxygen_rec_b_hw_params(struct snd_pcm_substream *substream,
 
        if (!is_ac97) {
                mutex_lock(&chip->mutex);
-               chip->model->set_adc_params(chip, hw_params);
+               chip->model.set_adc_params(chip, hw_params);
                mutex_unlock(&chip->mutex);
        }
        return 0;
@@ -468,7 +468,7 @@ static int oxygen_multich_hw_params(struct snd_pcm_substream *substream,
                             OXYGEN_MULTICH_FORMAT_MASK);
        oxygen_write16_masked(chip, OXYGEN_I2S_MULTICH_FORMAT,
                              oxygen_rate(hw_params) |
-                             chip->model->dac_i2s_format |
+                             chip->model.dac_i2s_format |
                              oxygen_i2s_bits(hw_params),
                              OXYGEN_I2S_RATE_MASK |
                              OXYGEN_I2S_FORMAT_MASK |
@@ -478,7 +478,7 @@ static int oxygen_multich_hw_params(struct snd_pcm_substream *substream,
        spin_unlock_irq(&chip->reg_lock);
 
        mutex_lock(&chip->mutex);
-       chip->model->set_dac_params(chip, hw_params);
+       chip->model.set_dac_params(chip, hw_params);
        mutex_unlock(&chip->mutex);
        return 0;
 }
@@ -657,9 +657,9 @@ int oxygen_pcm_init(struct oxygen *chip)
        int outs, ins;
        int err;
 
-       outs = !!(chip->model->pcm_dev_cfg & PLAYBACK_0_TO_I2S);
-       ins = !!(chip->model->pcm_dev_cfg & (CAPTURE_0_FROM_I2S_1 |
-                                            CAPTURE_0_FROM_I2S_2));
+       outs = !!(chip->model.pcm_dev_cfg & PLAYBACK_0_TO_I2S);
+       ins = !!(chip->model.pcm_dev_cfg & (CAPTURE_0_FROM_I2S_1 |
+                                           CAPTURE_0_FROM_I2S_2));
        if (outs | ins) {
                err = snd_pcm_new(chip->card, "Analog", 0, outs, ins, &pcm);
                if (err < 0)
@@ -667,10 +667,10 @@ int oxygen_pcm_init(struct oxygen *chip)
                if (outs)
                        snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,
                                        &oxygen_multich_ops);
-               if (chip->model->pcm_dev_cfg & CAPTURE_0_FROM_I2S_1)
+               if (chip->model.pcm_dev_cfg & CAPTURE_0_FROM_I2S_1)
                        snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
                                        &oxygen_rec_a_ops);
-               else if (chip->model->pcm_dev_cfg & CAPTURE_0_FROM_I2S_2)
+               else if (chip->model.pcm_dev_cfg & CAPTURE_0_FROM_I2S_2)
                        snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
                                        &oxygen_rec_b_ops);
                pcm->private_data = chip;
@@ -690,8 +690,8 @@ int oxygen_pcm_init(struct oxygen *chip)
                                                      BUFFER_BYTES_MAX);
        }
 
-       outs = !!(chip->model->pcm_dev_cfg & PLAYBACK_1_TO_SPDIF);
-       ins = !!(chip->model->pcm_dev_cfg & CAPTURE_1_FROM_SPDIF);
+       outs = !!(chip->model.pcm_dev_cfg & PLAYBACK_1_TO_SPDIF);
+       ins = !!(chip->model.pcm_dev_cfg & CAPTURE_1_FROM_SPDIF);
        if (outs | ins) {
                err = snd_pcm_new(chip->card, "Digital", 1, outs, ins, &pcm);
                if (err < 0)
@@ -712,11 +712,11 @@ int oxygen_pcm_init(struct oxygen *chip)
        }
 
        if (chip->has_ac97_1) {
-               outs = !!(chip->model->pcm_dev_cfg & PLAYBACK_2_TO_AC97_1);
-               ins = !!(chip->model->pcm_dev_cfg & CAPTURE_2_FROM_AC97_1);
+               outs = !!(chip->model.pcm_dev_cfg & PLAYBACK_2_TO_AC97_1);
+               ins = !!(chip->model.pcm_dev_cfg & CAPTURE_2_FROM_AC97_1);
        } else {
                outs = 0;
-               ins = !!(chip->model->pcm_dev_cfg & CAPTURE_2_FROM_I2S_2);
+               ins = !!(chip->model.pcm_dev_cfg & CAPTURE_2_FROM_I2S_2);
        }
        if (outs | ins) {
                err = snd_pcm_new(chip->card, outs ? "AC97" : "Analog2",