Kuninori Morimoto | 03849405 | 2009-12-14 13:22:00 +0900 | [diff] [blame] | 1 | /* |
| 2 | * fsi-da7210.c |
| 3 | * |
| 4 | * Copyright (C) 2009 Renesas Solutions Corp. |
| 5 | * Kuninori Morimoto <morimoto.kuninori@renesas.com> |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify it |
| 8 | * under the terms of the GNU General Public License as published by the |
| 9 | * Free Software Foundation; either version 2 of the License, or (at your |
| 10 | * option) any later version. |
| 11 | */ |
| 12 | |
Kuninori Morimoto | 03849405 | 2009-12-14 13:22:00 +0900 | [diff] [blame] | 13 | #include <linux/platform_device.h> |
Kuninori Morimoto | 03849405 | 2009-12-14 13:22:00 +0900 | [diff] [blame] | 14 | #include <sound/sh_fsi.h> |
Kuninori Morimoto | 03849405 | 2009-12-14 13:22:00 +0900 | [diff] [blame] | 15 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame^] | 16 | static int fsi_da7210_init(struct snd_soc_pcm_runtime *rtd) |
Kuninori Morimoto | 03849405 | 2009-12-14 13:22:00 +0900 | [diff] [blame] | 17 | { |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame^] | 18 | struct snd_soc_dai *dai = rtd->codec_dai; |
| 19 | |
| 20 | return snd_soc_dai_set_fmt(dai, |
Kuninori Morimoto | 03849405 | 2009-12-14 13:22:00 +0900 | [diff] [blame] | 21 | SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | |
| 22 | SND_SOC_DAIFMT_CBM_CFM); |
| 23 | } |
| 24 | |
| 25 | static struct snd_soc_dai_link fsi_da7210_dai = { |
| 26 | .name = "DA7210", |
| 27 | .stream_name = "DA7210", |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame^] | 28 | .cpu_dai_name = "fsib-dai", /* FSI B */ |
| 29 | .codec_dai_name = "da7210-hifi", |
| 30 | .platform_name = "fsi-pcm-audio", |
| 31 | .codec_name = "da7210-codec.0-001a", |
Kuninori Morimoto | 03849405 | 2009-12-14 13:22:00 +0900 | [diff] [blame] | 32 | .init = fsi_da7210_init, |
| 33 | }; |
| 34 | |
| 35 | static struct snd_soc_card fsi_soc_card = { |
| 36 | .name = "FSI", |
Kuninori Morimoto | 03849405 | 2009-12-14 13:22:00 +0900 | [diff] [blame] | 37 | .dai_link = &fsi_da7210_dai, |
| 38 | .num_links = 1, |
| 39 | }; |
| 40 | |
Kuninori Morimoto | 03849405 | 2009-12-14 13:22:00 +0900 | [diff] [blame] | 41 | static struct platform_device *fsi_da7210_snd_device; |
| 42 | |
| 43 | static int __init fsi_da7210_sound_init(void) |
| 44 | { |
| 45 | int ret; |
| 46 | |
Kuninori Morimoto | 3c2ef84 | 2010-07-16 19:51:06 +0900 | [diff] [blame] | 47 | fsi_da7210_snd_device = platform_device_alloc("soc-audio", FSI_PORT_B); |
Kuninori Morimoto | 03849405 | 2009-12-14 13:22:00 +0900 | [diff] [blame] | 48 | if (!fsi_da7210_snd_device) |
| 49 | return -ENOMEM; |
| 50 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame^] | 51 | platform_set_drvdata(fsi_da7210_snd_device, &fsi_soc_card); |
Kuninori Morimoto | 03849405 | 2009-12-14 13:22:00 +0900 | [diff] [blame] | 52 | ret = platform_device_add(fsi_da7210_snd_device); |
| 53 | if (ret) |
| 54 | platform_device_put(fsi_da7210_snd_device); |
| 55 | |
| 56 | return ret; |
| 57 | } |
| 58 | |
| 59 | static void __exit fsi_da7210_sound_exit(void) |
| 60 | { |
| 61 | platform_device_unregister(fsi_da7210_snd_device); |
| 62 | } |
| 63 | |
| 64 | module_init(fsi_da7210_sound_init); |
| 65 | module_exit(fsi_da7210_sound_exit); |
| 66 | |
| 67 | /* Module information */ |
| 68 | MODULE_DESCRIPTION("ALSA SoC FSI DA2710"); |
| 69 | MODULE_AUTHOR("Kuninori Morimoto <morimoto.kuninori@renesas.com>"); |
| 70 | MODULE_LICENSE("GPL"); |