Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1863664rwb; Fri, 19 Aug 2022 10:38:38 -0700 (PDT) X-Google-Smtp-Source: AA6agR68OSDSnf4zINcP/HXPkjlZcHZcSxmhsijiJWlOUmwzQM/kA16D/t60pOvCiQcPqijCtKBb X-Received: by 2002:a17:902:da82:b0:172:be4a:c586 with SMTP id j2-20020a170902da8200b00172be4ac586mr5054038plx.13.1660930717945; Fri, 19 Aug 2022 10:38:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660930717; cv=none; d=google.com; s=arc-20160816; b=Glk2D+uSyXAgFvt/IjKuHC91rEyJcDXQg4judvkepJ0VWnEr+tMY58Jojtxw6GvvU1 iu7SLYgE41hLxKXOoOtbIklAxqqQ0n4ntggblKMW2FWl1bCeRKKzvzuLF0xX3S0kWgPD x+bEprc/mK85OvqOD8oVOHr/yWW3gl1u2wOj1S5lflXyZNVvJ7PWbyHQSuwXJLUcqtcW cGrhhjyJ/cxLpTmRDv0MnDJV6+xCdGIMAKcI6Qi7yKBx0dqe6ZDFiEIrTCIYQCjWMPpY ckVEFBHJbIqO7yMHRVSONiwKIPH9z2rMvc8zTacJMBsBHTU5t/1CVKREuHwnriVNTvu+ wXmQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YGbc834bmLxj8io8XM1f0tBjPNlFBd0XIDOC4nCWsgc=; b=xKUcxrwB93hD+Tw6hThzHYpvWFqdIJ0SimTwGe+27Z5WGrfEM5pjPegiVks7qjmBh/ WvqBvQxoBcLUS+z7sYHosncDZQxkQrwfwlhx5QhmafD4i7479tJ7ZO+2cycuhrdakqev zAvEwIJeKneQwRcobhbpPlOilnk8wsLm/SeHQfh9IZDKVJQbUz6lSYWcRjTohAjstU4N YIknnGDboH05AOwlYh785dMzoZKjRto/LQYIgDahPc9W9jYsu5pFPSOx0g7k2WSJqOWW FaCK30yTSd31IorAiWQH1I1sDkmzvliwnYw+TYw/RghzlsYgIHgDdNf1HqbWVefXluCF OirA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zCqsGhhj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u24-20020a63f658000000b0041b4079be13si4718819pgj.624.2022.08.19.10.38.26; Fri, 19 Aug 2022 10:38:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zCqsGhhj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349986AbiHSQEg (ORCPT + 99 others); Fri, 19 Aug 2022 12:04:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351377AbiHSQBZ (ORCPT ); Fri, 19 Aug 2022 12:01:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 467ED105230; Fri, 19 Aug 2022 08:53:16 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 501A461765; Fri, 19 Aug 2022 15:53:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 248AAC433C1; Fri, 19 Aug 2022 15:53:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660924394; bh=bqw9yx6OrijSHK4DhwtQW8xRnobUCvPzRs0/17YF7EA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zCqsGhhjBe0uKkemls+fZK03/YyD6DPvkHtA7vECJwuqz/jzQ+cmgGLbinj0E9g7c lrJlAxGjpaEpPr35ICA9AcsPrDDWBgWxpaXSakwGqazk/iG9Jh6dN9ICPXcHeU6Z29 xwHWfFxv+q+M1g3kVX8Z/et4iQqkterTTW8bPgoQ= 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.10 157/545] drm/bridge: tc358767: Move (e)DP bridge endpoint parsing into dedicated function Date: Fri, 19 Aug 2022 17:38:47 +0200 Message-Id: <20220819153836.373770300@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220819153829.135562864@linuxfoundation.org> References: <20220819153829.135562864@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 DSI 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/tc358767.c index 34a3e4e9f717..9af564cf92e5 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -1535,19 +1535,12 @@ static irqreturn_t tc_irq_handler(int irq, void *arg) return IRQ_HANDLED; } -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 = &client->dev; + struct device *dev = tc->dev; struct drm_panel *panel; - struct tc_data *tc; int ret; - tc = devm_kzalloc(dev, sizeof(*tc), GFP_KERNEL); - if (!tc) - return -ENOMEM; - - tc->dev = dev; - /* port@2 is the output port */ ret = drm_of_find_panel_or_bridge(dev->of_node, 2, 0, &panel, NULL); if (ret && ret != -ENODEV) @@ -1566,6 +1559,25 @@ static int tc_probe(struct i2c_client *client, const struct i2c_device_id *id) tc->bridge.type = DRM_MODE_CONNECTOR_DisplayPort; } + return ret; +} + +static int tc_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct device *dev = &client->dev; + struct tc_data *tc; + int ret; + + tc = devm_kzalloc(dev, sizeof(*tc), GFP_KERNEL); + if (!tc) + return -ENOMEM; + + tc->dev = dev; + + ret = tc_probe_edp_bridge_endpoint(tc); + if (ret) + return ret; + /* Shut down GPIO is optional */ tc->sd_gpio = devm_gpiod_get_optional(dev, "shutdown", GPIOD_OUT_HIGH); if (IS_ERR(tc->sd_gpio)) -- 2.35.1