summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/hisilicon
diff options
context:
space:
mode:
authorXu YiPing <xuyiping@hisilicon.com>2019-08-21 02:06:15 +0300
committerSam Ravnborg <sam@ravnborg.org>2019-08-21 20:15:39 +0300
commite200d8eb390951fa10b87299ed084428b401fe85 (patch)
tree63f8d2cd72698022f6fb26a0d44ed6a561bd1f41 /drivers/gpu/drm/hisilicon
parent5fb2e411be93524070658716fcba6d50a6c71943 (diff)
downloadlinux-e200d8eb390951fa10b87299ed084428b401fe85.tar.xz
drm: kirin: Move channel formats to driver data
As part of refactoring the kirin driver to better support different hardware revisions, this patch moves the channel format arrays into the kirin_drm_data structure. This will make it easier to add support for new devices via a new kirin_drm_data structure. 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: Xinliang Liu <z.liuxinliang@hisilicon.com> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Xu YiPing <xuyiping@hisilicon.com> [jstultz: reworded commit message] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20190820230626.23253-15-john.stultz@linaro.org
Diffstat (limited to 'drivers/gpu/drm/hisilicon')
-rw-r--r--drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c30
-rw-r--r--drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h3
2 files changed, 10 insertions, 23 deletions
diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
index a1a79f372bcd..0489b6378e01 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
@@ -76,7 +76,7 @@ static const struct kirin_format ade_formats[] = {
{ DRM_FORMAT_ABGR8888, ADE_ABGR_8888 },
};
-static const u32 channel_formats1[] = {
+static const u32 channel_formats[] = {
/* channel 1,2,3,4 */
DRM_FORMAT_RGB565, DRM_FORMAT_BGR565, DRM_FORMAT_RGB888,
DRM_FORMAT_BGR888, DRM_FORMAT_XRGB8888, DRM_FORMAT_XBGR8888,
@@ -84,19 +84,6 @@ static const u32 channel_formats1[] = {
DRM_FORMAT_ABGR8888
};
-u32 ade_get_channel_formats(u8 ch, const u32 **formats)
-{
- switch (ch) {
- case ADE_CH1:
- *formats = channel_formats1;
- return ARRAY_SIZE(channel_formats1);
- default:
- DRM_ERROR("no this channel %d\n", ch);
- *formats = NULL;
- return 0;
- }
-}
-
/* convert from fourcc format to ade format */
static u32 ade_get_format(u32 pixel_format)
{
@@ -908,18 +895,13 @@ static struct drm_plane_funcs ade_plane_funcs = {
static int ade_plane_init(struct drm_device *dev, struct kirin_plane *kplane,
enum drm_plane_type type)
{
- const u32 *fmts;
- u32 fmts_cnt;
int ret = 0;
- /* get properties */
- fmts_cnt = ade_get_channel_formats(kplane->ch, &fmts);
- if (ret)
- return ret;
-
ret = drm_universal_plane_init(dev, &kplane->base, 1,
- ade_driver_data.plane_funcs, fmts,
- fmts_cnt, NULL, type, NULL);
+ ade_driver_data.plane_funcs,
+ ade_driver_data.channel_formats,
+ ade_driver_data.channel_formats_cnt,
+ NULL, type, NULL);
if (ret) {
DRM_ERROR("fail to init plane, ch=%d\n", kplane->ch);
return ret;
@@ -1057,6 +1039,8 @@ static void ade_drm_cleanup(struct platform_device *pdev)
}
struct kirin_drm_data ade_driver_data = {
+ .channel_formats = channel_formats,
+ .channel_formats_cnt = ARRAY_SIZE(channel_formats),
.crtc_helper_funcs = &ade_crtc_helper_funcs,
.crtc_funcs = &ade_crtc_funcs,
.plane_helper_funcs = &ade_plane_helper_funcs,
diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
index 70b04e65789c..66916502a9e6 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
@@ -35,6 +35,9 @@ struct kirin_plane {
/* display controller init/cleanup ops */
struct kirin_drm_data {
+ const u32 *channel_formats;
+ u32 channel_formats_cnt;
+
const struct drm_crtc_helper_funcs *crtc_helper_funcs;
const struct drm_crtc_funcs *crtc_funcs;
const struct drm_plane_helper_funcs *plane_helper_funcs;