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: 209806 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 512C3C433DF 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 1C1D120760 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: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: 209805 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36379C433DF 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 0868A206F1 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: