From patchwork Wed Aug 14 18:47:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171351 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1203503ily; Wed, 14 Aug 2019 11:47:44 -0700 (PDT) X-Received: by 2002:aa7:8102:: with SMTP id b2mr1405079pfi.105.1565808464043; Wed, 14 Aug 2019 11:47:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565808464; cv=none; d=google.com; s=arc-20160816; b=ucaOo6lz1B5mzSgZKI4QHAoEBAwRRvAPqCdS3GTEpUuNE1kYruvUgv5diHh8XNNMaZ LKGIklyo2DJekGZXU5kzaMroSANSMEtxcxB4d53L9G8TVljkUOS+6XT1mghudQPejAoP Rx0ofm2O2cYooO7uL0uTKPXUp3FwgHy3icoMkmIzOuSs0ExTBj0P8a/HY8mXf3dNqoim jCFQ3fEQYNBY+9rZmbszq/3Ib/rZ/G1ZpEiOJDKem6e3gUnZLFrblOJnHI1Ek/wj2gyX E7YkON2X76Va2uijL8+XexD13I7SSXhMkd+1d2NflL2piYIOavXaC1BY5im+aUCKy7tb ip8Q== 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=wO5ks8srjtZHHtpXOR5yQLjWhZNf1ho4YCPtcrf1Uww=; b=K7Xywc6+d2CcQQyQjKzigKeax+hQVu4ZUcytu50W2T5KCSygGcrGWnNKZcG5hewSew i8Apqg52E3r07RdvFnWl0DoTBHWaUJzB2MrbgNmLupd6CWaCATjCFfSA+r7GroXJaj2C oXS0W5w4JE7HKLzqJOpPfPWS6qucIFEzgIbawJFZ2zItvqT4hDAma4DwkfICKyhvunO5 m4uCzZeh0WoBaIdmJ0Mfo+HCkliTKawzrP2JKwUdcynTtSlcD9XE/mz1NTwkFcvtLWlx 4ZtJl1b5/b+K9Fh9ih43Zs2t65XcJFl5sJGDyavMW/BVVAejBFxRDpuF/S3oyWuCSItk 4Iwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JhjafeeS; 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 e16sor483443pjp.20.2019.08.14.11.47.43 for (Google Transport Security); Wed, 14 Aug 2019 11:47:44 -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=JhjafeeS; 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=wO5ks8srjtZHHtpXOR5yQLjWhZNf1ho4YCPtcrf1Uww=; b=JhjafeeSnqrY96MJ/4i5IWZwtutSY/+sjrJKNymWybFyvALBIrAwaLrXnNm+qRQJFR SDwJLC5JbCWTXnmsCh3xFFheswBW72hayuwa4XzQtbYFMdz98f6PUkLTEzuFhrxa7dcT +iK9J7/7XZ11mPfH+4rhV1qlHJOE9Cbn15Spe7OBIDglTWmOC5JJDFXGFEcNnn85sFph nfFKbeM6gQtUvUA8ojdH0NUEOCMibVOA4ayu7r6zMI0uF1kb47k3aDvlNGBm4X8Ogop4 hkGyHkjIk+KzXra8pKLmPtOod3J6cD2P2fAQ5iuRAiSTVcRNwKTGrTg6uMRvhyxo9f9c BKrw== 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=wO5ks8srjtZHHtpXOR5yQLjWhZNf1ho4YCPtcrf1Uww=; b=Vkp/3rLaZiwfPigQd/ilQxn7k++ZDrw2ncMtr8Q5wD2vYH2Irruy/fqp3nhct2vPnx m4FxDI7CbA2k0i61kt1cVQPkxOYDljXt0nSfB6UPJ8qZ2GbggQ6hUUBKQpEfY9VKol/x 5r4eAOvzwzCXNZ8UZCga7RUg/W0MlTZxFcmZyvhRKplBnrhvpvHuSfzIdOcoFdYgGq+T Df7x6D/fp1xOx5744zd6RpFfe2jBcp8fhCshHT9UlTSZqmxH3FMtUGXvCA3bTIZdkQGV 1ZnaZtYSWW2+TPNp+JTlFTZeOGeo2rGTKGEiuYH6NLpLFNOFeyYnjtBM7uYvpEZo1hXZ tGHg== X-Gm-Message-State: APjAAAUtcfzH9YPaouPlkWCBem6JEzvnWGUemhzQ8MB74LytzRkuuGUW WhxoqPFAh7NxqNUglgv3OVN2YTEN X-Google-Smtp-Source: APXvYqxW9O5O6lN6D75dJ6FsTbeutZUOicVbvKl6O0GFXkGTiyx7uCBE3n4NRfwQBEVHRq3DIGsO2w== X-Received: by 2002:a17:90a:ec07:: with SMTP id l7mr1055601pjy.39.1565808463626; Wed, 14 Aug 2019 11:47:43 -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.42 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 11:47:42 -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 24/26] drm: kirin: Add alloc_hw_ctx/clean_hw_ctx ops in driver data Date: Wed, 14 Aug 2019 18:47:00 +0000 Message-Id: <20190814184702.54275-25-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 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 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); };