* Palm27x-asoc: fix it to work without jack gpio specified
@ 2009-06-01 20:30 Marek Vasut
2009-06-01 22:58 ` Mark Brown
0 siblings, 1 reply; 4+ messages in thread
From: Marek Vasut @ 2009-06-01 20:30 UTC (permalink / raw)
To: alsa-devel, Mark Brown
[-- Attachment #1: Type: text/plain, Size: 93 bytes --]
Hi,
the patch follows. The problem was with palmz72 which doesn't have the jack
detection.
[-- Attachment #2: 0001-Palm27x-aSoC-Make-it-work-without-jack-GPIO-specifi.patch --]
[-- Type: text/x-diff, Size: 2533 bytes --]
From 4b569013e47b03199d7efda812cb329736723f0a Mon Sep 17 00:00:00 2001
From: Marek Vasut <marek.vasut@gmail.com>
Date: Mon, 1 Jun 2009 17:57:15 +0200
Subject: [PATCH 1/2] Palm27x-aSoC: Make it work without jack GPIO specified
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
---
sound/soc/pxa/palm27x.c | 41 +++++++++++++++++++++--------------------
1 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/sound/soc/pxa/palm27x.c b/sound/soc/pxa/palm27x.c
index e6102fd..628e13e 100644
--- a/sound/soc/pxa/palm27x.c
+++ b/sound/soc/pxa/palm27x.c
@@ -204,25 +204,22 @@ static int palm27x_asoc_probe(struct platform_device *pdev)
{
int ret;
- if (!(machine_is_palmtx() || machine_is_palmt5() ||
- machine_is_palmld() || machine_is_palmte2()))
- return -ENODEV;
-
- if (pdev->dev.platform_data)
+ if (pdev->dev.platform_data) {
palm27x_ep_gpio = ((struct palm27x_asoc_info *)
(pdev->dev.platform_data))->jack_gpio;
- ret = gpio_request(palm27x_ep_gpio, "Headphone Jack");
- if (ret)
- return ret;
- ret = gpio_direction_input(palm27x_ep_gpio);
- if (ret)
- goto err_alloc;
-
- if (request_irq(gpio_to_irq(palm27x_ep_gpio), palm27x_interrupt,
- IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
- "Headphone jack", NULL))
- goto err_alloc;
+ ret = gpio_request(palm27x_ep_gpio, "Headphone Jack");
+ if (ret)
+ return ret;
+ ret = gpio_direction_input(palm27x_ep_gpio);
+ if (ret)
+ goto err_alloc;
+
+ if (request_irq(gpio_to_irq(palm27x_ep_gpio), palm27x_interrupt,
+ IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
+ "Headphone jack", NULL))
+ goto err_alloc;
+ }
palm27x_snd_device = platform_device_alloc("soc-audio", -1);
if (!palm27x_snd_device) {
@@ -242,17 +239,21 @@ static int palm27x_asoc_probe(struct platform_device *pdev)
put_device:
platform_device_put(palm27x_snd_device);
err_dev:
- free_irq(gpio_to_irq(palm27x_ep_gpio), NULL);
+ if (pdev->dev.platform_data)
+ free_irq(gpio_to_irq(palm27x_ep_gpio), NULL);
err_alloc:
- gpio_free(palm27x_ep_gpio);
+ if (pdev->dev.platform_data)
+ gpio_free(palm27x_ep_gpio);
return ret;
}
static int __devexit palm27x_asoc_remove(struct platform_device *pdev)
{
- free_irq(gpio_to_irq(palm27x_ep_gpio), NULL);
- gpio_free(palm27x_ep_gpio);
+ if (pdev->dev.platform_data) {
+ free_irq(gpio_to_irq(palm27x_ep_gpio), NULL);
+ gpio_free(palm27x_ep_gpio);
+ }
platform_device_unregister(palm27x_snd_device);
return 0;
}
--
1.6.2.1
[-- Attachment #3: Type: text/plain, Size: 160 bytes --]
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: Palm27x-asoc: fix it to work without jack gpio specified
2009-06-01 20:30 Palm27x-asoc: fix it to work without jack gpio specified Marek Vasut
@ 2009-06-01 22:58 ` Mark Brown
2009-06-02 0:11 ` Marek Vasut
0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2009-06-01 22:58 UTC (permalink / raw)
To: Marek Vasut; +Cc: alsa-devel
On Mon, Jun 01, 2009 at 10:30:58PM +0200, Marek Vasut wrote:
> - if (!(machine_is_palmtx() || machine_is_palmt5() ||
> - machine_is_palmld() || machine_is_palmte2()))
> - return -ENODEV;
> -
> - if (pdev->dev.platform_data)
These machine_is_() checks don't get re-added elsehwere (and it looks
like you generated the diff against a different verison of the file to
the one that's in ALSA git). It'd be better to keep them here and just
add the { to the platform_data check.
Otherwise this is fine.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: Palm27x-asoc: fix it to work without jack gpio specified
2009-06-01 22:58 ` Mark Brown
@ 2009-06-02 0:11 ` Marek Vasut
2009-06-02 9:48 ` Mark Brown
0 siblings, 1 reply; 4+ messages in thread
From: Marek Vasut @ 2009-06-02 0:11 UTC (permalink / raw)
To: Mark Brown; +Cc: alsa-devel
On Tuesday 02 of June 2009 00:58:44 Mark Brown wrote:
> On Mon, Jun 01, 2009 at 10:30:58PM +0200, Marek Vasut wrote:
> > - if (!(machine_is_palmtx() || machine_is_palmt5() ||
> > - machine_is_palmld() || machine_is_palmte2()))
> > - return -ENODEV;
> > -
> > - if (pdev->dev.platform_data)
>
> These machine_is_() checks don't get re-added elsehwere (and it looks
> like you generated the diff against a different verison of the file to
> the one that's in ALSA git). It'd be better to keep them here and just
> add the { to the platform_data check.
But do we need those checks? The driver is registered only on those machines
anyway.
>
> Otherwise this is fine.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: Palm27x-asoc: fix it to work without jack gpio specified
2009-06-02 0:11 ` Marek Vasut
@ 2009-06-02 9:48 ` Mark Brown
0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2009-06-02 9:48 UTC (permalink / raw)
To: Marek Vasut; +Cc: alsa-devel
On Tue, Jun 02, 2009 at 02:11:46AM +0200, Marek Vasut wrote:
> On Tuesday 02 of June 2009 00:58:44 Mark Brown wrote:
> > These machine_is_() checks don't get re-added elsehwere (and it looks
> > like you generated the diff against a different verison of the file to
> > the one that's in ALSA git). It'd be better to keep them here and just
> > add the { to the platform_data check.
> But do we need those checks? The driver is registered only on those machines
> anyway.
Yes, they're not needed since it's a platform driver - that's not
obvious when looking at the context diffs (this is one of those cases
where explaining what you're doing in the changelog helps!).
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-06-02 9:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-01 20:30 Palm27x-asoc: fix it to work without jack gpio specified Marek Vasut
2009-06-01 22:58 ` Mark Brown
2009-06-02 0:11 ` Marek Vasut
2009-06-02 9:48 ` Mark Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.