Commit ada7f67d authored by Xu YiPing's avatar Xu YiPing Committed by Sam Ravnborg

drm: kirin: Rename ade_crtc to kirin_crtc

As part of refactoring the kirin driver to better support
different hardware revisions, this patch renames the
struct ade_crtc to kirin_crtc.

The struct kirin_crtc will later used by both kirin620 and
future kirin960 driver, and will be moved to a common
kirin_drm_drv.h in a future patch

Cc: Rongrong Zou <zourongrong@gmail.com>
Cc: Xinliang Liu <z.liuxinliang@hisilicon.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel <dri-devel@lists.freedesktop.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Acked-by: default avatarXinliang Liu <z.liuxinliang@hisilicon.com>
Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
Signed-off-by: default avatarXu YiPing <xuyiping@hisilicon.com>
[jstultz: reworded commit message]
Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20190820230626.23253-8-john.stultz@linaro.org
parent 0ae622c5
...@@ -38,8 +38,8 @@ ...@@ -38,8 +38,8 @@
#define OUT_OVLY ADE_OVLY2 /* output overlay compositor */ #define OUT_OVLY ADE_OVLY2 /* output overlay compositor */
#define ADE_DEBUG 1 #define ADE_DEBUG 1
#define to_ade_crtc(crtc) \ #define to_kirin_crtc(crtc) \
container_of(crtc, struct ade_crtc, base) container_of(crtc, struct kirin_crtc, base)
#define to_kirin_plane(plane) \ #define to_kirin_plane(plane) \
container_of(plane, struct kirin_plane, base) container_of(plane, struct kirin_plane, base)
...@@ -56,9 +56,9 @@ struct ade_hw_ctx { ...@@ -56,9 +56,9 @@ struct ade_hw_ctx {
int irq; int irq;
}; };
struct ade_crtc { struct kirin_crtc {
struct drm_crtc base; struct drm_crtc base;
struct ade_hw_ctx *ctx; void *hw_ctx;
struct work_struct display_reset_wq; struct work_struct display_reset_wq;
bool enable; bool enable;
}; };
...@@ -70,7 +70,7 @@ struct kirin_plane { ...@@ -70,7 +70,7 @@ struct kirin_plane {
}; };
struct ade_data { struct ade_data {
struct ade_crtc acrtc; struct kirin_crtc crtc;
struct kirin_plane planes[ADE_CH_NUM]; struct kirin_plane planes[ADE_CH_NUM];
struct ade_hw_ctx ctx; struct ade_hw_ctx ctx;
}; };
...@@ -184,8 +184,8 @@ static bool ade_crtc_mode_fixup(struct drm_crtc *crtc, ...@@ -184,8 +184,8 @@ static bool ade_crtc_mode_fixup(struct drm_crtc *crtc,
const struct drm_display_mode *mode, const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode) struct drm_display_mode *adjusted_mode)
{ {
struct ade_crtc *acrtc = to_ade_crtc(crtc); struct kirin_crtc *kcrtc = to_kirin_crtc(crtc);
struct ade_hw_ctx *ctx = acrtc->ctx; struct ade_hw_ctx *ctx = kcrtc->hw_ctx;
adjusted_mode->clock = adjusted_mode->clock =
clk_round_rate(ctx->ade_pix_clk, mode->clock * 1000) / 1000; clk_round_rate(ctx->ade_pix_clk, mode->clock * 1000) / 1000;
...@@ -317,8 +317,8 @@ static void ade_set_medianoc_qos(struct ade_hw_ctx *ctx) ...@@ -317,8 +317,8 @@ static void ade_set_medianoc_qos(struct ade_hw_ctx *ctx)
static int ade_crtc_enable_vblank(struct drm_crtc *crtc) static int ade_crtc_enable_vblank(struct drm_crtc *crtc)
{ {
struct ade_crtc *acrtc = to_ade_crtc(crtc); struct kirin_crtc *kcrtc = to_kirin_crtc(crtc);
struct ade_hw_ctx *ctx = acrtc->ctx; struct ade_hw_ctx *ctx = kcrtc->hw_ctx;
void __iomem *base = ctx->base; void __iomem *base = ctx->base;
if (!ctx->power_on) if (!ctx->power_on)
...@@ -332,8 +332,8 @@ static int ade_crtc_enable_vblank(struct drm_crtc *crtc) ...@@ -332,8 +332,8 @@ static int ade_crtc_enable_vblank(struct drm_crtc *crtc)
static void ade_crtc_disable_vblank(struct drm_crtc *crtc) static void ade_crtc_disable_vblank(struct drm_crtc *crtc)
{ {
struct ade_crtc *acrtc = to_ade_crtc(crtc); struct kirin_crtc *kcrtc = to_kirin_crtc(crtc);
struct ade_hw_ctx *ctx = acrtc->ctx; struct ade_hw_ctx *ctx = kcrtc->hw_ctx;
void __iomem *base = ctx->base; void __iomem *base = ctx->base;
if (!ctx->power_on) { if (!ctx->power_on) {
...@@ -347,7 +347,7 @@ static void ade_crtc_disable_vblank(struct drm_crtc *crtc) ...@@ -347,7 +347,7 @@ static void ade_crtc_disable_vblank(struct drm_crtc *crtc)
static void drm_underflow_wq(struct work_struct *work) static void drm_underflow_wq(struct work_struct *work)
{ {
struct ade_crtc *acrtc = container_of(work, struct ade_crtc, struct kirin_crtc *acrtc = container_of(work, struct kirin_crtc,
display_reset_wq); display_reset_wq);
struct drm_device *drm_dev = (&acrtc->base)->dev; struct drm_device *drm_dev = (&acrtc->base)->dev;
struct drm_atomic_state *state; struct drm_atomic_state *state;
...@@ -358,9 +358,9 @@ static void drm_underflow_wq(struct work_struct *work) ...@@ -358,9 +358,9 @@ static void drm_underflow_wq(struct work_struct *work)
static irqreturn_t ade_irq_handler(int irq, void *data) static irqreturn_t ade_irq_handler(int irq, void *data)
{ {
struct ade_crtc *acrtc = data; struct kirin_crtc *kcrtc = data;
struct ade_hw_ctx *ctx = acrtc->ctx; struct ade_hw_ctx *ctx = kcrtc->hw_ctx;
struct drm_crtc *crtc = &acrtc->base; struct drm_crtc *crtc = &kcrtc->base;
void __iomem *base = ctx->base; void __iomem *base = ctx->base;
u32 status; u32 status;
...@@ -377,7 +377,7 @@ static irqreturn_t ade_irq_handler(int irq, void *data) ...@@ -377,7 +377,7 @@ static irqreturn_t ade_irq_handler(int irq, void *data)
ade_update_bits(base + LDI_INT_CLR, UNDERFLOW_INT_EN_OFST, ade_update_bits(base + LDI_INT_CLR, UNDERFLOW_INT_EN_OFST,
MASK(1), 1); MASK(1), 1);
DRM_ERROR("LDI underflow!"); DRM_ERROR("LDI underflow!");
schedule_work(&acrtc->display_reset_wq); schedule_work(&kcrtc->display_reset_wq);
} }
return IRQ_HANDLED; return IRQ_HANDLED;
...@@ -499,11 +499,11 @@ static void ade_dump_regs(void __iomem *base) { } ...@@ -499,11 +499,11 @@ static void ade_dump_regs(void __iomem *base) { }
static void ade_crtc_atomic_enable(struct drm_crtc *crtc, static void ade_crtc_atomic_enable(struct drm_crtc *crtc,
struct drm_crtc_state *old_state) struct drm_crtc_state *old_state)
{ {
struct ade_crtc *acrtc = to_ade_crtc(crtc); struct kirin_crtc *kcrtc = to_kirin_crtc(crtc);
struct ade_hw_ctx *ctx = acrtc->ctx; struct ade_hw_ctx *ctx = kcrtc->hw_ctx;
int ret; int ret;
if (acrtc->enable) if (kcrtc->enable)
return; return;
if (!ctx->power_on) { if (!ctx->power_on) {
...@@ -516,27 +516,27 @@ static void ade_crtc_atomic_enable(struct drm_crtc *crtc, ...@@ -516,27 +516,27 @@ static void ade_crtc_atomic_enable(struct drm_crtc *crtc,
ade_display_enable(ctx); ade_display_enable(ctx);
ade_dump_regs(ctx->base); ade_dump_regs(ctx->base);
drm_crtc_vblank_on(crtc); drm_crtc_vblank_on(crtc);
acrtc->enable = true; kcrtc->enable = true;
} }
static void ade_crtc_atomic_disable(struct drm_crtc *crtc, static void ade_crtc_atomic_disable(struct drm_crtc *crtc,
struct drm_crtc_state *old_state) struct drm_crtc_state *old_state)
{ {
struct ade_crtc *acrtc = to_ade_crtc(crtc); struct kirin_crtc *kcrtc = to_kirin_crtc(crtc);
struct ade_hw_ctx *ctx = acrtc->ctx; struct ade_hw_ctx *ctx = kcrtc->hw_ctx;
if (!acrtc->enable) if (!kcrtc->enable)
return; return;
drm_crtc_vblank_off(crtc); drm_crtc_vblank_off(crtc);
ade_power_down(ctx); ade_power_down(ctx);
acrtc->enable = false; kcrtc->enable = false;
} }
static void ade_crtc_mode_set_nofb(struct drm_crtc *crtc) static void ade_crtc_mode_set_nofb(struct drm_crtc *crtc)
{ {
struct ade_crtc *acrtc = to_ade_crtc(crtc); struct kirin_crtc *kcrtc = to_kirin_crtc(crtc);
struct ade_hw_ctx *ctx = acrtc->ctx; struct ade_hw_ctx *ctx = kcrtc->hw_ctx;
struct drm_display_mode *mode = &crtc->state->mode; struct drm_display_mode *mode = &crtc->state->mode;
struct drm_display_mode *adj_mode = &crtc->state->adjusted_mode; struct drm_display_mode *adj_mode = &crtc->state->adjusted_mode;
...@@ -548,8 +548,8 @@ static void ade_crtc_mode_set_nofb(struct drm_crtc *crtc) ...@@ -548,8 +548,8 @@ static void ade_crtc_mode_set_nofb(struct drm_crtc *crtc)
static void ade_crtc_atomic_begin(struct drm_crtc *crtc, static void ade_crtc_atomic_begin(struct drm_crtc *crtc,
struct drm_crtc_state *old_state) struct drm_crtc_state *old_state)
{ {
struct ade_crtc *acrtc = to_ade_crtc(crtc); struct kirin_crtc *kcrtc = to_kirin_crtc(crtc);
struct ade_hw_ctx *ctx = acrtc->ctx; struct ade_hw_ctx *ctx = kcrtc->hw_ctx;
struct drm_display_mode *mode = &crtc->state->mode; struct drm_display_mode *mode = &crtc->state->mode;
struct drm_display_mode *adj_mode = &crtc->state->adjusted_mode; struct drm_display_mode *adj_mode = &crtc->state->adjusted_mode;
...@@ -562,13 +562,13 @@ static void ade_crtc_atomic_flush(struct drm_crtc *crtc, ...@@ -562,13 +562,13 @@ static void ade_crtc_atomic_flush(struct drm_crtc *crtc,
struct drm_crtc_state *old_state) struct drm_crtc_state *old_state)
{ {
struct ade_crtc *acrtc = to_ade_crtc(crtc); struct kirin_crtc *kcrtc = to_kirin_crtc(crtc);
struct ade_hw_ctx *ctx = acrtc->ctx; struct ade_hw_ctx *ctx = kcrtc->hw_ctx;
struct drm_pending_vblank_event *event = crtc->state->event; struct drm_pending_vblank_event *event = crtc->state->event;
void __iomem *base = ctx->base; void __iomem *base = ctx->base;
/* only crtc is enabled regs take effect */ /* only crtc is enabled regs take effect */
if (acrtc->enable) { if (kcrtc->enable) {
ade_dump_regs(base); ade_dump_regs(base);
/* flush ade registers */ /* flush ade registers */
writel(ADE_ENABLE, base + ADE_EN); writel(ADE_ENABLE, base + ADE_EN);
...@@ -1007,7 +1007,7 @@ static int ade_drm_init(struct platform_device *pdev) ...@@ -1007,7 +1007,7 @@ static int ade_drm_init(struct platform_device *pdev)
struct drm_device *dev = platform_get_drvdata(pdev); struct drm_device *dev = platform_get_drvdata(pdev);
struct ade_data *ade; struct ade_data *ade;
struct ade_hw_ctx *ctx; struct ade_hw_ctx *ctx;
struct ade_crtc *acrtc; struct kirin_crtc *kcrtc;
struct kirin_plane *kplane; struct kirin_plane *kplane;
enum drm_plane_type type; enum drm_plane_type type;
int ret; int ret;
...@@ -1021,8 +1021,8 @@ static int ade_drm_init(struct platform_device *pdev) ...@@ -1021,8 +1021,8 @@ static int ade_drm_init(struct platform_device *pdev)
platform_set_drvdata(pdev, ade); platform_set_drvdata(pdev, ade);
ctx = &ade->ctx; ctx = &ade->ctx;
acrtc = &ade->acrtc; kcrtc = &ade->crtc;
acrtc->ctx = ctx; kcrtc->hw_ctx = ctx;
ret = ade_dts_parse(pdev, ctx); ret = ade_dts_parse(pdev, ctx);
if (ret) if (ret)
...@@ -1046,15 +1046,15 @@ static int ade_drm_init(struct platform_device *pdev) ...@@ -1046,15 +1046,15 @@ static int ade_drm_init(struct platform_device *pdev)
} }
/* crtc init */ /* crtc init */
ret = ade_crtc_init(dev, &acrtc->base, &ade->planes[PRIMARY_CH].base); ret = ade_crtc_init(dev, &kcrtc->base, &ade->planes[PRIMARY_CH].base);
if (ret) if (ret)
return ret; return ret;
/* vblank irq init */ /* vblank irq init */
ret = devm_request_irq(dev->dev, ctx->irq, ade_irq_handler, ret = devm_request_irq(dev->dev, ctx->irq, ade_irq_handler,
IRQF_SHARED, dev->driver->name, acrtc); IRQF_SHARED, dev->driver->name, kcrtc);
INIT_WORK(&acrtc->display_reset_wq, drm_underflow_wq); INIT_WORK(&kcrtc->display_reset_wq, drm_underflow_wq);
if (ret) if (ret)
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment