From patchwork Mon Aug 19 23:03:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171751 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3596317ily; Mon, 19 Aug 2019 16:04:01 -0700 (PDT) X-Received: by 2002:a17:902:82c4:: with SMTP id u4mr1316568plz.196.1566255841405; Mon, 19 Aug 2019 16:04:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566255841; cv=none; d=google.com; s=arc-20160816; b=f5wIv41a5LPIkzNTzaAxp50Pwva+YXzLOKTXP1LcxBBpUDbty4bu3xjzOhMnZcJC4s d8Zx1jRQMf679Zb0BPlZx9ytll+NM+xa1zgwWMtQxjYnyrIUaUI2U/w0crXn0F3NOu9J W050wi5xJaItBTHSjJON8kpDJcjKuyFwJR6mf1SAClnRD1rjE4Q0p6Samt3QEvqVT3M/ qu4wN0qKF1vU5KuQUd1CNuP9HuuN42A0jIgzXwvSrBJQkYvIzwds9se6NFNlIlofhjw9 KOUMqCYJKR4qRSXXcmU2tZ2jSsVCzNJetbd3PF/sjXdSMC+448PhirWny5PjYIuLnEov 0YAQ== 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=ffOhLSrwkZ0FoYckf3kTJH2dZNi42NmCSonPnEyy2Hc=; b=Jk7mHuWw2qD7zKgHf3RY5+ASFk8LEZcuj7LFBNsu2Yud5pIWDJw/5DUr0nb6CJmuld hG72+vtXE4oJ1gcFI7WD1hH25l7h1kOGvWDBx2PGsnnRieNiwK1cuUNAp6zf3tpXsEnT 19SqCsorrFcnNRHSkB8hzMrJtAUaOd2Zpd3EezvLA6KDCSjG4gufaj/hwxTuI8hcEFCZ u4TMoNRK9OOnJnqnKHThx3p9DO3198B7I6WPb/OoJzF/BxLZ4jZVDMMhg3+U6wCCU51J vwvzUq2OhyR8dFJjHp+zyuPPqhc+pIBcsWDJs7L3EP27Nbr9PUZXvHcMitFqa8k3KxmU SV9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=u3ZHOgJd; 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 a31sor1858788pga.15.2019.08.19.16.04.01 for (Google Transport Security); Mon, 19 Aug 2019 16:04:01 -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=u3ZHOgJd; 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=ffOhLSrwkZ0FoYckf3kTJH2dZNi42NmCSonPnEyy2Hc=; b=u3ZHOgJd502s/aInsx0EzPcO26A1FA+uOEiIkhJKCiZ5hAcXzU0zAQA5eqfrge34yi HAgWlvz/zeQt8miwKSyTesRUl1qArKIpHtaIH+G98V0fKGHBkGDCIBoP4QyLv+B7zHbq 37bE3GwOVky5lEbBJqQSMAo1roqIKmn2AWPjyso7Tas2OIQ9zPgSffUeorOIz5D4N/iM ZpXMH1NNPT9hmJNqSvjyRqLzMG8OC+SlIUZBUSe2Xb7YctyFGwY04qyxJNFIuOnIX3QH HEt/eAuQu2E5dQ9B+3n1qJIurFSg7Rp4/Uy8Qk7EuLxvU/vssVWSA90jn9ry/YwoNGeI xr/A== 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=ffOhLSrwkZ0FoYckf3kTJH2dZNi42NmCSonPnEyy2Hc=; b=bBe+/GrlKqjQxSkkhG2W6goNmNb1MeLI5ghzgvl+L8h0EtQiVYGHb4TY+gg12u80+h b3q6vs5hp/ENcRi8qEomDKBsIg1OlQVIB7AmEteGyNgIPsOp9fnRaFtK4gCKai8MGdZz zms84uTBUjDY14NCLSdYY1PMCrR9l6tEFsILHa5OalaA2k7eHNOSwM2ImPtlZnJCCOQ0 f6KD4eFk1Fr6cSI14+3AxNFX7Oo7c0b9o55p9M52moIIo68S0xXZMZOObeucBh10C9r9 ecjQ0DHdaj9fknL8L2h3xeb4lYKloTj/dXfJMMwEmSYhEvzbWZVXPdr8Cjz+UJ6GJkOu ijng== X-Gm-Message-State: APjAAAU/sDYd8AxCbUFw0jRos56Z9OnrjGOIPQQA+nUmA+9J14hi4mLD TIGnn6mpcD187gPWpoXpLV24wGNu X-Google-Smtp-Source: APXvYqxoxiFV08/B/uo/2/sQJgEIGK7Iy84PjzPkwa/66GDBThzwEXIfxiZD56GFZFTRHw7CIvuc6w== X-Received: by 2002:a63:89c2:: with SMTP id v185mr21987280pgd.241.1566255840875; Mon, 19 Aug 2019 16:04:00 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id j15sm17256509pfr.146.2019.08.19.16.03.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 16:04:00 -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 v4 23/25] drm: kirin: Add alloc_hw_ctx/clean_hw_ctx ops in driver data Date: Mon, 19 Aug 2019 23:03:19 +0000 Message-Id: <20190819230321.56480-24-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190819230321.56480-1-john.stultz@linaro.org> References: <20190819230321.56480-1-john.stultz@linaro.org> From: Xu YiPing As part of refactoring the kirin driver to better support different hardware revisions, this patch changes the alloc/clean_hw_ctx functions to be called via driver_data specific funciton pointers. This will allow the ade_drm_init to later be made generic and moved to kirin_drm_drv.c 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 --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 9 ++++++++- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) -- 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 a7fe2fc57bf7..5caf0921c26c 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -999,7 +999,7 @@ static int ade_drm_init(struct platform_device *pdev) return -ENOMEM; } - ctx = ade_hw_ctx_alloc(pdev, &ade->crtc.base); + ctx = ade_driver_data.alloc_hw_ctx(pdev, &ade->crtc.base); if (IS_ERR(ctx)) { DRM_ERROR("failed to initialize kirin_priv hw ctx\n"); return -EINVAL; @@ -1038,6 +1038,10 @@ static int ade_drm_init(struct platform_device *pdev) return 0; } +static void ade_hw_ctx_cleanup(void *hw_ctx) +{ +} + static void ade_drm_cleanup(struct platform_device *pdev) { } @@ -1087,6 +1091,9 @@ struct kirin_drm_data ade_driver_data = { .plane_funcs = &ade_plane_funcs, .mode_config_funcs = &ade_mode_config_funcs, + .alloc_hw_ctx = ade_hw_ctx_alloc, + .cleanup_hw_ctx = ade_hw_ctx_cleanup, + .init = ade_drm_init, .cleanup = ade_drm_cleanup }; diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h index 95f56c9960d5..1663610d2cd8 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -49,6 +49,11 @@ struct kirin_drm_data { const struct drm_plane_helper_funcs *plane_helper_funcs; const struct drm_plane_funcs *plane_funcs; const struct drm_mode_config_funcs *mode_config_funcs; + + void *(*alloc_hw_ctx)(struct platform_device *pdev, + struct drm_crtc *crtc); + void (*cleanup_hw_ctx)(void *hw_ctx); + int (*init)(struct platform_device *pdev); void (*cleanup)(struct platform_device *pdev); };