tidss_irq.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (C) 2018 Texas Instruments Incorporated - https://www.ti.com/
  4. * Author: Tomi Valkeinen <[email protected]>
  5. */
  6. #ifndef __TIDSS_IRQ_H__
  7. #define __TIDSS_IRQ_H__
  8. #include <linux/types.h>
  9. #include "tidss_drv.h"
  10. /*
  11. * The IRQ status from various DISPC IRQ registers are packed into a single
  12. * value, where the bits are defined as follows:
  13. *
  14. * bit group |dev|wb |mrg0|mrg1|mrg2|mrg3|plane0-3| <unused> |
  15. * bit use |D |fou|FEOL|FEOL|FEOL|FEOL| UUUU | |
  16. * bit number|0 |1-3|4-7 |8-11| 12-19 | 20-23 | 24-31 |
  17. *
  18. * device bits: D = OCP error
  19. * WB bits: f = frame done wb, o = wb buffer overflow,
  20. * u = wb buffer uncomplete
  21. * vp bits: F = frame done, E = vsync even, O = vsync odd, L = sync lost
  22. * plane bits: U = fifo underflow
  23. */
  24. #define DSS_IRQ_DEVICE_OCP_ERR BIT(0)
  25. #define DSS_IRQ_DEVICE_FRAMEDONEWB BIT(1)
  26. #define DSS_IRQ_DEVICE_WBBUFFEROVERFLOW BIT(2)
  27. #define DSS_IRQ_DEVICE_WBUNCOMPLETEERROR BIT(3)
  28. #define DSS_IRQ_DEVICE_WB_MASK GENMASK(3, 1)
  29. #define DSS_IRQ_VP_BIT_N(ch, bit) (4 + 4 * (ch) + (bit))
  30. #define DSS_IRQ_PLANE_BIT_N(plane, bit) \
  31. (DSS_IRQ_VP_BIT_N(TIDSS_MAX_PORTS, 0) + 1 * (plane) + (bit))
  32. #define DSS_IRQ_VP_BIT(ch, bit) BIT(DSS_IRQ_VP_BIT_N((ch), (bit)))
  33. #define DSS_IRQ_PLANE_BIT(plane, bit) \
  34. BIT(DSS_IRQ_PLANE_BIT_N((plane), (bit)))
  35. static inline dispc_irq_t DSS_IRQ_VP_MASK(u32 ch)
  36. {
  37. return GENMASK(DSS_IRQ_VP_BIT_N((ch), 3), DSS_IRQ_VP_BIT_N((ch), 0));
  38. }
  39. static inline dispc_irq_t DSS_IRQ_PLANE_MASK(u32 plane)
  40. {
  41. return GENMASK(DSS_IRQ_PLANE_BIT_N((plane), 0),
  42. DSS_IRQ_PLANE_BIT_N((plane), 0));
  43. }
  44. #define DSS_IRQ_VP_FRAME_DONE(ch) DSS_IRQ_VP_BIT((ch), 0)
  45. #define DSS_IRQ_VP_VSYNC_EVEN(ch) DSS_IRQ_VP_BIT((ch), 1)
  46. #define DSS_IRQ_VP_VSYNC_ODD(ch) DSS_IRQ_VP_BIT((ch), 2)
  47. #define DSS_IRQ_VP_SYNC_LOST(ch) DSS_IRQ_VP_BIT((ch), 3)
  48. #define DSS_IRQ_PLANE_FIFO_UNDERFLOW(plane) DSS_IRQ_PLANE_BIT((plane), 0)
  49. struct drm_crtc;
  50. struct drm_device;
  51. struct tidss_device;
  52. void tidss_irq_enable_vblank(struct drm_crtc *crtc);
  53. void tidss_irq_disable_vblank(struct drm_crtc *crtc);
  54. int tidss_irq_install(struct drm_device *ddev, unsigned int irq);
  55. void tidss_irq_uninstall(struct drm_device *ddev);
  56. void tidss_irq_resume(struct tidss_device *tidss);
  57. #endif