core.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. };
  22. #define ARIZONA_IRQ_GP1 0
  23. #define ARIZONA_IRQ_GP2 1
  24. #define ARIZONA_IRQ_GP3 2
  25. #define ARIZONA_IRQ_GP4 3
  26. #define ARIZONA_IRQ_GP5_FALL 4
  27. #define ARIZONA_IRQ_GP5_RISE 5
  28. #define ARIZONA_IRQ_JD_FALL 6
  29. #define ARIZONA_IRQ_JD_RISE 7
  30. #define ARIZONA_IRQ_DSP1_RAM_RDY 8
  31. #define ARIZONA_IRQ_DSP_IRQ1 9
  32. #define ARIZONA_IRQ_DSP_IRQ2 10
  33. #define ARIZONA_IRQ_SPK_SHUTDOWN_WARN 11
  34. #define ARIZONA_IRQ_SPK_SHUTDOWN 12
  35. #define ARIZONA_IRQ_MICDET 13
  36. #define ARIZONA_IRQ_HPDET 14
  37. #define ARIZONA_IRQ_WSEQ_DONE 15
  38. #define ARIZONA_IRQ_DRC2_SIG_DET 16
  39. #define ARIZONA_IRQ_DRC1_SIG_DET 17
  40. #define ARIZONA_IRQ_ASRC2_LOCK 18
  41. #define ARIZONA_IRQ_ASRC1_LOCK 19
  42. #define ARIZONA_IRQ_UNDERCLOCKED 20
  43. #define ARIZONA_IRQ_OVERCLOCKED 21
  44. #define ARIZONA_IRQ_FLL2_LOCK 22
  45. #define ARIZONA_IRQ_FLL1_LOCK 23
  46. #define ARIZONA_IRQ_CLKGEN_ERR 24
  47. #define ARIZONA_IRQ_CLKGEN_ERR_ASYNC 25
  48. #define ARIZONA_IRQ_ASRC_CFG_ERR 26
  49. #define ARIZONA_IRQ_AIF3_ERR 27
  50. #define ARIZONA_IRQ_AIF2_ERR 28
  51. #define ARIZONA_IRQ_AIF1_ERR 29
  52. #define ARIZONA_IRQ_CTRLIF_ERR 30
  53. #define ARIZONA_IRQ_MIXER_DROPPED_SAMPLES 31
  54. #define ARIZONA_IRQ_ASYNC_CLK_ENA_LOW 32
  55. #define ARIZONA_IRQ_SYSCLK_ENA_LOW 33
  56. #define ARIZONA_IRQ_ISRC1_CFG_ERR 34
  57. #define ARIZONA_IRQ_ISRC2_CFG_ERR 35
  58. #define ARIZONA_IRQ_BOOT_DONE 36
  59. #define ARIZONA_IRQ_DCS_DAC_DONE 37
  60. #define ARIZONA_IRQ_DCS_HP_DONE 38
  61. #define ARIZONA_IRQ_FLL2_CLOCK_OK 39
  62. #define ARIZONA_IRQ_FLL1_CLOCK_OK 40
  63. #define ARIZONA_NUM_IRQ 41
  64. struct arizona {
  65. struct regmap *regmap;
  66. struct device *dev;
  67. enum arizona_type type;
  68. unsigned int rev;
  69. int num_core_supplies;
  70. struct regulator_bulk_data core_supplies[ARIZONA_MAX_CORE_SUPPLIES];
  71. struct arizona_pdata pdata;
  72. int irq;
  73. struct irq_domain *virq;
  74. struct regmap_irq_chip_data *aod_irq_chip;
  75. struct regmap_irq_chip_data *irq_chip;
  76. struct mutex clk_lock;
  77. int clk32k_ref;
  78. };
  79. int arizona_clk32k_enable(struct arizona *arizona);
  80. int arizona_clk32k_disable(struct arizona *arizona);
  81. int arizona_request_irq(struct arizona *arizona, int irq, char *name,
  82. irq_handler_t handler, void *data);
  83. void arizona_free_irq(struct arizona *arizona, int irq, void *data);
  84. int arizona_set_irq_wake(struct arizona *arizona, int irq, int on);
  85. int wm5102_patch(struct arizona *arizona);
  86. #endif