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