aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJyri Sarha <jsarha@ti.com>2015-03-03 06:28:53 -0500
committerMark Brown <broonie@kernel.org>2015-03-04 12:28:51 -0500
commit6742e15cf92a8dc3065843a627952ed518e08267 (patch)
treeff6239cae1bbae936de8f27a65254b46bcc27cb4
parent5163c1eede8e9073e5b6bf1a988ed07d35820343 (diff)
ASoC: omap-pcm: Allow only formats with 1, 2, and 4 byte physical size
sDMA support only transfer elements with 1, 2, and 4 byte physical size. Initialize the pcm driver accordingly. Signed-off-by: Jyri Sarha <jsarha@ti.com> Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/omap/omap-pcm.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c
index f4b05bc23e4b..e49ee2383a88 100644
--- a/sound/soc/omap/omap-pcm.c
+++ b/sound/soc/omap/omap-pcm.c
@@ -39,7 +39,7 @@
39#define pcm_omap1510() 0 39#define pcm_omap1510() 0
40#endif 40#endif
41 41
42static const struct snd_pcm_hardware omap_pcm_hardware = { 42static struct snd_pcm_hardware omap_pcm_hardware = {
43 .info = SNDRV_PCM_INFO_MMAP | 43 .info = SNDRV_PCM_INFO_MMAP |
44 SNDRV_PCM_INFO_MMAP_VALID | 44 SNDRV_PCM_INFO_MMAP_VALID |
45 SNDRV_PCM_INFO_INTERLEAVED | 45 SNDRV_PCM_INFO_INTERLEAVED |
@@ -53,6 +53,24 @@ static const struct snd_pcm_hardware omap_pcm_hardware = {
53 .buffer_bytes_max = 128 * 1024, 53 .buffer_bytes_max = 128 * 1024,
54}; 54};
55 55
56/* sDMA supports only 1, 2, and 4 byte transfer elements. */
57static void omap_pcm_limit_supported_formats(void)
58{
59 int i;
60
61 for (i = 0; i < SNDRV_PCM_FORMAT_LAST; i++) {
62 switch (snd_pcm_format_physical_width(i)) {
63 case 8:
64 case 16:
65 case 32:
66 omap_pcm_hardware.formats |= (1LL << i);
67 break;
68 default:
69 break;
70 }
71 }
72}
73
56/* this may get called several times by oss emulation */ 74/* this may get called several times by oss emulation */
57static int omap_pcm_hw_params(struct snd_pcm_substream *substream, 75static int omap_pcm_hw_params(struct snd_pcm_substream *substream,
58 struct snd_pcm_hw_params *params) 76 struct snd_pcm_hw_params *params)
@@ -235,6 +253,7 @@ static struct snd_soc_platform_driver omap_soc_platform = {
235 253
236int omap_pcm_platform_register(struct device *dev) 254int omap_pcm_platform_register(struct device *dev)
237{ 255{
256 omap_pcm_limit_supported_formats();
238 return devm_snd_soc_register_platform(dev, &omap_soc_platform); 257 return devm_snd_soc_register_platform(dev, &omap_soc_platform);
239} 258}
240EXPORT_SYMBOL_GPL(omap_pcm_platform_register); 259EXPORT_SYMBOL_GPL(omap_pcm_platform_register);