From patchwork Wed Aug 14 18:46:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171343 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1203232ily; Wed, 14 Aug 2019 11:47:29 -0700 (PDT) X-Received: by 2002:a17:902:8a94:: with SMTP id p20mr773477plo.312.1565808449093; Wed, 14 Aug 2019 11:47:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565808449; cv=none; d=google.com; s=arc-20160816; b=mOTmV8LUE3h6CuNnUo8j8MwXA8H51jgoi6z+90pwEzwXmpKRdBbBfsTS2Ef9uiOThK 4f6DzGQQtUXGrt093QIXSSKPbSR1wOlBLIEkvxj/JfvdErSszl2nsQOWXFCqzhEuZ5lm ImwngM4GOLfi8VzAEsmVNTBmTY10W3H0Ns3BkO1ONDm1DZABzXufl5hUeHZfK1HTUZ9v Fk9qH630tnE8v+cgt+tPE+URXgej2Ly5UjR/XckGbO3QpJe9dK0A88Nt9iX5QRunUC8l nm2eN+zNAy7N7uyX4DtpC/uLPwF2rJ9vBE3viMjl2ICwIRFhHf3+SYbKhOE55K99EvVy f2oQ== 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=7WLovU9z58t+myBhWk3iYSpTP732yAw8/1ubIgKA+3A=; b=T9e/NEDz4bsPfBWMxMG/7O+qlIj/XhSozXUc6dDywf09eUaqw5ebVgyWgU6bokhbKt Gm41ITIfevXUzYS3dsbRuugFP4mUMR4TgFOrBm3LygykMB7on/OYL3eEgRBwf3ycR/BP vPJ6r0/RndysS6Arsj3HFLN5NAB15SH4qq6faOSe20l2yq4WMfnBV/8ntFP4O/dyT7G9 QOb4YPm7re6OnG6/vdUP8BP//KyVhm9Gx/zLP7lz0tzzPCTzchWFU2g3kdKv7METa93S Hezz9NqBs987PuAiKT2UzhH15I+k6ws2of29pGxIylurtNkyTfjlqItTi+hO4OjgUQ1F oD2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="CER/jqqC"; 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 s16sor569729pfd.52.2019.08.14.11.47.29 for (Google Transport Security); Wed, 14 Aug 2019 11:47:29 -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="CER/jqqC"; 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=7WLovU9z58t+myBhWk3iYSpTP732yAw8/1ubIgKA+3A=; b=CER/jqqC2aPOLsLXBjxg7ht7MqkRyVbpCPa5548diH9GUIMpcKKp3Ab7dxu4JkRM4N QN6A4e5aHsk4ei+iWQrmACrD2/wR5JgFXd1lFFUdCl0FLIlhtTXA18FFWeQUkNP/3TgL fpGYfFfuSjbmScUfRlgx4700XHcpk4EJBYOKqwOONCgUDr1lkaG5HVGiZ5O4HlhPuGNX Lwdb2SVyX7FKnFopIbEkNXpRG91248q9PQB0b6bxOaRGkeSstBqBn2qMpFyZ2agAb0Rx x3M7tgDasQpoudyFE+yC64+qCgK738D2vMD4Z8ACW47e7JK2OMVk2/29ibZutteWt1BI 058w== 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=7WLovU9z58t+myBhWk3iYSpTP732yAw8/1ubIgKA+3A=; b=KQyZrSpxPE72jkN4qxDj9JAFhrv9KsYLI4j2pouhfZrrUhvg7pjHG0X/xlkBA8Q6va mBKK5nFVm7ozjutbQkjxj6rMHYE2/Z9hZbbPq91d2Km9V9xxFsZ13ECaf1ZCtAYoLchM SxajDucMRCxwPiYjkWegJj7dISiqRvTTW9Nkgf0V64WoA9/glL6XkxED2PS2N6aJmKPp 2aOi/EZDJyBkwWcALREu5fPwNyDew9tBxZAEDjRxENPq4gKjY3Bl5UomBJtqmfStXIJH DfbgDciq6IL2RUlIG1IV5dZdKJHwPnCAS1spZlEjBEcWOmSARvt/d1ZhiRoX2rGW/CAp MqXA== X-Gm-Message-State: APjAAAUE9A2BMDaTH0xNX9atimtqqhTgnYy+cTFn0/rup7jhDyCNEOfJ N40ood/+5MoecSiBZwKS1jYNm5Ff X-Google-Smtp-Source: APXvYqxj70kmciK+8+RpfO0Hyq2p8mFesfp+SwYXoNBXwfaJmOEIpApjYdaN0vMsGJxNRMUhNBzgDw== X-Received: by 2002:a62:8f91:: with SMTP id n139mr1474420pfd.48.1565808448714; Wed, 14 Aug 2019 11:47:28 -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.26 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 11:47:27 -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 14/26] drm: kirin: Move ade crtc/plane help functions to driver_data Date: Wed, 14 Aug 2019 18:46:50 +0000 Message-Id: <20190814184702.54275-15-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 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 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 acae2815eded..029733864aa8 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); };