From patchwork Thu Aug 1 03:44:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 170294 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp4836336ile; Wed, 31 Jul 2019 20:45:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqw3DPjlLItXDoOLpZKSq6k+0nxYZfh0liCVuwUSEaNap9KHupn8+Otw9S7oVaWivKKrJ6G7 X-Received: by 2002:a17:90a:20c6:: with SMTP id f64mr6242883pjg.57.1564631110904; Wed, 31 Jul 2019 20:45:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564631110; cv=none; d=google.com; s=arc-20160816; b=miLFpnmp5Y6+94DKZsaRiTHvLMdCG/khp7K8q7vTgfYD6flzt24c5cusHnTOUxLuGB HNTlrFs5vPc0wjFWGSqPpl9agVW+dWbtDXdgvqOZ2YuAAzB/RFkdavNe1Ty5fnDO8XMa jX7WbR0j3xPE2+0Dx5ojITicy79emELaYH2jbp10XPAZs3NkF9TazuuLeiYyVGkQnk/c DlzPsssC5yYnmNcd7sJGPR9iGbRX/ljxdoDPwLt7DnA/EKXxrnntivqTByyZus4u1SCD doyAEJvbIljVrk22qphO3tVdDQzTZDH40CIkkCf2z4g9Rze1n3dsqEjcbdvv2Wo/OAFO 8Ttw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:delivered-to; bh=hacTr+Rt7PnotfrZR5zVBYm7ZOKYwXIHrnyDsefpjMk=; b=jRL8m0mLbEirzBZhFECHJ7PTeDrcm3YJncHRXZ7L2R4XnsqJeTTYqW7MzV40T1kc+U PpwqD5ptZuSiB6W8uU0JLz3b8PTvM6agGgUzlmRoHaBvcJf6rWgBqmW0O1TTwPvJWyOq KEf4Iqvkjad8aVB3UV5OCC5X8+dJWKDpSPhoV9m9H123mwk3KOfuk8YdKo8zPVfLsmEo YkFAs1+7jmnumSPfamno0K6C7s/9Z96KoCLIoL142m4YAHC7R3kTAlAE7dnSVslti5UW BY07bFsIqO5ZhR8Md7HwTAL+DP/WRo1faPKTDwClNTRyq0eAi4qPjw4g/YG1TOJLQlWq wYuw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id f3si29552823plr.187.2019.07.31.20.45.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 31 Jul 2019 20:45:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 083C26E347; Thu, 1 Aug 2019 03:45:07 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id D057E6E347 for ; Thu, 1 Aug 2019 03:45:05 +0000 (UTC) Received: by mail-pf1-x444.google.com with SMTP id q10so33140442pff.9 for ; Wed, 31 Jul 2019 20:45:05 -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=I6qZv0NvjQC+of1GCo/KYasdnS8lE77yp0QRLPQskL4=; b=WkhJBdLbEDcvM5Fi3hYzuYjsES+/7Os9sS2fzHXnbBMM215Px+zJmV6/JOqgoMb1pA y81w+VnvXAZ1e1edN0S3Mm4WmUhs0tQZNuVXOVXGd1V6RCjSl+8GGv2d3R2xL7+N2d3R fyyFXwG7FgXp+SHYQ2qZ6bpo6HthEAfKDC+GX8za/GnKN444JmYPiXF2CWRETwZKrmvH cRGiWVfyn+zeM3+1GsO54JVhgvkMnq/hwXVZ8Pb9d135bGuZm3Nwyta6G5cMAqEY5XaG lEHHtyclHNE+k/QvN0APbWpRRnzUR1nxOUXxtQ26cUUpbg1cVIjuu+zQgpoYe0SG4jxn FLKg== X-Gm-Message-State: APjAAAX6/afnA3pJFbZhzzaoEXvhvZVg3xih7WB9j2APnovLl0RAAnAi IaYEHombx/4a/a4U4JAuu7/Opw== X-Received: by 2002:aa7:858b:: with SMTP id w11mr48729384pfn.68.1564631103854; Wed, 31 Jul 2019 20:45:03 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id h70sm64775674pgc.36.2019.07.31.20.45.02 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 31 Jul 2019 20:45:03 -0700 (PDT) From: John Stultz To: lkml Subject: [PATCH v3 12/26] drm: kirin: Move kirin_crtc, kirin_plane, kirin_format to kirin_drm_drv.h Date: Thu, 1 Aug 2019 03:44:25 +0000 Message-Id: <20190801034439.98227-13-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190801034439.98227-1-john.stultz@linaro.org> References: <20190801034439.98227-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=I6qZv0NvjQC+of1GCo/KYasdnS8lE77yp0QRLPQskL4=; b=LBUfraRwXQ6hIm+t+I/z/szQ5a8tgSCA4WdSllvNls0e5Nmk1uCQ2OME2rTVKCxaFd fngthY7x8jwqxMzhlDSSAPuf7WZ/nRF64rC4vBNmFt1GkBc12ggTPnQ09OsaW5LTRiWr x82tyGYfkY6Y0pm6An9Iy3boW/JM1v+63ieHcOcRDe9sTqNCyHocXaIithN1zPNnjO6F LSxl8VHiwJTxo1qKuN9yWyqIgv27CRxkW4enkqZuYxbfrLwwl6AD744a7bnYyMT22jJN Vpv8LCFdZCA8Max387n4rr8xtsDps7DxU9Jw5g1CzEMtVoAxbfuGn4h0tSUa40Vf7FYP QA9g== 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 , 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: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg 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 ec4857e45b6e..3ad1e290bf58 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);