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: 171869 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp180128ily; Tue, 20 Aug 2019 16:06:46 -0700 (PDT) X-Received: by 2002:a17:90a:a00d:: with SMTP id q13mr2396550pjp.114.1566342405958; Tue, 20 Aug 2019 16:06:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566342405; cv=none; d=google.com; s=arc-20160816; b=hihYfaYzEP8EjKLaawhWExoY2Ur+JPu/PXDM9JelHnGBkLrlVcajskWbLaMz6mQyo3 nww+Earazif+1iclTbJbwj9tx62SH4NZL8apXNQc1oISjAV1pQhX/OfcqgXTGENbZp5R CUxHrcjJH7goHEMFDuJQMw8RWJcWIaWFjE0wffsoS/klaGpuK1/eE6s7yQL/3ddrYurI g/x2PpdwFLYtFaLEGxjNDIw2HYrliIn6zd6Y5LcywO3xc5S6/H4JOFpzwYME09BvC5Bt d4RX3JdeRykcELCrWZdvqiDc3hVn8/Z9gj4EnLK0QdZTYTxKdHTsBUD1rQy0g1RpyKws JS/g== 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=agbQoDDs1++FfyQHMzk0YO2MigtF6/kdBKLBogsUhss=; b=yostyDSrEepVPEIBlyunkTvMZJbjqVSY07pr2NK2k6fvEw9NaDkcy5cC1XRBGTPCC7 6Lxb+y8PduhDphJT4Yc6ByjEtvXKyaM6TX0ebpSlbkeJRMRPhIcp4i3qqc4aUSG9qv2x BIyLrh65SoPthhEcJbp2QNoirsKZN7cm2LjIVg3Q+lXdMaA4aMPZlTTbSfjmqq7SQiOA s0kdw3DXspaToJu4ANoME3z4cSBoRBF3iEu6LXzQvyev+uuBAFL0OUKtuzUeL4ZhmJ+2 /5NUG5eGl/v00czC8OVzRLhpOEvRBSqIISE8bMYUZwprK0RKg301RcXkiXW+nyNBR029 0FXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UnQiUTuc; 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 gn19sor6860969plb.30.2019.08.20.16.06.45 for (Google Transport Security); Tue, 20 Aug 2019 16:06:45 -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=UnQiUTuc; 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=agbQoDDs1++FfyQHMzk0YO2MigtF6/kdBKLBogsUhss=; b=UnQiUTuc0BE9+QzXshy4rNkJmm+9QdEpKNXjs0jrBBpCLpvQxr0OFf+uzTU1fKLZUd U+6XMHVbRLD7NLNXzUFvqoa6WG7ox/rxP7FTcDxcu9nvoJP53gEVrmotLD7oQiPvVHs7 sHDvVFRSVLUzhUEHU67hHUfA8b1H9nHD5419g5e+49YIxQfOKQmFnDZh/kMAWrfDvkpW Qhu2m8nO0MvlAEXhgt2GUUjaQ9vCVLfzaYvvRlMbw88pSK9WzW36mKRsPa27u4fW8st7 p0Sm0UBQf8Sj0KSuhUH9sDJZyjR13hsrijDwJZzqW+NjS6ojgmjwLkBDKZLNp499pKv/ Qs2g== 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=p9NFSbTZStHFLwxtCnlnfBPhcn0Xz2888ITLzUOWD1SHlSOXuNUZ+HDG68KvGIQhAo 8w2x9k16W4/a8Cx7/YbQKaS3NjshELNIn4+aggjEBmYgCgR5t0La+F5+pU2SpQXeQ6YU iiz13pPWyFaYnn0rNOER4w2CBOnIulcMa3wWp2mhvUBNIV73dQH3kNxtfRpVR+aDxJAA JuLCmXMIG8VVVEhMdzTNCGrDpxCZ0apCoMWvxq6xf/xtkmvBUZgfxcdrnMcmYHogOYgq 8+vc0yXaYFWbIKlGs6W+ae+61Y55u/+Mdy88SbFsF4Hd3zugbHt293YHsVaAyuQaptjD +CcQ== X-Gm-Message-State: APjAAAX0AXjV5R1lw6mx3rUCNXR2gdggX6lFGPb/89RwqzhHEiAwannk eUHh89RDMfmITUQqnJR3EjaEKXMx 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) Return-Path: 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 Cc: Xu YiPing , Rongrong Zou , Xinliang Liu , David Airlie , Daniel Vetter , dri-devel , Sam Ravnborg , John Stultz 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> 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(-) -- 2.17.1 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);