pdata.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. /* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #ifndef __MFD_TABLA_PDATA_H__
  13. #define __MFD_TABLA_PDATA_H__
  14. #include <linux/slimbus/slimbus.h>
  15. #define MICBIAS_EXT_BYP_CAP 0x00
  16. #define MICBIAS_NO_EXT_BYP_CAP 0x01
  17. #define SITAR_LDOH_1P95_V 0x0
  18. #define SITAR_LDOH_2P35_V 0x1
  19. #define SITAR_LDOH_2P75_V 0x2
  20. #define SITAR_LDOH_2P85_V 0x3
  21. #define SITAR_CFILT1_SEL 0x0
  22. #define SITAR_CFILT2_SEL 0x1
  23. #define SITAR_CFILT3_SEL 0x2
  24. #define WCD9XXX_LDOH_1P95_V 0x0
  25. #define WCD9XXX_LDOH_2P35_V 0x1
  26. #define WCD9XXX_LDOH_2P75_V 0x2
  27. #define WCD9XXX_LDOH_2P85_V 0x3
  28. #define WCD9XXX_LDOH_3P0_V 0x3
  29. #define TABLA_LDOH_1P95_V 0x0
  30. #define TABLA_LDOH_2P35_V 0x1
  31. #define TABLA_LDOH_2P75_V 0x2
  32. #define TABLA_LDOH_2P85_V 0x3
  33. #define TABLA_CFILT1_SEL 0x0
  34. #define TABLA_CFILT2_SEL 0x1
  35. #define TABLA_CFILT3_SEL 0x2
  36. #define MAX_AMIC_CHANNEL 7
  37. #define TABLA_OCP_300_MA 0x0
  38. #define TABLA_OCP_350_MA 0x2
  39. #define TABLA_OCP_365_MA 0x3
  40. #define TABLA_OCP_150_MA 0x4
  41. #define TABLA_OCP_190_MA 0x6
  42. #define TABLA_OCP_220_MA 0x7
  43. #define TABLA_DCYCLE_255 0x0
  44. #define TABLA_DCYCLE_511 0x1
  45. #define TABLA_DCYCLE_767 0x2
  46. #define TABLA_DCYCLE_1023 0x3
  47. #define TABLA_DCYCLE_1279 0x4
  48. #define TABLA_DCYCLE_1535 0x5
  49. #define TABLA_DCYCLE_1791 0x6
  50. #define TABLA_DCYCLE_2047 0x7
  51. #define TABLA_DCYCLE_2303 0x8
  52. #define TABLA_DCYCLE_2559 0x9
  53. #define TABLA_DCYCLE_2815 0xA
  54. #define TABLA_DCYCLE_3071 0xB
  55. #define TABLA_DCYCLE_3327 0xC
  56. #define TABLA_DCYCLE_3583 0xD
  57. #define TABLA_DCYCLE_3839 0xE
  58. #define TABLA_DCYCLE_4095 0xF
  59. #define WCD9XXX_MCLK_CLK_12P288MHZ 12288000
  60. #define WCD9XXX_MCLK_CLK_9P6HZ 9600000
  61. /* Only valid for 9.6 MHz mclk */
  62. #define WCD9XXX_DMIC_SAMPLE_RATE_2P4MHZ 2400000
  63. #define WCD9XXX_DMIC_SAMPLE_RATE_3P2MHZ 3200000
  64. #define WCD9XXX_DMIC_SAMPLE_RATE_4P8MHZ 4800000
  65. /* Only valid for 12.288 MHz mclk */
  66. #define WCD9XXX_DMIC_SAMPLE_RATE_3P072MHZ 3072000
  67. #define WCD9XXX_DMIC_SAMPLE_RATE_4P096MHZ 4096000
  68. #define WCD9XXX_DMIC_SAMPLE_RATE_6P144MHZ 6144000
  69. #define WCD9XXX_DMIC_SAMPLE_RATE_UNDEFINED 0
  70. struct wcd9xxx_amic {
  71. /*legacy mode, txfe_enable and txfe_buff take 7 input
  72. * each bit represent the channel / TXFE number
  73. * and numbered as below
  74. * bit 0 = channel 1 / TXFE1_ENABLE / TXFE1_BUFF
  75. * bit 1 = channel 2 / TXFE2_ENABLE / TXFE2_BUFF
  76. * ...
  77. * bit 7 = channel 7 / TXFE7_ENABLE / TXFE7_BUFF
  78. */
  79. u8 legacy_mode:MAX_AMIC_CHANNEL;
  80. u8 txfe_enable:MAX_AMIC_CHANNEL;
  81. u8 txfe_buff:MAX_AMIC_CHANNEL;
  82. u8 use_pdata:MAX_AMIC_CHANNEL;
  83. };
  84. /* Each micbias can be assigned to one of three cfilters
  85. * Vbatt_min >= .15V + ldoh_v
  86. * ldoh_v >= .15v + cfiltx_mv
  87. * If ldoh_v = 1.95 160 mv < cfiltx_mv < 1800 mv
  88. * If ldoh_v = 2.35 200 mv < cfiltx_mv < 2200 mv
  89. * If ldoh_v = 2.75 240 mv < cfiltx_mv < 2600 mv
  90. * If ldoh_v = 2.85 250 mv < cfiltx_mv < 2700 mv
  91. */
  92. struct wcd9xxx_micbias_setting {
  93. u8 ldoh_v;
  94. u32 cfilt1_mv; /* in mv */
  95. u32 cfilt2_mv; /* in mv */
  96. u32 cfilt3_mv; /* in mv */
  97. /* Different WCD9xxx series codecs may not
  98. * have 4 mic biases. If a codec has fewer
  99. * mic biases, some of these properties will
  100. * not be used.
  101. */
  102. u8 bias1_cfilt_sel;
  103. u8 bias2_cfilt_sel;
  104. u8 bias3_cfilt_sel;
  105. u8 bias4_cfilt_sel;
  106. u8 bias1_cap_mode;
  107. u8 bias2_cap_mode;
  108. u8 bias3_cap_mode;
  109. u8 bias4_cap_mode;
  110. bool bias2_is_headset_only;
  111. };
  112. struct wcd9xxx_ocp_setting {
  113. unsigned int use_pdata:1; /* 0 - use sys default as recommended */
  114. unsigned int num_attempts:4; /* up to 15 attempts */
  115. unsigned int run_time:4; /* in duty cycle */
  116. unsigned int wait_time:4; /* in duty cycle */
  117. unsigned int hph_ocp_limit:3; /* Headphone OCP current limit */
  118. };
  119. #define WCD9XXX_MAX_REGULATOR 8
  120. /*
  121. * format : TABLA_<POWER_SUPPLY_PIN_NAME>_CUR_MAX
  122. *
  123. * <POWER_SUPPLY_PIN_NAME> from Tabla objective spec
  124. */
  125. #define WCD9XXX_CDC_VDDA_CP_CUR_MAX 500000
  126. #define WCD9XXX_CDC_VDDA_RX_CUR_MAX 20000
  127. #define WCD9XXX_CDC_VDDA_TX_CUR_MAX 20000
  128. #define WCD9XXX_VDDIO_CDC_CUR_MAX 5000
  129. #define WCD9XXX_VDDD_CDC_D_CUR_MAX 5000
  130. #define WCD9XXX_VDDD_CDC_A_CUR_MAX 5000
  131. #define WCD9XXX_VDD_SPKDRV_NAME "cdc-vdd-spkdrv"
  132. struct wcd9xxx_regulator {
  133. const char *name;
  134. int min_uV;
  135. int max_uV;
  136. int optimum_uA;
  137. bool ondemand;
  138. struct regulator *regulator;
  139. };
  140. struct wcd9xxx_pdata {
  141. int irq;
  142. int irq_base;
  143. int num_irqs;
  144. int reset_gpio;
  145. struct wcd9xxx_amic amic_settings;
  146. struct slim_device slimbus_slave_device;
  147. struct wcd9xxx_micbias_setting micbias;
  148. struct wcd9xxx_ocp_setting ocp;
  149. struct wcd9xxx_regulator regulator[WCD9XXX_MAX_REGULATOR];
  150. u32 mclk_rate;
  151. u32 dmic_sample_rate;
  152. };
  153. #endif