fsi-da7210.c 2.0 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 <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. .dai_link = &fsi_da7210_dai,
  41. .num_links = 1,
  42. };
  43. static struct platform_device *fsi_da7210_snd_device;
  44. static int __init fsi_da7210_sound_init(void)
  45. {
  46. int ret;
  47. fsi_da7210_snd_device = platform_device_alloc("soc-audio", FSI_PORT_B);
  48. if (!fsi_da7210_snd_device)
  49. return -ENOMEM;
  50. platform_set_drvdata(fsi_da7210_snd_device, &fsi_soc_card);
  51. ret = platform_device_add(fsi_da7210_snd_device);
  52. if (ret)
  53. platform_device_put(fsi_da7210_snd_device);
  54. return ret;
  55. }
  56. static void __exit fsi_da7210_sound_exit(void)
  57. {
  58. platform_device_unregister(fsi_da7210_snd_device);
  59. }
  60. module_init(fsi_da7210_sound_init);
  61. module_exit(fsi_da7210_sound_exit);
  62. /* Module information */
  63. MODULE_DESCRIPTION("ALSA SoC FSI DA2710");
  64. MODULE_AUTHOR("Kuninori Morimoto <morimoto.kuninori@renesas.com>");
  65. MODULE_LICENSE("GPL");