From patchwork Thu Aug 1 03:44:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 170305 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp4836720ile; Wed, 31 Jul 2019 20:45:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqySmn5CRRvjYr8sOOfBLiRZs3x4s/2mvXxBv+wZaqCkuKjaiDJsZljabg9mLZAFS6WwlVkw X-Received: by 2002:a63:4c46:: with SMTP id m6mr120170692pgl.59.1564631130376; Wed, 31 Jul 2019 20:45:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564631130; cv=none; d=google.com; s=arc-20160816; b=eDjSnsfRPNEWXuevZ9cXgRK6TpZDIyI20yv8vFe0LqNBA7zNlmGndpl7IQYfpGFRoY /DaFyqt5fbrssE2V+c6+iUSpqlwICPap8y9P/Gj52QX9C5ReRThruJ99nhR6BOEgYFMs zIzobcaufYqArNcQhPu8q7YlVcntvww+LJ8jY7zyiWWR9ace5mxm52bgfgn2deI987lY OaNYi9FdfhTSMuMBaBVlbnKgFmeFlLdwMmxJ5e1LZIxvhmzhAEiomdjikcmNifszFNlJ gJD3MJBkqAUPerkxP87frPd1jx0BL56/LxCvNKArI6m537i0wXfvwXCiC03GLnHmOwLY otXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=2SJ1RQl/uOMyO19jnUD0lNyv6QH0nUllbiw6Ng6yqJk=; b=cHqkLTJvITdgpCPrpBti6/F9ePIGdMcjz815oC+Xw8aeJr/wv1TuzyyXE0b9Ncu7SI UVuFU7w1+HL8SO3LUTWlm3YkELeFIllg1f5ACy9/CfQj/2iMS4/ZZo3p/ptTm2vR3WmC WkxCR6r+vLvmNuUb21Zg93zIOldSOVsySS27LY+rbrOuPD6PHlNpaPv42/OtyAcCgDcR dDRVm0d0XgxXHgLcRq7nizjWXRP0JKrBL/zOymLxeJYzETZQev3TwpGSXI+Yxj2OggJy xbcEcpaAf6/+3pYHWwZORpfpjkk/oN5KUmL6WCUzEASD+jCeUJaDEbYhEF+SRZnV9Kqq WGCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J9+JMcr9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n11si2868235pgr.460.2019.07.31.20.45.30; Wed, 31 Jul 2019 20:45:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J9+JMcr9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729508AbfHADp3 (ORCPT + 29 others); Wed, 31 Jul 2019 23:45:29 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:40329 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730118AbfHADpX (ORCPT ); Wed, 31 Jul 2019 23:45:23 -0400 Received: by mail-pl1-f193.google.com with SMTP id a93so31451069pla.7 for ; Wed, 31 Jul 2019 20:45:23 -0700 (PDT) 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=2SJ1RQl/uOMyO19jnUD0lNyv6QH0nUllbiw6Ng6yqJk=; b=J9+JMcr9OJwYMvFdAQKEduvl+84Dbc0aKweDgAVS6yk5/OwhMtRLqwB4r2kVnlOsMu bD+I8lt4/jXDaMSPdSrQjRhh0kj+/khxqEWaq/lwumFQO39/kuBdW+LsU0+VQJVdVhqQ s+Wb186mN++XDw4Qg8lbk9cNdsBm+amjRFNKSkXherrYJvCoTTp4M8WXPiEyGPaxWQTa /5Ido9xiaIN1fyY7qYfW7VvSDOP+bR6ZtCdL+QsTyrlPttSRxJQt3lOWLTQF0kyIUaVB eEbr4nTKN01fimxQihjv76yuG01+ASJV/ENmAAxuw/dQOH8EGa+4yWpICxWzLaRPdPfJ gzzA== 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=2SJ1RQl/uOMyO19jnUD0lNyv6QH0nUllbiw6Ng6yqJk=; b=K9Ifz/NczumawupQgon2lrtLUvNwIkM7PAXDqcpZLnalocavTex1Cq7ZldTDEnZPUl iFKd/T/XIhVgyOP9KNFqTsNCw+gwDjgoDiYSw/CY66M7FRrYVxid3pnxC+49U6TxVis+ pYwS3E9K6X+JThMCIEXi+tgSAiO2MuSTzsg1FVWG3VI1pki314zd9M88ata3eO1AQi4R Moq2fLF0JqdwwHv5v/TfnAMm9OvbiuOw3HArEOdAPDM+vobkPHs0Op4vTSEGA0E77cY0 bpiS33pv3ij3yXA91RmbSOOZ+6dYnWnnp9gczDWk9YGCpowjKBZYswSrcp19zoWa0wfY X1tA== X-Gm-Message-State: APjAAAUVnHEL5vgNtTMP4aJc2Hlm/ZrFgTLfR/hti5WH8F09uKS3nkds BxN+/1/8kq0zBxplMUNz8ZRLb4cDKos= X-Received: by 2002:a17:902:e2:: with SMTP id a89mr124513000pla.210.1564631122837; Wed, 31 Jul 2019 20:45:22 -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.21 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 31 Jul 2019 20:45:22 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Rongrong Zou , David Airlie , Daniel Vetter , dri-devel , Sam Ravnborg , John Stultz Subject: [PATCH v3 24/26] drm: kirin: Add alloc_hw_ctx/clean_hw_ctx ops in driver data Date: Thu, 1 Aug 2019 03:44:37 +0000 Message-Id: <20190801034439.98227-25-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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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: 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 --- 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 09dc2c07533d..f729a1de6e14 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) { } @@ -1090,6 +1094,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); };