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

TOMOYO Linux Cross Reference
Linux/sound/soc/sof/nocodec.c

Version: ~ [ linux-5.10-rc5 ] ~ [ linux-5.9.10 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.79 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.159 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.208 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.245 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.245 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ 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.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
  2 //
  3 // This file is provided under a dual BSD/GPLv2 license.  When using or
  4 // redistributing this file, you may do so under either license.
  5 //
  6 // Copyright(c) 2018 Intel Corporation. All rights reserved.
  7 //
  8 // Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
  9 //
 10 
 11 #include <linux/module.h>
 12 #include <sound/sof.h>
 13 #include "sof-priv.h"
 14 
 15 static struct snd_soc_card sof_nocodec_card = {
 16         .name = "nocodec", /* the sof- prefix is added by the core */
 17 };
 18 
 19 static int sof_nocodec_bes_setup(struct device *dev,
 20                                  const struct snd_sof_dsp_ops *ops,
 21                                  struct snd_soc_dai_link *links,
 22                                  int link_num, struct snd_soc_card *card)
 23 {
 24         struct snd_soc_dai_link_component *dlc;
 25         int i;
 26 
 27         if (!ops || !links || !card)
 28                 return -EINVAL;
 29 
 30         /* set up BE dai_links */
 31         for (i = 0; i < link_num; i++) {
 32                 dlc = devm_kzalloc(dev, 3 * sizeof(*dlc), GFP_KERNEL);
 33                 if (!dlc)
 34                         return -ENOMEM;
 35 
 36                 links[i].name = devm_kasprintf(dev, GFP_KERNEL,
 37                                                "NoCodec-%d", i);
 38                 if (!links[i].name)
 39                         return -ENOMEM;
 40 
 41                 links[i].cpus = &dlc[0];
 42                 links[i].codecs = &dlc[1];
 43                 links[i].platforms = &dlc[2];
 44 
 45                 links[i].num_cpus = 1;
 46                 links[i].num_codecs = 1;
 47                 links[i].num_platforms = 1;
 48 
 49                 links[i].id = i;
 50                 links[i].no_pcm = 1;
 51                 links[i].cpus->dai_name = ops->drv[i].name;
 52                 links[i].platforms->name = dev_name(dev);
 53                 links[i].codecs->dai_name = "snd-soc-dummy-dai";
 54                 links[i].codecs->name = "snd-soc-dummy";
 55                 links[i].dpcm_playback = 1;
 56                 links[i].dpcm_capture = 1;
 57         }
 58 
 59         card->dai_link = links;
 60         card->num_links = link_num;
 61 
 62         return 0;
 63 }
 64 
 65 int sof_nocodec_setup(struct device *dev,
 66                       struct snd_sof_pdata *sof_pdata,
 67                       struct snd_soc_acpi_mach *mach,
 68                       const struct sof_dev_desc *desc,
 69                       const struct snd_sof_dsp_ops *ops)
 70 {
 71         struct snd_soc_dai_link *links;
 72         int ret;
 73 
 74         if (!mach)
 75                 return -EINVAL;
 76 
 77         sof_pdata->drv_name = "sof-nocodec";
 78 
 79         mach->drv_name = "sof-nocodec";
 80         sof_pdata->fw_filename = desc->nocodec_fw_filename;
 81         sof_pdata->tplg_filename = desc->nocodec_tplg_filename;
 82 
 83         /* create dummy BE dai_links */
 84         links = devm_kzalloc(dev, sizeof(struct snd_soc_dai_link) *
 85                              ops->num_drv, GFP_KERNEL);
 86         if (!links)
 87                 return -ENOMEM;
 88 
 89         ret = sof_nocodec_bes_setup(dev, ops, links, ops->num_drv,
 90                                     &sof_nocodec_card);
 91         return ret;
 92 }
 93 EXPORT_SYMBOL(sof_nocodec_setup);
 94 
 95 static int sof_nocodec_probe(struct platform_device *pdev)
 96 {
 97         struct snd_soc_card *card = &sof_nocodec_card;
 98 
 99         card->dev = &pdev->dev;
100 
101         return devm_snd_soc_register_card(&pdev->dev, card);
102 }
103 
104 static int sof_nocodec_remove(struct platform_device *pdev)
105 {
106         return 0;
107 }
108 
109 static struct platform_driver sof_nocodec_audio = {
110         .probe = sof_nocodec_probe,
111         .remove = sof_nocodec_remove,
112         .driver = {
113                 .name = "sof-nocodec",
114                 .pm = &snd_soc_pm_ops,
115         },
116 };
117 module_platform_driver(sof_nocodec_audio)
118 
119 MODULE_DESCRIPTION("ASoC sof nocodec");
120 MODULE_AUTHOR("Liam Girdwood");
121 MODULE_LICENSE("Dual BSD/GPL");
122 MODULE_ALIAS("platform:sof-nocodec");
123 

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

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | 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.

osdn.jp