From patchwork Tue Oct 26 00:00:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12583605 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 D7217C433F5 for ; Tue, 26 Oct 2021 00:01:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C28BD60F70 for ; Tue, 26 Oct 2021 00:01:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235851AbhJZADw (ORCPT ); Mon, 25 Oct 2021 20:03:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235708AbhJZAD2 (ORCPT ); Mon, 25 Oct 2021 20:03:28 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31313C061767 for ; Mon, 25 Oct 2021 17:01:05 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id na16-20020a17090b4c1000b0019f5bb661f9so247202pjb.0 for ; Mon, 25 Oct 2021 17:01:05 -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=pu3Ettw2+f3cI24EEPlu+iHiL6Bl5h06ZQoWL3Cz2Tw=; b=FyVFBxqfsIYw8YOp7sC2d6zkxP42HZ4IH945uwnHC8IJXRMGAOMflzcAsSWqsBv3LS rx7di7IicyojDoCy/pfarCS70keFfp5aLLJ7RAYiJFwVcBLnyfVyMQztieULiZDGYH9J XYY2V8lXbLnP7x9/7EQfmfg0ZmwwKzOjuvCN8= 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=pu3Ettw2+f3cI24EEPlu+iHiL6Bl5h06ZQoWL3Cz2Tw=; b=To1hygLTRdkzurZl6s5wARl3i4yIEmpIeYIwAf0FVXZXp/8su+Jgx7nGh/OXAnjUmR n1ccXJKYTTjVrVLSXCPtrfznrtGKVfo4AJpkIaBwD6T8R7M7IBPGLF6J4vY21H8cNZj+ AYN2/CUxgwrhtEI3vS/h8cNgCILQT5QYGDZbqMJKT+3KXMkSeUPbp5cCcFRwGSY9LLok XS1STUSnFTIWCBMuGTL3hcyanC4VvRzU9otH1ICrGxIqjXUWuyBrf2GSek1r7LVnfJSr eASvWi1AihTSC4Bx38A1hPKalMrsp0jKpzrndoGJer1QBf528ROZdZIQhuBZ7cNDen1O 8B8Q== X-Gm-Message-State: AOAM531cVh+EuWZiPtEtAf7tZjI3QKyXv48jdF50GPawgXF5Xvyl7lDI QgI8BrLOFWH604+FVXgDN+hjIw== X-Google-Smtp-Source: ABdhPJyo8+IVsPW4ErQRrYNvfYFj9VfY/6yHyL/Fe4pPomZF1IH2ZD3fGLXHX+N3iY4mjz6EA/xuLg== X-Received: by 2002:a17:903:1111:b0:13f:d1d7:fb67 with SMTP id n17-20020a170903111100b0013fd1d7fb67mr18762269plh.85.1635206464672; Mon, 25 Oct 2021 17:01:04 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:f5e3:5eb1:d5ee:6893]) by smtp.gmail.com with ESMTPSA id b7sm9900747pfm.28.2021.10.25.17.01.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Oct 2021 17:01:04 -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, Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v3 21/34] drm/rockchip: Migrate to aggregate driver Date: Mon, 25 Oct 2021 17:00:31 -0700 Message-Id: <20211026000044.885195-22-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.1079.g6e70778dc9-goog In-Reply-To: <20211026000044.885195-1-swboyd@chromium.org> References: <20211026000044.885195-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: Sandy Huang Cc: "Heiko Stübner" Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index bfba9793d238..cc63222c3ad0 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -109,8 +109,9 @@ static void rockchip_iommu_cleanup(struct drm_device *drm_dev) iommu_domain_free(private->domain); } -static int rockchip_drm_bind(struct device *dev) +static int rockchip_drm_bind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct drm_device *drm_dev; struct rockchip_drm_private *private; int ret; @@ -186,8 +187,9 @@ static int rockchip_drm_bind(struct device *dev) return ret; } -static void rockchip_drm_unbind(struct device *dev) +static void rockchip_drm_unbind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct drm_device *drm_dev = dev_get_drvdata(dev); drm_dev_unregister(drm_dev); @@ -342,9 +344,13 @@ static struct component_match *rockchip_drm_match_add(struct device *dev) return match ?: ERR_PTR(-ENODEV); } -static const struct component_master_ops rockchip_drm_ops = { - .bind = rockchip_drm_bind, - .unbind = rockchip_drm_unbind, +static struct aggregate_driver rockchip_aggregate_driver = { + .probe = rockchip_drm_bind, + .remove = rockchip_drm_unbind, + .driver = { + .name = "rockchip_drm", + .owner = THIS_MODULE, + }, }; static int rockchip_drm_platform_of_probe(struct device *dev) @@ -415,7 +421,7 @@ static int rockchip_drm_platform_probe(struct platform_device *pdev) if (IS_ERR(match)) return PTR_ERR(match); - ret = component_master_add_with_match(dev, &rockchip_drm_ops, match); + ret = component_aggregate_register(dev, &rockchip_aggregate_driver, match); if (ret < 0) { rockchip_drm_match_remove(dev); return ret; @@ -426,7 +432,7 @@ static int rockchip_drm_platform_probe(struct platform_device *pdev) static int rockchip_drm_platform_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &rockchip_drm_ops); + component_aggregate_unregister(&pdev->dev, &rockchip_aggregate_driver); rockchip_drm_match_remove(&pdev->dev);