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

TOMOYO Linux Cross Reference
Linux/sound/soc/blackfin/bfin-eval-adau1x61.c

Version: ~ [ linux-6.0-rc6 ] ~ [ linux-5.19.10 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.69 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.144 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.214 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.259 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.294 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.329 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.302 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ 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 /*
  2  * Machine driver for EVAL-ADAU1x61MINIZ on Analog Devices bfin
  3  * evaluation boards.
  4  *
  5  * Copyright 2011-2014 Analog Devices Inc.
  6  * Author: Lars-Peter Clausen <lars@metafoo.de>
  7  *
  8  * Licensed under the GPL-2 or later.
  9  */
 10 
 11 #include <linux/module.h>
 12 #include <linux/device.h>
 13 #include <linux/slab.h>
 14 #include <sound/core.h>
 15 #include <sound/pcm.h>
 16 #include <sound/soc.h>
 17 #include <sound/pcm_params.h>
 18 
 19 #include "../codecs/adau17x1.h"
 20 
 21 static const struct snd_soc_dapm_widget bfin_eval_adau1x61_dapm_widgets[] = {
 22         SND_SOC_DAPM_LINE("In 1", NULL),
 23         SND_SOC_DAPM_LINE("In 2", NULL),
 24         SND_SOC_DAPM_LINE("In 3-4", NULL),
 25 
 26         SND_SOC_DAPM_LINE("Diff Out L", NULL),
 27         SND_SOC_DAPM_LINE("Diff Out R", NULL),
 28         SND_SOC_DAPM_LINE("Stereo Out", NULL),
 29         SND_SOC_DAPM_HP("Capless HP Out", NULL),
 30 };
 31 
 32 static const struct snd_soc_dapm_route bfin_eval_adau1x61_dapm_routes[] = {
 33         { "LAUX", NULL, "In 3-4" },
 34         { "RAUX", NULL, "In 3-4" },
 35         { "LINP", NULL, "In 1" },
 36         { "LINN", NULL, "In 1"},
 37         { "RINP", NULL, "In 2" },
 38         { "RINN", NULL, "In 2" },
 39 
 40         { "In 1", NULL, "MICBIAS" },
 41         { "In 2", NULL, "MICBIAS" },
 42 
 43         { "Capless HP Out", NULL, "LHP" },
 44         { "Capless HP Out", NULL, "RHP" },
 45         { "Diff Out L", NULL, "LOUT" },
 46         { "Diff Out R", NULL, "ROUT" },
 47         { "Stereo Out", NULL, "LOUT" },
 48         { "Stereo Out", NULL, "ROUT" },
 49 };
 50 
 51 static int bfin_eval_adau1x61_hw_params(struct snd_pcm_substream *substream,
 52         struct snd_pcm_hw_params *params)
 53 {
 54         struct snd_soc_pcm_runtime *rtd = substream->private_data;
 55         struct snd_soc_dai *codec_dai = rtd->codec_dai;
 56         int pll_rate;
 57         int ret;
 58 
 59         switch (params_rate(params)) {
 60         case 48000:
 61         case 8000:
 62         case 12000:
 63         case 16000:
 64         case 24000:
 65         case 32000:
 66         case 96000:
 67                 pll_rate = 48000 * 1024;
 68                 break;
 69         case 44100:
 70         case 7350:
 71         case 11025:
 72         case 14700:
 73         case 22050:
 74         case 29400:
 75         case 88200:
 76                 pll_rate = 44100 * 1024;
 77                 break;
 78         default:
 79                 return -EINVAL;
 80         }
 81 
 82         ret = snd_soc_dai_set_pll(codec_dai, ADAU17X1_PLL,
 83                         ADAU17X1_PLL_SRC_MCLK, 12288000, pll_rate);
 84         if (ret)
 85                 return ret;
 86 
 87         ret = snd_soc_dai_set_sysclk(codec_dai, ADAU17X1_CLK_SRC_PLL, pll_rate,
 88                         SND_SOC_CLOCK_IN);
 89 
 90         return ret;
 91 }
 92 
 93 static const struct snd_soc_ops bfin_eval_adau1x61_ops = {
 94         .hw_params = bfin_eval_adau1x61_hw_params,
 95 };
 96 
 97 static struct snd_soc_dai_link bfin_eval_adau1x61_dai = {
 98         .name = "adau1x61",
 99         .stream_name = "adau1x61",
100         .cpu_dai_name = "bfin-i2s.0",
101         .codec_dai_name = "adau-hifi",
102         .platform_name = "bfin-i2s-pcm-audio",
103         .codec_name = "adau1761.0-0038",
104         .ops = &bfin_eval_adau1x61_ops,
105         .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
106                 SND_SOC_DAIFMT_CBM_CFM,
107 };
108 
109 static struct snd_soc_card bfin_eval_adau1x61 = {
110         .name = "bfin-eval-adau1x61",
111         .owner = THIS_MODULE,
112         .driver_name = "eval-adau1x61",
113         .dai_link = &bfin_eval_adau1x61_dai,
114         .num_links = 1,
115 
116         .dapm_widgets = bfin_eval_adau1x61_dapm_widgets,
117         .num_dapm_widgets = ARRAY_SIZE(bfin_eval_adau1x61_dapm_widgets),
118         .dapm_routes = bfin_eval_adau1x61_dapm_routes,
119         .num_dapm_routes = ARRAY_SIZE(bfin_eval_adau1x61_dapm_routes),
120         .fully_routed = true,
121 };
122 
123 static int bfin_eval_adau1x61_probe(struct platform_device *pdev)
124 {
125         bfin_eval_adau1x61.dev = &pdev->dev;
126 
127         return devm_snd_soc_register_card(&pdev->dev, &bfin_eval_adau1x61);
128 }
129 
130 static struct platform_driver bfin_eval_adau1x61_driver = {
131         .driver = {
132                 .name = "bfin-eval-adau1x61",
133                 .pm = &snd_soc_pm_ops,
134         },
135         .probe = bfin_eval_adau1x61_probe,
136 };
137 module_platform_driver(bfin_eval_adau1x61_driver);
138 
139 MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
140 MODULE_DESCRIPTION("ALSA SoC bfin adau1x61 driver");
141 MODULE_LICENSE("GPL");
142 MODULE_ALIAS("platform:bfin-eval-adau1x61");
143 

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