armada_crtc.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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_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. uint8_t csc_yuv_mode;
  45. uint8_t csc_rgb_mode;
  46. struct drm_plane *plane;
  47. struct armada_gem_object *cursor_obj;
  48. int cursor_x;
  49. int cursor_y;
  50. uint32_t cursor_hw_pos;
  51. uint32_t cursor_hw_sz;
  52. uint32_t cursor_w;
  53. uint32_t cursor_h;
  54. int dpms;
  55. uint32_t cfg_dumb_ctrl;
  56. uint32_t dumb_ctrl;
  57. uint32_t spu_iopad_ctrl;
  58. wait_queue_head_t frame_wait;
  59. struct armada_frame_work *frame_work;
  60. spinlock_t irq_lock;
  61. uint32_t irq_ena;
  62. struct list_head vbl_list;
  63. };
  64. #define drm_to_armada_crtc(c) container_of(c, struct armada_crtc, crtc)
  65. struct device_node;
  66. int armada_drm_crtc_create(struct drm_device *, struct device *,
  67. struct resource *, int, const struct armada_variant *,
  68. struct device_node *);
  69. void armada_drm_crtc_gamma_set(struct drm_crtc *, u16, u16, u16, int);
  70. void armada_drm_crtc_gamma_get(struct drm_crtc *, u16 *, u16 *, u16 *, int);
  71. void armada_drm_crtc_disable_irq(struct armada_crtc *, u32);
  72. void armada_drm_crtc_enable_irq(struct armada_crtc *, u32);
  73. void armada_drm_crtc_update_regs(struct armada_crtc *, struct armada_regs *);
  74. extern struct platform_driver armada_lcd_platform_driver;
  75. #endif