Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2043867imu; Thu, 17 Jan 2019 07:29:59 -0800 (PST) X-Google-Smtp-Source: ALg8bN44whT4TJnzlAXEYk4kI7s3tmyVoNEsiUxtm9FIIQz2rv9n8S4/EU6Y9FyeO0bPG+XghmAC X-Received: by 2002:a17:902:1127:: with SMTP id d36mr14903266pla.299.1547738998932; Thu, 17 Jan 2019 07:29:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547738998; cv=none; d=google.com; s=arc-20160816; b=hkrMUcxCKzAgeJp/39DoLk4u3oQ43uBlaFFUSebmPF2+3dyc9uBrjI04Ul2dAZtx9j K4wPIlokADR+TSxktuzvTXpLCP708FdtQlHVIaR3vDGD3CnEirjNOHVnhZrWk/Uj/rqK oDvzYNyFoDVcn0Rbasbo6lz/KbVec3XBtNa4PUH28rhj24EUvxdPJcnMeSireN4d3yzw f8POqmb2cB8GIuR/1AAWw7SR3AW/HBcW7G4BQXArHPeutFiAwMwaKA2NPThNZpV3cZaT U/qDoKTo/btyi+QQBTidXOO2O7LGc+zFQsrHFd7w45X0aaZYwbIbbmOybyOKryEu3pOf PP1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dmarc-filter:dkim-signature :dkim-signature; bh=OMy22Hz7ZyMRjlAFgHppMCllpRC1lYMhQKTy51V2z+s=; b=djDOPVR39IggiwG4Mh8xsNQewbn4M035KRPMD5K5Vlyjo/bWciHavbR4IDN6XM9d/Q 6KkHk6x3t2A3nWNw5OwARIeXKq7uVeioL7fNT7VS9j3Z3xPXan6XyOg9pa+6TJU1J3Rp oVnGtQ2JtiHQ1srvh2d1/2708DZFH9N7WOqpHdsuAQcEh96ghdRKk7WxYxrueP92dxjV MubLnwhbV7/4Hw+vr5o6R8fMBxvnpgFStdOE7QpPCYT07NR05vVY6rtAvkyhyEqPaViC aDdLnKV7Wb88CwPFPxZOk019JaUnIz6WPfmUNroVDkJR3HmLMxgvBtvitc7mYXzT2DPR c/JA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=feO9GUBs; dkim=pass header.i=@codeaurora.org header.s=default header.b=a56qrrEI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g10si1816462plq.371.2019.01.17.07.29.42; Thu, 17 Jan 2019 07:29:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=feO9GUBs; dkim=pass header.i=@codeaurora.org header.s=default header.b=a56qrrEI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728386AbfAQPUA (ORCPT + 99 others); Thu, 17 Jan 2019 10:20:00 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:45626 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725970AbfAQPUA (ORCPT ); Thu, 17 Jan 2019 10:20:00 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 5F1CA60854; Thu, 17 Jan 2019 15:19:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1547738399; bh=yvgmVO8D14MSCmLKPZotqFQq9YZa5LG6cCqcUWPhPP8=; h=From:To:Cc:Subject:Date:From; b=feO9GUBsSZNCkT33qxQk2pd4UCGldzrvVHXyzUxUPgIcWny9zYGImWuvGpgHDV0YX BSIupklbYYH1ZNeDQj5742H/owqxQlXwoYT1uTfZuvNKpGHvwKyANUiiKYwwRQ3OAr GvLkXBZ14DVeQV8NgueWhu0X/chk7wvO/rZaR02E= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 Received: from blr-ubuntu-253.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.18.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: saiprakash.ranjan@codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 8330460854; Thu, 17 Jan 2019 15:19:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1547738398; bh=yvgmVO8D14MSCmLKPZotqFQq9YZa5LG6cCqcUWPhPP8=; h=From:To:Cc:Subject:Date:From; b=a56qrrEIMAi1at8jdTawZI+3A8kuUg2oxZ4RMcIswqYcW1OuiNpBp7dngBNXMhxRf rJ5NO6KbYkqfmdgeoTyl8GsienJQt7F/Lm3nlrin7ohrHJKZtsEOlw9AD7iExrmMzB F0fCzMUx5zYVAf/l3rNNj5BcQat6nuy6xNpq60HY= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 8330460854 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=saiprakash.ranjan@codeaurora.org From: Sai Prakash Ranjan To: Guenter Roeck , Wim Van Sebroeck , linux-watchdog@vger.kernel.org, Guenter Roeck Cc: Rajendra Nayak , Vivek Gautam , Sibi Sankar , Stephen Boyd , Doug Anderson , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Sai Prakash Ranjan Subject: [PATCHv2] watchdog: qcom: Add suspend/resume support Date: Thu, 17 Jan 2019 20:49:42 +0530 Message-Id: <20190117151942.6092-1-saiprakash.ranjan@codeaurora.org> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This adds the support for qcom watchdog suspend and resume when entering and exiting deep sleep states. Otherwise having watchdog active after suspend would result in unwanted crashes/resets if resume happens after a long time. Signed-off-by: Sai Prakash Ranjan --- v2: * Use __maybe_unused instead of #ifdef as suggested by Brian and Guenter --- drivers/watchdog/qcom-wdt.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/watchdog/qcom-wdt.c b/drivers/watchdog/qcom-wdt.c index 780971318810..5dfd604477a4 100644 --- a/drivers/watchdog/qcom-wdt.c +++ b/drivers/watchdog/qcom-wdt.c @@ -245,6 +245,28 @@ static int qcom_wdt_remove(struct platform_device *pdev) return 0; } +static int __maybe_unused qcom_wdt_suspend(struct device *dev) +{ + struct qcom_wdt *wdt = dev_get_drvdata(dev); + + if (watchdog_active(&wdt->wdd)) + qcom_wdt_stop(&wdt->wdd); + + return 0; +} + +static int __maybe_unused qcom_wdt_resume(struct device *dev) +{ + struct qcom_wdt *wdt = dev_get_drvdata(dev); + + if (watchdog_active(&wdt->wdd)) + qcom_wdt_start(&wdt->wdd); + + return 0; +} + +static SIMPLE_DEV_PM_OPS(qcom_wdt_pm_ops, qcom_wdt_suspend, qcom_wdt_resume); + static const struct of_device_id qcom_wdt_of_table[] = { { .compatible = "qcom,kpss-timer", .data = reg_offset_data_apcs_tmr }, { .compatible = "qcom,scss-timer", .data = reg_offset_data_apcs_tmr }, @@ -259,6 +281,7 @@ static struct platform_driver qcom_watchdog_driver = { .driver = { .name = KBUILD_MODNAME, .of_match_table = qcom_wdt_of_table, + .pm = &qcom_wdt_pm_ops, }, }; module_platform_driver(qcom_watchdog_driver); -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation