Kuninori Morimoto | b8e583f | 2009-08-21 09:42:59 +0900 | [diff] [blame] | 1 | /* |
| 2 | * FSI-AK464x sound support for ms7724se |
| 3 | * |
| 4 | * Copyright (C) 2009 Renesas Solutions Corp. |
| 5 | * Kuninori Morimoto <morimoto.kuninori@renesas.com> |
| 6 | * |
| 7 | * This file is subject to the terms and conditions of the GNU General Public |
| 8 | * License. See the file "COPYING" in the main directory of this archive |
| 9 | * for more details. |
| 10 | */ |
| 11 | |
Kuninori Morimoto | b8e583f | 2009-08-21 09:42:59 +0900 | [diff] [blame] | 12 | #include <linux/platform_device.h> |
Kuninori Morimoto | b8e583f | 2009-08-21 09:42:59 +0900 | [diff] [blame] | 13 | #include <sound/sh_fsi.h> |
Kuninori Morimoto | b8e583f | 2009-08-21 09:42:59 +0900 | [diff] [blame] | 14 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 15 | static int fsi_ak4642_dai_init(struct snd_soc_pcm_runtime *rtd) |
Kuninori Morimoto | 4b6316b | 2010-03-23 16:27:28 +0900 | [diff] [blame] | 16 | { |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 17 | struct snd_soc_dai *dai = rtd->codec_dai; |
Kuninori Morimoto | 4b6316b | 2010-03-23 16:27:28 +0900 | [diff] [blame] | 18 | int ret; |
| 19 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 20 | ret = snd_soc_dai_set_fmt(dai, SND_SOC_DAIFMT_CBM_CFM); |
Kuninori Morimoto | 0643ce8 | 2010-03-15 18:10:50 +0900 | [diff] [blame] | 21 | if (ret < 0) |
| 22 | return ret; |
| 23 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 24 | ret = snd_soc_dai_set_sysclk(dai, 0, 11289600, 0); |
Kuninori Morimoto | 4b6316b | 2010-03-23 16:27:28 +0900 | [diff] [blame] | 25 | |
| 26 | return ret; |
| 27 | } |
| 28 | |
Kuninori Morimoto | b8e583f | 2009-08-21 09:42:59 +0900 | [diff] [blame] | 29 | static struct snd_soc_dai_link fsi_dai_link = { |
| 30 | .name = "AK4642", |
| 31 | .stream_name = "AK4642", |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 32 | .cpu_dai_name = "fsia-dai", /* fsi A */ |
| 33 | .codec_dai_name = "ak4642-hifi", |
Kuninori Morimoto | 2c28032 | 2010-08-30 20:47:19 +0900 | [diff] [blame] | 34 | #ifdef CONFIG_MACH_AP4EVB |
Kuninori Morimoto | c570d52 | 2010-09-07 15:46:48 +0900 | [diff] [blame] | 35 | .platform_name = "sh_fsi2", |
Kuninori Morimoto | 2c28032 | 2010-08-30 20:47:19 +0900 | [diff] [blame] | 36 | .codec_name = "ak4642-codec.0-0013", |
| 37 | #else |
| 38 | .platform_name = "sh_fsi.0", |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 39 | .codec_name = "ak4642-codec.0-0012", |
Kuninori Morimoto | 2c28032 | 2010-08-30 20:47:19 +0900 | [diff] [blame] | 40 | #endif |
Kuninori Morimoto | 4b6316b | 2010-03-23 16:27:28 +0900 | [diff] [blame] | 41 | .init = fsi_ak4642_dai_init, |
Kuninori Morimoto | b8e583f | 2009-08-21 09:42:59 +0900 | [diff] [blame] | 42 | .ops = NULL, |
| 43 | }; |
| 44 | |
| 45 | static struct snd_soc_card fsi_soc_card = { |
Kuninori Morimoto | 1c7fc7e | 2010-09-13 19:40:13 +0900 | [diff] [blame] | 46 | .name = "FSI (AK4642)", |
Kuninori Morimoto | b8e583f | 2009-08-21 09:42:59 +0900 | [diff] [blame] | 47 | .dai_link = &fsi_dai_link, |
| 48 | .num_links = 1, |
| 49 | }; |
| 50 | |
Kuninori Morimoto | b8e583f | 2009-08-21 09:42:59 +0900 | [diff] [blame] | 51 | static struct platform_device *fsi_snd_device; |
| 52 | |
| 53 | static int __init fsi_ak4642_init(void) |
| 54 | { |
| 55 | int ret = -ENOMEM; |
| 56 | |
Kuninori Morimoto | 3c2ef84 | 2010-07-16 19:51:06 +0900 | [diff] [blame] | 57 | fsi_snd_device = platform_device_alloc("soc-audio", FSI_PORT_A); |
Kuninori Morimoto | b8e583f | 2009-08-21 09:42:59 +0900 | [diff] [blame] | 58 | if (!fsi_snd_device) |
| 59 | goto out; |
| 60 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 61 | platform_set_drvdata(fsi_snd_device, &fsi_soc_card); |
Kuninori Morimoto | b8e583f | 2009-08-21 09:42:59 +0900 | [diff] [blame] | 62 | ret = platform_device_add(fsi_snd_device); |
| 63 | |
| 64 | if (ret) |
| 65 | platform_device_put(fsi_snd_device); |
| 66 | |
| 67 | out: |
| 68 | return ret; |
| 69 | } |
| 70 | |
| 71 | static void __exit fsi_ak4642_exit(void) |
| 72 | { |
| 73 | platform_device_unregister(fsi_snd_device); |
| 74 | } |
| 75 | |
| 76 | module_init(fsi_ak4642_init); |
| 77 | module_exit(fsi_ak4642_exit); |
| 78 | |
| 79 | MODULE_LICENSE("GPL"); |
| 80 | MODULE_DESCRIPTION("Generic SH4 FSI-AK4642 sound card"); |
| 81 | MODULE_AUTHOR("Kuninori Morimoto <morimoto.kuninori@renesas.com>"); |