From patchwork Tue Apr 23 23:20:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 162760 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp4355003jan; Tue, 23 Apr 2019 16:21:33 -0700 (PDT) X-Received: by 2002:a17:902:7209:: with SMTP id ba9mr9078418plb.252.1556061693813; Tue, 23 Apr 2019 16:21:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556061693; cv=none; d=google.com; s=arc-20160816; b=yxxcSOBrRi6+PfnURlpeq460t5XlqnG/yPeZhsNiUQUskfdhWeY2aaQmzW0GOBmypz anfzMVvf70KVu6+kck0HUA9aU5AOxgBiNTVmKkU+qsNQPVC9CBOZS8MbygQsV7VeAGrd uprhCTMoCp9D3Wgl3kS1IIs1ojFX2m1FIA1IHsyATj506jw63PnxbKLzvncGRti2dckU Fl9UCwvD9RIcpWFl+4gidWAiIRrGkZjez0WHfwKGNodRAsEEWsdwMjQfpdnwPJpCPv3T 3c8zG/2zmHByS/baz8UuvgXD+l8KaYE6qeIOzoIyfzVTqqtbfYu3arPHZkM59m9v8Tcp 73LQ== 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=fyuYklvBayJptM/nAc9IL2K6XjtBGntJN95HuquLEL4=; b=CzAFt2wEmU0rb5/8Er+KAwwuTXQA0uuJRBdc+Z8f6l8h10BHhXtJIWA1VgOoEMkz4K LPmheJsWc/CUlapn5q+E8F0NcZYiNvUC1Et1Vg5RkLyouvxATksxygo0blOlVeEqIPEb AumFNReMM49e5NO83dg8Eo22iPlVc0GXMHRRCYIL/230lznX/biClT/XDp6Xm69ItKI5 dbYIL+p6YFcq1Bi89G579l9h+MhvCirdjnNHzig83HOJJV4mVx+CWdIdzdrRaUNPScvJ EULn7chOdbbabMy49tymk5cTYfqx7+mdADmuxQ9eBoS9l9T4xpnMXWzs/pjjmJ6GY5sZ b91A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="YvFX/fer"; 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 x18sor19746796pfa.69.2019.04.23.16.21.33 for (Google Transport Security); Tue, 23 Apr 2019 16:21:33 -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="YvFX/fer"; 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=fyuYklvBayJptM/nAc9IL2K6XjtBGntJN95HuquLEL4=; b=YvFX/fern8eZoKAnjIxAf5RUz4Uvp8J4p+xGsXoGVflJquwMrkpMrG5g8ZV/A05vEL yW4+YKBR+RsZlQhjDsCS8pJ/EmpS7jY5Nxgx/1AQ3Ya5XcDNOjPb4k8GciQ+eajGnR/5 RXoEnF4psLyE5PY753D8fvFFFGFUlRDP49VQujstxvFXl9/CyxSjTs159j/utvmq+X/s qPrI7Cib+zCask/1pHW5q5vdYjmF78xWdpJEJ86ShLuA6lz1CQltJKk0Roi5f1NAwx/B aYeJM1u+qRXXYRuBlkLqNqHVbjpQ7Qfb+aOQ9sDEROm0ngV+RtvVOxttKiHa++iOEKVP 4CKw== 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=fyuYklvBayJptM/nAc9IL2K6XjtBGntJN95HuquLEL4=; b=b/mkTOfYj1mFZH3IaXy7QwvKkR2ehygaqK/OvnbL9VMU1uNhFdz/xfHavIS6iMOJgb f9w0zT/VRLwOujimkFDv/kBV+fbIfiqZpZXq+VxcWB7pQlhXYGa7rcMS4VN/dlLh0Y71 a4SWeudqmqq/j4ZEJ7jsvWv3U/rND2qaJp4FFUrTX0rVwljxPtCtOPcbPRCclEuHo45f JIewy9cCOb6ce8fjGb7wO9GlDOrVlGlJKWWsU5ueI71mmUdgq6+eeCJRBaRCuCc3yiPW ROuDMIzIsxexo18g6tqsANtEYpOq16y3iVFtdzdGAflAnjWIb73k1ufQT/a9dM8l990D DtLA== X-Gm-Message-State: APjAAAVamK2lOY3b3ElTz/VXK7mCK23arN6TzdJu/xF/vnFc0dA8sR1M BJ61DQ+0zmV4sb+reE4A17ei80gsNPF6ow== X-Google-Smtp-Source: APXvYqz8GDtuEf42eI35uaJpItKZLJSWWg9sDHjfvRMh4FewHjzW+BcTBuYF9lMJA4CyvbPWWnvOhw== X-Received: by 2002:aa7:8518:: with SMTP id v24mr22541292pfn.219.1556061693163; Tue, 23 Apr 2019 16:21:33 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id c28sm6984235pgm.42.2019.04.23.16.21.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:32 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Xinliang Liu , Rongrong Zou , Xinwei Kong , Chen Feng , David Airlie , Daniel Vetter , dri-devel , John Stultz Subject: [PATCH 23/25] drm: kirin: Add alloc_hw_ctx/clean_hw_ctx ops in driver data Date: Tue, 23 Apr 2019 16:20:54 -0700 Message-Id: <1556061656-1733-24-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556061656-1733-1-git-send-email-john.stultz@linaro.org> References: <1556061656-1733-1-git-send-email-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: Xinliang Liu Cc: Rongrong Zou Cc: Xinwei Kong Cc: Chen Feng Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel 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.7.4 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 3d5bd3a..71671f8 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 8818ccf..17c45b5 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -53,6 +53,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); };