Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp1393430lqh; Mon, 6 May 2024 06:36:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUawDLZh5pHiSNoJKtX6z578d56oDIhCNFUK/bBf+zs+J1mq5w7FzaS5ZsJAF+Lb5V/DOE7OKo6OcXsupHigKu9p5ziwLW4uXZYCK3IGw== X-Google-Smtp-Source: AGHT+IF+KhH6trxYIbzG0VB95exRzlfC6+AOS+76gYC+x583ujXTSFmaMacBmcMN320C4N5VicjM X-Received: by 2002:a05:6870:844f:b0:23c:58bb:be68 with SMTP id n15-20020a056870844f00b0023c58bbbe68mr13060941oak.6.1715002569585; Mon, 06 May 2024 06:36:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715002569; cv=pass; d=google.com; s=arc-20160816; b=Jq+0Xq7u2HF7yn/9IlkzsPIPsoM/sOxTNSNqE1FokLMvzshMKu7Px6xKF43PPzW8jh 8sgaFMI8cYujsGkBC8TY0yg9NNts31IYiZ8wIuifJL/Qt3/KrijahiV2S64mAPsdG7FI W3xg2CkMy3K97NQ0qAKZGO2FC12R3n3jneYBkfqrTKvNS4YZFV1LJn1sdCHpwyiq5KBi EFCgclTWSKJngowXYGFtHKsNa3P/4ws9R7sg5eZxMBxoE7qVtGIA5NA1f7vKGQBdBzx4 PQzmBSp8ptV0/OKZtmEeuTQpkSDWqf1l6aEyfZg3Cn2ux6BKwLnvpoA22Siln2ZMBiG8 RLRg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:from :dkim-signature; bh=fkXvm8K73uRGt43Fh5pP2CjGxAWo/753DWe98SqauEI=; fh=SuRMajwH7N2ZLVBLirbkCwTFKIhKCObxyHKAw4nU6hQ=; b=EfUgwoFCKzH5IsNKMj17Hw/NAGm/J63ZKEboKk9hr74I16dMWqkB/wWtlWQWsvqE8Z zX6At4vQWS+Xfe9aMz6RnRvxux0VztRgzvZ+E6+LwFGYQ2XMWEG1NDqNg0VE2F+0WFFo 0t+odMdBbOK//jrmkuUO2ui/skFZaya/Ig39X+JVrpckgjGnzfwpuU1UirJMOq/8dTnK bVeDjjaETQtPUOOX6ZH1eGua1PRrLNiIv2Es35+5/24BngaUf8sDVuSsmFHVpTg/Fnma rZmutfPXnu+MKbU8qjKMU4XKrbYnO7hUF3NpU8j0BuPxQU94Dj4EDpHGoXXD/yyzgi1y NxhA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="XtKnAA/X"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-169894-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169894-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id m124-20020a632682000000b00626c6ce1165si1971883pgm.743.2024.05.06.06.36.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 06:36:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-169894-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="XtKnAA/X"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-169894-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169894-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id DCFAA282E85 for ; Mon, 6 May 2024 13:36:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B3B927A15D; Mon, 6 May 2024 13:35:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XtKnAA/X" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 CF17078C9E for ; Mon, 6 May 2024 13:35:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715002503; cv=none; b=Sr9ZQV1QfvNKDib5m8BYASaa2cETCu1ZitZ7020wMWa40YVtlt3kqbk1FxOGGyXIoSwMlQPVQEpeIFCSJ+CPDcodM62X09csxkdkDs/Lb4uKyzcA9WFS2FdEdEQqaQGGxSy2iSfOeI1HMASO9V+KyduB46ulU3pHQbJqpYza7tg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715002503; c=relaxed/simple; bh=7KQKdwRJtBFZkLdfMhs2OLN3qUwlGvTF8MBUDqOjd3s=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=KHLsthptXWe7tsLOqF2mj8m6FMwU3biE1eDf0tZ2eUWKjC7Ld76oZxd3kF/VvCKFCMxelOFgL5hF9AsSSsIbdsSpb3+KuPrtvYl4YUW6t6p/U2uc1GqpZ6rf3AeG4XP7dQGdOAI40Lafi8F9iB3JQQCg/yDLwqWzQqYJj5bqm38= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XtKnAA/X; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C0E4C116B1; Mon, 6 May 2024 13:34:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715002503; bh=7KQKdwRJtBFZkLdfMhs2OLN3qUwlGvTF8MBUDqOjd3s=; h=From:Subject:Date:To:Cc:From; b=XtKnAA/XWOfsPqfFPNMzDVsGyICjYHcSlf8yN7QfZtjlSZqSiy5hAzHxSY8rsgFJw 3/hyujLhOEw1+5r+M6JvWl7pIFUa759fB+oMeFWlMjrnpyy/jbd6Wcgfw5Y7L8e4ew FOZG46X4xaoX09TdyFSn6ZQf1dSKkjYei64HiVGsq42hEqOtxuBnw7BwPEPZRpVhhy KTQDbLBkXcbirv4Ug2rw8AvhFbgFpQcT2myKjRx2vLHBf83Szm0wich1/Jp9Zq51Ge s0S261RfU+xxKJ0DjL64p/1LO0WzWkNKtRwEyPkWRG/lQJshAOVx0XKzGhpo1TToeS 9xAidLnwcpCgg== From: Michael Walle Subject: [PATCH 00/20] drm/bridge: tc358775: proper bridge bringup and code cleanup Date: Mon, 06 May 2024 15:34:29 +0200 Message-Id: <20240506-tc358775-fix-powerup-v1-0-545dcf00b8dd@kernel.org> 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="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAGXcOGYC/x2Myw5AMBAAf0X2bJOlreJXxEFY7IWm9Uoa/65xn ExmIgT2wgHaLILnS4LsW4Iiz2Bch21hlCkxlFRqMlThMSpTW2twlgfdfrM/HRo164ZIq8I2kFL nOel/2/Xv+wEve/DHZgAAAA== To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Chun-Kuang Hu , Philipp Zabel , Matthias Brugger , AngeloGioacchino Del Regno , Sam Ravnborg , Vinay Simha BN , Tony Lindgren Cc: Daniel Semkowicz , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Michael Walle X-Mailer: b4 0.12.4 This patchset fixes the bridge initialization according to the datasheet. Not sure how that even worked before. Maybe because the initialization was done prior to linux (?). The bridge has some peculiarities: (1) The reset has to be deasserted in LP-11 mode (2) For I2C access the bridge needs the DSI clock (3) The bridge has to be configured while the video stream is disabled. (4) The bridge has limitations on the display timings. In particular, the horizontal pulse width has to be at least 8 pixels wide and both the horizontal pulse width as well as the back porch has to be even. According to the datasheet the horizontal front porch as well but in line sync mode, this is ignored. Also line sync is the only supported mode for this bridge, therefore, the front porch is always ignored. The most controversial patch is probably "drm/bridge: add dsi_lp11_notify mechanism" which is needed for (1) above. Some time ago there was a series [1] to add a manual power-up, which was abandoned and which didn't suite the needs for this bridge anyway. Also, this will gradually change the tc_ prefix to tc358775_ while the functions are refactored. The bridge was successfully tested on a Mediatek MT8195 SoC with the following panels: - Innolux G101ICE - AUO G121EAN01.0 - Innolux G156HCE (dual-link LVDS) [1] https://lore.kernel.org/r/20231016165355.1327217-1-dmitry.baryshkov@linaro.org/ Signed-off-by: Michael Walle --- Michael Walle (20): drm/bridge: add dsi_lp11_notify mechanism drm/mediatek: dsi: provide LP-11 mode during .pre_enable drm/mediatek: dsi: add support for .dsi_lp11_notity() drm/bridge: tc358775: fix regulator supply id drm/bridge: tc358775: add crtc modes fixup drm/bridge: tc358775: redefine LV_MX() drm/bridge: tc358775: use regmap instead of open coded access functions drm/bridge: tc358775: remove error message if regulator is missing drm/bridge: tc358775: remove complex vsdelay calculation drm/bridge: tc358775: simplify lvds_link property drm/bridge: tc358775: reformat weird indentation drm/bridge: tc358775: correctly configure LVDS clock drm/bridge: tc358775: split the init code drm/bridge: tc358775: configure PLL depending on the LVDS clock drm/bridge: tc358775: dynamically configure DSI link settings drm/bridge: tc358775: use proper defines to configure LVDS timings drm/bridge: tc358775: move bridge power up/down into functions drm/bridge: tc358775: fix the power-up/down delays drm/bridge: tc358775: fix power-up sequencing drm/bridge: tc358775: use devm_drm_bridge_add() drivers/gpu/drm/bridge/Kconfig | 1 + drivers/gpu/drm/bridge/tc358775.c | 601 ++++++++++++++++++++----------------- drivers/gpu/drm/drm_bridge.c | 16 + drivers/gpu/drm/mediatek/mtk_dsi.c | 8 +- include/drm/drm_bridge.h | 12 + 5 files changed, 355 insertions(+), 283 deletions(-) --- base-commit: 9221b2819b8a4196eecf5476d66201be60fbcf29 change-id: 20240506-tc358775-fix-powerup-53f490043179