Thomas Gleixner | b886d83 | 2019-06-01 10:08:55 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-only |
Wan ZongShun | 1082e27 | 2010-05-18 13:41:46 +0800 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2010 Nuvoton technology corporation. |
| 4 | * |
| 5 | * Wan ZongShun <mcuos.com@gmail.com> |
Wan ZongShun | 1082e27 | 2010-05-18 13:41:46 +0800 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <linux/module.h> |
| 9 | #include <linux/moduleparam.h> |
| 10 | #include <linux/timer.h> |
| 11 | #include <linux/interrupt.h> |
| 12 | #include <linux/platform_device.h> |
| 13 | |
| 14 | #include <sound/core.h> |
| 15 | #include <sound/pcm.h> |
| 16 | #include <sound/soc.h> |
Wan ZongShun | 1082e27 | 2010-05-18 13:41:46 +0800 | [diff] [blame] | 17 | |
Wan ZongShun | 019afb5 | 2010-06-10 10:40:40 +0800 | [diff] [blame] | 18 | #include "nuc900-audio.h" |
Wan ZongShun | 1082e27 | 2010-05-18 13:41:46 +0800 | [diff] [blame] | 19 | |
| 20 | static struct snd_soc_dai_link nuc900evb_ac97_dai = { |
| 21 | .name = "AC97", |
| 22 | .stream_name = "AC97 HiFi", |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 23 | .cpu_dai_name = "nuc900-ac97", |
| 24 | .codec_dai_name = "ac97-hifi", |
| 25 | .codec_name = "ac97-codec", |
| 26 | .platform_name = "nuc900-pcm-audio", |
Wan ZongShun | 1082e27 | 2010-05-18 13:41:46 +0800 | [diff] [blame] | 27 | }; |
| 28 | |
| 29 | static struct snd_soc_card nuc900evb_audio_machine = { |
| 30 | .name = "NUC900EVB_AC97", |
Axel Lin | b5a6704 | 2011-12-23 14:51:17 +0800 | [diff] [blame] | 31 | .owner = THIS_MODULE, |
Wan ZongShun | 1082e27 | 2010-05-18 13:41:46 +0800 | [diff] [blame] | 32 | .dai_link = &nuc900evb_ac97_dai, |
| 33 | .num_links = 1, |
Wan ZongShun | 1082e27 | 2010-05-18 13:41:46 +0800 | [diff] [blame] | 34 | }; |
| 35 | |
| 36 | static struct platform_device *nuc900evb_asoc_dev; |
| 37 | |
| 38 | static int __init nuc900evb_audio_init(void) |
| 39 | { |
| 40 | int ret; |
| 41 | |
| 42 | ret = -ENOMEM; |
| 43 | nuc900evb_asoc_dev = platform_device_alloc("soc-audio", -1); |
| 44 | if (!nuc900evb_asoc_dev) |
| 45 | goto out; |
| 46 | |
| 47 | /* nuc900 board audio device */ |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 48 | platform_set_drvdata(nuc900evb_asoc_dev, &nuc900evb_audio_machine); |
Wan ZongShun | 1082e27 | 2010-05-18 13:41:46 +0800 | [diff] [blame] | 49 | |
Wan ZongShun | 1082e27 | 2010-05-18 13:41:46 +0800 | [diff] [blame] | 50 | ret = platform_device_add(nuc900evb_asoc_dev); |
| 51 | |
| 52 | if (ret) { |
| 53 | platform_device_put(nuc900evb_asoc_dev); |
| 54 | nuc900evb_asoc_dev = NULL; |
| 55 | } |
| 56 | |
| 57 | out: |
| 58 | return ret; |
| 59 | } |
| 60 | |
| 61 | static void __exit nuc900evb_audio_exit(void) |
| 62 | { |
| 63 | platform_device_unregister(nuc900evb_asoc_dev); |
| 64 | } |
| 65 | |
| 66 | module_init(nuc900evb_audio_init); |
| 67 | module_exit(nuc900evb_audio_exit); |
| 68 | |
| 69 | MODULE_LICENSE("GPL"); |
| 70 | MODULE_DESCRIPTION("NUC900 Series ASoC audio support"); |
| 71 | MODULE_AUTHOR("Wan ZongShun"); |