fsi-da7210.c 1.8 KB

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