Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp1482645lqo; Sun, 12 May 2024 04:48:35 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWBF3+TICltIEZS5N6HadgBBGXtcVSg+ZIiLWR1B9bzdJSK+M+Gb6JW0TotmqN6iL1Mg28W1GhrozNMY9HX4GiLxnNpiZO21dwU3bNStA== X-Google-Smtp-Source: AGHT+IHZAfzjwEv3U9CIPMkt1fcrsGE17tdzXLOX9JEpGxeTnvz8KS0Vzb51RHA/KYHVCPpr9Bjh X-Received: by 2002:ac8:7c45:0:b0:43a:67c2:d2ed with SMTP id d75a77b69052e-43dfdb1eceemr96548451cf.12.1715514515373; Sun, 12 May 2024 04:48:35 -0700 (PDT) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-43e094d01dasi35167331cf.99.2024.05.12.04.48.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 May 2024 04:48:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-176861-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@dolcini.it header.s=default header.b=0kmb2Owc; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-176861-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176861-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=dolcini.it Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 0D55A1C2097D for ; Sun, 12 May 2024 11:48:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F2873208D0; Sun, 12 May 2024 11:48:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=dolcini.it header.i=@dolcini.it header.b="0kmb2Owc" Received: from mail11.truemail.it (mail11.truemail.it [217.194.8.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0D99E1C2AD; Sun, 12 May 2024 11:48:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.194.8.81 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715514506; cv=none; b=K3FEtln6mvwrem7q/L/lFetuwEjp+FOSj6MRAJO+vaj3XVI1JuYYUqfu7D/+Zes8xYUrMYIjUZeKcenvC1kTXWiCm1spvred+eCr95NOGn5mOi6anfEOO9ieXK1/vptkRkhrD5ICjGNY1Se4FVj8yKW2eSAud1fxcJsy9xhGUEA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715514506; c=relaxed/simple; bh=a5sdWUu/SAnXiIE5VHIWRL/RhaEuPx+jDaNkfSPfeoc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ctrEt3l1e2cxH619YDOrUZmDtxeeltkcO/u1WluuyYL2Bhc9shxoFCEhKjrk8HTftz1y4T17+gxkiVC4Oi+itMeBp+078N5eUjmedn5vhCWWir03KXKQyYANO9mt3L4QkwfpA+oGPgdsijiumlqaZksU8FZIBQXW+9cIx46gYeg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=dolcini.it; spf=pass smtp.mailfrom=dolcini.it; dkim=pass (2048-bit key) header.d=dolcini.it header.i=@dolcini.it header.b=0kmb2Owc; arc=none smtp.client-ip=217.194.8.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=dolcini.it Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=dolcini.it Received: from gaggiata.pivistrello.it (93-49-2-63.ip317.fastwebnet.it [93.49.2.63]) by mail11.truemail.it (Postfix) with ESMTPA id 7E6081FA0A; Sun, 12 May 2024 13:48:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dolcini.it; s=default; t=1715514493; bh=h0z00hFgh4UUjW8xjsLXv7Y36CFzGdOnXABZK2z+T8E=; h=Received:From:To:Subject; b=0kmb2Owch7ccpjr4CzvDlwCyQcDbQL/navgz7mJJnrdKG6zWp+U2OcHP8I9gYZiYy /q2yQCEnsgM/wtoxjQTiK360leWExG3pE0/yLGsAv1VpkR/dVzOe1VC2ZGIjK32m11 JBPuTgB+0/yKwNdozsIkoBOLM05koOpaPulZI0iADs5wUc3audNKGVhjiBZLuAhZQR EpMeqq1VlgthSjVSKusPRbgFemA4Li6y1ZSRAXL5J3g7VuR4LfP53suGUkUZ/D9eVu zxqwwsbvrU7fQLX0mFxmeR7yXYx4Gndej8IexOKFtIUC4Cb4WHYAETvp6m3btAKCv8 XFbV5taFPx/CQ== Received: by gaggiata.pivistrello.it (Postfix, from userid 1000) id 117787F95F; Sun, 12 May 2024 13:48:13 +0200 (CEST) Date: Sun, 12 May 2024 13:48:12 +0200 From: Francesco Dolcini To: Aradhya Bhatia Cc: Tomi Valkeinen , Jyri Sarha , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Neil Armstrong , Laurent Pinchart , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , DRI Development List , Devicetree List , Linux Kernel List , Nishanth Menon , Vignesh Raghavendra , Praneeth Bajjuri , Udit Kumar , Francesco Dolcini , Alexander Sverdlin , Randolph Sapp , Devarsh Thakkar , Jayesh Choudhary , Jai Luthra Subject: Re: [PATCH 4/4] drm/tidss: Add OLDI bridge support Message-ID: References: <20240511193055.1686149-1-a-bhatia1@ti.com> <20240511193055.1686149-5-a-bhatia1@ti.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240511193055.1686149-5-a-bhatia1@ti.com> Hello Aradhya, thanks for you patch, I should be able to test your patch on my hardware in the coming days. On Sun, May 12, 2024 at 01:00:55AM +0530, Aradhya Bhatia wrote: > Up till now, the OLDI support in tidss was integrated within the tidss dispc. > This was fine till the OLDI was one-to-mapped with the DSS video-port (VP). > The AM62 and AM62P SoCs have 2 OLDI TXes that can support dual-lvds / lvds-clone > modes. > > Add OLDI TXes as separate DRM bridge entities to better support the new LVDS > configurations. > > Signed-off-by: Aradhya Bhatia > --- > drivers/gpu/drm/tidss/Makefile | 3 +- > drivers/gpu/drm/tidss/tidss_dispc.c | 11 +- > drivers/gpu/drm/tidss/tidss_dispc.h | 4 + > drivers/gpu/drm/tidss/tidss_drv.c | 13 +- > drivers/gpu/drm/tidss/tidss_drv.h | 4 + > drivers/gpu/drm/tidss/tidss_oldi.c | 568 ++++++++++++++++++++++++++++ > drivers/gpu/drm/tidss/tidss_oldi.h | 73 ++++ > 7 files changed, 673 insertions(+), 3 deletions(-) > create mode 100644 drivers/gpu/drm/tidss/tidss_oldi.c > create mode 100644 drivers/gpu/drm/tidss/tidss_oldi.h > > diff --git a/drivers/gpu/drm/tidss/tidss_drv.c b/drivers/gpu/drm/tidss/tidss_drv.c > index d15f836dca95..fd90e8498cc2 100644 > --- a/drivers/gpu/drm/tidss/tidss_drv.c > +++ b/drivers/gpu/drm/tidss/tidss_drv.c > @@ -23,6 +23,7 @@ > #include "tidss_drv.h" > #include "tidss_kms.h" > #include "tidss_irq.h" > +#include "tidss_oldi.h" > > /* Power management */ > > @@ -140,10 +141,17 @@ static int tidss_probe(struct platform_device *pdev) > > spin_lock_init(&tidss->wait_lock); > > + ret = tidss_oldi_init(tidss); > + if (ret) { > + if (ret != -EPROBE_DEFER) > + dev_err(dev, "failed to init OLDI (%d)\n", ret); > + return ret; > + } return dev_err_probe() > diff --git a/drivers/gpu/drm/tidss/tidss_oldi.c b/drivers/gpu/drm/tidss/tidss_oldi.c > new file mode 100644 > index 000000000000..fd96ca815542 > --- /dev/null > +++ b/drivers/gpu/drm/tidss/tidss_oldi.c > @@ -0,0 +1,568 @@ .. > + ret = drm_of_find_panel_or_bridge(child, OLDI_OURPUT_PORT, -1, > + &panel, &bridge); > + if (ret) { > + /* > + * Either there was no OLDI sink in the devicetree, or > + * the OLDI sink has not been added yet. In any case, > + * return. > + * We don't want to have an OLDI node connected to DSS > + * but not to any sink. > + */ > + if (ret != -EPROBE_DEFER) > + dev_err(tidss->dev, > + "no panel/bridge for OLDI%d. Error %d\n", > + oldi_instance, ret); just dev_err_probe > + goto err_put_node; > + } .. > + if (IS_ERR(oldi->io_ctrl)) { > + dev_err(oldi->dev, > + "%s: oldi%d syscon_regmap_lookup_by_phandle failed %ld\n", > + __func__, oldi_instance, PTR_ERR(oldi->io_ctrl)); > + ret = PTR_ERR(oldi->io_ctrl); dev_err_probe > + goto err_put_node; > + } > + > + oldi->s_clk = of_clk_get_by_name(child, "s_clk"); > + if (IS_ERR(oldi->s_clk)) { > + dev_err(oldi->dev, > + "%s: oldi%d Failed to get s_clk: %ld\n", > + __func__, oldi_instance, PTR_ERR(oldi->s_clk)); > + ret = PTR_ERR(oldi->s_clk); dev_err_probe In general, in this function, sometime you print an error and goto err_put_node, sometime you just goto err_put_node. Not sure what's the rationale on this. > + goto err_put_node; > + } > + > + /* Register the bridge. */ > + oldi->bridge.of_node = child; > + oldi->bridge.driver_private = oldi; > + oldi->bridge.funcs = &tidss_oldi_bridge_funcs; > + oldi->bridge.timings = &default_tidss_oldi_timings; > + > + tidss->oldis[tidss->num_oldis++] = oldi; > + oldi->tidss = tidss; > + > + drm_bridge_add(&oldi->bridge); > + } > + > +err_put_node: > + of_node_put(child); > + of_node_put(oldi_parent); > + return ret; > +} > diff --git a/drivers/gpu/drm/tidss/tidss_oldi.h b/drivers/gpu/drm/tidss/tidss_oldi.h > new file mode 100644 > index 000000000000..5ad02ddea11a > --- /dev/null > +++ b/drivers/gpu/drm/tidss/tidss_oldi.h > @@ -0,0 +1,73 @@ > +/* SPDX-License-Identifier: GPL-2.0-or-later */ > +/* > + * Copyright (C) 2023 - Texas Instruments Incorporated > + * > + * Aradhya Bhatia > + */ > + > +#ifndef __TIDSS_OLDI_H__ > +#define __TIDSS_OLDI_H__ > + > +#include > + > +#include "tidss_drv.h" > +#include "tidss_dispc.h" > + > +struct tidss_oldi; why do you need this here? > + > +/* OLDI Instances */ > +#define OLDI(n) n > + > +/* OLDI PORTS */ > +#define OLDI_INPUT_PORT 0 > +#define OLDI_OURPUT_PORT 1 > + > +/* OLDI Config Bits */ > +#define OLDI_ENABLE BIT(0) > +#define OLDI_MAP (BIT(1) | BIT(2) | BIT(3)) > +#define OLDI_SRC BIT(4) > +#define OLDI_CLONE_MODE BIT(5) > +#define OLDI_MASTERSLAVE BIT(6) > +#define OLDI_DEPOL BIT(7) > +#define OLDI_MSB BIT(8) > +#define OLDI_LBEN BIT(9) > +#define OLDI_LBDATA BIT(10) > +#define OLDI_DUALMODESYNC BIT(11) > +#define OLDI_SOFTRST BIT(12) > +#define OLDI_TPATCFG BIT(13) > + > +/* Control MMR Register */ > + > +/* Register offsets */ > +#define OLDI_PD_CTRL 0x100 > +#define OLDI_LB_CTRL 0x104 > + > +/* Power control bits */ > +#define OLDI_PWRDN_TX(n) BIT(n) > + > +/* LVDS Bandgap reference Enable/Disable */ > +#define OLDI_PWRDN_BG BIT(8) > + > +#define OLDI_IDLE_CLK_HZ 25000000 /*25 MHz */ this is used only on a single C files, move it there? I would consider this comment in general for this header file, from a quick check most of this is used only in tidss_oldi.c. Francesco