From patchwork Tue Dec 3 16:29:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11271601 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 9E3CE930 for ; Tue, 3 Dec 2019 16:30:04 +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 83B1A20675 for ; Tue, 3 Dec 2019 16:30:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 83B1A20675 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 6E81D6E9D2; Tue, 3 Dec 2019 16:30:03 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by gabe.freedesktop.org (Postfix) with ESMTPS id EE95F6E9D2 for ; Tue, 3 Dec 2019 16:30:01 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id q10so4397005wrm.11 for ; Tue, 03 Dec 2019 08:30:01 -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:mime-version :content-transfer-encoding; bh=zaSjdjjHF8C8+w85wefmLYd2L9dUshbd+yUVIXEIO0Q=; b=S0oV8u767JpbdxsmonMLWoyInLziLMfDVw6ApK+OvFvhJwT5GmUESGl/R9pUaLAl/L 0Qulg5LFVRN8SeYNoWxTIJ3KyYLwd1USO6FW7WsfCrnU7WmzSrFAqZ+vJeUmh4rZYxqm kWG5mfhErS4jjHX8NYS/mCXIbEV6bkALRFctLTQX4MJHqa7XHsCTyNICJdhAF/+pzowr YOQWtlB7u0PSMY9isSjkYppM2KkqYB2TQByZcHuI6NzmSNh85s+jq/NiuGybKXww1YCL VRCw3Yy5tTw3Psc5n0L5XnCmKkIfVfi0tvIZHInN9Iwxa0R1SRoLt/FCBK3+3nZ68yyj CD2A== X-Gm-Message-State: APjAAAUaQL24IDDBmZ65Cklq+On+qO1ga7nwsEERGNxKiA6sVhdMAaXA 8f5AzgM9SW3WoENZi/7UTzE= X-Google-Smtp-Source: APXvYqwNbpQvjg2dXko3xhzf7ho/KJI8CqjxHZ2JvEfhjHiV++UgmaGMUswDcW7mROEshIzY4/eeHA== X-Received: by 2002:adf:eb46:: with SMTP id u6mr6306849wrn.239.1575390600513; Tue, 03 Dec 2019 08:30:00 -0800 (PST) Received: from localhost (pD9E518ED.dip0.t-ipconnect.de. [217.229.24.237]) by smtp.gmail.com with ESMTPSA id l204sm3679609wmf.2.2019.12.03.08.29.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2019 08:29:58 -0800 (PST) From: Thierry Reding To: Thierry Reding Subject: [PATCH] drm/tegra: output: Implement system suspend/resume Date: Tue, 3 Dec 2019 17:29:57 +0100 Message-Id: <20191203162957.1467114-1-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 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:mime-version :content-transfer-encoding; bh=zaSjdjjHF8C8+w85wefmLYd2L9dUshbd+yUVIXEIO0Q=; b=FOkbWEz7emVE46TomWiu3oD36RAQzhv+zRD4kcD2pe2kkuHGTJhYAB/7/mFGX05apc KMsGkU3IqZ2qIOF1KDe1U6jQ+Qkwzj84PG3844NS8uIuWw8yFUhYNdWkhy/fwGaqqGjT TTcJNN2BJrW6mj5JWsCOu+7rdY9YlLA0cesSBh4k4tvuAOhosLwcWG3NQGUK4MKHf4k4 ZU2xpblt5XHui//mhXVdlDaAx5vwW0T7RpY/pqBTw0clzOmFSO8OhdULfRpkd7WM8CPk MLQRETB0DOD6LB1O+kwqkofmb7rfQ/9XkE4cVuKwg3HUdcw6IbilN6YD3dYKazEv0AZg zyTA== 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, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding Implement generic system suspend/resume functions that can be used with any output type. Currently this only implements disabling and enabling of the IRQ functionality across system suspend/resume. This prevents an interrupt from happening before the display driver has fully resumed. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/output.c | 16 ++++++++++++++++ drivers/gpu/drm/tegra/sor.c | 17 +++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c index 34373734ff68..57203030dd02 100644 --- a/drivers/gpu/drm/tegra/output.c +++ b/drivers/gpu/drm/tegra/output.c @@ -250,3 +250,19 @@ void tegra_output_find_possible_crtcs(struct tegra_output *output, output->encoder.possible_crtcs = mask; } + +int tegra_output_suspend(struct tegra_output *output) +{ + if (output->hpd_irq) + disable_irq(output->hpd_irq); + + return 0; +} + +int tegra_output_resume(struct tegra_output *output) +{ + if (output->hpd_irq) + enable_irq(output->hpd_irq); + + return 0; +} diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c index 200d99e17afe..572e18545505 100644 --- a/drivers/gpu/drm/tegra/sor.c +++ b/drivers/gpu/drm/tegra/sor.c @@ -3995,9 +3995,16 @@ static int tegra_sor_suspend(struct device *dev) struct tegra_sor *sor = dev_get_drvdata(dev); int err; + err = tegra_output_suspend(&sor->output); + if (err < 0) { + dev_err(dev, "failed to suspend output: %d\n", err); + return err; + } + if (sor->hdmi_supply) { err = regulator_disable(sor->hdmi_supply); if (err < 0) { + tegra_output_resume(&sor->output); return err; } } @@ -4016,6 +4023,16 @@ static int tegra_sor_resume(struct device *dev) return err; } + err = tegra_output_resume(&sor->output); + if (err < 0) { + dev_err(dev, "failed to resume output: %d\n", err); + + if (sor->hdmi_supply) + regulator_disable(sor->hdmi_supply); + + return err; + } + return 0; }