Chaithrika U S | be461ba | 2009-05-28 05:10:50 -0400 | [diff] [blame] | 1 | /* |
| 2 | * ALSA SoC SPDIF DIT driver |
| 3 | * |
| 4 | * This driver is used by controllers which can operate in DIT (SPDI/F) where |
| 5 | * no codec is needed. This file provides stub codec that can be used |
| 6 | * in these configurations. TI DaVinci Audio controller uses this driver. |
| 7 | * |
| 8 | * Author: Steve Chen, <schen@mvista.com> |
| 9 | * Copyright: (C) 2009 MontaVista Software, Inc., <source@mvista.com> |
| 10 | * Copyright: (C) 2009 Texas Instruments, India |
| 11 | * |
| 12 | * This program is free software; you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License version 2 as |
| 14 | * published by the Free Software Foundation. |
| 15 | */ |
| 16 | |
| 17 | #include <linux/module.h> |
| 18 | #include <linux/moduleparam.h> |
Mark Brown | 37a5ddf | 2010-05-31 13:47:26 +0100 | [diff] [blame] | 19 | #include <linux/slab.h> |
Chaithrika U S | be461ba | 2009-05-28 05:10:50 -0400 | [diff] [blame] | 20 | #include <sound/soc.h> |
| 21 | #include <sound/pcm.h> |
Seungwhan Youn | 3a64291 | 2010-05-27 18:13:48 +0900 | [diff] [blame] | 22 | #include <sound/initval.h> |
Chaithrika U S | be461ba | 2009-05-28 05:10:50 -0400 | [diff] [blame] | 23 | |
Stephen Warren | 6ae759e | 2011-05-19 17:44:46 -0600 | [diff] [blame] | 24 | #define DRV_NAME "spdif-dit" |
Kevin Hilman | 0a0cf58 | 2009-07-13 14:50:40 -0700 | [diff] [blame] | 25 | |
Chaithrika U S | be461ba | 2009-05-28 05:10:50 -0400 | [diff] [blame] | 26 | #define STUB_RATES SNDRV_PCM_RATE_8000_96000 |
| 27 | #define STUB_FORMATS SNDRV_PCM_FMTBIT_S16_LE |
| 28 | |
Seungwhan Youn | 3a64291 | 2010-05-27 18:13:48 +0900 | [diff] [blame] | 29 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 30 | static struct snd_soc_codec_driver soc_codec_spdif_dit; |
Seungwhan Youn | 3a64291 | 2010-05-27 18:13:48 +0900 | [diff] [blame] | 31 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 32 | static struct snd_soc_dai_driver dit_stub_dai = { |
| 33 | .name = "dit-hifi", |
Chaithrika U S | be461ba | 2009-05-28 05:10:50 -0400 | [diff] [blame] | 34 | .playback = { |
| 35 | .stream_name = "Playback", |
| 36 | .channels_min = 1, |
| 37 | .channels_max = 384, |
| 38 | .rates = STUB_RATES, |
| 39 | .formats = STUB_FORMATS, |
| 40 | }, |
| 41 | }; |
| 42 | |
| 43 | static int spdif_dit_probe(struct platform_device *pdev) |
| 44 | { |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 45 | return snd_soc_register_codec(&pdev->dev, &soc_codec_spdif_dit, |
| 46 | &dit_stub_dai, 1); |
Chaithrika U S | be461ba | 2009-05-28 05:10:50 -0400 | [diff] [blame] | 47 | } |
| 48 | |
| 49 | static int spdif_dit_remove(struct platform_device *pdev) |
| 50 | { |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 51 | snd_soc_unregister_codec(&pdev->dev); |
Chaithrika U S | be461ba | 2009-05-28 05:10:50 -0400 | [diff] [blame] | 52 | return 0; |
| 53 | } |
| 54 | |
| 55 | static struct platform_driver spdif_dit_driver = { |
| 56 | .probe = spdif_dit_probe, |
| 57 | .remove = spdif_dit_remove, |
| 58 | .driver = { |
Stephen Warren | 6ae759e | 2011-05-19 17:44:46 -0600 | [diff] [blame] | 59 | .name = DRV_NAME, |
Chaithrika U S | be461ba | 2009-05-28 05:10:50 -0400 | [diff] [blame] | 60 | .owner = THIS_MODULE, |
| 61 | }, |
| 62 | }; |
| 63 | |
| 64 | static int __init dit_modinit(void) |
| 65 | { |
| 66 | return platform_driver_register(&spdif_dit_driver); |
| 67 | } |
| 68 | |
| 69 | static void __exit dit_exit(void) |
| 70 | { |
| 71 | platform_driver_unregister(&spdif_dit_driver); |
| 72 | } |
| 73 | |
| 74 | module_init(dit_modinit); |
| 75 | module_exit(dit_exit); |
| 76 | |
Stephen Warren | 6ae759e | 2011-05-19 17:44:46 -0600 | [diff] [blame] | 77 | MODULE_AUTHOR("Steve Chen <schen@mvista.com>"); |
| 78 | MODULE_DESCRIPTION("SPDIF dummy codec driver"); |
| 79 | MODULE_LICENSE("GPL"); |
| 80 | MODULE_ALIAS("platform:" DRV_NAME); |