Received: by 10.223.164.200 with SMTP id h8csp59397wrb; Sun, 5 Nov 2017 03:04:30 -0800 (PST) X-Google-Smtp-Source: ABhQp+Ttszo46/zTioqKMxlLLr0FmEk5F8gLNRI7IJ1l2PDXZUAhDv1Q6j0iMDLw0YPGlbL6K/qa X-Received: by 10.98.33.203 with SMTP id o72mr13421608pfj.41.1509879870434; Sun, 05 Nov 2017 03:04:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1509879870; cv=none; d=google.com; s=arc-20160816; b=noZ2WqQFMczuWFhw9VxFgfMViATIWFn7L8VnHvBy8RhElTwHZv7D5jGqlQMIN9+OXa danh9kb4bmCK/KnHaKb3K12zUucACT6URLrF+hEtODiy7srUTnb0RFzlloVUW+yoWe7Q TsSJGpCglOE8UCq2CnPrMla/tb+nVmJdapPkKNCKdvfjdM4MKbu1bPVjXy9N6cwvkHg3 PNFVlxY9d/NvVxowin7Q9WqXwnTL0deWLjOs2EsHVDPEr6j8G4JgAoKn44XGx4hGj0gy 1oDt7va1yW3eWfmNrEFXTG9qnY0pHLN66DroaudxCovijIt7sJNuL4Rgb3y3CdUXE/MS L9Pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=CWsxyfdJCqstKxXcnrc//Wp0J1KpOrvWAl9ZLCToXFY=; b=VJ1jfaD8LYAoXbcFoVtuBCCh4SpTQQSOedhVG0skNx5JaIRzRUiCBNtaH9LFnACQIG /A2BHLT6Mu0WXpUky4EQA44dOF3V3xVe7MSZ3DbAKWoIiBzAzmA1NGNZkoFPM9fzXdK9 bpR700lRofW9ZOQXAEBRxtV5unhBXTlLa+mBnABIAY385+W0iTRZMsio/zEsbOK/rxHi GTDltZQpoF7fFwvXpPVFjBzpRzW9aDO0xcSvxl52f7ha48J2TRe1Fb+w3Mt/9W6iLGi1 u8Rr/IoKF49Q/u3URz0bMpEsX5BUgT3ThIKMgq5W66cymzAwW/PnBkhoXuDbGzhcifXl tBlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kapsi.fi header.s=20161220 header.b=u45048fP; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h184si9409821pgc.288.2017.11.05.03.04.17; Sun, 05 Nov 2017 03:04:30 -0800 (PST) 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=@kapsi.fi header.s=20161220 header.b=u45048fP; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752844AbdKELCu (ORCPT + 96 others); Sun, 5 Nov 2017 06:02:50 -0500 Received: from mail.kapsi.fi ([91.232.154.25]:48722 "EHLO mail.kapsi.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751693AbdKELCE (ORCPT ); Sun, 5 Nov 2017 06:02:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kapsi.fi; s=20161220; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=CWsxyfdJCqstKxXcnrc//Wp0J1KpOrvWAl9ZLCToXFY=; b=u45048fPMqeZusfRlbSmLHgazwfqxMudOqS4c2Jjb3+vcLbebSUV/vdoE+8qSSzo7054yH4CAayAoYKgD2XAqosW1grlxgDgTqtGBUVshjDJ9Ngx8756z9iTe0iYzpo7fYfFrNXtSL8VMhBMZ9shXdCPOTD9vba5TWqGZQKFtPSoYQ+1k/sTbgfpxL9A/Ix+oXRD3zJJRLJpKz97aqO1hI9O5pMUe8QYH21+BPs23kGJll86MLvfyADM23tGI/uyqfC0UVITXwo4rw4LrhF2jYyohopJ2Macea1rkEzHXV7KuaEMngoiVI6xO0zUvuhoCq+9vLPz46Dse0XhOVIKjA==; Received: from dsl-hkibng22-54f983-249.dhcp.inet.fi ([84.249.131.249] helo=localhost.localdomain) by mail.kapsi.fi with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1eBIgk-0006dR-QX; Sun, 05 Nov 2017 13:02:02 +0200 From: Mikko Perttunen To: thierry.reding@gmail.com, jonathanh@nvidia.com Cc: digetx@gmail.com, dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, Mikko Perttunen Subject: [PATCH 09/10] drm/tegra: Boot VIC in runtime resume Date: Sun, 5 Nov 2017 13:01:17 +0200 Message-Id: <20171105110118.15142-10-mperttunen@nvidia.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171105110118.15142-1-mperttunen@nvidia.com> References: <20171105110118.15142-1-mperttunen@nvidia.com> X-SA-Exim-Connect-IP: 84.249.131.249 X-SA-Exim-Mail-From: mperttunen@nvidia.com X-SA-Exim-Scanned: No (on mail.kapsi.fi); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This ensures that there are no concurrency issues when multiple users are trying to use VIC concurrently, and also simplifies the code slightly. Signed-off-by: Mikko Perttunen --- drivers/gpu/drm/tegra/vic.c | 47 +++++++++++++++++++-------------------------- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/drivers/gpu/drm/tegra/vic.c b/drivers/gpu/drm/tegra/vic.c index 0cacf023a890..3de20f287112 100644 --- a/drivers/gpu/drm/tegra/vic.c +++ b/drivers/gpu/drm/tegra/vic.c @@ -29,7 +29,6 @@ struct vic_config { struct vic { struct falcon falcon; - bool booted; void __iomem *regs; struct tegra_drm_client client; @@ -51,33 +50,12 @@ static void vic_writel(struct vic *vic, u32 value, unsigned int offset) writel(value, vic->regs + offset); } -static int vic_runtime_resume(struct device *dev) -{ - struct vic *vic = dev_get_drvdata(dev); - - return clk_prepare_enable(vic->clk); -} - -static int vic_runtime_suspend(struct device *dev) -{ - struct vic *vic = dev_get_drvdata(dev); - - clk_disable_unprepare(vic->clk); - - vic->booted = false; - - return 0; -} - static int vic_boot(struct vic *vic) { u32 fce_ucode_size, fce_bin_data_offset; void *hdr; int err = 0; - if (vic->booted) - return 0; - /* setup clockgating registers */ vic_writel(vic, CG_IDLE_CG_DLY_CNT(4) | CG_IDLE_CG_EN | @@ -108,7 +86,26 @@ static int vic_boot(struct vic *vic) return err; } - vic->booted = true; + return 0; +} + +static int vic_runtime_resume(struct device *dev) +{ + struct vic *vic = dev_get_drvdata(dev); + int err; + + err = clk_prepare_enable(vic->clk); + if (err < 0) + return err; + + return vic_boot(vic); +} + +static int vic_runtime_suspend(struct device *dev) +{ + struct vic *vic = dev_get_drvdata(dev); + + clk_disable_unprepare(vic->clk); return 0; } @@ -225,10 +222,6 @@ static int vic_submit(struct tegra_drm_context *context, if (err < 0) return err; - err = vic_boot(vic); - if (err < 0) - goto put_vic; - err = tegra_drm_context_get_channel(context); if (err < 0) goto put_vic; -- 2.14.2 From 1583039895533110115@xxx Fri Nov 03 10:21:30 +0000 2017 X-GM-THRID: 1583039895533110115 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread