Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp1178216lqb; Thu, 30 May 2024 02:38:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXD2YFZu/LHPNUoRVbFU6W5V6KSMrLp391W1LNoCCd9kXg0PauTSsrbK09WTP/TJWHJVumjQc0nmQfhv4MTRMWzOk770nqINvvX5NhygQ== X-Google-Smtp-Source: AGHT+IFUevd0L3LkcBcduamL0u54npjDao/MWR/kZ0ZUQcdo7IpZaTQoHPnd1FXA/zcU2LAlvcn9 X-Received: by 2002:a05:6808:3021:b0:3c9:a6fb:bda1 with SMTP id 5614622812f47-3d1dccb2f0fmr1735211b6e.32.1717061930158; Thu, 30 May 2024 02:38:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717061930; cv=pass; d=google.com; s=arc-20160816; b=Ho7d8YXAMYImj0UEgg4msnad3VLrEbUHxnyjNdQ4yNhJ3UvUJYEdMs7BK2Va0o1k2Z 6C+N09igCmyPguPSFmTvuO5HwEwaKlQlOlvRtFhzalEmcZlh4KmxTZoCntIStg9D2nVe 83ohV3unUwqkEPR4fVitakQBX7V+1FqYvMeKJn203qn1Y1BR8qRVQ1syKCnW40OM4PXL ibCYo2TDR+0rDnU/+h4wqhedYaQZzp6q3ioD4eIqFUBZSEAN8epvGkwtFLDNFOu6HGiz w8pZL0x/5ZjneLgClJjFT+mmy9lt+UgBetX6tf44Xc3jZQUe3OpJiR6ZJLwu1gB/Cw7v fCKg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=YGuptUSUi6PCUNFepUagbXGzpwxcwb18R5SXcLEni7Y=; fh=fWFkqWhkEWu3rFwNeYdXbOcQQfbvrHCRIs7r20HyHeE=; b=U/qIlBofjcnDxTrHCJkYwAC5J7WIGxjZs2vFgDtZ6gg9CsxRBzj6+//IiPOdZrrb2h NV8hevfNXC0pQpu0F+y2qvwzWGjKrTg87tCHz96XnAjElFiI5cVpB/0FyIOD+4m44Hzt dBrunGfmvrW5fdxnaXIaOr7iQTByx4JlOzhWO4zgncVxCRgkx+/BnkRWxsSdZz/7yU8F UcfoB9dpuaZeU8ElGroxU4ibloDszrUsVVEUU1ldFB9k+beIIoM5PA2axuMchKxrcIUu hf3yED+zNgUba/qq5/RzP1LH8X6xd9RdDo0cUy1xeDEgWYCjgVavI4oQssiCZn0d1HWg c/Kg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Oha8PQjl; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-195200-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195200-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6ad706e3811si110757276d6.172.2024.05.30.02.38.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 02:38:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-195200-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Oha8PQjl; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-195200-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195200-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com 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 CAA3C1C2091B for ; Thu, 30 May 2024 09:38:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0EB0217D368; Thu, 30 May 2024 09:37:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="Oha8PQjl" Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 54DE1155335 for ; Thu, 30 May 2024 09:37:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.248 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717061829; cv=none; b=YEXeSq3614Dv5bl0Int7edjRrLvAN5/Sk4MAkIcTx3rfULP1xT4FY1ArFk2/L6lq10qSEoBNzYVs3vgny/aYIp8yaYO6JeNTdB1B8xGZEDOXgljz1jLrzEUuQTFkoTsvf8U+rWlqsvZMv6EkG+qFxVuNBY432SYWb2SrzHQ6O/k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717061829; c=relaxed/simple; bh=ssOuzRZz0zhXC/m8+8KE9BJFHCMlcpA1tyE1pbyJusE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uBQbgBRFB7GXFilXlZUUGiIl2YyU8jvojKa30RVtISE7Irv1ybyS5G50Whv582NGK32K91kqgS0Sd0WGbS7l1+8JtheBGtlL/F/AD+sOMeocRGO+NFLZNOzuzumK5mmAl/iuEUkakkNM7MZMLpKGIfeP3txBqyY52loa4S9cgds= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=Oha8PQjl; arc=none smtp.client-ip=198.47.23.248 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 44U9adaM055589; Thu, 30 May 2024 04:36:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1717061799; bh=YGuptUSUi6PCUNFepUagbXGzpwxcwb18R5SXcLEni7Y=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Oha8PQjlfEDV/DcneNe98XC/EWOPzqWzol/JGg+cqwkLCyNmrBVKVF6rRTLq8pcRF XKnroqcEFsZxEg2l2+xbJaqD7QFTiBLd0xj7xe6rztoIURjMIDTwICXhZthI8L8B2R 4aBtO1yQPS6vomNMdolKStA5bNMuwHRG0wvM2wUw= Received: from DLEE105.ent.ti.com (dlee105.ent.ti.com [157.170.170.35]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 44U9ad0Y104087 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 30 May 2024 04:36:39 -0500 Received: from DLEE112.ent.ti.com (157.170.170.23) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Thu, 30 May 2024 04:36:38 -0500 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Thu, 30 May 2024 04:36:38 -0500 Received: from localhost (uda0496377.dhcp.ti.com [172.24.227.31]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 44U9abTP086477; Thu, 30 May 2024 04:36:38 -0500 From: Aradhya Bhatia To: Tomi Valkeinen , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Jyri Sarha , Thomas Zimmermann , David Airlie , Daniel Vetter CC: DRI Development List , Linux Kernel List , Sam Ravnborg , Thierry Reding , Kieran Bingham , Nishanth Menon , Vignesh Raghavendra , Praneeth Bajjuri , Udit Kumar , Devarsh Thakkar , Jayesh Choudhary , Jai Luthra , Aradhya Bhatia Subject: [PATCH v2 9/9] drm/bridge: cdns-dsi: Use pre_enable/post_disable to enable/disable Date: Thu, 30 May 2024 15:06:21 +0530 Message-ID: <20240530093621.1925863-10-a-bhatia1@ti.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240530093621.1925863-1-a-bhatia1@ti.com> References: <20240530093621.1925863-1-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-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 The cdns-dsi controller requires that it be turned on completely before the input DPI's source has begun streaming[0]. Not having that, allows for a small window before cdns-dsi enable and after cdns-dsi disable where the previous entity (in this case tidss's videoport) to continue streaming DPI video signals. This small window where cdns-dsi is disabled but is still receiving signals causes the input FIFO of cdns-dsi to get corrupted. This causes the colors to shift on the output display. The colors can either shift by one color component (R->G, G->B, B->R), or by two color components (R->B, G->R, B->G). Since tidss's videoport starts streaming via crtc enable hooks, we need cdns-dsi to be up and running before that. Now that the bridges are pre_enabled before crtc is enabled, and post_disabled after crtc is disabled, use the pre_enable and post_disable hooks to get cdns-dsi ready and running before the tidss videoport to get pass the color shift issues. [0]: See section 12.6.5.7.3 "Start-up Procedure" in J721E SoC TRM TRM Link: http://www.ti.com/lit/pdf/spruil1 Signed-off-by: Aradhya Bhatia --- .../gpu/drm/bridge/cadence/cdns-dsi-core.c | 32 +++---------------- 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c index 6a2223ecff7d..1eedc7053ef8 100644 --- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c +++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c @@ -656,8 +656,8 @@ cdns_dsi_bridge_mode_valid(struct drm_bridge *bridge, return MODE_OK; } -static void cdns_dsi_bridge_atomic_disable(struct drm_bridge *bridge, - struct drm_bridge_state *old_bridge_state) +static void cdns_dsi_bridge_atomic_post_disable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) { struct cdns_dsi_input *input = bridge_to_cdns_dsi_input(bridge); struct cdns_dsi *dsi = input_to_dsi(input); @@ -677,15 +677,6 @@ static void cdns_dsi_bridge_atomic_disable(struct drm_bridge *bridge, pm_runtime_put(dsi->base.dev); } -static void cdns_dsi_bridge_atomic_post_disable(struct drm_bridge *bridge, - struct drm_bridge_state *old_bridge_state) -{ - struct cdns_dsi_input *input = bridge_to_cdns_dsi_input(bridge); - struct cdns_dsi *dsi = input_to_dsi(input); - - pm_runtime_put(dsi->base.dev); -} - static void cdns_dsi_hs_init(struct cdns_dsi *dsi) { struct cdns_dsi_output *output = &dsi->output; @@ -755,8 +746,8 @@ static void cdns_dsi_init_link(struct cdns_dsi *dsi) dsi->link_initialized = true; } -static void cdns_dsi_bridge_atomic_enable(struct drm_bridge *bridge, - struct drm_bridge_state *old_bridge_state) +static void cdns_dsi_bridge_atomic_pre_enable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) { struct cdns_dsi_input *input = bridge_to_cdns_dsi_input(bridge); struct cdns_dsi *dsi = input_to_dsi(input); @@ -907,19 +898,6 @@ static void cdns_dsi_bridge_atomic_enable(struct drm_bridge *bridge, writel(tmp, dsi->regs + MCTL_MAIN_EN); } -static void cdns_dsi_bridge_atomic_pre_enable(struct drm_bridge *bridge, - struct drm_bridge_state *old_bridge_state) -{ - struct cdns_dsi_input *input = bridge_to_cdns_dsi_input(bridge); - struct cdns_dsi *dsi = input_to_dsi(input); - - if (WARN_ON(pm_runtime_get_sync(dsi->base.dev) < 0)) - return; - - cdns_dsi_init_link(dsi); - cdns_dsi_hs_init(dsi); -} - static u32 *cdns_dsi_bridge_get_input_bus_fmts(struct drm_bridge *bridge, struct drm_bridge_state *bridge_state, struct drm_crtc_state *crtc_state, @@ -968,9 +946,7 @@ static u32 *cdns_dsi_bridge_get_input_bus_fmts(struct drm_bridge *bridge, static const struct drm_bridge_funcs cdns_dsi_bridge_funcs = { .attach = cdns_dsi_bridge_attach, .mode_valid = cdns_dsi_bridge_mode_valid, - .atomic_disable = cdns_dsi_bridge_atomic_disable, .atomic_pre_enable = cdns_dsi_bridge_atomic_pre_enable, - .atomic_enable = cdns_dsi_bridge_atomic_enable, .atomic_post_disable = cdns_dsi_bridge_atomic_post_disable, .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, -- 2.34.1