Jon Smirl | 6ffee43 | 2009-05-26 08:34:14 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Efika driver for the PSC of the Freescale MPC52xx |
| 3 | * configured as AC97 interface |
| 4 | * |
| 5 | * Copyright 2008 Jon Smirl, Digispeaker |
| 6 | * Author: Jon Smirl <jonsmirl@gmail.com> |
| 7 | * |
| 8 | * This file is licensed under the terms of the GNU General Public License |
| 9 | * version 2. This program is licensed "as is" without any warranty of any |
| 10 | * kind, whether express or implied. |
| 11 | */ |
| 12 | |
| 13 | #include <linux/init.h> |
| 14 | #include <linux/module.h> |
| 15 | #include <linux/interrupt.h> |
| 16 | #include <linux/device.h> |
| 17 | #include <linux/delay.h> |
| 18 | #include <linux/of_device.h> |
| 19 | #include <linux/of_platform.h> |
| 20 | #include <linux/dma-mapping.h> |
| 21 | |
| 22 | #include <sound/core.h> |
| 23 | #include <sound/pcm.h> |
| 24 | #include <sound/pcm_params.h> |
| 25 | #include <sound/initval.h> |
| 26 | #include <sound/soc.h> |
Jon Smirl | 6ffee43 | 2009-05-26 08:34:14 -0400 | [diff] [blame] | 27 | |
| 28 | #include "mpc5200_dma.h" |
Jon Smirl | 6ffee43 | 2009-05-26 08:34:14 -0400 | [diff] [blame] | 29 | |
Takashi Iwai | afc5e65 | 2009-08-07 16:33:53 +0200 | [diff] [blame] | 30 | #define DRV_NAME "efika-audio-fabric" |
| 31 | |
Kuninori Morimoto | cf8c3ec | 2019-06-06 13:14:32 +0900 | [diff] [blame] | 32 | SND_SOC_DAILINK_DEFS(analog, |
| 33 | DAILINK_COMP_ARRAY(COMP_CPU("mpc5200-psc-ac97.0")), |
| 34 | DAILINK_COMP_ARRAY(COMP_CODEC("stac9766-codec", |
| 35 | "stac9766-hifi-analog")), |
| 36 | DAILINK_COMP_ARRAY(COMP_PLATFORM("mpc5200-pcm-audio"))); |
| 37 | |
| 38 | SND_SOC_DAILINK_DEFS(iec958, |
| 39 | DAILINK_COMP_ARRAY(COMP_CPU("mpc5200-psc-ac97.1")), |
| 40 | DAILINK_COMP_ARRAY(COMP_CODEC("stac9766-codec", |
| 41 | "stac9766-hifi-IEC958")), |
| 42 | DAILINK_COMP_ARRAY(COMP_PLATFORM("mpc5200-pcm-audio"))); |
| 43 | |
Jon Smirl | 6ffee43 | 2009-05-26 08:34:14 -0400 | [diff] [blame] | 44 | static struct snd_soc_dai_link efika_fabric_dai[] = { |
| 45 | { |
| 46 | .name = "AC97", |
| 47 | .stream_name = "AC97 Analog", |
Kuninori Morimoto | cf8c3ec | 2019-06-06 13:14:32 +0900 | [diff] [blame] | 48 | SND_SOC_DAILINK_REG(analog), |
Jon Smirl | 6ffee43 | 2009-05-26 08:34:14 -0400 | [diff] [blame] | 49 | }, |
| 50 | { |
| 51 | .name = "AC97", |
| 52 | .stream_name = "AC97 IEC958", |
Kuninori Morimoto | cf8c3ec | 2019-06-06 13:14:32 +0900 | [diff] [blame] | 53 | SND_SOC_DAILINK_REG(iec958), |
Jon Smirl | 6ffee43 | 2009-05-26 08:34:14 -0400 | [diff] [blame] | 54 | }, |
| 55 | }; |
| 56 | |
Axel Lin | 4c3c5df | 2011-12-22 21:04:54 +0800 | [diff] [blame] | 57 | static struct snd_soc_card card = { |
| 58 | .name = "Efika", |
| 59 | .owner = THIS_MODULE, |
| 60 | .dai_link = efika_fabric_dai, |
| 61 | .num_links = ARRAY_SIZE(efika_fabric_dai), |
| 62 | }; |
| 63 | |
Jon Smirl | 6ffee43 | 2009-05-26 08:34:14 -0400 | [diff] [blame] | 64 | static __init int efika_fabric_init(void) |
| 65 | { |
| 66 | struct platform_device *pdev; |
| 67 | int rc; |
| 68 | |
Grant Likely | 71a157e | 2010-02-01 21:34:14 -0700 | [diff] [blame] | 69 | if (!of_machine_is_compatible("bplan,efika")) |
Jon Smirl | 6ffee43 | 2009-05-26 08:34:14 -0400 | [diff] [blame] | 70 | return -ENODEV; |
| 71 | |
Jon Smirl | 6ffee43 | 2009-05-26 08:34:14 -0400 | [diff] [blame] | 72 | pdev = platform_device_alloc("soc-audio", 1); |
| 73 | if (!pdev) { |
| 74 | pr_err("efika_fabric_init: platform_device_alloc() failed\n"); |
| 75 | return -ENODEV; |
| 76 | } |
| 77 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 78 | platform_set_drvdata(pdev, &card); |
Jon Smirl | 6ffee43 | 2009-05-26 08:34:14 -0400 | [diff] [blame] | 79 | |
| 80 | rc = platform_device_add(pdev); |
| 81 | if (rc) { |
| 82 | pr_err("efika_fabric_init: platform_device_add() failed\n"); |
Axel Lin | 4e1f865 | 2010-11-25 15:07:25 +0800 | [diff] [blame] | 83 | platform_device_put(pdev); |
Jon Smirl | 6ffee43 | 2009-05-26 08:34:14 -0400 | [diff] [blame] | 84 | return -ENODEV; |
| 85 | } |
| 86 | return 0; |
| 87 | } |
| 88 | |
| 89 | module_init(efika_fabric_init); |
| 90 | |
| 91 | |
| 92 | MODULE_AUTHOR("Jon Smirl <jonsmirl@gmail.com>"); |
| 93 | MODULE_DESCRIPTION(DRV_NAME ": mpc5200 Efika fabric driver"); |
| 94 | MODULE_LICENSE("GPL"); |
| 95 | |