From patchwork Mon Aug 19 23:03:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171742 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3595993ily; Mon, 19 Aug 2019 16:03:45 -0700 (PDT) X-Received: by 2002:a17:902:b08a:: with SMTP id p10mr25436410plr.83.1566255825647; Mon, 19 Aug 2019 16:03:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566255825; cv=none; d=google.com; s=arc-20160816; b=alJHwR/XkxuVg/X+OsFXBCD4YwdxTggX8aXNEOj4SnXTJUmTfbsmoPt08c0f/XXeEw 01b11BA8FgYqLxMYJ7x4Q98ztwvIP0Qh2MMYR5RQy70F8GjItWEVi7kDQelrpEV6J6+q DLvZZchY3n3fVg5sWV8ZsVPAUdUy41HILBxj6mNCejUv4kRitP08l2WVegsnIWWuuywh yvQU9ABazvrnnLhvJkIcT29TU4v9bZ4WBObUzpvRl3LxlpNPiVqGlYFf+M9ZYd46iTET 4FXciFsqU6d4+Pv869zT+ret6tLb/KWfFmlvI1dO3f8Psaw0gA0JbcFoZkhlvVS/oyi8 5tIg== 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=Yj68sd1eYwpU86YtcH+RSFue4gqH76sT4KzX/dwyzO0=; b=IehZGSqx0ZqTV6vEzMX+Qa2OgnVAt9JcE7gwXPbMYrzrWDs5vPxz2cdl0kifHnm6uY GVFWT+9zb0Vbp8TrZ485Y21zO/Y3pTyUj3l/8XRYjbrfFLXALYejNZeqxH4xuDF7SiKT dz6AZhOVo+axpyqTtD/iuz6oyTryt1VRzbWviQidusrnUELw3Rj3c9vBCaOqAo+AnvZu mULSvO7VIns7cWTSZSYHqHL2BUkEKEgqSJf1FW2ic2azkFRuViQZf5yW0R32H3CZRIxl pvxtkibFdBmlRgDwXB5MZU2xYLYQxQqpDWoi2HYI2MIUHsImWLw1KUkX2sEkVfmSuCqU 0NnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jWgmzgcM; 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 ev15sor2532525pjb.14.2019.08.19.16.03.45 for (Google Transport Security); Mon, 19 Aug 2019 16:03:45 -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=jWgmzgcM; 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=Yj68sd1eYwpU86YtcH+RSFue4gqH76sT4KzX/dwyzO0=; b=jWgmzgcM1i7NReZc5KCeo0QEYjt8aYxq4KuQ74NTGAlYRmuvYfF7LwkyS5FD/jBTQL OBgO+K8F+J8LV9REp0D4o5Dh2cXYJBL3QTEqYRBJhz9zzNVYyPWphz9l7xFYhvT18dCp pBdzcDxexJ5jPL7Sw+k7kAjQM5xfAmqkErQSv0ygKh65NYRuOzXyPfWdSe6AuOYpUfz9 pHgeDuP1V37a/81wG04A08EQTPGY/Zr/ALCQMAjVRPbO2hhQLyLaUHHYVc44DYHRQgV5 uTWevnSu3xP51+arFXtBI46wMZYGo6hrgcliqsp5gXAlb+PgO0vOsvxT37bYV/5eKlsx ditA== 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=Yj68sd1eYwpU86YtcH+RSFue4gqH76sT4KzX/dwyzO0=; b=YOVZNf3gCG3Xjuo/v1GhBVJ7nE8s95DZ2mpXR9yftjX9egUkUAViBC8116xkeVEzg0 FOY3/5H0kcyZqIB4GNT7zXjW1g2l6VTxCW5GJ/2qme81keFE9E8rjUxTD7bDgBWQSXFk jrD/HmgEdnGwDRvJKfNcQ9OFtYgT1GmBTLnroM5PoYmjWQ3nEe2NaBRVLJkLj815f2vY Pblpcd3KHibp6cd/84tLA1mQi6L/f1EXKaip+/IAFAO2q5a6LMIqhSW1Sn7WvPSBqdoH Oj+IFE2rsYAC3GQzF1N2IXZXp3mIf+l0sytm7FR8lpP7wkU+ROZn8DCwnEjW+oiKEs1X 2IQA== X-Gm-Message-State: APjAAAUf2c//djqQusH9/4a5/aT1XSkWDAMbnUHk4zHid4lkCimrF11b UvVh/RraO1lAzTx5HzzTdmNNf7Vq X-Google-Smtp-Source: APXvYqyyG2JQKgW7zVTrCOsLct0kVEH3lEoOnZMn335h3DFOFhgEOXxgTuPRyfeU5wuq83dSWU5c6Q== X-Received: by 2002:a17:90a:c68c:: with SMTP id n12mr23289345pjt.33.1566255825237; Mon, 19 Aug 2019 16:03:45 -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.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 16:03:44 -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 13/25] drm: kirin: Move ade crtc/plane help functions to driver_data Date: Mon, 19 Aug 2019 23:03:09 +0000 Message-Id: <20190819230321.56480-14-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 moves the crtc and plane funcs/helper_funcs to the struct kirin_drm_data. This will make it easier to add support for new devices via a new kirin_drm_data structure. 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 | 15 ++++++++++----- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 5 +++++ 2 files changed, 15 insertions(+), 5 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 6ff8417943c6..016a6057c5f6 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -602,13 +602,13 @@ static int ade_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, crtc->port = port; ret = drm_crtc_init_with_planes(dev, crtc, plane, NULL, - &ade_crtc_funcs, NULL); + ade_driver_data.crtc_funcs, NULL); if (ret) { DRM_ERROR("failed to init crtc.\n"); return ret; } - drm_crtc_helper_add(crtc, &ade_crtc_helper_funcs); + drm_crtc_helper_add(crtc, ade_driver_data.crtc_helper_funcs); return 0; } @@ -917,14 +917,15 @@ static int ade_plane_init(struct drm_device *dev, struct kirin_plane *kplane, if (ret) return ret; - ret = drm_universal_plane_init(dev, &kplane->base, 1, &ade_plane_funcs, - fmts, fmts_cnt, NULL, type, NULL); + ret = drm_universal_plane_init(dev, &kplane->base, 1, + ade_driver_data.plane_funcs, fmts, + fmts_cnt, NULL, type, NULL); if (ret) { DRM_ERROR("fail to init plane, ch=%d\n", kplane->ch); return ret; } - drm_plane_helper_add(&kplane->base, &ade_plane_helper_funcs); + drm_plane_helper_add(&kplane->base, ade_driver_data.plane_helper_funcs); return 0; } @@ -1056,6 +1057,10 @@ static void ade_drm_cleanup(struct platform_device *pdev) } struct kirin_drm_data ade_driver_data = { + .crtc_helper_funcs = &ade_crtc_helper_funcs, + .crtc_funcs = &ade_crtc_funcs, + .plane_helper_funcs = &ade_plane_helper_funcs, + .plane_funcs = &ade_plane_funcs, .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 cd2eaa653db7..70b04e65789c 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -35,6 +35,11 @@ struct kirin_plane { /* display controller init/cleanup ops */ struct kirin_drm_data { + const struct drm_crtc_helper_funcs *crtc_helper_funcs; + const struct drm_crtc_funcs *crtc_funcs; + const struct drm_plane_helper_funcs *plane_helper_funcs; + const struct drm_plane_funcs *plane_funcs; + int (*init)(struct platform_device *pdev); void (*cleanup)(struct platform_device *pdev); };