fsi-da7210.c 1.9 KB

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