diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2008-09-22 02:55:19 -0400 |
---|---|---|
committer | Clemens Ladisch <clemens@ladisch.de> | 2008-09-22 02:55:19 -0400 |
commit | 9bd6a73aef955216816fd6e28f371a868ed073d5 (patch) | |
tree | 4a416d4f4ed5308a83195f47f498b946bfb9062e /sound/pci/oxygen/oxygen_mixer.c | |
parent | 6627bea10e8b31cdedd3a59a311d9ad1e010059a (diff) |
ALSA: oxygen: use a copy of the model struct
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>
Diffstat (limited to 'sound/pci/oxygen/oxygen_mixer.c')
-rw-r--r-- | sound/pci/oxygen/oxygen_mixer.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/sound/pci/oxygen/oxygen_mixer.c b/sound/pci/oxygen/oxygen_mixer.c index 99c422ceb203..b7226b60eab6 100644 --- a/sound/pci/oxygen/oxygen_mixer.c +++ b/sound/pci/oxygen/oxygen_mixer.c | |||
@@ -31,9 +31,9 @@ static int dac_volume_info(struct snd_kcontrol *ctl, | |||
31 | struct oxygen *chip = ctl->private_data; | 31 | struct oxygen *chip = ctl->private_data; |
32 | 32 | ||
33 | info->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 33 | info->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
34 | info->count = chip->model->dac_channels; | 34 | info->count = chip->model.dac_channels; |
35 | info->value.integer.min = chip->model->dac_volume_min; | 35 | info->value.integer.min = chip->model.dac_volume_min; |
36 | info->value.integer.max = chip->model->dac_volume_max; | 36 | info->value.integer.max = chip->model.dac_volume_max; |
37 | return 0; | 37 | return 0; |
38 | } | 38 | } |
39 | 39 | ||
@@ -44,7 +44,7 @@ static int dac_volume_get(struct snd_kcontrol *ctl, | |||
44 | unsigned int i; | 44 | unsigned int i; |
45 | 45 | ||
46 | mutex_lock(&chip->mutex); | 46 | mutex_lock(&chip->mutex); |
47 | for (i = 0; i < chip->model->dac_channels; ++i) | 47 | for (i = 0; i < chip->model.dac_channels; ++i) |
48 | value->value.integer.value[i] = chip->dac_volume[i]; | 48 | value->value.integer.value[i] = chip->dac_volume[i]; |
49 | mutex_unlock(&chip->mutex); | 49 | mutex_unlock(&chip->mutex); |
50 | return 0; | 50 | return 0; |
@@ -59,13 +59,13 @@ static int dac_volume_put(struct snd_kcontrol *ctl, | |||
59 | 59 | ||
60 | changed = 0; | 60 | changed = 0; |
61 | mutex_lock(&chip->mutex); | 61 | mutex_lock(&chip->mutex); |
62 | for (i = 0; i < chip->model->dac_channels; ++i) | 62 | for (i = 0; i < chip->model.dac_channels; ++i) |
63 | if (value->value.integer.value[i] != chip->dac_volume[i]) { | 63 | if (value->value.integer.value[i] != chip->dac_volume[i]) { |
64 | chip->dac_volume[i] = value->value.integer.value[i]; | 64 | chip->dac_volume[i] = value->value.integer.value[i]; |
65 | changed = 1; | 65 | changed = 1; |
66 | } | 66 | } |
67 | if (changed) | 67 | if (changed) |
68 | chip->model->update_dac_volume(chip); | 68 | chip->model.update_dac_volume(chip); |
69 | mutex_unlock(&chip->mutex); | 69 | mutex_unlock(&chip->mutex); |
70 | return changed; | 70 | return changed; |
71 | } | 71 | } |
@@ -91,7 +91,7 @@ static int dac_mute_put(struct snd_kcontrol *ctl, | |||
91 | changed = !value->value.integer.value[0] != chip->dac_mute; | 91 | changed = !value->value.integer.value[0] != chip->dac_mute; |
92 | if (changed) { | 92 | if (changed) { |
93 | chip->dac_mute = !value->value.integer.value[0]; | 93 | chip->dac_mute = !value->value.integer.value[0]; |
94 | chip->model->update_dac_mute(chip); | 94 | chip->model.update_dac_mute(chip); |
95 | } | 95 | } |
96 | mutex_unlock(&chip->mutex); | 96 | mutex_unlock(&chip->mutex); |
97 | return changed; | 97 | return changed; |
@@ -103,7 +103,7 @@ static int upmix_info(struct snd_kcontrol *ctl, struct snd_ctl_elem_info *info) | |||
103 | "Front", "Front+Surround", "Front+Surround+Back" | 103 | "Front", "Front+Surround", "Front+Surround+Back" |
104 | }; | 104 | }; |
105 | struct oxygen *chip = ctl->private_data; | 105 | struct oxygen *chip = ctl->private_data; |
106 | unsigned int count = 2 + (chip->model->dac_channels == 8); | 106 | unsigned int count = 2 + (chip->model.dac_channels == 8); |
107 | 107 | ||
108 | info->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 108 | info->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
109 | info->count = 1; | 109 | info->count = 1; |
@@ -172,7 +172,7 @@ void oxygen_update_dac_routing(struct oxygen *chip) | |||
172 | static int upmix_put(struct snd_kcontrol *ctl, struct snd_ctl_elem_value *value) | 172 | static int upmix_put(struct snd_kcontrol *ctl, struct snd_ctl_elem_value *value) |
173 | { | 173 | { |
174 | struct oxygen *chip = ctl->private_data; | 174 | struct oxygen *chip = ctl->private_data; |
175 | unsigned int count = 2 + (chip->model->dac_channels == 8); | 175 | unsigned int count = 2 + (chip->model.dac_channels == 8); |
176 | int changed; | 176 | int changed; |
177 | 177 | ||
178 | mutex_lock(&chip->mutex); | 178 | mutex_lock(&chip->mutex); |
@@ -521,8 +521,8 @@ static void mute_ac97_ctl(struct oxygen *chip, unsigned int control) | |||
521 | value = oxygen_read_ac97(chip, 0, priv_idx); | 521 | value = oxygen_read_ac97(chip, 0, priv_idx); |
522 | if (!(value & 0x8000)) { | 522 | if (!(value & 0x8000)) { |
523 | oxygen_write_ac97(chip, 0, priv_idx, value | 0x8000); | 523 | oxygen_write_ac97(chip, 0, priv_idx, value | 0x8000); |
524 | if (chip->model->ac97_switch) | 524 | if (chip->model.ac97_switch) |
525 | chip->model->ac97_switch(chip, priv_idx, 0x8000); | 525 | chip->model.ac97_switch(chip, priv_idx, 0x8000); |
526 | snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, | 526 | snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, |
527 | &chip->controls[control]->id); | 527 | &chip->controls[control]->id); |
528 | } | 528 | } |
@@ -549,8 +549,8 @@ static int ac97_switch_put(struct snd_kcontrol *ctl, | |||
549 | change = newreg != oldreg; | 549 | change = newreg != oldreg; |
550 | if (change) { | 550 | if (change) { |
551 | oxygen_write_ac97(chip, codec, index, newreg); | 551 | oxygen_write_ac97(chip, codec, index, newreg); |
552 | if (codec == 0 && chip->model->ac97_switch) | 552 | if (codec == 0 && chip->model.ac97_switch) |
553 | chip->model->ac97_switch(chip, index, newreg & 0x8000); | 553 | chip->model.ac97_switch(chip, index, newreg & 0x8000); |
554 | if (index == AC97_LINE) { | 554 | if (index == AC97_LINE) { |
555 | oxygen_write_ac97_masked(chip, 0, CM9780_GPIO_STATUS, | 555 | oxygen_write_ac97_masked(chip, 0, CM9780_GPIO_STATUS, |
556 | newreg & 0x8000 ? | 556 | newreg & 0x8000 ? |
@@ -939,16 +939,16 @@ static int add_controls(struct oxygen *chip, | |||
939 | 939 | ||
940 | for (i = 0; i < count; ++i) { | 940 | for (i = 0; i < count; ++i) { |
941 | template = controls[i]; | 941 | template = controls[i]; |
942 | if (chip->model->control_filter) { | 942 | if (chip->model.control_filter) { |
943 | err = chip->model->control_filter(&template); | 943 | err = chip->model.control_filter(&template); |
944 | if (err < 0) | 944 | if (err < 0) |
945 | return err; | 945 | return err; |
946 | if (err == 1) | 946 | if (err == 1) |
947 | continue; | 947 | continue; |
948 | } | 948 | } |
949 | if (!strcmp(template.name, "Master Playback Volume") && | 949 | if (!strcmp(template.name, "Master Playback Volume") && |
950 | chip->model->dac_tlv) { | 950 | chip->model.dac_tlv) { |
951 | template.tlv.p = chip->model->dac_tlv; | 951 | template.tlv.p = chip->model.dac_tlv; |
952 | template.access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ; | 952 | template.access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ; |
953 | } | 953 | } |
954 | ctl = snd_ctl_new1(&template, chip); | 954 | ctl = snd_ctl_new1(&template, chip); |
@@ -974,14 +974,14 @@ int oxygen_mixer_init(struct oxygen *chip) | |||
974 | err = add_controls(chip, controls, ARRAY_SIZE(controls)); | 974 | err = add_controls(chip, controls, ARRAY_SIZE(controls)); |
975 | if (err < 0) | 975 | if (err < 0) |
976 | return err; | 976 | return err; |
977 | if (chip->model->pcm_dev_cfg & CAPTURE_1_FROM_SPDIF) { | 977 | if (chip->model.pcm_dev_cfg & CAPTURE_1_FROM_SPDIF) { |
978 | err = add_controls(chip, spdif_input_controls, | 978 | err = add_controls(chip, spdif_input_controls, |
979 | ARRAY_SIZE(spdif_input_controls)); | 979 | ARRAY_SIZE(spdif_input_controls)); |
980 | if (err < 0) | 980 | if (err < 0) |
981 | return err; | 981 | return err; |
982 | } | 982 | } |
983 | for (i = 0; i < ARRAY_SIZE(monitor_controls); ++i) { | 983 | for (i = 0; i < ARRAY_SIZE(monitor_controls); ++i) { |
984 | if (!(chip->model->pcm_dev_cfg & monitor_controls[i].pcm_dev)) | 984 | if (!(chip->model.pcm_dev_cfg & monitor_controls[i].pcm_dev)) |
985 | continue; | 985 | continue; |
986 | err = add_controls(chip, monitor_controls[i].controls, | 986 | err = add_controls(chip, monitor_controls[i].controls, |
987 | ARRAY_SIZE(monitor_controls[i].controls)); | 987 | ARRAY_SIZE(monitor_controls[i].controls)); |
@@ -1000,5 +1000,5 @@ int oxygen_mixer_init(struct oxygen *chip) | |||
1000 | if (err < 0) | 1000 | if (err < 0) |
1001 | return err; | 1001 | return err; |
1002 | } | 1002 | } |
1003 | return chip->model->mixer_init ? chip->model->mixer_init(chip) : 0; | 1003 | return chip->model.mixer_init ? chip->model.mixer_init(chip) : 0; |
1004 | } | 1004 | } |