From patchwork Tue Dec 10 14:06:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chew Chiau Ee X-Patchwork-Id: 3314251 Return-Path: X-Original-To: patchwork-dmaengine@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9BFBB9F37A for ; Tue, 10 Dec 2013 06:05:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DB7BC20340 for ; Tue, 10 Dec 2013 06:05:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 17F5F202FE for ; Tue, 10 Dec 2013 06:05:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750748Ab3LJGFb (ORCPT ); Tue, 10 Dec 2013 01:05:31 -0500 Received: from mga02.intel.com ([134.134.136.20]:43388 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750722Ab3LJGFb (ORCPT ); Tue, 10 Dec 2013 01:05:31 -0500 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP; 09 Dec 2013 22:05:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.93,863,1378882800"; d="scan'208";a="441481915" Received: from unknown (HELO localhost.png.intel.com) ([172.30.69.76]) by fmsmga001.fm.intel.com with ESMTP; 09 Dec 2013 22:05:28 -0800 From: Chew Chiau Ee To: Viresh Kumar , Andy Shevchenko , Dan Williams , Vinod Koul Cc: dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] dma: dw: Add suspend and resume handling for PCI mode DW_DMAC. Date: Tue, 10 Dec 2013 22:06:13 +0800 Message-Id: <1386684373-24753-1-git-send-email-chiau.ee.chew@intel.com> X-Mailer: git-send-email 1.7.4.4 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00, DATE_IN_FUTURE_06_12, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Chew, Chiau Ee This is to disable/enable DW_DMAC hw during suspend/resume. Signed-off-by: Chew, Chiau Ee Acked-by: Andy Shevchenko --- drivers/dma/dw/pci.c | 33 +++++++++++++++++++++++++++++++++ 1 files changed, 33 insertions(+), 0 deletions(-) diff --git a/drivers/dma/dw/pci.c b/drivers/dma/dw/pci.c index e89fc24..97bc3a2 100644 --- a/drivers/dma/dw/pci.c +++ b/drivers/dma/dw/pci.c @@ -75,6 +75,36 @@ static void dw_pci_remove(struct pci_dev *pdev) dev_warn(&pdev->dev, "can't remove device properly: %d\n", ret); } +#ifdef CONFIG_PM_SLEEP + +static int dw_pci_suspend_noirq(struct device *dev) +{ + struct pci_dev *pci = to_pci_dev(dev); + struct dw_dma_chip *chip = pci_get_drvdata(pci); + + return dw_dma_suspend(chip); +}; + +static int dw_pci_resume_noirq(struct device *dev) +{ + struct pci_dev *pci = to_pci_dev(dev); + struct dw_dma_chip *chip = pci_get_drvdata(pci); + + return dw_dma_resume(chip); +}; + +#else /* !CONFIG_PM_SLEEP */ + +#define dw_pci_suspend_noirq NULL +#define dw_pci_resume_noirq NULL + +#endif /* !CONFIG_PM_SLEEP */ + +static const struct dev_pm_ops dw_pci_dev_pm_ops = { + .suspend_noirq = dw_pci_suspend_noirq, + .resume_noirq = dw_pci_resume_noirq, +}; + static DEFINE_PCI_DEVICE_TABLE(dw_pci_id_table) = { /* Medfield */ { PCI_VDEVICE(INTEL, 0x0827), (kernel_ulong_t)&dw_pci_pdata }, @@ -92,6 +122,9 @@ static struct pci_driver dw_pci_driver = { .id_table = dw_pci_id_table, .probe = dw_pci_probe, .remove = dw_pci_remove, + .driver = { + .pm = &dw_pci_dev_pm_ops, + }, }; module_pci_driver(dw_pci_driver);