wl1273.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * sound/soc/codec/wl1273.h
  3. *
  4. * ALSA SoC WL1273 codec driver
  5. *
  6. * Copyright (C) Nokia Corporation
  7. * Author: Matti Aaltonen <matti.j.aaltonen@nokia.com>
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * version 2 as published by the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * 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., 51 Franklin St, Fifth Floor, Boston, MA
  21. * 02110-1301 USA
  22. *
  23. */
  24. #ifndef __WL1273_CODEC_H__
  25. #define __WL1273_CODEC_H__
  26. /* I2S protocol, left channel first, data width 16 bits */
  27. #define WL1273_PCM_DEF_MODE 0x00
  28. /* Rx */
  29. #define WL1273_AUDIO_ENABLE_I2S (1 << 0)
  30. #define WL1273_AUDIO_ENABLE_ANALOG (1 << 1)
  31. /* Tx */
  32. #define WL1273_AUDIO_IO_SET_ANALOG 0
  33. #define WL1273_AUDIO_IO_SET_I2S 1
  34. #define WL1273_POWER_SET_OFF 0
  35. #define WL1273_POWER_SET_FM (1 << 0)
  36. #define WL1273_POWER_SET_RDS (1 << 1)
  37. #define WL1273_POWER_SET_RETENTION (1 << 4)
  38. #define WL1273_PUPD_SET_OFF 0x00
  39. #define WL1273_PUPD_SET_ON 0x01
  40. #define WL1273_PUPD_SET_RETENTION 0x10
  41. /* I2S mode */
  42. #define WL1273_IS2_WIDTH_32 0x0
  43. #define WL1273_IS2_WIDTH_40 0x1
  44. #define WL1273_IS2_WIDTH_22_23 0x2
  45. #define WL1273_IS2_WIDTH_23_22 0x3
  46. #define WL1273_IS2_WIDTH_48 0x4
  47. #define WL1273_IS2_WIDTH_50 0x5
  48. #define WL1273_IS2_WIDTH_60 0x6
  49. #define WL1273_IS2_WIDTH_64 0x7
  50. #define WL1273_IS2_WIDTH_80 0x8
  51. #define WL1273_IS2_WIDTH_96 0x9
  52. #define WL1273_IS2_WIDTH_128 0xa
  53. #define WL1273_IS2_WIDTH 0xf
  54. #define WL1273_IS2_FORMAT_STD (0x0 << 4)
  55. #define WL1273_IS2_FORMAT_LEFT (0x1 << 4)
  56. #define WL1273_IS2_FORMAT_RIGHT (0x2 << 4)
  57. #define WL1273_IS2_FORMAT_USER (0x3 << 4)
  58. #define WL1273_IS2_MASTER (0x0 << 6)
  59. #define WL1273_IS2_SLAVEW (0x1 << 6)
  60. #define WL1273_IS2_TRI_AFTER_SENDING (0x0 << 7)
  61. #define WL1273_IS2_TRI_ALWAYS_ACTIVE (0x1 << 7)
  62. #define WL1273_IS2_SDOWS_RR (0x0 << 8)
  63. #define WL1273_IS2_SDOWS_RF (0x1 << 8)
  64. #define WL1273_IS2_SDOWS_FR (0x2 << 8)
  65. #define WL1273_IS2_SDOWS_FF (0x3 << 8)
  66. #define WL1273_IS2_TRI_OPT (0x0 << 10)
  67. #define WL1273_IS2_TRI_ALWAYS (0x1 << 10)
  68. #define WL1273_IS2_RATE_48K (0x0 << 12)
  69. #define WL1273_IS2_RATE_44_1K (0x1 << 12)
  70. #define WL1273_IS2_RATE_32K (0x2 << 12)
  71. #define WL1273_IS2_RATE_22_05K (0x4 << 12)
  72. #define WL1273_IS2_RATE_16K (0x5 << 12)
  73. #define WL1273_IS2_RATE_12K (0x8 << 12)
  74. #define WL1273_IS2_RATE_11_025 (0x9 << 12)
  75. #define WL1273_IS2_RATE_8K (0xa << 12)
  76. #define WL1273_IS2_RATE (0xf << 12)
  77. #define WL1273_I2S_DEF_MODE (WL1273_IS2_WIDTH_32 | \
  78. WL1273_IS2_FORMAT_STD | \
  79. WL1273_IS2_MASTER | \
  80. WL1273_IS2_TRI_AFTER_SENDING | \
  81. WL1273_IS2_SDOWS_RR | \
  82. WL1273_IS2_TRI_OPT | \
  83. WL1273_IS2_RATE_48K)
  84. int wl1273_get_format(struct snd_soc_codec *codec, unsigned int *fmt);
  85. #endif /* End of __WL1273_CODEC_H__ */