fsi-da7210.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 <linux/module.h>
  14. #include <sound/sh_fsi.h>
  15. static int fsi_da7210_init(struct snd_soc_pcm_runtime *rtd)
  16. {
  17. struct snd_soc_dai *codec = rtd->codec_dai;
  18. struct snd_soc_dai *cpu = rtd->cpu_dai;
  19. int ret;
  20. ret = snd_soc_dai_set_fmt(codec,
  21. SND_SOC_DAIFMT_I2S |
  22. SND_SOC_DAIFMT_CBM_CFM);
  23. if (ret < 0)
  24. return ret;
  25. ret = snd_soc_dai_set_fmt(cpu, SND_SOC_DAIFMT_I2S |
  26. SND_SOC_DAIFMT_CBS_CFS);
  27. return ret;
  28. }
  29. static struct snd_soc_dai_link fsi_da7210_dai = {
  30. .name = "DA7210",
  31. .stream_name = "DA7210",
  32. .cpu_dai_name = "fsib-dai", /* FSI B */
  33. .codec_dai_name = "da7210-hifi",
  34. .platform_name = "sh_fsi.0",
  35. .codec_name = "da7210-codec.0-001a",
  36. .init = fsi_da7210_init,
  37. };
  38. static struct snd_soc_card fsi_soc_card = {
  39. .name = "FSI-DA7210",
  40. .owner = THIS_MODULE,
  41. .dai_link = &fsi_da7210_dai,
  42. .num_links = 1,
  43. };
  44. static struct platform_device *fsi_da7210_snd_device;
  45. static int __init fsi_da7210_sound_init(void)
  46. {
  47. int ret;
  48. fsi_da7210_snd_device = platform_device_alloc("soc-audio", FSI_PORT_B);
  49. if (!fsi_da7210_snd_device)
  50. return -ENOMEM;
  51. platform_set_drvdata(fsi_da7210_snd_device, &fsi_soc_card);
  52. ret = platform_device_add(fsi_da7210_snd_device);
  53. if (ret)
  54. platform_device_put(fsi_da7210_snd_device);
  55. return ret;
  56. }
  57. static void __exit fsi_da7210_sound_exit(void)
  58. {
  59. platform_device_unregister(fsi_da7210_snd_device);
  60. }
  61. module_init(fsi_da7210_sound_init);
  62. module_exit(fsi_da7210_sound_exit);
  63. /* Module information */
  64. MODULE_DESCRIPTION("ALSA SoC FSI DA2710");
  65. MODULE_AUTHOR("Kuninori Morimoto <morimoto.kuninori@renesas.com>");
  66. MODULE_LICENSE("GPL");