Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2355965imu; Thu, 17 Jan 2019 12:42:48 -0800 (PST) X-Google-Smtp-Source: ALg8bN5gjU9IEscN7IKALzz+AffE56YukciBFOu6mDxSSMEx+k2KBQbyLhdJtP+NGDmrGG8ZwsBe X-Received: by 2002:a63:2849:: with SMTP id o70mr14605431pgo.155.1547757768642; Thu, 17 Jan 2019 12:42:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547757768; cv=none; d=google.com; s=arc-20160816; b=ZpUQtCouzwiacbzDBeCJxKdTrQjxd+yoDWJkWJlLIZjaI4YlUqqiPl5+gyrYLU/X2K ljSNX8InDEV0ZuHerT/Gk3tUpHMmdObKNio325FZliQ+CGhiGlRXSSap2UFB7+OBkdba pAZEoo3c9oSdJROCKwncMQ28ryOdKDjUJQ5PZVNjen09bJn3UT1bksGBp1nMwuSGS0Ho AR6tl+xukb2bkO9TJu43cZLNnjP8khC3WM0WR/5CVFYMZE6JJTgkBNhdeY0S3uCj9D4Q RctvsVK06Ru26ZSpuzbpNgWs7jRXoQi0be3sxAElkL97MfIg+gOaxIzucE0DrffcsLGk m9AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=C2Z4QWy5wNJw+5XfdnScGboqm8ucQNIbMLIloYyNmGs=; b=sFHYJRRyW6sg6cjcPAGx6AKizIb5S9/chiSEupWLXOYmIzgus9wGaFqdrfmRNOxoho 4aiWLbqzmzrpzrrYDnjB0j7TNbFj25lugiWmXvAnjuhmX/VSLFubW+LR4HiiZBB8WNow +6qU8dviro97KIHzw+NhifxHYMQlJkp96AO5l23uFIh2Dhp/by+2fNOjYhZgoEhcMExJ 7uwIIhVwM57OxwcOKjFYUJokqXr4cIn54+mNk/wE71VOw5TwR8XXVJg0o2QJReWepvRu mhjnnMPOu0+MvhNoiBQw5aauf+D6/IbuOc79wJJDAkJDzivYeBdfCIoCauHR79FuNPHS Zwjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=TIZMFkVV; 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 b11si2648471pfo.240.2019.01.17.12.42.29; Thu, 17 Jan 2019 12:42:48 -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=fail header.i=@gmail.com header.s=20161025 header.b=TIZMFkVV; 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 S1728456AbfAQSQH (ORCPT + 99 others); Thu, 17 Jan 2019 13:16:07 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:46948 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728187AbfAQSQH (ORCPT ); Thu, 17 Jan 2019 13:16:07 -0500 Received: by mail-pl1-f194.google.com with SMTP id t13so5084167ply.13; Thu, 17 Jan 2019 10:16:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=C2Z4QWy5wNJw+5XfdnScGboqm8ucQNIbMLIloYyNmGs=; b=TIZMFkVVr50pLywqY+9ZmLTAPt1srFAEqLNU42/hQaulTSrqjj0pfJdkcXYADAlW4U VF1StksTRnrLRVvo27iasEhRcp+QRIoMn8KtgvYVTPCyI4xv+1R8h4C6Q6KDHOGofdou A/sNqGgs/oheekTNdaCg34W9CoAqOzGivZsZLbDflH8BI/8TYKXNvr4YVULYUOoANJBC F5lgTrJVlpQ4/mVAUhv8RYuf/e558bNZr3xDaH7zbGQZXm3vQfuzn8JOUbHJ1GfdCaLc 1y/4qqMSvxbPxXiFGdJGV3aueip1Eg/TfgKuNnEi9eXbR34qPiO0dkHMkRJbEUJloAtT YvrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=C2Z4QWy5wNJw+5XfdnScGboqm8ucQNIbMLIloYyNmGs=; b=D8uzm/cxVCAS7UT7lyPwpvpKtpNmGnLFsDZ03AA/XLB0JsO9PZbThpG9UZ4m/Etj3s j2QZMlxsSQFVm2PKC5yBoAq67T1cUK+ni/zlEwgwp04A5ZjDUAFbVXIUvP+HQJUA+I68 dUQXjvYRk/rI+l4L7aLoHsKMKBF7qKg32QoYcdUEPdYR0lafX8LeOoU1rxnQU7x2QiSE n8BDHif1ni7v8Su8ODr4LJODgGOAk8UGOR1u3pr26UTotZeQuHcD9xDXvegszoiSA/Zx Lw9l4hr7hul5JQI+LhrcCYmL5UIzV08UxOVV0fe1/w8FcWJnzSg8jptDwCpxqGQu1jco KouA== X-Gm-Message-State: AJcUukfYnueS5wvSL1sjWwSUChOs8iNOPO6yRhxrPw9R6gf0d2CIDLZU kCTm0AmgiPLdma+aSwOv9gdoV0lx X-Received: by 2002:a17:902:2aa8:: with SMTP id j37mr15399309plb.226.1547748966386; Thu, 17 Jan 2019 10:16:06 -0800 (PST) Received: from localhost ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id s190sm3275776pfb.103.2019.01.17.10.16.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Jan 2019 10:16:05 -0800 (PST) Date: Thu, 17 Jan 2019 10:16:03 -0800 From: Guenter Roeck To: Sai Prakash Ranjan Cc: Wim Van Sebroeck , linux-watchdog@vger.kernel.org, Guenter Roeck , 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 Subject: Re: [PATCHv2] watchdog: qcom: Add suspend/resume support Message-ID: <20190117181603.GA14800@roeck-us.net> References: <20190117151942.6092-1-saiprakash.ranjan@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190117151942.6092-1-saiprakash.ranjan@codeaurora.org> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 17, 2019 at 08:49:42PM +0530, Sai Prakash Ranjan wrote: > 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 Reviewed-by: Guenter Roeck > > --- > > 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 >