From patchwork Tue Aug 20 23:06:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171881 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp180592ily; Tue, 20 Aug 2019 16:07:07 -0700 (PDT) X-Received: by 2002:a63:5b52:: with SMTP id l18mr26705063pgm.21.1566342427189; Tue, 20 Aug 2019 16:07:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566342427; cv=none; d=google.com; s=arc-20160816; b=HkgBTugik3RJ9LUeafPOG3B2MRi0zn7URgTkqUkFO2E7mImiifOGKxFxI48zxlE7HZ dvfyEUsq4/4A4cJsQexNDcYH3cZhfPRPAE6uvH+yIrepIsLyNRXZHCID8Q9iWYnPDtxO 7H2NLusbla+kbQGiulhMzzR/Vbv2ybSAbexnTqH0kN+tJM0E8+t8wb2KegwmXrtwsqUX m5saPHYYgLuqV5S1FDwNfrLZGSLk9A0xRWJ/ZGHhGhxxmv9dC6octnI2OzLu+Si/MyiG 4gQ+ilZ95zJsjKkT923qKJelLXiasgo7ITvji+Sdhhp5GoLCT8j7QPseN9Uh7dIg6Def f0Nw== 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=kYV4kILdbKA8eyGmIfSZvQNIJi3JDyMCa7aHVJs5K24=; b=op6hxBb0bAMlvO5QuyrHY5zPSMazRetTcr86McDEJWuGBDeq48R2lA9021JpsuZNw8 gvCsJHChopzSI1kQn1dp37tTSS2As+XePafmCvc9r6luxv2+3v1NODEe4nU3ikuQgG69 sHWKwxyX0Jk5r5NkKCRfHv3XjrJlVUCbBKRNJ83peBbiy1oeuqa9gt5VaTSG2RqbT220 b3YtGGWycCOSFpPUUu/YHD8TMAhMubKrrgauOA1xoaCqzxGKLK9QtCjzJ+bBdd/FYwZY dcWSdMY7Ft30+QJ19bMxE/oQ46KVfEws88ELVyGgy+INa8Q6UZfjiLBYQ0i8AvlH+LV1 qmPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dSG1Ek3w; 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 y13sor5524159pfq.30.2019.08.20.16.07.07 for (Google Transport Security); Tue, 20 Aug 2019 16:07:07 -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=dSG1Ek3w; 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=kYV4kILdbKA8eyGmIfSZvQNIJi3JDyMCa7aHVJs5K24=; b=dSG1Ek3wXoduCZ6bdSuQJ6zGn1REdKK3dH8Owh1BVf8Ldw3GKyoUXKYaXn2HjvWsG8 0MlCq97ext2U9uYXyV/org/3fYSxurxIps7pVnWIju7CTI40kNCZgjnfK+xgXP/3KceD YG5T4TWr78XkSbRdmtVXsdo6ODmzIGweCY6eclvmzUTmzIYugRMn3xIwL6/kLv9usAsJ EtvvPiZ7Rxryd4Y0jImrXwmpmsjFCAV0/ljtjkKlK0DeVe2IgpfJ0ZT+qQJOSKUfcYI1 +kb3OeO4iytf1/eFRCRYE6vc7RenGQ1wX1UcNLIW/+ziqlO1DOjcD/rnuwwTMLpzJyXR Lu2Q== 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=kYV4kILdbKA8eyGmIfSZvQNIJi3JDyMCa7aHVJs5K24=; b=RojQquQajjU7fU72cCyaMonEHyL+YwB9EaFeNPfJISPBQsbnfKSyDIxI0YE/rbNDYD DbttH7lPFoGKuNv2OrrdsmjqkMxndYlpG/Cdcpo0RP1bLwaaHLzMp21OX1JN1zGSZQg2 vi4v5qyRkPY5BJ7zg9gzAR09iXnFEXbUD7KS0ZZhm4okeKz/V1Aof+kCwvHyi5+XyiiQ WKYjAbSd+yBSgzY7HKDQa4eEd1+6ZLW3FEEvIj5Lkk2q20K02BV17LGTi59IUUWHiYME FUfQaJyJ3F5bvEiNDpSAY552rzxYZidgMvEWAqns+LsEA3GbQbqnHfnOSRCKbuxXlYDd a/Jw== X-Gm-Message-State: APjAAAVbFj7fag/Wk8KOBdZgLScP6SyeIrYNnuVH97v+PTDgmkCGYSve ywg7I+5LjYPYG1R9UbVHuEryg5vZ X-Google-Smtp-Source: APXvYqzk7Q18L54XsSE8B+hQfBteWjyw6GXtAXHv5na/lhxe1AhTuuoaZsEygqXrPAPNJJJfBzq22A== X-Received: by 2002:aa7:93cc:: with SMTP id y12mr28989943pff.246.1566342426836; Tue, 20 Aug 2019 16:07:06 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id q4sm27564747pff.183.2019.08.20.16.07.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2019 16:07:06 -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 v5 23/25] drm: kirin: Add alloc_hw_ctx/clean_hw_ctx ops in driver data Date: Tue, 20 Aug 2019 23:06:24 +0000 Message-Id: <20190820230626.23253-24-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190820230626.23253-1-john.stultz@linaro.org> References: <20190820230626.23253-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 d8e40fcff386..a2bb2b75be4b 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -1000,7 +1000,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; @@ -1040,6 +1040,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) { } @@ -1089,6 +1093,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); };