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

TOMOYO Linux Cross Reference
Linux/sound/soc/blackfin/bf5xx-ad1836.c

Version: ~ [ linux-5.15-rc6 ] ~ [ linux-5.14.14 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.75 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.155 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.213 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.252 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.287 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.289 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ 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 /*
  2  * File:         sound/soc/blackfin/bf5xx-ad1836.c
  3  * Author:       Barry Song <Barry.Song@analog.com>
  4  *
  5  * Created:      Aug 4 2009
  6  * Description:  Board driver for ad1836 sound chip
  7  *
  8  * Bugs:         Enter bugs at http://blackfin.uclinux.org/
  9  *
 10  * This program is free software; you can redistribute it and/or modify
 11  * it under the terms of the GNU General Public License as published by
 12  * the Free Software Foundation; either version 2 of the License, or
 13  * (at your option) any later version.
 14  *
 15  */
 16 
 17 #include <linux/module.h>
 18 #include <linux/moduleparam.h>
 19 #include <linux/device.h>
 20 #include <sound/core.h>
 21 #include <sound/pcm.h>
 22 #include <sound/soc.h>
 23 #include <sound/pcm_params.h>
 24 
 25 #include <asm/blackfin.h>
 26 #include <asm/cacheflush.h>
 27 #include <asm/irq.h>
 28 #include <asm/dma.h>
 29 #include <asm/portmux.h>
 30 
 31 #include "../codecs/ad1836.h"
 32 
 33 #include "bf5xx-tdm-pcm.h"
 34 #include "bf5xx-tdm.h"
 35 
 36 static struct snd_soc_card bf5xx_ad1836;
 37 
 38 static int bf5xx_ad1836_hw_params(struct snd_pcm_substream *substream,
 39         struct snd_pcm_hw_params *params)
 40 {
 41         struct snd_soc_pcm_runtime *rtd = substream->private_data;
 42         struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
 43         unsigned int channel_map[] = {0, 4, 1, 5, 2, 6, 3, 7};
 44         int ret = 0;
 45 
 46         /* set cpu DAI channel mapping */
 47         ret = snd_soc_dai_set_channel_map(cpu_dai, ARRAY_SIZE(channel_map),
 48                 channel_map, ARRAY_SIZE(channel_map), channel_map);
 49         if (ret < 0)
 50                 return ret;
 51 
 52         return 0;
 53 }
 54 
 55 static struct snd_soc_ops bf5xx_ad1836_ops = {
 56         .hw_params = bf5xx_ad1836_hw_params,
 57 };
 58 
 59 #define BF5XX_AD1836_DAIFMT (SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_IB_IF | \
 60                                 SND_SOC_DAIFMT_CBM_CFM)
 61 
 62 static struct snd_soc_dai_link bf5xx_ad1836_dai = {
 63         .name = "ad1836",
 64         .stream_name = "AD1836",
 65         .codec_dai_name = "ad1836-hifi",
 66         .platform_name = "bfin-tdm-pcm-audio",
 67         .ops = &bf5xx_ad1836_ops,
 68         .dai_fmt = BF5XX_AD1836_DAIFMT,
 69 };
 70 
 71 static struct snd_soc_card bf5xx_ad1836 = {
 72         .name = "bfin-ad1836",
 73         .owner = THIS_MODULE,
 74         .dai_link = &bf5xx_ad1836_dai,
 75         .num_links = 1,
 76 };
 77 
 78 static int bf5xx_ad1836_driver_probe(struct platform_device *pdev)
 79 {
 80         struct snd_soc_card *card = &bf5xx_ad1836;
 81         const char **link_name;
 82         int ret;
 83 
 84         link_name = pdev->dev.platform_data;
 85         if (!link_name) {
 86                 dev_err(&pdev->dev, "No platform data supplied\n");
 87                 return -EINVAL;
 88         }
 89         bf5xx_ad1836_dai.cpu_dai_name = link_name[0];
 90         bf5xx_ad1836_dai.codec_name = link_name[1];
 91 
 92         card->dev = &pdev->dev;
 93         platform_set_drvdata(pdev, card);
 94 
 95         ret = snd_soc_register_card(card);
 96         if (ret)
 97                 dev_err(&pdev->dev, "Failed to register card\n");
 98         return ret;
 99 }
100 
101 static int bf5xx_ad1836_driver_remove(struct platform_device *pdev)
102 {
103         struct snd_soc_card *card = platform_get_drvdata(pdev);
104 
105         snd_soc_unregister_card(card);
106         return 0;
107 }
108 
109 static struct platform_driver bf5xx_ad1836_driver = {
110         .driver = {
111                 .name = "bfin-snd-ad1836",
112                 .owner = THIS_MODULE,
113                 .pm = &snd_soc_pm_ops,
114         },
115         .probe = bf5xx_ad1836_driver_probe,
116         .remove = bf5xx_ad1836_driver_remove,
117 };
118 module_platform_driver(bf5xx_ad1836_driver);
119 
120 /* Module information */
121 MODULE_AUTHOR("Barry Song");
122 MODULE_DESCRIPTION("ALSA SoC AD1836 board driver");
123 MODULE_LICENSE("GPL");
124 
125 

~ [ 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