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 11 struct armada_gem_object; 12 13 struct armada_regs { 14 uint32_t offset; 15 uint32_t mask; 16 uint32_t val; 17 }; 18 19 #define armada_reg_queue_mod(_r, _i, _v, _m, _o) \ 20 do { \ 21 struct armada_regs *__reg = _r; \ 22 __reg[_i].offset = _o; \ 23 __reg[_i].mask = ~(_m); \ 24 __reg[_i].val = _v; \ 25 _i++; \ 26 } while (0) 27 28 #define armada_reg_queue_set(_r, _i, _v, _o) \ 29 armada_reg_queue_mod(_r, _i, _v, ~0, _o) 30 31 #define armada_reg_queue_end(_r, _i) \ 32 armada_reg_queue_mod(_r, _i, 0, 0, ~0) 33 34 struct armada_crtc; 35 struct armada_variant; 36 37 struct armada_crtc { 38 struct drm_crtc crtc; 39 const struct armada_variant *variant; 40 unsigned num; 41 void __iomem *base; 42 struct clk *clk; 43 struct clk *extclk[2]; 44 struct { 45 uint32_t spu_v_h_total; 46 uint32_t spu_v_porch; 47 uint32_t spu_adv_reg; 48 } v[2]; 49 bool interlaced; 50 bool cursor_update; 51 52 struct armada_gem_object *cursor_obj; 53 int cursor_x; 54 int cursor_y; 55 uint32_t cursor_hw_pos; 56 uint32_t cursor_hw_sz; 57 uint32_t cursor_w; 58 uint32_t cursor_h; 59 60 uint32_t cfg_dumb_ctrl; 61 uint32_t spu_iopad_ctrl; 62 63 spinlock_t irq_lock; 64 uint32_t irq_ena; 65 66 bool update_pending; 67 struct drm_pending_vblank_event *event; 68 struct armada_regs atomic_regs[32]; 69 struct armada_regs *regs; 70 unsigned int regs_idx; 71 }; 72 #define drm_to_armada_crtc(c) container_of(c, struct armada_crtc, crtc) 73 74 void armada_drm_crtc_update_regs(struct armada_crtc *, struct armada_regs *); 75 76 extern struct platform_driver armada_lcd_platform_driver; 77 78 #endif 79