From patchwork Tue Oct 14 07:15:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 38691 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F3D5620549 for ; Tue, 14 Oct 2014 07:16:07 +0000 (UTC) Received: by mail-lb0-f198.google.com with SMTP id 10sf4919192lbg.1 for ; Tue, 14 Oct 2014 00:16:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=hcBM+6ASACVvHcNcbLekqFrYDqfCRL21FucX/uNKCEw=; b=fCGXxoLr2OWOO78lEmmwXCBplewfQUvSLzQIxNEqCT4oNEq1EK7X6iwYk9JTl2O4zj giQYUJzIs033SCnwuHJdjeU2KPQhcMo0X78f+onugzBrZymvHLeDoyO8YNsBhaPenv2r Ko50QTDQQ3pZrCWQzPLGBWWzEMbxVd78UH+eo3R8u837IzvCl5aZjJFLB4iGMtcWS3ca odijQUxUX5a334GDvP8HvFvh4bdzx8iyhoIqu67/NY8sZCp6T8oWyZbUl9WQWK5fdjbn WN/Kq9sqW4UprQJr0fGn2ytbGK1rSRbXOA8Hl2Rm4uc0Jl4fS/yMpErUYPyw1pfsqHnL KvDQ== X-Gm-Message-State: ALoCoQmUT2Se25QTyzcoOkeeGF6EJPUwBe1OOD04uvOEMDDF80M0GIY+DbLdEHnIgdS0tPA1vc0N X-Received: by 10.112.99.72 with SMTP id eo8mr547861lbb.7.1413270966491; Tue, 14 Oct 2014 00:16:06 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.141 with SMTP id j13ls559723laa.5.gmail; Tue, 14 Oct 2014 00:16:06 -0700 (PDT) X-Received: by 10.152.30.33 with SMTP id p1mr3321563lah.78.1413270966255; Tue, 14 Oct 2014 00:16:06 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx.google.com with ESMTPS id t7si17490881laa.104.2014.10.14.00.16.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 14 Oct 2014 00:16:06 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by mail-lb0-f182.google.com with SMTP id z11so7715850lbi.13 for ; Tue, 14 Oct 2014 00:16:06 -0700 (PDT) X-Received: by 10.112.130.41 with SMTP id ob9mr3336083lbb.74.1413270966181; Tue, 14 Oct 2014 00:16:06 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.84.229 with SMTP id c5csp345561lbz; Tue, 14 Oct 2014 00:16:05 -0700 (PDT) X-Received: by 10.152.43.197 with SMTP id y5mr3431339lal.82.1413270964285; Tue, 14 Oct 2014 00:16:04 -0700 (PDT) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com [209.85.215.41]) by mx.google.com with ESMTPS id jz7si24603789lbc.49.2014.10.14.00.16.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 14 Oct 2014 00:16:04 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by mail-la0-f41.google.com with SMTP id pn19so7989945lab.14 for ; Tue, 14 Oct 2014 00:16:04 -0700 (PDT) X-Received: by 10.112.135.229 with SMTP id pv5mr3416361lbb.52.1413270964173; Tue, 14 Oct 2014 00:16:04 -0700 (PDT) Received: from uffe-Latitude-E6430s.lan (90-231-160-185-no158.tbcn.telia.com. [90.231.160.185]) by mx.google.com with ESMTPSA id a2sm5279497lbs.21.2014.10.14.00.16.01 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 14 Oct 2014 00:16:03 -0700 (PDT) From: Ulf Hansson To: Mauro Carvalho Chehab , linux-media@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-pm@vger.kernel.org, Geert Uytterhoeven , Kevin Hilman , Tomasz Figa , Kukjin Kim , Philipp Zabel , Sylwester Nawrocki , "Rafael J. Wysocki" , Pavel Machek , Ulf Hansson Subject: [PATCH 5/7] [media] exynos-gsc: Fixup system PM Date: Tue, 14 Oct 2014 09:15:38 +0200 Message-Id: <1413270940-4378-6-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1413270940-4378-1-git-send-email-ulf.hansson@linaro.org> References: <1413270940-4378-1-git-send-email-ulf.hansson@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ulf.hansson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , We had several issues with the system PM support. 1) It were depending on CONFIG_PM_RUNTIME. 2) It unnecessarily tracked the suspend state in a flag. 3) If userspace through sysfs prevents runtime PM operations, could cause the device to stay in low power after a system PM resume, which is not reflected properly. Solve all the above issues by using pm_runtime_force_suspend|resume() as the system PM callbacks. Signed-off-by: Ulf Hansson --- drivers/media/platform/exynos-gsc/gsc-core.c | 41 ++-------------------------- drivers/media/platform/exynos-gsc/gsc-core.h | 3 -- 2 files changed, 2 insertions(+), 42 deletions(-) diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c index 361a807..1b9f3d7 100644 --- a/drivers/media/platform/exynos-gsc/gsc-core.c +++ b/drivers/media/platform/exynos-gsc/gsc-core.c @@ -1183,46 +1183,9 @@ static int gsc_runtime_suspend(struct device *dev) } #endif -static int gsc_resume(struct device *dev) -{ - struct gsc_dev *gsc = dev_get_drvdata(dev); - unsigned long flags; - - pr_debug("gsc%d: state: 0x%lx", gsc->id, gsc->state); - - /* Do not resume if the device was idle before system suspend */ - spin_lock_irqsave(&gsc->slock, flags); - if (!test_and_clear_bit(ST_SUSPEND, &gsc->state) || - !gsc_m2m_opened(gsc)) { - spin_unlock_irqrestore(&gsc->slock, flags); - return 0; - } - spin_unlock_irqrestore(&gsc->slock, flags); - - if (!pm_runtime_suspended(dev)) - return gsc_runtime_resume(dev); - - return 0; -} - -static int gsc_suspend(struct device *dev) -{ - struct gsc_dev *gsc = dev_get_drvdata(dev); - - pr_debug("gsc%d: state: 0x%lx", gsc->id, gsc->state); - - if (test_and_set_bit(ST_SUSPEND, &gsc->state)) - return 0; - - if (!pm_runtime_suspended(dev)) - return gsc_runtime_suspend(dev); - - return 0; -} - static const struct dev_pm_ops gsc_pm_ops = { - .suspend = gsc_suspend, - .resume = gsc_resume, + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) SET_PM_RUNTIME_PM_OPS(gsc_runtime_suspend, gsc_runtime_resume, NULL) }; diff --git a/drivers/media/platform/exynos-gsc/gsc-core.h b/drivers/media/platform/exynos-gsc/gsc-core.h index ef0a656..2dbaa20 100644 --- a/drivers/media/platform/exynos-gsc/gsc-core.h +++ b/drivers/media/platform/exynos-gsc/gsc-core.h @@ -48,9 +48,6 @@ #define GSC_CTX_ABORT (1 << 7) enum gsc_dev_flags { - /* for global */ - ST_SUSPEND, - /* for m2m node */ ST_M2M_OPEN, ST_M2M_RUN,