From patchwork Wed Aug 14 18:46:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171342 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1203169ily; Wed, 14 Aug 2019 11:47:26 -0700 (PDT) X-Received: by 2002:a63:5550:: with SMTP id f16mr517314pgm.426.1565808446057; Wed, 14 Aug 2019 11:47:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565808446; cv=none; d=google.com; s=arc-20160816; b=Br7AvA7Xouws5VzqLjm86yDyc8guPNo0v0BvYrobMc91CF8fnGNQH2GMic/2/QKpwh z3z7mwPgiPi2HP9hxdqLbB5KUlPRm9kKrvzwlh8LQso/SYSNbBO7XWtCAR9JNwEOq4nv RayfBv5evTyRorCrSomsa7aEaoBEpJADb0wzDWZ7iNT7xxKcKEjZnxSkBipHBt+oqZnk sWHM8RaHL6SS9GAjFH4uQTA8XqfKVdevE+qtmMJcLMdDB9s2OZmIilgXSRT1HSAMjTo/ yArBSSS8r1VZ0ExBr1HM4wudQ2H6uKg1yfTNUPUAFnvqk0KcCay8uz14l7F2i7Ycoqq/ Xpjg== 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=wKlIaA25olU11BOMfTs22yk2wQhbHWnGWzmK5Nr5c8g=; b=HA8fhqCmfdK5UPYUtavdSxVfSCB1ACZO1QjZkZabHipelAiaA8dCPkfEpIe6jFSSwt IKuPTrbXJth9av2OAke/o+w8ZodBs/++cKxUmA++tG0c/VYcwPzZXe0/WjsNVp4r+C25 bIC4pV+37Lk+yfkUjcaYgZ9QOXFklEsbWvj/QoIu1FN+8xuDvOrogXVtALD12EKTPBHe bO0zwif56/9PKg0ZbDy9hoCRLFKqYzF46u8gNyjJSuTzZmLo5sO2Q9TuYrIZzEv2UOtN S2wLQDGNkLnaZ/50RwXIwWtqAf0WLmnakLZR2ThKa0agiBVoq7NxWSm2+1sW3EyzBEGT lLfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eZzQFn1v; 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 v11sor482548pju.18.2019.08.14.11.47.25 for (Google Transport Security); Wed, 14 Aug 2019 11:47:25 -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=eZzQFn1v; 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=wKlIaA25olU11BOMfTs22yk2wQhbHWnGWzmK5Nr5c8g=; b=eZzQFn1vrMPxI+c/iYaHjDFjdZqtfub5KdhWWCpMgIT90qc4LcH6QPySnBMnKqR1RJ hWFUlAp61oTrgfMmqMwVWrLDY3uwozkSqtAfucJDuU6oeJex9OI7lG0TKSrZC8t/+sC7 01P64SsD7fNSJ1fg1G5K9qXI0autzHTOrULBojThGkp/bgYTBYBa8OrdYy09/tid3Pnz BMO0eQKBVdfcT99VfcCVYGNbxzc0RsJc5lTLl6njbbQlHkgbOFN5RJPixCjbNmsdV0oT EJ46CZsKSnu+joJf8KYeWOviuK1PlsrCh7YHL94bkMPJNauTwDcq4UAB4xWnJYDqELDC GxVQ== 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=wKlIaA25olU11BOMfTs22yk2wQhbHWnGWzmK5Nr5c8g=; b=GoaqOS1UF6XZKlvGSjFXb3GA0udVukVts/IzYTSAGgoq6PZAwsJqbc+r7rkRxQXV4F 2A+SpMnrn8squcOBXYeRE+ckNYTT/x8N0Uz2/RCiPnLPAa6T98T4F6Pgeby+4OC9RfrT /sM0Z/sL7heuaixSuewzUWWDwBzSVWwHU4dRvGwNuwFeSkHjnn5w3W3uSPdLWSHoImaK ppRWeJP6IvZWT1IGgonQP5Bxfpo4tPlzpeXnSaJY1e+0MUDDlOdm5Vg0Vl2Hqxtw6bV+ xCC9pP7P/s06ubG3+5ZuQ6t2o+ZTAl/VUyvdQTB/qQ5B1J1lZ0GBQe6EJAbWqEm2BHLM 5Qog== X-Gm-Message-State: APjAAAXG3AcV+RXj7A51P0fufzxaTzxCj0i1QVG8gAJbeVLubAK/lsbj n/kw6y0Jm3sd4bCedR9VS+YygPh+ X-Google-Smtp-Source: APXvYqzHEij/L3W78cYXzvyGC77DpNrqOmQ3aeVR5dxILgGVVx40Tz9jy8wBE2fteMZvJQgodyXz5A== X-Received: by 2002:a17:90a:1916:: with SMTP id 22mr695571pjg.62.1565808445560; Wed, 14 Aug 2019 11:47:25 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id y16sm610855pfc.36.2019.08.14.11.47.24 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 11:47:24 -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: [RESEND][PATCH v3 12/26] drm: kirin: Move kirin_crtc, kirin_plane, kirin_format to kirin_drm_drv.h Date: Wed, 14 Aug 2019 18:46:48 +0000 Message-Id: <20190814184702.54275-13-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190814184702.54275-1-john.stultz@linaro.org> References: <20190814184702.54275-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 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 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);