pdata.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. /*
  2. * Platform data for Arizona devices
  3. *
  4. * Copyright 2012 Wolfson Microelectronics. PLC.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #ifndef _ARIZONA_PDATA_H
  11. #define _ARIZONA_PDATA_H
  12. #define ARIZONA_GPN_DIR 0x8000 /* GPN_DIR */
  13. #define ARIZONA_GPN_DIR_MASK 0x8000 /* GPN_DIR */
  14. #define ARIZONA_GPN_DIR_SHIFT 15 /* GPN_DIR */
  15. #define ARIZONA_GPN_DIR_WIDTH 1 /* GPN_DIR */
  16. #define ARIZONA_GPN_PU 0x4000 /* GPN_PU */
  17. #define ARIZONA_GPN_PU_MASK 0x4000 /* GPN_PU */
  18. #define ARIZONA_GPN_PU_SHIFT 14 /* GPN_PU */
  19. #define ARIZONA_GPN_PU_WIDTH 1 /* GPN_PU */
  20. #define ARIZONA_GPN_PD 0x2000 /* GPN_PD */
  21. #define ARIZONA_GPN_PD_MASK 0x2000 /* GPN_PD */
  22. #define ARIZONA_GPN_PD_SHIFT 13 /* GPN_PD */
  23. #define ARIZONA_GPN_PD_WIDTH 1 /* GPN_PD */
  24. #define ARIZONA_GPN_LVL 0x0800 /* GPN_LVL */
  25. #define ARIZONA_GPN_LVL_MASK 0x0800 /* GPN_LVL */
  26. #define ARIZONA_GPN_LVL_SHIFT 11 /* GPN_LVL */
  27. #define ARIZONA_GPN_LVL_WIDTH 1 /* GPN_LVL */
  28. #define ARIZONA_GPN_POL 0x0400 /* GPN_POL */
  29. #define ARIZONA_GPN_POL_MASK 0x0400 /* GPN_POL */
  30. #define ARIZONA_GPN_POL_SHIFT 10 /* GPN_POL */
  31. #define ARIZONA_GPN_POL_WIDTH 1 /* GPN_POL */
  32. #define ARIZONA_GPN_OP_CFG 0x0200 /* GPN_OP_CFG */
  33. #define ARIZONA_GPN_OP_CFG_MASK 0x0200 /* GPN_OP_CFG */
  34. #define ARIZONA_GPN_OP_CFG_SHIFT 9 /* GPN_OP_CFG */
  35. #define ARIZONA_GPN_OP_CFG_WIDTH 1 /* GPN_OP_CFG */
  36. #define ARIZONA_GPN_DB 0x0100 /* GPN_DB */
  37. #define ARIZONA_GPN_DB_MASK 0x0100 /* GPN_DB */
  38. #define ARIZONA_GPN_DB_SHIFT 8 /* GPN_DB */
  39. #define ARIZONA_GPN_DB_WIDTH 1 /* GPN_DB */
  40. #define ARIZONA_GPN_FN_MASK 0x007F /* GPN_FN - [6:0] */
  41. #define ARIZONA_GPN_FN_SHIFT 0 /* GPN_FN - [6:0] */
  42. #define ARIZONA_GPN_FN_WIDTH 7 /* GPN_FN - [6:0] */
  43. #define ARIZONA_MAX_GPIO 5
  44. #define ARIZONA_32KZ_MCLK1 1
  45. #define ARIZONA_32KZ_MCLK2 2
  46. #define ARIZONA_32KZ_NONE 3
  47. #define ARIZONA_MAX_INPUT 4
  48. #define ARIZONA_DMIC_MICVDD 0
  49. #define ARIZONA_DMIC_MICBIAS1 1
  50. #define ARIZONA_DMIC_MICBIAS2 2
  51. #define ARIZONA_DMIC_MICBIAS3 3
  52. #define ARIZONA_MAX_MICBIAS 3
  53. #define ARIZONA_INMODE_DIFF 0
  54. #define ARIZONA_INMODE_SE 1
  55. #define ARIZONA_INMODE_DMIC 2
  56. #define ARIZONA_MAX_OUTPUT 6
  57. #define ARIZONA_MAX_AIF 3
  58. #define ARIZONA_HAP_ACT_ERM 0
  59. #define ARIZONA_HAP_ACT_LRA 2
  60. #define ARIZONA_MAX_PDM_SPK 2
  61. struct regulator_init_data;
  62. struct arizona_micbias {
  63. int mV; /** Regulated voltage */
  64. unsigned int ext_cap:1; /** External capacitor fitted */
  65. unsigned int discharge:1; /** Actively discharge */
  66. unsigned int soft_start:1; /** Disable aggressive startup ramp rate */
  67. unsigned int bypass:1; /** Use bypass mode */
  68. };
  69. struct arizona_micd_config {
  70. unsigned int src;
  71. unsigned int bias;
  72. bool gpio;
  73. };
  74. struct arizona_micd_range {
  75. int max; /** Ohms */
  76. int key; /** Key to report to input layer */
  77. };
  78. struct arizona_pdata {
  79. int reset; /** GPIO controlling /RESET, if any */
  80. int ldoena; /** GPIO controlling LODENA, if any */
  81. /** Regulator configuration for MICVDD */
  82. struct regulator_init_data *micvdd;
  83. /** Regulator configuration for LDO1 */
  84. struct regulator_init_data *ldo1;
  85. /** If a direct 32kHz clock is provided on an MCLK specify it here */
  86. int clk32k_src;
  87. /** Mode for primary IRQ (defaults to active low) */
  88. unsigned int irq_flags;
  89. /* Base GPIO */
  90. int gpio_base;
  91. /** Pin state for GPIO pins */
  92. int gpio_defaults[ARIZONA_MAX_GPIO];
  93. /**
  94. * Maximum number of channels clocks will be generated for,
  95. * useful for systems where and I2S bus with multiple data
  96. * lines is mastered.
  97. */
  98. int max_channels_clocked[ARIZONA_MAX_AIF];
  99. /** GPIO5 is used for jack detection */
  100. bool jd_gpio5;
  101. /** Internal pull on GPIO5 is disabled when used for jack detection */
  102. bool jd_gpio5_nopull;
  103. /** Use the headphone detect circuit to identify the accessory */
  104. bool hpdet_acc_id;
  105. /** Check for line output with HPDET method */
  106. bool hpdet_acc_id_line;
  107. /** GPIO used for mic isolation with HPDET */
  108. int hpdet_id_gpio;
  109. /** Extra debounce timeout used during initial mic detection (ms) */
  110. int micd_detect_debounce;
  111. /** GPIO for mic detection polarity */
  112. int micd_pol_gpio;
  113. /** Mic detect ramp rate */
  114. int micd_bias_start_time;
  115. /** Mic detect sample rate */
  116. int micd_rate;
  117. /** Mic detect debounce level */
  118. int micd_dbtime;
  119. /** Mic detect timeout (ms) */
  120. int micd_timeout;
  121. /** Force MICBIAS on for mic detect */
  122. bool micd_force_micbias;
  123. /** Mic detect level parameters */
  124. const struct arizona_micd_range *micd_ranges;
  125. int num_micd_ranges;
  126. /** Headset polarity configurations */
  127. struct arizona_micd_config *micd_configs;
  128. int num_micd_configs;
  129. /** Reference voltage for DMIC inputs */
  130. int dmic_ref[ARIZONA_MAX_INPUT];
  131. /** MICBIAS configurations */
  132. struct arizona_micbias micbias[ARIZONA_MAX_MICBIAS];
  133. /** Mode of input structures */
  134. int inmode[ARIZONA_MAX_INPUT];
  135. /** Mode for outputs */
  136. bool out_mono[ARIZONA_MAX_OUTPUT];
  137. /** PDM speaker mute setting */
  138. unsigned int spk_mute[ARIZONA_MAX_PDM_SPK];
  139. /** PDM speaker format */
  140. unsigned int spk_fmt[ARIZONA_MAX_PDM_SPK];
  141. /** Haptic actuator type */
  142. unsigned int hap_act;
  143. /** GPIO for primary IRQ (used for edge triggered emulation) */
  144. int irq_gpio;
  145. };
  146. #endif