~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/sound/soc/fsl/lpc3xxx-pcm.c

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0-or-later
  2 //
  3 // Author: Kevin Wells <kevin.wells@nxp.com>
  4 //
  5 // Copyright (C) 2008 NXP Semiconductors
  6 // Copyright 2023 Timesys Corporation <piotr.wojtaszczyk@timesys.com>
  7 
  8 #include <linux/module.h>
  9 #include <linux/init.h>
 10 #include <linux/platform_device.h>
 11 #include <linux/slab.h>
 12 #include <linux/dma-mapping.h>
 13 #include <linux/amba/pl08x.h>
 14 
 15 #include <sound/core.h>
 16 #include <sound/pcm.h>
 17 #include <sound/pcm_params.h>
 18 #include <sound/dmaengine_pcm.h>
 19 #include <sound/soc.h>
 20 
 21 #include "lpc3xxx-i2s.h"
 22 
 23 #define STUB_FORMATS    (SNDRV_PCM_FMTBIT_S8 | \
 24                         SNDRV_PCM_FMTBIT_U8 | \
 25                         SNDRV_PCM_FMTBIT_S16_LE | \
 26                         SNDRV_PCM_FMTBIT_U16_LE | \
 27                         SNDRV_PCM_FMTBIT_S24_LE | \
 28                         SNDRV_PCM_FMTBIT_U24_LE | \
 29                         SNDRV_PCM_FMTBIT_S32_LE | \
 30                         SNDRV_PCM_FMTBIT_U32_LE | \
 31                         SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE)
 32 
 33 static const struct snd_pcm_hardware lpc3xxx_pcm_hardware = {
 34         .info = (SNDRV_PCM_INFO_MMAP |
 35                  SNDRV_PCM_INFO_MMAP_VALID |
 36                  SNDRV_PCM_INFO_INTERLEAVED |
 37                  SNDRV_PCM_INFO_BLOCK_TRANSFER |
 38                  SNDRV_PCM_INFO_PAUSE |
 39                  SNDRV_PCM_INFO_RESUME),
 40         .formats = STUB_FORMATS,
 41         .period_bytes_min = 128,
 42         .period_bytes_max = 2048,
 43         .periods_min = 2,
 44         .periods_max = 1024,
 45         .buffer_bytes_max = 128 * 1024
 46 };
 47 
 48 static const struct snd_dmaengine_pcm_config lpc3xxx_dmaengine_pcm_config = {
 49         .pcm_hardware = &lpc3xxx_pcm_hardware,
 50         .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config,
 51         .compat_filter_fn = pl08x_filter_id,
 52         .prealloc_buffer_size = 128 * 1024,
 53 };
 54 
 55 const struct snd_soc_component_driver lpc3xxx_soc_platform_driver = {
 56         .name = "lpc32xx-pcm",
 57 };
 58 
 59 int lpc3xxx_pcm_register(struct platform_device *pdev)
 60 {
 61         int ret;
 62 
 63         ret = devm_snd_dmaengine_pcm_register(&pdev->dev, &lpc3xxx_dmaengine_pcm_config, 0);
 64         if (ret) {
 65                 dev_err(&pdev->dev, "failed to register dmaengine: %d\n", ret);
 66                 return ret;
 67         }
 68 
 69         return devm_snd_soc_register_component(&pdev->dev, &lpc3xxx_soc_platform_driver,
 70                                                NULL, 0);
 71 }
 72 EXPORT_SYMBOL(lpc3xxx_pcm_register);
 73 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php