fsi-da7210.c 1.9 KB

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