From mboxrd@z Thu Jan 1 00:00:00 1970 From: robin.murphy@arm.com (Robin Murphy) Date: Thu, 5 May 2016 19:01:17 +0100 Subject: [PATCH 2/2] drm: hdlcd: Suspend/resume only active crtcs In-Reply-To: <20160505170601.GP1286@phenom.ffwll.local> References: <759fe8d3dde95091a9df83018051cba00f494e1e.1462464611.git.robin.murphy@arm.com> <20160505170601.GP1286@phenom.ffwll.local> Message-ID: <572B8A6D.40405@arm.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hi Daniel, On 05/05/16 18:06, Daniel Vetter wrote: > On Thu, May 05, 2016 at 05:13:38PM +0100, Robin Murphy wrote: >> The current PM ops simply unconditionally enable/disable the HDLCD, >> which proves problematic when there is no display plugged in - since >> without a crtc the hardware itself is still in an uninitialised state, >> coming out of suspend results in it being enabled without a valid >> framebuffer address, which typically results in it trying to scan out >> from bus address 0 and flooding the system with error interrupts. >> >> Fix this by checking the crtc state on resume, and only enabling the >> hardware if it's actually supposed to be. For the sake of consistency, >> do the same on the suspend path as well, although there it's merely a >> case of skipping unnecessary work. >> >> CC: Liviu Dudau >> Signed-off-by: Robin Murphy >> --- >> drivers/gpu/drm/arm/hdlcd_crtc.c | 6 ++++-- >> 1 file changed, 4 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c b/drivers/gpu/drm/arm/hdlcd_crtc.c >> index fef1b04c2aab..bf6ff5e48adc 100644 >> --- a/drivers/gpu/drm/arm/hdlcd_crtc.c >> +++ b/drivers/gpu/drm/arm/hdlcd_crtc.c >> @@ -296,12 +296,14 @@ static struct drm_plane *hdlcd_plane_init(struct drm_device *drm) >> >> void hdlcd_crtc_suspend(struct drm_crtc *crtc) >> { >> - hdlcd_crtc_disable(crtc); >> + if (crtc->state->active) >> + hdlcd_crtc_disable(crtc); >> } >> >> void hdlcd_crtc_resume(struct drm_crtc *crtc) >> { >> - hdlcd_crtc_enable(crtc); >> + if (crtc->state->active) >> + hdlcd_crtc_enable(crtc); >> } > > If you use the atomic helpers to suspend/resume your entire display > pipeline these callbacks shouldn't even be needed at all. Tried just > removing them? I'll have to leave that in Liviu's hands as I know literally nothing about the relationship between platform PM ops and DRM helpers ;) My only motivation is for the arm64 hibernate support currently sat in -next for 4.7 to stop being broken on my Juno board by this. Robin. > -Daniel > >> >> int hdlcd_setup_crtc(struct drm_device *drm) >> -- >> 2.8.1.dirty >> >> _______________________________________________ >> dri-devel mailing list >> dri-devel at lists.freedesktop.org >> https://lists.freedesktop.org/mailman/listinfo/dri-devel > From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robin Murphy Subject: Re: [PATCH 2/2] drm: hdlcd: Suspend/resume only active crtcs Date: Thu, 5 May 2016 19:01:17 +0100 Message-ID: <572B8A6D.40405@arm.com> References: <759fe8d3dde95091a9df83018051cba00f494e1e.1462464611.git.robin.murphy@arm.com> <20160505170601.GP1286@phenom.ffwll.local> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8"; Format="flowed" Content-Transfer-Encoding: base64 Return-path: Received: from foss.arm.com (foss.arm.com [217.140.101.70]) by gabe.freedesktop.org (Postfix) with ESMTP id BBCC66EA14 for ; Thu, 5 May 2016 18:01:19 +0000 (UTC) In-Reply-To: <20160505170601.GP1286@phenom.ffwll.local> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: airlied@linux.ie, liviu.dudau@arm.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org List-Id: dri-devel@lists.freedesktop.org SGkgRGFuaWVsLAoKT24gMDUvMDUvMTYgMTg6MDYsIERhbmllbCBWZXR0ZXIgd3JvdGU6Cj4gT24g VGh1LCBNYXkgMDUsIDIwMTYgYXQgMDU6MTM6MzhQTSArMDEwMCwgUm9iaW4gTXVycGh5IHdyb3Rl Ogo+PiBUaGUgY3VycmVudCBQTSBvcHMgc2ltcGx5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mVsCg== From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755794AbcEESBV (ORCPT ); Thu, 5 May 2016 14:01:21 -0400 Received: from foss.arm.com ([217.140.101.70]:51165 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754074AbcEESBU (ORCPT ); Thu, 5 May 2016 14:01:20 -0400 Subject: Re: [PATCH 2/2] drm: hdlcd: Suspend/resume only active crtcs To: airlied@linux.ie, liviu.dudau@arm.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <759fe8d3dde95091a9df83018051cba00f494e1e.1462464611.git.robin.murphy@arm.com> <20160505170601.GP1286@phenom.ffwll.local> From: Robin Murphy Message-ID: <572B8A6D.40405@arm.com> Date: Thu, 5 May 2016 19:01:17 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <20160505170601.GP1286@phenom.ffwll.local> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Daniel, On 05/05/16 18:06, Daniel Vetter wrote: > On Thu, May 05, 2016 at 05:13:38PM +0100, Robin Murphy wrote: >> The current PM ops simply unconditionally enable/disable the HDLCD, >> which proves problematic when there is no display plugged in - since >> without a crtc the hardware itself is still in an uninitialised state, >> coming out of suspend results in it being enabled without a valid >> framebuffer address, which typically results in it trying to scan out >> from bus address 0 and flooding the system with error interrupts. >> >> Fix this by checking the crtc state on resume, and only enabling the >> hardware if it's actually supposed to be. For the sake of consistency, >> do the same on the suspend path as well, although there it's merely a >> case of skipping unnecessary work. >> >> CC: Liviu Dudau >> Signed-off-by: Robin Murphy >> --- >> drivers/gpu/drm/arm/hdlcd_crtc.c | 6 ++++-- >> 1 file changed, 4 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c b/drivers/gpu/drm/arm/hdlcd_crtc.c >> index fef1b04c2aab..bf6ff5e48adc 100644 >> --- a/drivers/gpu/drm/arm/hdlcd_crtc.c >> +++ b/drivers/gpu/drm/arm/hdlcd_crtc.c >> @@ -296,12 +296,14 @@ static struct drm_plane *hdlcd_plane_init(struct drm_device *drm) >> >> void hdlcd_crtc_suspend(struct drm_crtc *crtc) >> { >> - hdlcd_crtc_disable(crtc); >> + if (crtc->state->active) >> + hdlcd_crtc_disable(crtc); >> } >> >> void hdlcd_crtc_resume(struct drm_crtc *crtc) >> { >> - hdlcd_crtc_enable(crtc); >> + if (crtc->state->active) >> + hdlcd_crtc_enable(crtc); >> } > > If you use the atomic helpers to suspend/resume your entire display > pipeline these callbacks shouldn't even be needed at all. Tried just > removing them? I'll have to leave that in Liviu's hands as I know literally nothing about the relationship between platform PM ops and DRM helpers ;) My only motivation is for the arm64 hibernate support currently sat in -next for 4.7 to stop being broken on my Juno board by this. Robin. > -Daniel > >> >> int hdlcd_setup_crtc(struct drm_device *drm) >> -- >> 2.8.1.dirty >> >> _______________________________________________ >> dri-devel mailing list >> dri-devel@lists.freedesktop.org >> https://lists.freedesktop.org/mailman/listinfo/dri-devel >