fsi-da7210.c 2.1 KB

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