wm8994.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Copyright (C) 2012 Samsung Electronics
  3. * R. Chadrasekar <rcsekar@samsung.com>
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #ifndef __WM8994_H__
  24. #define __WM8994_H__
  25. /* Sources for AIF1/2 SYSCLK - use with set_dai_sysclk() */
  26. #define WM8994_SYSCLK_MCLK1 1
  27. #define WM8994_SYSCLK_MCLK2 2
  28. #define WM8994_SYSCLK_FLL1 3
  29. #define WM8994_SYSCLK_FLL2 4
  30. /* Avilable audi interface ports in wm8994 codec */
  31. enum en_audio_interface {
  32. WM8994_AIF1 = 1,
  33. WM8994_AIF2,
  34. WM8994_AIF3
  35. };
  36. /* OPCLK is also configured with set_dai_sysclk, specify division*10 as rate. */
  37. #define WM8994_SYSCLK_OPCLK 5
  38. #define WM8994_FLL1 1
  39. #define WM8994_FLL2 2
  40. #define WM8994_FLL_SRC_MCLK1 1
  41. #define WM8994_FLL_SRC_MCLK2 2
  42. #define WM8994_FLL_SRC_LRCLK 3
  43. #define WM8994_FLL_SRC_BCLK 4
  44. /* maximum available digital interfac in the dac to configure */
  45. #define WM8994_MAX_AIF 2
  46. #define WM8994_MAX_INPUT_CLK_FREQ 13500000
  47. #define WM8994_ID 0x8994
  48. enum wm8994_vmid_mode {
  49. WM8994_VMID_NORMAL,
  50. WM8994_VMID_FORCE,
  51. };
  52. /* wm 8994 family devices */
  53. enum wm8994_type {
  54. WM8994 = 0,
  55. WM8958 = 1,
  56. WM1811 = 2,
  57. };
  58. /*
  59. * intialise wm8994 sound codec device for the given configuration
  60. *
  61. * @param blob FDT node for codec values
  62. * @param aif_id enum value of codec interface port in which
  63. * soc i2s is connected
  64. * @param sampling_rate Sampling rate ranges between from 8khz to 96khz
  65. * @param mclk_freq Master clock frequency.
  66. * @param bits_per_sample bits per Sample can be 16 or 24
  67. * @param channels Number of channnels, maximum 2
  68. *
  69. * @returns -1 for error and 0 Success.
  70. */
  71. int wm8994_init(const void *blob, enum en_audio_interface aif_id,
  72. int sampling_rate, int mclk_freq,
  73. int bits_per_sample, unsigned int channels);
  74. #endif /*__WM8994_H__ */