diff options
| -rw-r--r-- | sound/soc/omap/omap-pcm.c | 21 |
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 | ||
| 42 | static const struct snd_pcm_hardware omap_pcm_hardware = { | 42 | static 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. */ | ||
| 57 | static 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 */ |
| 57 | static int omap_pcm_hw_params(struct snd_pcm_substream *substream, | 75 | static 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 | ||
| 236 | int omap_pcm_platform_register(struct device *dev) | 254 | int 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 | } |
| 240 | EXPORT_SYMBOL_GPL(omap_pcm_platform_register); | 259 | EXPORT_SYMBOL_GPL(omap_pcm_platform_register); |
