From patchwork Thu Dec 2 22:27:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12653729 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 C5D56C433FE for ; Thu, 2 Dec 2021 22:28:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377327AbhLBWcP (ORCPT ); Thu, 2 Dec 2021 17:32:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377328AbhLBWbw (ORCPT ); Thu, 2 Dec 2021 17:31:52 -0500 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68670C0617A5 for ; Thu, 2 Dec 2021 14:27:57 -0800 (PST) Received: by mail-pg1-x535.google.com with SMTP id s37so1133378pga.9 for ; Thu, 02 Dec 2021 14:27:57 -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=Iz/NjPjdEaZsBHJkEVtreK2U1LcF5Hqi38Sw8WurdATCOC6cL1aALbf5tKQ42nw/JP XLpn10TTzlDxcNpFgdRhit4cBTePM4p/PIDWzc95txSTNFZo0kjFKj1KkzQzYtvCtams AY/q6Vck3YO6Ilm0AFo2PgxxI49UeqhKkWzFc= 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=qDPB4WajU/SsIBkMDvq3a7RYfnNlH2ZOk9BkWHZL9ZpKTHGG2nU2YmNJDUQvZ9DlO4 sqlHxuv2QNk+QQ6Lr8z2z/lTHvy3wCzozSV7uUI4erVyMYuP+uh+3jqvgTJssYT4/yF+ WX9vA9GSeERTfoQsLyLSRtgnIv3yWtV8qDFEidwePDkvALd86YPYP8VbL/tENdO3XluS F/7yfe2XRhjxdZXj2Xwg3WTq2le1pnRZwoiRPasNKr1O4hkgNGuqaqD7e7C2bdYfPjw/ uA6SOo2cQVhbTXoziWY5+hOfry7dvBxUUu9IcDLyXRL/e8v4NiJKjRQrqMwudP9hTuwP bSzA== X-Gm-Message-State: AOAM533rpqI8QviN+QEHdzllSYOhO/ZUkJPX6wbJoq8JcAvgmTFf2v9t qgqQOhKVZ/2D0OnQpzvNF5V7Qg== X-Google-Smtp-Source: ABdhPJxVmEV2ZUl66ZDAbxGprGmuY7cFZIZJo7PYVlcaMs8O09k6dLAZng38yOdGkw+kn2oxif5+jA== X-Received: by 2002:a63:531d:: with SMTP id h29mr1517646pgb.583.1638484076938; Thu, 02 Dec 2021 14:27:56 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.27.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:27:56 -0800 (PST) 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, Emma Anholt , Maxime Ripard , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v4 25/34] drm/vc4: Migrate to aggregate driver Date: Thu, 2 Dec 2021 14:27:23 -0800 Message-Id: <20211202222732.2453851-26-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-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; }