fsi-da7210.c 1.9 KB

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