[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190819230321.56480-12-john.stultz@linaro.org>
Date: Mon, 19 Aug 2019 23:03:07 +0000
From: John Stultz <john.stultz@...aro.org>
To: lkml <linux-kernel@...r.kernel.org>
Cc: Xu YiPing <xuyiping@...ilicon.com>,
Rongrong Zou <zourongrong@...il.com>,
Xinliang Liu <z.liuxinliang@...ilicon.com>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
dri-devel <dri-devel@...ts.freedesktop.org>,
Sam Ravnborg <sam@...nborg.org>,
John Stultz <john.stultz@...aro.org>
Subject: [PATCH v4 11/25] drm: kirin: Move kirin_crtc, kirin_plane, kirin_format to kirin_drm_drv.h
From: Xu YiPing <xuyiping@...ilicon.com>
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: Rongrong Zou <zourongrong@...il.com>
Cc: Xinliang Liu <z.liuxinliang@...ilicon.com>
Cc: David Airlie <airlied@...ux.ie>
Cc: Daniel Vetter <daniel@...ll.ch>
Cc: dri-devel <dri-devel@...ts.freedesktop.org>
Cc: Sam Ravnborg <sam@...nborg.org>
Acked-by: Xinliang Liu <z.liuxinliang@...ilicon.com>
Reviewed-by: Sam Ravnborg <sam@...nborg.org>
Signed-off-by: Xu YiPing <xuyiping@...ilicon.com>
[jstultz: reworded commit message]
Signed-off-by: John Stultz <john.stultz@...aro.org>
---
.../gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 27 ++-----------------
.../gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 24 +++++++++++++++++
2 files changed, 26 insertions(+), 25 deletions(-)
diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
index 191ee59f68b6..d3088d374f8b 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 22d1291668cd..d47cbb427979 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
@@ -9,6 +9,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);
--
2.17.1
Powered by blists - more mailing lists