wsa881x-irq.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /* Copyright (c) 2015, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #ifndef __WSA881X_IRQ_H__
  13. #define __WSA881X_IRQ_H__
  14. #include <linux/irqdomain.h>
  15. #include <linux/interrupt.h>
  16. #include <sound/soc.h>
  17. /**
  18. * enum wsa_interrupts - wsa interrupt number
  19. * @WSA_INT_SAF2WAR: Temp irq interrupt, from safe state to warning state.
  20. * @WSA_INT_WAR2SAF: Temp irq interrupt, from warning state to safe state.
  21. * @WSA_INT_DISABLE: Disable Temp sensor interrupts.
  22. * @WSA_INT_OCP: OCP interrupt.
  23. * @WSA_INT_CLIP: CLIP detect interrupt.
  24. * @WSA_NUM_IRQS: MAX Interrupt number.
  25. *
  26. * WSA IRQ Interrupt numbers.
  27. */
  28. enum wsa_interrupts {
  29. WSA_INT_SAF2WAR = 0,
  30. WSA_INT_WAR2SAF,
  31. WSA_INT_DISABLE,
  32. WSA_INT_OCP,
  33. WSA_INT_CLIP,
  34. WSA_NUM_IRQS,
  35. };
  36. /**
  37. * struct wsa_resource - the basic wsa_resource structure
  38. * @irq_lock: lock used by irq_chip functions.
  39. * @nested_irq_lock: lock used while handling nested interrupts.
  40. * @irq: interrupt number.
  41. * @irq_masks_cur: current mask value to be written to mask registers.
  42. * @irq_masks_cache: cached mask value.
  43. * @num_irqs: number of supported interrupts.
  44. * @num_irq_regs: number of irq registers.
  45. * @parent: parent pointer.
  46. * @dev: device pointer.
  47. * @domain: irq domain pointer.
  48. * codec: codec pointer.
  49. *
  50. * Contains required members used in wsa irq driver.
  51. */
  52. struct wsa_resource {
  53. struct mutex irq_lock;
  54. struct mutex nested_irq_lock;
  55. unsigned int irq;
  56. u8 irq_masks_cur;
  57. u8 irq_masks_cache;
  58. bool irq_level_high[8];
  59. int num_irqs;
  60. int num_irq_regs;
  61. void *parent;
  62. struct device *dev;
  63. struct irq_domain *domain;
  64. struct snd_soc_codec *codec;
  65. };
  66. void wsa_set_codec(struct snd_soc_codec *codec);
  67. void wsa_free_irq(int irq, void *data);
  68. void wsa_enable_irq(struct wsa_resource *wsa_res, int irq);
  69. void wsa_disable_irq(struct wsa_resource *wsa_res, int irq);
  70. void wsa_disable_irq_sync(struct wsa_resource *wsa_res, int irq);
  71. int wsa_request_irq(struct wsa_resource *wsa_res,
  72. int irq, irq_handler_t handler,
  73. const char *name, void *data);
  74. void wsa_irq_exit(struct wsa_resource *wsa_res);
  75. #endif /* __WSA881X_IRQ_H__ */