armada_crtc.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * Copyright (C) 2012 Russell King
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. */
  8. #ifndef ARMADA_CRTC_H
  9. #define ARMADA_CRTC_H
  10. struct armada_gem_object;
  11. struct armada_regs {
  12. uint32_t offset;
  13. uint32_t mask;
  14. uint32_t val;
  15. };
  16. #define armada_reg_queue_mod(_r, _i, _v, _m, _o) \
  17. do { \
  18. struct armada_regs *__reg = _r; \
  19. __reg[_i].offset = _o; \
  20. __reg[_i].mask = ~(_m); \
  21. __reg[_i].val = _v; \
  22. _i++; \
  23. } while (0)
  24. #define armada_reg_queue_set(_r, _i, _v, _o) \
  25. armada_reg_queue_mod(_r, _i, _v, ~0, _o)
  26. #define armada_reg_queue_end(_r, _i) \
  27. armada_reg_queue_mod(_r, _i, 0, 0, ~0)
  28. struct armada_frame_work;
  29. struct armada_crtc {
  30. struct drm_crtc crtc;
  31. unsigned num;
  32. void __iomem *base;
  33. struct clk *clk;
  34. struct {
  35. uint32_t spu_v_h_total;
  36. uint32_t spu_v_porch;
  37. uint32_t spu_adv_reg;
  38. } v[2];
  39. bool interlaced;
  40. uint8_t csc_yuv_mode;
  41. uint8_t csc_rgb_mode;
  42. struct drm_plane *plane;
  43. int dpms;
  44. uint32_t cfg_dumb_ctrl;
  45. uint32_t dumb_ctrl;
  46. uint32_t spu_iopad_ctrl;
  47. wait_queue_head_t frame_wait;
  48. struct armada_frame_work *frame_work;
  49. spinlock_t irq_lock;
  50. uint32_t irq_ena;
  51. struct list_head vbl_list;
  52. };
  53. #define drm_to_armada_crtc(c) container_of(c, struct armada_crtc, crtc)
  54. int armada_drm_crtc_create(struct drm_device *, unsigned, struct resource *);
  55. void armada_drm_crtc_gamma_set(struct drm_crtc *, u16, u16, u16, int);
  56. void armada_drm_crtc_gamma_get(struct drm_crtc *, u16 *, u16 *, u16 *, int);
  57. void armada_drm_crtc_irq(struct armada_crtc *, u32);
  58. void armada_drm_crtc_disable_irq(struct armada_crtc *, u32);
  59. void armada_drm_crtc_enable_irq(struct armada_crtc *, u32);
  60. void armada_drm_crtc_update_regs(struct armada_crtc *, struct armada_regs *);
  61. #endif