armada_crtc.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. bool cursor_update;
  41. uint8_t csc_yuv_mode;
  42. uint8_t csc_rgb_mode;
  43. struct drm_plane *plane;
  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. int dpms;
  52. uint32_t cfg_dumb_ctrl;
  53. uint32_t dumb_ctrl;
  54. uint32_t spu_iopad_ctrl;
  55. wait_queue_head_t frame_wait;
  56. struct armada_frame_work *frame_work;
  57. spinlock_t irq_lock;
  58. uint32_t irq_ena;
  59. struct list_head vbl_list;
  60. };
  61. #define drm_to_armada_crtc(c) container_of(c, struct armada_crtc, crtc)
  62. int armada_drm_crtc_create(struct drm_device *, unsigned, struct resource *);
  63. void armada_drm_crtc_gamma_set(struct drm_crtc *, u16, u16, u16, int);
  64. void armada_drm_crtc_gamma_get(struct drm_crtc *, u16 *, u16 *, u16 *, int);
  65. void armada_drm_crtc_irq(struct armada_crtc *, u32);
  66. void armada_drm_crtc_disable_irq(struct armada_crtc *, u32);
  67. void armada_drm_crtc_enable_irq(struct armada_crtc *, u32);
  68. void armada_drm_crtc_update_regs(struct armada_crtc *, struct armada_regs *);
  69. #endif