[PATCH 1/4] Allow passing platform_data to devices attached to AC97 bus

Marek Vasut
2009-07-22T10:59:32Z

[-- Attachment #1: Type: text/plain, Size: 447 bytes --]

Dne St 22. července 2009 12:40:29 Mark Brown napsal(a):
> On Tue, Jul 21, 2009 at 09:51:05PM +0200, Marek Vasut wrote:
> > Ok, this one should be better then? Mark, thanks for guiding me :-)
>
> There's so many patches flying around here that I've completely lost
> track of what the current state of play is. Could you please repost as
> a new patch series, ideally as a normal submission with meaningful per
> patch subject headers.

[-- Attachment #2: 0001-Allow-passing-platform_data-to-devices-attached-to-A.patch --]
[-- Type: text/x-patch, Size: 2332 bytes --]

From 5ed7859b282c23c2f98167ef3f821625ee8907aa 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 1/4] Allow passing platform_data to devices attached to AC97 bus

This patch allows passing platform_data to devices attached to AC97 bus
(like touchscreens, battery measurement chips ...).

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
---
include/sound/ac97_codec.h | 6 ++++++
include/sound/soc-dai.h | 1 +
sound/soc/soc-core.c | 6 +++++-
3 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h
index 251fc1c..9b1c098 100644
--- a/include/sound/ac97_codec.h
+++ b/include/sound/ac97_codec.h
@@ -642,4 +642,10 @@ int snd_ac97_pcm_double_rate_rules(struct snd_pcm_runtime *runtime);
/* ad hoc AC97 device driver access */
extern struct bus_type ac97_bus_type;

+/* AC97 platform_data adding function */
+static inline void snd_ac97_dev_add_pdata(struct snd_ac97 *ac97, void *data)
+{
+ ac97->dev.platform_data = data;
+}
+
#endif /* __SOUND_AC97_CODEC_H */
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index 352d7ee..0d65a03 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -179,6 +179,7 @@ struct snd_soc_dai {
int ac97_control;

struct device *dev;
+ void *ac97_pdata; /* platform_data for the ac97 codec */

/* DAI callbacks */
int (*probe)(struct platform_device *pdev,
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 1d70829..7cb0917 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -28,6 +28,7 @@
#include <linux/bitops.h>
#include <linux/debugfs.h>
#include <linux/platform_device.h>
+#include <sound/ac97_codec.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
@@ -1381,8 +1382,11 @@ int snd_soc_init_card(struct snd_soc_device *socdev)
continue;
}
}
- if (card->dai_link[i].codec_dai->ac97_control)
+ if (card->dai_link[i].codec_dai->ac97_control) {
ac97 = 1;
+ snd_ac97_dev_add_pdata(codec->ac97,
+ card->dai_link[i].cpu_dai->ac97_pdata);
+ }
}
snprintf(codec->card->shortname, sizeof(codec->card->shortname),
"%s", card->name);
--
1.6.3.3

[-- Attachment #3: Type: text/plain, Size: 160 bytes --]