From nobody Sun Dec 14 06:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34A33C00140 for ; Mon, 15 Aug 2022 18:44:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243500AbiHOSoc (ORCPT ); Mon, 15 Aug 2022 14:44:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243893AbiHOSli (ORCPT ); Mon, 15 Aug 2022 14:41:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36AC9BC; Mon, 15 Aug 2022 11:25:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B7946B80F99; Mon, 15 Aug 2022 18:25:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0275CC433C1; Mon, 15 Aug 2022 18:25:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587911; bh=DNt4WbPxh9ZOJW2Cbt6ropOHdfsmBte4nCv3qnWluoo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B0i5H5ytKXBPMzBBeQpkwJkUDKLzUcBViSZVCp/kuYF18JWZXKUxs0q2DFYf73rWE +tisakBP1vyOAb6y1y7kZlXzoZU5B53NkznU7nYA35KLViXfOQqAbt21tWHGIMfv4T hKsGFBTwIA2HNTL5dpLGEvahOf1ZqhMO5ZRbdGoA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lucas Stach , Marek Vasut , Jonas Karlman , Laurent Pinchart , Maxime Ripard , Neil Armstrong , Sam Ravnborg , Robert Foss , Sasha Levin Subject: [PATCH 5.15 235/779] drm/bridge: tc358767: Move (e)DP bridge endpoint parsing into dedicated function Date: Mon, 15 Aug 2022 19:57:59 +0200 Message-Id: <20220815180347.324851023@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marek Vasut [ Upstream commit 8478095a8c4bcea3c83b0767d6c9127434160761 ] The TC358767/TC358867/TC9595 are all capable of operating in multiple modes, DPI-to-(e)DP, DSI-to-(e)DP, DSI-to-DPI. Only the first mode is currently supported. In order to support the rest of the modes without making the tc_probe() overly long, split the bridge endpoint parsing into dedicated function, where the necessary logic to detect the bridge mode based on which endpoints are connected, can be implemented. Reviewed-by: Lucas Stach Tested-by: Lucas Stach # In both DPI to eDP and DS= I to DPI mode. Signed-off-by: Marek Vasut Cc: Jonas Karlman Cc: Laurent Pinchart Cc: Maxime Ripard Cc: Neil Armstrong Cc: Sam Ravnborg Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220329085015.39159-7-= marex@denx.de Signed-off-by: Sasha Levin --- drivers/gpu/drm/bridge/tc358767.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc3= 58767.c index 23a6f90b694b..a2d051ed6cd8 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -1549,19 +1549,12 @@ static irqreturn_t tc_irq_handler(int irq, void *ar= g) return IRQ_HANDLED; } =20 -static int tc_probe(struct i2c_client *client, const struct i2c_device_id = *id) +static int tc_probe_edp_bridge_endpoint(struct tc_data *tc) { - struct device *dev =3D &client->dev; + struct device *dev =3D tc->dev; struct drm_panel *panel; - struct tc_data *tc; int ret; =20 - tc =3D devm_kzalloc(dev, sizeof(*tc), GFP_KERNEL); - if (!tc) - return -ENOMEM; - - tc->dev =3D dev; - /* port@2 is the output port */ ret =3D drm_of_find_panel_or_bridge(dev->of_node, 2, 0, &panel, NULL); if (ret && ret !=3D -ENODEV) @@ -1580,6 +1573,25 @@ static int tc_probe(struct i2c_client *client, const= struct i2c_device_id *id) tc->bridge.type =3D DRM_MODE_CONNECTOR_DisplayPort; } =20 + return ret; +} + +static int tc_probe(struct i2c_client *client, const struct i2c_device_id = *id) +{ + struct device *dev =3D &client->dev; + struct tc_data *tc; + int ret; + + tc =3D devm_kzalloc(dev, sizeof(*tc), GFP_KERNEL); + if (!tc) + return -ENOMEM; + + tc->dev =3D dev; + + ret =3D tc_probe_edp_bridge_endpoint(tc); + if (ret) + return ret; + /* Shut down GPIO is optional */ tc->sd_gpio =3D devm_gpiod_get_optional(dev, "shutdown", GPIOD_OUT_HIGH); if (IS_ERR(tc->sd_gpio)) --=20 2.35.1