core.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. /*
  2. * Arizona MFD internals
  3. *
  4. * Copyright 2012 Wolfson Microelectronics plc
  5. *
  6. * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #ifndef _WM_ARIZONA_CORE_H
  13. #define _WM_ARIZONA_CORE_H
  14. #include <linux/interrupt.h>
  15. #include <linux/regmap.h>
  16. #include <linux/regulator/consumer.h>
  17. #include <linux/mfd/arizona/pdata.h>
  18. #define ARIZONA_MAX_CORE_SUPPLIES 2
  19. enum arizona_type {
  20. WM5102 = 1,
  21. WM5110 = 2,
  22. WM8997 = 3,
  23. WM8280 = 4,
  24. WM8998 = 5,
  25. WM1814 = 6,
  26. };
  27. #define ARIZONA_IRQ_GP1 0
  28. #define ARIZONA_IRQ_GP2 1
  29. #define ARIZONA_IRQ_GP3 2
  30. #define ARIZONA_IRQ_GP4 3
  31. #define ARIZONA_IRQ_GP5_FALL 4
  32. #define ARIZONA_IRQ_GP5_RISE 5
  33. #define ARIZONA_IRQ_JD_FALL 6
  34. #define ARIZONA_IRQ_JD_RISE 7
  35. #define ARIZONA_IRQ_DSP1_RAM_RDY 8
  36. #define ARIZONA_IRQ_DSP2_RAM_RDY 9
  37. #define ARIZONA_IRQ_DSP3_RAM_RDY 10
  38. #define ARIZONA_IRQ_DSP4_RAM_RDY 11
  39. #define ARIZONA_IRQ_DSP_IRQ1 12
  40. #define ARIZONA_IRQ_DSP_IRQ2 13
  41. #define ARIZONA_IRQ_DSP_IRQ3 14
  42. #define ARIZONA_IRQ_DSP_IRQ4 15
  43. #define ARIZONA_IRQ_DSP_IRQ5 16
  44. #define ARIZONA_IRQ_DSP_IRQ6 17
  45. #define ARIZONA_IRQ_DSP_IRQ7 18
  46. #define ARIZONA_IRQ_DSP_IRQ8 19
  47. #define ARIZONA_IRQ_SPK_OVERHEAT_WARN 20
  48. #define ARIZONA_IRQ_SPK_OVERHEAT 21
  49. #define ARIZONA_IRQ_MICDET 22
  50. #define ARIZONA_IRQ_HPDET 23
  51. #define ARIZONA_IRQ_WSEQ_DONE 24
  52. #define ARIZONA_IRQ_DRC2_SIG_DET 25
  53. #define ARIZONA_IRQ_DRC1_SIG_DET 26
  54. #define ARIZONA_IRQ_ASRC2_LOCK 27
  55. #define ARIZONA_IRQ_ASRC1_LOCK 28
  56. #define ARIZONA_IRQ_UNDERCLOCKED 29
  57. #define ARIZONA_IRQ_OVERCLOCKED 30
  58. #define ARIZONA_IRQ_FLL2_LOCK 31
  59. #define ARIZONA_IRQ_FLL1_LOCK 32
  60. #define ARIZONA_IRQ_CLKGEN_ERR 33
  61. #define ARIZONA_IRQ_CLKGEN_ERR_ASYNC 34
  62. #define ARIZONA_IRQ_ASRC_CFG_ERR 35
  63. #define ARIZONA_IRQ_AIF3_ERR 36
  64. #define ARIZONA_IRQ_AIF2_ERR 37
  65. #define ARIZONA_IRQ_AIF1_ERR 38
  66. #define ARIZONA_IRQ_CTRLIF_ERR 39
  67. #define ARIZONA_IRQ_MIXER_DROPPED_SAMPLES 40
  68. #define ARIZONA_IRQ_ASYNC_CLK_ENA_LOW 41
  69. #define ARIZONA_IRQ_SYSCLK_ENA_LOW 42
  70. #define ARIZONA_IRQ_ISRC1_CFG_ERR 43
  71. #define ARIZONA_IRQ_ISRC2_CFG_ERR 44
  72. #define ARIZONA_IRQ_BOOT_DONE 45
  73. #define ARIZONA_IRQ_DCS_DAC_DONE 46
  74. #define ARIZONA_IRQ_DCS_HP_DONE 47
  75. #define ARIZONA_IRQ_FLL2_CLOCK_OK 48
  76. #define ARIZONA_IRQ_FLL1_CLOCK_OK 49
  77. #define ARIZONA_IRQ_MICD_CLAMP_RISE 50
  78. #define ARIZONA_IRQ_MICD_CLAMP_FALL 51
  79. #define ARIZONA_IRQ_HP3R_DONE 52
  80. #define ARIZONA_IRQ_HP3L_DONE 53
  81. #define ARIZONA_IRQ_HP2R_DONE 54
  82. #define ARIZONA_IRQ_HP2L_DONE 55
  83. #define ARIZONA_IRQ_HP1R_DONE 56
  84. #define ARIZONA_IRQ_HP1L_DONE 57
  85. #define ARIZONA_IRQ_ISRC3_CFG_ERR 58
  86. #define ARIZONA_IRQ_DSP_SHARED_WR_COLL 59
  87. #define ARIZONA_IRQ_SPK_SHUTDOWN 60
  88. #define ARIZONA_IRQ_SPK1R_SHORT 61
  89. #define ARIZONA_IRQ_SPK1L_SHORT 62
  90. #define ARIZONA_IRQ_HP3R_SC_NEG 63
  91. #define ARIZONA_IRQ_HP3R_SC_POS 64
  92. #define ARIZONA_IRQ_HP3L_SC_NEG 65
  93. #define ARIZONA_IRQ_HP3L_SC_POS 66
  94. #define ARIZONA_IRQ_HP2R_SC_NEG 67
  95. #define ARIZONA_IRQ_HP2R_SC_POS 68
  96. #define ARIZONA_IRQ_HP2L_SC_NEG 69
  97. #define ARIZONA_IRQ_HP2L_SC_POS 70
  98. #define ARIZONA_IRQ_HP1R_SC_NEG 71
  99. #define ARIZONA_IRQ_HP1R_SC_POS 72
  100. #define ARIZONA_IRQ_HP1L_SC_NEG 73
  101. #define ARIZONA_IRQ_HP1L_SC_POS 74
  102. #define ARIZONA_NUM_IRQ 75
  103. struct snd_soc_dapm_context;
  104. struct arizona {
  105. struct regmap *regmap;
  106. struct device *dev;
  107. enum arizona_type type;
  108. unsigned int rev;
  109. int num_core_supplies;
  110. struct regulator_bulk_data core_supplies[ARIZONA_MAX_CORE_SUPPLIES];
  111. struct regulator *dcvdd;
  112. bool has_fully_powered_off;
  113. struct arizona_pdata pdata;
  114. unsigned int external_dcvdd:1;
  115. int irq;
  116. struct irq_domain *virq;
  117. struct regmap_irq_chip_data *aod_irq_chip;
  118. struct regmap_irq_chip_data *irq_chip;
  119. bool hpdet_clamp;
  120. unsigned int hp_ena;
  121. struct mutex clk_lock;
  122. int clk32k_ref;
  123. bool ctrlif_error;
  124. struct snd_soc_dapm_context *dapm;
  125. int tdm_width[ARIZONA_MAX_AIF];
  126. int tdm_slots[ARIZONA_MAX_AIF];
  127. uint16_t dac_comp_coeff;
  128. uint8_t dac_comp_enabled;
  129. struct mutex dac_comp_lock;
  130. };
  131. int arizona_clk32k_enable(struct arizona *arizona);
  132. int arizona_clk32k_disable(struct arizona *arizona);
  133. int arizona_request_irq(struct arizona *arizona, int irq, char *name,
  134. irq_handler_t handler, void *data);
  135. void arizona_free_irq(struct arizona *arizona, int irq, void *data);
  136. int arizona_set_irq_wake(struct arizona *arizona, int irq, int on);
  137. #ifdef CONFIG_MFD_WM5102
  138. int wm5102_patch(struct arizona *arizona);
  139. #else
  140. static inline int wm5102_patch(struct arizona *arizona)
  141. {
  142. return 0;
  143. }
  144. #endif
  145. int wm5110_patch(struct arizona *arizona);
  146. int wm8997_patch(struct arizona *arizona);
  147. int wm8998_patch(struct arizona *arizona);
  148. extern int arizona_of_get_named_gpio(struct arizona *arizona, const char *prop,
  149. bool mandatory);
  150. #endif