blob: 59553fd8c2fb9173a72b7da8b9fa5f70942fe8c2 [file] [log] [blame]
Kuninori Morimoto038494052009-12-14 13:22:00 +09001/*
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 Morimoto038494052009-12-14 13:22:00 +090013#include <linux/platform_device.h>
Kuninori Morimoto038494052009-12-14 13:22:00 +090014#include <sound/sh_fsi.h>
Kuninori Morimoto038494052009-12-14 13:22:00 +090015
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000016static int fsi_da7210_init(struct snd_soc_pcm_runtime *rtd)
Kuninori Morimoto038494052009-12-14 13:22:00 +090017{
Kuninori Morimoto4d805f72011-01-20 11:46:02 +090018 struct snd_soc_dai *codec = rtd->codec_dai;
19 struct snd_soc_dai *cpu = rtd->cpu_dai;
20 int ret;
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000021
Kuninori Morimoto4d805f72011-01-20 11:46:02 +090022 ret = snd_soc_dai_set_fmt(codec,
Kuninori Morimotoe9d3f952010-12-28 14:55:45 +090023 SND_SOC_DAIFMT_I2S |
Kuninori Morimoto038494052009-12-14 13:22:00 +090024 SND_SOC_DAIFMT_CBM_CFM);
Kuninori Morimoto4d805f72011-01-20 11:46:02 +090025 if (ret < 0)
26 return ret;
27
Kuninori Morimotof17c13c2011-01-24 10:43:19 +090028 ret = snd_soc_dai_set_fmt(cpu, SND_SOC_DAIFMT_I2S |
29 SND_SOC_DAIFMT_CBS_CFS);
Kuninori Morimoto4d805f72011-01-20 11:46:02 +090030
31 return ret;
Kuninori Morimoto038494052009-12-14 13:22:00 +090032}
33
34static struct snd_soc_dai_link fsi_da7210_dai = {
35 .name = "DA7210",
36 .stream_name = "DA7210",
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000037 .cpu_dai_name = "fsib-dai", /* FSI B */
38 .codec_dai_name = "da7210-hifi",
Kuninori Morimoto2c280322010-08-30 20:47:19 +090039 .platform_name = "sh_fsi.0",
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000040 .codec_name = "da7210-codec.0-001a",
Kuninori Morimoto038494052009-12-14 13:22:00 +090041 .init = fsi_da7210_init,
42};
43
44static struct snd_soc_card fsi_soc_card = {
Kuninori Morimotof15c9412011-07-05 00:16:03 -070045 .name = "FSI-DA7210",
Kuninori Morimoto038494052009-12-14 13:22:00 +090046 .dai_link = &fsi_da7210_dai,
47 .num_links = 1,
48};
49
Kuninori Morimoto038494052009-12-14 13:22:00 +090050static struct platform_device *fsi_da7210_snd_device;
51
52static int __init fsi_da7210_sound_init(void)
53{
54 int ret;
55
Kuninori Morimoto3c2ef842010-07-16 19:51:06 +090056 fsi_da7210_snd_device = platform_device_alloc("soc-audio", FSI_PORT_B);
Kuninori Morimoto038494052009-12-14 13:22:00 +090057 if (!fsi_da7210_snd_device)
58 return -ENOMEM;
59
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000060 platform_set_drvdata(fsi_da7210_snd_device, &fsi_soc_card);
Kuninori Morimoto038494052009-12-14 13:22:00 +090061 ret = platform_device_add(fsi_da7210_snd_device);
62 if (ret)
63 platform_device_put(fsi_da7210_snd_device);
64
65 return ret;
66}
67
68static void __exit fsi_da7210_sound_exit(void)
69{
70 platform_device_unregister(fsi_da7210_snd_device);
71}
72
73module_init(fsi_da7210_sound_init);
74module_exit(fsi_da7210_sound_exit);
75
76/* Module information */
77MODULE_DESCRIPTION("ALSA SoC FSI DA2710");
78MODULE_AUTHOR("Kuninori Morimoto <morimoto.kuninori@renesas.com>");
79MODULE_LICENSE("GPL");