I2C: Add helper macro for i2c_driver boilerplate
[zen-stable.git] / sound / soc / sh / fsi-da7210.c
blobf5586b5b0c3b7a135e09468871b272d6bffc158e
1 /*
2 * fsi-da7210.c
4 * Copyright (C) 2009 Renesas Solutions Corp.
5 * Kuninori Morimoto <morimoto.kuninori@renesas.com>
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.
13 #include <linux/platform_device.h>
14 #include <linux/module.h>
15 #include <sound/sh_fsi.h>
17 static int fsi_da7210_init(struct snd_soc_pcm_runtime *rtd)
19 struct snd_soc_dai *codec = rtd->codec_dai;
20 struct snd_soc_dai *cpu = rtd->cpu_dai;
21 int ret;
23 ret = snd_soc_dai_set_fmt(codec,
24 SND_SOC_DAIFMT_I2S |
25 SND_SOC_DAIFMT_CBM_CFM);
26 if (ret < 0)
27 return ret;
29 ret = snd_soc_dai_set_fmt(cpu, SND_SOC_DAIFMT_I2S |
30 SND_SOC_DAIFMT_CBS_CFS);
32 return ret;
35 static struct snd_soc_dai_link fsi_da7210_dai = {
36 .name = "DA7210",
37 .stream_name = "DA7210",
38 .cpu_dai_name = "fsib-dai", /* FSI B */
39 .codec_dai_name = "da7210-hifi",
40 .platform_name = "sh_fsi.0",
41 .codec_name = "da7210-codec.0-001a",
42 .init = fsi_da7210_init,
45 static struct snd_soc_card fsi_soc_card = {
46 .name = "FSI-DA7210",
47 .dai_link = &fsi_da7210_dai,
48 .num_links = 1,
51 static struct platform_device *fsi_da7210_snd_device;
53 static int __init fsi_da7210_sound_init(void)
55 int ret;
57 fsi_da7210_snd_device = platform_device_alloc("soc-audio", FSI_PORT_B);
58 if (!fsi_da7210_snd_device)
59 return -ENOMEM;
61 platform_set_drvdata(fsi_da7210_snd_device, &fsi_soc_card);
62 ret = platform_device_add(fsi_da7210_snd_device);
63 if (ret)
64 platform_device_put(fsi_da7210_snd_device);
66 return ret;
69 static void __exit fsi_da7210_sound_exit(void)
71 platform_device_unregister(fsi_da7210_snd_device);
74 module_init(fsi_da7210_sound_init);
75 module_exit(fsi_da7210_sound_exit);
77 /* Module information */
78 MODULE_DESCRIPTION("ALSA SoC FSI DA2710");
79 MODULE_AUTHOR("Kuninori Morimoto <morimoto.kuninori@renesas.com>");
80 MODULE_LICENSE("GPL");