From patchwork Wed Oct 6 19:37:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12540409 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7034AC433EF for ; Wed, 6 Oct 2021 19:39:34 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3C1AB611C5 for ; Wed, 6 Oct 2021 19:39:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3C1AB611C5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E102D6EE3D; Wed, 6 Oct 2021 19:38:41 +0000 (UTC) Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by gabe.freedesktop.org (Postfix) with ESMTPS id 14B436EE38 for ; Wed, 6 Oct 2021 19:38:39 +0000 (UTC) Received: by mail-pl1-x635.google.com with SMTP id x4so2371652pln.5 for ; Wed, 06 Oct 2021 12:38:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xbBIA2S7VMXOXCQu3Vr82oQpSXn2i51a0ZJRtaPISIs=; b=aN0RTzaXUPCNk+Z7SmH6pe2SeEIbUotZp5TdFO7V2VWXGU+0KZwohqj38kjI+GFn/K YXnd/NSMifjTnUK1IgGt/GE7okNm9POSZPSVKn2omkO8WH8sRHi8/rZVhF6IQ6Uz/EQ6 KNWrvLKUIPlxYo2xiow1LG1hapUFvaPz6OEZ4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xbBIA2S7VMXOXCQu3Vr82oQpSXn2i51a0ZJRtaPISIs=; b=tVG2CZWG7PW4dgsCAHz2wuGL9H1R7SnRQwI3ve6c/59THlLEy3gX7yVRknUnNeLNrB 9wldSsXAPQSzbt0HgQvb4WTP3SjuoJMFUr54CRFeSaYz++Bo54U7OGA+AfOH3mXOVlKT zqyCYSweNEs/Vy9rU+hJtKYGgw7XmNy/CWxO4HU4SxFhr3OT+BwvUeNWf61VBu88gx43 0qLZIBaKTlA21q1X9bQfkY7T2E0RSwkEhb7A8sROyQbXZ4jv4Q5bD4fvoDse1tD0Wfil BY19yxc9DoB0oERVvq+XnHBKx1DkcMId7/dI5mJCi8f4N1EZlrt7vDuRuTV0Ph19zn5+ nD5Q== X-Gm-Message-State: AOAM533zAL4mR39J70rQiaxOX2IyEhQ4XersUvnlvimPkIn8uAtyAd4T uvBd4tTwnHtHgr70KQxbccKW6g== X-Google-Smtp-Source: ABdhPJw+gb0O8hLaQn2OkipXTFOr/jVxqa6vjQTWqWuW/U/h57JvAGWQEu5RxusKdo9t0nSMvN+smw== X-Received: by 2002:a17:90a:bd18:: with SMTP id y24mr631875pjr.83.1633549119266; Wed, 06 Oct 2021 12:38:39 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.38.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:38:38 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Philipp Zabel , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v2 14/34] drm/imx: Migrate to aggregate driver Date: Wed, 6 Oct 2021 12:37:59 -0700 Message-Id: <20211006193819.2654854-15-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: Philipp Zabel Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/gpu/drm/imx/imx-drm-core.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c index 9558e9e1b431..dbf5cca5201d 100644 --- a/drivers/gpu/drm/imx/imx-drm-core.c +++ b/drivers/gpu/drm/imx/imx-drm-core.c @@ -198,8 +198,9 @@ static int compare_of(struct device *dev, void *data) return dev->of_node == np; } -static int imx_drm_bind(struct device *dev) +static int imx_drm_bind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct drm_device *drm; int ret; @@ -266,8 +267,9 @@ static int imx_drm_bind(struct device *dev) return ret; } -static void imx_drm_unbind(struct device *dev) +static void imx_drm_unbind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct drm_device *drm = dev_get_drvdata(dev); drm_dev_unregister(drm); @@ -281,14 +283,18 @@ static void imx_drm_unbind(struct device *dev) dev_set_drvdata(dev, NULL); } -static const struct component_master_ops imx_drm_ops = { - .bind = imx_drm_bind, - .unbind = imx_drm_unbind, +static struct aggregate_driver imx_drm_aggregate_driver = { + .probe = imx_drm_bind, + .remove = imx_drm_unbind, + .driver = { + .name = "imx_drm", + .owner = THIS_MODULE, + }, }; static int imx_drm_platform_probe(struct platform_device *pdev) { - int ret = drm_of_component_probe(&pdev->dev, compare_of, &imx_drm_ops); + int ret = drm_of_aggregate_probe(&pdev->dev, compare_of, &imx_drm_aggregate_driver); if (!ret) ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); @@ -298,7 +304,7 @@ static int imx_drm_platform_probe(struct platform_device *pdev) static int imx_drm_platform_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &imx_drm_ops); + component_aggregate_unregister(&pdev->dev, &imx_drm_aggregate_driver); return 0; }