From patchwork Mon Aug 7 11:24:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 9885063 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9871B603B4 for ; Mon, 7 Aug 2017 11:24:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A32A223B2 for ; Mon, 7 Aug 2017 11:24:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C31426247; Mon, 7 Aug 2017 11:24:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E8BF1223B2 for ; Mon, 7 Aug 2017 11:24:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=bO2bSmWiOy6WGKPnxBWxCclZJdFpYpDkz+FP/u76J/U=; b=buuhaW5EuQHCxaZoOM+LxJ4ztF /k8SIy4C5ZWDEPzifVAG8CelYGXKxN8L3sn/MSPoZ4Y82XlbeD645QwbN993rzgVyTf5q2Iho+8sE FSNt/iEgF8uisMEOX2BDoWhei5zMcPfbl1Szr1gadRpLHrkZ7sXB6QF1uFvZv5vMRkdsIeeMUC6T3 rKsK6ER7xwcO/HX0GnrkYMn7W3rL18ZvWMc06DKyMRSGDBx1C6EGhTTkM4VQYc7eFxI5x4G1YwUIo zYoY5bgLyXKmKeCg1AgdDZpg91wxzT153MYvuS1dzSxrUAopzmoy/5r7oQqEAOguG4Xq98cprh/uj t2YYgdHg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1deg9U-0005AV-SO; Mon, 07 Aug 2017 11:24:52 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1deg9P-00052S-0d for linux-arm-kernel@lists.infradead.org; Mon, 07 Aug 2017 11:24:50 +0000 Received: by mail-wm0-x242.google.com with SMTP id q189so684450wmd.0 for ; Mon, 07 Aug 2017 04:24:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=XwTk/CtMZ3TJThl9vG8Bj1a93UPB69NfzGEMnvxJpQw=; b=xuSkro9zK75hQQFIk6ZKvj84dyiP+Kz5hybguma1qkYAUL7+SvIOZM9woi32X7LB56 OmCuxUqsoeZEjoLoX2zkFTeouCjbjiw2u/evUt8kUSlo4gHvM1TaXj5u9xoUCuXSzxgk yohcs+NHgviqV6AF/h2buQ7h+rqtIJo+8UwJzXjsswS/MucvNElD+oCH0bc6zDyYeOUm Nd5BJ1dnsiUqu0DC9SCnwEh6IRM589hUKdzNAv9HrjVb1ZpLe1Vvuzxo0llSxsxIQvAu uuWhnPvtZX1KS2fgOsIOOeV3rDLXJTUBd6vDB6nP+xQ2a9+9hQNyVSPxMPzkrQ3jadR4 3/dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:in-reply-to:references; bh=XwTk/CtMZ3TJThl9vG8Bj1a93UPB69NfzGEMnvxJpQw=; b=Dw1epqxW7IN7Zks7RTrwo+7k3/aE8r88rPitnU/dEe1FT1mk87GLSyWLu4nsLA9NQm tRE2gw34UZoUh1waMAr7oLAHm6z2jMP7+jzIrPI1nnp54oa/5yzPvWK/rnIlS/CQFn1V ThoPP0O4FNCYv0mMg4V9XnUGuQeNb9TTZnogZrtxglzWImHfVsSehzOrSbYO8maTDOUd oIdHAxxr3vJ63eZnXTma1pzveYYzUb+7WKlhEqpWCrmJ9tM/f5ASH5oDP0dm/NkKkiyP xZH8xpTRE24om0F6VdRJQ7fz0nnlPkACZjYi5EpMj5GnA8HExD6CuD8+vMH5lXgR+sO/ 7bxQ== X-Gm-Message-State: AHYfb5j5et1nYa7Qbe0y+Svpk25eG4Wkj6bQZSwrECqkBRMPWMWcd5FY kR4TxsrX0CyQFDL7 X-Received: by 10.28.6.212 with SMTP id 203mr433996wmg.126.1502105067058; Mon, 07 Aug 2017 04:24:27 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id o30sm12209381wrb.76.2017.08.07.04.24.26 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 07 Aug 2017 04:24:26 -0700 (PDT) From: Michal Simek To: linux-kernel@vger.kernel.org, monstr@monstr.eu Subject: [PATCH 2/2] watchdog: of_xilinx_wdt: Add suspend/resume support Date: Mon, 7 Aug 2017 13:24:23 +0200 Message-Id: <1e1307808bd32591ea4f03ec3d70d0eadb38b91e.1502105061.git.michal.simek@xilinx.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170807_042447_307328_FEAC51B6 X-CRM114-Status: GOOD ( 11.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, Wim Van Sebroeck , Guenter Roeck , =?UTF-8?q?S=C3=B6ren=20Brinkmann?= , linux-watchdog@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add suspend/resume support to driver. Signed-off-by: Michal Simek Reviewed-by: Guenter Roeck --- drivers/watchdog/of_xilinx_wdt.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/drivers/watchdog/of_xilinx_wdt.c b/drivers/watchdog/of_xilinx_wdt.c index 41edeb93a327..1cf286945b7a 100644 --- a/drivers/watchdog/of_xilinx_wdt.c +++ b/drivers/watchdog/of_xilinx_wdt.c @@ -264,6 +264,43 @@ static int xwdt_remove(struct platform_device *pdev) return 0; } +/** + * xwdt_suspend - Suspend the device. + * + * @dev: handle to the device structure. + * Return: 0 always. + */ +static int __maybe_unused xwdt_suspend(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct xwdt_device *xdev = platform_get_drvdata(pdev); + + if (watchdog_active(&xdev->xilinx_wdt_wdd)) + xilinx_wdt_stop(&xdev->xilinx_wdt_wdd); + + return 0; +} + +/** + * xwdt_resume - Resume the device. + * + * @dev: handle to the device structure. + * Return: 0 on success, errno otherwise. + */ +static int __maybe_unused xwdt_resume(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct xwdt_device *xdev = platform_get_drvdata(pdev); + int ret = 0; + + if (watchdog_active(&xdev->xilinx_wdt_wdd)) + ret = xilinx_wdt_start(&xdev->xilinx_wdt_wdd); + + return ret; +} + +static SIMPLE_DEV_PM_OPS(xwdt_pm_ops, xwdt_suspend, xwdt_resume); + /* Match table for of_platform binding */ static const struct of_device_id xwdt_of_match[] = { { .compatible = "xlnx,xps-timebase-wdt-1.00.a", }, @@ -278,6 +315,7 @@ static int xwdt_remove(struct platform_device *pdev) .driver = { .name = WATCHDOG_NAME, .of_match_table = xwdt_of_match, + .pm = &xwdt_pm_ops, }, };