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> |
| 14 | #include <../sound/soc/codecs/ak4642.h> |
| 15 | |
Kuninori Morimoto | 4b6316b | 2010-03-23 16:27:28 +0900 | [diff] [blame] | 16 | static int fsi_ak4642_dai_init(struct snd_soc_codec *codec) |
| 17 | { |
| 18 | int ret; |
| 19 | |
Kuninori Morimoto | 0643ce8 | 2010-03-15 18:10:50 +0900 | [diff] [blame] | 20 | ret = snd_soc_dai_set_fmt(&ak4642_dai, SND_SOC_DAIFMT_CBM_CFM); |
| 21 | if (ret < 0) |
| 22 | return ret; |
| 23 | |
Kuninori Morimoto | 4b6316b | 2010-03-23 16:27:28 +0900 | [diff] [blame] | 24 | ret = snd_soc_dai_set_sysclk(&ak4642_dai, 0, 11289600, 0); |
| 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", |
Kuninori Morimoto | 3c2ef84 | 2010-07-16 19:51:06 +0900 | [diff] [blame^] | 32 | .cpu_dai = &fsi_soc_dai[FSI_PORT_A], |
Kuninori Morimoto | b8e583f | 2009-08-21 09:42:59 +0900 | [diff] [blame] | 33 | .codec_dai = &ak4642_dai, |
Kuninori Morimoto | 4b6316b | 2010-03-23 16:27:28 +0900 | [diff] [blame] | 34 | .init = fsi_ak4642_dai_init, |
Kuninori Morimoto | b8e583f | 2009-08-21 09:42:59 +0900 | [diff] [blame] | 35 | .ops = NULL, |
| 36 | }; |
| 37 | |
| 38 | static struct snd_soc_card fsi_soc_card = { |
| 39 | .name = "FSI", |
| 40 | .platform = &fsi_soc_platform, |
| 41 | .dai_link = &fsi_dai_link, |
| 42 | .num_links = 1, |
| 43 | }; |
| 44 | |
| 45 | static struct snd_soc_device fsi_snd_devdata = { |
| 46 | .card = &fsi_soc_card, |
| 47 | .codec_dev = &soc_codec_dev_ak4642, |
| 48 | }; |
| 49 | |
Kuninori Morimoto | b8e583f | 2009-08-21 09:42:59 +0900 | [diff] [blame] | 50 | static struct platform_device *fsi_snd_device; |
| 51 | |
| 52 | static int __init fsi_ak4642_init(void) |
| 53 | { |
| 54 | int ret = -ENOMEM; |
| 55 | |
Kuninori Morimoto | 3c2ef84 | 2010-07-16 19:51:06 +0900 | [diff] [blame^] | 56 | fsi_snd_device = platform_device_alloc("soc-audio", FSI_PORT_A); |
Kuninori Morimoto | b8e583f | 2009-08-21 09:42:59 +0900 | [diff] [blame] | 57 | if (!fsi_snd_device) |
| 58 | goto out; |
| 59 | |
| 60 | platform_set_drvdata(fsi_snd_device, |
| 61 | &fsi_snd_devdata); |
| 62 | fsi_snd_devdata.dev = &fsi_snd_device->dev; |
| 63 | ret = platform_device_add(fsi_snd_device); |
| 64 | |
| 65 | if (ret) |
| 66 | platform_device_put(fsi_snd_device); |
| 67 | |
| 68 | out: |
| 69 | return ret; |
| 70 | } |
| 71 | |
| 72 | static void __exit fsi_ak4642_exit(void) |
| 73 | { |
| 74 | platform_device_unregister(fsi_snd_device); |
| 75 | } |
| 76 | |
| 77 | module_init(fsi_ak4642_init); |
| 78 | module_exit(fsi_ak4642_exit); |
| 79 | |
| 80 | MODULE_LICENSE("GPL"); |
| 81 | MODULE_DESCRIPTION("Generic SH4 FSI-AK4642 sound card"); |
| 82 | MODULE_AUTHOR("Kuninori Morimoto <morimoto.kuninori@renesas.com>"); |