Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp622907imm; Fri, 13 Jul 2018 03:35:19 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf4wStSBELxzAdms1NtaCvdpPGiIKQTVMU9JL0Yit1xXNTwjQGO+APt2URh18oJQ44/4Dje X-Received: by 2002:a62:2646:: with SMTP id m67-v6mr2957951pfm.254.1531478119084; Fri, 13 Jul 2018 03:35:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531478119; cv=none; d=google.com; s=arc-20160816; b=xmGgn1NswKWAilRZ9TZH9glk54/JcLvpxSkYloCi1T+5j8Pepn2HCheSnJreg4qr+p ivQ1YAfRrueHzNLccPl0Hv415neR0kk49bQsquIeIaOzsni1pAf409MDGw9JlH9j9DZL TsYMIHTIRukzUx3iW5J5P4tMbrn2steEXAUyA/aBXYf2IgNotSNKnxy+fKb4rxbRVBIX 3jhEOcPqT5gk4r2TPSfCFVWQpyixIkYOgeXo/6Q07g9xaz871uQjdoSWWZZamYY4smWZ 1dm2h7tPWRU5unMMbzdRdVXgjnCSeSa6bSI8zXLsIvhU6oarQ/XX35LU7mWp/ChTBrLg m/LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:arc-authentication-results; bh=WIjpAUXv9Q6sxpqXg6aqbfR4dfkvHaqJ7Kwr+UD365I=; b=KQ7qnfaIx0/RY4Pfq7TDaczHBlaYyBaQzABKsHGuEg0E10CHsQC58rP+48HvA3FqyA 1LBQ2spanKrLTCqkZBo4J0YCwP9D8B3rcOCoh8cXh4SlUgUYViPOE4H4z7FOaNzQmPYX QCNtZh8u99mxttFGwHnq1oUizxYp+PJFxfS2zLYmk14a/ifYy0vvFCmYUu6iqN0j2xOB iJw/CAkaUyMPqZq/uAO7QN8tWe5fnEk6wQJjaTdVcgoecbtgJ1ZzDwUJVsiAzBxQGd86 4nLOFz3toc406P+hRkmvcHbl39WNLF2CYXGFuCabkMWGKijVyvmMl8rBIqmj30DVweVL vksQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@agner.ch header.s=dkim header.b=GwtGACCQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c2-v6si21900207pge.124.2018.07.13.03.35.04; Fri, 13 Jul 2018 03:35:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@agner.ch header.s=dkim header.b=GwtGACCQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729644AbeGMKrn (ORCPT + 99 others); Fri, 13 Jul 2018 06:47:43 -0400 Received: from mail.kmu-office.ch ([178.209.48.109]:41518 "EHLO mail.kmu-office.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727147AbeGMKrn (ORCPT ); Fri, 13 Jul 2018 06:47:43 -0400 Received: from webmail.kmu-office.ch (unknown [IPv6:2a02:418:6a02::a3]) by mail.kmu-office.ch (Postfix) with ESMTPSA id B6C485C168B; Fri, 13 Jul 2018 12:33:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1531478016; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WIjpAUXv9Q6sxpqXg6aqbfR4dfkvHaqJ7Kwr+UD365I=; b=GwtGACCQfXCW7z/GUicFqOH9HPDSIRKkCC2L4pFzl22i/YzbvHYTjlR2nZHqVhE5VMI0K3 GGNjBXD62oM1Vn8X8bPbT6IdPrEvPjkpwJ90x8ryT9Kiw6nKGI0l8C51no9GO9wCdr08Z/ 5yj+zNQYOOmEsXUHokrlcSQCnhCNcTQ= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Date: Fri, 13 Jul 2018 12:33:36 +0200 From: Stefan Agner To: Marek Vasut Cc: Anson Huang , airlied@linux.ie, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, dl-linux-imx Subject: Re: [PATCH] drm: mxsfb: fix runtime PM handling In-Reply-To: <90d16681-2a7a-4826-0411-478353d2afe3@denx.de> References: <1531472085-25174-1-git-send-email-Anson.Huang@nxp.com> <90d16681-2a7a-4826-0411-478353d2afe3@denx.de> Message-ID: <00b5faf737efd1054eb4f0f0e6fc8369@agner.ch> X-Sender: stefan@agner.ch User-Agent: Roundcube Webmail/1.3.4 X-Spamd-Result: default: False [-3.10 / 15.00]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; MIME_GOOD(-0.10)[text/plain]; FROM_HAS_DN(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_ZERO(0.00)[0]; ASN(0.00)[asn:29691, ipnet:2a02:418::/29, country:CH]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%]; ARC_NA(0.00)[] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 13.07.2018 11:12, Marek Vasut wrote: > On 07/13/2018 11:06 AM, Anson Huang wrote: > [...] >>> >>> On 07/13/2018 10:54 AM, Anson Huang wrote: >>>> As display power domain is combined with lcdif node on some i.MX >>>> platforms like i.MX6SL, when lcdif driver is enabled, the mxsfb_load >>>> is called to enable runtime pm, and a pair of pm_runtime_get_sync and >>>> pm_runtime_put_sync are also called, that will cause generic power >>>> domain driver to disable lcdif power domain and lcdif is no longer >>>> working, the lcdif power should ONLY be turned off when display is >>>> disabled, so move the pm_runtime_put_sync to mxsfb_unload and remove >>>> the pm_runtime_get_sync in mxsfb_unload as well, in this way, when >>>> display is enabled, the lcdif power will be always ON until the >>>> display is disabled. >>>> >>>> Signed-off-by: Anson Huang >>> >>> Doesn't this also mean the block will always be on, thus wasting power ? >> >> I think drm driver should have somewhere to implement the display >> disable case, like when fb0 is blank (echo 1 > /sys/class/graphics/fb0/blank), > > Isn't this just the fbdev emulation on top of drm/kms ? > I think this stuff can be compiled out completely. > >> then lcdif can be powered gated, and >> when display is back on (unblank), lcdif needs to be re-initialization and display will >> be on, current implementation is incorrect, with kernel booting up, lcdif >> is NOT working at all. > > It works fine on MX6SX , so I think this is isolated to MX6SL ? > I'm CCing Stefan, he might have some valuable feedback here. > Yeah not sure, but putting it in mxsfb_load seems wrong. MXSFB uses struct drm_simple_display_pipe_funcs which does have enable/disable callbacks, probably closer to what we want... -- Stefan >> The runtime power gating case can be implemented later to save power, >> need lcdif experts to do it. Thanks. >> >> Anson. >> >>> >>>> --- >>>> drivers/gpu/drm/mxsfb/mxsfb_drv.c | 3 +-- >>>> 1 file changed, 1 insertion(+), 2 deletions(-) >>>> >>>> diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c >>>> b/drivers/gpu/drm/mxsfb/mxsfb_drv.c >>>> index ffe5137..1ba179b 100644 >>>> --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c >>>> +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c >>>> @@ -235,7 +235,6 @@ static int mxsfb_load(struct drm_device *drm, >>>> unsigned long flags) >>>> >>>> pm_runtime_get_sync(drm->dev); >>>> ret = drm_irq_install(drm, platform_get_irq(pdev, 0)); >>>> - pm_runtime_put_sync(drm->dev); >>>> >>>> if (ret < 0) { >>>> dev_err(drm->dev, "Failed to install IRQ handler\n"); @@ -264,6 >>>> +263,7 @@ static int mxsfb_load(struct drm_device *drm, unsigned long >>>> flags) >>>> err_irq: >>>> drm_panel_detach(mxsfb->panel); >>>> err_vblank: >>>> + pm_runtime_put_sync(drm->dev); >>>> pm_runtime_disable(drm->dev); >>>> >>>> return ret; >>>> @@ -279,7 +279,6 @@ static void mxsfb_unload(struct drm_device *drm) >>>> drm_kms_helper_poll_fini(drm); >>>> drm_mode_config_cleanup(drm); >>>> >>>> - pm_runtime_get_sync(drm->dev); >>>> drm_irq_uninstall(drm); >>>> pm_runtime_put_sync(drm->dev); >>>> >>>> >>> >>> >>> -- >>> Best regards, >>> Marek Vasut