From patchwork Thu May 14 21:08:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11549789 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 30EE7138A for ; Thu, 14 May 2020 21:09:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 11E1F2074A for ; Thu, 14 May 2020 21:09:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="m2eydK5T" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727835AbgENVJk (ORCPT ); Thu, 14 May 2020 17:09:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726201AbgENVJk (ORCPT ); Thu, 14 May 2020 17:09:40 -0400 Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1226C061A0E; Thu, 14 May 2020 14:09:39 -0700 (PDT) Received: by mail-lj1-x242.google.com with SMTP id o14so5124383ljp.4; Thu, 14 May 2020 14:09:39 -0700 (PDT) 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=FmoIa0AdudNDzlTpZ0uiZDtdJ4Pgj1/DLge9mABr+4w=; b=m2eydK5TfbDdgIiR1qoaJyWjU/1xapfTY6oGjlexVUmxSSabO9gqLc9WTMyzQJpITB fWA7uSBy+kRiov7VdhjnIW/G7XIqLPg8vnRdwu8Ek6AAJcy1dBZAVNUIze8IwrxyMUx/ Z4H0/SHYEfA6t9h4V0l+x56uowOHydj3fNFi8H+ysFas5VSU0QKAx3TjU+c5NkLpz3qj 4nuAFNKkmzLiBBFrtsi4WRfpKI0w25q5MWlbx72LOqGAM90A1UMtfkUE/jE0H6jNkhEU nMEEL50QIXSspUMDfIHZnaf4KySCpup3aAZXd4Sfkt+Yd34s+4IoW5dW82APBhehs77j 6Gjg== 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=FmoIa0AdudNDzlTpZ0uiZDtdJ4Pgj1/DLge9mABr+4w=; b=q992gi1cbTH+TBpkLOVMQG3b0c1qklVOrx/ddj7z1uJSO8I4AY/fgO3b2YAr34LzFU 0+tXeMduRSE5hJg8dtYJSKP8eLzfzAnmaFlqLcO80xSu8xgpHNXJx9vC3jbhYxtF5Bk6 yhKu8n2CV+kHEm+MsAh6dtCnt4sfrUo8zdf9Zjf/dFzQGp5/L4GL/v+D/j4jFGGVA1mD 2zNqDLJzFacQy0Puo6HGsurTHJePE9ktZxxZK4Pid1T0lC7LD+GJdjapk1Z4IIoNbOFq lAeIeIXfJxhY0zztS/87Zu17a6+X4/FEPUiE+yrH2J08FfgfaGymsxq05HdHsdrMlsgr y06w== X-Gm-Message-State: AOAM532OluziO9Yy/dQbppRVkrReD2/7z8C6L7Z/35D0goFwVLbqXKfh VaC5+pEsJup0mQAKv9sx73E= X-Google-Smtp-Source: ABdhPJw3+tg4ZIkP0KD8isuSzsxGILoMKI+AxadyW6yCzc0e0wn6qyD7t0c7jWNSG1OzLhiEzNd/Bg== X-Received: by 2002:a2e:6c08:: with SMTP id h8mr134750ljc.48.1589490578217; Thu, 14 May 2020 14:09:38 -0700 (PDT) Received: from localhost.localdomain (ppp91-78-208-152.pppoe.mtu-net.ru. [91.78.208.152]) by smtp.gmail.com with ESMTPSA id g3sm45215ljk.27.2020.05.14.14.09.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 14:09:37 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mauro Carvalho Chehab , Hans Verkuil , Dan Carpenter Cc: linux-media@vger.kernel.org, linux-tegra@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 1/4] media: staging: tegra-vde: Balance runtime PM use-count on resume failure Date: Fri, 15 May 2020 00:08:44 +0300 Message-Id: <20200514210847.9269-2-digetx@gmail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200514210847.9269-1-digetx@gmail.com> References: <20200514210847.9269-1-digetx@gmail.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The RPM's use-count is getting incremented regardless of pm_runtime_get_sync() success or fail. It's up to a driver how to handle the failed RPM. In the case of VDE driver, the RPM's use-count should be restored if runtime-resume fails. Signed-off-by: Dmitry Osipenko --- drivers/staging/media/tegra-vde/vde.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/tegra-vde/vde.c b/drivers/staging/media/tegra-vde/vde.c index d3e63512a765..803e5dda4bb5 100644 --- a/drivers/staging/media/tegra-vde/vde.c +++ b/drivers/staging/media/tegra-vde/vde.c @@ -776,8 +776,10 @@ static int tegra_vde_ioctl_decode_h264(struct tegra_vde *vde, goto release_dpb_frames; ret = pm_runtime_get_sync(dev); - if (ret < 0) + if (ret < 0) { + pm_runtime_put_noidle(dev); goto unlock; + } /* * We rely on the VDE registers reset value, otherwise VDE From patchwork Thu May 14 21:08:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11549791 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 3A43614C0 for ; Thu, 14 May 2020 21:09:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1F912206F1 for ; Thu, 14 May 2020 21:09:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="tltjcWtT" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728140AbgENVJp (ORCPT ); Thu, 14 May 2020 17:09:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728043AbgENVJm (ORCPT ); Thu, 14 May 2020 17:09:42 -0400 Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2138C061A0C; Thu, 14 May 2020 14:09:40 -0700 (PDT) Received: by mail-lf1-x142.google.com with SMTP id c21so7487lfb.3; Thu, 14 May 2020 14:09:40 -0700 (PDT) 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=EO0vr0FBuxVa7FqS3Iq4jMbQpH1iOzHD8PnLZeBEDCg=; b=tltjcWtTVsozKzAf9N+yxZwewU2cNg30qCpbUSnD4xjqn3IaFYSc11cT2s/BUL/eo2 eXwYVd2jl6wBp8ekYPoinV7qyWBI/eE5FVU7CkPyuC6GI/SwOTI2Pq2XJYf4r+e9QBZe ygFDJQSL/D8hYv2L+KzG2ZXUD8oeB42Ne3vya1sRjlz6jo3ZU3a+StfRucZXUdIkXsxo FnlijK74UmStroYupJDYMm37bA8DF9v08j9v7/owoQgiy/Eqg4nj2S0ltJdI/YfsABS1 wmHuOppJGxLYcVHNerVfrh3N1QHnk5JJC3QvOcnEzuIgRHDB7kDzhX9+uw4uovyPCQlU PwVg== 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=EO0vr0FBuxVa7FqS3Iq4jMbQpH1iOzHD8PnLZeBEDCg=; b=FplEEN7y2ZZ9qDxUIWr05eKOL2ZV2jrIprdlQ7ELZMzJC7g77vwqhwT9deWlLw+QCT VETDWeXB30YOCaSRoOhgbfljotBa5fyKtnrgvy5wrvKiNLTLgKcAPpNrz3LBqGQ0Csa/ cuaFNkGoJ20gnks01Wr14hAo8Scqmx7mnrXA5kEig1SOesHbXc3uQzOXw+1VPEER2wdi NPND72zG6PBDJD2kAz9AHMOQbPMvhQeldXSM0CW2Vla10Qh4J2WRADRLCsdJMGrJlf8p NJ6O8P8CmuQ6IjXIm1673z0j+Ov+vLME/Jx0Be+xksVsCye90YWeZBPPbhco/Vy8BDKW g0JA== X-Gm-Message-State: AOAM533Y8ZIAXo+IMl3rWBTe4oKbg2DL7J6kO4ZbtoevHacRfTn9Rc3i 6DTk4Zhr2fSRw39BSs/fAEk= X-Google-Smtp-Source: ABdhPJwmXn6PJe8MV8dlPU1VcNAyZYVcG4jdW1N/ABx/HZNFEa2KXiju6MxUhsgJEX3Zjn5+oOQ5Kg== X-Received: by 2002:a19:d55:: with SMTP id 82mr55733lfn.89.1589490579255; Thu, 14 May 2020 14:09:39 -0700 (PDT) Received: from localhost.localdomain (ppp91-78-208-152.pppoe.mtu-net.ru. [91.78.208.152]) by smtp.gmail.com with ESMTPSA id g3sm45215ljk.27.2020.05.14.14.09.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 14:09:38 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mauro Carvalho Chehab , Hans Verkuil , Dan Carpenter Cc: linux-media@vger.kernel.org, linux-tegra@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 2/4] media: staging: tegra-vde: Runtime PM is always available on Tegra Date: Fri, 15 May 2020 00:08:45 +0300 Message-Id: <20200514210847.9269-3-digetx@gmail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200514210847.9269-1-digetx@gmail.com> References: <20200514210847.9269-1-digetx@gmail.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Runtime PM is always available on Tegra nowadays since commit 40b2bb1b132a ("ARM: tegra: enforce PM requirement"), hence the case of unavailable RPM doesn't need to be handled. Signed-off-by: Dmitry Osipenko --- drivers/staging/media/tegra-vde/vde.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/drivers/staging/media/tegra-vde/vde.c b/drivers/staging/media/tegra-vde/vde.c index 803e5dda4bb5..85cbbc8f70d3 100644 --- a/drivers/staging/media/tegra-vde/vde.c +++ b/drivers/staging/media/tegra-vde/vde.c @@ -1068,17 +1068,8 @@ static int tegra_vde_probe(struct platform_device *pdev) pm_runtime_use_autosuspend(dev); pm_runtime_set_autosuspend_delay(dev, 300); - if (!pm_runtime_enabled(dev)) { - err = tegra_vde_runtime_resume(dev); - if (err) - goto err_misc_unreg; - } - return 0; -err_misc_unreg: - misc_deregister(&vde->miscdev); - err_deinit_iommu: tegra_vde_iommu_deinit(vde); @@ -1093,13 +1084,6 @@ static int tegra_vde_remove(struct platform_device *pdev) { struct tegra_vde *vde = platform_get_drvdata(pdev); struct device *dev = &pdev->dev; - int err; - - if (!pm_runtime_enabled(dev)) { - err = tegra_vde_runtime_suspend(dev); - if (err) - return err; - } pm_runtime_dont_use_autosuspend(dev); pm_runtime_disable(dev); From patchwork Thu May 14 21:08:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11549795 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 C9579697 for ; Thu, 14 May 2020 21:10:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AAF9B206F1 for ; Thu, 14 May 2020 21:10:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gLiR8Cd3" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728244AbgENVJ5 (ORCPT ); Thu, 14 May 2020 17:09:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728035AbgENVJm (ORCPT ); Thu, 14 May 2020 17:09:42 -0400 Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3D62C061A0E; Thu, 14 May 2020 14:09:41 -0700 (PDT) Received: by mail-lj1-x241.google.com with SMTP id g4so5126309ljl.2; Thu, 14 May 2020 14:09:41 -0700 (PDT) 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=KheAdp9M1dfbG4eEm8dhaFoYt33Uw8W6nHGfCYpBQ1U=; b=gLiR8Cd33hBDhgcqV4vb/slAGpWjDL9p3Rlr92Yqo+TGnWCFldIjfFWkxpfV3P7Uz+ O1tJy7aA4cLjD+pLXjqLzcIiWL55PtMEubj46qyQlgxfEmTfanFYlsAQXieCN6D62rtg p19Q3gDAAaLIwyC8wHvfxQg0ud80YMVij3hzBMpp8ZjeNXWiTNHro+EYnIXpvFeVdF9H e8Lhq15JBDEU/8X5voT+kE+4CjzGmiZ5iFsoYd1uiQnf6+z4OsKXozVqNoYawaLqFgoO 9lCosisXPV8c0ENv1qRoXOBQRAQ2JCzvUlwzys3KvJ2ehFAyDkQ+tPV5s2BmG9jzSYHx J+Qg== 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=KheAdp9M1dfbG4eEm8dhaFoYt33Uw8W6nHGfCYpBQ1U=; b=g9RvpPvTI9fSgkTaLacYvG7v0Jp5g4DbwAoho22tFNJh6YRjAtv4ZP/fLU4kABRTUi v5yMixMCtM+Wdsyx0Ul5ra/2AQ3MgptOzeYEoaiQ0InZf/ASzbQ+SQ5f5xI4kpWMr477 nzVRKdPP3DJJsebxZrvL+JfYDdCX43i3HhZ1Uwj4iDfDhGMnm8SHmoATDj3+iMCXFGXP qzHL1zFo6kWHbTkVsEtrWJmoWv0rYKUjq4CvInW/+MH+SM2qjgWKUzK5NNfZIdvefEYo HqfIunn2BjqV+znf2qqiDBksJ5WCftoiJ4FFWum2EJA1RDGPUJerv/r/lha25zGSGlNf rBqQ== X-Gm-Message-State: AOAM530kDWalTbn4cwSioN0kPNXQYTBkfdCiFfRpYyLG7ARK/KLMRK5r nbWLMFf140SBk5QNW0Id36s= X-Google-Smtp-Source: ABdhPJw8fhDNpHCQC51ItCJfok/1aWb8KwJn6He0iS2C3z3YUOfwjJ+4h/7EGYjUKQFCuiWcV40bAA== X-Received: by 2002:a2e:9bc3:: with SMTP id w3mr130955ljj.170.1589490580297; Thu, 14 May 2020 14:09:40 -0700 (PDT) Received: from localhost.localdomain (ppp91-78-208-152.pppoe.mtu-net.ru. [91.78.208.152]) by smtp.gmail.com with ESMTPSA id g3sm45215ljk.27.2020.05.14.14.09.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 14:09:39 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mauro Carvalho Chehab , Hans Verkuil , Dan Carpenter Cc: linux-media@vger.kernel.org, linux-tegra@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 3/4] media: staging: tegra-vde: Turn ON power domain on shutdown Date: Fri, 15 May 2020 00:08:46 +0300 Message-Id: <20200514210847.9269-4-digetx@gmail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200514210847.9269-1-digetx@gmail.com> References: <20200514210847.9269-1-digetx@gmail.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org On some devices bootloader isn't ready to a clamped VDE power, and thus, machine hangs on a warm reboot (CPU reset). The VDE power partition is turned ON by default on a cold boot, hence VDE driver should keep power partition enabled on system's reboot too. This fixes hang on a warm reboot on a Tegra20 Acer A500 device, which is handy if Embedded Controller driver is unavailable, i.e. cold reboot can't be performed. Signed-off-by: Dmitry Osipenko --- drivers/staging/media/tegra-vde/vde.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/staging/media/tegra-vde/vde.c b/drivers/staging/media/tegra-vde/vde.c index 85cbbc8f70d3..b64e35b86fb4 100644 --- a/drivers/staging/media/tegra-vde/vde.c +++ b/drivers/staging/media/tegra-vde/vde.c @@ -1085,9 +1085,17 @@ static int tegra_vde_remove(struct platform_device *pdev) struct tegra_vde *vde = platform_get_drvdata(pdev); struct device *dev = &pdev->dev; + pm_runtime_get_sync(dev); pm_runtime_dont_use_autosuspend(dev); pm_runtime_disable(dev); + /* + * Balance RPM state, the VDE power domain is left ON and hardware + * is clock-gated. It's safe to reboot machine now. + */ + pm_runtime_put_noidle(dev); + clk_disable_unprepare(vde->clk); + misc_deregister(&vde->miscdev); tegra_vde_dmabuf_cache_unmap_all(vde); @@ -1099,6 +1107,16 @@ static int tegra_vde_remove(struct platform_device *pdev) return 0; } +static void tegra_vde_shutdown(struct platform_device *pdev) +{ + /* + * On some devices bootloader isn't ready to a power-gated VDE on + * a warm-reboot, machine will hang in that case. + */ + if (pm_runtime_status_suspended(&pdev->dev)) + tegra_vde_runtime_resume(&pdev->dev); +} + static __maybe_unused int tegra_vde_pm_suspend(struct device *dev) { struct tegra_vde *vde = dev_get_drvdata(dev); @@ -1144,6 +1162,7 @@ MODULE_DEVICE_TABLE(of, tegra_vde_of_match); static struct platform_driver tegra_vde_driver = { .probe = tegra_vde_probe, .remove = tegra_vde_remove, + .shutdown = tegra_vde_shutdown, .driver = { .name = "tegra-vde", .of_match_table = tegra_vde_of_match, From patchwork Thu May 14 21:08:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11549793 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 2C8EE697 for ; Thu, 14 May 2020 21:09:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1335F2074A for ; Thu, 14 May 2020 21:09:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dfyS/sP4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728113AbgENVJo (ORCPT ); Thu, 14 May 2020 17:09:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727777AbgENVJn (ORCPT ); Thu, 14 May 2020 17:09:43 -0400 Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF3ADC061A0F; Thu, 14 May 2020 14:09:42 -0700 (PDT) Received: by mail-lj1-x244.google.com with SMTP id l19so5087253lje.10; Thu, 14 May 2020 14:09:42 -0700 (PDT) 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=MbEwAEDY+UIz4Bw5+QFZkmbm4gisWV5nZMVAP0V+gWg=; b=dfyS/sP46qW3uvPVJQkdARtLyOipAh/Fz8Npnv+Bs1bbVNFTnOZFrWXV9okA/ZiMbg CB0NH+AvHjZgfAHA+DTHZ0BwQkTg6A+t0+5r3K/drjuIC63WOkMo25JRUDiROIk+/tCQ D8Qh0g4fdkthrjZ420wJ2/dYoWexp+lVhcjSMLe0LSXzmoqf579SDJ+L/jdCGfwULGE0 oH6EljARn+2wA3ooEGqHJt0oHllyQT7wfHRTYoCBMy+UmQ1+nkuSdRjkcsUsZZdoTsqX S8fLeSizceMcqArQRoQ+8xXHTgE6vIxqnxCkGgZqYxL/dBfDMrTZ7P8P1mlZ92E4UthP nqkw== 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=MbEwAEDY+UIz4Bw5+QFZkmbm4gisWV5nZMVAP0V+gWg=; b=uZwtf8MQVeOWeeEBb+igUYzOMjmGCYIXjokaqFbm5ADk2/JpxjMRWqmQChjDh1nkng lzcgCfoNW4o043atU7YubOmZIuFIbTgrNTJKzmR4BOECo5oiTv+EJ8ZrYwRjk1r9+++9 PfkjPz8Ec2r31aoc25qikSBJ1JV0zQ0oAFE0hq+ky3wk/BwDltvpQ60erY4SJq08mIzQ K/sTZLYbp6EI6d8T7yixKbfEAbqyQAVDRuHwvwgh2cgROCrdJkfyj6HP/gsNZCJdwPwQ kksbeY9J/NWSxyAi5SqFYeHqGT4/PCR9WWwmCNW2tvbAYDpDwESFFbHigFuDObdwauTa OGaA== X-Gm-Message-State: AOAM531LF+cKg/W1LrgJFq+tQu0xTPk8aOFS3IaXJwKrkq9DMcFlyb9a Vrrj/igyWQTaDmneiPDtX1A= X-Google-Smtp-Source: ABdhPJxPYojjqv+Q6EeNKYsxCP1N3bnO5bJhCCmwZemIP2H/4hZRmku6zi509u41Zy3B51R9aFzG2Q== X-Received: by 2002:a2e:361a:: with SMTP id d26mr103704lja.171.1589490581256; Thu, 14 May 2020 14:09:41 -0700 (PDT) Received: from localhost.localdomain (ppp91-78-208-152.pppoe.mtu-net.ru. [91.78.208.152]) by smtp.gmail.com with ESMTPSA id g3sm45215ljk.27.2020.05.14.14.09.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 14:09:40 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mauro Carvalho Chehab , Hans Verkuil , Dan Carpenter Cc: linux-media@vger.kernel.org, linux-tegra@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 4/4] media: staging: tegra-vde: Power-cycle hardware on probe Date: Fri, 15 May 2020 00:08:47 +0300 Message-Id: <20200514210847.9269-5-digetx@gmail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200514210847.9269-1-digetx@gmail.com> References: <20200514210847.9269-1-digetx@gmail.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org VDE partition is left turned ON after bootloader on most devices, hence let's ensure that it's turned OFF in order to lower power leakage while hardware is idling by turning it ON and OFF during of the driver's probe. Signed-off-by: Dmitry Osipenko --- drivers/staging/media/tegra-vde/vde.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/staging/media/tegra-vde/vde.c b/drivers/staging/media/tegra-vde/vde.c index b64e35b86fb4..3be96c36bf43 100644 --- a/drivers/staging/media/tegra-vde/vde.c +++ b/drivers/staging/media/tegra-vde/vde.c @@ -1068,6 +1068,14 @@ static int tegra_vde_probe(struct platform_device *pdev) pm_runtime_use_autosuspend(dev); pm_runtime_set_autosuspend_delay(dev, 300); + /* + * VDE partition may be left ON after bootloader, hence let's + * power-cycle it in order to put hardware into a predictable lower + * power state. + */ + pm_runtime_get_sync(dev); + pm_runtime_put(dev); + return 0; err_deinit_iommu: