Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp849995pxb; Mon, 25 Oct 2021 20:33:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx949LAmBw6PGNbSWWXONFjfnectrH6osWedSdA25tF1p8fX9Vr+Xa80qm/ZoYm4PZcktDN X-Received: by 2002:a05:6402:643:: with SMTP id u3mr32292039edx.164.1635219198604; Mon, 25 Oct 2021 20:33:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635219198; cv=none; d=google.com; s=arc-20160816; b=xHmfgdRshtdvSBQX+erwGJUcxLybcg1F3pKTLwut7x1Yu39xjftiCBXwuT4bVg/mdU 16o0yXVrNNbY9S5Q1DbrWUy/ghti+rSENqmRL87c8JC5RxnPUuvFygJWzlP9AKTjvYFy Rc5tS0eH667ghrlkntTlYibiuddF4ATf4MTnI6h4EmNjVOJJQdFz6ROBRGmRDeQzax4c +zImbiFLje3zGkayhXrN7UkWDJX2YFT1r+RQLl+hpiGxY1ksgdS89KJne5hPHNzX59IJ aCkGURGssk2hvXEJsuFwnxKpuGnpmiwBUKgXC9+ae27VyA2/c6HiB9WDB8E8L3neoFTN LrJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=SfmZAoSN1UYJWac68o+RmufoyphUhdu5prdrSebp+yc=; b=BGjIvYAis8Ys8bkjASUdGzmOg+PXZVCd4T1W7LkN+RRIywnJ7wuomHCopETkUsa5xs YO1btb/+/nE9cnI2sYjaXzZfMNwLmMvcMI9E2AmAeKwZE2zn4wAsJwifZ+LN6iqFuCiD FM05dgvmIdkL/qFI9SyAU4BhCsLDsKDqLMB+wju6wDHjogGJMVryt0t++Wu/fYdvXkWS Hhjx9t5gh8Gjs8VAqfIzPVdujVKs1D2WH5il/XyMK1VINZr9fUgdds3nlMydWy0V8M0v wLsR9tJvRYlAKRGYbCU8NLHmdDjT2Nf41oyf5epLMI07y6N4KVsjKswmeWNnJPbUmAYo m35A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Mpvt6TZq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gg1si7536088ejc.409.2021.10.25.20.32.55; Mon, 25 Oct 2021 20:33:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Mpvt6TZq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236156AbhJZAEb (ORCPT + 99 others); Mon, 25 Oct 2021 20:04:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235693AbhJZAD0 (ORCPT ); Mon, 25 Oct 2021 20:03:26 -0400 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DCC8C061243 for ; Mon, 25 Oct 2021 17:01:02 -0700 (PDT) Received: by mail-pg1-x52d.google.com with SMTP id f5so12251954pgc.12 for ; Mon, 25 Oct 2021 17:01:02 -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=SfmZAoSN1UYJWac68o+RmufoyphUhdu5prdrSebp+yc=; b=Mpvt6TZqBJRjjpQueNxpmUOJ/CuHCPf3g57W5nKE4F6VDMbDyu4dhn3uzf/zJu2HoD HYPHTESFuoQPQ/vTZtliG3cDTOHLv5VXBkOcN/ec5j8HsNjVn8ADoZeIsVujQHf9TFT3 VPxGTWoSrkHT8HeS1x5yN8nsoANr0l+Gcp1iQ= 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=SfmZAoSN1UYJWac68o+RmufoyphUhdu5prdrSebp+yc=; b=6G8WPRR58LmODTVYZG5yhFDPyAdLIlcyWg9/J/JlrHDySGoFLNiYgd9Wu2nXTtfWb8 /X4TvM2QEjCVCrJZUSKjrM347GGOR1B8RJIP5Tk+D3Te0OIfkQ7/y5ON0OJ4M4k6utqX Pd4XmdRZm43tcsedMQ7vdrxE9Kvu8AgiMyuE+wTXXUYCXP02NITowb04AYw5IWSrRelC +bYI1yP1h0t1sRiR/K+WfRNJ7qebZaZ2ZXG0zavo7wAtv/uDT+VReQL2sqMJehD2vv32 GGeh8m1pLzc6+QMuTUhYKa52jKnazLqZdCrs5lw/4jrOjOw7SWyVAWs/I2v60VNQnN4k 2d1A== X-Gm-Message-State: AOAM531Pl1FkIpQZnDQkItE8v5AuRc9WXLWz28gZ4V1PrcjkBa9oSwKB fEMmZSvstb51hXgfi+GZ/2o4Ng== X-Received: by 2002:aa7:8c0d:0:b0:47b:dc76:38c1 with SMTP id c13-20020aa78c0d000000b0047bdc7638c1mr16798377pfd.22.1635206462140; Mon, 25 Oct 2021 17:01:02 -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.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Oct 2021 17:01:01 -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, Chun-Kuang Hu , Philipp Zabel , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v3 18/34] drm/mediatek: Migrate to aggregate driver Date: Mon, 25 Oct 2021 17:00:28 -0700 Message-Id: <20211026000044.885195-19-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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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: Chun-Kuang Hu 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/mediatek/mtk_drm_drv.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c index aec39724ebeb..a3f27b8c9769 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -348,8 +348,9 @@ static int compare_of(struct device *dev, void *data) return dev->of_node == data; } -static int mtk_drm_bind(struct device *dev) +static int mtk_drm_bind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct mtk_drm_private *private = dev_get_drvdata(dev); struct drm_device *drm; int ret; @@ -380,8 +381,9 @@ static int mtk_drm_bind(struct device *dev) return ret; } -static void mtk_drm_unbind(struct device *dev) +static void mtk_drm_unbind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct mtk_drm_private *private = dev_get_drvdata(dev); drm_dev_unregister(private->drm); @@ -391,9 +393,13 @@ static void mtk_drm_unbind(struct device *dev) private->drm = NULL; } -static const struct component_master_ops mtk_drm_ops = { - .bind = mtk_drm_bind, - .unbind = mtk_drm_unbind, +static struct aggregate_driver mtk_drm_aggregate_driver = { + .probe = mtk_drm_bind, + .remove = mtk_drm_unbind, + .driver = { + .name = "mtk_drm", + .owner = THIS_MODULE, + }, }; static const struct of_device_id mtk_ddp_comp_dt_ids[] = { @@ -593,7 +599,7 @@ static int mtk_drm_probe(struct platform_device *pdev) platform_set_drvdata(pdev, private); - ret = component_master_add_with_match(dev, &mtk_drm_ops, match); + ret = component_aggregate_register(dev, &mtk_drm_aggregate_driver, match); if (ret) goto err_pm; @@ -616,7 +622,7 @@ static int mtk_drm_remove(struct platform_device *pdev) struct mtk_drm_private *private = platform_get_drvdata(pdev); int i; - component_master_del(&pdev->dev, &mtk_drm_ops); + component_aggregate_unregister(&pdev->dev, &mtk_drm_aggregate_driver); pm_runtime_disable(&pdev->dev); of_node_put(private->mutex_node); for (i = 0; i < DDP_COMPONENT_ID_MAX; i++) -- https://chromeos.dev