uda1341.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. /*
  2. * linux/include/linux/l3/uda1341.h
  3. *
  4. * Philips UDA1341 mixer device driver for ALSA
  5. *
  6. * Copyright (c) 2002 Tomas Kasparek <tomas.kasparek@seznam.cz>
  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.
  10. *
  11. * History:
  12. *
  13. * 2002-03-13 Tomas Kasparek Initial release - based on uda1341.h from OSS
  14. * 2002-03-30 Tomas Kasparek Proc filesystem support, complete mixer and DSP
  15. * features support
  16. */
  17. /* $Id: uda1341.h,v 1.6 2004/05/03 17:36:50 tiwai Exp $ */
  18. #define UDA1341_ALSA_NAME "snd-uda1341"
  19. /*
  20. * Default rate set after inicialization
  21. */
  22. #define AUDIO_RATE_DEFAULT 44100
  23. /*
  24. * UDA1341 L3 address and command types
  25. */
  26. #define UDA1341_L3ADDR 5
  27. #define UDA1341_DATA0 (UDA1341_L3ADDR << 2 | 0)
  28. #define UDA1341_DATA1 (UDA1341_L3ADDR << 2 | 1)
  29. #define UDA1341_STATUS (UDA1341_L3ADDR << 2 | 2)
  30. enum uda1341_onoff {
  31. OFF=0,
  32. ON,
  33. };
  34. const char *onoff_names[] = {
  35. "Off",
  36. "On",
  37. };
  38. enum uda1341_format {
  39. I2S=0,
  40. LSB16,
  41. LSB18,
  42. LSB20,
  43. MSB,
  44. LSB16MSB,
  45. LSB18MSB,
  46. LSB20MSB,
  47. };
  48. const char *format_names[] = {
  49. "I2S-bus",
  50. "LSB 16bits",
  51. "LSB 18bits",
  52. "LSB 20bits",
  53. "MSB",
  54. "in LSB 16bits/out MSB",
  55. "in LSB 18bits/out MSB",
  56. "in LSB 20bits/out MSB",
  57. };
  58. enum uda1341_fs {
  59. F512=0,
  60. F384,
  61. F256,
  62. Funused,
  63. };
  64. const char *fs_names[] = {
  65. "512*fs",
  66. "384*fs",
  67. "256*fs",
  68. "Unused - bad value!",
  69. };
  70. enum uda1341_peak {
  71. BEFORE=0,
  72. AFTER,
  73. };
  74. const char *peak_names[] = {
  75. "before",
  76. "after",
  77. };
  78. enum uda1341_filter {
  79. FLAT=0,
  80. MIN,
  81. MIN2,
  82. MAX,
  83. };
  84. const char *filter_names[] = {
  85. "flat",
  86. "min",
  87. "min",
  88. "max",
  89. };
  90. const char*bass_values[][16] = {
  91. {"0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB",
  92. "0 dB", "0 dB", "0 dB", "0 dB", "undefined", }, //flat
  93. {"0 dB", "2 dB", "4 dB", "6 dB", "8 dB", "10 dB", "12 dB", "14 dB", "16 dB", "18 dB", "18 dB",
  94. "18 dB", "18 dB", "18 dB", "18 dB", "undefined",}, // min
  95. {"0 dB", "2 dB", "4 dB", "6 dB", "8 dB", "10 dB", "12 dB", "14 dB", "16 dB", "18 dB", "18 dB",
  96. "18 dB", "18 dB", "18 dB", "18 dB", "undefined",}, // min
  97. {"0 dB", "2 dB", "4 dB", "6 dB", "8 dB", "10 dB", "12 dB", "14 dB", "16 dB", "18 dB", "20 dB",
  98. "22 dB", "24 dB", "24 dB", "24 dB", "undefined",}, // max
  99. };
  100. enum uda1341_mixer {
  101. DOUBLE,
  102. LINE,
  103. MIC,
  104. MIXER,
  105. };
  106. const char *mixer_names[] = {
  107. "double differential",
  108. "input channel 1 (line in)",
  109. "input channel 2 (microphone)",
  110. "digital mixer",
  111. };
  112. enum uda1341_deemp {
  113. NONE,
  114. D32,
  115. D44,
  116. D48,
  117. };
  118. const char *deemp_names[] = {
  119. "none",
  120. "32 kHz",
  121. "44.1 kHz",
  122. "48 kHz",
  123. };
  124. const char *mic_sens_value[] = {
  125. "-3 dB", "0 dB", "3 dB", "9 dB", "15 dB", "21 dB", "27 dB", "not used",
  126. };
  127. const unsigned short AGC_atime[] = {
  128. 11, 16, 11, 16, 21, 11, 16, 21,
  129. };
  130. const unsigned short AGC_dtime[] = {
  131. 100, 100, 200, 200, 200, 400, 400, 400,
  132. };
  133. const char *AGC_level[] = {
  134. "-9.0", "-11.5", "-15.0", "-17.5",
  135. };
  136. const char *ig_small_value[] = {
  137. "-3.0", "-2.5", "-2.0", "-1.5", "-1.0", "-0.5",
  138. };
  139. /*
  140. * this was computed as peak_value[i] = pow((63-i)*1.42,1.013)
  141. *
  142. * UDA1341 datasheet on page 21: Peak value (dB) = (Peak level - 63.5)*5*log2
  143. * There is an table with these values [level]=value: [3]=-90.31, [7]=-84.29
  144. * [61]=-2.78, [62] = -1.48, [63] = 0.0
  145. * I tried to compute it, but using but even using logarithm with base either 10 or 2
  146. * i was'n able to get values in the table from the formula. So I constructed another
  147. * formula (see above) to interpolate the values as good as possible. If there is some
  148. * mistake, please contact me on tomas.kasparek@seznam.cz. Thanks.
  149. * UDA1341TS datasheet is available at:
  150. * http://www-us9.semiconductors.com/acrobat/datasheets/UDA1341TS_3.pdf
  151. */
  152. const char *peak_value[] = {
  153. "-INF dB", "N.A.", "N.A", "90.31 dB", "N.A.", "N.A.", "N.A.", "-84.29 dB",
  154. "-82.65 dB", "-81.13 dB", "-79.61 dB", "-78.09 dB", "-76.57 dB", "-75.05 dB", "-73.53 dB",
  155. "-72.01 dB", "-70.49 dB", "-68.97 dB", "-67.45 dB", "-65.93 dB", "-64.41 dB", "-62.90 dB",
  156. "-61.38 dB", "-59.86 dB", "-58.35 dB", "-56.83 dB", "-55.32 dB", "-53.80 dB", "-52.29 dB",
  157. "-50.78 dB", "-49.26 dB", "-47.75 dB", "-46.24 dB", "-44.73 dB", "-43.22 dB", "-41.71 dB",
  158. "-40.20 dB", "-38.69 dB", "-37.19 dB", "-35.68 dB", "-34.17 dB", "-32.67 dB", "-31.17 dB",
  159. "-29.66 dB", "-28.16 dB", "-26.66 dB", "-25.16 dB", "-23.66 dB", "-22.16 dB", "-20.67 dB",
  160. "-19.17 dB", "-17.68 dB", "-16.19 dB", "-14.70 dB", "-13.21 dB", "-11.72 dB", "-10.24 dB",
  161. "-8.76 dB", "-7.28 dB", "-5.81 dB", "-4.34 dB", "-2.88 dB", "-1.43 dB", "0.00 dB",
  162. };
  163. enum uda1341_config {
  164. CMD_READ_REG = 0,
  165. CMD_RESET,
  166. CMD_FS,
  167. CMD_FORMAT,
  168. CMD_OGAIN,
  169. CMD_IGAIN,
  170. CMD_DAC,
  171. CMD_ADC,
  172. CMD_VOLUME,
  173. CMD_BASS,
  174. CMD_TREBBLE,
  175. CMD_PEAK,
  176. CMD_DEEMP,
  177. CMD_MUTE,
  178. CMD_FILTER,
  179. CMD_CH1,
  180. CMD_CH2,
  181. CMD_MIC,
  182. CMD_MIXER,
  183. CMD_AGC,
  184. CMD_IG,
  185. CMD_AGC_TIME,
  186. CMD_AGC_LEVEL,
  187. #ifdef CONFIG_PM
  188. CMD_SUSPEND,
  189. CMD_RESUME,
  190. #endif
  191. CMD_LAST,
  192. };
  193. enum write_through {
  194. //used in update_bits (write_cfg) to avoid l3_write - just update local copy of regs.
  195. REGS_ONLY=0,
  196. //update local regs and write value to uda1341 - do l3_write
  197. FLUSH,
  198. };
  199. int __init snd_chip_uda1341_mixer_new(snd_card_t *card, struct l3_client **clnt);
  200. /*
  201. * Local variables:
  202. * indent-tabs-mode: t
  203. * End:
  204. */