core.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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 3
  19. enum arizona_type {
  20. WM5102 = 1,
  21. WM5110 = 2,
  22. WM8997 = 3,
  23. };
  24. #define ARIZONA_IRQ_GP1 0
  25. #define ARIZONA_IRQ_GP2 1
  26. #define ARIZONA_IRQ_GP3 2
  27. #define ARIZONA_IRQ_GP4 3
  28. #define ARIZONA_IRQ_GP5_FALL 4
  29. #define ARIZONA_IRQ_GP5_RISE 5
  30. #define ARIZONA_IRQ_JD_FALL 6
  31. #define ARIZONA_IRQ_JD_RISE 7
  32. #define ARIZONA_IRQ_DSP1_RAM_RDY 8
  33. #define ARIZONA_IRQ_DSP2_RAM_RDY 9
  34. #define ARIZONA_IRQ_DSP3_RAM_RDY 10
  35. #define ARIZONA_IRQ_DSP4_RAM_RDY 11
  36. #define ARIZONA_IRQ_DSP_IRQ1 12
  37. #define ARIZONA_IRQ_DSP_IRQ2 13
  38. #define ARIZONA_IRQ_DSP_IRQ3 14
  39. #define ARIZONA_IRQ_DSP_IRQ4 15
  40. #define ARIZONA_IRQ_DSP_IRQ5 16
  41. #define ARIZONA_IRQ_DSP_IRQ6 17
  42. #define ARIZONA_IRQ_DSP_IRQ7 18
  43. #define ARIZONA_IRQ_DSP_IRQ8 19
  44. #define ARIZONA_IRQ_SPK_SHUTDOWN_WARN 20
  45. #define ARIZONA_IRQ_SPK_SHUTDOWN 21
  46. #define ARIZONA_IRQ_MICDET 22
  47. #define ARIZONA_IRQ_HPDET 23
  48. #define ARIZONA_IRQ_WSEQ_DONE 24
  49. #define ARIZONA_IRQ_DRC2_SIG_DET 25
  50. #define ARIZONA_IRQ_DRC1_SIG_DET 26
  51. #define ARIZONA_IRQ_ASRC2_LOCK 27
  52. #define ARIZONA_IRQ_ASRC1_LOCK 28
  53. #define ARIZONA_IRQ_UNDERCLOCKED 29
  54. #define ARIZONA_IRQ_OVERCLOCKED 30
  55. #define ARIZONA_IRQ_FLL2_LOCK 31
  56. #define ARIZONA_IRQ_FLL1_LOCK 32
  57. #define ARIZONA_IRQ_CLKGEN_ERR 33
  58. #define ARIZONA_IRQ_CLKGEN_ERR_ASYNC 34
  59. #define ARIZONA_IRQ_ASRC_CFG_ERR 35
  60. #define ARIZONA_IRQ_AIF3_ERR 36
  61. #define ARIZONA_IRQ_AIF2_ERR 37
  62. #define ARIZONA_IRQ_AIF1_ERR 38
  63. #define ARIZONA_IRQ_CTRLIF_ERR 39
  64. #define ARIZONA_IRQ_MIXER_DROPPED_SAMPLES 40
  65. #define ARIZONA_IRQ_ASYNC_CLK_ENA_LOW 41
  66. #define ARIZONA_IRQ_SYSCLK_ENA_LOW 42
  67. #define ARIZONA_IRQ_ISRC1_CFG_ERR 43
  68. #define ARIZONA_IRQ_ISRC2_CFG_ERR 44
  69. #define ARIZONA_IRQ_BOOT_DONE 45
  70. #define ARIZONA_IRQ_DCS_DAC_DONE 46
  71. #define ARIZONA_IRQ_DCS_HP_DONE 47
  72. #define ARIZONA_IRQ_FLL2_CLOCK_OK 48
  73. #define ARIZONA_IRQ_FLL1_CLOCK_OK 49
  74. #define ARIZONA_IRQ_MICD_CLAMP_RISE 50
  75. #define ARIZONA_IRQ_MICD_CLAMP_FALL 51
  76. #define ARIZONA_NUM_IRQ 52
  77. struct snd_soc_dapm_context;
  78. struct arizona {
  79. struct regmap *regmap;
  80. struct device *dev;
  81. enum arizona_type type;
  82. unsigned int rev;
  83. int num_core_supplies;
  84. struct regulator_bulk_data core_supplies[ARIZONA_MAX_CORE_SUPPLIES];
  85. struct regulator *dcvdd;
  86. struct arizona_pdata pdata;
  87. unsigned int external_dcvdd:1;
  88. int irq;
  89. struct irq_domain *virq;
  90. struct regmap_irq_chip_data *aod_irq_chip;
  91. struct regmap_irq_chip_data *irq_chip;
  92. bool hpdet_magic;
  93. unsigned int hp_ena;
  94. struct mutex clk_lock;
  95. int clk32k_ref;
  96. struct snd_soc_dapm_context *dapm;
  97. };
  98. int arizona_clk32k_enable(struct arizona *arizona);
  99. int arizona_clk32k_disable(struct arizona *arizona);
  100. int arizona_request_irq(struct arizona *arizona, int irq, char *name,
  101. irq_handler_t handler, void *data);
  102. void arizona_free_irq(struct arizona *arizona, int irq, void *data);
  103. int arizona_set_irq_wake(struct arizona *arizona, int irq, int on);
  104. int wm5102_patch(struct arizona *arizona);
  105. int wm5110_patch(struct arizona *arizona);
  106. int wm8997_patch(struct arizona *arizona);
  107. #endif