From patchwork Tue Aug 20 23:06:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171882 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp180615ily; Tue, 20 Aug 2019 16:07:08 -0700 (PDT) X-Received: by 2002:a17:902:9a82:: with SMTP id w2mr30535898plp.291.1566342428584; Tue, 20 Aug 2019 16:07:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566342428; cv=none; d=google.com; s=arc-20160816; b=rA6i+LUToPY8aNWwa9pp1G5jfS87ArzgV4YzRtEKLHzEtT9oKzt0yqYE+fw7XefXX+ HlcUNzeFU/LGlMo2dp4tzGpLILxRMyhP0xPiPDFmG+9JgMnySBOuuL3ZqEYMO8B5cNRa aXbqOa0xVvBPai8nRFvWI+NN5Fskly5DEGMG9jo2N3Mxd0GGkslaqfKdzDJUc/CkPI25 DkPGTagC6nn7Y06IhCyqHo4TZXmWE1bXmgDJn6nhQ6t8gWfo/dF1e+wgFFNVLbdNJ4ab mJBhnhprd90FCUMLDRr9FaoupBJB3NTcq+0sjjlIB3SkxAM9hWvuxRcjcROgiX9PD6vb M1/Q== 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=VMYo3cmyj5mjY37f6pl3U9ULsw2dRbJPHRfoYta4hK0=; b=NeqDkMkyET0bG7Lk6Xlrph+B98Ga/T26RXlso/67AuEKFXNxtc9fWIlqt5vyZgToyX prABlbk7wxTKKu9/4+7bsnfzU7XfZpumHBt3rwKIvrHub5/tgeHNmBukhlPrIu6su1qS N721nD3VaXU6iF2TjCmvBAxpdyDjfAqhuNlN/hrhsT4Wm4sxoW1fBX2qhfmUm0QdG7e+ E2XzIZeRuABj+HKPQwfgNMHoC7/W4zpRjWHS4A4aul9YElNHG4cqtSjDTut9dfzfCqv4 ZKZ9NrxoiTIWhZko3oaB5WbfLa+/jdpwBKDgiwmdjlCyy5K6NTGIBcCNQX5Wwxa3mTIN Keng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gU8ZcIiN; 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 z123sor5506345pfc.6.2019.08.20.16.07.08 for (Google Transport Security); Tue, 20 Aug 2019 16:07:08 -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=gU8ZcIiN; 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=VMYo3cmyj5mjY37f6pl3U9ULsw2dRbJPHRfoYta4hK0=; b=gU8ZcIiNsbUNjEDU4QjWJ18XVrvz8lEmU3ppSLa8L3REyQwkogE286YOh/RV+SS7bK dzkEXC8NFkYiQu0pEDlrrWCFHsw3x6XTDQbfUSId/HntLnnMVaVmQAol0l9wYXFnAb5/ 8u4GoC+2Y0OeBIaOu55i7DAptqIs488dPDRMi8qvm+E992oefr+YMpKZ8A/KdT+XUK8q Tp3+q7eThBZbXJ0XimqCKowZsiM3PkZokQj39DtGWkGe9ohYAh7C/ztK4b3a+sYzp5e8 P2/GfsazWdbIG77RFAy3zoB68GVn24r0Zqu6lHJroKkdWlxS73tzCy+RKm+PFWoanfNU QB/w== 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=VMYo3cmyj5mjY37f6pl3U9ULsw2dRbJPHRfoYta4hK0=; b=FulGKlft7ErV0jg4/e5FsDWebFHLNwz1ZlY0W3PFIFI4IqIWDXpjxsnc6+GIdP7HiJ 2zyWGpY0j4RLBht3icTN5qc/oEeFVY9kLEKovP+jWJdsdLmJfd3NULBH0epQH4f6uPdH VKJBLY0HhK+bIeveaYx0rB3Hc6U6z3LJMBCJWSoLyG6Ozq5g0Zrbd/Ebre/P3oW99Ub1 qOkZnOJBmnkmLxUKAh8D2tceqVfZgI0rxZgwkLp6bZkWBoa2w5HiFdI583WDc8MN/FL2 hKDNwguiTnEbOvOPUi/l/fk8z5H8fCkvwddTmJ35/7dA9MlaIRHhSYsxlqMCodfap70f MsGw== X-Gm-Message-State: APjAAAXm/Ee4ELZ/y8aDYVKWQtMXX5/djakSyNl/wvSL59nRbnxDXmvV ibb7yF/BmPgPZpN7ujIdtTCt+x/y X-Google-Smtp-Source: APXvYqxz1oVW6l7QOBSV8Pa4RGmsgh08w6fiIaPxG+0QGrfNNncnOJsGH7SP4TJXtPquEw8GHTDdyw== X-Received: by 2002:a62:1d93:: with SMTP id d141mr13758767pfd.40.1566342428229; Tue, 20 Aug 2019 16:07:08 -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.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2019 16:07:07 -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 24/25] drm: kirin: Pass driver data to crtc init and plane init Date: Tue, 20 Aug 2019 23:06:25 +0000 Message-Id: <20190820230626.23253-25-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 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 Acked-by: Xinliang Liu 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. v5: checkpatch --strict whitespace fixups noticed by Sam --- .../gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 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 a2bb2b75be4b..bbdfeac946a7 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, + 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; } @@ -1025,7 +1027,7 @@ 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; } @@ -1033,7 +1035,8 @@ static int ade_drm_init(struct platform_device *pdev) /* crtc init */ prim_plane = ade_driver_data.prim_plane; ret = kirin_drm_crtc_init(dev, &kcrtc->base, - &ade->planes[prim_plane].base); + &ade->planes[prim_plane].base, + &ade_driver_data); if (ret) return ret;