From patchwork Tue Aug 20 23:06:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 11104815 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 144411398 for ; Tue, 20 Aug 2019 23:06:49 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F07E222DD6 for ; Tue, 20 Aug 2019 23:06:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F07E222DD6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C10356E8B4; Tue, 20 Aug 2019 23:06:47 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by gabe.freedesktop.org (Postfix) with ESMTPS id 10F3E6E8B4 for ; Tue, 20 Aug 2019 23:06:46 +0000 (UTC) Received: by mail-pl1-x641.google.com with SMTP id f19so229324plr.3 for ; Tue, 20 Aug 2019 16:06:46 -0700 (PDT) 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=agbQoDDs1++FfyQHMzk0YO2MigtF6/kdBKLBogsUhss=; b=Ore+iW0T5Z4cEbq3gVWnFjTcWqdcRG6IZS6yZwshlnXakBoQJcR128PBN09B/TJ90M T4Efcb7evDmN0bie34WASxP1kM0pM2zKaZWaJzd1Hp/smxmLwbF8aDIpXPK8MZUiuego ctuKULCYUdnHj3xRhKlz7gwqcs7mni5aN+7uiD8adQmqWTzOwaN1Un2L5MhstmZeQzBC smT0oRUd8qproNd26RXbBLdFqeqkzMNDowCMO5cmhAVD5qIOSzGmAIKdqllMgcxe4nCc VhxDULArO8HU42LYY27/qqQOupOlfpRvHZgALLxUnrGtcAe7gtOVfobDhwUwE1E5RdPL yVBg== X-Gm-Message-State: APjAAAV5ztxwKuqZwggwNJ1VQA++MAbMUVYhYvwQqgCoABVBTLpdqW4n XobSt/Tt23Usqq6S6UsRAPt6YtpAaxI= X-Google-Smtp-Source: APXvYqw0XeS9psDk0ARBG6xEE0Yz76hurSEj3BK/Au7bic2CmkXtyBVc1sIbljqrdndw6/t3Ms7obQ== X-Received: by 2002:a17:902:bc4c:: with SMTP id t12mr31536024plz.1.1566342405586; Tue, 20 Aug 2019 16:06:45 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id q4sm27564747pff.183.2019.08.20.16.06.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2019 16:06:44 -0700 (PDT) From: John Stultz To: lkml Subject: [PATCH v5 11/25] drm: kirin: Move kirin_crtc, kirin_plane, kirin_format to kirin_drm_drv.h Date: Tue, 20 Aug 2019 23:06:12 +0000 Message-Id: <20190820230626.23253-12-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190820230626.23253-1-john.stultz@linaro.org> References: <20190820230626.23253-1-john.stultz@linaro.org> X-Mailman-Original-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=agbQoDDs1++FfyQHMzk0YO2MigtF6/kdBKLBogsUhss=; b=UnQiUTuc0BE9+QzXshy4rNkJmm+9QdEpKNXjs0jrBBpCLpvQxr0OFf+uzTU1fKLZUd U+6XMHVbRLD7NLNXzUFvqoa6WG7ox/rxP7FTcDxcu9nvoJP53gEVrmotLD7oQiPvVHs7 sHDvVFRSVLUzhUEHU67hHUfA8b1H9nHD5419g5e+49YIxQfOKQmFnDZh/kMAWrfDvkpW Qhu2m8nO0MvlAEXhgt2GUUjaQ9vCVLfzaYvvRlMbw88pSK9WzW36mKRsPa27u4fW8st7 p0Sm0UBQf8Sj0KSuhUH9sDJZyjR13hsrijDwJZzqW+NjS6ojgmjwLkBDKZLNp499pKv/ Qs2g== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Xu YiPing , David Airlie , dri-devel , Xinliang Liu , Rongrong Zou , Sam Ravnborg MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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: Rongrong Zou Cc: Xinliang Liu Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg Acked-by: Xinliang Liu Reviewed-by: Sam Ravnborg Signed-off-by: Xu YiPing [jstultz: reworded commit message] Signed-off-by: John Stultz --- .../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 da9f477679a3..3fbf099597c1 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);