Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4182205rdh; Tue, 28 Nov 2023 14:22:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IGJjDDMg1cTTUueiPaYPCnrH5KFo0FaPeVFBaa8X3QJZQwYIcVfl/Y2IWgy3SVAsjWMyhfX X-Received: by 2002:a17:90b:1650:b0:280:29cd:4802 with SMTP id il16-20020a17090b165000b0028029cd4802mr16768747pjb.3.1701210136232; Tue, 28 Nov 2023 14:22:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701210136; cv=none; d=google.com; s=arc-20160816; b=dawmbhUpefLEhGUwEbgKDDlvU5VbD/murvgeIQ1FA6lVAAfCwqvyIu7syrkdHjSEEs RAKbQSAPaDRyRvHzpsMDMB6Hb2Iti8WsYk2niszGYc6itQdUOsm/LXDl/f9KjoBPZr9V jON/TWRGgJbOKCoikPWsQHE+0H92o3IDDg16xXNEZ99TJWZOtnXAne7xVBj9YE+tce/z hgfNdCXf7O1LeOxdts3QBtT78uR4mgEskUO0Kf4R++tbPySkghBjLeKqt+JVBRUR6qWP i/WqOvvgwAQCdAb7q+W3hdqkBV5cJKJ181k8E510gQiV8FM7m8RmD2Jafc0JaMyk6pMp /tcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Mk6ahWEiYW0EiuwZrrmCv2lSUHnUEn9tTh+rrhzL628=; fh=Gzb2h9KQzEyLYB0k9LvJNtnjgCUToZdceFwykSb4bew=; b=LKlF3SM8UGwfzoKkNfPQhwnqQfPt6dS2/g23+ggmhM/p/wLn7SZh8GEwEvSnMBk7si Jk2DiXM2J0U+vhrUPW96rgi9QQ/xNP+SA0MQd2U4wMa/JfNYsoMcUvP0A0pWJcTmizca 8NRVO2vJiI2K5icRkmBxaISlsMVBgkNq2S4yYIgZbpJzglLqGdF37uIxs1izPAKFLlIz v0PxuFbWd/7fmtmpnKdAZuxYTDioUN2S7Ft2NW8jdFxaIXkz+9I1U6C7m9zIGGxp8Njt aTwacWdlHRrW/TKkXrNLlB6Qmy3K2UHMIoSSoD5+fYCaYiQ/aG4UEEh3p30pX+QleKfk m+9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CPJ60wIr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id nu14-20020a17090b1b0e00b00285a3d6ee55si8897823pjb.27.2023.11.28.14.22.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 14:22:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CPJ60wIr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 2AE6A80AD10A; Tue, 28 Nov 2023 14:22:13 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376302AbjK1WV6 (ORCPT + 99 others); Tue, 28 Nov 2023 17:21:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346160AbjK1WV5 (ORCPT ); Tue, 28 Nov 2023 17:21:57 -0500 Received: from mail-yw1-x1133.google.com (mail-yw1-x1133.google.com [IPv6:2607:f8b0:4864:20::1133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42E36DA for ; Tue, 28 Nov 2023 14:22:03 -0800 (PST) Received: by mail-yw1-x1133.google.com with SMTP id 00721157ae682-5cc86fcea4fso50715197b3.3 for ; Tue, 28 Nov 2023 14:22:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701210122; x=1701814922; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Mk6ahWEiYW0EiuwZrrmCv2lSUHnUEn9tTh+rrhzL628=; b=CPJ60wIriA4tDS7bh/3cR8oqtsakjoexD5Gv8TPuNIJ/kd6A5yY8cPKEk/5CFyTL/R UXd5DzGw/NmDIkDihauo6wjvIeCxcwUErjcQgu+mSzjd8XtR3zF2Dq6nxJAkamJmbHgX RdepqwytgGeaqBtJK6XA0jyUl3wNtgiwOB/DEMW6eNFNnPbbs7Ael39nd8PzzxOJA/eb b6KyxMQQCOS6pH9NoAgg/TIyIjUc71uWph55W0paIXvolMiVvHXb9QixOP0efLtZrAhf jNEYW2Jn+WKaLLE4sD4aa+GEtLJxxFvK8T3EXmyJ9d5ND0Ury2csWiadICsChuMv+cTY rpvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701210122; x=1701814922; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Mk6ahWEiYW0EiuwZrrmCv2lSUHnUEn9tTh+rrhzL628=; b=kpaYNuNt67TfwLucQuArNf7S4wltMlhupXltiv7iV1byaxn4YMoAyw0pvRSmdUYn0n 0T4exK0A75g86ETbQidya3tXBQs4lfy6JKSRwJE18OX6WU/TeQKv+pGpwxPY6npE2Pld aq1eqoX3U9H855MA7qLABwIdSV362hMUZvin76XYR1UlIswK/Wv2c6ZhS5b4LWGwU+n8 dov2qWwsB1gg2z9YC0R/0FVx0PxYPKjiB5C5sm/vgWXfXOdo54psTa4T4v0wnIc/Oa1w WK01xAr9YY5LeldG1IqKwii1Gpnwac4IhLWfEF9h6sq2Blqtlm/Oh6F7xwxR1qQ5dfUW othQ== X-Gm-Message-State: AOJu0YzmPMruA3yNltCYaZfag38QW2a6T1HT7eHARtOQJc1WXyz0NB0o W92qA50+30MFpq6l6M6MYuU7ipdABIkACrLeiBbXrw== X-Received: by 2002:a0d:d40f:0:b0:5cb:accf:ff1d with SMTP id w15-20020a0dd40f000000b005cbaccfff1dmr15164526ywd.25.1701210122379; Tue, 28 Nov 2023 14:22:02 -0800 (PST) MIME-Version: 1.0 References: <20231127160658.2164612-1-mwalle@kernel.org> <14D9F495-425D-47FA-AD0D-F7299285936F@walle.cc> <5eeade839ad3f71e8976965ce6cf3ed2@walle.cc> In-Reply-To: <5eeade839ad3f71e8976965ce6cf3ed2@walle.cc> From: Dmitry Baryshkov Date: Wed, 29 Nov 2023 00:21:51 +0200 Message-ID: Subject: Re: [RFC PATCH 03/10] drm/mipi-dsi: add API for manual control over the DSI link power state To: Michael Walle Cc: Michael Walle , Laurent.pinchart@ideasonboard.com, andrzej.hajda@intel.com, dave.stevenson@raspberrypi.com, dianders@chromium.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, jernej.skrabec@gmail.com, jonas@kwiboo.se, konrad.dybcio@linaro.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, marex@denx.de, marijn.suijten@somainline.org, mripard@kernel.org, neil.armstrong@linaro.org, quic_abhinavk@quicinc.com, quic_jesszhan@quicinc.com, rfoss@kernel.org, sean@poorly.run, tzimmermann@suse.de, tony@atomide.com, alexander.stein@ew.tq-group.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 28 Nov 2023 14:22:13 -0800 (PST) On Wed, 29 Nov 2023 at 00:20, Michael Walle wrote: > > [sorry I fat fingered my former reply and converted all CCs to BCCs..] > > >> >> >> > DSI device lifetime has three different stages: > >> >> >> > 1. before the DSI link being powered up and clocking, > >> >> >> > 2. when the DSI link is in LP state (for the purpose of this question, > >> >> >> > this is the time between the DSI link being powered up and the video > >> >> >> > stream start) > >> >> >> > 3. when the DSI link is in HS state (while streaming the video). > >> >> >> > >> >> >> It's not clear to me what (2) is. What is the state of the clock and > >> >> >> data lanes? > >> >> > > >> >> > Clk an Data0 should be in the LP mode, ready for LP Data Transfer. > >> >> > >> >> Then this is somehow missing > >> >> https://docs.kernel.org/gpu/drm-kms-helpers.html#mipi-dsi-bridge-operation > >> >> > >> >> A DSI host should keep the PHY powered down until the pre_enable > >> >> operation > >> >> is called. All lanes are in an undefined idle state up to this point, > >> >> and > >> >> it must not be assumed that it is LP-11. pre_enable should initialise > >> >> the > >> >> PHY, set the data lanes to LP-11, and the clock lane to either LP-11 > >> >> or HS > >> >> depending on the mode_flag MIPI_DSI_CLOCK_NON_CONTINUOUS. > >> >> > >> >> So I don't think these three states are sufficient, see below, that > >> >> there > >> >> should be at least four. > >> > > >> >Which one is #4? > >> > >> enabled clock lane (HS mode), data lanes in LP-11 > > > > What is the purpose of such a mode? > > To repeat my first mail: Excuse me please, I either missed it, or forgot it. > > I'm facing similar issues with the tc358775 bridge. This bridge needs > to release its reset while both clock and data lanes are in LP-11 > mode. > But then it needs to be configured (via I2C) while the clock lane is > in enabled (HS mode), but the data lanes are still in LP-11 mode. This is quite an interesting requirement. For example, I'm not 100% sure whether we can get that done on our (msm) hosts. I need to double check that. What frequency is expected on the CLK lane? Can it be an arbitrary frequency or it should be the same freq as the one used later for the video transfer? > > Therefore, for the correct init sequence is: > (1) dsi host enables lanes, that is clock and data are in lp-11 > (2) dsi bridge driver releases reset of the bridge > (3) dsi host enables clock lane, leaves data lanes in lp-11 > (4) dsi bridge driver configures the bridge > (5) dsi host enables the video stream > (6) dsi bridge enables the output port of the bridge > > -michael > > >> >> > I don't think we support ULPS currently. > >> >> > > >> >> > > >> >> >> > >> >> >> I'm facing similar issues with the tc358775 bridge. This bridge needs > >> >> >> to release its reset while both clock and data lanes are in LP-11 > >> >> >> mode. > >> >> >> But then it needs to be configured (via I2C) while the clock lane is > >> >> >> in enabled (HS mode), but the data lanes are still in LP-11 mode. > >> >> >> > >> >> >> To me it looks like there is a fouth case then: > >> >> >> 1. unpowered > >> >> >> 2. DSI clock and data are in LP-11 > >> >> >> 3. DSI clock is in HS and data are in LP-11 > >> >> >> 4. DSI clock is in HS and data is in HS > >> >> >> > >> >> >> (And of course the bridge needs continuous clock mode). > >> >> >> > >> >> >> > Different DSI bridges have different requirements with respect to the > >> >> >> > code being executed at stages 1 and 2. For example several DSI-to-eDP > >> >> >> > bridges (ps8640, tc358767 require for the link to be quiet during > >> >> >> > reset time. > >> >> >> > The DSI-controlled bridges and DSI panels need to send some commands > >> >> >> > in stage 2, before starting up video > >> >> >> > > >> >> >> > In the DRM subsystem stage 3 naturally maps to the > >> >> >> > drm_bridge_funcs::enable, stage 1 also naturally maps to the > >> >> >> > drm_bridge_funcs::pre_enable. Stage 2 doesn't have its own place in > >> >> >> > the DRM call chain. > >> >> >> > Earlier we attempted to solve that using the pre_enable_prev_first, > >> >> >> > which remapped pre-enable callback execution order. However it has led > >> >> >> > us to the two issues. First, at the DSI host driver we do not know > >> >> >> > whether the panel / bridge were updated to use pre_enable_prev_first > >> >> >> > or not. Second, if the bridge has to perform steps during both stages > >> >> >> > 1 and 2, it can not do that. > >> >> >> > > >> >> >> > I'm trying to find a way to express the difference between stages 1 > >> >> >> > and 2 in the generic code, so that we do not to worry about particular > >> >> >> > DSI host and DSI bridge / panel peculiarities when implementing the > >> >> >> > DSI host and/or DSI panel driver. > >> >> >> > >> >> >> For now, I have a rather hacky ".dsi_lp11_notify" callback in > >> >> >> drm_bridge_funcs which is supposed to be called by the DSI host while > >> >> >> the > >> >> >> clock and data lanes are in LP-11 mode. But that is rather an RFC and > >> >> >> me > >> >> >> needing something to get the driver for this bridge working. Because > >> >> >> it's > >> >> >> badly broken. FWIW, you can find my work-in-progress patches at > >> >> >> https://github.com/mwalle/linux/tree/feature-tc358775-fixes > >> >> >> > >> >> >> -michael > >> >> >> > >> >> > > >> >> > > >> >> > -- > >> >> > With best wishes > >> >> > Dmitry > >> > > >> > > >> > > >> -- With best wishes Dmitry