From patchwork Mon Oct 16 16:53:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 735822 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 AE511C41513 for ; Mon, 16 Oct 2023 16:56:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233675AbjJPQ4w (ORCPT ); Mon, 16 Oct 2023 12:56:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234160AbjJPQ4g (ORCPT ); Mon, 16 Oct 2023 12:56:36 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A62C1FFF for ; Mon, 16 Oct 2023 09:54:01 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-40572aeb6d0so46860375e9.1 for ; Mon, 16 Oct 2023 09:54:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697475240; x=1698080040; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FXcBslb1MNvlJH1zjcV0wxGhoCZ7RiOAEccFN8ak0qg=; b=YFovLDEXyDoGaIgb31uRr3rCTzXY2JY2mK4M62oxV7NpWWcaBO3vfyDgv6Gfgsh4Uh D4Tehyq6kFV+cvNVASguvPIeRMSxmzB3cmbkaF+HWY29gwhW5cyz8ZnApFIkViCWzEGr x9lXv47nNFzC6c4AH+F+2vuYl1yoD/cCAMihMYhrwSn2gmew5jUYy3UTYre99LQ+tXEn EbW1aA26dm35qeTilpp/K19Ze4g2wxIcj3w2/lpfx1KBphiIAR/QNk2dvwjDprM3eAxX LqxuRFQR2X0e0MlxyjYCXJWy66dt1aa3o0Cu34IG36xymVqwXEYA3zPehMzCo2OZxCmh x4nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697475240; x=1698080040; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FXcBslb1MNvlJH1zjcV0wxGhoCZ7RiOAEccFN8ak0qg=; b=ONJD/eJTnSXgMRrm5dzZ21c2yS2lKUJFrdrMaAO/QjPddYHavNX37tX4Vvk+XgBxNx D1UBlNGOTcEz/o7P6AiH/PE02AwXRtKbiFUGKFDOrkJW25HzkJmeHyEu1BCXQpbU6G3X 6IjaeaU6zkFlxj79b6MCQaZokDqnPFlVtBdcYA40agPc0aeYJWLY5/SU6kosNHZu/Lda R7rKlP6swV6Ri0zWiyjGBRWgxE23ZJ7IZcmXskHTK8ZcFIZRvBgKgMulahLnZ7szBEls aillSfEfMWkK0amgNJ4SVSmiuehD38CYAbJQ94Y8VAdtWUcgdEMoRRciC/ctn6bUIRRd Dm6w== X-Gm-Message-State: AOJu0Yyut/zvn19M7eAHaWhR9DgLzCdJjep13ABkuZAO7Zc0PO0LX2dP Qvf1o4C1GCgxmHBVOi0qEd6rvw== X-Google-Smtp-Source: AGHT+IHoONg9qNPiKGeTIHddHvmhDg1GDHSsCUAu6Z2s65378ibuLRfTX/M31ed4RtOSacgQiyUf0g== X-Received: by 2002:a1c:4b11:0:b0:405:3455:e1a3 with SMTP id y17-20020a1c4b11000000b004053455e1a3mr30359791wma.17.1697475240062; Mon, 16 Oct 2023 09:54:00 -0700 (PDT) Received: from eriador.lumag.spb.ru ([45.84.211.189]) by smtp.gmail.com with ESMTPSA id s19-20020a05600c45d300b0040648217f4fsm7638996wmo.39.2023.10.16.09.53.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 09:53:59 -0700 (PDT) From: Dmitry Baryshkov To: Dave Stevenson , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Douglas Anderson , Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , Konrad Dybcio , Jessica Zhang Cc: Marek Vasut , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [RFC PATCH 01/10] Revert "drm/bridge: tc358762: Split register programming from pre-enable to enable" Date: Mon, 16 Oct 2023 19:53:46 +0300 Message-ID: <20231016165355.1327217-2-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231016165355.1327217-1-dmitry.baryshkov@linaro.org> References: <20231016165355.1327217-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org It has been pointed out (e.g. in [1]) that enable is not the best place for sending the DSI commands. There are hosts (sunxi) that can not support sending DSI commands once video stream has enabled. Also most panel drivers send DSI commands in the prepare() callback (which maps to drm_bridg_funcs::pre_enable()). Thus the DSIM host should be fixed to be able to send DSI commands from pre_enable() state. [1] https://lore.kernel.org/dri-devel/CAPY8ntBrhYAmsraDqJGuTrSL6VjGXBAMVoN7xweV7E4qZv+v3Q@mail.gmail.com/ [2] https://github.com/torvalds/lincux/blob/master/include/drm/drm_mipi_dsi.h#L84-L87 Cc: Marek Vasut Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/bridge/tc358762.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358762.c b/drivers/gpu/drm/bridge/tc358762.c index 46198af9eebb..7b9f05f95fd1 100644 --- a/drivers/gpu/drm/bridge/tc358762.c +++ b/drivers/gpu/drm/bridge/tc358762.c @@ -185,17 +185,11 @@ static void tc358762_pre_enable(struct drm_bridge *bridge, struct drm_bridge_sta usleep_range(5000, 10000); } - ctx->pre_enabled = true; -} - -static void tc358762_enable(struct drm_bridge *bridge, struct drm_bridge_state *state) -{ - struct tc358762 *ctx = bridge_to_tc358762(bridge); - int ret; - ret = tc358762_init(ctx); if (ret < 0) dev_err(ctx->dev, "error initializing bridge (%d)\n", ret); + + ctx->pre_enabled = true; } static int tc358762_attach(struct drm_bridge *bridge, @@ -219,7 +213,6 @@ static void tc358762_bridge_mode_set(struct drm_bridge *bridge, static const struct drm_bridge_funcs tc358762_bridge_funcs = { .atomic_post_disable = tc358762_post_disable, .atomic_pre_enable = tc358762_pre_enable, - .atomic_enable = tc358762_enable, .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, .atomic_reset = drm_atomic_helper_bridge_reset, From patchwork Mon Oct 16 16:53:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 734065 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 EB71BCDB482 for ; Mon, 16 Oct 2023 16:56:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234442AbjJPQ4v (ORCPT ); Mon, 16 Oct 2023 12:56:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232802AbjJPQ4h (ORCPT ); Mon, 16 Oct 2023 12:56:37 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65BE4111A for ; Mon, 16 Oct 2023 09:54:03 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-40566f8a093so47088725e9.3 for ; Mon, 16 Oct 2023 09:54:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697475242; x=1698080042; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=y4YcpFsN2TSMs34leTZQIhhDmmY5p8SAeysdXXfcQJY=; b=bmNj056ztzl0VYdTedGhn+6dnUCqBbuUiOvKFOq+d9gOUdm9PHpQnVeCxaytmT7ikT 11ovGxEs7LoB3ArYNAy/yknDRIfv4I2crA8NlufsOXryCciNlXDzKPmTueoKDPuN8B5+ giMdp/Pd6JgKRqSUcZO0Weznbutm2KJIDm+/eGGwjANzDxCOZ7T7FacIGIsVzhDPQCkc FqnMLul7jH48ZUIxj7JAA1Wfef7LupIOsCcGXzxoYg4WPI8MOIVVTDhR6xq6DTLTWVY0 qZvvvqcjM6bAA0/XJVaFZLa8d3W7HNJiFjfA5HWap90bn30pQaxVFM/0nJJYs4Y+AiGZ l6UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697475242; x=1698080042; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=y4YcpFsN2TSMs34leTZQIhhDmmY5p8SAeysdXXfcQJY=; b=cKW/g2RCOI9Bhf3H8dLy6f+x+v5HlXYmADka1Kt5wkGD0DUqri2q6362omyMpmeiqH BWPFdpmMUEJppwB27ZrtvTppFJ3Aw5emh4G6ZPH9p/NgBQF9HwgYfRyBvbAiPVXE4tdP 5eXlTrOU9F/QftJANxKYW7Vh/5dJmwPxAmrMPiO2w/zurlJ5YGLORZA5WbkzS40InY+i 2IXUbfB60s9337swXewto3aho257k7Fgp7ifRuG5rn+5H++LSiOQBfckF0wvWNrZdWGC wybP1NcJrQYbMid3fZ9VAQGVpP1RTgC8sqUVYM5cbSz1H0zMAFDLT9ubqTOmcMnKmdYi 78Iw== X-Gm-Message-State: AOJu0Yw19sICQ8abpbUkudPAyo6KebJTrg8EfuWv71nApA9GXeHik563 SxoJltXAwYYWUjzK4+jxUq5b0w== X-Google-Smtp-Source: AGHT+IG9ptuOZK2qMMs221TBvhrKBhc0p1PMjKU8/S3TkYk4xU7qgakeBAb/XsiPpTTx7XzPxsCcZA== X-Received: by 2002:a7b:c394:0:b0:403:31a:77b9 with SMTP id s20-20020a7bc394000000b00403031a77b9mr30584923wmj.37.1697475241822; Mon, 16 Oct 2023 09:54:01 -0700 (PDT) Received: from eriador.lumag.spb.ru ([45.84.211.189]) by smtp.gmail.com with ESMTPSA id s19-20020a05600c45d300b0040648217f4fsm7638996wmo.39.2023.10.16.09.54.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 09:54:01 -0700 (PDT) From: Dmitry Baryshkov To: Dave Stevenson , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Douglas Anderson , Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , Konrad Dybcio , Jessica Zhang Cc: Marek Vasut , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [RFC PATCH 02/10] drm/mipi-dsi: document DSI hosts limitations Date: Mon, 16 Oct 2023 19:53:47 +0300 Message-ID: <20231016165355.1327217-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231016165355.1327217-1-dmitry.baryshkov@linaro.org> References: <20231016165355.1327217-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Document the known limititations of the DSI hosts vs commands transfers in LP mode. For the details see sun6i_dsi_encoder_enable(). Signed-off-by: Dmitry Baryshkov --- include/drm/drm_mipi_dsi.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h index c9df0407980c..167742e579e3 100644 --- a/include/drm/drm_mipi_dsi.h +++ b/include/drm/drm_mipi_dsi.h @@ -85,6 +85,10 @@ int mipi_dsi_create_packet(struct mipi_dsi_packet *packet, * host is in. Drivers that need the underlying device to be powered to * perform these operations will first need to make sure it's been * properly enabled. + * + * Note: some hosts (sunxi) can not send LP commands between HS video + * packets. Thus all DSI transfers sent in LP mode should be limited to the + * drm_bridge_funcs::pre_enable() and drm_panel_funcs::prepare() callbacks. */ struct mipi_dsi_host_ops { int (*attach)(struct mipi_dsi_host *host, From patchwork Mon Oct 16 16:53:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 735821 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 A8971CDB465 for ; Mon, 16 Oct 2023 16:56:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234382AbjJPQ4w (ORCPT ); Mon, 16 Oct 2023 12:56:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234371AbjJPQ4k (ORCPT ); Mon, 16 Oct 2023 12:56:40 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3285E1120 for ; Mon, 16 Oct 2023 09:54:05 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-40666aa674fso46986135e9.0 for ; Mon, 16 Oct 2023 09:54:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697475243; x=1698080043; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OLZfAioiQyP2GbHH4z94Kghh0UWm5WmSuFGJ712+5P8=; b=RxRgZE4sYeb4tEM3rATm0bRYUOboqRumrEcw4trJcYFi3YrOR3oQqnaVa0OxB0ijsx 0tKalTxlUAJwmw7+fWn6CqaZgnqtNfrpzyvmBiUqoMJ0zwvWcYw6g/Eng40gFTeRlEkp k3UNixOoWJVVjn/VkT3uz/4is9q4kBPbH+YksrTlCmjSh2em9ILiNRhmDiZ7QaNGjM9c iN9dlp39s3sji4zgMHnsLdSTTuvd/Yb0YUeDaMaQosJ+cBmnteq80XnabYt9uHiEwyFx qC5ISusovdfMfs9pAfUSJBpPcT68Rz8Zg3MZRNIRl5aR5RsQiRM3pCBzn9iWlb9kwwpz Ghsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697475243; x=1698080043; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OLZfAioiQyP2GbHH4z94Kghh0UWm5WmSuFGJ712+5P8=; b=JNuT8T0bUWgVhqZedGjntVSvKGdI8wtud+b6S4UTvrhYBejurVAqCPljyYFPSx/KIs KwLqed819ohoB4QgrGAuZDInTHj8K2OHHZgg5wupiDNaLFrcQpEHxcNS9+tvqO6JsrFe eKvG0ElSxuNNnn1j/vYDOSnLWxQpJvP7u4/oLnIsS7Ds62cKSXHvaiWy7fLoXsnafuHb dDknymxUJhIHAfDDCMlL8TCQP0TinbfAUHsWkd7UHZ36Y7pPqQnNbqYYb208A2LY4R5U WWr7pinjoAru67be/7niyW0ABnCTQygyJSTVmMhL45ZW0EMvOprRRsoqHzQOnbf7d6LZ 74bg== X-Gm-Message-State: AOJu0YyWgPqGHU/r47SwBgCOZ4ntbot70Fial7++1dCtIOdzrvzeUwIT CEyLnvOM51XYm63K/w7A3t3msQ== X-Google-Smtp-Source: AGHT+IEBvJ0AZHZOH5C1QXJLEQY2GElyolulqaAir+SIzHoMEpjQbAyxb+WOdlGZX6IRMJmT8vnGLw== X-Received: by 2002:a05:600c:2242:b0:401:be70:53b6 with SMTP id a2-20020a05600c224200b00401be7053b6mr30210769wmm.15.1697475243658; Mon, 16 Oct 2023 09:54:03 -0700 (PDT) Received: from eriador.lumag.spb.ru ([45.84.211.189]) by smtp.gmail.com with ESMTPSA id s19-20020a05600c45d300b0040648217f4fsm7638996wmo.39.2023.10.16.09.54.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 09:54:03 -0700 (PDT) From: Dmitry Baryshkov To: Dave Stevenson , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Douglas Anderson , Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , Konrad Dybcio , Jessica Zhang Cc: Marek Vasut , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [RFC PATCH 03/10] drm/mipi-dsi: add API for manual control over the DSI link power state Date: Mon, 16 Oct 2023 19:53:48 +0300 Message-ID: <20231016165355.1327217-4-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231016165355.1327217-1-dmitry.baryshkov@linaro.org> References: <20231016165355.1327217-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The MIPI DSI links do not fully fall into the DRM callbacks model. The drm_bridge_funcs abstraction. Instead of having just two states (off and on) the DSI hosts have separate LP-11 state. In this state the host is on, but the video stream is not yet enabled. Introduce API that allows DSI bridges / panels to control the DSI host power up state. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/drm_mipi_dsi.c | 31 +++++++++++++++++++++++++++++++ include/drm/drm_mipi_dsi.h | 29 +++++++++++++++++++++++++---- 2 files changed, 56 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c index 14201f73aab1..c467162cb7d8 100644 --- a/drivers/gpu/drm/drm_mipi_dsi.c +++ b/drivers/gpu/drm/drm_mipi_dsi.c @@ -428,6 +428,37 @@ int devm_mipi_dsi_attach(struct device *dev, } EXPORT_SYMBOL_GPL(devm_mipi_dsi_attach); +bool mipi_dsi_host_power_control_available(struct mipi_dsi_host *host) +{ + const struct mipi_dsi_host_ops *ops = host->ops; + + return ops && ops->power_up; +} +EXPORT_SYMBOL_GPL(mipi_dsi_host_power_control_available); + +int mipi_dsi_host_power_up(struct mipi_dsi_host *host) +{ + const struct mipi_dsi_host_ops *ops = host->ops; + + if (!mipi_dsi_host_power_control_available(host)) + return -EOPNOTSUPP; + + return ops->power_up ? ops->power_up(host) : 0; +} +EXPORT_SYMBOL_GPL(mipi_dsi_host_power_up); + +void mipi_dsi_host_power_down(struct mipi_dsi_host *host) +{ + const struct mipi_dsi_host_ops *ops = host->ops; + + if (!mipi_dsi_host_power_control_available(host)) + return; + + if (ops->power_down) + ops->power_down(host); +} +EXPORT_SYMBOL_GPL(mipi_dsi_host_power_down); + static ssize_t mipi_dsi_device_transfer(struct mipi_dsi_device *dsi, struct mipi_dsi_msg *msg) { diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h index 167742e579e3..e503c3e4d057 100644 --- a/include/drm/drm_mipi_dsi.h +++ b/include/drm/drm_mipi_dsi.h @@ -68,6 +68,8 @@ int mipi_dsi_create_packet(struct mipi_dsi_packet *packet, * @attach: attach DSI device to DSI host * @detach: detach DSI device from DSI host * @transfer: transmit a DSI packet + * @power_up: enable DSI link and bring it to the LP-11 state + * @power_down: fully disable DSI link * * DSI packets transmitted by .transfer() are passed in as mipi_dsi_msg * structures. This structure contains information about the type of packet @@ -81,10 +83,18 @@ int mipi_dsi_create_packet(struct mipi_dsi_packet *packet, * function will seldomly return anything other than the number of bytes * contained in the transmit buffer on success. * - * Also note that those callbacks can be called no matter the state the - * host is in. Drivers that need the underlying device to be powered to - * perform these operations will first need to make sure it's been - * properly enabled. + * Note: currently there are two modes of DSI power control. Legacy drivers + * will call those callbacks no matter the state the host is in. DSI host + * drivers that need the underlying device to be powered to perform these + * operations will first need to make sure it's been properly enabled. + * + * Newer drivers will set the @MIPI_DSI_MANUAL_POWERUP flag to indicate that + * they will call @mipi_dsi_power_up() and @mipi_dsi_power_down() to control + * the link state of the DSI host or they will set @MIPI_DSI_AUTO_POWERUP to + * indicate that the driver is fine with the link being powered up in DSI + * host's (atomic_)pre_enable() callback and then being disabled in the + * (atomic_)post_disable() callback. The transfer callback must only be called + * if the DSI host has been powered up and was not brought down. * * Note: some hosts (sunxi) can not send LP commands between HS video * packets. Thus all DSI transfers sent in LP mode should be limited to the @@ -97,6 +107,8 @@ struct mipi_dsi_host_ops { struct mipi_dsi_device *dsi); ssize_t (*transfer)(struct mipi_dsi_host *host, const struct mipi_dsi_msg *msg); + int (*power_up)(struct mipi_dsi_host *host); + void (*power_down)(struct mipi_dsi_host *host); }; /** @@ -143,6 +155,10 @@ struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node); #define MIPI_DSI_MODE_LPM BIT(11) /* transmit data ending at the same time for all lanes within one hsync */ #define MIPI_DSI_HS_PKT_END_ALIGNED BIT(12) +/* DSI peripheral driver manually controls DSI link powerup */ +#define MIPI_DSI_MANUAL_POWERUP BIT(13) +/* DSI peripheral driver is fine with automatic DSI link power control */ +#define MIPI_DSI_AUTO_POWERUP BIT(14) enum mipi_dsi_pixel_format { MIPI_DSI_FMT_RGB888, @@ -235,6 +251,11 @@ void mipi_dsi_device_unregister(struct mipi_dsi_device *dsi); struct mipi_dsi_device * devm_mipi_dsi_device_register_full(struct device *dev, struct mipi_dsi_host *host, const struct mipi_dsi_device_info *info); + +bool mipi_dsi_host_power_control_available(struct mipi_dsi_host *host); +int mipi_dsi_host_power_up(struct mipi_dsi_host *host); +void mipi_dsi_host_power_down(struct mipi_dsi_host *host); + struct mipi_dsi_device *of_find_mipi_dsi_device_by_node(struct device_node *np); int mipi_dsi_attach(struct mipi_dsi_device *dsi); int mipi_dsi_detach(struct mipi_dsi_device *dsi); From patchwork Mon Oct 16 16:53:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 734064 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 1161ECDB484 for ; Mon, 16 Oct 2023 16:56:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234135AbjJPQ4x (ORCPT ); Mon, 16 Oct 2023 12:56:53 -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 S234195AbjJPQ4k (ORCPT ); Mon, 16 Oct 2023 12:56:40 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B017113 for ; Mon, 16 Oct 2023 09:54:07 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-406650da82bso43826135e9.3 for ; Mon, 16 Oct 2023 09:54:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697475245; x=1698080045; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Gh1i1qC5dBtLH8fnR85p04AUelnLL/86pQbMA34ZucQ=; b=vzHcoHsLhS7Ac6lXY9AEuKugvuwVMLa/702wfzhO2OHGHKi92a1lWVDvVcE39Et4xE mmxy3c9tqYzuAj9FO6qTYdUUMNY6Mz6aAFrHYYZhEfWyqBQTZ7VOO/QRd393HiTkdW78 zFw8SkPNo8Vclboj6FXPIsWrKiKrvZ0wlRfSRm1/Q58jamBoexjbMh01OeUHxPcluZZP UadpRGfKMDdFd1pL4X5BobrqU5q8sbC7FE8D2lsKPfG/y8mTOONjQMpapdahirOAcuRZ CkTJk5PbL5UMu/woAY7hXO/Gw4mdT/7TXELSW5Mo5o/j0XS0gL2JIwTeeHgEd9zu6jzu EHUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697475245; x=1698080045; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Gh1i1qC5dBtLH8fnR85p04AUelnLL/86pQbMA34ZucQ=; b=K2gJ5bsp1eCwFncqCs7eIru3KYrpJ1ew5cjVF3j0W6UZStLUsXw7LgtT/x58J0J1do ctInLVProD4VQDmnsOEVpojAn+3y0tsD2KXyfGCU9zrn3/j5Oe7qjjqe20WpIJ/YVUjy EiBQoQwGYht/g+yJjTL//9OER5jaUEjFHdh7enXX2s1knJnM/BVIDX6EM5YLI5jzkP9K q+07Kmi589wQfMwjN9o5ktR8yJmWILKh+gIPY3CNQHNp9o1AbNtQkulZlv9FHYBtiLgP 2h5KJcrAcm5Q93BNQBTfejlACsS/er46xQObaycscO0TJ35KGZzT1Sf9Ix1Xl5aActir yR2A== X-Gm-Message-State: AOJu0YzCdKXPLuBxKtSkUsYCXW6JVUd3znOqGOqffuBKPr99B3J4eX7y yL1nN1hIcduB7G6/urw0CHMXzQ== X-Google-Smtp-Source: AGHT+IE0ZfNIwOf9qoBMcCLzP2Zitib4HQoRxmYe1CQIkuDQPdAYbM6sYWt+8StvzHVCWDqd+MMgNA== X-Received: by 2002:a7b:c419:0:b0:3fe:d630:f568 with SMTP id k25-20020a7bc419000000b003fed630f568mr29322698wmi.39.1697475245495; Mon, 16 Oct 2023 09:54:05 -0700 (PDT) Received: from eriador.lumag.spb.ru ([45.84.211.189]) by smtp.gmail.com with ESMTPSA id s19-20020a05600c45d300b0040648217f4fsm7638996wmo.39.2023.10.16.09.54.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 09:54:05 -0700 (PDT) From: Dmitry Baryshkov To: Dave Stevenson , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Douglas Anderson , Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , Konrad Dybcio , Jessica Zhang Cc: Marek Vasut , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [RFC PATCH 04/10] drm/msm/dsi: use dsi_mgr_bridge_power_off in dsi_mgr_bridge_post_disable Date: Mon, 16 Oct 2023 19:53:49 +0300 Message-ID: <20231016165355.1327217-5-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231016165355.1327217-1-dmitry.baryshkov@linaro.org> References: <20231016165355.1327217-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Simplify dsi_mgr_bridge_post_disable() by using dsi_mgr_bridge_power_off() instead of hand-coding the same call sequence. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/dsi/dsi_manager.c | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c index 896f369fdd53..9fa1f29ec11a 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c @@ -372,8 +372,10 @@ static void dsi_mgr_bridge_post_disable(struct drm_bridge *bridge) * It is safe to call dsi_mgr_phy_disable() here because a single PHY * won't be diabled until both PHYs request disable. */ - if (is_bonded_dsi && !IS_MASTER_DSI_LINK(id)) - goto disable_phy; + if (is_bonded_dsi && !IS_MASTER_DSI_LINK(id)) { + dsi_mgr_phy_disable(id); + return; + } ret = msm_dsi_host_disable(host); if (ret) @@ -385,26 +387,10 @@ static void dsi_mgr_bridge_post_disable(struct drm_bridge *bridge) pr_err("%s: host1 disable failed, %d\n", __func__, ret); } - msm_dsi_host_disable_irq(host); - if (is_bonded_dsi && msm_dsi1) - msm_dsi_host_disable_irq(msm_dsi1->host); - /* Save PHY status if it is a clock source */ msm_dsi_phy_pll_save_state(msm_dsi->phy); - ret = msm_dsi_host_power_off(host); - if (ret) - pr_err("%s: host %d power off failed,%d\n", __func__, id, ret); - - if (is_bonded_dsi && msm_dsi1) { - ret = msm_dsi_host_power_off(msm_dsi1->host); - if (ret) - pr_err("%s: host1 power off failed, %d\n", - __func__, ret); - } - -disable_phy: - dsi_mgr_phy_disable(id); + dsi_mgr_bridge_power_off(bridge); } static void dsi_mgr_bridge_mode_set(struct drm_bridge *bridge, From patchwork Mon Oct 16 16:53:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 735818 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 D3E41CDB483 for ; Mon, 16 Oct 2023 16:57:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234248AbjJPQ5B (ORCPT ); Mon, 16 Oct 2023 12:57:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233874AbjJPQ4l (ORCPT ); Mon, 16 Oct 2023 12:56:41 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4D42D65 for ; Mon, 16 Oct 2023 09:54:08 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-40684f53bfcso44071565e9.0 for ; Mon, 16 Oct 2023 09:54:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697475247; x=1698080047; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jimH2tfDdFWkB0SZHBV7Ktkx0rri8vXGCD3VUxA9GeA=; b=yHjvUQmxK1Kaums4YIdQCsa+OqESqk8P3PMH/OCkPUkgHlLNyJj39LqHFyVwGiHAMc qy3dMopCMCLyt1sYYCVnuqH7VsdaOaHJVvXasX+YeeUnGxJnxmptHWyjS2dm+1e1ucVL dxHKa7IiJZ1y1W3Xx+FpxVmcau4drvMksrYP8ceWYE8iN001oumg/2wdPPFOfE3gt8QY jClpyoP6+ITv05o++JvjzzANcaZaL3w79wltt2fdYd4I77e+IErkdASD4IbcQkxaQ7uJ 8dEwyIRu+FgbkUbga3nFxlfXlUZxG1r7MKwfVV0t0OCToLwrzMC/JHyIW6BX1FRgYJHf Ga4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697475247; x=1698080047; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jimH2tfDdFWkB0SZHBV7Ktkx0rri8vXGCD3VUxA9GeA=; b=QiFU9K+GNKur+p0LMV7qUGlTOKDtahbDbJvdkGgTmqIZVyP4Lv7Q+n/2FKCiFSfrlc kAzh941qsaejycxAw572Xn5Q/vKDA9yZ+Q3CEWuAeTeofvAxbrCRwjj4dtWQjbgZxqPv aEAJNB9g7etFuXnleo0+a6xOyiN/T0/nScRko17SzJbBDxIdV8fy3oW6H2TEoY6JEd12 olAUsY4CKz1I1Byw05qXYjPKl09ocC24cFP/n9lWZ6RX2pXFAev+S5nmgCYzWR5DQB7B tB0cgsYpHF53E8gq8bYyDIuO63THeDThCvw0NDjZ7ROBnbZzE437/VyhNo78dZDgsLQG vzXg== X-Gm-Message-State: AOJu0Yx9aUZxzMP8EhJqbsuQJ+lxkde0mwgjLGlSd+VOBlOK6cUgcM7w bfg8dtmTdYftPl7mbLOFWoFH8g== X-Google-Smtp-Source: AGHT+IFDCXD+4t3VPxLJVJO+pq+UmMCJZ9tCFqBC/3siQaBareVnnULXc6m32AkE8Mx8Tvt2g0WS8w== X-Received: by 2002:a05:600c:2a4e:b0:405:49aa:d578 with SMTP id x14-20020a05600c2a4e00b0040549aad578mr30626127wme.37.1697475247221; Mon, 16 Oct 2023 09:54:07 -0700 (PDT) Received: from eriador.lumag.spb.ru ([45.84.211.189]) by smtp.gmail.com with ESMTPSA id s19-20020a05600c45d300b0040648217f4fsm7638996wmo.39.2023.10.16.09.54.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 09:54:06 -0700 (PDT) From: Dmitry Baryshkov To: Dave Stevenson , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Douglas Anderson , Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , Konrad Dybcio , Jessica Zhang Cc: Marek Vasut , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [RFC PATCH 05/10] drm/msm/dsi: implement manual power control Date: Mon, 16 Oct 2023 19:53:50 +0300 Message-ID: <20231016165355.1327217-6-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231016165355.1327217-1-dmitry.baryshkov@linaro.org> References: <20231016165355.1327217-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Implement new API for tight control over the DSI link's power state. This allows bridge and panel drivers to send DSI commands at a proper time. Note, this also brings back the ps8640 workaround (to be removed later, once ps8640 driver sets up the MIPI_DSI_MANUAL_POWERUP flag).. We have to make sure that the DSI link stays disabled in case of this bridge, otherwise it will not work. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/dsi/dsi.h | 4 ++ drivers/gpu/drm/msm/dsi/dsi_host.c | 44 +++++++++++++++++ drivers/gpu/drm/msm/dsi/dsi_manager.c | 68 +++++++++++++++++++++++---- 3 files changed, 106 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h index a01c326774a6..e0ae2cb144de 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.h +++ b/drivers/gpu/drm/msm/dsi/dsi.h @@ -63,6 +63,8 @@ bool msm_dsi_manager_cmd_xfer_trigger(int id, u32 dma_base, u32 len); int msm_dsi_manager_register(struct msm_dsi *msm_dsi); void msm_dsi_manager_unregister(struct msm_dsi *msm_dsi); void msm_dsi_manager_tpg_enable(void); +int msm_dsi_manager_power_up(int id); +void msm_dsi_manager_power_down(int id); /* msm dsi */ static inline bool msm_dsi_device_connected(struct msm_dsi *msm_dsi) @@ -108,6 +110,8 @@ void msm_dsi_host_get_phy_clk_req(struct mipi_dsi_host *host, void msm_dsi_host_destroy(struct mipi_dsi_host *host); int msm_dsi_host_modeset_init(struct mipi_dsi_host *host, struct drm_device *dev); +bool msm_dsi_host_auto_powerup(struct mipi_dsi_host *host); +bool msm_dsi_host_early_powerup(struct mipi_dsi_host *host); int msm_dsi_host_init(struct msm_dsi *msm_dsi); int msm_dsi_runtime_suspend(struct device *dev); int msm_dsi_runtime_resume(struct device *dev); diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index fd2201cb62db..7010a6f17c5f 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -1671,10 +1671,54 @@ static ssize_t dsi_host_transfer(struct mipi_dsi_host *host, return ret; } +static bool msm_dsi_host_manual_powerup(struct mipi_dsi_host *host) +{ + struct msm_dsi_host *msm_host = to_msm_dsi_host(host); + + return msm_host->mode_flags & MIPI_DSI_MANUAL_POWERUP; +} + +bool msm_dsi_host_auto_powerup(struct mipi_dsi_host *host) +{ + struct msm_dsi_host *msm_host = to_msm_dsi_host(host); + + return msm_host->mode_flags & MIPI_DSI_AUTO_POWERUP; +} + +bool msm_dsi_host_early_powerup(struct mipi_dsi_host *host) +{ + struct msm_dsi_host *msm_host = to_msm_dsi_host(host); + + return !msm_dsi_host_manual_powerup(host) && + !msm_dsi_host_auto_powerup(host); +} + +static int msm_dsi_host_power_up(struct mipi_dsi_host *host) +{ + struct msm_dsi_host *msm_host = to_msm_dsi_host(host); + + if (msm_dsi_host_auto_powerup(host)) + return 0; + + return msm_dsi_manager_power_up(msm_host->id); +} + +static void msm_dsi_host_power_down(struct mipi_dsi_host *host) +{ + struct msm_dsi_host *msm_host = to_msm_dsi_host(host); + + if (!msm_dsi_host_manual_powerup(host)) + return; + + msm_dsi_manager_power_down(msm_host->id); +} + static const struct mipi_dsi_host_ops dsi_host_ops = { .attach = dsi_host_attach, .detach = dsi_host_detach, .transfer = dsi_host_transfer, + .power_up = msm_dsi_host_power_up, + .power_down = msm_dsi_host_power_down, }; /* diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c index 9fa1f29ec11a..2d7040d21239 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c @@ -198,6 +198,44 @@ static int dsi_mgr_bridge_get_id(struct drm_bridge *bridge) return dsi_bridge->id; } +/* + * If the next bridge in the chain is the Parade ps8640 bridge chip then don't + * power on early since it seems to violate the expectations of the firmware + * that the bridge chip is running. + */ +static bool dsi_mgr_next_is_ps8640(struct drm_bridge *bridge) +{ + struct drm_bridge *next_bridge = drm_bridge_get_next_bridge(bridge); + + return next_bridge && + next_bridge->of_node && + of_device_is_compatible(next_bridge->of_node, "parade,ps8640"); +} + +static bool dsi_mgr_auto_powerup(struct drm_bridge *bridge) +{ + int id = dsi_mgr_bridge_get_id(bridge); + struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); + struct mipi_dsi_host *host = msm_dsi->host; + + if (dsi_mgr_next_is_ps8640(bridge)) + return true; + + return msm_dsi_host_auto_powerup(host); +} + +static bool dsi_mgr_early_powerup(struct drm_bridge *bridge) +{ + int id = dsi_mgr_bridge_get_id(bridge); + struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); + struct mipi_dsi_host *host = msm_dsi->host; + + if (dsi_mgr_next_is_ps8640(bridge)) + return false; + + return msm_dsi_host_early_powerup(host); +} + static void msm_dsi_manager_set_split_display(u8 id) { struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); @@ -228,9 +266,8 @@ static void msm_dsi_manager_set_split_display(u8 id) } } -static int dsi_mgr_bridge_power_on(struct drm_bridge *bridge) +int msm_dsi_manager_power_up(int id) { - int id = dsi_mgr_bridge_get_id(bridge); struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); struct msm_dsi *msm_dsi1 = dsi_mgr_get_dsi(DSI_1); struct mipi_dsi_host *host = msm_dsi->host; @@ -240,6 +277,10 @@ static int dsi_mgr_bridge_power_on(struct drm_bridge *bridge) DBG("id=%d", id); + /* Do nothing with the host if it is slave-DSI in case of bonded DSI */ + if (is_bonded_dsi && !IS_MASTER_DSI_LINK(id)) + return 0; + ret = dsi_mgr_phy_enable(id, phy_shared_timings); if (ret) goto phy_en_fail; @@ -278,9 +319,8 @@ static int dsi_mgr_bridge_power_on(struct drm_bridge *bridge) return ret; } -static void dsi_mgr_bridge_power_off(struct drm_bridge *bridge) +void msm_dsi_manager_power_down(int id) { - int id = dsi_mgr_bridge_get_id(bridge); struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); struct msm_dsi *msm_dsi1 = dsi_mgr_get_dsi(DSI_1); struct mipi_dsi_host *host = msm_dsi->host; @@ -312,10 +352,12 @@ static void dsi_mgr_bridge_pre_enable(struct drm_bridge *bridge) if (is_bonded_dsi && !IS_MASTER_DSI_LINK(id)) return; - ret = dsi_mgr_bridge_power_on(bridge); - if (ret) { - dev_err(&msm_dsi->pdev->dev, "Power on failed: %d\n", ret); - return; + if (dsi_mgr_auto_powerup(bridge)) { + ret = msm_dsi_manager_power_up(id); + if (ret) { + dev_err(&msm_dsi->pdev->dev, "Power on failed: %d\n", ret); + return; + } } ret = msm_dsi_host_enable(host); @@ -337,7 +379,8 @@ static void dsi_mgr_bridge_pre_enable(struct drm_bridge *bridge) host1_en_fail: msm_dsi_host_disable(host); host_en_fail: - dsi_mgr_bridge_power_off(bridge); + if (dsi_mgr_auto_powerup(bridge)) + msm_dsi_manager_power_down(id); } void msm_dsi_manager_tpg_enable(void) @@ -390,7 +433,9 @@ static void dsi_mgr_bridge_post_disable(struct drm_bridge *bridge) /* Save PHY status if it is a clock source */ msm_dsi_phy_pll_save_state(msm_dsi->phy); - dsi_mgr_bridge_power_off(bridge); + if (dsi_mgr_auto_powerup(bridge) || + dsi_mgr_early_powerup(bridge)) + msm_dsi_manager_power_down(id); } static void dsi_mgr_bridge_mode_set(struct drm_bridge *bridge, @@ -411,6 +456,9 @@ static void dsi_mgr_bridge_mode_set(struct drm_bridge *bridge, msm_dsi_host_set_display_mode(host, adjusted_mode); if (is_bonded_dsi && other_dsi) msm_dsi_host_set_display_mode(other_dsi->host, adjusted_mode); + + if (dsi_mgr_early_powerup(bridge)) + msm_dsi_manager_power_up(id); } static enum drm_mode_status dsi_mgr_bridge_mode_valid(struct drm_bridge *bridge, From patchwork Mon Oct 16 16:53:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 734063 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 6E7B1CDB482 for ; Mon, 16 Oct 2023 16:56:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234499AbjJPQ4y (ORCPT ); Mon, 16 Oct 2023 12:56:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234349AbjJPQ4l (ORCPT ); Mon, 16 Oct 2023 12:56:41 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9114B324E for ; Mon, 16 Oct 2023 09:54:10 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-40566f8a093so47089995e9.3 for ; Mon, 16 Oct 2023 09:54:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697475249; x=1698080049; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AhGTCeJTgvu597dzkwlQwgzYcEyeuUmDXvIZAq5l/4I=; b=KIXmQqYeNZ+MQKazc4bVk01kpUUKf4aansqE25G3Y9+IaGJtwLEzmrQ91UzNhb5hA2 lO0u1A4BpsFA7AgwdgF6R1TJ1HSGfTs02FCtsIJElbx27a+d9pz0QM1Ilmlp/X4ZanX9 eDnDqDSr/P4mJF1cKtNwxKQKtGvtjfw/cUxp6FpowDpuI/ecljtUkS4s3JnFZ+DAIXKN RTypNew6bXAgjGBkLqIJQ/uWH4IZbMnRmOC0HTO70rfZAq/80oNFur/EiydrpmCIxkfI VNp1mGX5Rr9BjajfjS25mMA20jdKRxUaQ2t35YUGLmK/q61gK/RKlgUtIU4/3AFfLC5a 2QFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697475249; x=1698080049; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AhGTCeJTgvu597dzkwlQwgzYcEyeuUmDXvIZAq5l/4I=; b=PFAb72Os+PI5HUxDtI0WgOi5L8iXm6BXxl9y2hI+0yslhx+PPkUk1tn27xLNq6mWmm lAuRey7j8IU+fhTthlTTWMmg+pqCA37R7j+qROiU4XIAWohu9syD4+OMknaa1+JKgZXJ r1HKzAgyDpOzNpuWbvp3+ep/xdgWGYO9ms4eku7RFO/51HGHOK1guVzbAfs+JoYMVrER fRFydTSoVxFqussJX45q+Yn+POkiG0QqV3cpSuHN/ho/jE3kLGjBhznSZMU0Vm/BkkT3 zdf3bs//xUGUbGlcfu980TrvO6GB4QKisvlvVlMKvNaFad1xtD4XXg0gHvuzRuXLb1xH J9LA== X-Gm-Message-State: AOJu0Yz+NcP8rjghs/30+E3W6yTixXC4F1FoUqGAq7abMRwVsmEtNndP /o2OJhtjLfT2THt03O+vTqH2vg== X-Google-Smtp-Source: AGHT+IFMc1ydiV35u/i4xaIUD7bB3YsAkS433GNNfx1qmd94WFx7VWq0imHb4rjYzorutlJy9cRnjA== X-Received: by 2002:a05:600c:4f49:b0:407:8b61:da70 with SMTP id m9-20020a05600c4f4900b004078b61da70mr784351wmq.9.1697475248812; Mon, 16 Oct 2023 09:54:08 -0700 (PDT) Received: from eriador.lumag.spb.ru ([45.84.211.189]) by smtp.gmail.com with ESMTPSA id s19-20020a05600c45d300b0040648217f4fsm7638996wmo.39.2023.10.16.09.54.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 09:54:08 -0700 (PDT) From: Dmitry Baryshkov To: Dave Stevenson , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Douglas Anderson , Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , Konrad Dybcio , Jessica Zhang Cc: Marek Vasut , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [RFC PATCH 06/10] drm/bridge: tc358762: add support for manual DSI power control Date: Mon, 16 Oct 2023 19:53:51 +0300 Message-ID: <20231016165355.1327217-7-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231016165355.1327217-1-dmitry.baryshkov@linaro.org> References: <20231016165355.1327217-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Start migrating tc358762 bridge to new manual DSI power control API. If the tight power control is not available, default to the existing pre_enable_prev_first flag. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/bridge/tc358762.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/tc358762.c b/drivers/gpu/drm/bridge/tc358762.c index 7b9f05f95fd1..efb1da4487c9 100644 --- a/drivers/gpu/drm/bridge/tc358762.c +++ b/drivers/gpu/drm/bridge/tc358762.c @@ -72,6 +72,7 @@ struct tc358762 { struct device *dev; struct drm_bridge bridge; struct regulator *regulator; + struct mipi_dsi_host *dsi_host; struct drm_bridge *panel_bridge; struct gpio_desc *reset_gpio; struct drm_display_mode mode; @@ -163,6 +164,8 @@ static void tc358762_post_disable(struct drm_bridge *bridge, struct drm_bridge_s ctx->pre_enabled = false; + mipi_dsi_host_power_down(ctx->dsi_host); + if (ctx->reset_gpio) gpiod_set_value_cansleep(ctx->reset_gpio, 0); @@ -185,6 +188,10 @@ static void tc358762_pre_enable(struct drm_bridge *bridge, struct drm_bridge_sta usleep_range(5000, 10000); } + ret = mipi_dsi_host_power_up(ctx->dsi_host); + if (ret < 0) + dev_err(ctx->dev, "error powering up the DSI host (%d)\n", ret); + ret = tc358762_init(ctx); if (ret < 0) dev_err(ctx->dev, "error initializing bridge (%d)\n", ret); @@ -277,10 +284,16 @@ static int tc358762_probe(struct mipi_dsi_device *dsi) if (ret < 0) return ret; + ctx->dsi_host = dsi->host; + ctx->bridge.funcs = &tc358762_bridge_funcs; ctx->bridge.type = DRM_MODE_CONNECTOR_DPI; ctx->bridge.of_node = dev->of_node; - ctx->bridge.pre_enable_prev_first = true; + + if (mipi_dsi_host_power_control_available(dsi->host)) + dsi->mode_flags |= MIPI_DSI_MANUAL_POWERUP; + else + ctx->bridge.pre_enable_prev_first = true; drm_bridge_add(&ctx->bridge); From patchwork Mon Oct 16 16:53:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 735820 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 8EE85CDB484 for ; Mon, 16 Oct 2023 16:56:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234114AbjJPQ4y (ORCPT ); Mon, 16 Oct 2023 12:56:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234457AbjJPQ4l (ORCPT ); Mon, 16 Oct 2023 12:56:41 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B8053845 for ; Mon, 16 Oct 2023 09:54:12 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-4066241289bso49055605e9.0 for ; Mon, 16 Oct 2023 09:54:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697475250; x=1698080050; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tDlsbj0O4m938XJJJjIOKHw+A0HfBTEQDaR3qGbI7EM=; b=ebRdFCkTp69mnesA4vlUP9qPwXgAjbDp4ttEGNZADsJK35BzSGJpjHDA6dB6/IbUl8 3B7tBYYoe3uS+wQIHeyXN0EcdR2sFJU1cxV7sX21nhk+riZphRYMr200XHEkeeu3Axzx iDFVhkIm0Uh3t9bbBnWA4B+shgKFsONE1jjTmn2k2L5m7N37dSOej+B94a1noOPIEoNG PnoG3QjLrsw5OPp7qdnMGQGgmgelvKtvYAohwU3ggc2wsCTh11IsDutMQQJBFHXM42kL 0rMDZ4yF5V23jfH4u+pLiaNGgIvbZZC9uWDtk31IenfRM8rqhR7j1cyc2gsA22XKqQOp OCLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697475250; x=1698080050; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tDlsbj0O4m938XJJJjIOKHw+A0HfBTEQDaR3qGbI7EM=; b=qhY5SL8eFI58daHFakmPZbgG+WVPWqoTeu5z+F1hjJIi+MoD1snG5fUlmwFcXB0vZD XkB2kI0J5xWKX8HacEKJMzQbVBDjA73eVLmygbpk/qh4XwRCGaesQluKvb5sbDcpI1j5 E8kemljfuG0Ba5io+7AHYe7wxYvDbqAA4UJtutceektjIVTWPYHnD9kBY8lfBCIgZS+2 os6/dMEyH68gywR3mK8GiQpe/EFL7CtBXiwcVSI8EIvAqtXb73AIW/S+Unfg8uMS5ghl AX2hivm1qzytKxgtrkkW1oTGviC0PhKrxor+3TGRNoKZQZORe739zLIVh59h76ttvXGD wefA== X-Gm-Message-State: AOJu0YwEja1IgdYr+AdzYPkx449oEHNqJ/PJUCtrxHPNMBdok0u3JeUq mQAX3WnTEyTKmv+Rs1CR/E82oA== X-Google-Smtp-Source: AGHT+IHo4VTLj6QFSkMq4vzDZuAnsr0A18LuIJLePvTKSU99Hb1c9SVuY4KiSXHIr1fuYLLcUJPY5Q== X-Received: by 2002:a7b:c7d7:0:b0:3fd:2e89:31bd with SMTP id z23-20020a7bc7d7000000b003fd2e8931bdmr30618680wmk.14.1697475250508; Mon, 16 Oct 2023 09:54:10 -0700 (PDT) Received: from eriador.lumag.spb.ru ([45.84.211.189]) by smtp.gmail.com with ESMTPSA id s19-20020a05600c45d300b0040648217f4fsm7638996wmo.39.2023.10.16.09.54.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 09:54:10 -0700 (PDT) From: Dmitry Baryshkov To: Dave Stevenson , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Douglas Anderson , Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , Konrad Dybcio , Jessica Zhang Cc: Marek Vasut , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [RFC PATCH 07/10] drm/bridge: ps8640: require manual DSI power control Date: Mon, 16 Oct 2023 19:53:52 +0300 Message-ID: <20231016165355.1327217-8-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231016165355.1327217-1-dmitry.baryshkov@linaro.org> References: <20231016165355.1327217-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The Parade PS8640 bridge will fail to start if the DSI link is enabled when the bridge is being reset / powered up (even to the LP-11 state). To ensure that the DSI link is powered down, require manual control over the DSI link state. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/bridge/parade-ps8640.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/parade-ps8640.c b/drivers/gpu/drm/bridge/parade-ps8640.c index 8161b1a1a4b1..6c5daaa70cb7 100644 --- a/drivers/gpu/drm/bridge/parade-ps8640.c +++ b/drivers/gpu/drm/bridge/parade-ps8640.c @@ -458,6 +458,10 @@ static void ps8640_atomic_pre_enable(struct drm_bridge *bridge, ps8640_bridge_vdo_control(ps_bridge, ENABLE); + ret = mipi_dsi_host_power_up(ps_bridge->dsi->host); + if (ret < 0) + dev_warn(dev, "failed to power up DSI host: %d\n", ret); + ps_bridge->pre_enabled = true; } @@ -468,6 +472,8 @@ static void ps8640_atomic_post_disable(struct drm_bridge *bridge, ps_bridge->pre_enabled = false; + mipi_dsi_host_power_down(ps_bridge->dsi->host); + ps8640_bridge_vdo_control(ps_bridge, DISABLE); pm_runtime_put_sync_suspend(&ps_bridge->page[PAGE0_DP_CNTL]->dev); } @@ -562,6 +568,11 @@ static int ps8640_bridge_get_dsi_resources(struct device *dev, struct ps8640 *ps if (!host) return -EPROBE_DEFER; + if (!mipi_dsi_host_power_control_available(host)) { + dev_err(dev, "MIPI DSI host doesn't provide tight power control\n"); + return -ENODEV; + } + dsi = devm_mipi_dsi_device_register_full(dev, host, &info); if (IS_ERR(dsi)) { dev_err(dev, "failed to create dsi device\n"); @@ -572,7 +583,8 @@ static int ps8640_bridge_get_dsi_resources(struct device *dev, struct ps8640 *ps dsi->host = host; dsi->mode_flags = MIPI_DSI_MODE_VIDEO | - MIPI_DSI_MODE_VIDEO_SYNC_PULSE; + MIPI_DSI_MODE_VIDEO_SYNC_PULSE | + MIPI_DSI_MANUAL_POWERUP; dsi->format = MIPI_DSI_FMT_RGB888; dsi->lanes = NUM_MIPI_LANES; From patchwork Mon Oct 16 16:53:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 734062 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 630EDCDB474 for ; Mon, 16 Oct 2023 16:56:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229848AbjJPQ44 (ORCPT ); Mon, 16 Oct 2023 12:56:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231302AbjJPQ4m (ORCPT ); Mon, 16 Oct 2023 12:56:42 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A611C3860 for ; Mon, 16 Oct 2023 09:54:13 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4065dea9a33so45537745e9.3 for ; Mon, 16 Oct 2023 09:54:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697475252; x=1698080052; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7atWdHX87tg37dPcf4FsazD++qIF8t5k5lbbaEv6EjQ=; b=Uprv4Hn2IPCDeTaUEae+9zl2q9+xhk5RCmPvOG5bmHC0AIy3gLI8pjNUrs30Y6R4+r J64hKtTrOd6IgvFDXfG9JIIduVzcHoP3gbHUSNI6TuYCeO24AzPANLqeRpJEa9TYGAyM IocR6XGReWRJ09TOl47SokkVCj9ZUX1cGG8dJMJ04huJjkR6UmsIPBMh1/vBjB+NKHl0 5hyzkHbcGBcNSXwAfb5WzFw7LKdub1NxlE/DHXhwc1umcZRHntdDUaZn2Umg4w1aBruE cnY+I8kAkYuEbbahdrQR8BJdRZwYDm9NvxRsEKd1lOd3/EdPBvMt1zPCHZ5Rbxz41Nhw pIyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697475252; x=1698080052; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7atWdHX87tg37dPcf4FsazD++qIF8t5k5lbbaEv6EjQ=; b=nKMXjKVIVhuLLB43I3km8JrjInod84l5bs0viLjk8J7M35FZk4JszL3cpG8Q4OYZgM tHlzCh/hO1k8kj+jat5FnphAoGCcmdJRPEhOUibMHwM7rz6OpxGJZfrSPHU60Fi/B8LO AS2/DigpS0uKJV07jzqEKT8W8cwaPxosqF8uoUQ8Lis6IEZL4nsy9wxjaYa0hczlPWDh 9H97V54tIj1eUohwVBaVF4+Vh++6G0/rlYkkhVH4th3085KdU/jicYFBbgYjJ6PgSrSR ZJBIOiad32QtnWKWTUjktHMIcoDeQiiiy6Y5ZC+H3SZ69xxwInA/ewHvZN15aK+pJmKe 31Ow== X-Gm-Message-State: AOJu0Yxd6CPDUZxi2S3Rm9v9mJGNWjW93XG3wAUu2NjQVb7d/7hEtFw5 3GWJ7dzlG0EUSQt7C4bp8oF2pA== X-Google-Smtp-Source: AGHT+IFkELKtKgynuffB+oWpclXHrxccbH7YSTd/rxvV58WereDXS35Dcn2oCjeZlgI0vrzf+kaXkQ== X-Received: by 2002:a7b:c5c9:0:b0:403:272:4414 with SMTP id n9-20020a7bc5c9000000b0040302724414mr29903330wmk.0.1697475252155; Mon, 16 Oct 2023 09:54:12 -0700 (PDT) Received: from eriador.lumag.spb.ru ([45.84.211.189]) by smtp.gmail.com with ESMTPSA id s19-20020a05600c45d300b0040648217f4fsm7638996wmo.39.2023.10.16.09.54.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 09:54:11 -0700 (PDT) From: Dmitry Baryshkov To: Dave Stevenson , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Douglas Anderson , Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , Konrad Dybcio , Jessica Zhang Cc: Marek Vasut , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [RFC PATCH 08/10] drm/bridge: lt9611: mark for automatic DSI power control Date: Mon, 16 Oct 2023 19:53:53 +0300 Message-ID: <20231016165355.1327217-9-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231016165355.1327217-1-dmitry.baryshkov@linaro.org> References: <20231016165355.1327217-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The Lontium LT9611 driver doesn't need to control DSI power lines manually. Mark it for automatic power control. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/bridge/lontium-lt9611.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c index 9663601ce098..10b7093bd5c5 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c @@ -774,7 +774,7 @@ static struct mipi_dsi_device *lt9611_attach_dsi(struct lt9611 *lt9611, dsi->lanes = 4; dsi->format = MIPI_DSI_FMT_RGB888; dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE | - MIPI_DSI_MODE_VIDEO_HSE; + MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_AUTO_POWERUP; ret = devm_mipi_dsi_attach(dev, dsi); if (ret < 0) { From patchwork Mon Oct 16 16:53:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 735819 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 2F163CDB483 for ; Mon, 16 Oct 2023 16:57:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233853AbjJPQ46 (ORCPT ); Mon, 16 Oct 2023 12:56:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234215AbjJPQ4n (ORCPT ); Mon, 16 Oct 2023 12:56:43 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADFEC2132 for ; Mon, 16 Oct 2023 09:54:15 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-3248ac76acbso3918235f8f.1 for ; Mon, 16 Oct 2023 09:54:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697475254; x=1698080054; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zpGIiUMbok8vBwc13/k0XLEAhZoDX5uqz8AGagQ5Hmc=; b=rQ8QLDL2UJWSvpTZwfiKnAkE5JK5NclU0ZhgMbI0lPQgGYqrOb5yMq7qpHQbAJg3W5 tPyAcAqt44cuUfYIshdzRx8wbXK7HUE0oHuYw2LNG2FUeVSsyEetN/BAQIniZgKzu6ra fd+K+8LA9WKO47E9jxCVH724El3S/D5V1Ma23p3u9jKjBZCghWNo9wyUgXypWXPjpIxB xyMSG+BiSWBqk1fka1/Qop67koEA2wgiVZTMMiUkKJStXxkyyn5FtPMe1mGuG4CsReUg +5jZRWE6zbQSujcX+qIm7gA/ZF6oDWUqanKnbx6awvfjWESy7sUPdlXNdgEp4yHxRQ6U rQlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697475254; x=1698080054; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zpGIiUMbok8vBwc13/k0XLEAhZoDX5uqz8AGagQ5Hmc=; b=JSu2Vdxphlxi32+7kfKrVujzgbM5ura3bQiSB6Nct/euXzfp5PDn3mnAkBF/Z++xCX McApLvnDlP6vfQPkIo4NdpW2y1nJBPRL18E7XjvKsDAbctqVR39+iETDtNKl6zWkAgra tqeNTWART56GsVX3kyhfzSspz4lBOY/JpV2KltuzGExZv14Yw25ap9PhNGIclOeq3byn foEjpl5gwRBSS8S74RVAm+raCcbeD/FkwLFvn1BzOERa3+yfD2au1nUOn9QlKS/rz5tK YtONshdFnQ+9UGUWAFnblZX+oa9GjfL8Kws8gPH00PwU5QiJ8cWjHhgqDMdYT7WFvVwz AoZw== X-Gm-Message-State: AOJu0YxSJKQjEBPS+ym6MKgmaJpuXf0LZ98pY1ln5dsp6d0tGHoiCjIR h0pB0GU0O/6GNK2x1Nj7Olx7Fw== X-Google-Smtp-Source: AGHT+IGv6IJmbuk/e/mZEXSBzwHspez+g7aAQkIvi456hEyHQKQI7pI4oTBdD/5E0EVsTbEEtp3zKw== X-Received: by 2002:a05:6000:80a:b0:32d:857c:d51c with SMTP id bt10-20020a056000080a00b0032d857cd51cmr16399678wrb.43.1697475254257; Mon, 16 Oct 2023 09:54:14 -0700 (PDT) Received: from eriador.lumag.spb.ru ([45.84.211.189]) by smtp.gmail.com with ESMTPSA id s19-20020a05600c45d300b0040648217f4fsm7638996wmo.39.2023.10.16.09.54.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 09:54:13 -0700 (PDT) From: Dmitry Baryshkov To: Dave Stevenson , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Douglas Anderson , Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , Konrad Dybcio , Jessica Zhang Cc: Marek Vasut , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [RFC PATCH 09/10] drm/bridge: lt9611uxc: implement automatic DSI power control Date: Mon, 16 Oct 2023 19:53:54 +0300 Message-ID: <20231016165355.1327217-10-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231016165355.1327217-1-dmitry.baryshkov@linaro.org> References: <20231016165355.1327217-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The Lontium LT9611UXC driver doesn't need to control DSI power lines manually. Mark it for automatic power control. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/bridge/lontium-lt9611uxc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c index 7835738a532e..ace7a6ee890b 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c @@ -279,7 +279,7 @@ static struct mipi_dsi_device *lt9611uxc_attach_dsi(struct lt9611uxc *lt9611uxc, dsi->lanes = 4; dsi->format = MIPI_DSI_FMT_RGB888; dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE | - MIPI_DSI_MODE_VIDEO_HSE; + MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_AUTO_POWERUP; ret = devm_mipi_dsi_attach(dev, dsi); if (ret < 0) { From patchwork Mon Oct 16 16:53:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 734061 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 1EEEECDB482 for ; Mon, 16 Oct 2023 16:57:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234101AbjJPQ47 (ORCPT ); Mon, 16 Oct 2023 12:56:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234248AbjJPQ4n (ORCPT ); Mon, 16 Oct 2023 12:56:43 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF58B3C26 for ; Mon, 16 Oct 2023 09:54:17 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-40572aeb6d0so46864755e9.1 for ; Mon, 16 Oct 2023 09:54:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697475256; x=1698080056; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Z2KAQh5biIaDjy3JspEokfbAFpOptd05O572lVX96aY=; b=b16gH0mUBocs5VLOa0oKJnzWyP2wr6PBOpMJgT0H0PPo+joXWMArPcZs8zkRWZrjqP hlgpRPTum5bT+FO/P77WqYszXeXNIqZ/i2P5JIGakO8r2xsMw+ln7zsl2V/5XpRjtbjB xFz5ULF98c/nQOqFxLdUVeRHCvWPVOBO13hSg0mO9Zrmom2DTpnnt8HkCGGLuiqqQwss zVdMa8/WiPzc6ajsaNkfUlOY8UA+BfXOFnGVT4eSdtI7jLnshuWsf+3Um4XYQpzbgtyu kTY9J8/td9YqwKK5vlUx3Qz7a8RtPg0eeA9VLAzMLCiHLL96cEaVQWqLn62uE1ci4uR0 q39w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697475256; x=1698080056; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z2KAQh5biIaDjy3JspEokfbAFpOptd05O572lVX96aY=; b=Znit8/3GYWb/47hUDOtOfxQaTlJrncOoYtuxJR+Cnw/oZIfl4uEPpXYq0xlggA8Yna +1AP1rWBek7kEIffdLBhNjCEaKlxWWaTyx7WT/VyZwa259+RU9B6zguOtke29Vc36/dz 20w/AsSh6xbot9fzQ6xNE8+JPZoldyYtboxsijkoIDxk3FiSJ0rEIeGoTBiWvTx/k0CM W2/N4MEiN7vCdn0a19F+8HAQVH2QRQheDmB1Kq69AszuE9hMDY7XgLzFQqIq8nFS/m8K /hH6usNWqm+JkHO0GLhIzk/bSsICCYph6K756K8RWA90nIct6b5On2j1Qfc0Hb30JpnZ hzIA== X-Gm-Message-State: AOJu0YxINA8lEzqL1y4Ckt5XrDg64JLf/dSXH8fIggVe5J7m7EjNS2U6 gPdiS7gVlLV4fif2DidsC+27wQ== X-Google-Smtp-Source: AGHT+IEqmnobiCsIMYAdCDeaCtj3AGb0jtlboDlqcQ+Atx1a8i0m4PfESVkAoxvu6F9wIJAh3Bb39A== X-Received: by 2002:a1c:7711:0:b0:405:959e:dc7c with SMTP id t17-20020a1c7711000000b00405959edc7cmr29757671wmi.30.1697475256293; Mon, 16 Oct 2023 09:54:16 -0700 (PDT) Received: from eriador.lumag.spb.ru ([45.84.211.189]) by smtp.gmail.com with ESMTPSA id s19-20020a05600c45d300b0040648217f4fsm7638996wmo.39.2023.10.16.09.54.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 09:54:15 -0700 (PDT) From: Dmitry Baryshkov To: Dave Stevenson , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Douglas Anderson , Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , Konrad Dybcio , Jessica Zhang Cc: Marek Vasut , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [RFC PATCH 10/10] drm/msm/dsi: drop (again) the ps8640 workaround Date: Mon, 16 Oct 2023 19:53:55 +0300 Message-ID: <20231016165355.1327217-11-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231016165355.1327217-1-dmitry.baryshkov@linaro.org> References: <20231016165355.1327217-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Now as the Parade PS8640 driver sets the MIPI_DSI_MANUAL_POWERUP flag, drop the workaround enforcing the late DSI link powerup in the case the next bridge is ps8640. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/dsi/dsi_manager.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c index 2d7040d21239..b6b8171cf382 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c @@ -198,29 +198,12 @@ static int dsi_mgr_bridge_get_id(struct drm_bridge *bridge) return dsi_bridge->id; } -/* - * If the next bridge in the chain is the Parade ps8640 bridge chip then don't - * power on early since it seems to violate the expectations of the firmware - * that the bridge chip is running. - */ -static bool dsi_mgr_next_is_ps8640(struct drm_bridge *bridge) -{ - struct drm_bridge *next_bridge = drm_bridge_get_next_bridge(bridge); - - return next_bridge && - next_bridge->of_node && - of_device_is_compatible(next_bridge->of_node, "parade,ps8640"); -} - static bool dsi_mgr_auto_powerup(struct drm_bridge *bridge) { int id = dsi_mgr_bridge_get_id(bridge); struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); struct mipi_dsi_host *host = msm_dsi->host; - if (dsi_mgr_next_is_ps8640(bridge)) - return true; - return msm_dsi_host_auto_powerup(host); } @@ -230,9 +213,6 @@ static bool dsi_mgr_early_powerup(struct drm_bridge *bridge) struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); struct mipi_dsi_host *host = msm_dsi->host; - if (dsi_mgr_next_is_ps8640(bridge)) - return false; - return msm_dsi_host_early_powerup(host); }