From patchwork Thu Nov 28 15:37:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11266291 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 1D98A14B7 for ; Thu, 28 Nov 2019 15:38:12 +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 054A521781 for ; Thu, 28 Nov 2019 15:38:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 054A521781 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 A0CD36E822; Thu, 28 Nov 2019 15:38:10 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6368689D67 for ; Thu, 28 Nov 2019 15:38:00 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id z3so31635813wru.3 for ; Thu, 28 Nov 2019 07:38:00 -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=0dzbVXJ7V8hcU1LtMIPexGVLsK0+2tdodZ/4GZpJrGQ=; b=UCvHa3QI+SSOV9zseWd3zN1CQOu33LthVBX8oLdEBlCBv8iA92gvJoCi0MCoiFvZAp eTwBCNsyf24xjjYXMW1ae33+zrSShNWegWKFLBXL3dPLwpJAny9DgN/xVjIRMw9mL7tv +iA5eTybStEACA90c6ctJJ4SAxl8vyiVQwuNuEvRiEiCv2r5T3p5toFxdoImgnaWfT7O kYvOhImJQnS4ty5g1tB+ttpC3+q2W8aB7TPxteq6tR6L9Vi8xFVEY1rIOSKC34M+mv1p KKVtsQBlRSt1xfLgE8UGcxEsv69u/Hkg29auqjr3rMO6ernThHUzse9iwfxHos3Wrswn 4Okg== X-Gm-Message-State: APjAAAV7qK8wtOVkzp+QnqpCyOVVmhMNCQ9d4C0jqf1zdb0hqSYJ55N6 hsjCs2XCLmRnNtRwkOV+EQG1P+ZXbaA= X-Google-Smtp-Source: APXvYqwN6jeHqpiergoAp6H44RRaiLz+Bep/6Nl1tHZ/cpDeXEHqkAVIY9PD5yeg/w5+Yv36571D4A== X-Received: by 2002:adf:f802:: with SMTP id s2mr17381533wrp.201.1574955478979; Thu, 28 Nov 2019 07:37:58 -0800 (PST) Received: from localhost (pD9E518ED.dip0.t-ipconnect.de. [217.229.24.237]) by smtp.gmail.com with ESMTPSA id q3sm1858695wrn.33.2019.11.28.07.37.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Nov 2019 07:37:58 -0800 (PST) From: Thierry Reding To: Thierry Reding Subject: [PATCH 8/9] drm/tegra: dpaux: Add missing runtime PM references Date: Thu, 28 Nov 2019 16:37:40 +0100 Message-Id: <20191128153741.2380419-9-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191128153741.2380419-1-thierry.reding@gmail.com> References: <20191128153741.2380419-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=0dzbVXJ7V8hcU1LtMIPexGVLsK0+2tdodZ/4GZpJrGQ=; b=WqZ/47EKwwoGBWxgT/2GeoCq0+nbfB28gH8NAOmaWg8LYI9qJGORY/MDy1ojv8+P38 AvNWstImqj2TYDREPetx+/GdEXvi+K81npK6H7j3fMrhLsQxuFQnQ2HW2y7DQ/h5cYQ+ MPJHNqxmCWDQVav3wIPaYhGVn5VJqEFUQ+snIlTO+A84tSHnbGpRSf4nYXQlUNgJf6Cg eYc3l7NeJSfXrBQDC5dwmFawt/Prsuxu/42NCoOVgTqvrzWs9vayr1VzFoXY/1VUKeRU rLjD6DeIr3/G+R7rHqo0ezvBQfUH850fgrY0kcPYjlx7JkVm/+YuAad3CoGDKOzhenkC bsiQ== 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 Ensure that a runtime PM reference is acquired each time the DPAUX registers are accessed. Otherwise the code may end up running without the controller being powered, out-of-reset or clocked in some corner cases, resulting in a crash. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/dpaux.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/tegra/dpaux.c b/drivers/gpu/drm/tegra/dpaux.c index 622cdf1ad246..4b2b86aed1a5 100644 --- a/drivers/gpu/drm/tegra/dpaux.c +++ b/drivers/gpu/drm/tegra/dpaux.c @@ -434,8 +434,13 @@ static int tegra_dpaux_set_mux(struct pinctrl_dev *pinctrl, unsigned int function, unsigned int group) { struct tegra_dpaux *dpaux = pinctrl_dev_get_drvdata(pinctrl); + int err; + + pm_runtime_get_sync(dpaux->dev); + err = tegra_dpaux_pad_config(dpaux, function); + pm_runtime_put(dpaux->dev); - return tegra_dpaux_pad_config(dpaux, function); + return err; } static const struct pinmux_ops tegra_dpaux_pinmux_ops = { @@ -809,15 +814,22 @@ enum drm_connector_status drm_dp_aux_detect(struct drm_dp_aux *aux) int drm_dp_aux_enable(struct drm_dp_aux *aux) { struct tegra_dpaux *dpaux = to_dpaux(aux); + int err; + + pm_runtime_get_sync(dpaux->dev); + err = tegra_dpaux_pad_config(dpaux, DPAUX_PADCTL_FUNC_AUX); + pm_runtime_put(dpaux->dev); - return tegra_dpaux_pad_config(dpaux, DPAUX_PADCTL_FUNC_AUX); + return err; } int drm_dp_aux_disable(struct drm_dp_aux *aux) { struct tegra_dpaux *dpaux = to_dpaux(aux); + pm_runtime_get_sync(dpaux->dev); tegra_dpaux_pad_power_down(dpaux); + pm_runtime_put(dpaux->dev); return 0; }