diff options
Diffstat (limited to 'sound/ppc')
-rw-r--r-- | sound/ppc/beep.c | 32 | ||||
-rw-r--r-- | sound/ppc/keywest.c | 3 | ||||
-rw-r--r-- | sound/ppc/tumbler.c | 20 |
3 files changed, 35 insertions, 20 deletions
diff --git a/sound/ppc/beep.c b/sound/ppc/beep.c index 5fec1e58f310..5f38f670102c 100644 --- a/sound/ppc/beep.c +++ b/sound/ppc/beep.c | |||
@@ -215,15 +215,18 @@ int __init snd_pmac_attach_beep(struct snd_pmac *chip) | |||
215 | { | 215 | { |
216 | struct pmac_beep *beep; | 216 | struct pmac_beep *beep; |
217 | struct input_dev *input_dev; | 217 | struct input_dev *input_dev; |
218 | struct snd_kcontrol *beep_ctl; | ||
218 | void *dmabuf; | 219 | void *dmabuf; |
219 | int err = -ENOMEM; | 220 | int err = -ENOMEM; |
220 | 221 | ||
221 | beep = kzalloc(sizeof(*beep), GFP_KERNEL); | 222 | beep = kzalloc(sizeof(*beep), GFP_KERNEL); |
223 | if (! beep) | ||
224 | return -ENOMEM; | ||
222 | dmabuf = dma_alloc_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4, | 225 | dmabuf = dma_alloc_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4, |
223 | &beep->addr, GFP_KERNEL); | 226 | &beep->addr, GFP_KERNEL); |
224 | input_dev = input_allocate_device(); | 227 | input_dev = input_allocate_device(); |
225 | if (!beep || !dmabuf || !input_dev) | 228 | if (! dmabuf || ! input_dev) |
226 | goto fail; | 229 | goto fail1; |
227 | 230 | ||
228 | /* FIXME: set more better values */ | 231 | /* FIXME: set more better values */ |
229 | input_dev->name = "PowerMac Beep"; | 232 | input_dev->name = "PowerMac Beep"; |
@@ -244,17 +247,24 @@ int __init snd_pmac_attach_beep(struct snd_pmac *chip) | |||
244 | beep->volume = BEEP_VOLUME; | 247 | beep->volume = BEEP_VOLUME; |
245 | beep->running = 0; | 248 | beep->running = 0; |
246 | 249 | ||
247 | err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_pmac_beep_mixer, chip)); | 250 | beep_ctl = snd_ctl_new1(&snd_pmac_beep_mixer, chip); |
251 | err = snd_ctl_add(chip->card, beep_ctl); | ||
248 | if (err < 0) | 252 | if (err < 0) |
249 | goto fail; | 253 | goto fail1; |
254 | |||
255 | chip->beep = beep; | ||
250 | 256 | ||
251 | chip->beep = beep; | 257 | err = input_register_device(beep->dev); |
252 | input_register_device(beep->dev); | 258 | if (err) |
253 | 259 | goto fail2; | |
254 | return 0; | 260 | |
255 | 261 | return 0; | |
256 | fail: input_free_device(input_dev); | 262 | |
257 | kfree(dmabuf); | 263 | fail2: snd_ctl_remove(chip->card, beep_ctl); |
264 | fail1: input_free_device(input_dev); | ||
265 | if (dmabuf) | ||
266 | dma_free_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4, | ||
267 | dmabuf, beep->addr); | ||
258 | kfree(beep); | 268 | kfree(beep); |
259 | return err; | 269 | return err; |
260 | } | 270 | } |
diff --git a/sound/ppc/keywest.c b/sound/ppc/keywest.c index 59482a4cd446..272ae38e9b18 100644 --- a/sound/ppc/keywest.c +++ b/sound/ppc/keywest.c | |||
@@ -117,6 +117,9 @@ int __init snd_pmac_tumbler_post_init(void) | |||
117 | { | 117 | { |
118 | int err; | 118 | int err; |
119 | 119 | ||
120 | if (!keywest_ctx || !keywest_ctx->client) | ||
121 | return -ENXIO; | ||
122 | |||
120 | if ((err = keywest_ctx->init_client(keywest_ctx)) < 0) { | 123 | if ((err = keywest_ctx->init_client(keywest_ctx)) < 0) { |
121 | snd_printk(KERN_ERR "tumbler: %i :cannot initialize the MCS\n", err); | 124 | snd_printk(KERN_ERR "tumbler: %i :cannot initialize the MCS\n", err); |
122 | return err; | 125 | return err; |
diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c index 84f6b19c07ca..cdff53e4a17e 100644 --- a/sound/ppc/tumbler.c +++ b/sound/ppc/tumbler.c | |||
@@ -190,7 +190,7 @@ static int check_audio_gpio(struct pmac_gpio *gp) | |||
190 | 190 | ||
191 | ret = do_gpio_read(gp); | 191 | ret = do_gpio_read(gp); |
192 | 192 | ||
193 | return (ret & 0xd) == (gp->active_val & 0xd); | 193 | return (ret & 0x1) == (gp->active_val & 0x1); |
194 | } | 194 | } |
195 | 195 | ||
196 | static int read_audio_gpio(struct pmac_gpio *gp) | 196 | static int read_audio_gpio(struct pmac_gpio *gp) |
@@ -198,7 +198,8 @@ static int read_audio_gpio(struct pmac_gpio *gp) | |||
198 | int ret; | 198 | int ret; |
199 | if (! gp->addr) | 199 | if (! gp->addr) |
200 | return 0; | 200 | return 0; |
201 | ret = ((do_gpio_read(gp) & 0x02) !=0); | 201 | ret = do_gpio_read(gp); |
202 | ret = (ret & 0x02) !=0; | ||
202 | return ret == gp->active_state; | 203 | return ret == gp->active_state; |
203 | } | 204 | } |
204 | 205 | ||
@@ -1035,7 +1036,7 @@ static struct device_node *find_audio_device(const char *name) | |||
1035 | return NULL; | 1036 | return NULL; |
1036 | 1037 | ||
1037 | for (np = np->child; np; np = np->sibling) { | 1038 | for (np = np->child; np; np = np->sibling) { |
1038 | char *property = get_property(np, "audio-gpio", NULL); | 1039 | const char *property = get_property(np, "audio-gpio", NULL); |
1039 | if (property && strcmp(property, name) == 0) | 1040 | if (property && strcmp(property, name) == 0) |
1040 | return np; | 1041 | return np; |
1041 | } | 1042 | } |
@@ -1062,7 +1063,8 @@ static long tumbler_find_device(const char *device, const char *platform, | |||
1062 | struct pmac_gpio *gp, int is_compatible) | 1063 | struct pmac_gpio *gp, int is_compatible) |
1063 | { | 1064 | { |
1064 | struct device_node *node; | 1065 | struct device_node *node; |
1065 | u32 *base, addr; | 1066 | const u32 *base; |
1067 | u32 addr; | ||
1066 | 1068 | ||
1067 | if (is_compatible) | 1069 | if (is_compatible) |
1068 | node = find_compatible_audio_device(device); | 1070 | node = find_compatible_audio_device(device); |
@@ -1074,9 +1076,9 @@ static long tumbler_find_device(const char *device, const char *platform, | |||
1074 | return -ENODEV; | 1076 | return -ENODEV; |
1075 | } | 1077 | } |
1076 | 1078 | ||
1077 | base = (u32 *)get_property(node, "AAPL,address", NULL); | 1079 | base = get_property(node, "AAPL,address", NULL); |
1078 | if (! base) { | 1080 | if (! base) { |
1079 | base = (u32 *)get_property(node, "reg", NULL); | 1081 | base = get_property(node, "reg", NULL); |
1080 | if (!base) { | 1082 | if (!base) { |
1081 | DBG("(E) cannot find address for device %s !\n", device); | 1083 | DBG("(E) cannot find address for device %s !\n", device); |
1082 | snd_printd("cannot find address for device %s\n", device); | 1084 | snd_printd("cannot find address for device %s\n", device); |
@@ -1090,13 +1092,13 @@ static long tumbler_find_device(const char *device, const char *platform, | |||
1090 | 1092 | ||
1091 | gp->addr = addr & 0x0000ffff; | 1093 | gp->addr = addr & 0x0000ffff; |
1092 | /* Try to find the active state, default to 0 ! */ | 1094 | /* Try to find the active state, default to 0 ! */ |
1093 | base = (u32 *)get_property(node, "audio-gpio-active-state", NULL); | 1095 | base = get_property(node, "audio-gpio-active-state", NULL); |
1094 | if (base) { | 1096 | if (base) { |
1095 | gp->active_state = *base; | 1097 | gp->active_state = *base; |
1096 | gp->active_val = (*base) ? 0x5 : 0x4; | 1098 | gp->active_val = (*base) ? 0x5 : 0x4; |
1097 | gp->inactive_val = (*base) ? 0x4 : 0x5; | 1099 | gp->inactive_val = (*base) ? 0x4 : 0x5; |
1098 | } else { | 1100 | } else { |
1099 | u32 *prop = NULL; | 1101 | const u32 *prop = NULL; |
1100 | gp->active_state = 0; | 1102 | gp->active_state = 0; |
1101 | gp->active_val = 0x4; | 1103 | gp->active_val = 0x4; |
1102 | gp->inactive_val = 0x5; | 1104 | gp->inactive_val = 0x5; |
@@ -1105,7 +1107,7 @@ static long tumbler_find_device(const char *device, const char *platform, | |||
1105 | * as we don't yet have an interpreter for these things | 1107 | * as we don't yet have an interpreter for these things |
1106 | */ | 1108 | */ |
1107 | if (platform) | 1109 | if (platform) |
1108 | prop = (u32 *)get_property(node, platform, NULL); | 1110 | prop = get_property(node, platform, NULL); |
1109 | if (prop) { | 1111 | if (prop) { |
1110 | if (prop[3] == 0x9 && prop[4] == 0x9) { | 1112 | if (prop[3] == 0x9 && prop[4] == 0x9) { |
1111 | gp->active_val = 0xd; | 1113 | gp->active_val = 0xd; |