fsi-ak4642.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * FSI-AK464x sound support for ms7724se
  3. *
  4. * Copyright (C) 2009 Renesas Solutions Corp.
  5. * Kuninori Morimoto <morimoto.kuninori@renesas.com>
  6. *
  7. * This file is subject to the terms and conditions of the GNU General Public
  8. * License. See the file "COPYING" in the main directory of this archive
  9. * for more details.
  10. */
  11. #include <linux/platform_device.h>
  12. #include <sound/sh_fsi.h>
  13. static int fsi_ak4642_dai_init(struct snd_soc_pcm_runtime *rtd)
  14. {
  15. struct snd_soc_dai *dai = rtd->codec_dai;
  16. int ret;
  17. ret = snd_soc_dai_set_fmt(dai, SND_SOC_DAIFMT_CBM_CFM);
  18. if (ret < 0)
  19. return ret;
  20. ret = snd_soc_dai_set_sysclk(dai, 0, 11289600, 0);
  21. return ret;
  22. }
  23. static struct snd_soc_dai_link fsi_dai_link = {
  24. .name = "AK4642",
  25. .stream_name = "AK4642",
  26. .cpu_dai_name = "fsia-dai", /* fsi A */
  27. .codec_dai_name = "ak4642-hifi",
  28. #ifdef CONFIG_MACH_AP4EVB
  29. .platform_name = "sh_fsi2",
  30. .codec_name = "ak4642-codec.0-0013",
  31. #else
  32. .platform_name = "sh_fsi.0",
  33. .codec_name = "ak4642-codec.0-0012",
  34. #endif
  35. .init = fsi_ak4642_dai_init,
  36. .ops = NULL,
  37. };
  38. static struct snd_soc_card fsi_soc_card = {
  39. .name = "FSI (AK4642)",
  40. .dai_link = &fsi_dai_link,
  41. .num_links = 1,
  42. };
  43. static struct platform_device *fsi_snd_device;
  44. static int __init fsi_ak4642_init(void)
  45. {
  46. int ret = -ENOMEM;
  47. fsi_snd_device = platform_device_alloc("soc-audio", FSI_PORT_A);
  48. if (!fsi_snd_device)
  49. goto out;
  50. platform_set_drvdata(fsi_snd_device, &fsi_soc_card);
  51. ret = platform_device_add(fsi_snd_device);
  52. if (ret)
  53. platform_device_put(fsi_snd_device);
  54. out:
  55. return ret;
  56. }
  57. static void __exit fsi_ak4642_exit(void)
  58. {
  59. platform_device_unregister(fsi_snd_device);
  60. }
  61. module_init(fsi_ak4642_init);
  62. module_exit(fsi_ak4642_exit);
  63. MODULE_LICENSE("GPL");
  64. MODULE_DESCRIPTION("Generic SH4 FSI-AK4642 sound card");
  65. MODULE_AUTHOR("Kuninori Morimoto <morimoto.kuninori@renesas.com>");