From: Marek Vasut <marek.vasut@gmail.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: alsa-devel@alsa-project.org,
Russell King - ARM Linux <linux@arm.linux.org.uk>,
Takashi Iwai <tiwai@suse.de>,
Robert Jarzmik <robert.jarzmik@free.fr>,
cbou@mail.ru, Eric Miao <eric.y.miao@gmail.com>,
avorontsov@ru.mvista.com, dwmw2@infradead.org,
linux-arm-kernel@lists.arm.linux.org.uk
Subject: Re: [PATCH 2/4] Allow passing platform_data for pxa2xx-ac97
Date: Thu, 30 Jul 2009 02:55:01 +0200 [thread overview]
Message-ID: <200907300255.01675.marek.vasut@gmail.com> (raw)
In-Reply-To: <200907280728.21372.marek.vasut@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1489 bytes --]
Dne Út 28. července 2009 07:28:20 Marek Vasut napsal(a):
> Dne Čt 23. července 2009 20:39:37 Marek Vasut napsal(a):
> > Dne Čt 23. července 2009 16:16:12 Marek Vasut napsal(a):
> > > Dne Čt 23. července 2009 12:27:41 Mark Brown napsal(a):
> > > > On Wed, Jul 22, 2009 at 01:02:40PM +0200, Marek Vasut wrote:
> > > > > struct snd_ac97_bus *ac97_bus;
> > > > > struct snd_ac97_template ac97_template;
> > > > > int ret;
> > > > > + pxa2xx_audio_ops_t *pdata = dev->dev.platform_data;
> > > > > + int id = dev->id < 0 ? 0 : dev->id;
> > > >
> > > > dev here is the AC97 controller device - if there's more than one
> > > > AC97 controller in the system they can each have the four child
> > > > devices. On the other hand, I don't think any of the PXA processors
> > > > have more than one AC97 controller so it'll never actually have any
> > > > impact.
> > > >
> > > > I think the best thing for now is to either warn if anything except
> > > > the primary codec has platform data or change the platform data to
> > > > have a variable something like primary_audio_pdata. The driver
> > > > doesn't appear to support secondary codecs anyway.
> > >
> > > Ok, here's a fixed patch.
> >
> > Argh, one more iteration here. There was a typo in the previous patch.
> > Sorry.
>
> Hi, well ... any updates ? Eric, is this patch ok with you ?
I made one more revision here as in case the platform_data aren't supplied,
the kernel obviously crashes.
[-- Attachment #2: 0001-Allow-passing-platform_data-for-pxa2xx-ac97.patch --]
[-- Type: text/x-patch, Size: 4083 bytes --]
From 207d54244768e94ce0144cba55acf4ae065e6ce0 Mon Sep 17 00:00:00 2001
From: Marek Vasut <marek.vasut@gmail.com>
Date: Tue, 21 Jul 2009 16:22:29 +0200
Subject: [PATCH] Allow passing platform_data for pxa2xx-ac97
This patch adds support for passing platform data to ac97 bus devices
from PXA2xx-AC97 driver..
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
---
arch/arm/mach-pxa/include/mach/audio.h | 3 +++
include/sound/ac97_codec.h | 3 +++
sound/arm/pxa2xx-ac97.c | 10 ++++++++++
sound/soc/pxa/pxa2xx-ac97.c | 12 +++++++++++-
4 files changed, 27 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-pxa/include/mach/audio.h b/arch/arm/mach-pxa/include/mach/audio.h
index 16eb025..a3449e3 100644
--- a/arch/arm/mach-pxa/include/mach/audio.h
+++ b/arch/arm/mach-pxa/include/mach/audio.h
@@ -3,10 +3,12 @@
#include <sound/core.h>
#include <sound/pcm.h>
+#include <sound/ac97_codec.h>
/*
* @reset_gpio: AC97 reset gpio (normally gpio113 or gpio95)
* a -1 value means no gpio will be used for reset
+ * @codec_pdata: AC97 codec platform_data
* reset_gpio should only be specified for pxa27x CPUs where a silicon
* bug prevents correct operation of the reset line. If not specified,
@@ -20,6 +22,7 @@ typedef struct {
void (*resume)(void *);
void *priv;
int reset_gpio;
+ void *codec_pdata[AC97_BUS_MAX_DEVICES];
} pxa2xx_audio_ops_t;
extern void pxa_set_ac97_info(pxa2xx_audio_ops_t *ops);
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h
index 9b1c098..3dae3f7 100644
--- a/include/sound/ac97_codec.h
+++ b/include/sound/ac97_codec.h
@@ -32,6 +32,9 @@
#include "control.h"
#include "info.h"
+/* maximum number of devices on the AC97 bus */
+#define AC97_BUS_MAX_DEVICES 4
+
/*
* AC'97 codec registers
*/
diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c
index c570ebd..6c00ea4 100644
--- a/sound/arm/pxa2xx-ac97.c
+++ b/sound/arm/pxa2xx-ac97.c
@@ -170,6 +170,13 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)
struct snd_ac97_bus *ac97_bus;
struct snd_ac97_template ac97_template;
int ret;
+ pxa2xx_audio_ops_t *pdata = dev->dev.platform_data;
+
+ if (dev->id >= 0) {
+ dev_err(&dev->dev, "PXA2xx has only one AC97 port.\n");
+ ret = -ENXIO;
+ goto err_dev;
+ }
ret = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
THIS_MODULE, 0, &card);
@@ -200,6 +207,8 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)
snprintf(card->longname, sizeof(card->longname),
"%s (%s)", dev->dev.driver->name, card->mixername);
+ if (pdata && pdata->codec_data)
+ snd_ac97_dev_add_pdata(ac97_bus->codec[0], pdata->codec_pdata);
snd_card_set_dev(card, &dev->dev);
ret = snd_card_register(card);
if (ret == 0) {
@@ -212,6 +221,7 @@ err_remove:
err:
if (card)
snd_card_free(card);
+err_dev:
return ret;
}
diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c
index d9c94d7..7330e5c 100644
--- a/sound/soc/pxa/pxa2xx-ac97.c
+++ b/sound/soc/pxa/pxa2xx-ac97.c
@@ -22,6 +22,7 @@
#include <mach/hardware.h>
#include <mach/regs-ac97.h>
#include <mach/dma.h>
+#include <mach/audio.h>
#include "pxa2xx-pcm.h"
#include "pxa2xx-ac97.h"
@@ -241,9 +242,18 @@ EXPORT_SYMBOL_GPL(soc_ac97_ops);
static int __devinit pxa2xx_ac97_dev_probe(struct platform_device *pdev)
{
int i;
+ pxa2xx_audio_ops_t *pdata = pdev->dev.platform_data;
- for (i = 0; i < ARRAY_SIZE(pxa_ac97_dai); i++)
+ if (pdev->id >= 0) {
+ dev_err(&pdev->dev, "PXA2xx has only one AC97 port.\n");
+ return -ENXIO;
+ }
+
+ for (i = 0; i < ARRAY_SIZE(pxa_ac97_dai); i++) {
pxa_ac97_dai[i].dev = &pdev->dev;
+ if (pdata && pdata->codec_pdata)
+ pxa_ac97_dai[i].ac97_pdata = pdata->codec_pdata;
+ }
/* Punt most of the init to the SoC probe; we may need the machine
* driver to do interesting things with the clocking to get us up
--
1.6.3.3
[-- 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
next prev parent reply other threads:[~2009-07-30 0:55 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-21 14:33 [PATCH] Allow passing platform_data to devices attached to AC97 bus Marek Vasut
2009-07-21 14:50 ` Takashi Iwai
2009-07-21 14:53 ` Mark Brown
2009-07-21 15:16 ` Takashi Iwai
2009-07-21 15:40 ` Marek Vasut
2009-07-21 18:30 ` Mark Brown
2009-07-21 19:51 ` Marek Vasut
2009-07-22 10:40 ` Mark Brown
2009-07-22 10:59 ` [PATCH 1/4] " Marek Vasut
2009-07-23 10:16 ` Mark Brown
2009-07-23 10:28 ` Takashi Iwai
2009-07-23 10:31 ` Mark Brown
2009-07-21 20:24 ` [PATCH] " Marek Vasut
2009-07-21 20:59 ` Takashi Iwai
2009-07-21 21:53 ` Marek Vasut
2009-07-21 22:13 ` Marek Vasut
2009-07-21 22:33 ` Russell King - ARM Linux
2009-07-21 22:39 ` Marek Vasut
2009-07-21 22:40 ` Marek Vasut
2009-07-21 22:34 ` Anton Vorontsov
2009-07-21 22:43 ` Marek Vasut
2009-07-22 11:01 ` [PATCH 1/4] " Marek Vasut
2009-07-22 11:02 ` [PATCH 2/4] Allow passing platform_data for pxa2xx-ac97 Marek Vasut
2009-07-23 10:27 ` Mark Brown
2009-07-23 14:16 ` Marek Vasut
2009-07-23 15:14 ` Mark Brown
2009-07-23 18:39 ` Marek Vasut
2009-07-28 5:28 ` Marek Vasut
2009-07-30 0:55 ` Marek Vasut [this message]
2009-08-13 20:40 ` Mark Brown
2009-08-13 23:34 ` Marek Vasut
2009-08-13 23:42 ` Anton Vorontsov
2009-08-14 8:57 ` Mark Brown
2009-07-22 11:04 ` [PATCH 3/4] Convert WM97xx driver to use platform_data Marek Vasut
2009-07-23 11:49 ` Mark Brown
2009-07-24 19:44 ` Robert Jarzmik
2009-07-24 21:03 ` Marek Vasut
2009-07-22 11:05 ` [PATCH 4/4] Convert all platforms to pass platform_data to wm97xx battery Marek Vasut
2009-07-22 18:09 ` Robert Jarzmik
2009-07-22 18:30 ` Marek Vasut
2009-07-25 20:55 ` Robert Jarzmik
2009-07-27 0:06 ` Marek Vasut
2009-07-21 20:25 ` [PATCH] Allow passing platform_data to devices attached to AC97 bus Marek Vasut
2009-07-21 15:41 ` Marek Vasut
2009-07-21 17:40 ` Marek Vasut
2009-07-21 18:27 ` Mark Brown
2009-07-21 18:38 ` Mark Brown
2009-07-21 17:42 ` Marek Vasut
2009-07-21 18:18 ` Marek Vasut
2009-07-21 15:11 ` Robert Jarzmik
2009-07-21 15:17 ` Takashi Iwai
2009-07-25 20:56 ` Robert Jarzmik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200907300255.01675.marek.vasut@gmail.com \
--to=marek.vasut@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=avorontsov@ru.mvista.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=cbou@mail.ru \
--cc=dwmw2@infradead.org \
--cc=eric.y.miao@gmail.com \
--cc=linux-arm-kernel@lists.arm.linux.org.uk \
--cc=linux@arm.linux.org.uk \
--cc=robert.jarzmik@free.fr \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox