From patchwork Tue Dec 3 16:19:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11271549 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 31A05138C for ; Tue, 3 Dec 2019 16:19:31 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1AA8D2084F for ; Tue, 3 Dec 2019 16:19:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1AA8D2084F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 60BA06E845; Tue, 3 Dec 2019 16:19:30 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0DD3C6E844 for ; Tue, 3 Dec 2019 16:19:28 +0000 (UTC) Received: by mail-wr1-x444.google.com with SMTP id j42so4345238wrj.12 for ; Tue, 03 Dec 2019 08:19:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pvQehkVTnZhXOtbF2Az2asg2sLoVMRuQyXqH7URMAHM=; b=iHp+nlc9kwcyK0LA6sKK/RF7Y4lXxqbN+lH+Q1UMbsDsF+lHrNlgrvZt8Qr665wfM3 EvUPsKgATyPN/44UOXE6IVjdfxC1EdnQDest1FiQRQz6/h/vwMNAc2WNElzZKr7Q0HK2 o0GFzFkiZAyuiTiDrC1y1hQ2+M7NDWr/gjH+LPu3YNoUX55tiHdPakFMSyvOgG/1RlFM 3zs5AcNgtVRNfyFXnqDzFALs3cD7YgSdcyXFW66zLO/HDfr/eslSfch/QWUewHy2DG5f ulj3cWljEzAh7j7ZNXNxt5xO7+93kvCKeAkIoda+cuQPBRBtEHtOUBLVQRUocXvrfNwF oeRw== X-Gm-Message-State: APjAAAWUngpEZVs+gqIE1s3Cdao/xpvHBkLgZizwEh1G8mT0LRrGq5RK UkuQgSD8sslvBb0CKPyqUwFSSOp8Tbc= X-Google-Smtp-Source: APXvYqy+DcGAlAhe1ldzMVwN7qNiMU9+r376sbkbfD9Fshi4/avfLvvX5mcOke2PpX86Q3t2S3JqHg== X-Received: by 2002:adf:814c:: with SMTP id 70mr5814983wrm.157.1575389966593; Tue, 03 Dec 2019 08:19:26 -0800 (PST) Received: from localhost (pD9E518ED.dip0.t-ipconnect.de. [217.229.24.237]) by smtp.gmail.com with ESMTPSA id k13sm2901194wrx.59.2019.12.03.08.19.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2019 08:19:25 -0800 (PST) From: Thierry Reding To: Thierry Reding Subject: [PATCH v2 5/9] drm/tegra: sor: Implement system suspend/resume Date: Tue, 3 Dec 2019 17:19:10 +0100 Message-Id: <20191203161914.1312555-5-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191203161914.1312555-1-thierry.reding@gmail.com> References: <20191203161914.1312555-1-thierry.reding@gmail.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pvQehkVTnZhXOtbF2Az2asg2sLoVMRuQyXqH7URMAHM=; b=Mrhr+/Wn9ZoXUAeQh0b/8qtNuL4ue3b/8nabr8jiNHIXLbo3hN56imCCyjJOfDdzab IdiNTZEbydnQGfTNkmNJiRIyzZTxNiHICvxxdFq1i150uGN6O3ykVwVIBfEyneDxUQJ3 WIiTKS1oVmcY2dms0mmP9oeDNk32JgdtgjkE0ia75P/RpIalqMjUHzPuBmtNyNRRWP4a 2ZF4p0+bMrSbzS2hM0jJxe35/kpTM8NEnnvj69tsr4BzpmDHNYPFE/YG5MV7WeEhb4Fk EGwc7Hx0XPciwFIYbT+cMt9uAhXkEKLDBJglbKNQa5HFD11oKRJ0pgpCbCLl1UxzxXOM cSpw== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-tegra@vger.kernel.org, Daniel Vetter , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding Upon system suspend, make sure the +5V HDMI regulator is disabled. This avoids potentially leaking current to the HDMI connector. This also makes sure that upon resume the regulator is enabled again, which in some cases is necessary to properly restore the state of the supply on resume. Reviewed-by: Daniel Vetter Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/sor.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c index 615cb319fa8b..2200f4cd397a 100644 --- a/drivers/gpu/drm/tegra/sor.c +++ b/drivers/gpu/drm/tegra/sor.c @@ -3912,8 +3912,7 @@ static int tegra_sor_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM -static int tegra_sor_suspend(struct device *dev) +static int tegra_sor_runtime_suspend(struct device *dev) { struct tegra_sor *sor = dev_get_drvdata(dev); int err; @@ -3935,7 +3934,7 @@ static int tegra_sor_suspend(struct device *dev) return 0; } -static int tegra_sor_resume(struct device *dev) +static int tegra_sor_runtime_resume(struct device *dev) { struct tegra_sor *sor = dev_get_drvdata(dev); int err; @@ -3967,10 +3966,25 @@ static int tegra_sor_resume(struct device *dev) return 0; } -#endif + +static int tegra_sor_suspend(struct device *dev) +{ + struct tegra_sor *sor = dev_get_drvdata(dev); + + return regulator_disable(sor->hdmi_supply); +} + +static int tegra_sor_resume(struct device *dev) +{ + struct tegra_sor *sor = dev_get_drvdata(dev); + + return regulator_enable(sor->hdmi_supply); +} static const struct dev_pm_ops tegra_sor_pm_ops = { - SET_RUNTIME_PM_OPS(tegra_sor_suspend, tegra_sor_resume, NULL) + SET_RUNTIME_PM_OPS(tegra_sor_runtime_suspend, tegra_sor_runtime_resume, + NULL) + SET_SYSTEM_SLEEP_PM_OPS(tegra_sor_suspend, tegra_sor_resume) }; struct platform_driver tegra_sor_driver = {