Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp928289pxb; Mon, 25 Oct 2021 22:43:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBzqTQIH5PtckSjFxTHRSumFULBMm57th7Jtyk5OJWHUNaFdj8TX8jIW5ZA4i74O36fe34 X-Received: by 2002:a17:902:c214:b0:13f:1b2a:8011 with SMTP id 20-20020a170902c21400b0013f1b2a8011mr20595045pll.3.1635226984146; Mon, 25 Oct 2021 22:43:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635226984; cv=none; d=google.com; s=arc-20160816; b=ykhaNjcDifSgDfc7vS/9k7Gclj0HBM63GwSO18clNqct3fA2Gs6vT5Lc6WLHjeQnjw jvpITMqz5iJv7T6fTEoBSmWq45voYPNInYm4z0vp8CIMYhr1Va4t0SKN3HLJa3GzLLkr dAE7puTdGCkkncMCUR8Un56BEtn6rs/MQaTo/yLLEXXb80Dh/Ugua2H1Vtu4aONRZPGe g+rUoqcPYFIp9MNtLvxy3Exrt0U8eyYgMDU4J4At0gtTDigZcWhtgiE2WcvE6cwXf/R7 V07r+NlEnQUktuo/ccAT8EM1HE8PlmTXSXOasMPzGgZSVAmz/s3Mf5btUiklJTiBwasW Hikg== 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=txgUq4z88WnnvzWzs6FXSEEPpZuqTbA+AthU6UWidQU=; b=lWpiVMQQ31hSisIkE+Gh18m2XKEL1BHTBiYrfPKxvP6vQxwcZMKBdZUWfCxkbqn349 IJ7E8EFNMZYXLlNZqgUTjZAni+s/ZcwaFe9Wxe4ighWUuz27hAYDfSxBwBsCHCDnNtAi wm3ECaaeSE9KshmAD25Aq4mS8poxWJqTtZDeYEXnUB0T8LZOXfIAYZi3D8O1hjPM8L8f PQeDpJpiIb+7RVkMqNcbfvLLHxHovruZGcApM/675Mko7MiR7gkHNEDP3dGcfQDmms2H o8TFjYgMemYT+y/Xlq+61iPw+sku0rWfPKfPtk3JsqFoilxgedZ4xhVsVxZY9SMNKXDs h6pQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=A9uYcNC3; 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 z15si27107529pgu.404.2021.10.25.22.42.51; Mon, 25 Oct 2021 22:43:04 -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=A9uYcNC3; 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 S235788AbhJZADp (ORCPT + 99 others); Mon, 25 Oct 2021 20:03:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235531AbhJZADR (ORCPT ); Mon, 25 Oct 2021 20:03:17 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E4DEC061229 for ; Mon, 25 Oct 2021 17:00:52 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id f5so12251536pgc.12 for ; Mon, 25 Oct 2021 17:00:52 -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=txgUq4z88WnnvzWzs6FXSEEPpZuqTbA+AthU6UWidQU=; b=A9uYcNC3Y2SU5Menz6F1KUEbpXNwN+ud/4zeGvxXq2DS/2o+S7j2n3UCd54VrkmHXF XqOH8ZN1RGNjIq1ab1TKFRoPuzucoAv8DAm0BTCfb+kArLqN3+wU2rLBg3w1evkDD2CY RE5RL05zWPiNBeirxolfz7HVdHkmm3pdI5rwY= 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=txgUq4z88WnnvzWzs6FXSEEPpZuqTbA+AthU6UWidQU=; b=oXadjka06PnhjW/PAxY1FzZXmX96TkZezKN2lmZj3vmLQ9Jo1e+fayOwoe0vj8gWXD hk2XbRKiVUbBqqBZwRldrGARQDAoP5SZK5uyF0FVfLm/8ZC+feQTpsNvD99/Z5jMjNWb M2Yrg/RIYQBqaoVGMzjbRTpQLQAJtjLIfQXzf+XxaP6j06rmm7PzB6pRFgmgP4p2RTBA nLnldkWzHPXorwlQpkn1ePZSGS/B54eF7VdHzgiC40UAwSvdUFrmngXwxXB6JcyPlx1X nDJiBPwG5QIx0nmn11KDjGL1tRVKWScBt4hIc8V0A3bP9e4w7G1+4eUw63IlyFgDXN6M 7dZA== X-Gm-Message-State: AOAM533siORGlUNWGDIaTYseEjEUaRvC1FtW7ulUAKjMB5VnZvEyTDDr 8TfGsovJwKmCZWXoJWaYmkgkQ79gUPQ= X-Received: by 2002:a62:188c:0:b0:44d:6660:212b with SMTP id 134-20020a62188c000000b0044d6660212bmr21989004pfy.8.1635206451988; Mon, 25 Oct 2021 17:00:51 -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.00.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Oct 2021 17:00:51 -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, Laurent Pinchart , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v3 06/34] drm/of: Add a drm_of_aggregate_probe() API Date: Mon, 25 Oct 2021 17:00:16 -0700 Message-Id: <20211026000044.885195-7-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 Similar to drm_of_component_probe() but using the new API that registers a driver instead of an ops struct. This allows us to migrate the users of drm_of_component_probe() to the new way of doing things. Cc: Laurent Pinchart Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/gpu/drm/drm_of.c | 85 +++++++++++++++++++++++++++++++--------- include/drm/drm_of.h | 12 ++++++ 2 files changed, 78 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index 997b8827fed2..dc4b507c809d 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -99,30 +99,18 @@ void drm_of_component_match_add(struct device *master, } EXPORT_SYMBOL_GPL(drm_of_component_match_add); -/** - * drm_of_component_probe - Generic probe function for a component based master - * @dev: master device containing the OF node - * @compare_of: compare function used for matching components - * @m_ops: component master ops to be used - * - * Parse the platform device OF node and bind all the components associated - * with the master. Interface ports are added before the encoders in order to - * satisfy their .bind requirements - * See Documentation/devicetree/bindings/graph.txt for the bindings. - * - * Returns zero if successful, or one of the standard error codes if it fails. - */ -int drm_of_component_probe(struct device *dev, +static int _drm_of_component_probe(struct device *dev, int (*compare_of)(struct device *, void *), - const struct component_master_ops *m_ops) + struct component_match **matchptr) { struct device_node *ep, *port, *remote; - struct component_match *match = NULL; int i; if (!dev->of_node) return -EINVAL; + *matchptr = NULL; + /* * Bind the crtc's ports first, so that drm_of_find_possible_crtcs() * called from encoder's .bind callbacks works as expected @@ -133,7 +121,7 @@ int drm_of_component_probe(struct device *dev, break; if (of_device_is_available(port->parent)) - drm_of_component_match_add(dev, &match, compare_of, + drm_of_component_match_add(dev, matchptr, compare_of, port); of_node_put(port); @@ -144,7 +132,7 @@ int drm_of_component_probe(struct device *dev, return -ENODEV; } - if (!match) { + if (!*matchptr) { dev_err(dev, "no available port\n"); return -ENODEV; } @@ -174,17 +162,76 @@ int drm_of_component_probe(struct device *dev, continue; } - drm_of_component_match_add(dev, &match, compare_of, + drm_of_component_match_add(dev, matchptr, compare_of, remote); of_node_put(remote); } of_node_put(port); } + return 0; +} + +/** + * drm_of_component_probe - Generic probe function for a component based master + * @dev: master device containing the OF node + * @compare_of: compare function used for matching components + * @m_ops: component master ops to be used + * + * Parse the platform device OF node and bind all the components associated + * with the master. Interface ports are added before the encoders in order to + * satisfy their .bind requirements + * See Documentation/devicetree/bindings/graph.txt for the bindings. + * + * Deprecated: Use drm_of_aggregate_probe() instead. + * + * Returns zero if successful, or one of the standard error codes if it fails. + */ +int drm_of_component_probe(struct device *dev, + int (*compare_of)(struct device *, void *), + const struct component_master_ops *m_ops) +{ + + struct component_match *match; + int ret; + + ret = _drm_of_component_probe(dev, compare_of, &match); + if (ret) + return ret; + return component_master_add_with_match(dev, m_ops, match); } EXPORT_SYMBOL(drm_of_component_probe); + +/** + * drm_of_aggregate_probe - Generic probe function for a component based aggregate host + * @dev: device containing the OF node + * @compare_of: compare function used for matching components + * @adrv: aggregate driver to be used + * + * Parse the platform device OF node and bind all the components associated + * with the aggregate device. Interface ports are added before the encoders in + * order to satisfy their .bind_component requirements + * See Documentation/devicetree/bindings/graph.txt for the bindings. + * + * Returns zero if successful, or one of the standard error codes if it fails. + */ +int drm_of_aggregate_probe(struct device *dev, + int (*compare_of)(struct device *, void *), + struct aggregate_driver *adrv) +{ + struct component_match *match; + int ret; + + ret = _drm_of_component_probe(dev, compare_of, &match); + if (ret) + return ret; + + return component_aggregate_register(dev, adrv, match); +} +EXPORT_SYMBOL(drm_of_aggregate_probe); + /* * drm_of_encoder_active_endpoint - return the active encoder endpoint * @node: device tree node containing encoder input ports diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h index b9b093add92e..9d35a141f888 100644 --- a/include/drm/drm_of.h +++ b/include/drm/drm_of.h @@ -7,6 +7,7 @@ #include #endif +struct aggregate_driver; struct component_master_ops; struct component_match; struct device; @@ -40,6 +41,9 @@ void drm_of_component_match_add(struct device *master, int drm_of_component_probe(struct device *dev, int (*compare_of)(struct device *, void *), const struct component_master_ops *m_ops); +int drm_of_aggregate_probe(struct device *dev, + int (*compare_of)(struct device *, void *), + struct aggregate_driver *adrv); int drm_of_encoder_active_endpoint(struct device_node *node, struct drm_encoder *encoder, struct of_endpoint *endpoint); @@ -78,6 +82,14 @@ drm_of_component_probe(struct device *dev, return -EINVAL; } +static inline int +drm_of_aggregate_probe(struct device *dev, + int (*compare_of)(struct device *, void *), + struct aggregate_driver *adrv) +{ + return -EINVAL; +} + static inline int drm_of_encoder_active_endpoint(struct device_node *node, struct drm_encoder *encoder, struct of_endpoint *endpoint) -- https://chromeos.dev