From patchwork Thu May 12 17:11:05 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raffaele Recalcati X-Patchwork-Id: 780592 Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p4CHDuDP021828 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 12 May 2011 17:14:17 GMT Received: from dlep33.itg.ti.com ([157.170.170.112]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id p4CHCPDE032630 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 12 May 2011 12:12:25 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep33.itg.ti.com (8.13.7/8.13.7) with ESMTP id p4CHCPud003377; Thu, 12 May 2011 12:12:25 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 45D0A8062F; Thu, 12 May 2011 12:12:25 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp52.itg.ti.com (dflp52.itg.ti.com [128.247.22.96]) by linux.omap.com (Postfix) with ESMTP id 144C780626 for ; Thu, 12 May 2011 12:11:28 -0500 (CDT) Received: from medina.ext.ti.com (localhost [127.0.0.1]) by dflp52.itg.ti.com (8.13.7/8.13.7) with ESMTP id p4CHBRYB005131 for ; Thu, 12 May 2011 12:11:27 -0500 (CDT) Received: from psmtp.com (na3sys009amx207.postini.com [74.125.149.47]) by medina.ext.ti.com (8.13.7/8.13.7) with SMTP id p4CHBQPV001789 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 12 May 2011 12:11:27 -0500 Received: from mail-wy0-f173.google.com ([74.125.82.173]) (using TLSv1) by na3sys009amx207.postini.com ([74.125.148.10]) with SMTP; Thu, 12 May 2011 10:11:27 PDT Received: by mail-wy0-f173.google.com with SMTP id 42so1522370wyb.4 for ; Thu, 12 May 2011 10:11:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=gtSjVamW8fUT7GYA4BPMpc+ZjKmywbkfRuLOFxu6Vyg=; b=KXehNfSkiDFIRmcAF1p2AqgOqPfcj9Dl+5Ve9TFth+ecS0MbAIFw8Vity3X9kfpQVP OAB2ZHbEOtptXZCx/buEkh4JbrlTkkO1ILw6liisVLTGLjMVclr6W173MvEBF8wFoyPD QibsZZVhIPBlgG83ReVTyrGZbBVMh2xNVQj10= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=SRCup1MSlqIRXKFiaDONCNgEkMcahqqWuaP3rN6VC8/VlC/e4WRIyix+oYzENBGuCx B3PWTP6t4UaRvjAnOEkIrninpJaRWPp4nxvOlVAXgKod9d55xzIFGyH5SPufehRrFjFm mfwvF+l2U23qa0cYcrU/DcMPqbxrux0jHwoG8= Received: by 10.216.61.77 with SMTP id v55mr1921094wec.114.1305220286301; Thu, 12 May 2011 10:11:26 -0700 (PDT) Received: from localhost.localdomain (host41-16-static.112-2-b.business.telecomitalia.it [2.112.16.41]) by mx.google.com with ESMTPS id c43sm719446weo.18.2011.05.12.10.11.24 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 12 May 2011 10:11:25 -0700 (PDT) From: Raffaele Recalcati To: linux-pm@lists.linux-foundation.org Subject: [PATCH 4/4] DaVinci: vpfe: support for pm_loss Date: Thu, 12 May 2011 19:11:05 +0200 Message-Id: <1305220265-9020-5-git-send-email-lamiaposta71@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1305220265-9020-1-git-send-email-lamiaposta71@gmail.com> References: <1305220265-9020-1-git-send-email-lamiaposta71@gmail.com> X-pstn-neptune: 0/0/0.00/0 X-pstn-levels: (S:46.63939/99.90000 CV:99.9000 FC:95.5390 LC:95.5390 R:95.9108 P:95.9108 M:97.0282 C:98.6951 ) X-pstn-settings: 2 (0.5000:0.0750) s cv GT3 gt2 gt1 r p m c X-pstn-addresses: from [db-null] Cc: davinci-linux-open-source@linux.davincidsp.com, Raffaele Recalcati , linux-kernel@vger.kernel.org X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: davinci-linux-open-source-bounces@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com X-Greylist: Sender succeeded STARTTLS authentication, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 12 May 2011 17:14:17 +0000 (UTC) From: Raffaele Recalcati Signed-off-by: Raffaele Recalcati --- drivers/media/video/davinci/vpfe_capture.c | 45 ++++++++++++++++++++++++++++ 1 files changed, 45 insertions(+), 0 deletions(-) diff --git a/drivers/media/video/davinci/vpfe_capture.c b/drivers/media/video/davinci/vpfe_capture.c index 353eada..21fa9bf 100644 --- a/drivers/media/video/davinci/vpfe_capture.c +++ b/drivers/media/video/davinci/vpfe_capture.c @@ -74,6 +74,8 @@ #include #include #include +#include +#include #include "ccdc_hw_device.h" static int debug; @@ -2051,6 +2053,46 @@ static int __devexit vpfe_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM_LOSS +static int vpfe_capture_power_changed(struct device *dev, + enum sys_power_state s) +{ + int ret; + struct vpfe_device *vpfe_dev = dev_get_drvdata(dev); + struct vpfe_subdev_info *sdinfo = vpfe_dev->current_subdev; + + if (!sdinfo) + return -EINVAL; + + if (!vpfe_dev->started) { + pr_debug_pm_loss("vpfe_capture_power_changed(%d) " + "BUT NOTHING TO DO\n", s); + return 0; + } + + sdinfo = vpfe_dev->current_subdev; + + switch (s) { + case SYS_PWR_GOOD: + pr_debug_pm_loss("vpfe_capture_power_changed(%d)\n", s); + ret = v4l2_device_call_until_err(&vpfe_dev->v4l2_dev, + sdinfo->grp_id, + video, s_stream, 1); + break; + case SYS_PWR_FAILING: + pr_debug_pm_loss("vpfe_capture_power_changed(%d)\n", s); + ret = v4l2_device_call_until_err(&vpfe_dev->v4l2_dev, + sdinfo->grp_id, + video, s_stream, 0); + break; + default: + BUG(); + ret = -ENODEV; + } + return ret; +} +#endif /* CONFIG_PM_LOSS */ + static int vpfe_suspend(struct device *dev) { return 0; @@ -2064,6 +2106,9 @@ static int vpfe_resume(struct device *dev) static const struct dev_pm_ops vpfe_dev_pm_ops = { .suspend = vpfe_suspend, .resume = vpfe_resume, +#ifdef CONFIG_PM_LOSS + .power_changed = vpfe_capture_power_changed, +#endif }; static struct platform_driver vpfe_driver = {