diff options
Diffstat (limited to 'sound/soc/fsl/mpc5200_psc_ac97.c')
| -rw-r--r-- | sound/soc/fsl/mpc5200_psc_ac97.c | 59 | 
1 files changed, 32 insertions, 27 deletions
diff --git a/sound/soc/fsl/mpc5200_psc_ac97.c b/sound/soc/fsl/mpc5200_psc_ac97.c index 40acc8e2b1c..24eafa2cfbf 100644 --- a/sound/soc/fsl/mpc5200_psc_ac97.c +++ b/sound/soc/fsl/mpc5200_psc_ac97.c @@ -131,13 +131,12 @@ static void psc_ac97_cold_reset(struct snd_ac97 *ac97)  	psc_ac97_warm_reset(ac97);  } -struct snd_ac97_bus_ops soc_ac97_ops = { +static struct snd_ac97_bus_ops psc_ac97_ops = {  	.read		= psc_ac97_read,  	.write		= psc_ac97_write,  	.reset		= psc_ac97_cold_reset,  	.warm_reset	= psc_ac97_warm_reset,  }; -EXPORT_SYMBOL_GPL(soc_ac97_ops);  static int psc_ac97_hw_analog_params(struct snd_pcm_substream *substream,  				 struct snd_pcm_hw_params *params, @@ -226,26 +225,29 @@ static int psc_ac97_probe(struct snd_soc_dai *cpu_dai)  /**   * psc_ac97_dai_template: template CPU Digital Audio Interface   */ -static struct snd_soc_dai_ops psc_ac97_analog_ops = { +static const struct snd_soc_dai_ops psc_ac97_analog_ops = {  	.hw_params	= psc_ac97_hw_analog_params,  	.trigger	= psc_ac97_trigger,  }; -static struct snd_soc_dai_ops psc_ac97_digital_ops = { +static const struct snd_soc_dai_ops psc_ac97_digital_ops = {  	.hw_params	= psc_ac97_hw_digital_params,  };  static struct snd_soc_dai_driver psc_ac97_dai[] = {  { +	.name = "mpc5200-psc-ac97.0",  	.ac97_control = 1,  	.probe	= psc_ac97_probe,  	.playback = { +		.stream_name	= "AC97 Playback",  		.channels_min   = 1,  		.channels_max   = 6,  		.rates          = SNDRV_PCM_RATE_8000_48000,  		.formats = SNDRV_PCM_FMTBIT_S32_BE,  	},  	.capture = { +		.stream_name	= "AC97 Capture",  		.channels_min   = 1,  		.channels_max   = 2,  		.rates          = SNDRV_PCM_RATE_8000_48000, @@ -254,8 +256,10 @@ static struct snd_soc_dai_driver psc_ac97_dai[] = {  	.ops = &psc_ac97_analog_ops,  },  { +	.name = "mpc5200-psc-ac97.1",  	.ac97_control = 1,  	.playback = { +		.stream_name	= "AC97 SPDIF",  		.channels_min   = 1,  		.channels_max   = 2,  		.rates          = SNDRV_PCM_RATE_32000 | \ @@ -265,6 +269,9 @@ static struct snd_soc_dai_driver psc_ac97_dai[] = {  	.ops = &psc_ac97_digital_ops,  } }; +static const struct snd_soc_component_driver psc_ac97_component = { +	.name		= DRV_NAME, +};  /* --------------------------------------------------------------------- @@ -272,14 +279,24 @@ static struct snd_soc_dai_driver psc_ac97_dai[] = {   * - Probe/remove operations   * - OF device match table   */ -static int __devinit psc_ac97_of_probe(struct platform_device *op, -				      const struct of_device_id *match) +static int psc_ac97_of_probe(struct platform_device *op)  {  	int rc;  	struct snd_ac97 ac97;  	struct mpc52xx_psc __iomem *regs; -	rc = snd_soc_register_dais(&op->dev, psc_ac97_dai, ARRAY_SIZE(psc_ac97_dai)); +	rc = mpc5200_audio_dma_create(op); +	if (rc != 0) +		return rc; + +	rc = snd_soc_set_ac97_ops(&psc_ac97_ops); +	if (rc != 0) { +		dev_err(&op->dev, "Failed to set AC'97 ops: %d\n", rc); +		return rc; +	} + +	rc = snd_soc_register_component(&op->dev, &psc_ac97_component, +					psc_ac97_dai, ARRAY_SIZE(psc_ac97_dai));  	if (rc != 0) {  		dev_err(&op->dev, "Failed to register DAI\n");  		return rc; @@ -302,23 +319,25 @@ static int __devinit psc_ac97_of_probe(struct platform_device *op,  	return 0;  } -static int __devexit psc_ac97_of_remove(struct platform_device *op) +static int psc_ac97_of_remove(struct platform_device *op)  { -	snd_soc_unregister_dais(&op->dev, ARRAY_SIZE(psc_ac97_dai)); +	mpc5200_audio_dma_destroy(op); +	snd_soc_unregister_component(&op->dev); +	snd_soc_set_ac97_ops(NULL);  	return 0;  }  /* Match table for of_platform binding */ -static struct of_device_id psc_ac97_match[] __devinitdata = { +static struct of_device_id psc_ac97_match[] = {  	{ .compatible = "fsl,mpc5200-psc-ac97", },  	{ .compatible = "fsl,mpc5200b-psc-ac97", },  	{}  };  MODULE_DEVICE_TABLE(of, psc_ac97_match); -static struct of_platform_driver psc_ac97_driver = { +static struct platform_driver psc_ac97_driver = {  	.probe = psc_ac97_of_probe, -	.remove = __devexit_p(psc_ac97_of_remove), +	.remove = psc_ac97_of_remove,  	.driver = {  		.name = "mpc5200-psc-ac97",  		.owner = THIS_MODULE, @@ -326,21 +345,7 @@ static struct of_platform_driver psc_ac97_driver = {  	},  }; -/* --------------------------------------------------------------------- - * Module setup and teardown; simply register the of_platform driver - * for the PSC in AC97 mode. - */ -static int __init psc_ac97_init(void) -{ -	return of_register_platform_driver(&psc_ac97_driver); -} -module_init(psc_ac97_init); - -static void __exit psc_ac97_exit(void) -{ -	of_unregister_platform_driver(&psc_ac97_driver); -} -module_exit(psc_ac97_exit); +module_platform_driver(psc_ac97_driver);  MODULE_AUTHOR("Jon Smirl <jonsmirl@gmail.com>");  MODULE_DESCRIPTION("mpc5200 AC97 module");  | 
