pdata.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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. #include <dt-bindings/mfd/arizona.h>
  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_MASK 0x4000 /* GPN_PU */
  17. #define ARIZONA_GPN_PU_SHIFT 14 /* GPN_PU */
  18. #define ARIZONA_GPN_PU_WIDTH 1 /* GPN_PU */
  19. #define ARIZONA_GPN_PD_MASK 0x2000 /* GPN_PD */
  20. #define ARIZONA_GPN_PD_SHIFT 13 /* GPN_PD */
  21. #define ARIZONA_GPN_PD_WIDTH 1 /* GPN_PD */
  22. #define ARIZONA_GPN_LVL_MASK 0x0800 /* GPN_LVL */
  23. #define ARIZONA_GPN_LVL_SHIFT 11 /* GPN_LVL */
  24. #define ARIZONA_GPN_LVL_WIDTH 1 /* GPN_LVL */
  25. #define ARIZONA_GPN_POL_MASK 0x0400 /* GPN_POL */
  26. #define ARIZONA_GPN_POL_SHIFT 10 /* GPN_POL */
  27. #define ARIZONA_GPN_POL_WIDTH 1 /* GPN_POL */
  28. #define ARIZONA_GPN_OP_CFG_MASK 0x0200 /* GPN_OP_CFG */
  29. #define ARIZONA_GPN_OP_CFG_SHIFT 9 /* GPN_OP_CFG */
  30. #define ARIZONA_GPN_OP_CFG_WIDTH 1 /* GPN_OP_CFG */
  31. #define ARIZONA_GPN_DB_MASK 0x0100 /* GPN_DB */
  32. #define ARIZONA_GPN_DB_SHIFT 8 /* GPN_DB */
  33. #define ARIZONA_GPN_DB_WIDTH 1 /* GPN_DB */
  34. #define ARIZONA_GPN_FN_MASK 0x007F /* GPN_FN - [6:0] */
  35. #define ARIZONA_GPN_FN_SHIFT 0 /* GPN_FN - [6:0] */
  36. #define ARIZONA_GPN_FN_WIDTH 7 /* GPN_FN - [6:0] */
  37. #define ARIZONA_MAX_GPIO 5
  38. #define ARIZONA_MAX_INPUT 4
  39. #define ARIZONA_MAX_MICBIAS 3
  40. #define ARIZONA_MAX_OUTPUT 6
  41. #define ARIZONA_MAX_AIF 3
  42. #define ARIZONA_HAP_ACT_ERM 0
  43. #define ARIZONA_HAP_ACT_LRA 2
  44. #define ARIZONA_MAX_PDM_SPK 2
  45. struct regulator_init_data;
  46. struct arizona_micbias {
  47. int mV; /** Regulated voltage */
  48. unsigned int ext_cap:1; /** External capacitor fitted */
  49. unsigned int discharge:1; /** Actively discharge */
  50. unsigned int soft_start:1; /** Disable aggressive startup ramp rate */
  51. unsigned int bypass:1; /** Use bypass mode */
  52. };
  53. struct arizona_micd_config {
  54. unsigned int src;
  55. unsigned int bias;
  56. bool gpio;
  57. };
  58. struct arizona_micd_range {
  59. int max; /** Ohms */
  60. int key; /** Key to report to input layer */
  61. };
  62. struct arizona_pdata {
  63. int reset; /** GPIO controlling /RESET, if any */
  64. int ldoena; /** GPIO controlling LODENA, if any */
  65. /** Regulator configuration for MICVDD */
  66. struct regulator_init_data *micvdd;
  67. /** Regulator configuration for LDO1 */
  68. struct regulator_init_data *ldo1;
  69. /** If a direct 32kHz clock is provided on an MCLK specify it here */
  70. int clk32k_src;
  71. /** Mode for primary IRQ (defaults to active low) */
  72. unsigned int irq_flags;
  73. /* Base GPIO */
  74. int gpio_base;
  75. /** Pin state for GPIO pins */
  76. unsigned int gpio_defaults[ARIZONA_MAX_GPIO];
  77. /**
  78. * Maximum number of channels clocks will be generated for,
  79. * useful for systems where and I2S bus with multiple data
  80. * lines is mastered.
  81. */
  82. unsigned int max_channels_clocked[ARIZONA_MAX_AIF];
  83. /** GPIO5 is used for jack detection */
  84. bool jd_gpio5;
  85. /** Internal pull on GPIO5 is disabled when used for jack detection */
  86. bool jd_gpio5_nopull;
  87. /** set to true if jackdet contact opens on insert */
  88. bool jd_invert;
  89. /** Use the headphone detect circuit to identify the accessory */
  90. bool hpdet_acc_id;
  91. /** Check for line output with HPDET method */
  92. bool hpdet_acc_id_line;
  93. /** GPIO used for mic isolation with HPDET */
  94. int hpdet_id_gpio;
  95. /** Channel to use for headphone detection */
  96. unsigned int hpdet_channel;
  97. /** Use software comparison to determine mic presence */
  98. bool micd_software_compare;
  99. /** Extra debounce timeout used during initial mic detection (ms) */
  100. unsigned int micd_detect_debounce;
  101. /** GPIO for mic detection polarity */
  102. int micd_pol_gpio;
  103. /** Mic detect ramp rate */
  104. unsigned int micd_bias_start_time;
  105. /** Mic detect sample rate */
  106. unsigned int micd_rate;
  107. /** Mic detect debounce level */
  108. unsigned int micd_dbtime;
  109. /** Mic detect timeout (ms) */
  110. unsigned int micd_timeout;
  111. /** Force MICBIAS on for mic detect */
  112. bool micd_force_micbias;
  113. /** Mic detect level parameters */
  114. const struct arizona_micd_range *micd_ranges;
  115. int num_micd_ranges;
  116. /** Headset polarity configurations */
  117. struct arizona_micd_config *micd_configs;
  118. int num_micd_configs;
  119. /** Reference voltage for DMIC inputs */
  120. int dmic_ref[ARIZONA_MAX_INPUT];
  121. /** MICBIAS configurations */
  122. struct arizona_micbias micbias[ARIZONA_MAX_MICBIAS];
  123. /**
  124. * Mode of input structures
  125. * One of the ARIZONA_INMODE_xxx values
  126. * wm5102/wm5110/wm8280/wm8997: [0]=IN1 [1]=IN2 [2]=IN3 [3]=IN4
  127. * wm8998: [0]=IN1A [1]=IN2A [2]=IN1B [3]=IN2B
  128. */
  129. int inmode[ARIZONA_MAX_INPUT];
  130. /** Mode for outputs */
  131. bool out_mono[ARIZONA_MAX_OUTPUT];
  132. /** PDM speaker mute setting */
  133. unsigned int spk_mute[ARIZONA_MAX_PDM_SPK];
  134. /** PDM speaker format */
  135. unsigned int spk_fmt[ARIZONA_MAX_PDM_SPK];
  136. /** Haptic actuator type */
  137. unsigned int hap_act;
  138. /** GPIO for primary IRQ (used for edge triggered emulation) */
  139. int irq_gpio;
  140. /** General purpose switch control */
  141. unsigned int gpsw;
  142. };
  143. #endif