Skip to content

Commit

Permalink
ALSA: ASoC: Pass the DAI being configured into CPU DAI probe and remove
Browse files Browse the repository at this point in the history
This allows per-DAI initialisation to be done by the CPU DAI drivers.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
  • Loading branch information
Mark Brown authored and Jaroslav Kysela committed Jun 13, 2008
1 parent dbac7cb commit bdb9287
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 12 deletions.
6 changes: 4 additions & 2 deletions include/sound/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,10 @@ struct snd_soc_cpu_dai {
unsigned char type;

/* DAI callbacks */
int (*probe)(struct platform_device *pdev);
void (*remove)(struct platform_device *pdev);
int (*probe)(struct platform_device *pdev,
struct snd_soc_cpu_dai *dai);
void (*remove)(struct platform_device *pdev,
struct snd_soc_cpu_dai *dai);
int (*suspend)(struct platform_device *pdev,
struct snd_soc_cpu_dai *cpu_dai);
int (*resume)(struct platform_device *pdev,
Expand Down
6 changes: 4 additions & 2 deletions sound/soc/davinci/davinci-i2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,8 @@ static int davinci_i2s_trigger(struct snd_pcm_substream *substream, int cmd)
return ret;
}

static int davinci_i2s_probe(struct platform_device *pdev)
static int davinci_i2s_probe(struct platform_device *pdev,
struct snd_soc_cpu_dai *dai)
{
struct snd_soc_device *socdev = platform_get_drvdata(pdev);
struct snd_soc_machine *machine = socdev->machine;
Expand Down Expand Up @@ -356,7 +357,8 @@ static int davinci_i2s_probe(struct platform_device *pdev)
return ret;
}

static void davinci_i2s_remove(struct platform_device *pdev)
static void davinci_i2s_remove(struct platform_device *pdev,
struct snd_soc_cpu_dai *dai)
{
struct snd_soc_device *socdev = platform_get_drvdata(pdev);
struct snd_soc_machine *machine = socdev->machine;
Expand Down
3 changes: 2 additions & 1 deletion sound/soc/pxa/pxa2xx-ac97.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,8 @@ static int pxa2xx_ac97_resume(struct platform_device *pdev,
#define pxa2xx_ac97_resume NULL
#endif

static int pxa2xx_ac97_probe(struct platform_device *pdev)
static int pxa2xx_ac97_probe(struct platform_device *pdev,
struct snd_soc_cpu_dai *dai)
{
int ret;

Expand Down
3 changes: 2 additions & 1 deletion sound/soc/s3c24xx/s3c2412-i2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,8 @@ struct clk *s3c2412_get_iisclk(void)
EXPORT_SYMBOL_GPL(s3c2412_get_iisclk);


static int s3c2412_i2s_probe(struct platform_device *pdev)
static int s3c2412_i2s_probe(struct platform_device *pdev,
struct snd_soc_cpu_dai *dai)
{
DBG("Entered %s\n", __func__);

Expand Down
6 changes: 4 additions & 2 deletions sound/soc/s3c24xx/s3c2443-ac97.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ static struct s3c24xx_pcm_dma_params s3c2443_ac97_mic_mono_in = {
.dma_size = 4,
};

static int s3c2443_ac97_probe(struct platform_device *pdev)
static int s3c2443_ac97_probe(struct platform_device *pdev,
struct snd_soc_cpu_dai *dai)
{
int ret;
u32 ac_glbctrl;
Expand Down Expand Up @@ -260,7 +261,8 @@ static int s3c2443_ac97_probe(struct platform_device *pdev)
return ret;
}

static void s3c2443_ac97_remove(struct platform_device *pdev)
static void s3c2443_ac97_remove(struct platform_device *pdev,
struct snd_soc_cpu_dai *dai)
{
free_irq(IRQ_S3C244x_AC97, NULL);
clk_disable(s3c24xx_ac97.ac97_clk);
Expand Down
3 changes: 2 additions & 1 deletion sound/soc/s3c24xx/s3c24xx-i2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,8 @@ u32 s3c24xx_i2s_get_clockrate(void)
}
EXPORT_SYMBOL_GPL(s3c24xx_i2s_get_clockrate);

static int s3c24xx_i2s_probe(struct platform_device *pdev)
static int s3c24xx_i2s_probe(struct platform_device *pdev,
struct snd_soc_cpu_dai *dai)
{
DBG("Entered %s\n", __func__);

Expand Down
6 changes: 3 additions & 3 deletions sound/soc/soc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ static int soc_probe(struct platform_device *pdev)
for (i = 0; i < machine->num_links; i++) {
struct snd_soc_cpu_dai *cpu_dai = machine->dai_link[i].cpu_dai;
if (cpu_dai->probe) {
ret = cpu_dai->probe(pdev);
ret = cpu_dai->probe(pdev, cpu_dai);
if (ret < 0)
goto cpu_dai_err;
}
Expand Down Expand Up @@ -798,7 +798,7 @@ static int soc_probe(struct platform_device *pdev)
for (i--; i >= 0; i--) {
struct snd_soc_cpu_dai *cpu_dai = machine->dai_link[i].cpu_dai;
if (cpu_dai->remove)
cpu_dai->remove(pdev);
cpu_dai->remove(pdev, cpu_dai);
}

if (machine->remove)
Expand Down Expand Up @@ -827,7 +827,7 @@ static int soc_remove(struct platform_device *pdev)
for (i = 0; i < machine->num_links; i++) {
struct snd_soc_cpu_dai *cpu_dai = machine->dai_link[i].cpu_dai;
if (cpu_dai->remove)
cpu_dai->remove(pdev);
cpu_dai->remove(pdev, cpu_dai);
}

if (machine->remove)
Expand Down

0 comments on commit bdb9287

Please sign in to comment.