diff options
Diffstat (limited to 'sound')
33 files changed, 681 insertions, 258 deletions
diff --git a/sound/aoa/codecs/snd-aoa-codec-onyx.c b/sound/aoa/codecs/snd-aoa-codec-onyx.c index b00fc4842c93..7f980be5d060 100644 --- a/sound/aoa/codecs/snd-aoa-codec-onyx.c +++ b/sound/aoa/codecs/snd-aoa-codec-onyx.c | |||
@@ -1062,9 +1062,9 @@ static int onyx_i2c_attach(struct i2c_adapter *adapter) | |||
1062 | 1062 | ||
1063 | while ((dev = of_get_next_child(busnode, dev)) != NULL) { | 1063 | while ((dev = of_get_next_child(busnode, dev)) != NULL) { |
1064 | if (device_is_compatible(dev, "pcm3052")) { | 1064 | if (device_is_compatible(dev, "pcm3052")) { |
1065 | u32 *addr; | 1065 | const u32 *addr; |
1066 | printk(KERN_DEBUG PFX "found pcm3052\n"); | 1066 | printk(KERN_DEBUG PFX "found pcm3052\n"); |
1067 | addr = (u32 *) get_property(dev, "reg", NULL); | 1067 | addr = of_get_property(dev, "reg", NULL); |
1068 | if (!addr) | 1068 | if (!addr) |
1069 | return -ENODEV; | 1069 | return -ENODEV; |
1070 | return onyx_create(adapter, dev, (*addr)>>1); | 1070 | return onyx_create(adapter, dev, (*addr)>>1); |
diff --git a/sound/aoa/codecs/snd-aoa-codec-tas.c b/sound/aoa/codecs/snd-aoa-codec-tas.c index 2cd81fa07ce1..ceca38486eae 100644 --- a/sound/aoa/codecs/snd-aoa-codec-tas.c +++ b/sound/aoa/codecs/snd-aoa-codec-tas.c | |||
@@ -939,9 +939,9 @@ static int tas_i2c_attach(struct i2c_adapter *adapter) | |||
939 | 939 | ||
940 | while ((dev = of_get_next_child(busnode, dev)) != NULL) { | 940 | while ((dev = of_get_next_child(busnode, dev)) != NULL) { |
941 | if (device_is_compatible(dev, "tas3004")) { | 941 | if (device_is_compatible(dev, "tas3004")) { |
942 | u32 *addr; | 942 | const u32 *addr; |
943 | printk(KERN_DEBUG PFX "found tas3004\n"); | 943 | printk(KERN_DEBUG PFX "found tas3004\n"); |
944 | addr = (u32 *) get_property(dev, "reg", NULL); | 944 | addr = of_get_property(dev, "reg", NULL); |
945 | if (!addr) | 945 | if (!addr) |
946 | continue; | 946 | continue; |
947 | return tas_create(adapter, dev, ((*addr) >> 1) & 0x7f); | 947 | return tas_create(adapter, dev, ((*addr) >> 1) & 0x7f); |
@@ -950,9 +950,10 @@ static int tas_i2c_attach(struct i2c_adapter *adapter) | |||
950 | * property that says 'tas3004', they just have a 'deq' | 950 | * property that says 'tas3004', they just have a 'deq' |
951 | * node without any such property... */ | 951 | * node without any such property... */ |
952 | if (strcmp(dev->name, "deq") == 0) { | 952 | if (strcmp(dev->name, "deq") == 0) { |
953 | u32 *_addr, addr; | 953 | const u32 *_addr; |
954 | u32 addr; | ||
954 | printk(KERN_DEBUG PFX "found 'deq' node\n"); | 955 | printk(KERN_DEBUG PFX "found 'deq' node\n"); |
955 | _addr = (u32 *) get_property(dev, "i2c-address", NULL); | 956 | _addr = of_get_property(dev, "i2c-address", NULL); |
956 | if (!_addr) | 957 | if (!_addr) |
957 | continue; | 958 | continue; |
958 | addr = ((*_addr) >> 1) & 0x7f; | 959 | addr = ((*_addr) >> 1) & 0x7f; |
diff --git a/sound/aoa/core/snd-aoa-gpio-feature.c b/sound/aoa/core/snd-aoa-gpio-feature.c index 2b03bc798bcb..805dcbff2257 100644 --- a/sound/aoa/core/snd-aoa-gpio-feature.c +++ b/sound/aoa/core/snd-aoa-gpio-feature.c | |||
@@ -55,7 +55,7 @@ static struct device_node *get_gpio(char *name, | |||
55 | int *gpioactiveptr) | 55 | int *gpioactiveptr) |
56 | { | 56 | { |
57 | struct device_node *np, *gpio; | 57 | struct device_node *np, *gpio; |
58 | u32 *reg; | 58 | const u32 *reg; |
59 | const char *audio_gpio; | 59 | const char *audio_gpio; |
60 | 60 | ||
61 | *gpioptr = -1; | 61 | *gpioptr = -1; |
@@ -71,7 +71,7 @@ static struct device_node *get_gpio(char *name, | |||
71 | if (!gpio) | 71 | if (!gpio) |
72 | return NULL; | 72 | return NULL; |
73 | while ((np = of_get_next_child(gpio, np))) { | 73 | while ((np = of_get_next_child(gpio, np))) { |
74 | audio_gpio = get_property(np, "audio-gpio", NULL); | 74 | audio_gpio = of_get_property(np, "audio-gpio", NULL); |
75 | if (!audio_gpio) | 75 | if (!audio_gpio) |
76 | continue; | 76 | continue; |
77 | if (strcmp(audio_gpio, name) == 0) | 77 | if (strcmp(audio_gpio, name) == 0) |
@@ -84,7 +84,7 @@ static struct device_node *get_gpio(char *name, | |||
84 | return NULL; | 84 | return NULL; |
85 | } | 85 | } |
86 | 86 | ||
87 | reg = (u32 *)get_property(np, "reg", NULL); | 87 | reg = of_get_property(np, "reg", NULL); |
88 | if (!reg) | 88 | if (!reg) |
89 | return NULL; | 89 | return NULL; |
90 | 90 | ||
@@ -96,7 +96,7 @@ static struct device_node *get_gpio(char *name, | |||
96 | if (*gpioptr < 0x50) | 96 | if (*gpioptr < 0x50) |
97 | *gpioptr += 0x50; | 97 | *gpioptr += 0x50; |
98 | 98 | ||
99 | reg = (u32 *)get_property(np, "audio-gpio-active-state", NULL); | 99 | reg = of_get_property(np, "audio-gpio-active-state", NULL); |
100 | if (!reg) | 100 | if (!reg) |
101 | /* Apple seems to default to 1, but | 101 | /* Apple seems to default to 1, but |
102 | * that doesn't seem right at least on most | 102 | * that doesn't seem right at least on most |
diff --git a/sound/aoa/fabrics/snd-aoa-fabric-layout.c b/sound/aoa/fabrics/snd-aoa-fabric-layout.c index 1b94ba6dd279..98806283d1b2 100644 --- a/sound/aoa/fabrics/snd-aoa-fabric-layout.c +++ b/sound/aoa/fabrics/snd-aoa-fabric-layout.c | |||
@@ -724,7 +724,7 @@ static int check_codec(struct aoa_codec *codec, | |||
724 | struct layout_dev *ldev, | 724 | struct layout_dev *ldev, |
725 | struct codec_connect_info *cci) | 725 | struct codec_connect_info *cci) |
726 | { | 726 | { |
727 | u32 *ref; | 727 | const u32 *ref; |
728 | char propname[32]; | 728 | char propname[32]; |
729 | struct codec_connection *cc; | 729 | struct codec_connection *cc; |
730 | 730 | ||
@@ -732,7 +732,7 @@ static int check_codec(struct aoa_codec *codec, | |||
732 | if (codec->node && (strcmp(codec->node->name, "codec") == 0)) { | 732 | if (codec->node && (strcmp(codec->node->name, "codec") == 0)) { |
733 | snprintf(propname, sizeof(propname), | 733 | snprintf(propname, sizeof(propname), |
734 | "platform-%s-codec-ref", codec->name); | 734 | "platform-%s-codec-ref", codec->name); |
735 | ref = (u32*)get_property(ldev->sound, propname, NULL); | 735 | ref = of_get_property(ldev->sound, propname, NULL); |
736 | if (!ref) { | 736 | if (!ref) { |
737 | printk(KERN_INFO "snd-aoa-fabric-layout: " | 737 | printk(KERN_INFO "snd-aoa-fabric-layout: " |
738 | "required property %s not present\n", propname); | 738 | "required property %s not present\n", propname); |
@@ -946,7 +946,7 @@ static struct aoa_fabric layout_fabric = { | |||
946 | static int aoa_fabric_layout_probe(struct soundbus_dev *sdev) | 946 | static int aoa_fabric_layout_probe(struct soundbus_dev *sdev) |
947 | { | 947 | { |
948 | struct device_node *sound = NULL; | 948 | struct device_node *sound = NULL; |
949 | unsigned int *layout_id; | 949 | const unsigned int *layout_id; |
950 | struct layout *layout; | 950 | struct layout *layout; |
951 | struct layout_dev *ldev = NULL; | 951 | struct layout_dev *ldev = NULL; |
952 | int err; | 952 | int err; |
@@ -962,7 +962,7 @@ static int aoa_fabric_layout_probe(struct soundbus_dev *sdev) | |||
962 | } | 962 | } |
963 | if (!sound) return -ENODEV; | 963 | if (!sound) return -ENODEV; |
964 | 964 | ||
965 | layout_id = (unsigned int *) get_property(sound, "layout-id", NULL); | 965 | layout_id = of_get_property(sound, "layout-id", NULL); |
966 | if (!layout_id) | 966 | if (!layout_id) |
967 | goto outnodev; | 967 | goto outnodev; |
968 | printk(KERN_INFO "snd-aoa-fabric-layout: found bus with layout %d\n", | 968 | printk(KERN_INFO "snd-aoa-fabric-layout: found bus with layout %d\n", |
diff --git a/sound/aoa/soundbus/core.c b/sound/aoa/soundbus/core.c index 47b3e3768df0..8b2e9b905cda 100644 --- a/sound/aoa/soundbus/core.c +++ b/sound/aoa/soundbus/core.c | |||
@@ -61,9 +61,9 @@ static int soundbus_uevent(struct device *dev, char **envp, int num_envp, | |||
61 | { | 61 | { |
62 | struct soundbus_dev * soundbus_dev; | 62 | struct soundbus_dev * soundbus_dev; |
63 | struct of_device * of; | 63 | struct of_device * of; |
64 | char *scratch, *compat, *compat2; | 64 | const char *compat; |
65 | int i = 0; | 65 | int retval = 0, i = 0, length = 0; |
66 | int length, cplen, cplen2, seen = 0; | 66 | int cplen, seen = 0; |
67 | 67 | ||
68 | if (!dev) | 68 | if (!dev) |
69 | return -ENODEV; | 69 | return -ENODEV; |
@@ -75,63 +75,47 @@ static int soundbus_uevent(struct device *dev, char **envp, int num_envp, | |||
75 | of = &soundbus_dev->ofdev; | 75 | of = &soundbus_dev->ofdev; |
76 | 76 | ||
77 | /* stuff we want to pass to /sbin/hotplug */ | 77 | /* stuff we want to pass to /sbin/hotplug */ |
78 | envp[i++] = scratch = buffer; | 78 | retval = add_uevent_var(envp, num_envp, &i, |
79 | length = scnprintf (scratch, buffer_size, "OF_NAME=%s", of->node->name); | 79 | buffer, buffer_size, &length, |
80 | ++length; | 80 | "OF_NAME=%s", of->node->name); |
81 | buffer_size -= length; | 81 | if (retval) |
82 | if ((buffer_size <= 0) || (i >= num_envp)) | 82 | return retval; |
83 | return -ENOMEM; | 83 | |
84 | scratch += length; | 84 | retval = add_uevent_var(envp, num_envp, &i, |
85 | 85 | buffer, buffer_size, &length, | |
86 | envp[i++] = scratch; | 86 | "OF_TYPE=%s", of->node->type); |
87 | length = scnprintf (scratch, buffer_size, "OF_TYPE=%s", of->node->type); | 87 | if (retval) |
88 | ++length; | 88 | return retval; |
89 | buffer_size -= length; | ||
90 | if ((buffer_size <= 0) || (i >= num_envp)) | ||
91 | return -ENOMEM; | ||
92 | scratch += length; | ||
93 | 89 | ||
94 | /* Since the compatible field can contain pretty much anything | 90 | /* Since the compatible field can contain pretty much anything |
95 | * it's not really legal to split it out with commas. We split it | 91 | * it's not really legal to split it out with commas. We split it |
96 | * up using a number of environment variables instead. */ | 92 | * up using a number of environment variables instead. */ |
97 | 93 | ||
98 | compat = (char *) get_property(of->node, "compatible", &cplen); | 94 | compat = of_get_property(of->node, "compatible", &cplen); |
99 | compat2 = compat; | ||
100 | cplen2= cplen; | ||
101 | while (compat && cplen > 0) { | 95 | while (compat && cplen > 0) { |
102 | envp[i++] = scratch; | 96 | int tmp = length; |
103 | length = scnprintf (scratch, buffer_size, | 97 | retval = add_uevent_var(envp, num_envp, &i, |
104 | "OF_COMPATIBLE_%d=%s", seen, compat); | 98 | buffer, buffer_size, &length, |
105 | ++length; | 99 | "OF_COMPATIBLE_%d=%s", seen, compat); |
106 | buffer_size -= length; | 100 | if (retval) |
107 | if ((buffer_size <= 0) || (i >= num_envp)) | 101 | return retval; |
108 | return -ENOMEM; | 102 | compat += length - tmp; |
109 | scratch += length; | 103 | cplen -= length - tmp; |
110 | length = strlen (compat) + 1; | 104 | seen += 1; |
111 | compat += length; | ||
112 | cplen -= length; | ||
113 | seen++; | ||
114 | } | 105 | } |
115 | 106 | ||
116 | envp[i++] = scratch; | 107 | retval = add_uevent_var(envp, num_envp, &i, |
117 | length = scnprintf (scratch, buffer_size, "OF_COMPATIBLE_N=%d", seen); | 108 | buffer, buffer_size, &length, |
118 | ++length; | 109 | "OF_COMPATIBLE_N=%d", seen); |
119 | buffer_size -= length; | 110 | if (retval) |
120 | if ((buffer_size <= 0) || (i >= num_envp)) | 111 | return retval; |
121 | return -ENOMEM; | 112 | retval = add_uevent_var(envp, num_envp, &i, |
122 | scratch += length; | 113 | buffer, buffer_size, &length, |
123 | 114 | "MODALIAS=%s", soundbus_dev->modalias); | |
124 | envp[i++] = scratch; | ||
125 | length = scnprintf (scratch, buffer_size, "MODALIAS=%s", | ||
126 | soundbus_dev->modalias); | ||
127 | |||
128 | buffer_size -= length; | ||
129 | if ((buffer_size <= 0) || (i >= num_envp)) | ||
130 | return -ENOMEM; | ||
131 | 115 | ||
132 | envp[i] = NULL; | 116 | envp[i] = NULL; |
133 | 117 | ||
134 | return 0; | 118 | return retval; |
135 | } | 119 | } |
136 | 120 | ||
137 | static int soundbus_device_remove(struct device *dev) | 121 | static int soundbus_device_remove(struct device *dev) |
diff --git a/sound/aoa/soundbus/i2sbus/i2sbus-core.c b/sound/aoa/soundbus/i2sbus/i2sbus-core.c index e36f6aa448d4..79fc4bc09e5e 100644 --- a/sound/aoa/soundbus/i2sbus/i2sbus-core.c +++ b/sound/aoa/soundbus/i2sbus/i2sbus-core.c | |||
@@ -122,7 +122,7 @@ static int i2sbus_get_and_fixup_rsrc(struct device_node *np, int index, | |||
122 | { | 122 | { |
123 | struct device_node *parent; | 123 | struct device_node *parent; |
124 | int pindex, rc = -ENXIO; | 124 | int pindex, rc = -ENXIO; |
125 | u32 *reg; | 125 | const u32 *reg; |
126 | 126 | ||
127 | /* Machines with layout 76 and 36 (K2 based) have a weird device | 127 | /* Machines with layout 76 and 36 (K2 based) have a weird device |
128 | * tree what we need to special case. | 128 | * tree what we need to special case. |
@@ -141,7 +141,7 @@ static int i2sbus_get_and_fixup_rsrc(struct device_node *np, int index, | |||
141 | rc = of_address_to_resource(parent, pindex, res); | 141 | rc = of_address_to_resource(parent, pindex, res); |
142 | if (rc) | 142 | if (rc) |
143 | goto bail; | 143 | goto bail; |
144 | reg = (u32 *)get_property(np, "reg", NULL); | 144 | reg = of_get_property(np, "reg", NULL); |
145 | if (reg == NULL) { | 145 | if (reg == NULL) { |
146 | rc = -ENXIO; | 146 | rc = -ENXIO; |
147 | goto bail; | 147 | goto bail; |
@@ -188,8 +188,8 @@ static int i2sbus_add_dev(struct macio_dev *macio, | |||
188 | } | 188 | } |
189 | } | 189 | } |
190 | if (i == 1) { | 190 | if (i == 1) { |
191 | u32 *layout_id; | 191 | const u32 *layout_id = |
192 | layout_id = (u32*) get_property(sound, "layout-id", NULL); | 192 | of_get_property(sound, "layout-id", NULL); |
193 | if (layout_id) { | 193 | if (layout_id) { |
194 | layout = *layout_id; | 194 | layout = *layout_id; |
195 | snprintf(dev->sound.modalias, 32, | 195 | snprintf(dev->sound.modalias, 32, |
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c index 53675cf4de44..b9eca9f3dd25 100644 --- a/sound/arm/aaci.c +++ b/sound/arm/aaci.c | |||
@@ -65,10 +65,12 @@ static void aaci_ac97_select_codec(struct aaci *aaci, struct snd_ac97 *ac97) | |||
65 | * SI1TxEn, SI2TxEn and SI12TxEn bits are set in the AACI_MAINCR | 65 | * SI1TxEn, SI2TxEn and SI12TxEn bits are set in the AACI_MAINCR |
66 | * register. | 66 | * register. |
67 | */ | 67 | */ |
68 | static void aaci_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short val) | 68 | static void aaci_ac97_write(struct snd_ac97 *ac97, unsigned short reg, |
69 | unsigned short val) | ||
69 | { | 70 | { |
70 | struct aaci *aaci = ac97->private_data; | 71 | struct aaci *aaci = ac97->private_data; |
71 | u32 v; | 72 | u32 v; |
73 | int timeout = 5000; | ||
72 | 74 | ||
73 | if (ac97->num >= 4) | 75 | if (ac97->num >= 4) |
74 | return; | 76 | return; |
@@ -89,7 +91,11 @@ static void aaci_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned | |||
89 | */ | 91 | */ |
90 | do { | 92 | do { |
91 | v = readl(aaci->base + AACI_SLFR); | 93 | v = readl(aaci->base + AACI_SLFR); |
92 | } while (v & (SLFR_1TXB|SLFR_2TXB)); | 94 | } while ((v & (SLFR_1TXB|SLFR_2TXB)) && timeout--); |
95 | |||
96 | if (!timeout) | ||
97 | dev_err(&aaci->dev->dev, | ||
98 | "timeout waiting for write to complete\n"); | ||
93 | 99 | ||
94 | mutex_unlock(&aaci->ac97_sem); | 100 | mutex_unlock(&aaci->ac97_sem); |
95 | } | 101 | } |
@@ -101,6 +107,8 @@ static unsigned short aaci_ac97_read(struct snd_ac97 *ac97, unsigned short reg) | |||
101 | { | 107 | { |
102 | struct aaci *aaci = ac97->private_data; | 108 | struct aaci *aaci = ac97->private_data; |
103 | u32 v; | 109 | u32 v; |
110 | int timeout = 5000; | ||
111 | int retries = 10; | ||
104 | 112 | ||
105 | if (ac97->num >= 4) | 113 | if (ac97->num >= 4) |
106 | return ~0; | 114 | return ~0; |
@@ -119,7 +127,13 @@ static unsigned short aaci_ac97_read(struct snd_ac97 *ac97, unsigned short reg) | |||
119 | */ | 127 | */ |
120 | do { | 128 | do { |
121 | v = readl(aaci->base + AACI_SLFR); | 129 | v = readl(aaci->base + AACI_SLFR); |
122 | } while (v & SLFR_1TXB); | 130 | } while ((v & SLFR_1TXB) && timeout--); |
131 | |||
132 | if (!timeout) { | ||
133 | dev_err(&aaci->dev->dev, "timeout on slot 1 TX busy\n"); | ||
134 | v = ~0; | ||
135 | goto out; | ||
136 | } | ||
123 | 137 | ||
124 | /* | 138 | /* |
125 | * Give the AC'97 codec more than enough time | 139 | * Give the AC'97 codec more than enough time |
@@ -130,21 +144,35 @@ static unsigned short aaci_ac97_read(struct snd_ac97 *ac97, unsigned short reg) | |||
130 | /* | 144 | /* |
131 | * Wait for slot 2 to indicate data. | 145 | * Wait for slot 2 to indicate data. |
132 | */ | 146 | */ |
147 | timeout = 5000; | ||
133 | do { | 148 | do { |
134 | cond_resched(); | 149 | cond_resched(); |
135 | v = readl(aaci->base + AACI_SLFR) & (SLFR_1RXV|SLFR_2RXV); | 150 | v = readl(aaci->base + AACI_SLFR) & (SLFR_1RXV|SLFR_2RXV); |
136 | } while (v != (SLFR_1RXV|SLFR_2RXV)); | 151 | } while ((v != (SLFR_1RXV|SLFR_2RXV)) && timeout--); |
137 | 152 | ||
138 | v = readl(aaci->base + AACI_SL1RX) >> 12; | 153 | if (!timeout) { |
139 | if (v == reg) { | 154 | dev_err(&aaci->dev->dev, "timeout on RX valid\n"); |
140 | v = readl(aaci->base + AACI_SL2RX) >> 4; | ||
141 | } else { | ||
142 | dev_err(&aaci->dev->dev, | ||
143 | "wrong ac97 register read back (%x != %x)\n", | ||
144 | v, reg); | ||
145 | v = ~0; | 155 | v = ~0; |
156 | goto out; | ||
146 | } | 157 | } |
147 | 158 | ||
159 | do { | ||
160 | v = readl(aaci->base + AACI_SL1RX) >> 12; | ||
161 | if (v == reg) { | ||
162 | v = readl(aaci->base + AACI_SL2RX) >> 4; | ||
163 | break; | ||
164 | } else if (--retries) { | ||
165 | dev_warn(&aaci->dev->dev, | ||
166 | "ac97 read back fail. retry\n"); | ||
167 | continue; | ||
168 | } else { | ||
169 | dev_warn(&aaci->dev->dev, | ||
170 | "wrong ac97 register read back (%x != %x)\n", | ||
171 | v, reg); | ||
172 | v = ~0; | ||
173 | } | ||
174 | } while (retries); | ||
175 | out: | ||
148 | mutex_unlock(&aaci->ac97_sem); | 176 | mutex_unlock(&aaci->ac97_sem); |
149 | return v; | 177 | return v; |
150 | } | 178 | } |
@@ -164,10 +192,70 @@ static inline void aaci_chan_wait_ready(struct aaci_runtime *aacirun) | |||
164 | /* | 192 | /* |
165 | * Interrupt support. | 193 | * Interrupt support. |
166 | */ | 194 | */ |
167 | static void aaci_fifo_irq(struct aaci *aaci, u32 mask) | 195 | static void aaci_fifo_irq(struct aaci *aaci, int channel, u32 mask) |
168 | { | 196 | { |
197 | if (mask & ISR_ORINTR) { | ||
198 | dev_warn(&aaci->dev->dev, "RX overrun on chan %d\n", channel); | ||
199 | writel(ICLR_RXOEC1 << channel, aaci->base + AACI_INTCLR); | ||
200 | } | ||
201 | |||
202 | if (mask & ISR_RXTOINTR) { | ||
203 | dev_warn(&aaci->dev->dev, "RX timeout on chan %d\n", channel); | ||
204 | writel(ICLR_RXTOFEC1 << channel, aaci->base + AACI_INTCLR); | ||
205 | } | ||
206 | |||
207 | if (mask & ISR_RXINTR) { | ||
208 | struct aaci_runtime *aacirun = &aaci->capture; | ||
209 | void *ptr; | ||
210 | |||
211 | if (!aacirun->substream || !aacirun->start) { | ||
212 | dev_warn(&aaci->dev->dev, "RX interrupt???"); | ||
213 | writel(0, aacirun->base + AACI_IE); | ||
214 | return; | ||
215 | } | ||
216 | ptr = aacirun->ptr; | ||
217 | |||
218 | do { | ||
219 | unsigned int len = aacirun->fifosz; | ||
220 | u32 val; | ||
221 | |||
222 | if (aacirun->bytes <= 0) { | ||
223 | aacirun->bytes += aacirun->period; | ||
224 | aacirun->ptr = ptr; | ||
225 | spin_unlock(&aaci->lock); | ||
226 | snd_pcm_period_elapsed(aacirun->substream); | ||
227 | spin_lock(&aaci->lock); | ||
228 | } | ||
229 | if (!(aacirun->cr & CR_EN)) | ||
230 | break; | ||
231 | |||
232 | val = readl(aacirun->base + AACI_SR); | ||
233 | if (!(val & SR_RXHF)) | ||
234 | break; | ||
235 | if (!(val & SR_RXFF)) | ||
236 | len >>= 1; | ||
237 | |||
238 | aacirun->bytes -= len; | ||
239 | |||
240 | /* reading 16 bytes at a time */ | ||
241 | for( ; len > 0; len -= 16) { | ||
242 | asm( | ||
243 | "ldmia %1, {r0, r1, r2, r3}\n\t" | ||
244 | "stmia %0!, {r0, r1, r2, r3}" | ||
245 | : "+r" (ptr) | ||
246 | : "r" (aacirun->fifo) | ||
247 | : "r0", "r1", "r2", "r3", "cc"); | ||
248 | |||
249 | if (ptr >= aacirun->end) | ||
250 | ptr = aacirun->start; | ||
251 | } | ||
252 | } while(1); | ||
253 | aacirun->ptr = ptr; | ||
254 | } | ||
255 | |||
169 | if (mask & ISR_URINTR) { | 256 | if (mask & ISR_URINTR) { |
170 | writel(ICLR_TXUEC1, aaci->base + AACI_INTCLR); | 257 | dev_dbg(&aaci->dev->dev, "TX underrun on chan %d\n", channel); |
258 | writel(ICLR_TXUEC1 << channel, aaci->base + AACI_INTCLR); | ||
171 | } | 259 | } |
172 | 260 | ||
173 | if (mask & ISR_TXINTR) { | 261 | if (mask & ISR_TXINTR) { |
@@ -192,7 +280,7 @@ static void aaci_fifo_irq(struct aaci *aaci, u32 mask) | |||
192 | snd_pcm_period_elapsed(aacirun->substream); | 280 | snd_pcm_period_elapsed(aacirun->substream); |
193 | spin_lock(&aaci->lock); | 281 | spin_lock(&aaci->lock); |
194 | } | 282 | } |
195 | if (!(aacirun->cr & TXCR_TXEN)) | 283 | if (!(aacirun->cr & CR_EN)) |
196 | break; | 284 | break; |
197 | 285 | ||
198 | val = readl(aacirun->base + AACI_SR); | 286 | val = readl(aacirun->base + AACI_SR); |
@@ -233,7 +321,7 @@ static irqreturn_t aaci_irq(int irq, void *devid) | |||
233 | u32 m = mask; | 321 | u32 m = mask; |
234 | for (i = 0; i < 4; i++, m >>= 7) { | 322 | for (i = 0; i < 4; i++, m >>= 7) { |
235 | if (m & 0x7f) { | 323 | if (m & 0x7f) { |
236 | aaci_fifo_irq(aaci, m); | 324 | aaci_fifo_irq(aaci, i, m); |
237 | } | 325 | } |
238 | } | 326 | } |
239 | } | 327 | } |
@@ -330,8 +418,9 @@ static struct snd_pcm_hardware aaci_hw_info = { | |||
330 | .periods_max = PAGE_SIZE / 16, | 418 | .periods_max = PAGE_SIZE / 16, |
331 | }; | 419 | }; |
332 | 420 | ||
333 | static int aaci_pcm_open(struct aaci *aaci, struct snd_pcm_substream *substream, | 421 | static int __aaci_pcm_open(struct aaci *aaci, |
334 | struct aaci_runtime *aacirun) | 422 | struct snd_pcm_substream *substream, |
423 | struct aaci_runtime *aacirun) | ||
335 | { | 424 | { |
336 | struct snd_pcm_runtime *runtime = substream->runtime; | 425 | struct snd_pcm_runtime *runtime = substream->runtime; |
337 | int ret; | 426 | int ret; |
@@ -380,7 +469,7 @@ static int aaci_pcm_close(struct snd_pcm_substream *substream) | |||
380 | struct aaci *aaci = substream->private_data; | 469 | struct aaci *aaci = substream->private_data; |
381 | struct aaci_runtime *aacirun = substream->runtime->private_data; | 470 | struct aaci_runtime *aacirun = substream->runtime->private_data; |
382 | 471 | ||
383 | WARN_ON(aacirun->cr & TXCR_TXEN); | 472 | WARN_ON(aacirun->cr & CR_EN); |
384 | 473 | ||
385 | aacirun->substream = NULL; | 474 | aacirun->substream = NULL; |
386 | free_irq(aaci->dev->irq[0], aaci); | 475 | free_irq(aaci->dev->irq[0], aaci); |
@@ -395,7 +484,7 @@ static int aaci_pcm_hw_free(struct snd_pcm_substream *substream) | |||
395 | /* | 484 | /* |
396 | * This must not be called with the device enabled. | 485 | * This must not be called with the device enabled. |
397 | */ | 486 | */ |
398 | WARN_ON(aacirun->cr & TXCR_TXEN); | 487 | WARN_ON(aacirun->cr & CR_EN); |
399 | 488 | ||
400 | if (aacirun->pcm_open) | 489 | if (aacirun->pcm_open) |
401 | snd_ac97_pcm_close(aacirun->pcm); | 490 | snd_ac97_pcm_close(aacirun->pcm); |
@@ -422,9 +511,15 @@ static int aaci_pcm_hw_params(struct snd_pcm_substream *substream, | |||
422 | if (err < 0) | 511 | if (err < 0) |
423 | goto out; | 512 | goto out; |
424 | 513 | ||
425 | err = snd_ac97_pcm_open(aacirun->pcm, params_rate(params), | 514 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
426 | params_channels(params), | 515 | err = snd_ac97_pcm_open(aacirun->pcm, params_rate(params), |
427 | aacirun->pcm->r[0].slots); | 516 | params_channels(params), |
517 | aacirun->pcm->r[0].slots); | ||
518 | else | ||
519 | err = snd_ac97_pcm_open(aacirun->pcm, params_rate(params), | ||
520 | params_channels(params), | ||
521 | aacirun->pcm->r[1].slots); | ||
522 | |||
428 | if (err) | 523 | if (err) |
429 | goto out; | 524 | goto out; |
430 | 525 | ||
@@ -467,9 +562,9 @@ static int aaci_pcm_mmap(struct snd_pcm_substream *substream, struct vm_area_str | |||
467 | * Playback specific ALSA stuff | 562 | * Playback specific ALSA stuff |
468 | */ | 563 | */ |
469 | static const u32 channels_to_txmask[] = { | 564 | static const u32 channels_to_txmask[] = { |
470 | [2] = TXCR_TX3 | TXCR_TX4, | 565 | [2] = CR_SL3 | CR_SL4, |
471 | [4] = TXCR_TX3 | TXCR_TX4 | TXCR_TX7 | TXCR_TX8, | 566 | [4] = CR_SL3 | CR_SL4 | CR_SL7 | CR_SL8, |
472 | [6] = TXCR_TX3 | TXCR_TX4 | TXCR_TX7 | TXCR_TX8 | TXCR_TX6 | TXCR_TX9, | 567 | [6] = CR_SL3 | CR_SL4 | CR_SL7 | CR_SL8 | CR_SL6 | CR_SL9, |
473 | }; | 568 | }; |
474 | 569 | ||
475 | /* | 570 | /* |
@@ -504,7 +599,7 @@ aaci_rule_channels(struct snd_pcm_hw_params *p, struct snd_pcm_hw_rule *rule) | |||
504 | chan_mask); | 599 | chan_mask); |
505 | } | 600 | } |
506 | 601 | ||
507 | static int aaci_pcm_playback_open(struct snd_pcm_substream *substream) | 602 | static int aaci_pcm_open(struct snd_pcm_substream *substream) |
508 | { | 603 | { |
509 | struct aaci *aaci = substream->private_data; | 604 | struct aaci *aaci = substream->private_data; |
510 | int ret; | 605 | int ret; |
@@ -519,7 +614,12 @@ static int aaci_pcm_playback_open(struct snd_pcm_substream *substream) | |||
519 | if (ret) | 614 | if (ret) |
520 | return ret; | 615 | return ret; |
521 | 616 | ||
522 | return aaci_pcm_open(aaci, substream, &aaci->playback); | 617 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
618 | ret = __aaci_pcm_open(aaci, substream, &aaci->playback); | ||
619 | } else { | ||
620 | ret = __aaci_pcm_open(aaci, substream, &aaci->capture); | ||
621 | } | ||
622 | return ret; | ||
523 | } | 623 | } |
524 | 624 | ||
525 | static int aaci_pcm_playback_hw_params(struct snd_pcm_substream *substream, | 625 | static int aaci_pcm_playback_hw_params(struct snd_pcm_substream *substream, |
@@ -540,11 +640,11 @@ static int aaci_pcm_playback_hw_params(struct snd_pcm_substream *substream, | |||
540 | * FIXME: double rate slots? | 640 | * FIXME: double rate slots? |
541 | */ | 641 | */ |
542 | if (ret >= 0) { | 642 | if (ret >= 0) { |
543 | aacirun->cr = TXCR_FEN | TXCR_COMPACT | TXCR_TSZ16; | 643 | aacirun->cr = CR_FEN | CR_COMPACT | CR_SZ16; |
544 | aacirun->cr |= channels_to_txmask[channels]; | 644 | aacirun->cr |= channels_to_txmask[channels]; |
545 | 645 | ||
546 | aacirun->fifosz = aaci->fifosize * 4; | 646 | aacirun->fifosz = aaci->fifosize * 4; |
547 | if (aacirun->cr & TXCR_COMPACT) | 647 | if (aacirun->cr & CR_COMPACT) |
548 | aacirun->fifosz >>= 1; | 648 | aacirun->fifosz >>= 1; |
549 | } | 649 | } |
550 | return ret; | 650 | return ret; |
@@ -557,7 +657,7 @@ static void aaci_pcm_playback_stop(struct aaci_runtime *aacirun) | |||
557 | ie = readl(aacirun->base + AACI_IE); | 657 | ie = readl(aacirun->base + AACI_IE); |
558 | ie &= ~(IE_URIE|IE_TXIE); | 658 | ie &= ~(IE_URIE|IE_TXIE); |
559 | writel(ie, aacirun->base + AACI_IE); | 659 | writel(ie, aacirun->base + AACI_IE); |
560 | aacirun->cr &= ~TXCR_TXEN; | 660 | aacirun->cr &= ~CR_EN; |
561 | aaci_chan_wait_ready(aacirun); | 661 | aaci_chan_wait_ready(aacirun); |
562 | writel(aacirun->cr, aacirun->base + AACI_TXCR); | 662 | writel(aacirun->cr, aacirun->base + AACI_TXCR); |
563 | } | 663 | } |
@@ -567,7 +667,7 @@ static void aaci_pcm_playback_start(struct aaci_runtime *aacirun) | |||
567 | u32 ie; | 667 | u32 ie; |
568 | 668 | ||
569 | aaci_chan_wait_ready(aacirun); | 669 | aaci_chan_wait_ready(aacirun); |
570 | aacirun->cr |= TXCR_TXEN; | 670 | aacirun->cr |= CR_EN; |
571 | 671 | ||
572 | ie = readl(aacirun->base + AACI_IE); | 672 | ie = readl(aacirun->base + AACI_IE); |
573 | ie |= IE_URIE | IE_TXIE; | 673 | ie |= IE_URIE | IE_TXIE; |
@@ -615,7 +715,7 @@ static int aaci_pcm_playback_trigger(struct snd_pcm_substream *substream, int cm | |||
615 | } | 715 | } |
616 | 716 | ||
617 | static struct snd_pcm_ops aaci_playback_ops = { | 717 | static struct snd_pcm_ops aaci_playback_ops = { |
618 | .open = aaci_pcm_playback_open, | 718 | .open = aaci_pcm_open, |
619 | .close = aaci_pcm_close, | 719 | .close = aaci_pcm_close, |
620 | .ioctl = snd_pcm_lib_ioctl, | 720 | .ioctl = snd_pcm_lib_ioctl, |
621 | .hw_params = aaci_pcm_playback_hw_params, | 721 | .hw_params = aaci_pcm_playback_hw_params, |
@@ -626,7 +726,133 @@ static struct snd_pcm_ops aaci_playback_ops = { | |||
626 | .mmap = aaci_pcm_mmap, | 726 | .mmap = aaci_pcm_mmap, |
627 | }; | 727 | }; |
628 | 728 | ||
729 | static int aaci_pcm_capture_hw_params(struct snd_pcm_substream *substream, | ||
730 | struct snd_pcm_hw_params *params) | ||
731 | { | ||
732 | struct aaci *aaci = substream->private_data; | ||
733 | struct aaci_runtime *aacirun = substream->runtime->private_data; | ||
734 | int ret; | ||
735 | |||
736 | ret = aaci_pcm_hw_params(substream, aacirun, params); | ||
737 | |||
738 | if (ret >= 0) { | ||
739 | aacirun->cr = CR_FEN | CR_COMPACT | CR_SZ16; | ||
740 | |||
741 | /* Line in record: slot 3 and 4 */ | ||
742 | aacirun->cr |= CR_SL3 | CR_SL4; | ||
743 | |||
744 | aacirun->fifosz = aaci->fifosize * 4; | ||
745 | |||
746 | if (aacirun->cr & CR_COMPACT) | ||
747 | aacirun->fifosz >>= 1; | ||
748 | } | ||
749 | return ret; | ||
750 | } | ||
751 | |||
752 | static void aaci_pcm_capture_stop(struct aaci_runtime *aacirun) | ||
753 | { | ||
754 | u32 ie; | ||
755 | |||
756 | aaci_chan_wait_ready(aacirun); | ||
757 | |||
758 | ie = readl(aacirun->base + AACI_IE); | ||
759 | ie &= ~(IE_ORIE | IE_RXIE); | ||
760 | writel(ie, aacirun->base+AACI_IE); | ||
761 | |||
762 | aacirun->cr &= ~CR_EN; | ||
763 | |||
764 | writel(aacirun->cr, aacirun->base + AACI_RXCR); | ||
765 | } | ||
766 | |||
767 | static void aaci_pcm_capture_start(struct aaci_runtime *aacirun) | ||
768 | { | ||
769 | u32 ie; | ||
770 | |||
771 | aaci_chan_wait_ready(aacirun); | ||
772 | |||
773 | #ifdef DEBUG | ||
774 | /* RX Timeout value: bits 28:17 in RXCR */ | ||
775 | aacirun->cr |= 0xf << 17; | ||
776 | #endif | ||
777 | |||
778 | aacirun->cr |= CR_EN; | ||
779 | writel(aacirun->cr, aacirun->base + AACI_RXCR); | ||
780 | |||
781 | ie = readl(aacirun->base + AACI_IE); | ||
782 | ie |= IE_ORIE |IE_RXIE; // overrun and rx interrupt -- half full | ||
783 | writel(ie, aacirun->base + AACI_IE); | ||
784 | } | ||
785 | |||
786 | static int aaci_pcm_capture_trigger(struct snd_pcm_substream *substream, int cmd) | ||
787 | { | ||
788 | struct aaci *aaci = substream->private_data; | ||
789 | struct aaci_runtime *aacirun = substream->runtime->private_data; | ||
790 | unsigned long flags; | ||
791 | int ret = 0; | ||
792 | |||
793 | spin_lock_irqsave(&aaci->lock, flags); | ||
794 | |||
795 | switch (cmd) { | ||
796 | case SNDRV_PCM_TRIGGER_START: | ||
797 | aaci_pcm_capture_start(aacirun); | ||
798 | break; | ||
799 | |||
800 | case SNDRV_PCM_TRIGGER_RESUME: | ||
801 | aaci_pcm_capture_start(aacirun); | ||
802 | break; | ||
803 | |||
804 | case SNDRV_PCM_TRIGGER_STOP: | ||
805 | aaci_pcm_capture_stop(aacirun); | ||
806 | break; | ||
807 | |||
808 | case SNDRV_PCM_TRIGGER_SUSPEND: | ||
809 | aaci_pcm_capture_stop(aacirun); | ||
810 | break; | ||
811 | |||
812 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | ||
813 | break; | ||
814 | |||
815 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | ||
816 | break; | ||
817 | |||
818 | default: | ||
819 | ret = -EINVAL; | ||
820 | } | ||
821 | |||
822 | spin_unlock_irqrestore(&aaci->lock, flags); | ||
823 | |||
824 | return ret; | ||
825 | } | ||
629 | 826 | ||
827 | static int aaci_pcm_capture_prepare(struct snd_pcm_substream *substream) | ||
828 | { | ||
829 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
830 | struct aaci *aaci = substream->private_data; | ||
831 | |||
832 | aaci_pcm_prepare(substream); | ||
833 | |||
834 | /* allow changing of sample rate */ | ||
835 | aaci_ac97_write(aaci->ac97, AC97_EXTENDED_STATUS, 0x0001); /* VRA */ | ||
836 | aaci_ac97_write(aaci->ac97, AC97_PCM_LR_ADC_RATE, runtime->rate); | ||
837 | aaci_ac97_write(aaci->ac97, AC97_PCM_MIC_ADC_RATE, runtime->rate); | ||
838 | |||
839 | /* Record select: Mic: 0, Aux: 3, Line: 4 */ | ||
840 | aaci_ac97_write(aaci->ac97, AC97_REC_SEL, 0x0404); | ||
841 | |||
842 | return 0; | ||
843 | } | ||
844 | |||
845 | static struct snd_pcm_ops aaci_capture_ops = { | ||
846 | .open = aaci_pcm_open, | ||
847 | .close = aaci_pcm_close, | ||
848 | .ioctl = snd_pcm_lib_ioctl, | ||
849 | .hw_params = aaci_pcm_capture_hw_params, | ||
850 | .hw_free = aaci_pcm_hw_free, | ||
851 | .prepare = aaci_pcm_capture_prepare, | ||
852 | .trigger = aaci_pcm_capture_trigger, | ||
853 | .pointer = aaci_pcm_pointer, | ||
854 | .mmap = aaci_pcm_mmap, | ||
855 | }; | ||
630 | 856 | ||
631 | /* | 857 | /* |
632 | * Power Management. | 858 | * Power Management. |
@@ -666,7 +892,7 @@ static int aaci_resume(struct amba_device *dev) | |||
666 | 892 | ||
667 | 893 | ||
668 | static struct ac97_pcm ac97_defs[] __devinitdata = { | 894 | static struct ac97_pcm ac97_defs[] __devinitdata = { |
669 | [0] = { /* Front PCM */ | 895 | [0] = { /* Front PCM */ |
670 | .exclusive = 1, | 896 | .exclusive = 1, |
671 | .r = { | 897 | .r = { |
672 | [0] = { | 898 | [0] = { |
@@ -740,6 +966,7 @@ static int __devinit aaci_probe_ac97(struct aaci *aaci) | |||
740 | ret = snd_ac97_mixer(ac97_bus, &ac97_template, &ac97); | 966 | ret = snd_ac97_mixer(ac97_bus, &ac97_template, &ac97); |
741 | if (ret) | 967 | if (ret) |
742 | goto out; | 968 | goto out; |
969 | aaci->ac97 = ac97; | ||
743 | 970 | ||
744 | /* | 971 | /* |
745 | * Disable AC97 PC Beep input on audio codecs. | 972 | * Disable AC97 PC Beep input on audio codecs. |
@@ -752,6 +979,7 @@ static int __devinit aaci_probe_ac97(struct aaci *aaci) | |||
752 | goto out; | 979 | goto out; |
753 | 980 | ||
754 | aaci->playback.pcm = &ac97_bus->pcms[0]; | 981 | aaci->playback.pcm = &ac97_bus->pcms[0]; |
982 | aaci->capture.pcm = &ac97_bus->pcms[1]; | ||
755 | 983 | ||
756 | out: | 984 | out: |
757 | return ret; | 985 | return ret; |
@@ -801,7 +1029,7 @@ static int __devinit aaci_init_pcm(struct aaci *aaci) | |||
801 | struct snd_pcm *pcm; | 1029 | struct snd_pcm *pcm; |
802 | int ret; | 1030 | int ret; |
803 | 1031 | ||
804 | ret = snd_pcm_new(aaci->card, "AACI AC'97", 0, 1, 0, &pcm); | 1032 | ret = snd_pcm_new(aaci->card, "AACI AC'97", 0, 1, 1, &pcm); |
805 | if (ret == 0) { | 1033 | if (ret == 0) { |
806 | aaci->pcm = pcm; | 1034 | aaci->pcm = pcm; |
807 | pcm->private_data = aaci; | 1035 | pcm->private_data = aaci; |
@@ -810,6 +1038,7 @@ static int __devinit aaci_init_pcm(struct aaci *aaci) | |||
810 | strlcpy(pcm->name, DRIVER_NAME, sizeof(pcm->name)); | 1038 | strlcpy(pcm->name, DRIVER_NAME, sizeof(pcm->name)); |
811 | 1039 | ||
812 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &aaci_playback_ops); | 1040 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &aaci_playback_ops); |
1041 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &aaci_capture_ops); | ||
813 | } | 1042 | } |
814 | 1043 | ||
815 | return ret; | 1044 | return ret; |
@@ -817,15 +1046,15 @@ static int __devinit aaci_init_pcm(struct aaci *aaci) | |||
817 | 1046 | ||
818 | static unsigned int __devinit aaci_size_fifo(struct aaci *aaci) | 1047 | static unsigned int __devinit aaci_size_fifo(struct aaci *aaci) |
819 | { | 1048 | { |
820 | void __iomem *base = aaci->base + AACI_CSCH1; | 1049 | struct aaci_runtime *aacirun = &aaci->playback; |
821 | int i; | 1050 | int i; |
822 | 1051 | ||
823 | writel(TXCR_FEN | TXCR_TSZ16 | TXCR_TXEN, base + AACI_TXCR); | 1052 | writel(CR_FEN | CR_SZ16 | CR_EN, aacirun->base + AACI_TXCR); |
824 | 1053 | ||
825 | for (i = 0; !(readl(base + AACI_SR) & SR_TXFF) && i < 4096; i++) | 1054 | for (i = 0; !(readl(aacirun->base + AACI_SR) & SR_TXFF) && i < 4096; i++) |
826 | writel(0, aaci->base + AACI_DR1); | 1055 | writel(0, aacirun->fifo); |
827 | 1056 | ||
828 | writel(0, base + AACI_TXCR); | 1057 | writel(0, aacirun->base + AACI_TXCR); |
829 | 1058 | ||
830 | /* | 1059 | /* |
831 | * Re-initialise the AACI after the FIFO depth test, to | 1060 | * Re-initialise the AACI after the FIFO depth test, to |
@@ -872,6 +1101,12 @@ static int __devinit aaci_probe(struct amba_device *dev, void *id) | |||
872 | aaci->playback.base = aaci->base + AACI_CSCH1; | 1101 | aaci->playback.base = aaci->base + AACI_CSCH1; |
873 | aaci->playback.fifo = aaci->base + AACI_DR1; | 1102 | aaci->playback.fifo = aaci->base + AACI_DR1; |
874 | 1103 | ||
1104 | /* | ||
1105 | * Capture uses AACI channel 0 | ||
1106 | */ | ||
1107 | aaci->capture.base = aaci->base + AACI_CSCH1; | ||
1108 | aaci->capture.fifo = aaci->base + AACI_DR1; | ||
1109 | |||
875 | for (i = 0; i < 4; i++) { | 1110 | for (i = 0; i < 4; i++) { |
876 | void __iomem *base = aaci->base + i * 0x14; | 1111 | void __iomem *base = aaci->base + i * 0x14; |
877 | 1112 | ||
@@ -907,7 +1142,7 @@ static int __devinit aaci_probe(struct amba_device *dev, void *id) | |||
907 | ret = snd_card_register(aaci->card); | 1142 | ret = snd_card_register(aaci->card); |
908 | if (ret == 0) { | 1143 | if (ret == 0) { |
909 | dev_info(&dev->dev, "%s, fifo %d\n", aaci->card->longname, | 1144 | dev_info(&dev->dev, "%s, fifo %d\n", aaci->card->longname, |
910 | aaci->fifosize); | 1145 | aaci->fifosize); |
911 | amba_set_drvdata(dev, aaci->card); | 1146 | amba_set_drvdata(dev, aaci->card); |
912 | return ret; | 1147 | return ret; |
913 | } | 1148 | } |
diff --git a/sound/arm/aaci.h b/sound/arm/aaci.h index 9175ff9ded01..924f69c1c44c 100644 --- a/sound/arm/aaci.h +++ b/sound/arm/aaci.h | |||
@@ -49,27 +49,27 @@ | |||
49 | #define AACI_DR4 0x0f0 /* data read/written fifo 4 */ | 49 | #define AACI_DR4 0x0f0 /* data read/written fifo 4 */ |
50 | 50 | ||
51 | /* | 51 | /* |
52 | * transmit fifo control register. P48 | 52 | * TX/RX fifo control register (CR). P48 |
53 | */ | 53 | */ |
54 | #define TXCR_FEN (1 << 16) /* fifo enable */ | 54 | #define CR_FEN (1 << 16) /* fifo enable */ |
55 | #define TXCR_COMPACT (1 << 15) /* compact mode */ | 55 | #define CR_COMPACT (1 << 15) /* compact mode */ |
56 | #define TXCR_TSZ16 (0 << 13) /* 16 bits */ | 56 | #define CR_SZ16 (0 << 13) /* 16 bits */ |
57 | #define TXCR_TSZ18 (1 << 13) /* 18 bits */ | 57 | #define CR_SZ18 (1 << 13) /* 18 bits */ |
58 | #define TXCR_TSZ20 (2 << 13) /* 20 bits */ | 58 | #define CR_SZ20 (2 << 13) /* 20 bits */ |
59 | #define TXCR_TSZ12 (3 << 13) /* 12 bits */ | 59 | #define CR_SZ12 (3 << 13) /* 12 bits */ |
60 | #define TXCR_TX12 (1 << 12) /* transmits slot 12 */ | 60 | #define CR_SL12 (1 << 12) |
61 | #define TXCR_TX11 (1 << 11) /* transmits slot 12 */ | 61 | #define CR_SL11 (1 << 11) |
62 | #define TXCR_TX10 (1 << 10) /* transmits slot 12 */ | 62 | #define CR_SL10 (1 << 10) |
63 | #define TXCR_TX9 (1 << 9) /* transmits slot 12 */ | 63 | #define CR_SL9 (1 << 9) |
64 | #define TXCR_TX8 (1 << 8) /* transmits slot 12 */ | 64 | #define CR_SL8 (1 << 8) |
65 | #define TXCR_TX7 (1 << 7) /* transmits slot 12 */ | 65 | #define CR_SL7 (1 << 7) |
66 | #define TXCR_TX6 (1 << 6) /* transmits slot 12 */ | 66 | #define CR_SL6 (1 << 6) |
67 | #define TXCR_TX5 (1 << 5) /* transmits slot 12 */ | 67 | #define CR_SL5 (1 << 5) |
68 | #define TXCR_TX4 (1 << 4) /* transmits slot 12 */ | 68 | #define CR_SL4 (1 << 4) |
69 | #define TXCR_TX3 (1 << 3) /* transmits slot 12 */ | 69 | #define CR_SL3 (1 << 3) |
70 | #define TXCR_TX2 (1 << 2) /* transmits slot 12 */ | 70 | #define CR_SL2 (1 << 2) |
71 | #define TXCR_TX1 (1 << 1) /* transmits slot 12 */ | 71 | #define CR_SL1 (1 << 1) |
72 | #define TXCR_TXEN (1 << 0) /* transmit enable */ | 72 | #define CR_EN (1 << 0) /* transmit enable */ |
73 | 73 | ||
74 | /* | 74 | /* |
75 | * status register bits. P49 | 75 | * status register bits. P49 |
@@ -229,6 +229,7 @@ struct aaci { | |||
229 | /* AC'97 */ | 229 | /* AC'97 */ |
230 | struct mutex ac97_sem; | 230 | struct mutex ac97_sem; |
231 | struct snd_ac97_bus *ac97_bus; | 231 | struct snd_ac97_bus *ac97_bus; |
232 | struct snd_ac97 *ac97; | ||
232 | 233 | ||
233 | u32 maincr; | 234 | u32 maincr; |
234 | spinlock_t lock; | 235 | spinlock_t lock; |
diff --git a/sound/oss/dmasound/dmasound_awacs.c b/sound/oss/dmasound/dmasound_awacs.c index 37773b1deea5..730fa1d001a5 100644 --- a/sound/oss/dmasound/dmasound_awacs.c +++ b/sound/oss/dmasound/dmasound_awacs.c | |||
@@ -257,7 +257,7 @@ static volatile struct dbdma_cmd *emergency_dbdma_cmd; | |||
257 | /* | 257 | /* |
258 | * Stuff for restoring after a sleep. | 258 | * Stuff for restoring after a sleep. |
259 | */ | 259 | */ |
260 | static int awacs_sleep_notify(struct pmu_sleep_notifier *self, int when); | 260 | static void awacs_sleep_notify(struct pmu_sleep_notifier *self, int when); |
261 | struct pmu_sleep_notifier awacs_sleep_notifier = { | 261 | struct pmu_sleep_notifier awacs_sleep_notifier = { |
262 | awacs_sleep_notify, SLEEP_LEVEL_SOUND, | 262 | awacs_sleep_notify, SLEEP_LEVEL_SOUND, |
263 | }; | 263 | }; |
@@ -346,36 +346,42 @@ int gpio_headphone_irq; | |||
346 | int | 346 | int |
347 | setup_audio_gpio(const char *name, const char* compatible, int *gpio_addr, int* gpio_pol) | 347 | setup_audio_gpio(const char *name, const char* compatible, int *gpio_addr, int* gpio_pol) |
348 | { | 348 | { |
349 | struct device_node *gpiop; | ||
349 | struct device_node *np; | 350 | struct device_node *np; |
350 | const u32* pp; | 351 | const u32* pp; |
352 | int ret = -ENODEV; | ||
351 | 353 | ||
352 | np = find_devices("gpio"); | 354 | gpiop = of_find_node_by_name(NULL, "gpio"); |
353 | if (!np) | 355 | if (!gpiop) |
354 | return -ENODEV; | 356 | goto done; |
355 | 357 | ||
356 | np = np->child; | 358 | np = of_get_next_child(gpiop, NULL); |
357 | while(np != 0) { | 359 | while(np != 0) { |
358 | if (name) { | 360 | if (name) { |
359 | const char *property = | 361 | const char *property = |
360 | get_property(np,"audio-gpio",NULL); | 362 | of_get_property(np,"audio-gpio",NULL); |
361 | if (property != 0 && strcmp(property,name) == 0) | 363 | if (property != 0 && strcmp(property,name) == 0) |
362 | break; | 364 | break; |
363 | } else if (compatible && device_is_compatible(np, compatible)) | 365 | } else if (compatible && device_is_compatible(np, compatible)) |
364 | break; | 366 | break; |
365 | np = np->sibling; | 367 | np = of_get_next_child(gpiop, np); |
366 | } | 368 | } |
367 | if (!np) | 369 | if (!np) |
368 | return -ENODEV; | 370 | goto done; |
369 | pp = get_property(np, "AAPL,address", NULL); | 371 | pp = of_get_property(np, "AAPL,address", NULL); |
370 | if (!pp) | 372 | if (!pp) |
371 | return -ENODEV; | 373 | goto done; |
372 | *gpio_addr = (*pp) & 0x0000ffff; | 374 | *gpio_addr = (*pp) & 0x0000ffff; |
373 | pp = get_property(np, "audio-gpio-active-state", NULL); | 375 | pp = of_get_property(np, "audio-gpio-active-state", NULL); |
374 | if (pp) | 376 | if (pp) |
375 | *gpio_pol = *pp; | 377 | *gpio_pol = *pp; |
376 | else | 378 | else |
377 | *gpio_pol = 1; | 379 | *gpio_pol = 1; |
378 | return irq_of_parse_and_map(np, 0); | 380 | ret = irq_of_parse_and_map(np, 0); |
381 | done: | ||
382 | of_node_put(np); | ||
383 | of_node_put(gpiop); | ||
384 | return ret; | ||
379 | } | 385 | } |
380 | 386 | ||
381 | static inline void | 387 | static inline void |
@@ -578,7 +584,7 @@ tas_mixer_ioctl(u_int cmd, u_long arg) | |||
578 | } | 584 | } |
579 | 585 | ||
580 | static void __init | 586 | static void __init |
581 | tas_init_frame_rates(unsigned int *prop, unsigned int l) | 587 | tas_init_frame_rates(const unsigned int *prop, unsigned int l) |
582 | { | 588 | { |
583 | int i ; | 589 | int i ; |
584 | if (prop) { | 590 | if (prop) { |
@@ -1419,7 +1425,7 @@ load_awacs(void) | |||
1419 | * Save state when going to sleep, restore it afterwards. | 1425 | * Save state when going to sleep, restore it afterwards. |
1420 | */ | 1426 | */ |
1421 | /* FIXME: sort out disabling/re-enabling of read stuff as well */ | 1427 | /* FIXME: sort out disabling/re-enabling of read stuff as well */ |
1422 | static int awacs_sleep_notify(struct pmu_sleep_notifier *self, int when) | 1428 | static void awacs_sleep_notify(struct pmu_sleep_notifier *self, int when) |
1423 | { | 1429 | { |
1424 | unsigned long flags; | 1430 | unsigned long flags; |
1425 | 1431 | ||
@@ -1548,7 +1554,6 @@ static int awacs_sleep_notify(struct pmu_sleep_notifier *self, int when) | |||
1548 | spin_unlock_irqrestore(&dmasound.lock, flags); | 1554 | spin_unlock_irqrestore(&dmasound.lock, flags); |
1549 | UNLOCK(); | 1555 | UNLOCK(); |
1550 | } | 1556 | } |
1551 | return PBOOK_SLEEP_OK; | ||
1552 | } | 1557 | } |
1553 | #endif /* CONFIG_PM */ | 1558 | #endif /* CONFIG_PM */ |
1554 | 1559 | ||
@@ -2553,32 +2558,33 @@ set_model(void) | |||
2553 | static struct device_node* __init | 2558 | static struct device_node* __init |
2554 | get_snd_io_node(void) | 2559 | get_snd_io_node(void) |
2555 | { | 2560 | { |
2556 | struct device_node *np = NULL; | 2561 | struct device_node *np; |
2557 | 2562 | ||
2558 | /* set up awacs_node for early OF which doesn't have a full set of | 2563 | /* set up awacs_node for early OF which doesn't have a full set of |
2559 | * properties on davbus | 2564 | * properties on davbus |
2560 | */ | 2565 | */ |
2561 | 2566 | awacs_node = of_find_node_by_name(NULL, "awacs"); | |
2562 | awacs_node = find_devices("awacs"); | ||
2563 | if (awacs_node) | 2567 | if (awacs_node) |
2564 | awacs_revision = AWACS_AWACS; | 2568 | awacs_revision = AWACS_AWACS; |
2565 | 2569 | ||
2566 | /* powermac models after 9500 (other than those which use DACA or | 2570 | /* powermac models after 9500 (other than those which use DACA or |
2567 | * Tumbler) have a node called "davbus". | 2571 | * Tumbler) have a node called "davbus". |
2568 | */ | 2572 | */ |
2569 | np = find_devices("davbus"); | 2573 | np = of_find_node_by_name(NULL, "davbus"); |
2570 | /* | 2574 | /* |
2571 | * if we didn't find a davbus device, try 'i2s-a' since | 2575 | * if we didn't find a davbus device, try 'i2s-a' since |
2572 | * this seems to be what iBooks (& Tumbler) have. | 2576 | * this seems to be what iBooks (& Tumbler) have. |
2573 | */ | 2577 | */ |
2574 | if (np == NULL) | 2578 | if (np == NULL) { |
2575 | np = i2s_node = find_devices("i2s-a"); | 2579 | i2s_node = of_find_node_by_name(NULL, "i2s-a"); |
2580 | np = of_node_get(i2s_node); | ||
2581 | } | ||
2576 | 2582 | ||
2577 | /* if we didn't find this - perhaps we are on an early model | 2583 | /* if we didn't find this - perhaps we are on an early model |
2578 | * which _only_ has an 'awacs' node | 2584 | * which _only_ has an 'awacs' node |
2579 | */ | 2585 | */ |
2580 | if (np == NULL && awacs_node) | 2586 | if (np == NULL && awacs_node) |
2581 | np = awacs_node ; | 2587 | np = of_node_get(awacs_node); |
2582 | 2588 | ||
2583 | /* if we failed all these return null - this will cause the | 2589 | /* if we failed all these return null - this will cause the |
2584 | * driver to give up... | 2590 | * driver to give up... |
@@ -2597,9 +2603,9 @@ get_snd_info_node(struct device_node *io) | |||
2597 | { | 2603 | { |
2598 | struct device_node *info; | 2604 | struct device_node *info; |
2599 | 2605 | ||
2600 | info = find_devices("sound"); | 2606 | for_each_node_by_name(info, "sound") |
2601 | while (info && info->parent != io) | 2607 | if (info->parent == io) |
2602 | info = info->next; | 2608 | break; |
2603 | return info; | 2609 | return info; |
2604 | } | 2610 | } |
2605 | 2611 | ||
@@ -2635,11 +2641,17 @@ get_codec_type(struct device_node *info) | |||
2635 | static void __init | 2641 | static void __init |
2636 | get_expansion_type(void) | 2642 | get_expansion_type(void) |
2637 | { | 2643 | { |
2638 | if (find_devices("perch") != NULL) | 2644 | struct device_node *dn; |
2645 | |||
2646 | dn = of_find_node_by_name(NULL, "perch"); | ||
2647 | if (dn != NULL) | ||
2639 | has_perch = 1; | 2648 | has_perch = 1; |
2649 | of_node_put(dn); | ||
2640 | 2650 | ||
2641 | if (find_devices("pb-ziva-pc") != NULL) | 2651 | dn = of_find_node_by_name(NULL, "pb-ziva-pc"); |
2652 | if (dn != NULL) | ||
2642 | has_ziva = 1; | 2653 | has_ziva = 1; |
2654 | of_node_put(dn); | ||
2643 | /* need to work out how we deal with iMac SRS module */ | 2655 | /* need to work out how we deal with iMac SRS module */ |
2644 | } | 2656 | } |
2645 | 2657 | ||
@@ -2652,7 +2664,7 @@ get_expansion_type(void) | |||
2652 | */ | 2664 | */ |
2653 | 2665 | ||
2654 | static void __init | 2666 | static void __init |
2655 | awacs_init_frame_rates(unsigned int *prop, unsigned int l) | 2667 | awacs_init_frame_rates(const unsigned int *prop, unsigned int l) |
2656 | { | 2668 | { |
2657 | int i ; | 2669 | int i ; |
2658 | if (prop) { | 2670 | if (prop) { |
@@ -2675,7 +2687,7 @@ awacs_init_frame_rates(unsigned int *prop, unsigned int l) | |||
2675 | } | 2687 | } |
2676 | 2688 | ||
2677 | static void __init | 2689 | static void __init |
2678 | burgundy_init_frame_rates(unsigned int *prop, unsigned int l) | 2690 | burgundy_init_frame_rates(const unsigned int *prop, unsigned int l) |
2679 | { | 2691 | { |
2680 | int temp[9] ; | 2692 | int temp[9] ; |
2681 | int i = 0 ; | 2693 | int i = 0 ; |
@@ -2701,7 +2713,7 @@ if (i > 1){ | |||
2701 | } | 2713 | } |
2702 | 2714 | ||
2703 | static void __init | 2715 | static void __init |
2704 | daca_init_frame_rates(unsigned int *prop, unsigned int l) | 2716 | daca_init_frame_rates(const unsigned int *prop, unsigned int l) |
2705 | { | 2717 | { |
2706 | int temp[9] ; | 2718 | int temp[9] ; |
2707 | int i = 0 ; | 2719 | int i = 0 ; |
@@ -2728,7 +2740,7 @@ if (i > 1){ | |||
2728 | } | 2740 | } |
2729 | 2741 | ||
2730 | static void __init | 2742 | static void __init |
2731 | init_frame_rates(unsigned int *prop, unsigned int l) | 2743 | init_frame_rates(const unsigned int *prop, unsigned int l) |
2732 | { | 2744 | { |
2733 | switch (awacs_revision) { | 2745 | switch (awacs_revision) { |
2734 | case AWACS_TUMBLER: | 2746 | case AWACS_TUMBLER: |
@@ -2828,7 +2840,7 @@ int __init dmasound_awacs_init(void) | |||
2828 | #ifdef DEBUG_DMASOUND | 2840 | #ifdef DEBUG_DMASOUND |
2829 | printk("dmasound_pmac: couldn't find sound io OF node\n"); | 2841 | printk("dmasound_pmac: couldn't find sound io OF node\n"); |
2830 | #endif | 2842 | #endif |
2831 | return -ENODEV ; | 2843 | goto no_device; |
2832 | } | 2844 | } |
2833 | 2845 | ||
2834 | /* find the OF node that tells us about the sound sub-system | 2846 | /* find the OF node that tells us about the sound sub-system |
@@ -2840,7 +2852,7 @@ printk("dmasound_pmac: couldn't find sound io OF node\n"); | |||
2840 | #ifdef DEBUG_DMASOUND | 2852 | #ifdef DEBUG_DMASOUND |
2841 | printk("dmasound_pmac: couldn't find 'sound' OF node\n"); | 2853 | printk("dmasound_pmac: couldn't find 'sound' OF node\n"); |
2842 | #endif | 2854 | #endif |
2843 | return -ENODEV ; | 2855 | goto no_device; |
2844 | } | 2856 | } |
2845 | } | 2857 | } |
2846 | 2858 | ||
@@ -2849,7 +2861,7 @@ printk("dmasound_pmac: couldn't find 'sound' OF node\n"); | |||
2849 | #ifdef DEBUG_DMASOUND | 2861 | #ifdef DEBUG_DMASOUND |
2850 | printk("dmasound_pmac: couldn't find a Codec we can handle\n"); | 2862 | printk("dmasound_pmac: couldn't find a Codec we can handle\n"); |
2851 | #endif | 2863 | #endif |
2852 | return -ENODEV ; /* we don't know this type of h/w */ | 2864 | goto no_device; /* we don't know this type of h/w */ |
2853 | } | 2865 | } |
2854 | 2866 | ||
2855 | /* set up perch, ziva, SRS or whatever else we have as sound | 2867 | /* set up perch, ziva, SRS or whatever else we have as sound |
@@ -2867,11 +2879,12 @@ printk("dmasound_pmac: couldn't find a Codec we can handle\n"); | |||
2867 | * machines). | 2879 | * machines). |
2868 | */ | 2880 | */ |
2869 | if (awacs_node) { | 2881 | if (awacs_node) { |
2870 | io = awacs_node ; | 2882 | of_node_put(io); |
2883 | io = of_node_get(awacs_node); | ||
2871 | if (of_get_address(io, 2, NULL, NULL) == NULL) { | 2884 | if (of_get_address(io, 2, NULL, NULL) == NULL) { |
2872 | printk("dmasound_pmac: can't use %s\n", | 2885 | printk("dmasound_pmac: can't use %s\n", |
2873 | io->full_name); | 2886 | io->full_name); |
2874 | return -ENODEV; | 2887 | goto no_device; |
2875 | } | 2888 | } |
2876 | } else | 2889 | } else |
2877 | printk("dmasound_pmac: can't use %s\n", io->full_name); | 2890 | printk("dmasound_pmac: can't use %s\n", io->full_name); |
@@ -2882,7 +2895,7 @@ printk("dmasound_pmac: couldn't find a Codec we can handle\n"); | |||
2882 | awacs_rsrc[0].end - awacs_rsrc[0].start + 1, | 2895 | awacs_rsrc[0].end - awacs_rsrc[0].start + 1, |
2883 | " (IO)") == NULL) { | 2896 | " (IO)") == NULL) { |
2884 | printk(KERN_ERR "dmasound: can't request IO resource !\n"); | 2897 | printk(KERN_ERR "dmasound: can't request IO resource !\n"); |
2885 | return -ENODEV; | 2898 | goto no_device; |
2886 | } | 2899 | } |
2887 | if (of_address_to_resource(io, 1, &awacs_rsrc[1]) || | 2900 | if (of_address_to_resource(io, 1, &awacs_rsrc[1]) || |
2888 | request_mem_region(awacs_rsrc[1].start, | 2901 | request_mem_region(awacs_rsrc[1].start, |
@@ -2891,7 +2904,7 @@ printk("dmasound_pmac: couldn't find a Codec we can handle\n"); | |||
2891 | release_mem_region(awacs_rsrc[0].start, | 2904 | release_mem_region(awacs_rsrc[0].start, |
2892 | awacs_rsrc[0].end - awacs_rsrc[0].start + 1); | 2905 | awacs_rsrc[0].end - awacs_rsrc[0].start + 1); |
2893 | printk(KERN_ERR "dmasound: can't request Tx DMA resource !\n"); | 2906 | printk(KERN_ERR "dmasound: can't request Tx DMA resource !\n"); |
2894 | return -ENODEV; | 2907 | goto no_device; |
2895 | } | 2908 | } |
2896 | if (of_address_to_resource(io, 2, &awacs_rsrc[2]) || | 2909 | if (of_address_to_resource(io, 2, &awacs_rsrc[2]) || |
2897 | request_mem_region(awacs_rsrc[2].start, | 2910 | request_mem_region(awacs_rsrc[2].start, |
@@ -2902,7 +2915,7 @@ printk("dmasound_pmac: couldn't find a Codec we can handle\n"); | |||
2902 | release_mem_region(awacs_rsrc[1].start, | 2915 | release_mem_region(awacs_rsrc[1].start, |
2903 | awacs_rsrc[1].end - awacs_rsrc[1].start + 1); | 2916 | awacs_rsrc[1].end - awacs_rsrc[1].start + 1); |
2904 | printk(KERN_ERR "dmasound: can't request Rx DMA resource !\n"); | 2917 | printk(KERN_ERR "dmasound: can't request Rx DMA resource !\n"); |
2905 | return -ENODEV; | 2918 | goto no_device; |
2906 | } | 2919 | } |
2907 | 2920 | ||
2908 | awacs_beep_dev = input_allocate_device(); | 2921 | awacs_beep_dev = input_allocate_device(); |
@@ -2914,7 +2927,7 @@ printk("dmasound_pmac: couldn't find a Codec we can handle\n"); | |||
2914 | release_mem_region(awacs_rsrc[2].start, | 2927 | release_mem_region(awacs_rsrc[2].start, |
2915 | awacs_rsrc[2].end - awacs_rsrc[2].start + 1); | 2928 | awacs_rsrc[2].end - awacs_rsrc[2].start + 1); |
2916 | printk(KERN_ERR "dmasound: can't allocate input device !\n"); | 2929 | printk(KERN_ERR "dmasound: can't allocate input device !\n"); |
2917 | return -ENOMEM; | 2930 | goto no_device; |
2918 | } | 2931 | } |
2919 | 2932 | ||
2920 | awacs_beep_dev->name = "dmasound beeper"; | 2933 | awacs_beep_dev->name = "dmasound beeper"; |
@@ -2942,7 +2955,8 @@ printk("dmasound_pmac: couldn't find a Codec we can handle\n"); | |||
2942 | awacs_rx_irq = irq_of_parse_and_map(io, 2); | 2955 | awacs_rx_irq = irq_of_parse_and_map(io, 2); |
2943 | 2956 | ||
2944 | /* Hack for legacy crap that will be killed someday */ | 2957 | /* Hack for legacy crap that will be killed someday */ |
2945 | awacs_node = io; | 2958 | of_node_put(awacs_node); |
2959 | awacs_node = of_node_get(io); | ||
2946 | 2960 | ||
2947 | /* if we have an awacs or screamer - probe the chip to make | 2961 | /* if we have an awacs or screamer - probe the chip to make |
2948 | * sure we have the right revision. | 2962 | * sure we have the right revision. |
@@ -2973,24 +2987,26 @@ printk("dmasound_pmac: Awacs/Screamer Codec Mfct: %d Rev %d\n", mfg, rev); | |||
2973 | */ | 2987 | */ |
2974 | 2988 | ||
2975 | if (info) { | 2989 | if (info) { |
2976 | unsigned int *prop, l; | 2990 | const unsigned int *prop; |
2991 | unsigned int l; | ||
2977 | 2992 | ||
2978 | sound_device_id = 0; | 2993 | sound_device_id = 0; |
2979 | /* device ID appears post g3 b&w */ | 2994 | /* device ID appears post g3 b&w */ |
2980 | prop = (unsigned int *)get_property(info, "device-id", NULL); | 2995 | prop = of_get_property(info, "device-id", NULL); |
2981 | if (prop != 0) | 2996 | if (prop != 0) |
2982 | sound_device_id = *prop; | 2997 | sound_device_id = *prop; |
2983 | 2998 | ||
2984 | /* look for a property saying what sample rates | 2999 | /* look for a property saying what sample rates |
2985 | are available */ | 3000 | are available */ |
2986 | 3001 | ||
2987 | prop = (unsigned int *)get_property(info, "sample-rates", &l); | 3002 | prop = of_get_property(info, "sample-rates", &l); |
2988 | if (prop == 0) | 3003 | if (prop == 0) |
2989 | prop = (unsigned int *) get_property | 3004 | prop = of_get_property(info, "output-frame-rates", &l); |
2990 | (info, "output-frame-rates", &l); | ||
2991 | 3005 | ||
2992 | /* if it's there use it to set up frame rates */ | 3006 | /* if it's there use it to set up frame rates */ |
2993 | init_frame_rates(prop, l) ; | 3007 | init_frame_rates(prop, l) ; |
3008 | of_node_put(info); | ||
3009 | info = NULL; | ||
2994 | } | 3010 | } |
2995 | 3011 | ||
2996 | if (awacs) | 3012 | if (awacs) |
@@ -3160,7 +3176,16 @@ printk("dmasound_pmac: Awacs/Screamer Codec Mfct: %d Rev %d\n", mfg, rev); | |||
3160 | */ | 3176 | */ |
3161 | input_register_device(awacs_beep_dev); | 3177 | input_register_device(awacs_beep_dev); |
3162 | 3178 | ||
3179 | of_node_put(io); | ||
3180 | |||
3163 | return dmasound_init(); | 3181 | return dmasound_init(); |
3182 | |||
3183 | no_device: | ||
3184 | of_node_put(info); | ||
3185 | of_node_put(awacs_node); | ||
3186 | of_node_put(i2s_node); | ||
3187 | of_node_put(io); | ||
3188 | return -ENODEV ; | ||
3164 | } | 3189 | } |
3165 | 3190 | ||
3166 | static void __exit dmasound_awacs_cleanup(void) | 3191 | static void __exit dmasound_awacs_cleanup(void) |
@@ -3179,6 +3204,8 @@ static void __exit dmasound_awacs_cleanup(void) | |||
3179 | } | 3204 | } |
3180 | dmasound_deinit(); | 3205 | dmasound_deinit(); |
3181 | 3206 | ||
3207 | of_node_put(awacs_node); | ||
3208 | of_node_put(i2s_node); | ||
3182 | } | 3209 | } |
3183 | 3210 | ||
3184 | MODULE_DESCRIPTION("PowerMac built-in audio driver."); | 3211 | MODULE_DESCRIPTION("PowerMac built-in audio driver."); |
diff --git a/sound/oss/dmasound/dmasound_core.c b/sound/oss/dmasound/dmasound_core.c index a0ec886f2aa3..f4056a9c371b 100644 --- a/sound/oss/dmasound/dmasound_core.c +++ b/sound/oss/dmasound/dmasound_core.c | |||
@@ -1346,22 +1346,34 @@ static const struct file_operations sq_fops = | |||
1346 | .ioctl = sq_ioctl, | 1346 | .ioctl = sq_ioctl, |
1347 | .open = sq_open, | 1347 | .open = sq_open, |
1348 | .release = sq_release, | 1348 | .release = sq_release, |
1349 | }; | ||
1350 | |||
1349 | #ifdef HAS_RECORD | 1351 | #ifdef HAS_RECORD |
1350 | .read = NULL /* default to no read for compat mode */ | 1352 | static const struct file_operations sq_fops_record = |
1351 | #endif | 1353 | { |
1354 | .owner = THIS_MODULE, | ||
1355 | .llseek = no_llseek, | ||
1356 | .write = sq_write, | ||
1357 | .poll = sq_poll, | ||
1358 | .ioctl = sq_ioctl, | ||
1359 | .open = sq_open, | ||
1360 | .release = sq_release, | ||
1361 | .read = sq_read, | ||
1352 | }; | 1362 | }; |
1363 | #endif | ||
1353 | 1364 | ||
1354 | static int sq_init(void) | 1365 | static int sq_init(void) |
1355 | { | 1366 | { |
1367 | const struct file_operations *fops = &sq_fops; | ||
1356 | #ifndef MODULE | 1368 | #ifndef MODULE |
1357 | int sq_unit; | 1369 | int sq_unit; |
1358 | #endif | 1370 | #endif |
1359 | 1371 | ||
1360 | #ifdef HAS_RECORD | 1372 | #ifdef HAS_RECORD |
1361 | if (dmasound.mach.record) | 1373 | if (dmasound.mach.record) |
1362 | sq_fops.read = sq_read ; | 1374 | fops = &sq_fops_record; |
1363 | #endif | 1375 | #endif |
1364 | sq_unit = register_sound_dsp(&sq_fops, -1); | 1376 | sq_unit = register_sound_dsp(fops, -1); |
1365 | if (sq_unit < 0) { | 1377 | if (sq_unit < 0) { |
1366 | printk(KERN_ERR "dmasound_core: couldn't register fops\n") ; | 1378 | printk(KERN_ERR "dmasound_core: couldn't register fops\n") ; |
1367 | return sq_unit ; | 1379 | return sq_unit ; |
diff --git a/sound/oss/dmasound/tas_common.c b/sound/oss/dmasound/tas_common.c index 665e85b5562b..b295ef682192 100644 --- a/sound/oss/dmasound/tas_common.c +++ b/sound/oss/dmasound/tas_common.c | |||
@@ -41,7 +41,6 @@ | |||
41 | 41 | ||
42 | static u8 tas_i2c_address = 0x34; | 42 | static u8 tas_i2c_address = 0x34; |
43 | static struct i2c_client *tas_client; | 43 | static struct i2c_client *tas_client; |
44 | static struct device_node* tas_node; | ||
45 | 44 | ||
46 | static int tas_attach_adapter(struct i2c_adapter *); | 45 | static int tas_attach_adapter(struct i2c_adapter *); |
47 | static int tas_detach_client(struct i2c_client *); | 46 | static int tas_detach_client(struct i2c_client *); |
@@ -190,17 +189,18 @@ tas_cleanup(void) | |||
190 | int __init | 189 | int __init |
191 | tas_init(int driver_id, const char *driver_name) | 190 | tas_init(int driver_id, const char *driver_name) |
192 | { | 191 | { |
193 | u32* paddr; | 192 | const u32* paddr; |
193 | struct device_node *tas_node; | ||
194 | 194 | ||
195 | printk(KERN_INFO "tas driver [%s])\n", driver_name); | 195 | printk(KERN_INFO "tas driver [%s])\n", driver_name); |
196 | 196 | ||
197 | #ifndef CONFIG_I2C_POWERMAC | 197 | #ifndef CONFIG_I2C_POWERMAC |
198 | request_module("i2c-powermac"); | 198 | request_module("i2c-powermac"); |
199 | #endif | 199 | #endif |
200 | tas_node = find_devices("deq"); | 200 | tas_node = of_find_node_by_name("deq"); |
201 | if (tas_node == NULL) | 201 | if (tas_node == NULL) |
202 | return -ENODEV; | 202 | return -ENODEV; |
203 | paddr = (u32 *)get_property(tas_node, "i2c-address", NULL); | 203 | paddr = of_get_property(tas_node, "i2c-address", NULL); |
204 | if (paddr) { | 204 | if (paddr) { |
205 | tas_i2c_address = (*paddr) >> 1; | 205 | tas_i2c_address = (*paddr) >> 1; |
206 | printk(KERN_INFO "using i2c address: 0x%x from device-tree\n", | 206 | printk(KERN_INFO "using i2c address: 0x%x from device-tree\n", |
@@ -208,6 +208,7 @@ tas_init(int driver_id, const char *driver_name) | |||
208 | } else | 208 | } else |
209 | printk(KERN_INFO "using i2c address: 0x%x (default)\n", | 209 | printk(KERN_INFO "using i2c address: 0x%x (default)\n", |
210 | tas_i2c_address); | 210 | tas_i2c_address); |
211 | of_node_put(tas_node); | ||
211 | 212 | ||
212 | return i2c_add_driver(&tas_driver); | 213 | return i2c_add_driver(&tas_driver); |
213 | } | 214 | } |
diff --git a/sound/parisc/harmony.c b/sound/parisc/harmony.c index cf603337b321..ff705c63a03a 100644 --- a/sound/parisc/harmony.c +++ b/sound/parisc/harmony.c | |||
@@ -854,7 +854,7 @@ static struct snd_kcontrol_new snd_harmony_controls[] = { | |||
854 | HARMONY_GAIN_HE_SHIFT, 1, 0), | 854 | HARMONY_GAIN_HE_SHIFT, 1, 0), |
855 | }; | 855 | }; |
856 | 856 | ||
857 | static void __init | 857 | static void __devinit |
858 | snd_harmony_mixer_reset(struct snd_harmony *h) | 858 | snd_harmony_mixer_reset(struct snd_harmony *h) |
859 | { | 859 | { |
860 | harmony_mute(h); | 860 | harmony_mute(h); |
@@ -863,7 +863,7 @@ snd_harmony_mixer_reset(struct snd_harmony *h) | |||
863 | harmony_unmute(h); | 863 | harmony_unmute(h); |
864 | } | 864 | } |
865 | 865 | ||
866 | static int __init | 866 | static int __devinit |
867 | snd_harmony_mixer_init(struct snd_harmony *h) | 867 | snd_harmony_mixer_init(struct snd_harmony *h) |
868 | { | 868 | { |
869 | struct snd_card *card = h->card; | 869 | struct snd_card *card = h->card; |
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c index bfc2fed16da3..b188a4df58cb 100644 --- a/sound/pci/ac97/ac97_patch.c +++ b/sound/pci/ac97/ac97_patch.c | |||
@@ -1790,6 +1790,8 @@ static const struct snd_kcontrol_new snd_ac97_ad1981x_jack_sense[] = { | |||
1790 | * (SS vendor << 16 | device) | 1790 | * (SS vendor << 16 | device) |
1791 | */ | 1791 | */ |
1792 | static unsigned int ad1981_jacks_blacklist[] = { | 1792 | static unsigned int ad1981_jacks_blacklist[] = { |
1793 | 0x10140523, /* Thinkpad R40 */ | ||
1794 | 0x10140534, /* Thinkpad X31 */ | ||
1793 | 0x10140537, /* Thinkpad T41p */ | 1795 | 0x10140537, /* Thinkpad T41p */ |
1794 | 0x10140554, /* Thinkpad T42p/R50p */ | 1796 | 0x10140554, /* Thinkpad T42p/R50p */ |
1795 | 0 /* end */ | 1797 | 0 /* end */ |
@@ -1960,9 +1962,11 @@ static int snd_ac97_ad1888_downmix_put(struct snd_kcontrol *kcontrol, struct snd | |||
1960 | static void ad1888_update_jacks(struct snd_ac97 *ac97) | 1962 | static void ad1888_update_jacks(struct snd_ac97 *ac97) |
1961 | { | 1963 | { |
1962 | unsigned short val = 0; | 1964 | unsigned short val = 0; |
1963 | if (! is_shared_linein(ac97)) | 1965 | /* clear LODIS if shared jack is to be used for Surround out */ |
1966 | if (is_shared_linein(ac97)) | ||
1964 | val |= (1 << 12); | 1967 | val |= (1 << 12); |
1965 | if (! is_shared_micin(ac97)) | 1968 | /* clear CLDIS if shared jack is to be used for C/LFE out */ |
1969 | if (is_shared_micin(ac97)) | ||
1966 | val |= (1 << 11); | 1970 | val |= (1 << 11); |
1967 | /* shared Line-In */ | 1971 | /* shared Line-In */ |
1968 | snd_ac97_update_bits(ac97, AC97_AD_MISC, (1 << 11) | (1 << 12), val); | 1972 | snd_ac97_update_bits(ac97, AC97_AD_MISC, (1 << 11) | (1 << 12), val); |
@@ -2134,8 +2138,9 @@ static const struct snd_kcontrol_new snd_ac97_ad1985_controls[] = { | |||
2134 | static void ad1985_update_jacks(struct snd_ac97 *ac97) | 2138 | static void ad1985_update_jacks(struct snd_ac97 *ac97) |
2135 | { | 2139 | { |
2136 | ad1888_update_jacks(ac97); | 2140 | ad1888_update_jacks(ac97); |
2141 | /* clear OMS if shared jack is to be used for C/LFE out */ | ||
2137 | snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 1 << 9, | 2142 | snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 1 << 9, |
2138 | is_shared_micin(ac97) ? 0 : 1 << 9); | 2143 | is_shared_micin(ac97) ? 1 << 9 : 0); |
2139 | } | 2144 | } |
2140 | 2145 | ||
2141 | static int patch_ad1985_specific(struct snd_ac97 *ac97) | 2146 | static int patch_ad1985_specific(struct snd_ac97 *ac97) |
@@ -2416,9 +2421,9 @@ static void ad1986_update_jacks(struct snd_ac97 *ac97) | |||
2416 | unsigned short ser_val; | 2421 | unsigned short ser_val; |
2417 | 2422 | ||
2418 | /* disable SURROUND and CENTER/LFE if not surround mode */ | 2423 | /* disable SURROUND and CENTER/LFE if not surround mode */ |
2419 | if (! is_surround_on(ac97)) | 2424 | if (!is_surround_on(ac97)) |
2420 | misc_val |= AC97_AD1986_SODIS; | 2425 | misc_val |= AC97_AD1986_SODIS; |
2421 | if (! is_clfe_on(ac97)) | 2426 | if (!is_clfe_on(ac97)) |
2422 | misc_val |= AC97_AD1986_CLDIS; | 2427 | misc_val |= AC97_AD1986_CLDIS; |
2423 | 2428 | ||
2424 | /* select line input (default=LINE_IN, SURROUND or MIC_1/2) */ | 2429 | /* select line input (default=LINE_IN, SURROUND or MIC_1/2) */ |
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c index 9327ab2eccb0..ba7fa22b285d 100644 --- a/sound/pci/ali5451/ali5451.c +++ b/sound/pci/ali5451/ali5451.c | |||
@@ -2312,6 +2312,8 @@ static int __devinit snd_ali_create(struct snd_card *card, | |||
2312 | return err; | 2312 | return err; |
2313 | } | 2313 | } |
2314 | 2314 | ||
2315 | snd_card_set_dev(card, &pci->dev); | ||
2316 | |||
2315 | /* initialise synth voices*/ | 2317 | /* initialise synth voices*/ |
2316 | for (i = 0; i < ALI_CHANNELS; i++ ) { | 2318 | for (i = 0; i < ALI_CHANNELS; i++ ) { |
2317 | codec->synth.voices[i].number = i; | 2319 | codec->synth.voices[i].number = i; |
diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c index c3f3da211234..e9b029e1cd6d 100644 --- a/sound/pci/bt87x.c +++ b/sound/pci/bt87x.c | |||
@@ -804,6 +804,7 @@ static struct { | |||
804 | {0x1822, 0x0001}, /* Twinhan VisionPlus DVB-T */ | 804 | {0x1822, 0x0001}, /* Twinhan VisionPlus DVB-T */ |
805 | {0x18ac, 0xd500}, /* DVICO FusionHDTV 5 Lite */ | 805 | {0x18ac, 0xd500}, /* DVICO FusionHDTV 5 Lite */ |
806 | {0x18ac, 0xdb10}, /* DVICO FusionHDTV DVB-T Lite */ | 806 | {0x18ac, 0xdb10}, /* DVICO FusionHDTV DVB-T Lite */ |
807 | {0x18ac, 0xdb11}, /* Ultraview DVB-T Lite */ | ||
807 | {0x270f, 0xfc00}, /* Chaintech Digitop DST-1000 DVB-S */ | 808 | {0x270f, 0xfc00}, /* Chaintech Digitop DST-1000 DVB-S */ |
808 | {0x7063, 0x2000}, /* pcHDTV HD-2000 TV */ | 809 | {0x7063, 0x2000}, /* pcHDTV HD-2000 TV */ |
809 | }; | 810 | }; |
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c index 70face7e1048..7d3c5ee0005c 100644 --- a/sound/pci/cmipci.c +++ b/sound/pci/cmipci.c | |||
@@ -57,7 +57,7 @@ static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | |||
57 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 57 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
58 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */ | 58 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */ |
59 | static long mpu_port[SNDRV_CARDS]; | 59 | static long mpu_port[SNDRV_CARDS]; |
60 | static long fm_port[SNDRV_CARDS]; | 60 | static long fm_port[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)]=1}; |
61 | static int soft_ac3[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)]=1}; | 61 | static int soft_ac3[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)]=1}; |
62 | #ifdef SUPPORT_JOYSTICK | 62 | #ifdef SUPPORT_JOYSTICK |
63 | static int joystick_port[SNDRV_CARDS]; | 63 | static int joystick_port[SNDRV_CARDS]; |
@@ -2779,6 +2779,9 @@ static int __devinit snd_cmipci_create_fm(struct cmipci *cm, long fm_port) | |||
2779 | struct snd_opl3 *opl3; | 2779 | struct snd_opl3 *opl3; |
2780 | int err; | 2780 | int err; |
2781 | 2781 | ||
2782 | if (!fm_port) | ||
2783 | goto disable_fm; | ||
2784 | |||
2782 | /* first try FM regs in PCI port range */ | 2785 | /* first try FM regs in PCI port range */ |
2783 | iosynth = cm->iobase + CM_REG_FM_PCI; | 2786 | iosynth = cm->iobase + CM_REG_FM_PCI; |
2784 | err = snd_opl3_create(cm->card, iosynth, iosynth + 2, | 2787 | err = snd_opl3_create(cm->card, iosynth, iosynth + 2, |
@@ -2793,7 +2796,7 @@ static int __devinit snd_cmipci_create_fm(struct cmipci *cm, long fm_port) | |||
2793 | case 0x3C8: val |= CM_FMSEL_3C8; break; | 2796 | case 0x3C8: val |= CM_FMSEL_3C8; break; |
2794 | case 0x388: val |= CM_FMSEL_388; break; | 2797 | case 0x388: val |= CM_FMSEL_388; break; |
2795 | default: | 2798 | default: |
2796 | return 0; | 2799 | goto disable_fm; |
2797 | } | 2800 | } |
2798 | snd_cmipci_write(cm, CM_REG_LEGACY_CTRL, val); | 2801 | snd_cmipci_write(cm, CM_REG_LEGACY_CTRL, val); |
2799 | /* enable FM */ | 2802 | /* enable FM */ |
@@ -2803,11 +2806,7 @@ static int __devinit snd_cmipci_create_fm(struct cmipci *cm, long fm_port) | |||
2803 | OPL3_HW_OPL3, 0, &opl3) < 0) { | 2806 | OPL3_HW_OPL3, 0, &opl3) < 0) { |
2804 | printk(KERN_ERR "cmipci: no OPL device at %#lx, " | 2807 | printk(KERN_ERR "cmipci: no OPL device at %#lx, " |
2805 | "skipping...\n", iosynth); | 2808 | "skipping...\n", iosynth); |
2806 | /* disable FM */ | 2809 | goto disable_fm; |
2807 | snd_cmipci_write(cm, CM_REG_LEGACY_CTRL, | ||
2808 | val & ~CM_FMSEL_MASK); | ||
2809 | snd_cmipci_clear_bit(cm, CM_REG_MISC_CTRL, CM_FM_EN); | ||
2810 | return 0; | ||
2811 | } | 2810 | } |
2812 | } | 2811 | } |
2813 | if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { | 2812 | if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { |
@@ -2815,6 +2814,11 @@ static int __devinit snd_cmipci_create_fm(struct cmipci *cm, long fm_port) | |||
2815 | return err; | 2814 | return err; |
2816 | } | 2815 | } |
2817 | return 0; | 2816 | return 0; |
2817 | |||
2818 | disable_fm: | ||
2819 | snd_cmipci_clear_bit(cm, CM_REG_LEGACY_CTRL, CM_FMSEL_MASK); | ||
2820 | snd_cmipci_clear_bit(cm, CM_REG_MISC_CTRL, CM_FM_EN); | ||
2821 | return 0; | ||
2818 | } | 2822 | } |
2819 | 2823 | ||
2820 | static int __devinit snd_cmipci_create(struct snd_card *card, struct pci_dev *pci, | 2824 | static int __devinit snd_cmipci_create(struct snd_card *card, struct pci_dev *pci, |
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c index 6a428b81dba6..e413da00759b 100644 --- a/sound/pci/echoaudio/echoaudio.c +++ b/sound/pci/echoaudio/echoaudio.c | |||
@@ -2033,6 +2033,8 @@ static int __devinit snd_echo_probe(struct pci_dev *pci, | |||
2033 | if (card == NULL) | 2033 | if (card == NULL) |
2034 | return -ENOMEM; | 2034 | return -ENOMEM; |
2035 | 2035 | ||
2036 | snd_card_set_dev(card, &pci->dev); | ||
2037 | |||
2036 | if ((err = snd_echo_create(card, pci, &chip)) < 0) { | 2038 | if ((err = snd_echo_create(card, pci, &chip)) < 0) { |
2037 | snd_card_free(card); | 2039 | snd_card_free(card); |
2038 | return err; | 2040 | return err; |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index b9a8e238b0a8..1672cace1ae7 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -199,7 +199,6 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 }; | |||
199 | 199 | ||
200 | /* STATESTS int mask: SD2,SD1,SD0 */ | 200 | /* STATESTS int mask: SD2,SD1,SD0 */ |
201 | #define STATESTS_INT_MASK 0x07 | 201 | #define STATESTS_INT_MASK 0x07 |
202 | #define AZX_MAX_CODECS 3 | ||
203 | 202 | ||
204 | /* SD_CTL bits */ | 203 | /* SD_CTL bits */ |
205 | #define SD_CTL_STREAM_RESET 0x01 /* stream reset bit */ | 204 | #define SD_CTL_STREAM_RESET 0x01 /* stream reset bit */ |
@@ -966,6 +965,16 @@ static int azx_setup_controller(struct azx *chip, struct azx_dev *azx_dev) | |||
966 | * Codec initialization | 965 | * Codec initialization |
967 | */ | 966 | */ |
968 | 967 | ||
968 | static unsigned int azx_max_codecs[] __devinitdata = { | ||
969 | [AZX_DRIVER_ICH] = 3, | ||
970 | [AZX_DRIVER_ATI] = 4, | ||
971 | [AZX_DRIVER_ATIHDMI] = 4, | ||
972 | [AZX_DRIVER_VIA] = 3, /* FIXME: correct? */ | ||
973 | [AZX_DRIVER_SIS] = 3, /* FIXME: correct? */ | ||
974 | [AZX_DRIVER_ULI] = 3, /* FIXME: correct? */ | ||
975 | [AZX_DRIVER_NVIDIA] = 3, /* FIXME: correct? */ | ||
976 | }; | ||
977 | |||
969 | static int __devinit azx_codec_create(struct azx *chip, const char *model) | 978 | static int __devinit azx_codec_create(struct azx *chip, const char *model) |
970 | { | 979 | { |
971 | struct hda_bus_template bus_temp; | 980 | struct hda_bus_template bus_temp; |
@@ -982,7 +991,7 @@ static int __devinit azx_codec_create(struct azx *chip, const char *model) | |||
982 | return err; | 991 | return err; |
983 | 992 | ||
984 | codecs = 0; | 993 | codecs = 0; |
985 | for (c = 0; c < AZX_MAX_CODECS; c++) { | 994 | for (c = 0; c < azx_max_codecs[chip->driver_type]; c++) { |
986 | if ((chip->codec_mask & (1 << c)) & probe_mask) { | 995 | if ((chip->codec_mask & (1 << c)) & probe_mask) { |
987 | err = snd_hda_codec_new(chip->bus, c, NULL); | 996 | err = snd_hda_codec_new(chip->bus, c, NULL); |
988 | if (err < 0) | 997 | if (err < 0) |
@@ -1078,6 +1087,10 @@ static int azx_pcm_open(struct snd_pcm_substream *substream) | |||
1078 | runtime->hw.rates = hinfo->rates; | 1087 | runtime->hw.rates = hinfo->rates; |
1079 | snd_pcm_limit_hw_rates(runtime); | 1088 | snd_pcm_limit_hw_rates(runtime); |
1080 | snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); | 1089 | snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); |
1090 | snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, | ||
1091 | 128); | ||
1092 | snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, | ||
1093 | 128); | ||
1081 | if ((err = hinfo->ops.open(hinfo, apcm->codec, substream)) < 0) { | 1094 | if ((err = hinfo->ops.open(hinfo, apcm->codec, substream)) < 0) { |
1082 | azx_release_device(azx_dev); | 1095 | azx_release_device(azx_dev); |
1083 | mutex_unlock(&chip->open_mutex); | 1096 | mutex_unlock(&chip->open_mutex); |
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 38977bce70e2..f94f1f22889e 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -523,6 +523,7 @@ static struct snd_kcontrol_new ad1986a_mixers[] = { | |||
523 | HDA_CODEC_MUTE("Aux Playback Switch", 0x16, 0x0, HDA_OUTPUT), | 523 | HDA_CODEC_MUTE("Aux Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
524 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), | 524 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), |
525 | HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), | 525 | HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), |
526 | HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT), | ||
526 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x18, 0x0, HDA_OUTPUT), | 527 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x18, 0x0, HDA_OUTPUT), |
527 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x18, 0x0, HDA_OUTPUT), | 528 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
528 | HDA_CODEC_VOLUME("Mono Playback Volume", 0x1e, 0x0, HDA_OUTPUT), | 529 | HDA_CODEC_VOLUME("Mono Playback Volume", 0x1e, 0x0, HDA_OUTPUT), |
@@ -570,6 +571,7 @@ static struct snd_kcontrol_new ad1986a_laptop_mixers[] = { | |||
570 | HDA_CODEC_MUTE("Aux Playback Switch", 0x16, 0x0, HDA_OUTPUT), | 571 | HDA_CODEC_MUTE("Aux Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
571 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), | 572 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), |
572 | HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), | 573 | HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), |
574 | HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT), | ||
573 | /* HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x18, 0x0, HDA_OUTPUT), | 575 | /* HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x18, 0x0, HDA_OUTPUT), |
574 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x18, 0x0, HDA_OUTPUT), | 576 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
575 | HDA_CODEC_VOLUME("Mono Playback Volume", 0x1e, 0x0, HDA_OUTPUT), | 577 | HDA_CODEC_VOLUME("Mono Playback Volume", 0x1e, 0x0, HDA_OUTPUT), |
@@ -658,6 +660,7 @@ static struct snd_kcontrol_new ad1986a_laptop_eapd_mixers[] = { | |||
658 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x17, 0x0, HDA_OUTPUT), | 660 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x17, 0x0, HDA_OUTPUT), |
659 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), | 661 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), |
660 | HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), | 662 | HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), |
663 | HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT), | ||
661 | HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT), | 664 | HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT), |
662 | HDA_CODEC_MUTE("Capture Switch", 0x12, 0x0, HDA_OUTPUT), | 665 | HDA_CODEC_MUTE("Capture Switch", 0x12, 0x0, HDA_OUTPUT), |
663 | { | 666 | { |
@@ -830,12 +833,14 @@ static struct snd_pci_quirk ad1986a_cfg_tbl[] = { | |||
830 | SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS P5", AD1986A_3STACK), | 833 | SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS P5", AD1986A_3STACK), |
831 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS M2N", AD1986A_3STACK), | 834 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS M2N", AD1986A_3STACK), |
832 | SND_PCI_QUIRK(0x1043, 0x8234, "ASUS M2N", AD1986A_3STACK), | 835 | SND_PCI_QUIRK(0x1043, 0x8234, "ASUS M2N", AD1986A_3STACK), |
836 | SND_PCI_QUIRK(0x144d, 0xb03c, "Samsung R55", AD1986A_3STACK), | ||
833 | SND_PCI_QUIRK(0x144d, 0xc01e, "FSC V2060", AD1986A_LAPTOP), | 837 | SND_PCI_QUIRK(0x144d, 0xc01e, "FSC V2060", AD1986A_LAPTOP), |
834 | SND_PCI_QUIRK(0x144d, 0xc023, "Samsung X60", AD1986A_LAPTOP_EAPD), | 838 | SND_PCI_QUIRK(0x144d, 0xc023, "Samsung X60", AD1986A_LAPTOP_EAPD), |
835 | SND_PCI_QUIRK(0x144d, 0xc024, "Samsung R65", AD1986A_LAPTOP_EAPD), | 839 | SND_PCI_QUIRK(0x144d, 0xc024, "Samsung R65", AD1986A_LAPTOP_EAPD), |
836 | SND_PCI_QUIRK(0x144d, 0xc026, "Samsung X11", AD1986A_LAPTOP_EAPD), | 840 | SND_PCI_QUIRK(0x144d, 0xc026, "Samsung X11", AD1986A_LAPTOP_EAPD), |
837 | SND_PCI_QUIRK(0x144d, 0xc504, "Samsung Q35", AD1986A_3STACK), | 841 | SND_PCI_QUIRK(0x144d, 0xc504, "Samsung Q35", AD1986A_3STACK), |
838 | SND_PCI_QUIRK(0x144d, 0xc027, "Samsung Q1", AD1986A_ULTRA), | 842 | SND_PCI_QUIRK(0x144d, 0xc027, "Samsung Q1", AD1986A_ULTRA), |
843 | SND_PCI_QUIRK(0x17aa, 0x1011, "Lenovo M55", AD1986A_LAPTOP), | ||
839 | SND_PCI_QUIRK(0x17aa, 0x1017, "Lenovo A60", AD1986A_3STACK), | 844 | SND_PCI_QUIRK(0x17aa, 0x1017, "Lenovo A60", AD1986A_3STACK), |
840 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo N100", AD1986A_LAPTOP_EAPD), | 845 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo N100", AD1986A_LAPTOP_EAPD), |
841 | SND_PCI_QUIRK(0x17c0, 0x2017, "Samsung M50", AD1986A_LAPTOP), | 846 | SND_PCI_QUIRK(0x17c0, 0x2017, "Samsung M50", AD1986A_LAPTOP), |
@@ -1202,7 +1207,7 @@ static struct hda_verb ad1981_init_verbs[] = { | |||
1202 | /* | 1207 | /* |
1203 | * Patch for HP nx6320 | 1208 | * Patch for HP nx6320 |
1204 | * | 1209 | * |
1205 | * nx6320 uses EAPD in the reserve way - EAPD-on means the internal | 1210 | * nx6320 uses EAPD in the reverse way - EAPD-on means the internal |
1206 | * speaker output enabled _and_ mute-LED off. | 1211 | * speaker output enabled _and_ mute-LED off. |
1207 | */ | 1212 | */ |
1208 | 1213 | ||
@@ -1370,6 +1375,21 @@ static int ad1981_hp_init(struct hda_codec *codec) | |||
1370 | return 0; | 1375 | return 0; |
1371 | } | 1376 | } |
1372 | 1377 | ||
1378 | /* configuration for Toshiba Laptops */ | ||
1379 | static struct hda_verb ad1981_toshiba_init_verbs[] = { | ||
1380 | {0x05, AC_VERB_SET_EAPD_BTLENABLE, 0x01 }, /* default on */ | ||
1381 | /* pin sensing on HP and Mic jacks */ | ||
1382 | {0x06, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1981_HP_EVENT}, | ||
1383 | {0x08, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1981_MIC_EVENT}, | ||
1384 | {} | ||
1385 | }; | ||
1386 | |||
1387 | static struct snd_kcontrol_new ad1981_toshiba_mixers[] = { | ||
1388 | HDA_CODEC_VOLUME("Amp Volume", 0x1a, 0x0, HDA_OUTPUT), | ||
1389 | HDA_CODEC_MUTE("Amp Switch", 0x1a, 0x0, HDA_OUTPUT), | ||
1390 | { } | ||
1391 | }; | ||
1392 | |||
1373 | /* configuration for Lenovo Thinkpad T60 */ | 1393 | /* configuration for Lenovo Thinkpad T60 */ |
1374 | static struct snd_kcontrol_new ad1981_thinkpad_mixers[] = { | 1394 | static struct snd_kcontrol_new ad1981_thinkpad_mixers[] = { |
1375 | HDA_CODEC_VOLUME("Master Playback Volume", 0x05, 0x0, HDA_OUTPUT), | 1395 | HDA_CODEC_VOLUME("Master Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
@@ -1415,6 +1435,7 @@ enum { | |||
1415 | AD1981_BASIC, | 1435 | AD1981_BASIC, |
1416 | AD1981_HP, | 1436 | AD1981_HP, |
1417 | AD1981_THINKPAD, | 1437 | AD1981_THINKPAD, |
1438 | AD1981_TOSHIBA, | ||
1418 | AD1981_MODELS | 1439 | AD1981_MODELS |
1419 | }; | 1440 | }; |
1420 | 1441 | ||
@@ -1422,6 +1443,7 @@ static const char *ad1981_models[AD1981_MODELS] = { | |||
1422 | [AD1981_HP] = "hp", | 1443 | [AD1981_HP] = "hp", |
1423 | [AD1981_THINKPAD] = "thinkpad", | 1444 | [AD1981_THINKPAD] = "thinkpad", |
1424 | [AD1981_BASIC] = "basic", | 1445 | [AD1981_BASIC] = "basic", |
1446 | [AD1981_TOSHIBA] = "toshiba" | ||
1425 | }; | 1447 | }; |
1426 | 1448 | ||
1427 | static struct snd_pci_quirk ad1981_cfg_tbl[] = { | 1449 | static struct snd_pci_quirk ad1981_cfg_tbl[] = { |
@@ -1432,6 +1454,7 @@ static struct snd_pci_quirk ad1981_cfg_tbl[] = { | |||
1432 | /* Lenovo Thinkpad T60/X60/Z6xx */ | 1454 | /* Lenovo Thinkpad T60/X60/Z6xx */ |
1433 | SND_PCI_QUIRK(0x17aa, 0, "Lenovo Thinkpad", AD1981_THINKPAD), | 1455 | SND_PCI_QUIRK(0x17aa, 0, "Lenovo Thinkpad", AD1981_THINKPAD), |
1434 | SND_PCI_QUIRK(0x1014, 0x0597, "Lenovo Z60", AD1981_THINKPAD), | 1456 | SND_PCI_QUIRK(0x1014, 0x0597, "Lenovo Z60", AD1981_THINKPAD), |
1457 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba U205", AD1981_TOSHIBA), | ||
1435 | {} | 1458 | {} |
1436 | }; | 1459 | }; |
1437 | 1460 | ||
@@ -1482,8 +1505,17 @@ static int patch_ad1981(struct hda_codec *codec) | |||
1482 | spec->mixers[0] = ad1981_thinkpad_mixers; | 1505 | spec->mixers[0] = ad1981_thinkpad_mixers; |
1483 | spec->input_mux = &ad1981_thinkpad_capture_source; | 1506 | spec->input_mux = &ad1981_thinkpad_capture_source; |
1484 | break; | 1507 | break; |
1508 | case AD1981_TOSHIBA: | ||
1509 | spec->mixers[0] = ad1981_hp_mixers; | ||
1510 | spec->mixers[1] = ad1981_toshiba_mixers; | ||
1511 | spec->num_init_verbs = 2; | ||
1512 | spec->init_verbs[1] = ad1981_toshiba_init_verbs; | ||
1513 | spec->multiout.dig_out_nid = 0; | ||
1514 | spec->input_mux = &ad1981_hp_capture_source; | ||
1515 | codec->patch_ops.init = ad1981_hp_init; | ||
1516 | codec->patch_ops.unsol_event = ad1981_hp_unsol_event; | ||
1517 | break; | ||
1485 | } | 1518 | } |
1486 | |||
1487 | return 0; | 1519 | return 0; |
1488 | } | 1520 | } |
1489 | 1521 | ||
@@ -2604,6 +2636,12 @@ static const char *ad1988_models[AD1988_MODEL_LAST] = { | |||
2604 | [AD1988_AUTO] = "auto", | 2636 | [AD1988_AUTO] = "auto", |
2605 | }; | 2637 | }; |
2606 | 2638 | ||
2639 | static struct snd_pci_quirk ad1988_cfg_tbl[] = { | ||
2640 | SND_PCI_QUIRK(0x1043, 0x81f6, "Asus M2N-SLI", AD1988_6STACK_DIG), | ||
2641 | SND_PCI_QUIRK(0x1043, 0x81ec, "Asus P5B-DLX", AD1988_6STACK_DIG), | ||
2642 | {} | ||
2643 | }; | ||
2644 | |||
2607 | static int patch_ad1988(struct hda_codec *codec) | 2645 | static int patch_ad1988(struct hda_codec *codec) |
2608 | { | 2646 | { |
2609 | struct ad198x_spec *spec; | 2647 | struct ad198x_spec *spec; |
@@ -2620,7 +2658,7 @@ static int patch_ad1988(struct hda_codec *codec) | |||
2620 | snd_printk(KERN_INFO "patch_analog: AD1988A rev.2 is detected, enable workarounds\n"); | 2658 | snd_printk(KERN_INFO "patch_analog: AD1988A rev.2 is detected, enable workarounds\n"); |
2621 | 2659 | ||
2622 | board_config = snd_hda_check_board_config(codec, AD1988_MODEL_LAST, | 2660 | board_config = snd_hda_check_board_config(codec, AD1988_MODEL_LAST, |
2623 | ad1988_models, NULL); | 2661 | ad1988_models, ad1988_cfg_tbl); |
2624 | if (board_config < 0) { | 2662 | if (board_config < 0) { |
2625 | printk(KERN_INFO "hda_codec: Unknown model for AD1988, trying auto-probe from BIOS...\n"); | 2663 | printk(KERN_INFO "hda_codec: Unknown model for AD1988, trying auto-probe from BIOS...\n"); |
2626 | board_config = AD1988_AUTO; | 2664 | board_config = AD1988_AUTO; |
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 23a1c75085b5..46e93c6b9a42 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -629,10 +629,12 @@ static int cxt5045_hp_master_vol_put(struct snd_kcontrol *kcontrol, | |||
629 | static void cxt5045_hp_automute(struct hda_codec *codec) | 629 | static void cxt5045_hp_automute(struct hda_codec *codec) |
630 | { | 630 | { |
631 | struct conexant_spec *spec = codec->spec; | 631 | struct conexant_spec *spec = codec->spec; |
632 | unsigned int bits = (spec->hp_present || !spec->cur_eapd) ? 0x80 : 0; | 632 | unsigned int bits; |
633 | 633 | ||
634 | spec->hp_present = snd_hda_codec_read(codec, 0x11, 0, | 634 | spec->hp_present = snd_hda_codec_read(codec, 0x11, 0, |
635 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | 635 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
636 | |||
637 | bits = (spec->hp_present || !spec->cur_eapd) ? 0x80 : 0; | ||
636 | snd_hda_codec_amp_update(codec, 0x10, 0, HDA_OUTPUT, 0, 0x80, bits); | 638 | snd_hda_codec_amp_update(codec, 0x10, 0, HDA_OUTPUT, 0, 0x80, bits); |
637 | snd_hda_codec_amp_update(codec, 0x10, 1, HDA_OUTPUT, 0, 0x80, bits); | 639 | snd_hda_codec_amp_update(codec, 0x10, 1, HDA_OUTPUT, 0, 0x80, bits); |
638 | } | 640 | } |
@@ -979,10 +981,12 @@ static int cxt5047_hp_master_vol_put(struct snd_kcontrol *kcontrol, | |||
979 | static void cxt5047_hp_automute(struct hda_codec *codec) | 981 | static void cxt5047_hp_automute(struct hda_codec *codec) |
980 | { | 982 | { |
981 | struct conexant_spec *spec = codec->spec; | 983 | struct conexant_spec *spec = codec->spec; |
982 | unsigned int bits = spec->hp_present || !spec->cur_eapd ? 0x80 : 0; | 984 | unsigned int bits; |
983 | 985 | ||
984 | spec->hp_present = snd_hda_codec_read(codec, 0x13, 0, | 986 | spec->hp_present = snd_hda_codec_read(codec, 0x13, 0, |
985 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | 987 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
988 | |||
989 | bits = (spec->hp_present || !spec->cur_eapd) ? 0x80 : 0; | ||
986 | snd_hda_codec_amp_update(codec, 0x1d, 0, HDA_OUTPUT, 0, 0x80, bits); | 990 | snd_hda_codec_amp_update(codec, 0x1d, 0, HDA_OUTPUT, 0, 0x80, bits); |
987 | snd_hda_codec_amp_update(codec, 0x1d, 1, HDA_OUTPUT, 0, 0x80, bits); | 991 | snd_hda_codec_amp_update(codec, 0x1d, 1, HDA_OUTPUT, 0, 0x80, bits); |
988 | /* Mute/Unmute PCM 2 for good measure - some systems need this */ | 992 | /* Mute/Unmute PCM 2 for good measure - some systems need this */ |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 145682b78071..fba3cb11bc2a 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -4186,6 +4186,8 @@ static const char *alc260_models[ALC260_MODEL_LAST] = { | |||
4186 | static struct snd_pci_quirk alc260_cfg_tbl[] = { | 4186 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
4187 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), | 4187 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
4188 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), | 4188 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
4189 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), | ||
4190 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), | ||
4189 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), | 4191 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
4190 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP), | 4192 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP), |
4191 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013), | 4193 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013), |
@@ -4942,9 +4944,16 @@ static int patch_alc882(struct hda_codec *codec) | |||
4942 | alc882_cfg_tbl); | 4944 | alc882_cfg_tbl); |
4943 | 4945 | ||
4944 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { | 4946 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
4945 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " | 4947 | /* Pick up systems that don't supply PCI SSID */ |
4946 | "trying auto-probe from BIOS...\n"); | 4948 | switch (codec->subsystem_id) { |
4947 | board_config = ALC882_AUTO; | 4949 | case 0x106b0c00: /* Mac Pro */ |
4950 | board_config = ALC885_MACPRO; | ||
4951 | break; | ||
4952 | default: | ||
4953 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " | ||
4954 | "trying auto-probe from BIOS...\n"); | ||
4955 | board_config = ALC882_AUTO; | ||
4956 | } | ||
4948 | } | 4957 | } |
4949 | 4958 | ||
4950 | if (board_config == ALC882_AUTO) { | 4959 | if (board_config == ALC882_AUTO) { |
@@ -5917,8 +5926,10 @@ static struct snd_kcontrol_new alc262_base_mixer[] = { | |||
5917 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | 5926 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
5918 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | 5927 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
5919 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | 5928 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
5929 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
5920 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | 5930 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
5921 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | 5931 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
5932 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | ||
5922 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), | 5933 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
5923 | HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */ | 5934 | HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
5924 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), | 5935 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
@@ -5937,8 +5948,10 @@ static struct snd_kcontrol_new alc262_hippo1_mixer[] = { | |||
5937 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | 5948 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
5938 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | 5949 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
5939 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | 5950 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
5951 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
5940 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | 5952 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
5941 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | 5953 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
5954 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | ||
5942 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), | 5955 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
5943 | HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */ | 5956 | HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
5944 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ | 5957 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
@@ -5955,8 +5968,10 @@ static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { | |||
5955 | 5968 | ||
5956 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | 5969 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
5957 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | 5970 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
5971 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
5958 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | 5972 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
5959 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | 5973 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
5974 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | ||
5960 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | 5975 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
5961 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | 5976 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
5962 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | 5977 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
@@ -5977,6 +5992,7 @@ static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { | |||
5977 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), | 5992 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
5978 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), | 5993 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
5979 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), | 5994 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
5995 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), | ||
5980 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), | 5996 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
5981 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | 5997 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
5982 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | 5998 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
@@ -5989,6 +6005,7 @@ static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { | |||
5989 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { | 6005 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
5990 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | 6006 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
5991 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | 6007 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
6008 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), | ||
5992 | { } /* end */ | 6009 | { } /* end */ |
5993 | }; | 6010 | }; |
5994 | 6011 | ||
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index f7ef9c5afe87..c94291bc5367 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -59,6 +59,9 @@ enum { | |||
59 | STAC_D945GTP3, | 59 | STAC_D945GTP3, |
60 | STAC_D945GTP5, | 60 | STAC_D945GTP5, |
61 | STAC_MACMINI, | 61 | STAC_MACMINI, |
62 | STAC_MACBOOK, | ||
63 | STAC_MACBOOK_PRO_V1, | ||
64 | STAC_MACBOOK_PRO_V2, | ||
62 | STAC_922X_MODELS | 65 | STAC_922X_MODELS |
63 | }; | 66 | }; |
64 | 67 | ||
@@ -461,6 +464,8 @@ static struct snd_pci_quirk stac9200_cfg_tbl[] = { | |||
461 | "Dell Inspiron E1705/9400", STAC_REF), | 464 | "Dell Inspiron E1705/9400", STAC_REF), |
462 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ce, | 465 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ce, |
463 | "Dell XPS M1710", STAC_REF), | 466 | "Dell XPS M1710", STAC_REF), |
467 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cf, | ||
468 | "Dell Precision M90", STAC_REF), | ||
464 | {} /* terminator */ | 469 | {} /* terminator */ |
465 | }; | 470 | }; |
466 | 471 | ||
@@ -519,11 +524,32 @@ static unsigned int d945gtp5_pin_configs[10] = { | |||
519 | 0x02a19320, 0x40000100, | 524 | 0x02a19320, 0x40000100, |
520 | }; | 525 | }; |
521 | 526 | ||
527 | static unsigned int macbook_pin_configs[10] = { | ||
528 | 0x0321e230, 0x03a1e020, 0x400000fd, 0x9017e110, | ||
529 | 0x400000fe, 0x0381e021, 0x1345e240, 0x13c5e22e, | ||
530 | 0x400000fc, 0x400000fb, | ||
531 | }; | ||
532 | |||
533 | static unsigned int macbook_pro_v1_pin_configs[10] = { | ||
534 | 0x0321e230, 0x03a1e020, 0x9017e110, 0x01014010, | ||
535 | 0x01a19021, 0x0381e021, 0x1345e240, 0x13c5e22e, | ||
536 | 0x02a19320, 0x400000fb | ||
537 | }; | ||
538 | |||
539 | static unsigned int macbook_pro_v2_pin_configs[10] = { | ||
540 | 0x0221401f, 0x90a70120, 0x01813024, 0x01014010, | ||
541 | 0x400000fd, 0x01016011, 0x1345e240, 0x13c5e22e, | ||
542 | 0x400000fc, 0x400000fb, | ||
543 | }; | ||
544 | |||
522 | static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = { | 545 | static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = { |
523 | [STAC_D945_REF] = ref922x_pin_configs, | 546 | [STAC_D945_REF] = ref922x_pin_configs, |
524 | [STAC_D945GTP3] = d945gtp3_pin_configs, | 547 | [STAC_D945GTP3] = d945gtp3_pin_configs, |
525 | [STAC_D945GTP5] = d945gtp5_pin_configs, | 548 | [STAC_D945GTP5] = d945gtp5_pin_configs, |
526 | [STAC_MACMINI] = d945gtp5_pin_configs, | 549 | [STAC_MACMINI] = d945gtp5_pin_configs, |
550 | [STAC_MACBOOK] = macbook_pin_configs, | ||
551 | [STAC_MACBOOK_PRO_V1] = macbook_pro_v1_pin_configs, | ||
552 | [STAC_MACBOOK_PRO_V2] = macbook_pro_v2_pin_configs, | ||
527 | }; | 553 | }; |
528 | 554 | ||
529 | static const char *stac922x_models[STAC_922X_MODELS] = { | 555 | static const char *stac922x_models[STAC_922X_MODELS] = { |
@@ -531,6 +557,9 @@ static const char *stac922x_models[STAC_922X_MODELS] = { | |||
531 | [STAC_D945GTP5] = "5stack", | 557 | [STAC_D945GTP5] = "5stack", |
532 | [STAC_D945GTP3] = "3stack", | 558 | [STAC_D945GTP3] = "3stack", |
533 | [STAC_MACMINI] = "macmini", | 559 | [STAC_MACMINI] = "macmini", |
560 | [STAC_MACBOOK] = "macbook", | ||
561 | [STAC_MACBOOK_PRO_V1] = "macbook-pro-v1", | ||
562 | [STAC_MACBOOK_PRO_V2] = "macbook-pro", | ||
534 | }; | 563 | }; |
535 | 564 | ||
536 | static struct snd_pci_quirk stac922x_cfg_tbl[] = { | 565 | static struct snd_pci_quirk stac922x_cfg_tbl[] = { |
@@ -1580,6 +1609,11 @@ static int stac92xx_init(struct hda_codec *codec) | |||
1580 | for (i = 0; i < cfg->hp_outs; i++) | 1609 | for (i = 0; i < cfg->hp_outs; i++) |
1581 | enable_pin_detect(codec, cfg->hp_pins[i], | 1610 | enable_pin_detect(codec, cfg->hp_pins[i], |
1582 | STAC_HP_EVENT); | 1611 | STAC_HP_EVENT); |
1612 | /* force to enable the first line-out; the others are set up | ||
1613 | * in unsol_event | ||
1614 | */ | ||
1615 | stac92xx_auto_set_pinctl(codec, spec->autocfg.line_out_pins[0], | ||
1616 | AC_PINCTL_OUT_EN); | ||
1583 | stac92xx_auto_init_hp_out(codec); | 1617 | stac92xx_auto_init_hp_out(codec); |
1584 | /* fake event to set up pins */ | 1618 | /* fake event to set up pins */ |
1585 | codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26); | 1619 | codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26); |
@@ -1864,6 +1898,22 @@ static int patch_stac922x(struct hda_codec *codec) | |||
1864 | spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS, | 1898 | spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS, |
1865 | stac922x_models, | 1899 | stac922x_models, |
1866 | stac922x_cfg_tbl); | 1900 | stac922x_cfg_tbl); |
1901 | if (spec->board_config == STAC_MACMINI) { | ||
1902 | spec->gpio_mute = 1; | ||
1903 | /* Intel Macs have all same PCI SSID, so we need to check | ||
1904 | * codec SSID to distinguish the exact models | ||
1905 | */ | ||
1906 | printk(KERN_INFO "hda_codec: STAC922x, Apple subsys_id=%x\n", codec->subsystem_id); | ||
1907 | switch (codec->subsystem_id) { | ||
1908 | case 0x106b0200: /* MacBook Pro first generation */ | ||
1909 | spec->board_config = STAC_MACBOOK_PRO_V1; | ||
1910 | break; | ||
1911 | case 0x106b1e00: /* MacBook Pro second generation */ | ||
1912 | spec->board_config = STAC_MACBOOK_PRO_V2; | ||
1913 | break; | ||
1914 | } | ||
1915 | } | ||
1916 | |||
1867 | again: | 1917 | again: |
1868 | if (spec->board_config < 0) { | 1918 | if (spec->board_config < 0) { |
1869 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, " | 1919 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, " |
@@ -1904,9 +1954,6 @@ static int patch_stac922x(struct hda_codec *codec) | |||
1904 | return err; | 1954 | return err; |
1905 | } | 1955 | } |
1906 | 1956 | ||
1907 | if (spec->board_config == STAC_MACMINI) | ||
1908 | spec->gpio_mute = 1; | ||
1909 | |||
1910 | codec->patch_ops = stac92xx_patch_ops; | 1957 | codec->patch_ops = stac92xx_patch_ops; |
1911 | 1958 | ||
1912 | return 0; | 1959 | return 0; |
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index a289abfc7172..7cf2dcb9d8d4 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c | |||
@@ -725,10 +725,11 @@ static void fill_nocache(void *buf, int size, int nocache) | |||
725 | static inline void snd_intel8x0_update(struct intel8x0 *chip, struct ichdev *ichdev) | 725 | static inline void snd_intel8x0_update(struct intel8x0 *chip, struct ichdev *ichdev) |
726 | { | 726 | { |
727 | unsigned long port = ichdev->reg_offset; | 727 | unsigned long port = ichdev->reg_offset; |
728 | unsigned long flags; | ||
728 | int status, civ, i, step; | 729 | int status, civ, i, step; |
729 | int ack = 0; | 730 | int ack = 0; |
730 | 731 | ||
731 | spin_lock(&chip->reg_lock); | 732 | spin_lock_irqsave(&chip->reg_lock, flags); |
732 | status = igetbyte(chip, port + ichdev->roff_sr); | 733 | status = igetbyte(chip, port + ichdev->roff_sr); |
733 | civ = igetbyte(chip, port + ICH_REG_OFF_CIV); | 734 | civ = igetbyte(chip, port + ICH_REG_OFF_CIV); |
734 | if (!(status & ICH_BCIS)) { | 735 | if (!(status & ICH_BCIS)) { |
@@ -768,7 +769,7 @@ static inline void snd_intel8x0_update(struct intel8x0 *chip, struct ichdev *ich | |||
768 | ack = 1; | 769 | ack = 1; |
769 | } | 770 | } |
770 | } | 771 | } |
771 | spin_unlock(&chip->reg_lock); | 772 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
772 | if (ack && ichdev->substream) { | 773 | if (ack && ichdev->substream) { |
773 | snd_pcm_period_elapsed(ichdev->substream); | 774 | snd_pcm_period_elapsed(ichdev->substream); |
774 | } | 775 | } |
@@ -2470,7 +2471,10 @@ static int intel8x0_suspend(struct pci_dev *pci, pm_message_t state) | |||
2470 | } | 2471 | } |
2471 | pci_disable_device(pci); | 2472 | pci_disable_device(pci); |
2472 | pci_save_state(pci); | 2473 | pci_save_state(pci); |
2473 | pci_set_power_state(pci, pci_choose_state(pci, state)); | 2474 | /* The call below may disable built-in speaker on some laptops |
2475 | * after S2RAM. So, don't touch it. | ||
2476 | */ | ||
2477 | /* pci_set_power_state(pci, pci_choose_state(pci, state)); */ | ||
2474 | return 0; | 2478 | return 0; |
2475 | } | 2479 | } |
2476 | 2480 | ||
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c index 5e1d5d2b2850..952625dead58 100644 --- a/sound/pci/riptide/riptide.c +++ b/sound/pci/riptide/riptide.c | |||
@@ -1919,6 +1919,8 @@ snd_riptide_create(struct snd_card *card, struct pci_dev *pci, | |||
1919 | return err; | 1919 | return err; |
1920 | } | 1920 | } |
1921 | 1921 | ||
1922 | snd_card_set_dev(card, &pci->dev); | ||
1923 | |||
1922 | *rchip = chip; | 1924 | *rchip = chip; |
1923 | return 0; | 1925 | return 0; |
1924 | } | 1926 | } |
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index e0215aca1193..6e95857e4e67 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c | |||
@@ -4468,6 +4468,8 @@ static int __devinit snd_hdspm_probe(struct pci_dev *pci, | |||
4468 | hdspm->dev = dev; | 4468 | hdspm->dev = dev; |
4469 | hdspm->pci = pci; | 4469 | hdspm->pci = pci; |
4470 | 4470 | ||
4471 | snd_card_set_dev(card, &pci->dev); | ||
4472 | |||
4471 | if ((err = | 4473 | if ((err = |
4472 | snd_hdspm_create(card, hdspm, precise_ptr[dev], | 4474 | snd_hdspm_create(card, hdspm, precise_ptr[dev], |
4473 | enable_monitor[dev])) < 0) { | 4475 | enable_monitor[dev])) < 0) { |
diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c index c64af55865d4..2bae9c1a2b54 100644 --- a/sound/ppc/pmac.c +++ b/sound/ppc/pmac.c | |||
@@ -816,6 +816,7 @@ static int snd_pmac_free(struct snd_pmac *chip) | |||
816 | 816 | ||
817 | if (chip->pdev) | 817 | if (chip->pdev) |
818 | pci_dev_put(chip->pdev); | 818 | pci_dev_put(chip->pdev); |
819 | of_node_put(chip->node); | ||
819 | kfree(chip); | 820 | kfree(chip); |
820 | return 0; | 821 | return 0; |
821 | } | 822 | } |
@@ -863,8 +864,10 @@ static void __init detect_byte_swap(struct snd_pmac *chip) | |||
863 | */ | 864 | */ |
864 | static int __init snd_pmac_detect(struct snd_pmac *chip) | 865 | static int __init snd_pmac_detect(struct snd_pmac *chip) |
865 | { | 866 | { |
866 | struct device_node *sound = NULL; | 867 | struct device_node *sound; |
867 | unsigned int *prop, l; | 868 | struct device_node *dn; |
869 | const unsigned int *prop; | ||
870 | unsigned int l; | ||
868 | struct macio_chip* macio; | 871 | struct macio_chip* macio; |
869 | 872 | ||
870 | if (!machine_is(powermac)) | 873 | if (!machine_is(powermac)) |
@@ -890,22 +893,21 @@ static int __init snd_pmac_detect(struct snd_pmac *chip) | |||
890 | else if (machine_is_compatible("PowerBook1,1") | 893 | else if (machine_is_compatible("PowerBook1,1") |
891 | || machine_is_compatible("AAPL,PowerBook1998")) | 894 | || machine_is_compatible("AAPL,PowerBook1998")) |
892 | chip->is_pbook_G3 = 1; | 895 | chip->is_pbook_G3 = 1; |
893 | chip->node = find_devices("awacs"); | 896 | chip->node = of_find_node_by_name(NULL, "awacs"); |
894 | if (chip->node) | 897 | sound = of_node_get(chip->node); |
895 | sound = chip->node; | ||
896 | 898 | ||
897 | /* | 899 | /* |
898 | * powermac G3 models have a node called "davbus" | 900 | * powermac G3 models have a node called "davbus" |
899 | * with a child called "sound". | 901 | * with a child called "sound". |
900 | */ | 902 | */ |
901 | if (!chip->node) | 903 | if (!chip->node) |
902 | chip->node = find_devices("davbus"); | 904 | chip->node = of_find_node_by_name(NULL, "davbus"); |
903 | /* | 905 | /* |
904 | * if we didn't find a davbus device, try 'i2s-a' since | 906 | * if we didn't find a davbus device, try 'i2s-a' since |
905 | * this seems to be what iBooks have | 907 | * this seems to be what iBooks have |
906 | */ | 908 | */ |
907 | if (! chip->node) { | 909 | if (! chip->node) { |
908 | chip->node = find_devices("i2s-a"); | 910 | chip->node = of_find_node_by_name(NULL, "i2s-a"); |
909 | if (chip->node && chip->node->parent && | 911 | if (chip->node && chip->node->parent && |
910 | chip->node->parent->parent) { | 912 | chip->node->parent->parent) { |
911 | if (device_is_compatible(chip->node->parent->parent, | 913 | if (device_is_compatible(chip->node->parent->parent, |
@@ -917,22 +919,25 @@ static int __init snd_pmac_detect(struct snd_pmac *chip) | |||
917 | return -ENODEV; | 919 | return -ENODEV; |
918 | 920 | ||
919 | if (!sound) { | 921 | if (!sound) { |
920 | sound = find_devices("sound"); | 922 | sound = of_find_node_by_name(NULL, "sound"); |
921 | while (sound && sound->parent != chip->node) | 923 | while (sound && sound->parent != chip->node) |
922 | sound = sound->next; | 924 | sound = of_find_node_by_name(sound, "sound"); |
923 | } | 925 | } |
924 | if (! sound) | 926 | if (! sound) { |
927 | of_node_put(chip->node); | ||
925 | return -ENODEV; | 928 | return -ENODEV; |
926 | prop = (unsigned int *) get_property(sound, "sub-frame", NULL); | 929 | } |
930 | prop = of_get_property(sound, "sub-frame", NULL); | ||
927 | if (prop && *prop < 16) | 931 | if (prop && *prop < 16) |
928 | chip->subframe = *prop; | 932 | chip->subframe = *prop; |
929 | prop = (unsigned int *) get_property(sound, "layout-id", NULL); | 933 | prop = of_get_property(sound, "layout-id", NULL); |
930 | if (prop) { | 934 | if (prop) { |
931 | /* partly deprecate snd-powermac, for those machines | 935 | /* partly deprecate snd-powermac, for those machines |
932 | * that have a layout-id property for now */ | 936 | * that have a layout-id property for now */ |
933 | printk(KERN_INFO "snd-powermac no longer handles any " | 937 | printk(KERN_INFO "snd-powermac no longer handles any " |
934 | "machines with a layout-id property " | 938 | "machines with a layout-id property " |
935 | "in the device-tree, use snd-aoa.\n"); | 939 | "in the device-tree, use snd-aoa.\n"); |
940 | of_node_put(chip->node); | ||
936 | return -ENODEV; | 941 | return -ENODEV; |
937 | } | 942 | } |
938 | /* This should be verified on older screamers */ | 943 | /* This should be verified on older screamers */ |
@@ -967,10 +972,12 @@ static int __init snd_pmac_detect(struct snd_pmac *chip) | |||
967 | chip->freq_table = tumbler_freqs; | 972 | chip->freq_table = tumbler_freqs; |
968 | chip->control_mask = MASK_IEPC | 0x11; /* disable IEE */ | 973 | chip->control_mask = MASK_IEPC | 0x11; /* disable IEE */ |
969 | } | 974 | } |
970 | prop = (unsigned int *)get_property(sound, "device-id", NULL); | 975 | prop = of_get_property(sound, "device-id", NULL); |
971 | if (prop) | 976 | if (prop) |
972 | chip->device_id = *prop; | 977 | chip->device_id = *prop; |
973 | chip->has_iic = (find_devices("perch") != NULL); | 978 | dn = of_find_node_by_name(NULL, "perch"); |
979 | chip->has_iic = (dn != NULL); | ||
980 | of_node_put(dn); | ||
974 | 981 | ||
975 | /* We need the PCI device for DMA allocations, let's use a crude method | 982 | /* We need the PCI device for DMA allocations, let's use a crude method |
976 | * for now ... | 983 | * for now ... |
@@ -997,10 +1004,9 @@ static int __init snd_pmac_detect(struct snd_pmac *chip) | |||
997 | 1004 | ||
998 | /* look for a property saying what sample rates | 1005 | /* look for a property saying what sample rates |
999 | are available */ | 1006 | are available */ |
1000 | prop = (unsigned int *) get_property(sound, "sample-rates", &l); | 1007 | prop = of_get_property(sound, "sample-rates", &l); |
1001 | if (! prop) | 1008 | if (! prop) |
1002 | prop = (unsigned int *) get_property(sound, | 1009 | prop = of_get_property(sound, "output-frame-rates", &l); |
1003 | "output-frame-rates", &l); | ||
1004 | if (prop) { | 1010 | if (prop) { |
1005 | int i; | 1011 | int i; |
1006 | chip->freqs_ok = 0; | 1012 | chip->freqs_ok = 0; |
@@ -1021,6 +1027,7 @@ static int __init snd_pmac_detect(struct snd_pmac *chip) | |||
1021 | chip->freqs_ok = 1; | 1027 | chip->freqs_ok = 1; |
1022 | } | 1028 | } |
1023 | 1029 | ||
1030 | of_node_put(sound); | ||
1024 | return 0; | 1031 | return 0; |
1025 | } | 1032 | } |
1026 | 1033 | ||
diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c index 8f074c7936e6..54e333fbb1d0 100644 --- a/sound/ppc/tumbler.c +++ b/sound/ppc/tumbler.c | |||
@@ -1031,32 +1031,40 @@ static irqreturn_t headphone_intr(int irq, void *devid) | |||
1031 | /* look for audio-gpio device */ | 1031 | /* look for audio-gpio device */ |
1032 | static struct device_node *find_audio_device(const char *name) | 1032 | static struct device_node *find_audio_device(const char *name) |
1033 | { | 1033 | { |
1034 | struct device_node *gpiop; | ||
1034 | struct device_node *np; | 1035 | struct device_node *np; |
1035 | 1036 | ||
1036 | if (! (np = find_devices("gpio"))) | 1037 | gpiop = of_find_node_by_name(NULL, "gpio"); |
1038 | if (! gpiop) | ||
1037 | return NULL; | 1039 | return NULL; |
1038 | 1040 | ||
1039 | for (np = np->child; np; np = np->sibling) { | 1041 | for (np = of_get_next_child(gpiop, NULL); np; |
1040 | const char *property = get_property(np, "audio-gpio", NULL); | 1042 | np = of_get_next_child(gpiop, np)) { |
1043 | const char *property = of_get_property(np, "audio-gpio", NULL); | ||
1041 | if (property && strcmp(property, name) == 0) | 1044 | if (property && strcmp(property, name) == 0) |
1042 | return np; | 1045 | break; |
1043 | } | 1046 | } |
1044 | return NULL; | 1047 | of_node_put(gpiop); |
1048 | return np; | ||
1045 | } | 1049 | } |
1046 | 1050 | ||
1047 | /* look for audio-gpio device */ | 1051 | /* look for audio-gpio device */ |
1048 | static struct device_node *find_compatible_audio_device(const char *name) | 1052 | static struct device_node *find_compatible_audio_device(const char *name) |
1049 | { | 1053 | { |
1054 | struct device_node *gpiop; | ||
1050 | struct device_node *np; | 1055 | struct device_node *np; |
1051 | 1056 | ||
1052 | if (! (np = find_devices("gpio"))) | 1057 | gpiop = of_find_node_by_name(NULL, "gpio"); |
1058 | if (!gpiop) | ||
1053 | return NULL; | 1059 | return NULL; |
1054 | 1060 | ||
1055 | for (np = np->child; np; np = np->sibling) { | 1061 | for (np = of_get_next_child(gpiop, NULL); np; |
1062 | np = of_get_next_child(gpiop, np)) { | ||
1056 | if (device_is_compatible(np, name)) | 1063 | if (device_is_compatible(np, name)) |
1057 | return np; | 1064 | break; |
1058 | } | 1065 | } |
1059 | return NULL; | 1066 | of_node_put(gpiop); |
1067 | return np; | ||
1060 | } | 1068 | } |
1061 | 1069 | ||
1062 | /* find an audio device and get its address */ | 1070 | /* find an audio device and get its address */ |
@@ -1066,6 +1074,7 @@ static long tumbler_find_device(const char *device, const char *platform, | |||
1066 | struct device_node *node; | 1074 | struct device_node *node; |
1067 | const u32 *base; | 1075 | const u32 *base; |
1068 | u32 addr; | 1076 | u32 addr; |
1077 | long ret; | ||
1069 | 1078 | ||
1070 | if (is_compatible) | 1079 | if (is_compatible) |
1071 | node = find_compatible_audio_device(device); | 1080 | node = find_compatible_audio_device(device); |
@@ -1077,12 +1086,13 @@ static long tumbler_find_device(const char *device, const char *platform, | |||
1077 | return -ENODEV; | 1086 | return -ENODEV; |
1078 | } | 1087 | } |
1079 | 1088 | ||
1080 | base = get_property(node, "AAPL,address", NULL); | 1089 | base = of_get_property(node, "AAPL,address", NULL); |
1081 | if (! base) { | 1090 | if (! base) { |
1082 | base = get_property(node, "reg", NULL); | 1091 | base = of_get_property(node, "reg", NULL); |
1083 | if (!base) { | 1092 | if (!base) { |
1084 | DBG("(E) cannot find address for device %s !\n", device); | 1093 | DBG("(E) cannot find address for device %s !\n", device); |
1085 | snd_printd("cannot find address for device %s\n", device); | 1094 | snd_printd("cannot find address for device %s\n", device); |
1095 | of_node_put(node); | ||
1086 | return -ENODEV; | 1096 | return -ENODEV; |
1087 | } | 1097 | } |
1088 | addr = *base; | 1098 | addr = *base; |
@@ -1093,7 +1103,7 @@ static long tumbler_find_device(const char *device, const char *platform, | |||
1093 | 1103 | ||
1094 | gp->addr = addr & 0x0000ffff; | 1104 | gp->addr = addr & 0x0000ffff; |
1095 | /* Try to find the active state, default to 0 ! */ | 1105 | /* Try to find the active state, default to 0 ! */ |
1096 | base = get_property(node, "audio-gpio-active-state", NULL); | 1106 | base = of_get_property(node, "audio-gpio-active-state", NULL); |
1097 | if (base) { | 1107 | if (base) { |
1098 | gp->active_state = *base; | 1108 | gp->active_state = *base; |
1099 | gp->active_val = (*base) ? 0x5 : 0x4; | 1109 | gp->active_val = (*base) ? 0x5 : 0x4; |
@@ -1108,7 +1118,7 @@ static long tumbler_find_device(const char *device, const char *platform, | |||
1108 | * as we don't yet have an interpreter for these things | 1118 | * as we don't yet have an interpreter for these things |
1109 | */ | 1119 | */ |
1110 | if (platform) | 1120 | if (platform) |
1111 | prop = get_property(node, platform, NULL); | 1121 | prop = of_get_property(node, platform, NULL); |
1112 | if (prop) { | 1122 | if (prop) { |
1113 | if (prop[3] == 0x9 && prop[4] == 0x9) { | 1123 | if (prop[3] == 0x9 && prop[4] == 0x9) { |
1114 | gp->active_val = 0xd; | 1124 | gp->active_val = 0xd; |
@@ -1124,7 +1134,9 @@ static long tumbler_find_device(const char *device, const char *platform, | |||
1124 | DBG("(I) GPIO device %s found, offset: %x, active state: %d !\n", | 1134 | DBG("(I) GPIO device %s found, offset: %x, active state: %d !\n", |
1125 | device, gp->addr, gp->active_state); | 1135 | device, gp->addr, gp->active_state); |
1126 | 1136 | ||
1127 | return irq_of_parse_and_map(node, 0); | 1137 | ret = irq_of_parse_and_map(node, 0); |
1138 | of_node_put(node); | ||
1139 | return ret; | ||
1128 | } | 1140 | } |
1129 | 1141 | ||
1130 | /* reset audio */ | 1142 | /* reset audio */ |
@@ -1310,7 +1322,7 @@ int __init snd_pmac_tumbler_init(struct snd_pmac *chip) | |||
1310 | { | 1322 | { |
1311 | int i, err; | 1323 | int i, err; |
1312 | struct pmac_tumbler *mix; | 1324 | struct pmac_tumbler *mix; |
1313 | u32 *paddr; | 1325 | const u32 *paddr; |
1314 | struct device_node *tas_node, *np; | 1326 | struct device_node *tas_node, *np; |
1315 | char *chipname; | 1327 | char *chipname; |
1316 | 1328 | ||
@@ -1331,9 +1343,9 @@ int __init snd_pmac_tumbler_init(struct snd_pmac *chip) | |||
1331 | 1343 | ||
1332 | for (np = chip->node->child; np; np = np->sibling) { | 1344 | for (np = chip->node->child; np; np = np->sibling) { |
1333 | if (!strcmp(np->name, "sound")) { | 1345 | if (!strcmp(np->name, "sound")) { |
1334 | if (get_property(np, "has-anded-reset", NULL)) | 1346 | if (of_get_property(np, "has-anded-reset", NULL)) |
1335 | mix->anded_reset = 1; | 1347 | mix->anded_reset = 1; |
1336 | if (get_property(np, "layout-id", NULL)) | 1348 | if (of_get_property(np, "layout-id", NULL)) |
1337 | mix->reset_on_sleep = 0; | 1349 | mix->reset_on_sleep = 0; |
1338 | break; | 1350 | break; |
1339 | } | 1351 | } |
@@ -1342,19 +1354,20 @@ int __init snd_pmac_tumbler_init(struct snd_pmac *chip) | |||
1342 | return err; | 1354 | return err; |
1343 | 1355 | ||
1344 | /* set up TAS */ | 1356 | /* set up TAS */ |
1345 | tas_node = find_devices("deq"); | 1357 | tas_node = of_find_node_by_name(NULL, "deq"); |
1346 | if (tas_node == NULL) | 1358 | if (tas_node == NULL) |
1347 | tas_node = find_devices("codec"); | 1359 | tas_node = of_find_node_by_name(NULL, "codec"); |
1348 | if (tas_node == NULL) | 1360 | if (tas_node == NULL) |
1349 | return -ENODEV; | 1361 | return -ENODEV; |
1350 | 1362 | ||
1351 | paddr = (u32 *)get_property(tas_node, "i2c-address", NULL); | 1363 | paddr = of_get_property(tas_node, "i2c-address", NULL); |
1352 | if (paddr == NULL) | 1364 | if (paddr == NULL) |
1353 | paddr = (u32 *)get_property(tas_node, "reg", NULL); | 1365 | paddr = of_get_property(tas_node, "reg", NULL); |
1354 | if (paddr) | 1366 | if (paddr) |
1355 | mix->i2c.addr = (*paddr) >> 1; | 1367 | mix->i2c.addr = (*paddr) >> 1; |
1356 | else | 1368 | else |
1357 | mix->i2c.addr = TAS_I2C_ADDR; | 1369 | mix->i2c.addr = TAS_I2C_ADDR; |
1370 | of_node_put(tas_node); | ||
1358 | 1371 | ||
1359 | DBG("(I) TAS i2c address is: %x\n", mix->i2c.addr); | 1372 | DBG("(I) TAS i2c address is: %x\n", mix->i2c.addr); |
1360 | 1373 | ||
diff --git a/sound/soc/Kconfig b/sound/soc/Kconfig index ec821a57f843..dccaa4be679e 100644 --- a/sound/soc/Kconfig +++ b/sound/soc/Kconfig | |||
@@ -10,6 +10,8 @@ config SND_SOC_AC97_BUS | |||
10 | 10 | ||
11 | config SND_SOC | 11 | config SND_SOC |
12 | tristate "SoC audio support" | 12 | tristate "SoC audio support" |
13 | depends on SND | ||
14 | select SND_PCM | ||
13 | ---help--- | 15 | ---help--- |
14 | 16 | ||
15 | If you want SoC support, you should say Y here and also to the | 17 | If you want SoC support, you should say Y here and also to the |
diff --git a/sound/soc/at91/Kconfig b/sound/soc/at91/Kconfig index 5bcf08b728b0..a5b2558916c1 100644 --- a/sound/soc/at91/Kconfig +++ b/sound/soc/at91/Kconfig | |||
@@ -2,8 +2,7 @@ menu "SoC Audio for the Atmel AT91" | |||
2 | 2 | ||
3 | config SND_AT91_SOC | 3 | config SND_AT91_SOC |
4 | tristate "SoC Audio for the Atmel AT91 System-on-Chip" | 4 | tristate "SoC Audio for the Atmel AT91 System-on-Chip" |
5 | depends on ARCH_AT91 && SND | 5 | depends on ARCH_AT91 && SND_SOC |
6 | select SND_PCM | ||
7 | help | 6 | help |
8 | Say Y or M if you want to add support for codecs attached to | 7 | Say Y or M if you want to add support for codecs attached to |
9 | the AT91 SSC interface. You will also need | 8 | the AT91 SSC interface. You will also need |
diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c index 92a64871bcd0..ee7a691a9ba1 100644 --- a/sound/soc/codecs/wm9712.c +++ b/sound/soc/codecs/wm9712.c | |||
@@ -39,7 +39,7 @@ static int ac97_write(struct snd_soc_codec *codec, | |||
39 | */ | 39 | */ |
40 | static const u16 wm9712_reg[] = { | 40 | static const u16 wm9712_reg[] = { |
41 | 0x6174, 0x8000, 0x8000, 0x8000, // 6 | 41 | 0x6174, 0x8000, 0x8000, 0x8000, // 6 |
42 | 0xf0f0, 0xaaa0, 0xc008, 0x6808, // e | 42 | 0x0f0f, 0xaaa0, 0xc008, 0x6808, // e |
43 | 0xe808, 0xaaa0, 0xad00, 0x8000, // 16 | 43 | 0xe808, 0xaaa0, 0xad00, 0x8000, // 16 |
44 | 0xe808, 0x3000, 0x8000, 0x0000, // 1e | 44 | 0xe808, 0x3000, 0x8000, 0x0000, // 1e |
45 | 0x0000, 0x0000, 0x0000, 0x000f, // 26 | 45 | 0x0000, 0x0000, 0x0000, 0x000f, // 26 |
@@ -96,6 +96,7 @@ SOC_DOUBLE("Speaker Playback Volume", AC97_MASTER, 8, 0, 31, 1), | |||
96 | SOC_SINGLE("Speaker Playback Switch", AC97_MASTER, 15, 1, 1), | 96 | SOC_SINGLE("Speaker Playback Switch", AC97_MASTER, 15, 1, 1), |
97 | SOC_DOUBLE("Headphone Playback Volume", AC97_HEADPHONE, 8, 0, 31, 1), | 97 | SOC_DOUBLE("Headphone Playback Volume", AC97_HEADPHONE, 8, 0, 31, 1), |
98 | SOC_SINGLE("Headphone Playback Switch", AC97_HEADPHONE,15, 1, 1), | 98 | SOC_SINGLE("Headphone Playback Switch", AC97_HEADPHONE,15, 1, 1), |
99 | SOC_DOUBLE("PCM Playback Volume", AC97_PCM, 8, 0, 31, 1), | ||
99 | 100 | ||
100 | SOC_SINGLE("Speaker Playback ZC Switch", AC97_MASTER, 7, 1, 0), | 101 | SOC_SINGLE("Speaker Playback ZC Switch", AC97_MASTER, 7, 1, 0), |
101 | SOC_SINGLE("Speaker Playback Invert Switch", AC97_MASTER, 6, 1, 0), | 102 | SOC_SINGLE("Speaker Playback Invert Switch", AC97_MASTER, 6, 1, 0), |
diff --git a/sound/soc/pxa/Kconfig b/sound/soc/pxa/Kconfig index 579e1c8d2b28..b9ab3b8e1d3e 100644 --- a/sound/soc/pxa/Kconfig +++ b/sound/soc/pxa/Kconfig | |||
@@ -2,8 +2,7 @@ menu "SoC Audio for the Intel PXA2xx" | |||
2 | 2 | ||
3 | config SND_PXA2XX_SOC | 3 | config SND_PXA2XX_SOC |
4 | tristate "SoC Audio for the Intel PXA2xx chip" | 4 | tristate "SoC Audio for the Intel PXA2xx chip" |
5 | depends on ARCH_PXA && SND | 5 | depends on ARCH_PXA && SND_SOC |
6 | select SND_PCM | ||
7 | help | 6 | help |
8 | Say Y or M if you want to add support for codecs attached to | 7 | Say Y or M if you want to add support for codecs attached to |
9 | the PXA2xx AC97, I2S or SSP interface. You will also need | 8 | the PXA2xx AC97, I2S or SSP interface. You will also need |
diff --git a/sound/sparc/amd7930.c b/sound/sparc/amd7930.c index c899786f30f5..07962a35f241 100644 --- a/sound/sparc/amd7930.c +++ b/sound/sparc/amd7930.c | |||
@@ -1067,8 +1067,8 @@ out_err: | |||
1067 | 1067 | ||
1068 | static int __devinit amd7930_obio_attach(struct device_node *dp) | 1068 | static int __devinit amd7930_obio_attach(struct device_node *dp) |
1069 | { | 1069 | { |
1070 | struct linux_prom_registers *regs; | 1070 | const struct linux_prom_registers *regs; |
1071 | struct linux_prom_irqs *irqp; | 1071 | const struct linux_prom_irqs *irqp; |
1072 | struct resource res, *rp; | 1072 | struct resource res, *rp; |
1073 | int len; | 1073 | int len; |
1074 | 1074 | ||
diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c index f5956d557f70..900a00de35fd 100644 --- a/sound/sparc/cs4231.c +++ b/sound/sparc/cs4231.c | |||
@@ -2284,7 +2284,7 @@ static int __init cs4231_init(void) | |||
2284 | if (!strcmp(edev->prom_node->name, "SUNW,CS4231")) { | 2284 | if (!strcmp(edev->prom_node->name, "SUNW,CS4231")) { |
2285 | match = 1; | 2285 | match = 1; |
2286 | } else if (!strcmp(edev->prom_node->name, "audio")) { | 2286 | } else if (!strcmp(edev->prom_node->name, "audio")) { |
2287 | char *compat; | 2287 | const char *compat; |
2288 | 2288 | ||
2289 | compat = of_get_property(edev->prom_node, | 2289 | compat = of_get_property(edev->prom_node, |
2290 | "compatible", NULL); | 2290 | "compatible", NULL); |