Commit 474828a4 authored by Marek Vasut's avatar Marek Vasut Committed by Mark Brown

ALSA: 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: default avatarMarek Vasut <marek.vasut@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent a7569afa
...@@ -642,4 +642,10 @@ int snd_ac97_pcm_double_rate_rules(struct snd_pcm_runtime *runtime); ...@@ -642,4 +642,10 @@ int snd_ac97_pcm_double_rate_rules(struct snd_pcm_runtime *runtime);
/* ad hoc AC97 device driver access */ /* ad hoc AC97 device driver access */
extern struct bus_type ac97_bus_type; 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 */ #endif /* __SOUND_AC97_CODEC_H */
...@@ -179,6 +179,7 @@ struct snd_soc_dai { ...@@ -179,6 +179,7 @@ struct snd_soc_dai {
int ac97_control; int ac97_control;
struct device *dev; struct device *dev;
void *ac97_pdata; /* platform_data for the ac97 codec */
/* DAI callbacks */ /* DAI callbacks */
int (*probe)(struct platform_device *pdev, int (*probe)(struct platform_device *pdev,
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <sound/ac97_codec.h>
#include <sound/core.h> #include <sound/core.h>
#include <sound/pcm.h> #include <sound/pcm.h>
#include <sound/pcm_params.h> #include <sound/pcm_params.h>
...@@ -1461,8 +1462,11 @@ int snd_soc_init_card(struct snd_soc_device *socdev) ...@@ -1461,8 +1462,11 @@ int snd_soc_init_card(struct snd_soc_device *socdev)
continue; continue;
} }
} }
if (card->dai_link[i].codec_dai->ac97_control) if (card->dai_link[i].codec_dai->ac97_control) {
ac97 = 1; 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), snprintf(codec->card->shortname, sizeof(codec->card->shortname),
"%s", card->name); "%s", card->name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment