2012-08-15 12:59:49 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2012 Russell King
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
#ifndef ARMADA_CRTC_H
|
|
|
|
#define ARMADA_CRTC_H
|
|
|
|
|
|
|
|
struct armada_gem_object;
|
|
|
|
|
|
|
|
struct armada_regs {
|
|
|
|
uint32_t offset;
|
|
|
|
uint32_t mask;
|
|
|
|
uint32_t val;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define armada_reg_queue_mod(_r, _i, _v, _m, _o) \
|
|
|
|
do { \
|
|
|
|
struct armada_regs *__reg = _r; \
|
|
|
|
__reg[_i].offset = _o; \
|
|
|
|
__reg[_i].mask = ~(_m); \
|
|
|
|
__reg[_i].val = _v; \
|
|
|
|
_i++; \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define armada_reg_queue_set(_r, _i, _v, _o) \
|
|
|
|
armada_reg_queue_mod(_r, _i, _v, ~0, _o)
|
|
|
|
|
|
|
|
#define armada_reg_queue_end(_r, _i) \
|
|
|
|
armada_reg_queue_mod(_r, _i, 0, 0, ~0)
|
|
|
|
|
2015-08-06 15:37:18 +00:00
|
|
|
struct armada_crtc;
|
|
|
|
struct armada_plane;
|
2014-04-22 14:24:03 +00:00
|
|
|
struct armada_variant;
|
2012-08-15 12:59:49 +00:00
|
|
|
|
2015-08-06 15:37:18 +00:00
|
|
|
struct armada_plane_work {
|
2017-07-07 14:55:53 +00:00
|
|
|
void (*fn)(struct armada_crtc *, struct armada_plane_work *);
|
2017-07-07 14:56:20 +00:00
|
|
|
void (*cancel)(struct armada_crtc *, struct armada_plane_work *);
|
2017-07-08 09:22:25 +00:00
|
|
|
bool need_kfree;
|
2017-07-07 14:55:53 +00:00
|
|
|
struct drm_plane *plane;
|
2017-07-08 09:16:52 +00:00
|
|
|
struct drm_framebuffer *old_fb;
|
2017-07-08 09:16:53 +00:00
|
|
|
struct drm_pending_vblank_event *event;
|
2018-07-30 10:52:34 +00:00
|
|
|
struct armada_regs regs[24];
|
2015-08-06 15:37:18 +00:00
|
|
|
};
|
|
|
|
|
2015-07-15 17:11:24 +00:00
|
|
|
struct armada_plane {
|
|
|
|
struct drm_plane base;
|
2015-07-15 17:11:25 +00:00
|
|
|
wait_queue_head_t frame_wait;
|
2015-08-06 15:37:18 +00:00
|
|
|
struct armada_plane_work *work;
|
2015-07-15 17:11:24 +00:00
|
|
|
};
|
|
|
|
#define drm_to_armada_plane(p) container_of(p, struct armada_plane, base)
|
|
|
|
|
2015-08-06 15:37:18 +00:00
|
|
|
int armada_drm_plane_work_queue(struct armada_crtc *dcrtc,
|
2017-07-07 14:55:53 +00:00
|
|
|
struct armada_plane_work *work);
|
2015-08-06 15:37:18 +00:00
|
|
|
int armada_drm_plane_work_wait(struct armada_plane *plane, long timeout);
|
2017-07-07 14:55:40 +00:00
|
|
|
void armada_drm_plane_work_cancel(struct armada_crtc *dcrtc,
|
|
|
|
struct armada_plane *plane);
|
2018-07-30 10:52:34 +00:00
|
|
|
|
2012-08-15 12:59:49 +00:00
|
|
|
struct armada_crtc {
|
|
|
|
struct drm_crtc crtc;
|
2014-04-22 14:24:03 +00:00
|
|
|
const struct armada_variant *variant;
|
2012-08-15 12:59:49 +00:00
|
|
|
unsigned num;
|
|
|
|
void __iomem *base;
|
|
|
|
struct clk *clk;
|
2014-04-22 14:21:30 +00:00
|
|
|
struct clk *extclk[2];
|
2012-08-15 12:59:49 +00:00
|
|
|
struct {
|
|
|
|
uint32_t spu_v_h_total;
|
|
|
|
uint32_t spu_v_porch;
|
|
|
|
uint32_t spu_adv_reg;
|
|
|
|
} v[2];
|
|
|
|
bool interlaced;
|
2013-05-19 09:55:17 +00:00
|
|
|
bool cursor_update;
|
2012-08-15 12:59:49 +00:00
|
|
|
|
|
|
|
struct drm_plane *plane;
|
|
|
|
|
2013-05-19 09:55:17 +00:00
|
|
|
struct armada_gem_object *cursor_obj;
|
|
|
|
int cursor_x;
|
|
|
|
int cursor_y;
|
|
|
|
uint32_t cursor_hw_pos;
|
|
|
|
uint32_t cursor_hw_sz;
|
|
|
|
uint32_t cursor_w;
|
|
|
|
uint32_t cursor_h;
|
|
|
|
|
2012-08-15 12:59:49 +00:00
|
|
|
int dpms;
|
|
|
|
uint32_t cfg_dumb_ctrl;
|
|
|
|
uint32_t spu_iopad_ctrl;
|
|
|
|
|
|
|
|
spinlock_t irq_lock;
|
|
|
|
uint32_t irq_ena;
|
2018-07-30 10:52:34 +00:00
|
|
|
|
2018-07-30 10:52:34 +00:00
|
|
|
struct drm_pending_vblank_event *event;
|
2018-07-30 10:52:34 +00:00
|
|
|
struct armada_regs atomic_regs[32];
|
|
|
|
struct armada_regs *regs;
|
|
|
|
unsigned int regs_idx;
|
2012-08-15 12:59:49 +00:00
|
|
|
};
|
|
|
|
#define drm_to_armada_crtc(c) container_of(c, struct armada_crtc, crtc)
|
|
|
|
|
|
|
|
void armada_drm_crtc_update_regs(struct armada_crtc *, struct armada_regs *);
|
|
|
|
|
2014-04-22 10:10:15 +00:00
|
|
|
extern struct platform_driver armada_lcd_platform_driver;
|
|
|
|
|
2012-08-15 12:59:49 +00:00
|
|
|
#endif
|