From patchwork Thu Jan 6 21:45:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12705785 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F870C4167D for ; Thu, 6 Jan 2022 21:47:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245177AbiAFVrK (ORCPT ); Thu, 6 Jan 2022 16:47:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244757AbiAFVqk (ORCPT ); Thu, 6 Jan 2022 16:46:40 -0500 Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F046C033274 for ; Thu, 6 Jan 2022 13:46:31 -0800 (PST) Received: by mail-pg1-x531.google.com with SMTP id z30so238595pge.4 for ; Thu, 06 Jan 2022 13:46:31 -0800 (PST) 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=pXQku93D/rC4XyQwRyjDG+Hw8yXvhZdjZb839YbIyVI=; b=XNFvfrQVoCRkJsg0UDXwhqksdjN1M3Wn/j+UApsuk0/AmeJfmXR3Fiu+2LJd/rRR2L shwEpidpjJPREQx8USWBQtSU/rpnGZD7n9Hcl3MmF+Fi8BrE8hW1b2fzsqkLDXryTfvX IgpGdRMknXm0EoelHiL4T0fIc56a2EyUJNVjA= 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=pXQku93D/rC4XyQwRyjDG+Hw8yXvhZdjZb839YbIyVI=; b=WWU90CFeqT2Ec2kUZU31OTa0lMD17DKaGQS73M33ArbREQoZq4rTCBk+pUZPKCezDY nWit+DEGbrgbGjqGoEp3zSMkNAU5wyqzjUFpRCxqRpT2e9+hWWB2rSQgFUxhhfZ03sJ3 B+Ix6ldfrprL9hWORnmumDgL/FCTg4vAFDitzCC/smCi0mrPdaCb0DK8ViEtzlrHghnp BULMFQE2RyS7PqdY3tX3bVdZ35loPSN23V5t5wy8iTU6hEwLvd7jJ7FIyi1q+zPtkM3X BsYBZv5wMPhqbWfXZ1wEaXoGqysfclluxNUDoI/0lU57Na7anxV1xEw7T0GyjbStA0o1 jCTQ== X-Gm-Message-State: AOAM533Occy2KXhfaYy8+aVAYyLBAnVtYRKiqvoae4GHYV34R7o69gPa bPvrJkAPMz2YRJ2bbiH4bt5MdQ== X-Google-Smtp-Source: ABdhPJzxEXPWmecqAT9M5vPs4YoQa9EQGMGNVPF/F/pdV8VYbPk2PnOFg0Jind+8jOkQzP/e2LpMfA== X-Received: by 2002:a63:7704:: with SMTP id s4mr7298509pgc.422.1641505590634; Thu, 06 Jan 2022 13:46:30 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:30 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Emma Anholt , Maxime Ripard , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 24/32] drm/vc4: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:47 -0800 Message-Id: <20220106214556.2461363-25-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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: Emma Anholt Cc: Maxime Ripard Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/gpu/drm/vc4/vc4_drv.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c index 16abc3a3d601..82a44ebf9121 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.c +++ b/drivers/gpu/drm/vc4/vc4_drv.c @@ -212,8 +212,9 @@ static void vc4_match_add_drivers(struct device *dev, } } -static int vc4_drm_bind(struct device *dev) +static int vc4_drm_bind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct platform_device *pdev = to_platform_device(dev); struct drm_device *drm; struct vc4_dev *vc4; @@ -284,8 +285,9 @@ static int vc4_drm_bind(struct device *dev) return ret; } -static void vc4_drm_unbind(struct device *dev) +static void vc4_drm_unbind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct drm_device *drm = dev_get_drvdata(dev); drm_dev_unregister(drm); @@ -293,9 +295,13 @@ static void vc4_drm_unbind(struct device *dev) drm_atomic_helper_shutdown(drm); } -static const struct component_master_ops vc4_drm_ops = { - .bind = vc4_drm_bind, - .unbind = vc4_drm_unbind, +static struct aggregate_driver vc4_aggregate_driver = { + .probe = vc4_drm_bind, + .remove = vc4_drm_unbind, + .driver = { + .name = "vc4_drm", + .owner = THIS_MODULE, + }, }; /* @@ -326,12 +332,12 @@ static int vc4_platform_drm_probe(struct platform_device *pdev) vc4_match_add_drivers(dev, &match, component_drivers, ARRAY_SIZE(component_drivers)); - return component_master_add_with_match(dev, &vc4_drm_ops, match); + return component_aggregate_register(dev, &vc4_aggregate_driver, match); } static int vc4_platform_drm_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &vc4_drm_ops); + component_aggregate_unregister(&pdev->dev, &vc4_aggregate_driver); return 0; }