From patchwork Mon Aug 19 23:03:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171752 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3596349ily; Mon, 19 Aug 2019 16:04:02 -0700 (PDT) X-Received: by 2002:a17:902:a50a:: with SMTP id s10mr14068636plq.108.1566255842903; Mon, 19 Aug 2019 16:04:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566255842; cv=none; d=google.com; s=arc-20160816; b=UDT44FgXNdHUD3h96Q2DKBBP/obe4EHuZf6MqnIZZalBXw8VZiP3wDKQBnLr1MmuJk wuHeNC+s0Oc+M3aZx6Ki98AtEYLo3SLXlE8Uq+8KFdUp/OLbWKMC2mMLg3WUUOhzHHpv NcdFtAKMzY82l3KHYzEqqii6VoMHjFgeaG8FievBBVIEYme64R6VAqs3VVvGQXIhufUh b9+amoRkkk72vf2QBvi17Hjan08MabdF/Eww02wmVuFD0URGZcSMMaXAU0sB52aotRc4 LnTe4q7Wgvj+fpMs0KgRX9MrKWsIquVM1D7Jb3shxKrqSCM5OloZUUSvyj5b0muxm2Rl lrLQ== 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=YSUSZvC/MmkBb2A0U71VegVq9IwUqDyTaMf1Jm6kttM=; b=C5Ye81mqz1gy3i0W2BPRPk+mfLEkwsZ/aYtJVoYcncjj5rawn1HXDUjBDYnZEVeftS nGDZhsPDYVXZhSfE8CxGFdpOjJQjTlCzJxsVHPkyc1Wkxqeh1ki7YYfrfA3L9EjgxbJ9 INrd88PeLmreKh3zIX3B7CBqa5c8YLD3zPYBmXj+H6pDF9zlTT/kGCU4ZXzvL2BYWeUC 3t/8CNRMI4oZY86zACPJFnqUOU8LK18ugxjcOCv+OZHwRQvNYJNzpYyz/N2jurg5t3DK zdUYah2fygdFGV+aiwGmmzFdYTK9B0RKnwf3AYvEwNwRXTQaGu6L/po5ZEf0wrgUgs7M fItw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lUn1iLVW; 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 f6sor2050240pfd.46.2019.08.19.16.04.02 for (Google Transport Security); Mon, 19 Aug 2019 16:04:02 -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=lUn1iLVW; 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=YSUSZvC/MmkBb2A0U71VegVq9IwUqDyTaMf1Jm6kttM=; b=lUn1iLVWN3M/Tavd+lGuDsv+sjHbrx8GA9ZiY8qNOT04SvbHkmMQaFc10dzXCV2nL0 v0IFt7+4KM5RkGel8iZf268c9c5XOBDQjeWCHpNZHij2ar4vItOFkNorSBg2T9vlFkK9 n5iSbXpVkRmPjGEe6/eHcsJJPytYpdT+3cK3V2yHVs0acHXIJRDAPih50km1ipZX1TAR WgU2p6s7q+A69kPVgtzwgh/xJKB7s3DeX9/jPOljSf1z6/0i7PyWA7ZSCYV2nChVIDkc Kun9g4EEXdAYn9iBmJYQ/T4F4mI3fEh+4Hu6664kAaPuWPGLoqVlscoQCf3odGCbALJP /tHw== 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=YSUSZvC/MmkBb2A0U71VegVq9IwUqDyTaMf1Jm6kttM=; b=lQ43gOaXAEuM0XYcYp1pmZ9ljFTAJ4R+W7v0+gEUJ5P9axTTO+g8DHT+OtXdVFEVxl AdhBSYecSqaf0GZaO5oU6P+OKVvIKHJBTfc0Q95doyFgiRMSNiTVrAQSt3sT0qY0CLs8 Hneids/5FjjiW3ixW44vfBK7ZyexJS9maZMCn6JNevoYokIUz/rPI4fApJG86d2tUZDn m9hUi921b60AlDUZLTd1drofV26dEmqAePj5p7BcdxTkv6Ed4sHtY1ofvO+efluEPW+9 63/r1DNW5Jre5UQaxwz9qxrz0Bzg6SCa9qJTfm2+Z0W1LIGFkCixs0IHbmjPkrRayEFM 62xg== X-Gm-Message-State: APjAAAVlrt4T6e7BTR0NitXG0TUy3wpK4G7ODYjvcSkgrTcPtd1KKI8z vu0jfCki2itJ+toARJ2g8tD+nNyP X-Google-Smtp-Source: APXvYqwuD5lU5Za2D+Vjnplf9zhdygBc0WW1Zmxbw+NTVMd+56KwwU6JvtLjPPrSlN2QSTYdxT3KDA== X-Received: by 2002:a63:5807:: with SMTP id m7mr21941754pgb.371.1566255842444; Mon, 19 Aug 2019 16:04:02 -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.04.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 16:04:01 -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 24/25] drm: kirin: Pass driver data to crtc init and plane init Date: Mon, 19 Aug 2019 23:03:20 +0000 Message-Id: <20190819230321.56480-25-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 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. --- .../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 5caf0921c26c..559e521add43 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;