From patchwork Tue Jul 20 13:45:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12388321 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D2D0C636C8 for ; Tue, 20 Jul 2021 13:45:41 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F17C161164 for ; Tue, 20 Jul 2021 13:45:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F17C161164 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cerno.tech Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 73A5989E19; Tue, 20 Jul 2021 13:45:40 +0000 (UTC) Received: from wnew3-smtp.messagingengine.com (wnew3-smtp.messagingengine.com [64.147.123.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4ECE589EA3 for ; Tue, 20 Jul 2021 13:45:37 +0000 (UTC) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.west.internal (Postfix) with ESMTP id 182F22B01189; Tue, 20 Jul 2021 09:45:36 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 20 Jul 2021 09:45:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=s1/AGqxR15g+h Pk2op+DrdT6xO3KSQkr55JaRssrGcY=; b=EbC4yCxjXxo6DS/vKoYyfM/ORjISk uu1uLEFJgthMaHxG/pUXxz+5mWDCMlFnLNDbC5VFYOv7D5niZCh+Blu6JnC2mwFj lxMJkHlSzAWeFT0JI95aLwSQy5SwTBUy+RtzQGLoRt1K+J+H7P7GcsY13taMNbfP mf6gq2TYoS6EyjKnZgzwUGDkwx3UGDnAKVS/isoD/wWRxGSLQ97iJeCpoBH57Oa0 HK3CJkBQ3fAFlpH5rlvld/be4BSiZeTfLH1ahn08TaRrQjHkd+mU6a5/OqrcRelP U401+gqmX2ThdL0BwXMitE9zAEuIqOoHs4L7lQqmxmoy5qT9sjRF8eZFQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=s1/AGqxR15g+hPk2op+DrdT6xO3KSQkr55JaRssrGcY=; b=Iq0S8KeP N1NUOw1XSE+kw9ebJzm8UXOa4J8Vae2JAldVuBioqFD0D7kaSYjSwLUAsXDx/V6S Vojze0ZW4HXvy0hhOSWUFQMUhU/WuT336lfIFbLrqlJSwr0pS2QFx/L7UOL9bvyy JHPZYUuyy6Nl7LKxXJ7YtILMtgC7zJ4qmSZiq/iCdk9rC/N7lwSxchfz83OmxwNk nxR2EFtXLg1Sogwb2PBdDTEbRfF70IhvszqX75nGiUKmcJPVZFX+fMexGIDOYOC0 DDFmMLR3Fl5fpK4v5piGb3E+MbVwJ+8VwXYX0uAcfOSQ+4A9efyTO+twCDP0dYft pnTVjynvzGbhgA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrfedvgdeikecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrgihimhgv ucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrghtth gvrhhnpedvkeelveefffekjefhffeuleetleefudeifeehuddugffghffhffehveevheeh vdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrg igihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 20 Jul 2021 09:45:34 -0400 (EDT) From: Maxime Ripard To: Robert Foss , Andrzej Hajda , Daniel Vetter , David Airlie , Sam Ravnborg , Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard , Neil Armstrong , Jonas Karlman , Jernej Skrabec , Thierry Reding , Laurent Pinchart Subject: [PATCH 01/10] Revert "drm/vc4: dsi: Only register our component once a DSI device is attached" Date: Tue, 20 Jul 2021 15:45:16 +0200 Message-Id: <20210720134525.563936-2-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210720134525.563936-1-maxime@cerno.tech> References: <20210720134525.563936-1-maxime@cerno.tech> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This reverts commit 7213246a803f9b8da0677adb9ae06a3d8b806d02. The commit 7213246a803f ("drm/vc4: dsi: Only register our component once a DSI device is attached") aimed at preventing an endless probe loop between the DSI host driver and its panel/bridge where both would wait for each other to probe. The solution implemented in that commit however relies on the fact that MIPI-DSI device will either be a MIPI-DSI device, or would call mipi_dsi_device_register_full() at probe time. This assumption isn't true for bridges though where most drivers will do so in the bridge attach hook. However, the drm_bridge_attach is usually called in the DSI host bind hook, and thus we never get this far, resulting in a DSI bridge that will never have its attach run, and the DSI host that will never be bound, effectively creating the same situation we were trying to avoid for panels. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_dsi.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c index a55256ed0955..6dfcbd9e234e 100644 --- a/drivers/gpu/drm/vc4/vc4_dsi.c +++ b/drivers/gpu/drm/vc4/vc4_dsi.c @@ -1257,12 +1257,10 @@ static ssize_t vc4_dsi_host_transfer(struct mipi_dsi_host *host, return ret; } -static const struct component_ops vc4_dsi_ops; static int vc4_dsi_host_attach(struct mipi_dsi_host *host, struct mipi_dsi_device *device) { struct vc4_dsi *dsi = host_to_dsi(host); - int ret; dsi->lanes = device->lanes; dsi->channel = device->channel; @@ -1297,12 +1295,6 @@ static int vc4_dsi_host_attach(struct mipi_dsi_host *host, return 0; } - ret = component_add(&dsi->pdev->dev, &vc4_dsi_ops); - if (ret) { - mipi_dsi_host_unregister(&dsi->dsi_host); - return ret; - } - return 0; } @@ -1689,6 +1681,7 @@ static int vc4_dsi_dev_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct vc4_dsi *dsi; + int ret; dsi = devm_kzalloc(dev, sizeof(*dsi), GFP_KERNEL); if (!dsi) @@ -1696,10 +1689,26 @@ static int vc4_dsi_dev_probe(struct platform_device *pdev) dev_set_drvdata(dev, dsi); dsi->pdev = pdev; + + /* Note, the initialization sequence for DSI and panels is + * tricky. The component bind above won't get past its + * -EPROBE_DEFER until the panel/bridge probes. The + * panel/bridge will return -EPROBE_DEFER until it has a + * mipi_dsi_host to register its device to. So, we register + * the host during pdev probe time, so vc4 as a whole can then + * -EPROBE_DEFER its component bind process until the panel + * successfully attaches. + */ dsi->dsi_host.ops = &vc4_dsi_host_ops; dsi->dsi_host.dev = dev; mipi_dsi_host_register(&dsi->dsi_host); + ret = component_add(&pdev->dev, &vc4_dsi_ops); + if (ret) { + mipi_dsi_host_unregister(&dsi->dsi_host); + return ret; + } + return 0; } From patchwork Tue Jul 20 13:45:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12388323 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4117C07E9B for ; Tue, 20 Jul 2021 13:45:44 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5B18D610D2 for ; Tue, 20 Jul 2021 13:45:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5B18D610D2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cerno.tech Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CD82B89EA3; Tue, 20 Jul 2021 13:45:43 +0000 (UTC) Received: from wnew3-smtp.messagingengine.com (wnew3-smtp.messagingengine.com [64.147.123.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id DEDA86E1BA for ; Tue, 20 Jul 2021 13:45:40 +0000 (UTC) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.west.internal (Postfix) with ESMTP id A5FA92B0118B; Tue, 20 Jul 2021 09:45:39 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 20 Jul 2021 09:45:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=Y1PGxBBc2x1J5 /4e1hDAV1v6mDbdZRmgKeM9hilyyuE=; b=wbcmb/3lQqv9llefCApdMTLmEVEac eplPXEqsvE5mqYZG5iNoN41/PKonGuhMiC2zwUDCYHwUeovcX6QGdXVZ3ehn02PJ tgHSOc1kvQ4Ea/uD/HMym3gmT07m27/Z7WSvjGdohEFJuyYbjl2CsUtYZCsDCRWf X1c+SochqnXC4j6nkzfnyytfgAF24tgIzhyJyZVuKA2gIv9y2aH6/TV+IxkIWB0j FPfJEHMeVJ1pUCtntcV9KmYmu1ilOslIFsI+2tc+/7E6NiS9Rzt1fZrRXm8HZMMX rFTeMjqj0TVoqTHR1i4SFaLRj/8Vtw6zL0gL7Ir6H4GhSA3OQcxO5p0Yg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=Y1PGxBBc2x1J5/4e1hDAV1v6mDbdZRmgKeM9hilyyuE=; b=sihLDEp2 BlzCMoObJDmOnuI74E+PLEHjYc50k5PmTTgJq3zk6TV9EmtYHjL++FyFmKX5B77F cSdrSJmSpz2kWZX5q0TJ8/i065sUuTCW2CwDUKxvIBm5JFg33Nxl5gV7ZXhNgPYr OMtB78f3eYG9ARoM5ZyJs2/eNjTfv+WayDwpVVBSRO5DYsKzDlKsIDR8LE21ALrq 73uiHuLLBzfOud5MugApAqsrszy63QDiXVBu8oXMwAJl4n5uuWNcjyItLgel5Dyn CXONh4RtLsg664S60UU06jnlEOz/MB9BWKqZcTH0A8a9vwmAfiy49qeq9mC71Ibz Atef4HOgopTesw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrfedvgdeikecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrgihimhgv ucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrghtth gvrhhnpedvkeelveefffekjefhffeuleetleefudeifeehuddugffghffhffehveevheeh vdenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrg igihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 20 Jul 2021 09:45:38 -0400 (EDT) From: Maxime Ripard To: Robert Foss , Andrzej Hajda , Daniel Vetter , David Airlie , Sam Ravnborg , Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard , Neil Armstrong , Jonas Karlman , Jernej Skrabec , Thierry Reding , Laurent Pinchart Subject: [PATCH 02/10] drm/bridge: Add a function to abstract away panels Date: Tue, 20 Jul 2021 15:45:17 +0200 Message-Id: <20210720134525.563936-3-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210720134525.563936-1-maxime@cerno.tech> References: <20210720134525.563936-1-maxime@cerno.tech> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Display drivers so far need to have a lot of boilerplate to first retrieve either the panel or bridge that they are connected to using drm_of_find_panel_or_bridge(), and then either deal with each with ad-hoc functions or create a drm panel bridge through drm_panel_bridge_add. In order to reduce the boilerplate and hopefully create a path of least resistance towards using the DRM panel bridge layer, let's create the function devm_drm_of_get_next to reduce that boilerplate. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/drm_bridge.c | 62 +++++++++++++++++++++++++++++++++--- drivers/gpu/drm/drm_of.c | 3 ++ include/drm/drm_bridge.h | 2 ++ 3 files changed, 63 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index 044acd07c153..aef8c9f4fb9f 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -24,10 +24,12 @@ #include #include #include +#include #include #include #include +#include #include "drm_crtc_internal.h" @@ -50,10 +52,8 @@ * * Display drivers are responsible for linking encoders with the first bridge * in the chains. This is done by acquiring the appropriate bridge with - * of_drm_find_bridge() or drm_of_find_panel_or_bridge(), or creating it for a - * panel with drm_panel_bridge_add_typed() (or the managed version - * devm_drm_panel_bridge_add_typed()). Once acquired, the bridge shall be - * attached to the encoder with a call to drm_bridge_attach(). + * drm_of_get_next(). Once acquired, the bridge shall be attached to the + * encoder with a call to drm_bridge_attach(). * * Bridges are responsible for linking themselves with the next bridge in the * chain, if any. This is done the same way as for encoders, with the call to @@ -1223,6 +1223,60 @@ struct drm_bridge *of_drm_find_bridge(struct device_node *np) return NULL; } EXPORT_SYMBOL(of_drm_find_bridge); + +/** + * devm_drm_of_get_next - Return next bridge in the chain + * @dev: device to tie the bridge lifetime to + * @np: device tree node containing encoder output ports + * @port: port in the device tree node + * @endpoint: endpoint in the device tree node + * + * Given a DT node's port and endpoint number, finds the connected node + * and returns the associated bridge if any, or creates and returns a + * drm panel bridge instance if a panel is connected. + * + * Returns a pointer to the bridge if successful, or an error pointer + * otherwise. + */ +struct drm_bridge *devm_drm_of_get_next(struct device *dev, + struct device_node *np, + unsigned int port, + unsigned int endpoint) +{ + struct device_node *remote; + struct drm_bridge *bridge; + struct drm_panel *panel; + + /* + * of_graph_get_remote_node() produces a noisy error message if port + * node isn't found and the absence of the port is a legit case here, + * so at first we silently check whether graph presents in the + * device-tree node. + */ + if (!of_graph_is_present(np)) + return ERR_PTR(-ENODEV); + + remote = of_graph_get_remote_node(np, port, endpoint); + if (!remote) + return ERR_PTR(-ENODEV); + + bridge = of_drm_find_bridge(remote); + if (bridge) { + of_node_put(remote); + return bridge; + } + + panel = of_drm_find_panel(remote); + if (IS_ERR(panel)) { + of_node_put(remote); + return ERR_CAST(panel); + } + + of_node_put(remote); + + return devm_drm_panel_bridge_add(dev, panel); +} +EXPORT_SYMBOL(devm_drm_of_get_next); #endif MODULE_AUTHOR("Ajay Kumar "); diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index 997b8827fed2..bbbdc4d17ac9 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -231,6 +231,9 @@ EXPORT_SYMBOL_GPL(drm_of_encoder_active_endpoint); * return either the associated struct drm_panel or drm_bridge device. Either * @panel or @bridge must not be NULL. * + * This function is deprecated and should not be used in new drivers. Use + * drm_of_get_next() instead. + * * Returns zero if successful, or one of the standard error codes if it fails. */ int drm_of_find_panel_or_bridge(const struct device_node *np, diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index 46bdfa48c413..e16fafc6f37d 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -911,6 +911,8 @@ struct drm_bridge *devm_drm_panel_bridge_add(struct device *dev, struct drm_bridge *devm_drm_panel_bridge_add_typed(struct device *dev, struct drm_panel *panel, u32 connector_type); +struct drm_bridge *devm_drm_of_get_next(struct device *dev, struct device_node *node, + unsigned int port, unsigned int endpoint); struct drm_connector *drm_panel_bridge_connector(struct drm_bridge *bridge); #endif From patchwork Tue Jul 20 13:45:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12388325 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A02DC07E9B for ; Tue, 20 Jul 2021 13:45:48 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A0819610D2 for ; Tue, 20 Jul 2021 13:45:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A0819610D2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cerno.tech Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 16AB36E1BA; Tue, 20 Jul 2021 13:45:47 +0000 (UTC) Received: from wnew3-smtp.messagingengine.com (wnew3-smtp.messagingengine.com [64.147.123.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 27F226E314 for ; Tue, 20 Jul 2021 13:45:45 +0000 (UTC) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.west.internal (Postfix) with ESMTP id EBCF22B01187; Tue, 20 Jul 2021 09:45:43 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Tue, 20 Jul 2021 09:45:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=BlLF334688PDi p4UlmyHDphu5KOpwIjt5VbcUSY2TZ0=; b=vOoefpxZalgZMMClcnkMFXTxr5EG7 NCg8hC3Hkh8ArQ0hHT/6izNim6LRzxvZAdBMZSCyVeXD5hUOS7665e/UFL2aG+vJ Sd4RQdNqBOYLHiIGKIxu85d0CqEtAOcoecHUULTKYvkQSjWVbktquq9qeSQhEYrA uNgKjqUKet5grp7MMVV0pWMpXDy3y1mQ+54+l8BkXbPbgg2ZQjG06qao1ypDiyQ2 trOrSaAUiz/GVcJLxTdQ5Lgo96YYKGmXcJltSY4dLVHBZqnVuYG5leiNVDXcr4p6 LurkvQ5N8SLD//KmdQ2gZBuE0s6YCfTaDshaoqxFVqa7/8VDVFIXw++zw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=BlLF334688PDip4UlmyHDphu5KOpwIjt5VbcUSY2TZ0=; b=EeTc99I5 jACW/T7jxsf3/LxIBj9YK834D9MXiVLZwkBzT4vqyryQ/DbA7UPQd4HOFODxGROU nLqhR1Eu7C5gCBI6BLqRAghJ397HlV0xGLUq9rCCsqPy19+/s2c5TjVCpW0eCXBv fqgU5leV9X0NpVscTyjBDvbhuFis7IyUY4pRP8Obzl+gLKc1brq3kCj2FqpbTLg8 J5gN4IP2Nw90i0Byl95fl9LoG9XCMlEU4Kcy2Xv/utfbo/IeLgRdiuhEbte+kjCy 1KnVKvqEu9avx9wSSJKi8Lq9JtW9Efz+q2rN67gFAJ6Wm9rYlKIWN2HrH6XW7KH/ 9Ec1dgpVccRKGQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrfedvgdeikecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrgihimhgv ucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrghtth gvrhhnpedvkeelveefffekjefhffeuleetleefudeifeehuddugffghffhffehveevheeh vdenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrg igihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 20 Jul 2021 09:45:43 -0400 (EDT) From: Maxime Ripard To: Robert Foss , Andrzej Hajda , Daniel Vetter , David Airlie , Sam Ravnborg , Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard , Neil Armstrong , Jonas Karlman , Jernej Skrabec , Thierry Reding , Laurent Pinchart Subject: [PATCH 03/10] drm/bridge: Add documentation sections Date: Tue, 20 Jul 2021 15:45:18 +0200 Message-Id: <20210720134525.563936-4-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210720134525.563936-1-maxime@cerno.tech> References: <20210720134525.563936-1-maxime@cerno.tech> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The bridge documentation overview is quite packed already, and we'll add some more documentation that isn't part of an overview at all. Let's add some sections to the documentation to separare each bits. Signed-off-by: Maxime Ripard Reviewed-by: Sam Ravnborg --- Documentation/gpu/drm-kms-helpers.rst | 6 ++++++ drivers/gpu/drm/drm_bridge.c | 14 +++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Documentation/gpu/drm-kms-helpers.rst b/Documentation/gpu/drm-kms-helpers.rst index 389892f36185..10f8df7aecc0 100644 --- a/Documentation/gpu/drm-kms-helpers.rst +++ b/Documentation/gpu/drm-kms-helpers.rst @@ -151,6 +151,12 @@ Overview .. kernel-doc:: drivers/gpu/drm/drm_bridge.c :doc: overview +Display Driver Integration +-------------------------- + +.. kernel-doc:: drivers/gpu/drm/drm_bridge.c + :doc: display driver integration + Bridge Operations ----------------- diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index aef8c9f4fb9f..c9a950bfdfe5 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -50,6 +50,15 @@ * Chaining multiple bridges to the output of a bridge, or the same bridge to * the output of different bridges, is not supported. * + * &drm_bridge, like &drm_panel, aren't &drm_mode_object entities like planes, + * CRTCs, encoders or connectors and hence are not visible to userspace. They + * just provide additional hooks to get the desired output at the end of the + * encoder chain. + */ + +/** + * DOC: display driver integration + * * Display drivers are responsible for linking encoders with the first bridge * in the chains. This is done by acquiring the appropriate bridge with * drm_of_get_next(). Once acquired, the bridge shall be attached to the @@ -84,11 +93,6 @@ * helper to create the &drm_connector, or implement it manually on top of the * connector-related operations exposed by the bridge (see the overview * documentation of bridge operations for more details). - * - * &drm_bridge, like &drm_panel, aren't &drm_mode_object entities like planes, - * CRTCs, encoders or connectors and hence are not visible to userspace. They - * just provide additional hooks to get the desired output at the end of the - * encoder chain. */ static DEFINE_MUTEX(bridge_lock); From patchwork Tue Jul 20 13:45:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12388327 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7566BC07E95 for ; Tue, 20 Jul 2021 13:45:52 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4407A61164 for ; Tue, 20 Jul 2021 13:45:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4407A61164 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cerno.tech Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CA05A6E30F; Tue, 20 Jul 2021 13:45:51 +0000 (UTC) Received: from wnew3-smtp.messagingengine.com (wnew3-smtp.messagingengine.com [64.147.123.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 675436E30F for ; Tue, 20 Jul 2021 13:45:50 +0000 (UTC) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id 338272B01189; Tue, 20 Jul 2021 09:45:49 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Tue, 20 Jul 2021 09:45:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=+NaTdju2t0dD7 WUYDPfRGagnPcPZI7VtK/pJug5xl9M=; b=Xm46C04+BUYYCyce90M/0U1C8NvwE zVy0EHDEWB48oHuqh4JRg+S7LY3IOqDn3XtfwLRv88LNG3l1CSNnHNRtNE6XWmg9 vr9HJqQEOK5uYOJDMiOykCYma+uuUwfNUzt323K/LbSICv/4jEgpJbsgnRu3ivXC 0dqH5t90XLHB31S6yaPgQ285Rixm50a5ecOWSmTZPJKfEv1JTClGKRheBdBtMOxm QTfL/WQ7yHdylURuP/QddzBnjMeXztRnar27Ma/F6Sm06QwuiH6Zks0PZ4QpxSGs IqEDbBBjQR46v6qbevISR0aRN4S/sbUYJBY/kuFmeoMRNhfn273XvQqNw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=+NaTdju2t0dD7WUYDPfRGagnPcPZI7VtK/pJug5xl9M=; b=YLGz+ta/ s69237/770+28VoEKQMbVXJa+zpsroZAOs1HN88fqdjbSIXDPqM4Wv1/Z6BwmSaD Ls1DSjfK63FFRTOePqMJSRjU/QKlhAfq1ExMDs+UCgpbzDxTyl2WuF5/Anu81Ekq i5DVn7WM/pCEYQsCBkzVswVlvEUHFc3agsgf+a65cXA4+bTNMzB2IQ/Phr2RsJLZ pMh3o0l3sWcU3Iiv8utrRwNaO0C3wT1vLE2lEhNw+BGBcZu8+/JSjkF0+nXr9FIX lZ96iweWJ2Jd4Sm7vQhcUDtqwwPW5Dyh/PqJ9a8UHZdp8monb2ZQsV6CD5F0qcQZ /wglXPqsIGtOVA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrfedvgdeikecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrgihimhgv ucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrghtth gvrhhnpedvkeelveefffekjefhffeuleetleefudeifeehuddugffghffhffehveevheeh vdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrg igihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 20 Jul 2021 09:45:46 -0400 (EDT) From: Maxime Ripard To: Robert Foss , Andrzej Hajda , Daniel Vetter , David Airlie , Sam Ravnborg , Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard , Neil Armstrong , Jonas Karlman , Jernej Skrabec , Thierry Reding , Laurent Pinchart Subject: [PATCH 04/10] drm/bridge: Document the probe issue with MIPI-DSI bridges Date: Tue, 20 Jul 2021 15:45:19 +0200 Message-Id: <20210720134525.563936-5-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210720134525.563936-1-maxime@cerno.tech> References: <20210720134525.563936-1-maxime@cerno.tech> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Interactions between bridges, panels, MIPI-DSI host and the component framework are not trivial and can lead to probing issues when implementing a display driver. Let's document the various cases we need too consider, and the solution to support all the cases. Signed-off-by: Maxime Ripard --- Documentation/gpu/drm-kms-helpers.rst | 6 +++ drivers/gpu/drm/drm_bridge.c | 60 +++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/Documentation/gpu/drm-kms-helpers.rst b/Documentation/gpu/drm-kms-helpers.rst index 10f8df7aecc0..ec2f65b31930 100644 --- a/Documentation/gpu/drm-kms-helpers.rst +++ b/Documentation/gpu/drm-kms-helpers.rst @@ -157,6 +157,12 @@ Display Driver Integration .. kernel-doc:: drivers/gpu/drm/drm_bridge.c :doc: display driver integration +Special Care with MIPI-DSI bridges +---------------------------------- + +.. kernel-doc:: drivers/gpu/drm/drm_bridge.c + :doc: special care dsi + Bridge Operations ----------------- diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index c9a950bfdfe5..81f8dac12367 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -95,6 +95,66 @@ * documentation of bridge operations for more details). */ +/** + * DOC: special care dsi + * + * The interaction between the bridges and other frameworks involved in + * the probing of the display driver and the bridge driver can be + * challenging. Indeed, there's multiple cases that needs to be + * considered: + * + * - The display driver doesn't use the component framework and isn't a + * MIPI-DSI host. In this case, the bridge driver will probe at some + * point and the display driver should try to probe again by returning + * EPROBE_DEFER as long as the bridge driver hasn't probed. + * + * - The display driver doesn't use the component framework, but is a + * MIPI-DSI host. The bridge device uses the MIPI-DCS commands to be + * controlled. In this case, the bridge device is a child of the + * display device and when it will probe it's assured that the display + * device (and MIPI-DSI host) is present. The display driver will be + * assured that the bridge driver is connected between the + * &mipi_dsi_host_ops.attach and &mipi_dsi_host_ops.detach operations. + * Therefore, it must run mipi_dsi_host_register() in its probe + * function, and then run drm_bridge_attach() in its + * &mipi_dsi_host_ops.attach hook. + * + * - The display driver uses the component framework and is a MIPI-DSI + * host. The bridge device uses the MIPI-DCS commands to be + * controlled. This is the same situation than above, and can run + * mipi_dsi_host_register() in either its probe or bind hooks. + * + * - The display driver uses the component framework and is a MIPI-DSI + * host. The bridge device uses a separate bus (such as I2C) to be + * controlled. In this case, there's no correlation between the probe + * of the bridge and display drivers, so care must be taken to avoid + * an endless EPROBE_DEFER loop, with each driver waiting for the + * other to probe. + * + * The ideal pattern to cover the last item (and all the others in the + * display driver case) is to split the operations like this: + * + * - In the display driver must run mipi_dsi_host_register() and + * component_add in its probe hook. It will make sure that the + * MIPI-DSI host sticks around, and that the driver's bind can be + * called. + * + * - In its probe hook, the bridge driver must not try to find its + * MIPI-DSI host or register as a MIPI-DSI device. As far as the + * framework is concerned, it must only call drm_bridge_add(). + * + * - In its bind hook, the display driver must try to find the bridge + * and return -EPROBE_DEFER if it doesn't find it. If it's there, it + * must call drm_bridge_attach(). The MIPI-DSI host is now functional. + * + * - In its &drm_bridge_funcs.attach hook, the bridge driver can now try + * to find its MIPI-DSI host and can register as a MIPI-DSI device. + * + * At this point, we're now certain that both the display driver and the + * bridge driver are functional and we can't have a deadlock-like + * situation when probing. + */ + static DEFINE_MUTEX(bridge_lock); static LIST_HEAD(bridge_list); From patchwork Tue Jul 20 13:45:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12388329 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3235AC07E95 for ; Tue, 20 Jul 2021 13:45:56 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F0AFC61164 for ; Tue, 20 Jul 2021 13:45:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F0AFC61164 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cerno.tech Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 72E386E314; Tue, 20 Jul 2021 13:45:55 +0000 (UTC) Received: from wnew3-smtp.messagingengine.com (wnew3-smtp.messagingengine.com [64.147.123.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id C57CD6E314 for ; Tue, 20 Jul 2021 13:45:53 +0000 (UTC) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.west.internal (Postfix) with ESMTP id 941872B01187; Tue, 20 Jul 2021 09:45:52 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 20 Jul 2021 09:45:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=8yAEGsFt+FTE6 Oglj0fT1zDjBqe/OTSnpQ+lXQWNmQI=; b=RxhxK2sJ9lnaAnyxBhS5odAYTWl6K RK4JFMbjDVeiLlX6B1apYmEoB2LJS1YmMxAvnh48ksfLvBmE/mH4zDr8gfx2XU6/ lKUiMk3lKHt/VgAa2OW5g0MfaGzWPobbwr7/bYdr34ZMeQmHJRw6PdBowyE5gxhC 14WrQMNAubyjsxdnIkpfyZmKvmaxASVXGkL9SLHJaPMSdpQJuZin6W4bO4EjuTdz nmp+BK2GHACwoNHCMrr0byBiXWK9OsLO0ggmSkthSyRJI5srZ0Snc1SCaHOXSHcP xsJOu5zoxLhktZspOejNrM39aQxJGsM+0M6wNq8yQFJv9ajDFvyZhSvLw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=8yAEGsFt+FTE6Oglj0fT1zDjBqe/OTSnpQ+lXQWNmQI=; b=HBkKpOXd po1yKVaQrn7c1QFp2kX8A71zvW3Id8RF2c2nfbCZ4PNXNQYv8YWK7ZtyU0DUKTzD 1XMuc0T0nLbejPpreoW4ZMkSeUNK2+i+/tcfI45zQj9iynujyasaAws5Iz7Y2Dy0 zlXP+aTtnX1uoaORIUcUmhkd49dIfoxmbROo6KZbJNKMt3VRMKhzuB6xveEz0zwV TkHZx4qs8XTtNdFHH3MTnoLSp8Z81RoEvGFICJuO2Vf08pH8PIeBIKwx1f47c8H8 57Wmv0PS6/6XWyqhOQAWAbmy8L4wvG0JKJy5svUFfoJiJYlvBA/NSLDmNQriXBYn Ol+NumLtA9dCrg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrfedvgdeikecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrgihimhgv ucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrghtth gvrhhnpedvkeelveefffekjefhffeuleetleefudeifeehuddugffghffhffehveevheeh vdenucevlhhushhtvghrufhiiigvpeefnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrg igihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 20 Jul 2021 09:45:51 -0400 (EDT) From: Maxime Ripard To: Robert Foss , Andrzej Hajda , Daniel Vetter , David Airlie , Sam Ravnborg , Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard , Neil Armstrong , Jonas Karlman , Jernej Skrabec , Thierry Reding , Laurent Pinchart Subject: [PATCH 05/10] drm/panel: Create attach and detach callbacks Date: Tue, 20 Jul 2021 15:45:20 +0200 Message-Id: <20210720134525.563936-6-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210720134525.563936-1-maxime@cerno.tech> References: <20210720134525.563936-1-maxime@cerno.tech> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" In order to make the probe order expectation more consistent between bridges, let's create attach and detach hooks for the panels as well to match what is there for bridges. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/drm_panel.c | 20 ++++++++++++++++++++ include/drm/drm_panel.h | 6 ++++++ 2 files changed, 26 insertions(+) diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c index f634371c717a..23bca798a2f3 100644 --- a/drivers/gpu/drm/drm_panel.c +++ b/drivers/gpu/drm/drm_panel.c @@ -223,6 +223,26 @@ int drm_panel_get_modes(struct drm_panel *panel, } EXPORT_SYMBOL(drm_panel_get_modes); +int drm_panel_attach(struct drm_panel *panel) +{ + if (!panel) + return -EINVAL; + + if (panel->funcs && panel->funcs->attach) + return panel->funcs->attach(panel); + + return -EOPNOTSUPP; +} + +void drm_panel_detach(struct drm_panel *panel) +{ + if (!panel) + return; + + if (panel->funcs && panel->funcs->detach) + panel->funcs->detach(panel); +} + #ifdef CONFIG_OF /** * of_drm_find_panel - look up a panel using a device tree node diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h index 4602f833eb51..b9201d520754 100644 --- a/include/drm/drm_panel.h +++ b/include/drm/drm_panel.h @@ -68,6 +68,9 @@ enum drm_panel_orientation; * does not need to implement the functionality to enable/disable backlight. */ struct drm_panel_funcs { + int (*attach)(struct drm_panel *panel); + void (*detach)(struct drm_panel *panel); + /** * @prepare: * @@ -180,6 +183,9 @@ void drm_panel_init(struct drm_panel *panel, struct device *dev, void drm_panel_add(struct drm_panel *panel); void drm_panel_remove(struct drm_panel *panel); +int drm_panel_attach(struct drm_panel *panel); +void drm_panel_detach(struct drm_panel *panel); + int drm_panel_prepare(struct drm_panel *panel); int drm_panel_unprepare(struct drm_panel *panel); From patchwork Tue Jul 20 13:45:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12388331 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17C3DC07E9B for ; Tue, 20 Jul 2021 13:46:01 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D73E0610D2 for ; Tue, 20 Jul 2021 13:46:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D73E0610D2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cerno.tech Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7AF796E321; Tue, 20 Jul 2021 13:46:00 +0000 (UTC) Received: from wnew3-smtp.messagingengine.com (wnew3-smtp.messagingengine.com [64.147.123.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 94E8A6E321 for ; Tue, 20 Jul 2021 13:45:59 +0000 (UTC) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.west.internal (Postfix) with ESMTP id 61D722B0008E; Tue, 20 Jul 2021 09:45:58 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Tue, 20 Jul 2021 09:45:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=RJHCd20ztixx0 Jw0hO0kTjsLqhDgzKUjg5r4sge0A3k=; b=b/Dqp/4SuZ4fRuuF0mw63N6FkvEiK XWVE5SG3erjQu3d4EMkDN3KxLukIlAVW5M0FA9qZay+yPkXN8vWNA6owNahtsr7J d2wsBOkziMvOhjeyXyYU283mcSs5x6S9qj5gru8uNNLnxYSkQAgjlgwzihO4htDQ jzEYDkUkXf8djMLBYuNfx43BzU1eoNeJVqTEvaoG5Ky06sCrs/RtMCCpQF/t9tgw RS9dPTMEnX0tHLSBY4W1Ql2ym44WMbmtWNGv7fzOdEa97UgqKRXy3znn7L/+eT17 REZjrvipA9JRsNkQMbKLfdEhUEDloVqG1mR/G8RojrWqxRuttNMyQcseQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=RJHCd20ztixx0Jw0hO0kTjsLqhDgzKUjg5r4sge0A3k=; b=BNzg5woU ZlQOd4XT3rvqi69Bbgc5meQVUsppSMwEAVwgU1VewteLmpjEIAKQv9WQsIp/Pfo9 tswUWAVAS1uaox43hx41w8u2x2SmIu+OTGaLZju1KM0BUgxBZ6xnyE5f6NQOj/99 wE+Ogly3BioO30klFOFvMHCASJMD3l5uGqcbu5fa7HHha5FnAfcFa/dJtX3/udcA n/GtikGBbUxmU2ycza0AMO1eVBlXVwFTol5fjJCPu7mHNPnan8UgbpZrtcTOWqfF 6i+inil0RUvR6p/DUhYrvpDJ2+T71Dv0oOI4lZ2TF4H2ytj/v+GrMmDCsJaiaqbk jznmgqbAUM4E9A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrfedvgdeijecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrgihimhgv ucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrghtth gvrhhnpedvkeelveefffekjefhffeuleetleefudeifeehuddugffghffhffehveevheeh vdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrg igihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 20 Jul 2021 09:45:55 -0400 (EDT) From: Maxime Ripard To: Robert Foss , Andrzej Hajda , Daniel Vetter , David Airlie , Sam Ravnborg , Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard , Neil Armstrong , Jonas Karlman , Jernej Skrabec , Thierry Reding , Laurent Pinchart Subject: [PATCH 06/10] drm/bridge: panel: Call attach and detach for the panel Date: Tue, 20 Jul 2021 15:45:21 +0200 Message-Id: <20210720134525.563936-7-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210720134525.563936-1-maxime@cerno.tech> References: <20210720134525.563936-1-maxime@cerno.tech> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Now that we have additional attach and detach hooks for panels, make sure that the panel bridge driver calls them when relevant. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/bridge/panel.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c index c916f4b8907e..c2249f3fd357 100644 --- a/drivers/gpu/drm/bridge/panel.c +++ b/drivers/gpu/drm/bridge/panel.c @@ -60,6 +60,8 @@ static int panel_bridge_attach(struct drm_bridge *bridge, struct drm_connector *connector = &panel_bridge->connector; int ret; + drm_panel_attach(panel_bridge->panel); + if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) return 0; @@ -90,6 +92,8 @@ static void panel_bridge_detach(struct drm_bridge *bridge) struct panel_bridge *panel_bridge = drm_bridge_to_panel_bridge(bridge); struct drm_connector *connector = &panel_bridge->connector; + drm_panel_detach(panel_bridge->panel); + /* * Cleanup the connector if we know it was initialized. * From patchwork Tue Jul 20 13:45:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12388333 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66D32C07E9B for ; Tue, 20 Jul 2021 13:46:06 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 23EB6610D2 for ; Tue, 20 Jul 2021 13:46:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 23EB6610D2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cerno.tech Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 88FE66E328; Tue, 20 Jul 2021 13:46:04 +0000 (UTC) Received: from wnew3-smtp.messagingengine.com (wnew3-smtp.messagingengine.com [64.147.123.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 388916E328 for ; Tue, 20 Jul 2021 13:46:03 +0000 (UTC) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.west.internal (Postfix) with ESMTP id B8ABF2B000FA; Tue, 20 Jul 2021 09:46:01 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Tue, 20 Jul 2021 09:46:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=/nJufUMnp88VZ Vd3czIYa6D3EC6WnnQ6c7BA6KgXV7Y=; b=aMvqStTXWSlDNDdbIa0UPHH7qrn5P dRLMKxmVYSLc/PtVY2OLYCLkxc3bfkkjHvkpoTXCPIHXoy2vKeAWjYJnCObWCDpz /9LfEHAP1IttUKYECwZsnyTNl1qN+skB/O8+pXBzEflGCephCkLPr4Vz230f/n9G u1QRARL2FFWYuVcTBS5SQZnD3DHCpBh5wyhsJvhIVh4hvOE3XX/5m5ytgSbw0BQE fQOpLsQBUUKArpY/iD9eF74+AydNMf8mxgz8N1JbUz2I7udZwCbITC810HLVzA8F jwCuoY3rPqusrjWYX0a332dHmiiOPdrsE/+2/6SkDu0vYgznEUJxv0hmQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=/nJufUMnp88VZVd3czIYa6D3EC6WnnQ6c7BA6KgXV7Y=; b=FEp2SJGr 2Bq/SQF8U3ROqm5OdZ78XR11EzJgVR2ZCR5VhJrjX92yAASZQJ5D1nu3jsuck+VD Xj5/GvmHyisCAc6M2lFr/Kl9rUg3E10+5ZA2opblHiP6Dy7IeY6D9AjsaK8SQYz3 orMNecvj8prD7fJjdFPZowKLlcs37u+X74qxwBiS2Wn+ZNqmRLipkXxR/am1hZ93 RJ0CRTxfNAsqhDT7XixJr27kdALbhHB7q/aSq2ckY4SzOyIqL3Vx3NI3IpvU58WI Nlo2iuhqQKgTLD73Dh9zlzlRgUBVHQbBmEcR7w6TKaNxaxOrcdPy8e2lRfdziErk M90Yw9Ow7PiX3g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrfedvgdeijecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrgihimhgv ucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrghtth gvrhhnpedvkeelveefffekjefhffeuleetleefudeifeehuddugffghffhffehveevheeh vdenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrg igihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 20 Jul 2021 09:46:00 -0400 (EDT) From: Maxime Ripard To: Robert Foss , Andrzej Hajda , Daniel Vetter , David Airlie , Sam Ravnborg , Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard , Neil Armstrong , Jonas Karlman , Jernej Skrabec , Thierry Reding , Laurent Pinchart Subject: [PATCH 07/10] drm/vc4: dsi: Switch to drm_of_get_next Date: Tue, 20 Jul 2021 15:45:22 +0200 Message-Id: <20210720134525.563936-8-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210720134525.563936-1-maxime@cerno.tech> References: <20210720134525.563936-1-maxime@cerno.tech> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The new drm_of_get_next removes most of the boilerplate we have to deal with. Let's switch to it. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_drv.c | 2 ++ drivers/gpu/drm/vc4/vc4_dsi.c | 28 ++++------------------------ 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c index 73335feb712f..ff056ee8bc4b 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.c +++ b/drivers/gpu/drm/vc4/vc4_drv.c @@ -25,7 +25,9 @@ #include #include #include +#include #include +#include #include #include #include diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c index 6dfcbd9e234e..f51ce8db0f4e 100644 --- a/drivers/gpu/drm/vc4/vc4_dsi.c +++ b/drivers/gpu/drm/vc4/vc4_dsi.c @@ -1489,7 +1489,6 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) struct drm_device *drm = dev_get_drvdata(master); struct vc4_dsi *dsi = dev_get_drvdata(dev); struct vc4_dsi_encoder *vc4_dsi_encoder; - struct drm_panel *panel; const struct of_device_id *match; dma_cap_mask_t dma_mask; int ret; @@ -1601,27 +1600,9 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) return ret; } - ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0, - &panel, &dsi->bridge); - if (ret) { - /* If the bridge or panel pointed by dev->of_node is not - * enabled, just return 0 here so that we don't prevent the DRM - * dev from being registered. Of course that means the DSI - * encoder won't be exposed, but that's not a problem since - * nothing is connected to it. - */ - if (ret == -ENODEV) - return 0; - - return ret; - } - - if (panel) { - dsi->bridge = devm_drm_panel_bridge_add_typed(dev, panel, - DRM_MODE_CONNECTOR_DSI); - if (IS_ERR(dsi->bridge)) - return PTR_ERR(dsi->bridge); - } + dsi->bridge = devm_drm_of_get_next(dev, dev->of_node, 0, 0); + if (IS_ERR(dsi->bridge)) + return PTR_ERR(dsi->bridge); /* The esc clock rate is supposed to always be 100Mhz. */ ret = clk_set_rate(dsi->escape_clock, 100 * 1000000); @@ -1661,8 +1642,7 @@ static void vc4_dsi_unbind(struct device *dev, struct device *master, { struct vc4_dsi *dsi = dev_get_drvdata(dev); - if (dsi->bridge) - pm_runtime_disable(dev); + pm_runtime_disable(dev); /* * Restore the bridge_chain so the bridge detach procedure can happen From patchwork Tue Jul 20 13:45:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12388335 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62A23C07E9B for ; Tue, 20 Jul 2021 13:46:11 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D41CA610D2 for ; Tue, 20 Jul 2021 13:46:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D41CA610D2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cerno.tech Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 44C4D6E332; Tue, 20 Jul 2021 13:46:10 +0000 (UTC) Received: from wnew3-smtp.messagingengine.com (wnew3-smtp.messagingengine.com [64.147.123.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 616806E3DB for ; Tue, 20 Jul 2021 13:46:08 +0000 (UTC) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.west.internal (Postfix) with ESMTP id 2F1FC2B0090F; Tue, 20 Jul 2021 09:46:07 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 20 Jul 2021 09:46:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=Oi467eD63Wjwp FoHKx4z3s/qo/NOlxbPHqYAVB8BXxs=; b=KiwjgczlrUV+JYgkxXE7dSb/3Sbg/ KbjMo96pTzKlNzuf+58JPZyQKX6tiTbNHk93MYDkiC9/ZJrBOS0BRZPrOjnJrFSc zwaPIEubV+K3slQnMWV1v9oDn+n9mywEX2SHVfz62nTjU6nti1Gj6RSoUmD09v91 KxvuMrz+dsJzJ73NPat3eGROaCx+6uMiuxnhQGt1aaqdaph9jyxt0T0Gz7++iH/G 6zBR7fYm38gtEvsyCU0KAxsCQGi9RKUrTYL1t0wKN4WKVTeSRM44dVO334SyQmSm Yucy/2Lq9tlfu+thvg+Tn7BbikcfPEaaIUEHtFDmIVL9oWpAaYXjaC5lw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=Oi467eD63WjwpFoHKx4z3s/qo/NOlxbPHqYAVB8BXxs=; b=tXcZj+Pl +r2whY8MXq03BPU/MPJFMQfa7Pu31Po76+bn79SCB1vSTPVqE/4tzaU0WwyPylYF AIJE1n9Nhtttos9JqAdxCtwZSQAU1z+N6Zl3kpYmZC31ktLykPvDp0DqSzN8FplC tIvXsRnHz+GTekCVBWLMR/xWVcagbaJW5IFXZPYiWdamN/1g3dqX9yYIr9IuFX5p ugNMZOp8Bv+WRYF3KulVcfQSzwYrG34PUcU3+Bvh2vnJxbX0gD/myRni7w5GkHm6 zwUnfRuRTh32GQUdRmdiW3TzClcsuC3D8DSi8ndDCRTz+ClhA6IOXm3tHwZQ2NiX /hcVX5cLoQHA1A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrfedvgdeikecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrgihimhgv ucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrghtth gvrhhnpedvkeelveefffekjefhffeuleetleefudeifeehuddugffghffhffehveevheeh vdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrg igihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 20 Jul 2021 09:46:04 -0400 (EDT) From: Maxime Ripard To: Robert Foss , Andrzej Hajda , Daniel Vetter , David Airlie , Sam Ravnborg , Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard , Neil Armstrong , Jonas Karlman , Jernej Skrabec , Thierry Reding , Laurent Pinchart Subject: [PATCH 08/10] drm/panel: raspberrypi-touchscreen: Prevent double-free Date: Tue, 20 Jul 2021 15:45:23 +0200 Message-Id: <20210720134525.563936-9-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210720134525.563936-1-maxime@cerno.tech> References: <20210720134525.563936-1-maxime@cerno.tech> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The mipi_dsi_device allocated by mipi_dsi_device_register_full() is already free'd on release. Fixes: 2f733d6194bd ("drm/panel: Add support for the Raspberry Pi 7" Touchscreen.") Signed-off-by: Maxime Ripard Reviewed-by: Sam Ravnborg --- drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c index 6f2ce3b81f47..462faae0f446 100644 --- a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c +++ b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c @@ -447,7 +447,6 @@ static int rpi_touchscreen_remove(struct i2c_client *i2c) drm_panel_remove(&ts->base); mipi_dsi_device_unregister(ts->dsi); - kfree(ts->dsi); return 0; } From patchwork Tue Jul 20 13:45:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12388337 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92B75C07E9B for ; Tue, 20 Jul 2021 13:46:14 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 54A8361164 for ; Tue, 20 Jul 2021 13:46:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 54A8361164 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cerno.tech Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D2F936E39B; Tue, 20 Jul 2021 13:46:13 +0000 (UTC) Received: from wnew3-smtp.messagingengine.com (wnew3-smtp.messagingengine.com [64.147.123.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id BED776E39B for ; Tue, 20 Jul 2021 13:46:12 +0000 (UTC) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.west.internal (Postfix) with ESMTP id 875022B005D0; Tue, 20 Jul 2021 09:46:11 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Tue, 20 Jul 2021 09:46:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=rpqGJA8BzP498 VRthL+GNLGbJX6smf0yyUoSj3bk7lg=; b=liC6SCDatppqQysuy4XdOdBm/hL9z rFNTqft+3e40uxFGLIAbYKAHEzFOTdo7BIdm84hYJqyDN3G1oPzQoU8SWaO6f6B2 WbVo7XRroBsx5iEl+3M3CHScJIFd4OwMoJObyMA+t2DslgWbeb82e+RRulxKpu/1 8VoWmuw6zBLJV98XhkOisFX8HALRctsGr5OV38CGPByHn07QKBwpg8/OrQWLwKRU wmPaZRVKp6qS1+oYkGbF0AMbFtzsbMKRFN8M7Y/ixlJd4nZUSKYglZbL1BztGLtx gDc8XIlaSMLLFf9UdobfZz8AmxQui6u287NKBFv9a36kJgh3oeSf1J4fA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=rpqGJA8BzP498VRthL+GNLGbJX6smf0yyUoSj3bk7lg=; b=OB7E272R oQsMem7IvWJ2BtjDYbP6oMYR1e0zswulSjGN3eJ4QYRXkjOQlokgXKSTGWDFvxxo jbLfcVg8382wxhA65ZWi5lDyqnp7xJXaYPkSam2Gspe6umCpCvDLcamP/nqoW6sH FUwyIcii2Fea0BHdFvB5Rjavt8tUvXoeecXAaj9eIbtzaEdWzQuWpRSIn9wnAY5l mKDNUklp1oqjLZFzrqLbOj2q06xhLNMrIAXVOnUTPya9SWC6ej++3YaX2R5NsRxC /FIEJXP30ZnAVum2Swo5K2DD96o8gVUNKyq9UY2bzVWLMVvBT6HCHem4MxrY9FRh HuF5pxCkOPVM/Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrfedvgdeijecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrgihimhgv ucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrghtth gvrhhnpedvkeelveefffekjefhffeuleetleefudeifeehuddugffghffhffehveevheeh vdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrg igihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 20 Jul 2021 09:46:09 -0400 (EDT) From: Maxime Ripard To: Robert Foss , Andrzej Hajda , Daniel Vetter , David Airlie , Sam Ravnborg , Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard , Neil Armstrong , Jonas Karlman , Jernej Skrabec , Thierry Reding , Laurent Pinchart Subject: [PATCH 09/10] drm/panel: raspberrypi-touchscreen: Use the attach hook Date: Tue, 20 Jul 2021 15:45:24 +0200 Message-Id: <20210720134525.563936-10-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210720134525.563936-1-maxime@cerno.tech> References: <20210720134525.563936-1-maxime@cerno.tech> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Now that we have an attach hook available for panels as well, let's use it for the RaspberryPi 7" DSI panel. This now mimics what all the other bridges in a similar situation are doing, and we avoid our probe order issue entirely. Signed-off-by: Maxime Ripard --- .../drm/panel/panel-raspberrypi-touchscreen.c | 135 ++++++++++-------- 1 file changed, 77 insertions(+), 58 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c index 462faae0f446..995c5cafb970 100644 --- a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c +++ b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c @@ -346,7 +346,83 @@ static int rpi_touchscreen_get_modes(struct drm_panel *panel, return num; } +static int rpi_touchscreen_attach(struct drm_panel *panel) +{ + struct rpi_touchscreen *ts = panel_to_ts(panel); + struct device *dev = &ts->i2c->dev; + struct device_node *endpoint, *dsi_host_node; + struct mipi_dsi_device *dsi; + struct mipi_dsi_host *host; + int ret; + + struct mipi_dsi_device_info info = { + .type = RPI_DSI_DRIVER_NAME, + .channel = 0, + .node = NULL, + }; + + /* Look up the DSI host. It needs to probe before we do. */ + endpoint = of_graph_get_next_endpoint(dev->of_node, NULL); + if (!endpoint) + return -ENODEV; + + dsi_host_node = of_graph_get_remote_port_parent(endpoint); + if (!dsi_host_node) { + of_node_put(endpoint); + return -ENODEV; + } + + host = of_find_mipi_dsi_host_by_node(dsi_host_node); + of_node_put(dsi_host_node); + if (!host) { + of_node_put(endpoint); + return -EPROBE_DEFER; + } + + info.node = of_graph_get_remote_port(endpoint); + if (!info.node) { + of_node_put(endpoint); + return -ENODEV; + } + + of_node_put(endpoint); + + dsi = mipi_dsi_device_register_full(host, &info); + if (IS_ERR(dsi)) { + dev_err(dev, "DSI device registration failed: %ld\n", + PTR_ERR(dsi)); + return PTR_ERR(dsi); + } + + ts->dsi = dsi; + + dsi->mode_flags = (MIPI_DSI_MODE_VIDEO | + MIPI_DSI_MODE_VIDEO_SYNC_PULSE | + MIPI_DSI_MODE_LPM); + dsi->format = MIPI_DSI_FMT_RGB888; + dsi->lanes = 1; + + ret = mipi_dsi_attach(dsi); + if (ret) { + dev_err(&dsi->dev, "failed to attach dsi to host: %d\n", ret); + return ret; + } + + return 0; +} + +static void rpi_touchscreen_detach(struct drm_panel *panel) +{ + struct rpi_touchscreen *ts = panel_to_ts(panel); + + mipi_dsi_detach(ts->dsi); + mipi_dsi_device_unregister(ts->dsi); +} + static const struct drm_panel_funcs rpi_touchscreen_funcs = { + .attach = rpi_touchscreen_attach, + .detach = rpi_touchscreen_detach, + .disable = rpi_touchscreen_disable, .unprepare = rpi_touchscreen_noop, .prepare = rpi_touchscreen_noop, @@ -359,14 +435,7 @@ static int rpi_touchscreen_probe(struct i2c_client *i2c, { struct device *dev = &i2c->dev; struct rpi_touchscreen *ts; - struct device_node *endpoint, *dsi_host_node; - struct mipi_dsi_host *host; int ver; - struct mipi_dsi_device_info info = { - .type = RPI_DSI_DRIVER_NAME, - .channel = 0, - .node = NULL, - }; ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL); if (!ts) @@ -394,35 +463,6 @@ static int rpi_touchscreen_probe(struct i2c_client *i2c, /* /\* Turn off at boot, so we can cleanly sequence powering on. *\/ */ /* rpi_touchscreen_i2c_write(ts, REG_POWERON, 0); */ - /* Look up the DSI host. It needs to probe before we do. */ - endpoint = of_graph_get_next_endpoint(dev->of_node, NULL); - if (!endpoint) - return -ENODEV; - - dsi_host_node = of_graph_get_remote_port_parent(endpoint); - if (!dsi_host_node) - goto error; - - host = of_find_mipi_dsi_host_by_node(dsi_host_node); - of_node_put(dsi_host_node); - if (!host) { - of_node_put(endpoint); - return -EPROBE_DEFER; - } - - info.node = of_graph_get_remote_port(endpoint); - if (!info.node) - goto error; - - of_node_put(endpoint); - - ts->dsi = mipi_dsi_device_register_full(host, &info); - if (IS_ERR(ts->dsi)) { - dev_err(dev, "DSI device registration failed: %ld\n", - PTR_ERR(ts->dsi)); - return PTR_ERR(ts->dsi); - } - drm_panel_init(&ts->base, dev, &rpi_touchscreen_funcs, DRM_MODE_CONNECTOR_DSI); @@ -432,41 +472,20 @@ static int rpi_touchscreen_probe(struct i2c_client *i2c, drm_panel_add(&ts->base); return 0; - -error: - of_node_put(endpoint); - return -ENODEV; } static int rpi_touchscreen_remove(struct i2c_client *i2c) { struct rpi_touchscreen *ts = i2c_get_clientdata(i2c); - mipi_dsi_detach(ts->dsi); - drm_panel_remove(&ts->base); - mipi_dsi_device_unregister(ts->dsi); - return 0; } static int rpi_touchscreen_dsi_probe(struct mipi_dsi_device *dsi) { - int ret; - - dsi->mode_flags = (MIPI_DSI_MODE_VIDEO | - MIPI_DSI_MODE_VIDEO_SYNC_PULSE | - MIPI_DSI_MODE_LPM); - dsi->format = MIPI_DSI_FMT_RGB888; - dsi->lanes = 1; - - ret = mipi_dsi_attach(dsi); - - if (ret) - dev_err(&dsi->dev, "failed to attach dsi to host: %d\n", ret); - - return ret; + return 0; } static struct mipi_dsi_driver rpi_touchscreen_dsi_driver = { From patchwork Tue Jul 20 13:45:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12388339 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A407BC636C8 for ; Tue, 20 Jul 2021 13:46:19 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 681C4610D2 for ; Tue, 20 Jul 2021 13:46:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 681C4610D2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cerno.tech Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 028656E32F; Tue, 20 Jul 2021 13:46:19 +0000 (UTC) Received: from wnew3-smtp.messagingengine.com (wnew3-smtp.messagingengine.com [64.147.123.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2E4926E3BB for ; Tue, 20 Jul 2021 13:46:17 +0000 (UTC) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.west.internal (Postfix) with ESMTP id F40112B00919; Tue, 20 Jul 2021 09:46:15 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Tue, 20 Jul 2021 09:46:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=oj0uWTcP4eN/7 CWZDuDel6GfjZzcOM2ouml6hFdmYPA=; b=2UcA+t8Z1Ne7llgHOKoxMJN85t7E7 Zw8vW751X1WKI3aM+j1A/mn2QmUb3QTZ86GFJohZ4aB0i58ZTREja3DuUNCI8tsA R4/qbcOyDD/+pnajpjWU/RbeMfSu8kd6pbubyJzTGB26+PVHLA9HjzFE2dik9Ts1 RvWQEuTqbMqr+zx7MqjJ1vQPEK6bggmv8wsqR2J/A0+umULvrd/T7/wEYmrC/LBL p2frPhzdzXYfgu1nWk6lMo5SaqdKDZm7ZX1dyuMhsilmZwE1N+jPdccLxjcsHW/3 OfglniPjIvV+ltveQl9UIAsUwzBQZSlDg4WPVYAC0tJyz1IYb0OlS2gnQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=oj0uWTcP4eN/7CWZDuDel6GfjZzcOM2ouml6hFdmYPA=; b=fQEL1Kxh R+4RnVcSaWFI+5xnYRu5NbPJl+NkA0zDFINLCIdSEs+LOTHZPW4DhtKsyKABcYKn 3hz543/ff4aQJQVkU3pfS724/lW+libLC/dRStCUbLY0/eJoMYr1GqqAeHLSgyGj wwYETWosS8BhU+0aO89lkuvcLUG2aW+5YB6w91mdMfvBEi1ZiAirO4Cu7nZMaeVz KEvkCQKa0eKvdR9NezigJ7akHd9YM+XUnYn0X1m/ROyNBwQWP9yeIjewJhyA2PRh EyTe9xZwynZ7psRAy8Dwafe9Y31/7SujUVBzN9fMzoa8knTSU0kkpfJ7RVZwX78l 5L/SyKyxVyZILg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrfedvgdeijecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrgihimhgv ucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrghtth gvrhhnpedvkeelveefffekjefhffeuleetleefudeifeehuddugffghffhffehveevheeh vdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrg igihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 20 Jul 2021 09:46:14 -0400 (EDT) From: Maxime Ripard To: Robert Foss , Andrzej Hajda , Daniel Vetter , David Airlie , Sam Ravnborg , Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard , Neil Armstrong , Jonas Karlman , Jernej Skrabec , Thierry Reding , Laurent Pinchart Subject: [PATCH 10/10] drm/panel: raspberrypi-touchscreen: Remove MIPI-DSI driver Date: Tue, 20 Jul 2021 15:45:25 +0200 Message-Id: <20210720134525.563936-11-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210720134525.563936-1-maxime@cerno.tech> References: <20210720134525.563936-1-maxime@cerno.tech> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The driver was using a two-steps initialisation when probing with the i2c probe first registering the MIPI-DSI device, and then when that device was probed the driver would attach the device to its host. This resulted in a fairly non-standard probe logic. The previous commit changed that logic entirely though, resulting in a completely empty MIPI-DSI device probe. Let's simplify the driver by removing it entirely and just behave as a normal i2c driver. Signed-off-by: Maxime Ripard --- .../drm/panel/panel-raspberrypi-touchscreen.c | 25 +------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c index 995c5cafb970..09937aa26c6a 100644 --- a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c +++ b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c @@ -483,16 +483,6 @@ static int rpi_touchscreen_remove(struct i2c_client *i2c) return 0; } -static int rpi_touchscreen_dsi_probe(struct mipi_dsi_device *dsi) -{ - return 0; -} - -static struct mipi_dsi_driver rpi_touchscreen_dsi_driver = { - .driver.name = RPI_DSI_DRIVER_NAME, - .probe = rpi_touchscreen_dsi_probe, -}; - static const struct of_device_id rpi_touchscreen_of_ids[] = { { .compatible = "raspberrypi,7inch-touchscreen-panel" }, { } /* sentinel */ @@ -507,20 +497,7 @@ static struct i2c_driver rpi_touchscreen_driver = { .probe = rpi_touchscreen_probe, .remove = rpi_touchscreen_remove, }; - -static int __init rpi_touchscreen_init(void) -{ - mipi_dsi_driver_register(&rpi_touchscreen_dsi_driver); - return i2c_add_driver(&rpi_touchscreen_driver); -} -module_init(rpi_touchscreen_init); - -static void __exit rpi_touchscreen_exit(void) -{ - i2c_del_driver(&rpi_touchscreen_driver); - mipi_dsi_driver_unregister(&rpi_touchscreen_dsi_driver); -} -module_exit(rpi_touchscreen_exit); +module_i2c_driver(rpi_touchscreen_driver); MODULE_AUTHOR("Eric Anholt "); MODULE_DESCRIPTION("Raspberry Pi 7-inch touchscreen driver");