Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5975073ybe; Tue, 10 Sep 2019 11:35:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqweFkfG6Cv63BlKTVmQQBB6yN7f7264RXZzXDeAf/E2Ko+mqyj4OtOWckGhzIjkTF7kMhVX X-Received: by 2002:a50:b501:: with SMTP id y1mr32134419edd.167.1568140517872; Tue, 10 Sep 2019 11:35:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568140517; cv=none; d=google.com; s=arc-20160816; b=VpkJ6CCrZEI2QawRpIU2IbebcVQDQFMWRtrzH2/Fsg5gCzWzaLzoShhSunBafZOCou rVNga7WuuCuiZ0YLINSIMPcLjsrgMIxMPk1LSD5iXk8sQ0yUC37vlJcBqwASEb0QCTGh vhE021k7vG7WS/SPwog9fVfldXR0+zDNDj+GP++eho4WO8MmPAhQlV2YnhvFrs6OSezW D4Xz0CmhzzfK0NI9nmrQjbSXGe+hz9mFj5hSNQ7v6S1kN6/+SxJEugX8B8yErzjaCjoa iclmvLfoHxy/V7duz5+yWp9PUlcSE3WAc5OrOxXKy/wuSkoIfyqS49VUnjGMNx6eg+6M Eecw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=ZUNgq9Kc07s4hJ1BQZTNPqbFYkBH7lGyGY7xvKH4+OU=; b=DQ8ziDpWtcuWVEBpiBZzoGQdI4tSWBWUzJHywMcQOLvNRCltQ5OV1QrVzfZvOiitTm Li+8mGEVTpNFwGiDoq33r2nP3Rh5ZOWF60u6VPj3OYooO/FHUVBM6J+400wt/UT1u0xw g7qtPuBbFAFx45tbQOYh6ih8PIxkLkzJZj62CYG+2r4V8FdHDt902XrqohlLbREKSD40 IGcg8yT2U6BmLtWSszDE5uQIYzntypsCdVhpcqnWrm5sDKxywuHymqNZlLQWeMPOlrSG F0wS5k4Pqnxf6GvNyGTOBbon/vEjMMIiXr5KvpJ4DVCqsfBvmRmmzOkzRtuO66NXuknb qtCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=rUn5IfzU; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h14si10954615edk.315.2019.09.10.11.34.54; Tue, 10 Sep 2019 11:35:17 -0700 (PDT) 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=@ti.com header.s=ti-com-17Q1 header.b=rUn5IfzU; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389608AbfIIQZy (ORCPT + 99 others); Mon, 9 Sep 2019 12:25:54 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:49126 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389577AbfIIQZx (ORCPT ); Mon, 9 Sep 2019 12:25:53 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x89GPpAD070397; Mon, 9 Sep 2019 11:25:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1568046351; bh=ZUNgq9Kc07s4hJ1BQZTNPqbFYkBH7lGyGY7xvKH4+OU=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=rUn5IfzU1qUcKQd82OgL90VTwjR0uDLp2WAOzdIdp8ow7+yxERaX+1o2OR7istcbV Flq2Dq8YD3RatPoenXTIruDe1f5NU/BT+AVI8uk/8c6osGoPe48ueFBiXazO6kyVvn LdJkd+gOOvm901IuPnBchH5/2r8rhXfn95NHsOyI= Received: from DFLE115.ent.ti.com (dfle115.ent.ti.com [10.64.6.36]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x89GPpOD026755 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 9 Sep 2019 11:25:51 -0500 Received: from DFLE106.ent.ti.com (10.64.6.27) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 9 Sep 2019 11:25:51 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Mon, 9 Sep 2019 11:25:51 -0500 Received: from uda0869644b.dal.design.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id x89GPnoP056522; Mon, 9 Sep 2019 11:25:51 -0500 From: Benoit Parrot To: Hans Verkuil CC: Prabhakar Lad , , , , Dave Gerlach , Benoit Parrot Subject: [Patch 01/13] media: am437x-vpfe: Fix suspend path to always handle pinctrl config Date: Mon, 9 Sep 2019 11:27:31 -0500 Message-ID: <20190909162743.30114-2-bparrot@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190909162743.30114-1-bparrot@ti.com> References: <20190909162743.30114-1-bparrot@ti.com> MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dave Gerlach Currently if vpfe is not active then it returns immediately in the suspend and resume handlers. Change this so that it always performs the pinctrl config so that we can still get proper sleep state configuration on the pins even if we do not need to worry about fully saving and restoring context. Signed-off-by: Dave Gerlach Signed-off-by: Benoit Parrot --- drivers/media/platform/am437x/am437x-vpfe.c | 44 ++++++++++----------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/drivers/media/platform/am437x/am437x-vpfe.c b/drivers/media/platform/am437x/am437x-vpfe.c index 2b42ba1f5949..ab959d61f9c9 100644 --- a/drivers/media/platform/am437x/am437x-vpfe.c +++ b/drivers/media/platform/am437x/am437x-vpfe.c @@ -2653,22 +2653,22 @@ static int vpfe_suspend(struct device *dev) struct vpfe_device *vpfe = dev_get_drvdata(dev); struct vpfe_ccdc *ccdc = &vpfe->ccdc; - /* if streaming has not started we don't care */ - if (!vb2_start_streaming_called(&vpfe->buffer_queue)) - return 0; + /* only do full suspend if streaming has started */ + if (vb2_start_streaming_called(&vpfe->buffer_queue)) { - pm_runtime_get_sync(dev); - vpfe_config_enable(ccdc, 1); + pm_runtime_get_sync(dev); + vpfe_config_enable(ccdc, 1); - /* Save VPFE context */ - vpfe_save_context(ccdc); + /* Save VPFE context */ + vpfe_save_context(ccdc); - /* Disable CCDC */ - vpfe_pcr_enable(ccdc, 0); - vpfe_config_enable(ccdc, 0); + /* Disable CCDC */ + vpfe_pcr_enable(ccdc, 0); + vpfe_config_enable(ccdc, 0); - /* Disable both master and slave clock */ - pm_runtime_put_sync(dev); + /* Disable both master and slave clock */ + pm_runtime_put_sync(dev); + } /* Select sleep pin state */ pinctrl_pm_select_sleep_state(dev); @@ -2710,19 +2710,19 @@ static int vpfe_resume(struct device *dev) struct vpfe_device *vpfe = dev_get_drvdata(dev); struct vpfe_ccdc *ccdc = &vpfe->ccdc; - /* if streaming has not started we don't care */ - if (!vb2_start_streaming_called(&vpfe->buffer_queue)) - return 0; + /* only do full resume if streaming has started */ + if (vb2_start_streaming_called(&vpfe->buffer_queue)) { - /* Enable both master and slave clock */ - pm_runtime_get_sync(dev); - vpfe_config_enable(ccdc, 1); + /* Enable both master and slave clock */ + pm_runtime_get_sync(dev); + vpfe_config_enable(ccdc, 1); - /* Restore VPFE context */ - vpfe_restore_context(ccdc); + /* Restore VPFE context */ + vpfe_restore_context(ccdc); - vpfe_config_enable(ccdc, 0); - pm_runtime_put_sync(dev); + vpfe_config_enable(ccdc, 0); + pm_runtime_put_sync(dev); + } /* Select default pin state */ pinctrl_pm_select_default_state(dev); -- 2.17.1