From patchwork Fri Aug 14 10:49:17 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 41372 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n7EArFaW025527 for ; Fri, 14 Aug 2009 10:53:55 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753493AbZHNKxx (ORCPT ); Fri, 14 Aug 2009 06:53:53 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754517AbZHNKxx (ORCPT ); Fri, 14 Aug 2009 06:53:53 -0400 Received: from wf-out-1314.google.com ([209.85.200.171]:50812 "EHLO wf-out-1314.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753493AbZHNKxw (ORCPT ); Fri, 14 Aug 2009 06:53:52 -0400 Received: by wf-out-1314.google.com with SMTP id 26so428890wfd.4 for ; Fri, 14 Aug 2009 03:53:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:date:message-id :in-reply-to:references:subject; bh=APcA7V9fIzVMPG2oKElRwW2P16McWmyH4tQ8//bXcq4=; b=KPMKjGaD/WahGy61dxUEdJixv+4oFsKuupZE6DGSccrgS0bqHIgl5OaKqQHT7ukaB0 VYxuZPGhcWebM/3sCqESn51bGcKIQIh5ZHHve5EoFVSjva9OPvWFUeLGvQMtSDRw8rG4 QmJPmqxDky3w78y6CLXp3MbCumpEsKaSY3OpQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:date:message-id:in-reply-to:references:subject; b=rZemY2WuYSOOPRkS88V9qP1SKXAGs7QoG//3VwNx6TL943k3BzpfL/FMVW6XcaL+ZD I0BqGYHG4aDlQzpdMepd7hB8XPelVULq3aDnQOpi2x3X0PTZMxm1yfOYEhu8JHzAO4H8 4cz/ULfDLmESGOrKf9Lsd/mPNYmGzP8Jk5Exk= Received: by 10.142.148.1 with SMTP id v1mr321406wfd.84.1250247233164; Fri, 14 Aug 2009 03:53:53 -0700 (PDT) Received: from rx1.opensource.se (mailhost.igel.co.jp [219.106.231.130]) by mx.google.com with ESMTPS id g14sm301640rvb.1.2009.08.14.03.53.50 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 14 Aug 2009 03:53:52 -0700 (PDT) From: Magnus Damm To: linux-pm@lists.linux-foundation.org Cc: linux-sh@vger.kernel.org, gregkh@suse.de, rjw@sisk.pl, lethal@linux-sh.org, stern@rowland.harvard.edu, pavel@ucw.cz, Magnus Damm Date: Fri, 14 Aug 2009 19:49:17 +0900 Message-Id: <20090814104917.32396.63200.sendpatchset@rx1.opensource.se> In-Reply-To: <20090814104808.32396.50021.sendpatchset@rx1.opensource.se> References: <20090814104808.32396.50021.sendpatchset@rx1.opensource.se> Subject: [PATCH 04/05] v4l2: Runtime PM for SuperH Mobile CEU Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org From: Magnus Damm This patch modifies the SuperH Mobile CEU driver to support Runtime PM. Driver callbacks for Runtime PM are empty because the device registers are always re-initialized after pm_runtime_get_sync(). The Runtime PM functions replaces the clock framework module stop bit handling in this driver. Signed-off-by: Magnus Damm --- drivers/media/video/sh_mobile_ceu_camera.c | 41 +++++++++++++++++----------- 1 file changed, 25 insertions(+), 16 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 0001/drivers/media/video/sh_mobile_ceu_camera.c +++ work/drivers/media/video/sh_mobile_ceu_camera.c 2009-08-14 15:04:05.000000000 +0900 @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include @@ -86,7 +86,6 @@ struct sh_mobile_ceu_dev { unsigned int irq; void __iomem *base; - struct clk *clk; unsigned long video_limit; /* lock used to protect videobuf */ @@ -364,7 +363,7 @@ static int sh_mobile_ceu_add_device(stru if (ret) goto err; - clk_enable(pcdev->clk); + pm_runtime_get_sync(ici->dev); ceu_write(pcdev, CAPSR, 1 << 16); /* reset */ while (ceu_read(pcdev, CSTSR) & 1) @@ -398,7 +397,7 @@ static void sh_mobile_ceu_remove_device( } spin_unlock_irqrestore(&pcdev->lock, flags); - clk_disable(pcdev->clk); + pm_runtime_put_sync(ici->dev); icd->ops->release(icd); @@ -801,7 +800,6 @@ static int sh_mobile_ceu_probe(struct pl struct sh_mobile_ceu_dev *pcdev; struct resource *res; void __iomem *base; - char clk_name[8]; unsigned int irq; int err = 0; @@ -865,13 +863,9 @@ static int sh_mobile_ceu_probe(struct pl goto exit_release_mem; } - snprintf(clk_name, sizeof(clk_name), "ceu%d", pdev->id); - pcdev->clk = clk_get(&pdev->dev, clk_name); - if (IS_ERR(pcdev->clk)) { - dev_err(&pdev->dev, "cannot get clock \"%s\"\n", clk_name); - err = PTR_ERR(pcdev->clk); - goto exit_free_irq; - } + pm_suspend_ignore_children(&pdev->dev, true); + pm_runtime_enable(&pdev->dev); + pm_runtime_resume(&pdev->dev); pcdev->ici.priv = pcdev; pcdev->ici.dev = &pdev->dev; @@ -881,12 +875,10 @@ static int sh_mobile_ceu_probe(struct pl err = soc_camera_host_register(&pcdev->ici); if (err) - goto exit_free_clk; + goto exit_free_irq; return 0; -exit_free_clk: - clk_put(pcdev->clk); exit_free_irq: free_irq(pcdev->irq, pcdev); exit_release_mem: @@ -907,7 +899,6 @@ static int sh_mobile_ceu_remove(struct p struct sh_mobile_ceu_dev, ici); soc_camera_host_unregister(soc_host); - clk_put(pcdev->clk); free_irq(pcdev->irq, pcdev); if (platform_get_resource(pdev, IORESOURCE_MEM, 1)) dma_release_declared_memory(&pdev->dev); @@ -916,9 +907,27 @@ static int sh_mobile_ceu_remove(struct p return 0; } +static int sh_mobile_ceu_runtime_nop(struct device *dev) +{ + /* Runtime PM callback shared between ->runtime_suspend() + * and ->runtime_resume(). Simply returns success. + * + * This driver re-initializes all registers after + * pm_runtime_get_sync() anyway so there is no need + * to save and restore registers here. + */ + return 0; +} + +static struct dev_pm_ops sh_mobile_ceu_dev_pm_ops = { + .runtime_suspend = sh_mobile_ceu_runtime_nop, + .runtime_resume = sh_mobile_ceu_runtime_nop, +}; + static struct platform_driver sh_mobile_ceu_driver = { .driver = { .name = "sh_mobile_ceu", + .pm = &sh_mobile_ceu_dev_pm_ops, }, .probe = sh_mobile_ceu_probe, .remove = sh_mobile_ceu_remove,