Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2637438rda; Wed, 25 Oct 2023 08:16:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFx92Fzgag0GTLiGGw3362C634iYECYKb/O7tMllcXBvZ5yQcboFoAAWcNX5gQZ3hULqbhA X-Received: by 2002:a81:6d50:0:b0:5a7:c8d4:c254 with SMTP id i77-20020a816d50000000b005a7c8d4c254mr17937306ywc.0.1698247009005; Wed, 25 Oct 2023 08:16:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698247008; cv=none; d=google.com; s=arc-20160816; b=XLMct3ttdlOhKWPAyC8mFX/e8dVYJToBQc/aQZX46v8bwCHZvr430mLQGE7Co/R3lq D6JGbVMEqAZuj+hBkicbsN8E/9Zdupx7OwBVIJWxvQP2twmiABDqyfsaMCphnb8KE7Gr 9aaoll5l5VXzuUWjKDOSYR/Dlx7baME8vEDoSf0dG7kwwnrsDFRZdkcf1N+d5hfIEycG GzNzgVDJm9/aSJ9G+ASzm1ogmtDz+iAWkbCt2Umtnq2WgyU1mK99lhUSJR+GcQc/I9bU BcrK+Zu1P9B/zWVU6UGSrSg25gtO7PkrH8LgWkN5asixfTCUlO0JFGwLsJRAzq7OVnvZ prlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=Td1Qp2jEYN6EwIlzvrnD5w5N2Jcs878/iCYHd4DtvAU=; fh=HmfvRwlJJGSrlPnePxiXsW6Ad01CzFQSI43r0o4gKw8=; b=AbEQEXYWrno9fD7WOuJjPmS4lrG40SI9zoWbzAj/Zdf3A2L5HbL62E0HT1Yw1BsJKm CtM5xRU/LRgnzjicW7LK2iRt9fyRkTsckePVkyNzT2Y+1BICGhLmeaQIwce9wre48kyy QLLPJx+3IiFG/oT2j0Qy2fa8IJR39k1/S+K4/721JOftHpsbbMRvxocqbODIool+ZOvH xJSkCQt/G/drS0CBFOaF5OGZ5+k97Cs2q/Ints5Py0jJ2gA1qnajbBhdOJoUMPUd05TB XTRKYqH68nHLqF89ofX+ellRNnu2TRWfZ95OIidf9e84DmezoN5Bo7Dab9akteJ+sk8p 501g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RYTtR2L4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id l140-20020a0de292000000b005a7bff05e34si11383874ywe.418.2023.10.25.08.16.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 08:16:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RYTtR2L4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id DADE98077818; Wed, 25 Oct 2023 08:16:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344461AbjJYPQ1 (ORCPT + 99 others); Wed, 25 Oct 2023 11:16:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234998AbjJYPQV (ORCPT ); Wed, 25 Oct 2023 11:16:21 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B121412F for ; Wed, 25 Oct 2023 08:16:18 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-50816562320so1278868e87.3 for ; Wed, 25 Oct 2023 08:16:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698246977; x=1698851777; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Td1Qp2jEYN6EwIlzvrnD5w5N2Jcs878/iCYHd4DtvAU=; b=RYTtR2L4tFlYQ3scGGElZQQQhftT4CE1noUoGJUrjhZ4szOrhlp9n0+lSXolHNH2BK SD7cXuZqTDylTuVr4Qk99ZlpELLsOiiLc2XhJ+IqtMG/g/bLFuxklP2KmJkwrQUesMsQ PjBWW7ZmKU9oXdGaucYTdXeFUySJp+SxJeOn68Zln4ZILSoGcKVg4JICr5N0AcEKXplG T3ZF6zeLfvElI/riSwou5vp8H16BDx44LpSbqoeXLe5YnmCNerwI+b9xi6Jqltn0TKsP AvFn9EaOsxaBbsIiuchU+8DOiWFEuEgzPnM+lCNf8htl/g3KTPM2aBC5RWgBpqY6fkoF 7wSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698246977; x=1698851777; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Td1Qp2jEYN6EwIlzvrnD5w5N2Jcs878/iCYHd4DtvAU=; b=lq/N32xdIyZb7vhhhxZgxT7Qp8BSS4jqhuVIbXTUcX7AThG6ACHV+5SoRhCcsq6j6a b2rbd+cSsFx2+jx8kyWqbTUALi8e/zhSrcSi9DUUXAxitQ4m2hiJAnQUYCRk9K+YW/dS gH4EKikUkJK2OJg5f6F1Xx7p5BzyA1Q2BM6drUkHmFGURYqpPw6Y6FR9/FCp/2FkXNa+ wL1ikfGU5dJ2Cxgc1O7xs2syhaObggvQWRCM1HAY84DBefKVAaAhRiVi9YI0sBivswnj XN82pUaHltnAcSzyp16EVFjLXTmxLOEzBEwvqFg6nZzfM6RW8F84boPAqFvXmDLX0VsC 19Zg== X-Gm-Message-State: AOJu0YwAdnQk9i4dN6R0tJtLmbUSyGrBSga/39A2l3XhCc2OqVM+dUVx bprBWuA2lypXGHq5afLm702cnw== X-Received: by 2002:a05:6512:71:b0:507:a6b2:c63e with SMTP id i17-20020a056512007100b00507a6b2c63emr9706041lfo.53.1698246976791; Wed, 25 Oct 2023 08:16:16 -0700 (PDT) Received: from [192.168.1.212] ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id v26-20020ac258fa000000b00507a3b8b008sm2586135lfo.112.2023.10.25.08.16.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 25 Oct 2023 08:16:16 -0700 (PDT) Message-ID: <1696f131-83fb-4d0c-b4d7-0bdb61e4ae65@linaro.org> Date: Wed, 25 Oct 2023 18:16:14 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH 03/10] drm/mipi-dsi: add API for manual control over the DSI link power state Content-Language: en-GB To: Maxime Ripard Cc: Dave Stevenson , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Douglas Anderson , Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , Konrad Dybcio , Jessica Zhang , Marek Vasut , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org References: <20231016165355.1327217-1-dmitry.baryshkov@linaro.org> <20231016165355.1327217-4-dmitry.baryshkov@linaro.org> <7e4ak4e77fp5dat2aopyq3g4wnqu3tt7di7ytdr3dvgjviyhrd@vqiqx6iso6vg> From: Dmitry Baryshkov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Wed, 25 Oct 2023 08:16:44 -0700 (PDT) On 25/10/2023 15:44, Maxime Ripard wrote: > On Thu, Oct 19, 2023 at 02:19:51PM +0300, Dmitry Baryshkov wrote: >> On Thu, 19 Oct 2023 at 12:26, Maxime Ripard wrote: >>> >>> On Mon, Oct 16, 2023 at 07:53:48PM +0300, Dmitry Baryshkov wrote: >>>> The MIPI DSI links do not fully fall into the DRM callbacks model. >>> >>> Explaining why would help >> >> A kind of explanation comes afterwards, but probably I should change >> the order of the phrases and expand it: >> >> The atomic_pre_enable / atomic_enable and correspondingly >> atomic_disable / atomic_post_disable expect that the bridge links >> follow a simple paradigm: either it is off, or it is on and streaming >> video. Thus, it is fine to just enable the link at the enable time, >> doing some preparations during the pre_enable. >> >> But then it causes several issues with DSI. First, some of the DSI >> bridges and most of the DSI panels would like to send commands over >> the DSI link to setup the device. > > What prevent them from doing it in enable when the link is enabled? > >> Next, some of the DSI hosts have limitations on sending the commands. >> The proverbial sunxi DSI host can not send DSI commands after the >> video stream has started. Thus most of the panels have opted to send >> all DSI commands from pre_enable (or prepare) callback (before the >> video stream has started). > > I'm not sure we should account for a single driver when designing a > framework. We should focus on designing something sound, and then making > that driver work with whatever we designed, but not the other way > around. And if we can't, we should get rid of that driver because it's > de-facto unmaintainable. And I'm saying that as the author of that > driver. That's not the only driver with strange peculiarities. For example, see commit 8a4b2fc9c91a ("drm/bridge: tc358762: Split register programming from pre-enable to enable"), which was one of the issues that actually prompted me to send this this patchset (after my previous version of this patch being rejected because of sunxi). > >> However this leaves no good place for the DSI host to power up the DSI >> link. By default the host's pre_enable callback is called after the >> DSI bridge's pre_enable. For quite some time we were powering up the >> DSI link from mode_set. This doesn't look fully correct. > > Yeah, it's not. > >> And also we got into the issue with ps8640 bridge, which requires for >> the DSI link to be quiet / unpowered at the bridge's reset time. >> >> Dave has come with the idea of pre_enable_prev_first / >> prepare_prev_first flags, which attempt to solve the issue by >> reversing the order of pre_enable callbacks. This mostly solves the >> issue. However during this cycle it became obvious that this approach >> is not ideal too. There is no way for the DSI host to know whether the >> DSI panel / bridge has been updated to use this flag or not, see the >> discussion at [1]. > > Yeah. Well, that happens. I kind of disagree with Neil here though when > he says that "A panel driver should not depend on features of a DSI > controller". Panels definitely rely on particular features, like the > number of lanes, the modes supported, etc. In the mentioned discussion it was more about 'DSI host should not assume panel driver features', like the panel sending commands in pre_enable or not, or having pre_enable_prev_first. So the pre_enable_prev_first clearly lacks feature negotiation. > > Panels shouldn't depend on a particular driver *behaviour*. But the > features are fine. > > For our particular discussion, I think that that kind of discussion is a > dead-end, and we just shouldn't worry about it. Yes, some panels have > not yet been updated to take the new flags into account. However, the > proper thing to do is to update them if we see a problem with that (and > thus move forward to the ideal solution), not revert the beginning of > that feature enablement (thus moving away from where we want to end up > in). > >> Thus comes this proposal. It allows for the panels to explicitly bring >> the link up and down at the correct time, it supports automatic use >> case, where no special handling is required. And last, but not least, >> it allows the DSI host to note that the bridge / panel were not >> updated to follow new protocol and thus the link should be powered on >> at the mode_set time. This leaves us with the possibility of dropping >> support for this workaround once all in-kernel drivers are updated. > > I'm kind of skeptical for these kind of claims that everything will be > automatic and will be handled fine. What if we have conflicting > requirements, for example two bridges drivers that would request the > power up at different times? Well, we do not support DSI sublinks, do we? > > Also, we would still need to update every single panel driver, which is > going to create a lot of boilerplate that people might get wrong. Yes, quite unfortunately. Another approach that I have in mind is to add two callbacks to mipi_dsi_device. This way the DSI host will call into the device to initialise it once the link has been powered up and just before tearing it down. We solve a lot of problems this way, no boilerplate and the panel / bridge are in control of the initialisation procedure. WDYT? > I have the feeling that we should lay out the problem without talking > about any existing code base first. So, what does the MIPI-DSI spec > requires and what does panels and bridges expect? There is not that much in the DSI spec (or maybe I do not understand the question). The spec is more about the power states and the commands. Our problem is that this doesn't fully match kernel expectations. -- With best wishes Dmitry