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

TOMOYO Linux Cross Reference
Linux/sound/soc/fsl/phycore-ac97.c

Version: ~ [ linux-6.1-rc7 ] ~ [ linux-6.0.10 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.80 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.156 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.225 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.267 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.300 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.334 ] ~ [ 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  * phycore-ac97.c  --  SoC audio for imx_phycore in AC97 mode
  3  *
  4  * Copyright 2009 Sascha Hauer, Pengutronix <s.hauer@pengutronix.de>
  5  *
  6  *  This program is free software; you can redistribute  it and/or modify it
  7  *  under  the terms of  the GNU General  Public License as published by the
  8  *  Free Software Foundation;  either version 2 of the  License, or (at your
  9  *  option) any later version.
 10  *
 11  */
 12 
 13 #include <linux/module.h>
 14 #include <linux/moduleparam.h>
 15 #include <linux/device.h>
 16 #include <linux/i2c.h>
 17 #include <sound/core.h>
 18 #include <sound/pcm.h>
 19 #include <sound/soc.h>
 20 #include <asm/mach-types.h>
 21 
 22 #include "imx-audmux.h"
 23 
 24 static struct snd_soc_card imx_phycore;
 25 
 26 static const struct snd_soc_ops imx_phycore_hifi_ops = {
 27 };
 28 
 29 static struct snd_soc_dai_link imx_phycore_dai_ac97[] = {
 30         {
 31                 .name           = "HiFi",
 32                 .stream_name    = "HiFi",
 33                 .codec_dai_name         = "wm9712-hifi",
 34                 .codec_name     = "wm9712-codec",
 35                 .cpu_dai_name   = "imx-ssi.0",
 36                 .platform_name  = "imx-ssi.0",
 37                 .ops            = &imx_phycore_hifi_ops,
 38         },
 39 };
 40 
 41 static struct snd_soc_card imx_phycore = {
 42         .name           = "PhyCORE-ac97-audio",
 43         .owner          = THIS_MODULE,
 44         .dai_link       = imx_phycore_dai_ac97,
 45         .num_links      = ARRAY_SIZE(imx_phycore_dai_ac97),
 46 };
 47 
 48 static struct platform_device *imx_phycore_snd_ac97_device;
 49 static struct platform_device *imx_phycore_snd_device;
 50 
 51 static int __init imx_phycore_init(void)
 52 {
 53         int ret;
 54 
 55         if (machine_is_pca100()) {
 56                 imx_audmux_v1_configure_port(MX27_AUDMUX_HPCR1_SSI0,
 57                         IMX_AUDMUX_V1_PCR_SYN | /* 4wire mode */
 58                         IMX_AUDMUX_V1_PCR_TFCSEL(3) |
 59                         IMX_AUDMUX_V1_PCR_TCLKDIR | /* clock is output */
 60                         IMX_AUDMUX_V1_PCR_RXDSEL(3));
 61                 imx_audmux_v1_configure_port(3,
 62                         IMX_AUDMUX_V1_PCR_SYN | /* 4wire mode */
 63                         IMX_AUDMUX_V1_PCR_TFCSEL(0) |
 64                         IMX_AUDMUX_V1_PCR_TFSDIR |
 65                         IMX_AUDMUX_V1_PCR_RXDSEL(0));
 66         } else if (machine_is_pcm043()) {
 67                 imx_audmux_v2_configure_port(3,
 68                         IMX_AUDMUX_V2_PTCR_SYN | /* 4wire mode */
 69                         IMX_AUDMUX_V2_PTCR_TFSEL(0) |
 70                         IMX_AUDMUX_V2_PTCR_TFSDIR,
 71                         IMX_AUDMUX_V2_PDCR_RXDSEL(0));
 72                 imx_audmux_v2_configure_port(0,
 73                         IMX_AUDMUX_V2_PTCR_SYN | /* 4wire mode */
 74                         IMX_AUDMUX_V2_PTCR_TCSEL(3) |
 75                         IMX_AUDMUX_V2_PTCR_TCLKDIR, /* clock is output */
 76                         IMX_AUDMUX_V2_PDCR_RXDSEL(3));
 77         } else {
 78                 /* return happy. We might run on a totally different machine */
 79                 return 0;
 80         }
 81 
 82         imx_phycore_snd_ac97_device = platform_device_alloc("soc-audio", -1);
 83         if (!imx_phycore_snd_ac97_device)
 84                 return -ENOMEM;
 85 
 86         platform_set_drvdata(imx_phycore_snd_ac97_device, &imx_phycore);
 87         ret = platform_device_add(imx_phycore_snd_ac97_device);
 88         if (ret)
 89                 goto fail1;
 90 
 91         imx_phycore_snd_device = platform_device_alloc("wm9712-codec", -1);
 92         if (!imx_phycore_snd_device) {
 93                 ret = -ENOMEM;
 94                 goto fail2;
 95         }
 96         ret = platform_device_add(imx_phycore_snd_device);
 97 
 98         if (ret) {
 99                 printk(KERN_ERR "ASoC: Platform device allocation failed\n");
100                 goto fail3;
101         }
102 
103         return 0;
104 
105 fail3:
106         platform_device_put(imx_phycore_snd_device);
107 fail2:
108         platform_device_del(imx_phycore_snd_ac97_device);
109 fail1:
110         platform_device_put(imx_phycore_snd_ac97_device);
111         return ret;
112 }
113 
114 static void __exit imx_phycore_exit(void)
115 {
116         platform_device_unregister(imx_phycore_snd_device);
117         platform_device_unregister(imx_phycore_snd_ac97_device);
118 }
119 
120 late_initcall(imx_phycore_init);
121 module_exit(imx_phycore_exit);
122 
123 MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de>");
124 MODULE_DESCRIPTION("PhyCORE ALSA SoC driver");
125 MODULE_LICENSE("GPL");
126 

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