armada_crtc.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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_crtc;
  29. struct armada_variant;
  30. struct armada_crtc {
  31. struct drm_crtc crtc;
  32. const struct armada_variant *variant;
  33. unsigned num;
  34. void __iomem *base;
  35. struct clk *clk;
  36. struct clk *extclk[2];
  37. struct {
  38. uint32_t spu_v_h_total;
  39. uint32_t spu_v_porch;
  40. uint32_t spu_adv_reg;
  41. } v[2];
  42. bool interlaced;
  43. bool cursor_update;
  44. struct armada_gem_object *cursor_obj;
  45. int cursor_x;
  46. int cursor_y;
  47. uint32_t cursor_hw_pos;
  48. uint32_t cursor_hw_sz;
  49. uint32_t cursor_w;
  50. uint32_t cursor_h;
  51. uint32_t cfg_dumb_ctrl;
  52. uint32_t spu_iopad_ctrl;
  53. spinlock_t irq_lock;
  54. uint32_t irq_ena;
  55. bool update_pending;
  56. struct drm_pending_vblank_event *event;
  57. struct armada_regs atomic_regs[32];
  58. struct armada_regs *regs;
  59. unsigned int regs_idx;
  60. };
  61. #define drm_to_armada_crtc(c) container_of(c, struct armada_crtc, crtc)
  62. void armada_drm_crtc_update_regs(struct armada_crtc *, struct armada_regs *);
  63. extern struct platform_driver armada_lcd_platform_driver;
  64. #endif