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 | |
| 13 | #include <linux/interrupt.h> |
| 14 | #include <linux/platform_device.h> |
| 15 | #include <linux/io.h> |
| 16 | #include <linux/i2c.h> |
| 17 | #include <sound/core.h> |
| 18 | #include <sound/pcm.h> |
| 19 | #include <sound/pcm_params.h> |
| 20 | #include <sound/soc.h> |
| 21 | #include <sound/soc-dapm.h> |
| 22 | |
| 23 | #include <sound/sh_fsi.h> |
| 24 | #include "../codecs/da7210.h" |
| 25 | |
| 26 | static int fsi_da7210_init(struct snd_soc_codec *codec) |
| 27 | { |
| 28 | return snd_soc_dai_set_fmt(&da7210_dai, |
| 29 | SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | |
| 30 | SND_SOC_DAIFMT_CBM_CFM); |
| 31 | } |
| 32 | |
| 33 | static struct snd_soc_dai_link fsi_da7210_dai = { |
| 34 | .name = "DA7210", |
| 35 | .stream_name = "DA7210", |
| 36 | .cpu_dai = &fsi_soc_dai[1], /* FSI B */ |
| 37 | .codec_dai = &da7210_dai, |
| 38 | .init = fsi_da7210_init, |
| 39 | }; |
| 40 | |
| 41 | static struct snd_soc_card fsi_soc_card = { |
| 42 | .name = "FSI", |
| 43 | .platform = &fsi_soc_platform, |
| 44 | .dai_link = &fsi_da7210_dai, |
| 45 | .num_links = 1, |
| 46 | }; |
| 47 | |
| 48 | static struct snd_soc_device fsi_da7210_snd_devdata = { |
| 49 | .card = &fsi_soc_card, |
| 50 | .codec_dev = &soc_codec_dev_da7210, |
| 51 | }; |
| 52 | |
| 53 | static struct platform_device *fsi_da7210_snd_device; |
| 54 | |
| 55 | static int __init fsi_da7210_sound_init(void) |
| 56 | { |
| 57 | int ret; |
| 58 | |
| 59 | fsi_da7210_snd_device = platform_device_alloc("soc-audio", -1); |
| 60 | if (!fsi_da7210_snd_device) |
| 61 | return -ENOMEM; |
| 62 | |
| 63 | platform_set_drvdata(fsi_da7210_snd_device, &fsi_da7210_snd_devdata); |
| 64 | fsi_da7210_snd_devdata.dev = &fsi_da7210_snd_device->dev; |
| 65 | ret = platform_device_add(fsi_da7210_snd_device); |
| 66 | if (ret) |
| 67 | platform_device_put(fsi_da7210_snd_device); |
| 68 | |
| 69 | return ret; |
| 70 | } |
| 71 | |
| 72 | static void __exit fsi_da7210_sound_exit(void) |
| 73 | { |
| 74 | platform_device_unregister(fsi_da7210_snd_device); |
| 75 | } |
| 76 | |
| 77 | module_init(fsi_da7210_sound_init); |
| 78 | module_exit(fsi_da7210_sound_exit); |
| 79 | |
| 80 | /* Module information */ |
| 81 | MODULE_DESCRIPTION("ALSA SoC FSI DA2710"); |
| 82 | MODULE_AUTHOR("Kuninori Morimoto <morimoto.kuninori@renesas.com>"); |
| 83 | MODULE_LICENSE("GPL"); |