From patchwork Wed Jun 24 15: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: 11623479 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 1096F138C for ; Wed, 24 Jun 2020 15:09:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EACED20E65 for ; Wed, 24 Jun 2020 15:09:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DaVK2w2z" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404434AbgFXPI7 (ORCPT ); Wed, 24 Jun 2020 11:08:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404357AbgFXPI6 (ORCPT ); Wed, 24 Jun 2020 11:08:58 -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 9DE19C0613ED; Wed, 24 Jun 2020 08:08:58 -0700 (PDT) Received: by mail-lj1-x244.google.com with SMTP id i3so2970370ljg.3; Wed, 24 Jun 2020 08:08:58 -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=n81a7xgicqVqpnshMV1Fym2lKSMaAj06qWLiaAZUAA8=; b=DaVK2w2zzhMR7dhzxorRAMiXFpOAQqUV3BgyeJk5BvrGgH4/6DEBA3VxQxEHsMmopB 16gMgtDiFKxBRWtXnqDuRsAAXODJ1rftcFpKFv8E57JigQk64LxlGC7mC45qrncZ1PVK rjEabLm92zu/UhkkKPeFaoy6TdduiuiqkC5ym/8X1VCH1VDIWbSiNX/JAJBlWdhiJbjd FoLN7w6NDq01hRz3ahZGsOpqmvechMFisnPwzDwMIMt6UVryrcxeBHiGhlgz3xfehLF5 mEAyDUxib+8AA/apNlZnWL46u8EKrEfTZTnRRSTunBM5M2PuqBHO34Cj1pbrSL3M0m3J 8WdQ== 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=n81a7xgicqVqpnshMV1Fym2lKSMaAj06qWLiaAZUAA8=; b=KRVVq5iJxdUT2RdF9YVMg5MAmzuJOE6+FvtJPfcYSdVX8ZPGuX0iYJYD5GV5ZjXPuS sGPnLt6ITvzlfgYMvX1/kycGZfdUKzpjPp35l16srLujCfKgcyJzJUksaJx+4csXsisp HQi0cTsm0+KkbzSlCyqde3FUaTu3O4Sree0ApCJt50pw7CrMpmkeoN0faEu/1l8BWZLv Ivk/wwlAl+KNdSfVeCPPPfjQbrS4RUeQWpiiHIvQtkuRqBMQqNd1p/EA4JPkAT06s7ML EnUYvLBLz5audyeGSsXYIEhPFBzfbR3y5QxZJupzHCzFY8Zp+OXpZA9wZaoXT7A/W0SU NYMg== X-Gm-Message-State: AOAM533Dk33SN9W3WsnPqneCPU0kN0AUi/qrbMPqkgPGqtpFvY6VwhX3 dhc1iLAyGyFyYF5NduRYf8A= X-Google-Smtp-Source: ABdhPJwWvevn5bWodaDDTeO6gegWo/JJY45ganJgJ5FSOkH7CGVN4WdL93vQRhvTexMjGq2XSmWDgw== X-Received: by 2002:a05:651c:338:: with SMTP id b24mr13475658ljp.87.1593011337024; Wed, 24 Jun 2020 08:08:57 -0700 (PDT) Received: from localhost.localdomain (79-139-237-54.dynamic.spd-mgts.ru. [79.139.237.54]) by smtp.gmail.com with ESMTPSA id z1sm4182049lja.47.2020.06.24.08.08.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jun 2020 08:08:56 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-tegra@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/4] media: staging: tegra-vde: Balance runtime PM use-count on resume failure Date: Wed, 24 Jun 2020 18:08:44 +0300 Message-Id: <20200624150847.22672-2-digetx@gmail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200624150847.22672-1-digetx@gmail.com> References: <20200624150847.22672-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 the 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. Use pm_runtime_put_noidle(), which is the most straight-forward variant to balance the RPM, confirmed by Rafael J. Wysocki. Link: https://lore.kernel.org/linux-i2c/CAJZ5v0i87NGcy9+kxubScdPDyByr8ypQWcGgBFn+V-wDd69BHQ@mail.gmail.com/ 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 Wed Jun 24 15: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: 11623481 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 CA535138C for ; Wed, 24 Jun 2020 15:09:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AF4F6206A5 for ; Wed, 24 Jun 2020 15:09:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="J2ZoUKab" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404470AbgFXPJO (ORCPT ); Wed, 24 Jun 2020 11:09:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404067AbgFXPI7 (ORCPT ); Wed, 24 Jun 2020 11:08:59 -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 A0EBEC061573; Wed, 24 Jun 2020 08:08:59 -0700 (PDT) Received: by mail-lj1-x244.google.com with SMTP id s1so2976350ljo.0; Wed, 24 Jun 2020 08:08:59 -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=J2ZoUKabV8uBWW8kT14GVdq844k5EGl9LZL64gEzgnhcADd8Ey9EGbuClRMNnMseCg U1KHZistw+DkX9cqdP1WCbkcM+QtHu0ScwWhr6ar6Xkv6RfSKeHf3fIviD3k89avexI7 OQxhBScnUY+89SxyZMVTNGKj88NOEztFu22WFCr59dYFDp6hqNOo1xA//QFL0aqqxyEM wv7QLohFndzJkxFUckGdRPNhWh/ZrCJ9P774Gu4JDSIAKvWRf+HFavFp0ScgXTn60JQk aQ+YheYahlXjBbYR/t2lin+Y1fFWbPjFQlypbnImOOBvEGEkTcUb5bruoHs9vc+kvRme 3VwQ== 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=EdtgKraVE9+Id3x2TX8aKR6wopdGF3CunmK/hRu7cadcuT8LF5WuhHhbKzfjXdhoP+ 1rEcdD0BsvmARO6A88kRqgRa1XdkbIEjai4heOGxTG5V+6KIaSMZ9P55WsaRMzqMoWK5 sdtf5Sw4RwI8ZAR6RCa3O/Gq5T5828DgPsuLd3nXjKtx2ZdV6DFRaXwsUZ5vRshndWHA H6NsVXad8OxKF5PRpVKPRnH6K2ed82GZgvSdRGRcxkBRpiXV3Ijr7KC296Vn4wpVCpx3 JBPX0H9qgj12T8j/Td8RXKG7/yLKJfcBPD7/m3uDgNME02wd0fsd0+69JqRAhiMIgSKX WzSQ== X-Gm-Message-State: AOAM532kCMc2CeaVYbbR7f6JgPumzW0dlDCOw8TXGqXWopqSumDflxUj bmkdI7IUzhZVCCUy3fpYSzw= X-Google-Smtp-Source: ABdhPJyKT14B5+qLcVOpYptH1Lq0z9yrEMkRgXqV0VmarTChqLi//LDwXiSj80dipUCtV5kkV88X8A== X-Received: by 2002:a2e:9c8e:: with SMTP id x14mr11827756lji.200.1593011338198; Wed, 24 Jun 2020 08:08:58 -0700 (PDT) Received: from localhost.localdomain (79-139-237-54.dynamic.spd-mgts.ru. [79.139.237.54]) by smtp.gmail.com with ESMTPSA id z1sm4182049lja.47.2020.06.24.08.08.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jun 2020 08:08:57 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-tegra@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/4] media: staging: tegra-vde: Runtime PM is always available on Tegra Date: Wed, 24 Jun 2020 18:08:45 +0300 Message-Id: <20200624150847.22672-3-digetx@gmail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200624150847.22672-1-digetx@gmail.com> References: <20200624150847.22672-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 Acked-by: Thierry Reding --- 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 Wed Jun 24 15: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: 11623477 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 0F80B913 for ; Wed, 24 Jun 2020 15:09:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EB60D20E65 for ; Wed, 24 Jun 2020 15:09:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YMrvDWL/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404447AbgFXPJD (ORCPT ); Wed, 24 Jun 2020 11:09:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404442AbgFXPJB (ORCPT ); Wed, 24 Jun 2020 11:09:01 -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 B44BAC061573; Wed, 24 Jun 2020 08:09:00 -0700 (PDT) Received: by mail-lf1-x142.google.com with SMTP id g139so1452745lfd.10; Wed, 24 Jun 2020 08:09:00 -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=YMrvDWL/13Qtb/t3P8AqAn7YXh+E5039QwPNb0vmwIbDc+mVHxz7OIiIAMP+ST+S+v WEi9f/pouSHwNiVg9M9zSajFLSKXGJZ/v3hOEQwNFyhZ1dH1O9+KH3OKMptmoOtL6eed Q8L07crHA2zRVbxLHhAme3Ig61vVANQHgD9UfkdluZmOM2ZbWeohP1hinz8Foc2jrh69 3ibyFDx5rnQIFxdyp3LYxg3rioriCS0sOxMI33kKetcMsKIxkrjyg7G1Z/3fZw/b0Mzb 51L5Us03w/z7vBI1W+pWMTwAMt0Dt/uyBYNfXypX46LgBJHwGp2XbhhRrm1ML1ZH2A9c 7d4Q== 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=jfKYb1kX7eWg4WXnbXWM724BVrNdl/bHQPyydb120T3eks0AJXiafTirlMpFAZqhYu J68DLxtqw+8AzvP8LkHu+taoyozvvnEWvn53s6sgSal0+M+NctI7c9fM8ZWcxWJV5GIB be11hG5cz23HkA5fiv/sNjKIHaItEYRi12PJqCAP9sMnl8MJpz5PfHVJ4CNHJ97Xi2H7 gu64LQBrZGq2+UZFijSZREXtctdjwWc3LOa1Hmu2w/aUSPmZwYuXGQNgo5yH+B1sPm4Z LukQ9YSlT10heGQUYrVrQMJIRWwaQTMqmbDXgDoJ2JXA3vBR3rRimhLe+A2d4uoPwqZ9 gSew== X-Gm-Message-State: AOAM531D/LXFUobL/FF9nS2xjikZ7l7f8vy4X3m/uOJb0wHXHCpgw7f4 cJQbyx3nlHWL1gBHJLZE2YE= X-Google-Smtp-Source: ABdhPJyuihnjhleoFSkxrceYwKLcXKmloeag18MhVXjSAM33bpxBmEXnrnBvMHE+KbpSExRlAvz/bA== X-Received: by 2002:ac2:4a83:: with SMTP id l3mr15608005lfp.92.1593011339237; Wed, 24 Jun 2020 08:08:59 -0700 (PDT) Received: from localhost.localdomain (79-139-237-54.dynamic.spd-mgts.ru. [79.139.237.54]) by smtp.gmail.com with ESMTPSA id z1sm4182049lja.47.2020.06.24.08.08.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jun 2020 08:08:58 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-tegra@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/4] media: staging: tegra-vde: Turn ON power domain on shutdown Date: Wed, 24 Jun 2020 18:08:46 +0300 Message-Id: <20200624150847.22672-4-digetx@gmail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200624150847.22672-1-digetx@gmail.com> References: <20200624150847.22672-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 Acked-by: Thierry Reding --- 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 Wed Jun 24 15: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: 11623475 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 F0F6F138C for ; Wed, 24 Jun 2020 15:09:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D81AB20E65 for ; Wed, 24 Jun 2020 15:09:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ulp/uL9m" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404453AbgFXPJE (ORCPT ); Wed, 24 Jun 2020 11:09:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404444AbgFXPJC (ORCPT ); Wed, 24 Jun 2020 11:09:02 -0400 Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEE10C0613ED; Wed, 24 Jun 2020 08:09:01 -0700 (PDT) Received: by mail-lf1-x143.google.com with SMTP id g2so1480525lfb.0; Wed, 24 Jun 2020 08:09:01 -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=ulp/uL9mvSJ7SU6iy5vKC57v2/nHWbwvSeoz2IatRstoQAKNz9khO51LYV0etv/+Pt nOjON8gH8HePftUtiH/m1lbv6Ge7KCktGswiYuoR6BzRE/4aPtpbZ+G8AtBcnzezenRv E19kA4MYhMukJaDqwCySvCQtSIREF728qLuajUixXbhb8xBkfGnACnug5MRDiEDpkLvu ruAE3QYb7Hcp6hPuFK+NFirykJcmSZF1auuJnTTpeLMPyTnoHiQ5KbzSKM9ITmJi4eak ErFjnAFcranSp2YH9+o44LTTuGjTuoI7MB4F0YV1MiN25IhJqTh7fcK9HT7i497ahTcZ 7aSQ== 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=B6mhMdGyuvOK51zunSh4HqLbrTEJUnlX6LJgyN7YEFj7xRskEXvSoZ+xTiERHw1NZr x1nb0SNjmEoMIZH911zPIkV1f9TPtwhfFx9b2qRwEWA9DPWGT66zkT0wuHBeLOoIs/EF VkfSRbH8HM2SDqfNlvD7g/fu9a2ySRxlhTvtE8fOkXJ601RkR5Wnn0fRQA8R0KmlcTQc nzRiCOBG2yfu7VpwqIOUvEGScNpBrpBBhv/zlbn2b2Ne+ChrYnwDztY/NDIquXKzjYSV oWTTf3HQ8845dM76JsXETDrGMu+HgK8wCTvBBEEo6V39v0fO3bgG9+dz5tbzGYzlPFHi uiXA== X-Gm-Message-State: AOAM532nF3bu9WmUdnb42DIwQcxGJtKY1Vs+dCfTZHds7gcuI5jjPzf/ kYdGmQxHOmOU/3sbE/ydV2I= X-Google-Smtp-Source: ABdhPJwBscUlFJUFnBG6HoRwUDBMUXuDryV4RkhTsFyJYaFEtrtjM23lOEY1nMU1CiXDl9wNs+qRrA== X-Received: by 2002:ac2:5295:: with SMTP id q21mr15591045lfm.185.1593011340318; Wed, 24 Jun 2020 08:09:00 -0700 (PDT) Received: from localhost.localdomain (79-139-237-54.dynamic.spd-mgts.ru. [79.139.237.54]) by smtp.gmail.com with ESMTPSA id z1sm4182049lja.47.2020.06.24.08.08.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jun 2020 08:08:59 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-tegra@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 4/4] media: staging: tegra-vde: Power-cycle hardware on probe Date: Wed, 24 Jun 2020 18:08:47 +0300 Message-Id: <20200624150847.22672-5-digetx@gmail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200624150847.22672-1-digetx@gmail.com> References: <20200624150847.22672-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: