diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-08 22:31:16 +0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-08 22:31:16 +0400 |
commit | 3f17ea6dea8ba5668873afa54628a91aaa3fb1c0 (patch) | |
tree | afbeb2accd4c2199ddd705ae943995b143a0af02 /sound/soc/blackfin/bfin-eval-adau1x81.c | |
parent | 1860e379875dfe7271c649058aeddffe5afd9d0d (diff) | |
parent | 1a5700bc2d10cd379a795fd2bb377a190af5acd4 (diff) | |
download | linux-3f17ea6dea8ba5668873afa54628a91aaa3fb1c0.tar.xz |
Merge branch 'next' (accumulated 3.16 merge window patches) into master
Now that 3.15 is released, this merges the 'next' branch into 'master',
bringing us to the normal situation where my 'master' branch is the
merge window.
* accumulated work in next: (6809 commits)
ufs: sb mutex merge + mutex_destroy
powerpc: update comments for generic idle conversion
cris: update comments for generic idle conversion
idle: remove cpu_idle() forward declarations
nbd: zero from and len fields in NBD_CMD_DISCONNECT.
mm: convert some level-less printks to pr_*
MAINTAINERS: adi-buildroot-devel is moderated
MAINTAINERS: add linux-api for review of API/ABI changes
mm/kmemleak-test.c: use pr_fmt for logging
fs/dlm/debug_fs.c: replace seq_printf by seq_puts
fs/dlm/lockspace.c: convert simple_str to kstr
fs/dlm/config.c: convert simple_str to kstr
mm: mark remap_file_pages() syscall as deprecated
mm: memcontrol: remove unnecessary memcg argument from soft limit functions
mm: memcontrol: clean up memcg zoneinfo lookup
mm/memblock.c: call kmemleak directly from memblock_(alloc|free)
mm/mempool.c: update the kmemleak stack trace for mempool allocations
lib/radix-tree.c: update the kmemleak stack trace for radix tree allocations
mm: introduce kmemleak_update_trace()
mm/kmemleak.c: use %u to print ->checksum
...
Diffstat (limited to 'sound/soc/blackfin/bfin-eval-adau1x81.c')
-rw-r--r-- | sound/soc/blackfin/bfin-eval-adau1x81.c | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/sound/soc/blackfin/bfin-eval-adau1x81.c b/sound/soc/blackfin/bfin-eval-adau1x81.c new file mode 100644 index 000000000000..5c380f6aed1a --- /dev/null +++ b/sound/soc/blackfin/bfin-eval-adau1x81.c @@ -0,0 +1,130 @@ +/* + * Machine driver for EVAL-ADAU1x81 on Analog Devices bfin + * evaluation boards. + * + * Copyright 2011-2014 Analog Devices Inc. + * Author: Lars-Peter Clausen <lars@metafoo.de> + * + * Licensed under the GPL-2 or later. + */ + +#include <linux/module.h> +#include <linux/device.h> +#include <linux/slab.h> +#include <sound/core.h> +#include <sound/pcm.h> +#include <sound/soc.h> +#include <sound/pcm_params.h> + +#include "../codecs/adau17x1.h" + +static const struct snd_soc_dapm_widget bfin_eval_adau1x81_dapm_widgets[] = { + SND_SOC_DAPM_LINE("Stereo In", NULL), + SND_SOC_DAPM_LINE("Beep", NULL), + + SND_SOC_DAPM_SPK("Speaker", NULL), + SND_SOC_DAPM_HP("Headphone", NULL), +}; + +static const struct snd_soc_dapm_route bfin_eval_adau1x81_dapm_routes[] = { + { "BEEP", NULL, "Beep" }, + { "LMIC", NULL, "Stereo In" }, + { "LMIC", NULL, "Stereo In" }, + + { "Headphone", NULL, "AOUTL" }, + { "Headphone", NULL, "AOUTR" }, + { "Speaker", NULL, "SP" }, +}; + +static int bfin_eval_adau1x81_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_dai *codec_dai = rtd->codec_dai; + int pll_rate; + int ret; + + switch (params_rate(params)) { + case 48000: + case 8000: + case 12000: + case 16000: + case 24000: + case 32000: + case 96000: + pll_rate = 48000 * 1024; + break; + case 44100: + case 7350: + case 11025: + case 14700: + case 22050: + case 29400: + case 88200: + pll_rate = 44100 * 1024; + break; + default: + return -EINVAL; + } + + ret = snd_soc_dai_set_pll(codec_dai, ADAU17X1_PLL, + ADAU17X1_PLL_SRC_MCLK, 12288000, pll_rate); + if (ret) + return ret; + + ret = snd_soc_dai_set_sysclk(codec_dai, ADAU17X1_CLK_SRC_PLL, pll_rate, + SND_SOC_CLOCK_IN); + + return ret; +} + +static const struct snd_soc_ops bfin_eval_adau1x81_ops = { + .hw_params = bfin_eval_adau1x81_hw_params, +}; + +static struct snd_soc_dai_link bfin_eval_adau1x81_dai = { + .name = "adau1x81", + .stream_name = "adau1x81", + .cpu_dai_name = "bfin-i2s.0", + .codec_dai_name = "adau-hifi", + .platform_name = "bfin-i2s-pcm-audio", + .codec_name = "adau1781.0-0038", + .ops = &bfin_eval_adau1x81_ops, + .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | + SND_SOC_DAIFMT_CBM_CFM, +}; + +static struct snd_soc_card bfin_eval_adau1x81 = { + .name = "bfin-eval-adau1x81", + .driver_name = "eval-adau1x81", + .dai_link = &bfin_eval_adau1x81_dai, + .num_links = 1, + + .dapm_widgets = bfin_eval_adau1x81_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(bfin_eval_adau1x81_dapm_widgets), + .dapm_routes = bfin_eval_adau1x81_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(bfin_eval_adau1x81_dapm_routes), + .fully_routed = true, +}; + +static int bfin_eval_adau1x81_probe(struct platform_device *pdev) +{ + bfin_eval_adau1x81.dev = &pdev->dev; + + return devm_snd_soc_register_card(&pdev->dev, &bfin_eval_adau1x81); +} + +static struct platform_driver bfin_eval_adau1x81_driver = { + .driver = { + .name = "bfin-eval-adau1x81", + .owner = THIS_MODULE, + .pm = &snd_soc_pm_ops, + }, + .probe = bfin_eval_adau1x81_probe, +}; +module_platform_driver(bfin_eval_adau1x81_driver); + +MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); +MODULE_DESCRIPTION("ALSA SoC bfin adau1x81 driver"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:bfin-eval-adau1x81"); |