Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2623055pxb; Sun, 17 Oct 2021 20:48:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkK8mSg4LjoryxVhLA9y1yatbrcv5kBxsfWTez6LS/6h2xL34+tkoPcBPZY95wAX5JGuiI X-Received: by 2002:a17:903:246:b0:13f:2ff9:8b93 with SMTP id j6-20020a170903024600b0013f2ff98b93mr25090167plh.54.1634528882436; Sun, 17 Oct 2021 20:48:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634528882; cv=none; d=google.com; s=arc-20160816; b=YvUkSlyr7kEWKEt+1Gmit4HAEOBRN/cndL5pbWtXq0mu7biZQA4/39CebO7fjrI13Z Kc1en5OIsgyWenKoRkhS9IinFECypIR93CWCPlEp/95UuSw2vdiXGzgIMHTEGZbLf8d0 9G/6QMfcwFLi2xT3M+R+QMsNn6v5LCMc2NNqLFHa5G7Il0w6kbklthCb12apTHA0e8Pf OZj5gwSZ1HWAU2ppsx8ymI1s1yV6+B8tuLbWMgO1x/kBgDtGtGIORMrROCl6L8GRRLyH XoiHuuDHFdAKHN3JGspatmt/J0OAA7MeeoMTtyudhHkn6Wo8d6lTIyMfaBQQ626h5dFJ nhRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=zrRCznlJOYFOwHtB4Fk0Bk1AwKEYLAP/XqnqyE3nR6k=; b=alQjleikKZ9i1hplolGeVaBKLq8MkIVImj3GiwJ6d+sVWTA/E9Liam/6fhRPv0hKFA X7QGnvzCBSAQcnvg3VwEn0jwSow9MC4ou67NvcGsA6wMgx9RUkstS4bsNeGep8U+250q sRXspB01rIftsQmOw97lFtW7p+nNY5BIWOLln0aDMXoByAPMCiBimjY+TurBFhfQwq87 BR/eHxThIuwoKT2EWNXud2p3nHBc46xmsqVhtXfI6QytUYpUh7+iEvAdVjcyMM+5PTgD AhPK0UtTjekonIxjSGpE2bm4W9gUMdMstyuQtK8ADM0JLb774hs36M8/qP36BctL1M+s 0BgA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b22si10950806pjz.98.2021.10.17.20.47.50; Sun, 17 Oct 2021 20:48:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242769AbhJQV56 (ORCPT + 98 others); Sun, 17 Oct 2021 17:57:58 -0400 Received: from gloria.sntech.de ([185.11.138.130]:54336 "EHLO gloria.sntech.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235265AbhJQV55 (ORCPT ); Sun, 17 Oct 2021 17:57:57 -0400 Received: from p508fd4f7.dip0.t-ipconnect.de ([80.143.212.247] helo=phil.localnet) by gloria.sntech.de with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mcE87-0004xA-He; Sun, 17 Oct 2021 23:55:43 +0200 From: Heiko Stuebner To: Brian Norris Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, Sandy Huang , Chen-Yu Tsai , Thomas Hebb , Brian Norris , stable@vger.kernel.org Subject: Re: [PATCH v3 2/4] drm/rockchip: dsi: Reconfigure hardware on resume() Date: Sun, 17 Oct 2021 23:55:42 +0200 Message-ID: <13120578.oI4PYoXzsg@phil> In-Reply-To: <20210928143413.v3.2.I4e9d93aadb00b1ffc7d506e3186a25492bf0b732@changeid> References: <20210928213552.1001939-1-briannorris@chromium.org> <20210928143413.v3.2.I4e9d93aadb00b1ffc7d506e3186a25492bf0b732@changeid> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Dienstag, 28. September 2021, 23:35:50 CEST schrieb Brian Norris: > Since commit 43c2de1002d2, we perform most HW configuration in the > bind() function. This configuration may be lost on suspend/resume, so we > need to call it again. That may lead to errors like this after system > suspend/resume: > > dw-mipi-dsi-rockchip ff968000.mipi: failed to write command FIFO > panel-kingdisplay-kd097d04 ff960000.mipi.0: failed write init cmds: -110 > > Tested on Acer Chromebook Tab 10 (RK3399 Gru-Scarlet). > > Note that early mailing list versions of this driver borrowed Rockchip's > downstream/BSP solution, to do HW configuration in mode_set() (which > *is* called at the appropriate pre-enable() times), not always though. In non-atomic settings .mode_set actually doesn't seem to be called every time. I've experienced this when drm disables atomic when X11 is running. So having real suspend/resume callbacks makes quite a lot of sense :-) Heiko > but that was > discarded along the way. I've avoided that still, because mode_set() > documentation doesn't suggest this kind of purpose as far as I can tell. > > Fixes: 43c2de1002d2 ("drm/rockchip: dsi: move all lane config except LCDC mux to bind()") > Cc: > Signed-off-by: Brian Norris > --- > > Changes in v3: > - New patch, to fix related PM issue discovered after patch 1 > > .../gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 37 +++++++++++++++++++ > 1 file changed, 37 insertions(+) > > diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c > index 45676b23c019..21c67343cc6c 100644 > --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c > +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c > @@ -268,6 +268,8 @@ struct dw_mipi_dsi_rockchip { > struct dw_mipi_dsi *dmd; > const struct rockchip_dw_dsi_chip_data *cdata; > struct dw_mipi_dsi_plat_data pdata; > + > + bool dsi_bound; > }; > > struct dphy_pll_parameter_map { > @@ -964,6 +966,8 @@ static int dw_mipi_dsi_rockchip_bind(struct device *dev, > goto out_pm_runtime; > } > > + dsi->dsi_bound = true; > + > return 0; > > out_pm_runtime: > @@ -983,6 +987,8 @@ static void dw_mipi_dsi_rockchip_unbind(struct device *dev, > if (dsi->is_slave) > return; > > + dsi->dsi_bound = false; > + > dw_mipi_dsi_unbind(dsi->dmd); > > clk_disable_unprepare(dsi->pllref_clk); > @@ -1277,6 +1283,36 @@ static const struct phy_ops dw_mipi_dsi_dphy_ops = { > .exit = dw_mipi_dsi_dphy_exit, > }; > > +static int __maybe_unused dw_mipi_dsi_rockchip_resume(struct device *dev) > +{ > + struct dw_mipi_dsi_rockchip *dsi = dev_get_drvdata(dev); > + int ret; > + > + /* > + * Re-configure DSI state, if we were previously initialized. We need > + * to do this before rockchip_drm_drv tries to re-enable() any panels. > + */ > + if (dsi->dsi_bound) { > + ret = clk_prepare_enable(dsi->grf_clk); > + if (ret) { > + DRM_DEV_ERROR(dsi->dev, "Failed to enable grf_clk: %d\n", ret); > + return ret; > + } > + > + dw_mipi_dsi_rockchip_config(dsi); > + if (dsi->slave) > + dw_mipi_dsi_rockchip_config(dsi->slave); > + > + clk_disable_unprepare(dsi->grf_clk); > + } > + > + return 0; > +} > + > +static const struct dev_pm_ops dw_mipi_dsi_rockchip_pm_ops = { > + SET_LATE_SYSTEM_SLEEP_PM_OPS(NULL, dw_mipi_dsi_rockchip_resume) > +}; > + > static int dw_mipi_dsi_rockchip_probe(struct platform_device *pdev) > { > struct device *dev = &pdev->dev; > @@ -1594,6 +1630,7 @@ struct platform_driver dw_mipi_dsi_rockchip_driver = { > .remove = dw_mipi_dsi_rockchip_remove, > .driver = { > .of_match_table = dw_mipi_dsi_rockchip_dt_ids, > + .pm = &dw_mipi_dsi_rockchip_pm_ops, > .name = "dw-mipi-dsi-rockchip", > }, > }; >