From patchwork Thu Jan 27 20:01:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 537134 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 97B38C4321E for ; Thu, 27 Jan 2022 20:03:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343784AbiA0UDk (ORCPT ); Thu, 27 Jan 2022 15:03:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343767AbiA0UCY (ORCPT ); Thu, 27 Jan 2022 15:02:24 -0500 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E442C061763 for ; Thu, 27 Jan 2022 12:02:21 -0800 (PST) Received: by mail-pl1-x631.google.com with SMTP id j16so3704467plx.4 for ; Thu, 27 Jan 2022 12:02:21 -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=IW/8Y9aTwhLOwEb2xP1btnAgZlqJiVoA25E4MQ0ztlM=; b=Orc/8SO3R+dEVDvMgPCjrMtDqLFJ0Q6HS0V1upmPpUW4kXr9C4iejmRDOGbRV9iW4j k9loF01QGaULZ1/ixZXpaAmhKNCK4M8hIxc3gWmGet47QcH0vvkYz42DwlJvJdht3Dnv tqIWTsf24/eGXmaKQV4HRtIrBwUEtqhRo9dI4= 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=IW/8Y9aTwhLOwEb2xP1btnAgZlqJiVoA25E4MQ0ztlM=; b=QeubNZ8hNZbqSxxmPUllkCKOsFnV7fk5mGwq2NS/WiTym/KM0sA1zwTdcGhXkN0I6Y drRDpW5TrUGa3R+NQdjb63BHOQpoj12rQCw7W/BWD+KD85uPoBzVgSrnT/1EIcNqGTff Mg1B+56PR0NMHMIC+ImqkYqXagy80NUrMGfZy4oCfn1ifgPD5HRgRr6mUdOQUcRWV7Bv gS7CcJg79JM3RYCYbwTxgseTFsQ8Sg/45aijojTEgBnWb5YKHfkaFSgnFft906Bgzv1O hGs9wkC3nbM4XB2h7gGglNXM7KrxOV6oCbCrzvOUJ+WXYJ0FfolW5+7r1IK22u8D4QYd AOyw== X-Gm-Message-State: AOAM531q0drjor5TxqYhLpvjKNcP21GJwkREZeh/FSYM30t4YgxI+3nq 19gmzP8AaXYW2Do/ur/kExWMOA== X-Google-Smtp-Source: ABdhPJwbPVI8xDeM1NWvY0IzOnQ+E4h23xnsQ0RPm+d8WXJjw8YoUnpfi1pwRQVIiRppcVlDbKUIrA== X-Received: by 2002:a17:902:da90:: with SMTP id j16mr4907623plx.101.1643313740669; Thu, 27 Jan 2022 12:02:20 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.02.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:20 -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, Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 20/35] drm/rockchip: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:26 -0800 Message-Id: <20220127200141.1295328-21-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-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 bec207de4544..6a6ed293d7a0 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -108,8 +108,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 = aggregate_device_parent(adev); struct drm_device *drm_dev; struct rockchip_drm_private *private; int ret; @@ -179,8 +180,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 = aggregate_device_parent(adev); struct drm_device *drm_dev = dev_get_drvdata(dev); drm_dev_unregister(drm_dev); @@ -331,9 +333,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) @@ -404,7 +410,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; @@ -415,7 +421,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);