| OLD | NEW |
| 1 /* | 1 /* |
| 2 * tegra_pcm.c - Tegra PCM driver | 2 * tegra_pcm.c - Tegra PCM driver |
| 3 * | 3 * |
| 4 * Author: Stephen Warren <swarren@nvidia.com> | 4 * Author: Stephen Warren <swarren@nvidia.com> |
| 5 * Copyright (C) 2010 - NVIDIA, Inc. | 5 * Copyright (C) 2010 - NVIDIA, Inc. |
| 6 * | 6 * |
| 7 * Based on code copyright/by: | 7 * Based on code copyright/by: |
| 8 * | 8 * |
| 9 * Copyright (c) 2009-2010, NVIDIA Corporation. | 9 * Copyright (c) 2009-2010, NVIDIA Corporation. |
| 10 * Scott Peterson <speterson@nvidia.com> | 10 * Scott Peterson <speterson@nvidia.com> |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include <linux/module.h> | 32 #include <linux/module.h> |
| 33 #include <linux/dma-mapping.h> | 33 #include <linux/dma-mapping.h> |
| 34 #include <linux/slab.h> | 34 #include <linux/slab.h> |
| 35 #include <sound/core.h> | 35 #include <sound/core.h> |
| 36 #include <sound/pcm.h> | 36 #include <sound/pcm.h> |
| 37 #include <sound/pcm_params.h> | 37 #include <sound/pcm_params.h> |
| 38 #include <sound/soc.h> | 38 #include <sound/soc.h> |
| 39 | 39 |
| 40 #include "tegra_pcm.h" | 40 #include "tegra_pcm.h" |
| 41 | 41 |
| 42 #define DRV_NAME "tegra-pcm-audio" |
| 43 |
| 42 static const struct snd_pcm_hardware tegra_pcm_hardware = { | 44 static const struct snd_pcm_hardware tegra_pcm_hardware = { |
| 43 .info = SNDRV_PCM_INFO_MMAP | | 45 .info = SNDRV_PCM_INFO_MMAP | |
| 44 SNDRV_PCM_INFO_MMAP_VALID | | 46 SNDRV_PCM_INFO_MMAP_VALID | |
| 45 SNDRV_PCM_INFO_PAUSE | | 47 SNDRV_PCM_INFO_PAUSE | |
| 46 SNDRV_PCM_INFO_RESUME | | 48 SNDRV_PCM_INFO_RESUME | |
| 47 SNDRV_PCM_INFO_INTERLEAVED, | 49 SNDRV_PCM_INFO_INTERLEAVED, |
| 48 .formats = SNDRV_PCM_FMTBIT_S16_LE, | 50 .formats = SNDRV_PCM_FMTBIT_S16_LE, |
| 49 .channels_min = 2, | 51 .channels_min = 2, |
| 50 .channels_max = 2, | 52 .channels_max = 2, |
| 51 .period_bytes_min = 1024, | 53 .period_bytes_min = 1024, |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 } | 258 } |
| 257 | 259 |
| 258 static snd_pcm_uframes_t tegra_pcm_pointer(struct snd_pcm_substream *substream) | 260 static snd_pcm_uframes_t tegra_pcm_pointer(struct snd_pcm_substream *substream) |
| 259 { | 261 { |
| 260 struct snd_pcm_runtime *runtime = substream->runtime; | 262 struct snd_pcm_runtime *runtime = substream->runtime; |
| 261 struct tegra_runtime_data *prtd = runtime->private_data; | 263 struct tegra_runtime_data *prtd = runtime->private_data; |
| 262 | 264 |
| 263 return prtd->period_index * runtime->period_size; | 265 return prtd->period_index * runtime->period_size; |
| 264 } | 266 } |
| 265 | 267 |
| 268 |
| 266 static int tegra_pcm_mmap(struct snd_pcm_substream *substream, | 269 static int tegra_pcm_mmap(struct snd_pcm_substream *substream, |
| 267 struct vm_area_struct *vma) | 270 struct vm_area_struct *vma) |
| 268 { | 271 { |
| 269 struct snd_pcm_runtime *runtime = substream->runtime; | 272 struct snd_pcm_runtime *runtime = substream->runtime; |
| 270 | 273 |
| 271 return dma_mmap_writecombine(substream->pcm->card->dev, vma, | 274 return dma_mmap_writecombine(substream->pcm->card->dev, vma, |
| 272 runtime->dma_area, | 275 runtime->dma_area, |
| 273 runtime->dma_addr, | 276 runtime->dma_addr, |
| 274 runtime->dma_bytes); | 277 runtime->dma_bytes); |
| 275 } | 278 } |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 } | 372 } |
| 370 | 373 |
| 371 static int __devexit tegra_pcm_platform_remove(struct platform_device *pdev) | 374 static int __devexit tegra_pcm_platform_remove(struct platform_device *pdev) |
| 372 { | 375 { |
| 373 snd_soc_unregister_platform(&pdev->dev); | 376 snd_soc_unregister_platform(&pdev->dev); |
| 374 return 0; | 377 return 0; |
| 375 } | 378 } |
| 376 | 379 |
| 377 static struct platform_driver tegra_pcm_driver = { | 380 static struct platform_driver tegra_pcm_driver = { |
| 378 .driver = { | 381 .driver = { |
| 379 » » .name = "tegra-pcm-audio", | 382 » » .name = DRV_NAME, |
| 380 .owner = THIS_MODULE, | 383 .owner = THIS_MODULE, |
| 381 }, | 384 }, |
| 382 .probe = tegra_pcm_platform_probe, | 385 .probe = tegra_pcm_platform_probe, |
| 383 .remove = __devexit_p(tegra_pcm_platform_remove), | 386 .remove = __devexit_p(tegra_pcm_platform_remove), |
| 384 }; | 387 }; |
| 385 | 388 |
| 386 static int __init snd_tegra_pcm_init(void) | 389 static int __init snd_tegra_pcm_init(void) |
| 387 { | 390 { |
| 388 return platform_driver_register(&tegra_pcm_driver); | 391 return platform_driver_register(&tegra_pcm_driver); |
| 389 } | 392 } |
| 390 module_init(snd_tegra_pcm_init); | 393 module_init(snd_tegra_pcm_init); |
| 391 | 394 |
| 392 static void __exit snd_tegra_pcm_exit(void) | 395 static void __exit snd_tegra_pcm_exit(void) |
| 393 { | 396 { |
| 394 platform_driver_unregister(&tegra_pcm_driver); | 397 platform_driver_unregister(&tegra_pcm_driver); |
| 395 } | 398 } |
| 396 module_exit(snd_tegra_pcm_exit); | 399 module_exit(snd_tegra_pcm_exit); |
| 397 | 400 |
| 398 MODULE_AUTHOR("Stephen Warren <swarren@nvidia.com>"); | 401 MODULE_AUTHOR("Stephen Warren <swarren@nvidia.com>"); |
| 399 MODULE_DESCRIPTION("Tegra PCM ASoC driver"); | 402 MODULE_DESCRIPTION("Tegra PCM ASoC driver"); |
| 400 MODULE_LICENSE("GPL"); | 403 MODULE_LICENSE("GPL"); |
| 404 MODULE_ALIAS("platform:" DRV_NAME); |
| OLD | NEW |