From patchwork Tue Apr 23 23:20:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 162748 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp4354722jan; Tue, 23 Apr 2019 16:21:16 -0700 (PDT) X-Received: by 2002:a65:4108:: with SMTP id w8mr27262325pgp.236.1556061676715; Tue, 23 Apr 2019 16:21:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556061676; cv=none; d=google.com; s=arc-20160816; b=EfF4JGDWrfcIyKLCvTiLM9EKoCMoE9Bj3I75GIDIduuY77caoZUYvvZycltQrT+7pt 9gSDNSEcOhQAtxgMpZHF0EqAuffBjv+iZw1iylrWAekQU+eWwk1mHAhJ2ilU6+bkKVgx w8QbZc56BGQEgcMczYB3BMRL3h6TkIWKkGvauqT9mzzTYYtAW5knxX3wDUFaQIoamLHi HcjR0Rs7PiRPLT6hzWHP0qpQ9dpm5QN57oKJCirfa7tEHcVQDXCDZfHjrvlXRo1NP5js t+wyF9ObqU+w6H4KVmBchreL22mlp3UAHoOy7DueW/C+PdQNIf30M8QbASvwGtdcTUzk Oekw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QV6q4rIQIKonURhV5YI0Y2da8qAlozUPAhHD+uzvbZs=; b=Pn3Uwm35J9kblppD94JGbetnvm5YNv5kW2Jh1LTzeBrjg265T6DPAv6J7kSDEpZUUY 1sQFq2EklCi6U16QKLMCBPfhSQFTpOFcyj3pKC7LxWzc3kEP+moiyQr0PTyLt+Q66wxb Eh3kaJ3Hs6on/hfYXBcoNGt/4hpf0VnXJ8AQPt4ku+MbRrb+EdWtjn5/ooQ/EGkRHPgR Bx7wCN1jbuWxFkxd69xc8kq2Fn9bHQAbAZUWzjaJal0FwvWv3luDnxAWJe9Cb5AWw1YN ARt8nlAidmpi9H5ofaGcXpkkYE6uh70una7Xhvomw1P4kZUly1+R5BeWDCgZ0JemTI+u uTHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cjViXEEt; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id cl14sor14830375plb.30.2019.04.23.16.21.16 for (Google Transport Security); Tue, 23 Apr 2019 16:21:16 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cjViXEEt; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QV6q4rIQIKonURhV5YI0Y2da8qAlozUPAhHD+uzvbZs=; b=cjViXEEth7iNuFYI0MTKtfltpV1DEW3RM2sP6kFUQRF1yZR+gHY7wnkxF3NQprorMh QZzV6oCUnje+bIBXL2+EU2opo6GijlLcAJlFZsX/91h9PBwEgQ6rR+QJVP/O0TDvse8n pQ/VJ6Qz9VTNyjO7XHtJiG+mFyQZKYwb70p6MYw1n0iIyJuoBhyyOBdNueeuYFDrrUm/ oJvlcKblSvExCfIpIG6Ngvo1v3zwOfBaUogRlbYNEeLPs7baorv9X9m/lbXA1tqQE4vi grJpEZNhCwaSYGU/9srOxbi2No7gzI0KKYLH8uJHtHf4fjcB3woDCkn/k2jsCI6VTlhB wScw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QV6q4rIQIKonURhV5YI0Y2da8qAlozUPAhHD+uzvbZs=; b=oGCFdRLkqqZoZxJnHX9Z9s+PW4T15cA9N/lLwGKcU3yNFtsmoQmWaoQChrMoCnSsw+ c0FpuSRriS6dJRbfhDqm8OyBvPCBHuaKHIs2SUCAp1SQnO3JjdTplXJv5g09rskKThxN uPoiN8x00p68W9kWd9xQXrIr2pElNTpJxpzYkywLEGGGEgZO+aT2/FfSivzDKYRw2/Sd fIUB4BRl1T6CXvX3dsRooMrMSo879NegAo1x/VtDuxwx2zZeXn8eLMfbCR+4EnuRmhJh 7gJgWEfrIBwIzX4KNMecqX5tJVYFH7e0e4SHBpJ+UESlzF9wbMIffGyJdjjiAeFqx6YY RPAA== X-Gm-Message-State: APjAAAWGaHYs2ET9nU2mghMYsi4iQbyr5tOdQ06RmLkd+AOWNNV+DUgs 3Nc/v1NsecIVQutFD8QuuRLN4df7 X-Google-Smtp-Source: APXvYqxcrohcoxF7N0y3iDmLR1PiNAeIDv8NwK0xG5vjhqwI1ajGwj0jXu3C4/WphYQxCdjQhubPBA== X-Received: by 2002:a17:902:a7:: with SMTP id a36mr28776329pla.111.1556061676303; Tue, 23 Apr 2019 16:21:16 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id c28sm6984235pgm.42.2019.04.23.16.21.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:15 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Xinliang Liu , Rongrong Zou , Xinwei Kong , Chen Feng , David Airlie , Daniel Vetter , dri-devel , John Stultz Subject: [PATCH 11/25] drm: kirin: Move kirin_crtc, kirin_plane, kirin_format to kirin_drm_drv.h Date: Tue, 23 Apr 2019 16:20:42 -0700 Message-Id: <1556061656-1733-12-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556061656-1733-1-git-send-email-john.stultz@linaro.org> References: <1556061656-1733-1-git-send-email-john.stultz@linaro.org> From: Xu YiPing As part of refactoring the kirin driver to better support different hardware revisions, this patch moves some shared structures and helpers to the common kirin_drm_drv.h These structures will later used by both kirin620 and future kirin960 driver Cc: Xinliang Liu Cc: Rongrong Zou Cc: Xinwei Kong Cc: Chen Feng Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Signed-off-by: Xu YiPing [jstultz: reworded commit message] Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 27 ++----------------------- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 24 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 25 deletions(-) -- 2.7.4 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index f54cf99..69604ad 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -38,12 +38,6 @@ #define OUT_OVLY ADE_OVLY2 /* output overlay compositor */ #define ADE_DEBUG 1 -#define to_kirin_crtc(crtc) \ - container_of(crtc, struct kirin_crtc, base) - -#define to_kirin_plane(plane) \ - container_of(plane, struct kirin_plane, base) - struct ade_hw_ctx { void __iomem *base; @@ -59,18 +53,6 @@ struct ade_hw_ctx { struct drm_crtc *crtc; }; -struct kirin_crtc { - struct drm_crtc base; - void *hw_ctx; - bool enable; -}; - -struct kirin_plane { - struct drm_plane base; - void *hw_ctx; - u32 ch; -}; - struct ade_data { struct kirin_crtc crtc; struct kirin_plane planes[ADE_CH_NUM]; @@ -78,12 +60,7 @@ struct ade_data { }; /* ade-format info: */ -struct ade_format { - u32 pixel_format; - enum ade_fb_format ade_format; -}; - -static const struct ade_format ade_formats[] = { +static const struct kirin_format ade_formats[] = { /* 16bpp RGB: */ { DRM_FORMAT_RGB565, ADE_RGB_565 }, { DRM_FORMAT_BGR565, ADE_BGR_565 }, @@ -127,7 +104,7 @@ static u32 ade_get_format(u32 pixel_format) for (i = 0; i < ARRAY_SIZE(ade_formats); i++) if (ade_formats[i].pixel_format == pixel_format) - return ade_formats[i].ade_format; + return ade_formats[i].hw_format; /* not found */ DRM_ERROR("Not found pixel format!!fourcc_format= %d\n", diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h index ad027d1..b6626f5 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -13,6 +13,30 @@ #define MAX_CRTC 2 +#define to_kirin_crtc(crtc) \ + container_of(crtc, struct kirin_crtc, base) + +#define to_kirin_plane(plane) \ + container_of(plane, struct kirin_plane, base) + +/* kirin-format translate table */ +struct kirin_format { + u32 pixel_format; + u32 hw_format; +}; + +struct kirin_crtc { + struct drm_crtc base; + void *hw_ctx; + bool enable; +}; + +struct kirin_plane { + struct drm_plane base; + void *hw_ctx; + u32 ch; +}; + /* display controller init/cleanup ops */ struct kirin_dc_ops { int (*init)(struct platform_device *pdev);