From patchwork Wed Aug 14 18:47:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171352 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1203530ily; Wed, 14 Aug 2019 11:47:45 -0700 (PDT) X-Received: by 2002:a63:484d:: with SMTP id x13mr515263pgk.122.1565808465655; Wed, 14 Aug 2019 11:47:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565808465; cv=none; d=google.com; s=arc-20160816; b=ted2Xq34inRxSyn3z0pyopNm5/cXMVx6Ty+c60gc4ZtwF5ufaxW9ePDVUUiYdbcPxd 6XbDKHk+BJSLJhz+c8IdZ8zMV9JrNIa0Az1c2yHKTm4oBTJ7vF+kZ/mUIZ+gv6hIdhjR sVG10h0Jv00MFOqyKgTrLoWrmx6E1pNP5NXTBcfO5VxSi1kP+ga98EY+qMKOD6CByqv/ oFGVugpgQI3bDZXtDK9yztfwtBSEUPB1ahbIp1AHaNqbjI1d2qcRvwrnxJtP7QxEsxiZ LlQyvfaMmJNGwE2ogvpYq0sEqVl4kcCwvFydNmXQ38DOSLXVa3FzzyHyQoJ6ySyKOHtm M8Mg== 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=g6uAv27tRz5L9wSjxLNVl9yJGuoTJBSlGcSrGIG0dc8=; b=NTg9XVGJQMc1MDIfT2ZVYEuB9fcRoqyBUUscqUgPU+dxOTm8RyGTBVTxMemYte1e13 0K6B1v7TkcoehrT/kjnJBdI/zK69cO3sYIwegEAMnQ8Xjzie1uOJe07AL7T+L99SQGQL Ic5rwEa/ahPOF45pnTqW1I80EwzGbdOTpHsKr0eWVD3bmq1VB6osv6rPmuQOgh7Derzl 6J7L5Hn9NHXlC1fm3apwvujOjgvzroXiggplVW9tStellfeP+LTnVibQhga+UZVdYcll FwOjoSdMwSfx+Wj62hI6+E6PI5wdAjqGPWYXBvtJCVDzcaCvYFqd6XHn9l83UEXCMiKM KO6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Q/K3nksX"; 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 d11sor502839pjr.11.2019.08.14.11.47.45 for (Google Transport Security); Wed, 14 Aug 2019 11:47: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="Q/K3nksX"; 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=g6uAv27tRz5L9wSjxLNVl9yJGuoTJBSlGcSrGIG0dc8=; b=Q/K3nksXnTewrgH66PEsGInqHk3G5CSsI2MmO0bGyulaasGK4GnUHI4STA2aXzrRz4 D0B7N1vpWKlYXzTEzek6IXpuHE4Ye51+L0AWYXGcXZLqitG/qBEgEUu/AZmCNwPFaKHU taiQH2TBjCAka8jXpuyNUDKgJEJds4vdeIIjZPNFxDROhXDFhUkpW66TJ/87mhbw5D/b kBY/0l4Yq0C9A6Dq9qmXYcI1gbtFB1VTjUJVOypUM0UeMW8Sr79f3I5D7nG7VSp9iZVW /rUuvIxHQCdB2EYgVcWynoQwr8d36hSXtEAgjF5iV2u0nnJrQXwLU3+4/T7Nn3qGoqT5 wz6A== 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=g6uAv27tRz5L9wSjxLNVl9yJGuoTJBSlGcSrGIG0dc8=; b=UUTWudR8XBjybqkPtkGwo5NlasdPLrN7Dw+bs4Cu7TdRI7LUndwLFIs0o+OB5zHJqv uYf05/DEro5nO9eJ0Ikl/Y8tBV9LeKsQUhgvLMF8mB/rUiqiMSrmr/lLzqI1Abswv+He L3PRg41sHnz+O4HAb4x9QcTxuIr1xW4DOko1VCnjhHJQDfRZsQ5v3ovzZlPBlOEPl8Dy Y/12RVg+dM3+PL4Cps8DKO7Zs8XGWz5oKRWFZM5LD2LLBRDqMpiSllq3UXueakd+RVJS 3cOdZ0X7VuZ1WIBiqZJ1/ie4i4NMmPVNjj1MQLCYsG0R9Gwl8dfICsHHiCMeizLKg7OB 4OUg== X-Gm-Message-State: APjAAAXUtY/whCrHHdu+7TfLcmmNLP1xA2a/t4aKQcGS++MS9ZBFnUNY 3l3c2ViWqZbTmJMC+wkw8YKWGtZX X-Google-Smtp-Source: APXvYqww/O9lEEjFWec4hq2+MxoQOn1KDh79uOYPC/WRYrDlO23Pgp6bxoz/dkBfwH1RluR4paFsEg== X-Received: by 2002:a17:90a:9f4b:: with SMTP id q11mr1030317pjv.105.1565808465169; Wed, 14 Aug 2019 11:47:45 -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.43 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 11:47: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: [RESEND][PATCH v3 25/26] drm: kirin: Pass driver data to crtc init and plane init Date: Wed, 14 Aug 2019 18:47:01 +0000 Message-Id: <20190814184702.54275-26-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 code via a passed in driver_data pointer, rather than hardcoding them via ade_driver_data variable. This will allow those funcitons to be later moved to the generic kirin_drm_drv.c using alternative driver_data structures that support other hardware. 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 --- v2: Whitespace fixups, commit message tweaks suggested by Sam. --- .../gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 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 f729a1de6e14..ab0c5d03903d 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -572,7 +572,8 @@ static const struct drm_crtc_funcs ade_crtc_funcs = { }; static int kirin_drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, - struct drm_plane *plane) + struct drm_plane *plane, + const struct kirin_drm_data *driver_data) { struct device_node *port; int ret; @@ -589,13 +590,13 @@ static int kirin_drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, crtc->port = port; ret = drm_crtc_init_with_planes(dev, crtc, plane, NULL, - ade_driver_data.crtc_funcs, NULL); + driver_data->crtc_funcs, NULL); if (ret) { DRM_ERROR("failed to init crtc.\n"); return ret; } - drm_crtc_helper_add(crtc, ade_driver_data.crtc_helper_funcs); + drm_crtc_helper_add(crtc, driver_data->crtc_helper_funcs); return 0; } @@ -894,21 +895,22 @@ static struct drm_plane_funcs ade_plane_funcs = { static int kirin_drm_plane_init(struct drm_device *dev, struct kirin_plane *kplane, - enum drm_plane_type type) + enum drm_plane_type type, + const struct kirin_drm_data *driver_data) { int ret = 0; ret = drm_universal_plane_init(dev, &kplane->base, 1, - ade_driver_data.plane_funcs, - ade_driver_data.channel_formats, - ade_driver_data.channel_formats_cnt, - NULL, type, NULL); + driver_data->plane_funcs, + driver_data->channel_formats, + driver_data->channel_formats_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_driver_data.plane_helper_funcs); + drm_plane_helper_add(&kplane->base, driver_data->plane_helper_funcs); return 0; } @@ -1024,14 +1026,15 @@ static int ade_drm_init(struct platform_device *pdev) else type = DRM_PLANE_TYPE_OVERLAY; - ret = kirin_drm_plane_init(dev, kplane, type); + ret = kirin_drm_plane_init(dev, kplane, type, &ade_driver_data); if (ret) return ret; } /* crtc init */ ret = kirin_drm_crtc_init(dev, &kcrtc->base, - &ade->planes[ade_driver_data.prim_plane].base); + &ade->planes[ade_driver_data.prim_plane].base, + &ade_driver_data); if (ret) return ret;