From 2566d36ab4f0b90141bb59a5f7342255751fbf45 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Tue, 25 Jul 2006 16:12:51 +0200 Subject: [ALSA] aoa: feature gpio layer: fix IRQ access The IRQ rework caused some hiccups here, in some cases we call get_irq without a device node. This patch makes it catch that case and return NO_IRQ when it happens, along with changing the place where the irq is checked to check for NO_IRQ instead of -1. Acked-by: Benjamin Herrenschmidt Signed-off-by: Johannes Berg Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- sound/aoa/core/snd-aoa-gpio-feature.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'sound/aoa') diff --git a/sound/aoa/core/snd-aoa-gpio-feature.c b/sound/aoa/core/snd-aoa-gpio-feature.c index 7ae0c0bdfad8..f69d33357a28 100644 --- a/sound/aoa/core/snd-aoa-gpio-feature.c +++ b/sound/aoa/core/snd-aoa-gpio-feature.c @@ -112,7 +112,10 @@ static struct device_node *get_gpio(char *name, static void get_irq(struct device_node * np, int *irqptr) { - *irqptr = irq_of_parse_and_map(np, 0); + if (np) + *irqptr = irq_of_parse_and_map(np, 0); + else + *irqptr = NO_IRQ; } /* 0x4 is outenable, 0x1 is out, thus 4 or 5 */ @@ -322,7 +325,7 @@ static int ftr_set_notify(struct gpio_runtime *rt, return -EINVAL; } - if (irq == -1) + if (irq == NO_IRQ) return -ENODEV; mutex_lock(¬if->mutex); -- cgit v1.2.3 From 6e8331ac6973435b1e7604c30f2ad394035b46e1 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Tue, 25 Jul 2006 16:13:37 +0200 Subject: [ALSA] aoa: fix toonie codec This patch fixes the toonie codec to be actually usable. Signed-off-by: Johannes Berg Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- sound/aoa/codecs/snd-aoa-codec-toonie.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'sound/aoa') diff --git a/sound/aoa/codecs/snd-aoa-codec-toonie.c b/sound/aoa/codecs/snd-aoa-codec-toonie.c index bcc555647e79..3c7d1d8a9a6f 100644 --- a/sound/aoa/codecs/snd-aoa-codec-toonie.c +++ b/sound/aoa/codecs/snd-aoa-codec-toonie.c @@ -51,6 +51,13 @@ static struct transfer_info toonie_transfers[] = { {} }; +static int toonie_usable(struct codec_info_item *cii, + struct transfer_info *ti, + struct transfer_info *out) +{ + return 1; +} + #ifdef CONFIG_PM static int toonie_suspend(struct codec_info_item *cii, pm_message_t state) { @@ -69,6 +76,7 @@ static struct codec_info toonie_codec_info = { .sysclock_factor = 256, .bus_factor = 64, .owner = THIS_MODULE, + .usable = toonie_usable, #ifdef CONFIG_PM .suspend = toonie_suspend, .resume = toonie_resume, @@ -79,19 +87,20 @@ static int toonie_init_codec(struct aoa_codec *codec) { struct toonie *toonie = codec_to_toonie(codec); + /* nothing connected? what a joke! */ + if (toonie->codec.connected != 1) + return -ENOTCONN; + if (aoa_snd_device_new(SNDRV_DEV_LOWLEVEL, toonie, &ops)) { printk(KERN_ERR PFX "failed to create toonie snd device!\n"); return -ENODEV; } - /* nothing connected? what a joke! */ - if (toonie->codec.connected != 1) - return -ENOTCONN; - if (toonie->codec.soundbus_dev->attach_codec(toonie->codec.soundbus_dev, aoa_get_card(), &toonie_codec_info, toonie)) { printk(KERN_ERR PFX "error creating toonie pcm\n"); + snd_device_free(aoa_get_card(), toonie); return -ENODEV; } -- cgit v1.2.3 From be6a83dd668fb8578456b61d9e16a18d9bc37a65 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Tue, 25 Jul 2006 16:15:07 +0200 Subject: [ALSA] aoa: platform function gpio: ignore errors from functions that don't exist Sometimes we simply want to turn off or on everything, and when recently a warning was added when a certain platform function can't be called, this triggered all the time in those cases. This patch shows the warning only if the error was different from the function not existing. The alternative would be to not even try calling the function when it doesn't exist by first checking which exist and then only calling those that do, but that adds complexity that isn't necessary. Signed-off-by: Johannes Berg Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- sound/aoa/core/snd-aoa-gpio-pmf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound/aoa') diff --git a/sound/aoa/core/snd-aoa-gpio-pmf.c b/sound/aoa/core/snd-aoa-gpio-pmf.c index 3d57fd1aec4b..2836c3218391 100644 --- a/sound/aoa/core/snd-aoa-gpio-pmf.c +++ b/sound/aoa/core/snd-aoa-gpio-pmf.c @@ -18,7 +18,7 @@ static void pmf_gpio_set_##name(struct gpio_runtime *rt, int on)\ \ if (unlikely(!rt)) return; \ rc = pmf_call_function(rt->node, #name "-mute", &args); \ - if (rc) \ + if (rc && rc != -ENODEV) \ printk(KERN_WARNING "pmf_gpio_set_" #name \ " failed, rc: %d\n", rc); \ rt->implementation_private &= ~(1<