From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S969289AbdIZNw2 (ORCPT ); Tue, 26 Sep 2017 09:52:28 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:38845 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968208AbdIZNw0 (ORCPT ); Tue, 26 Sep 2017 09:52:26 -0400 X-Google-Smtp-Source: AOwi7QCnrijYwN+fGtjZ5IxrRIRI9bWtAq4YFZ5tozvu8O2QXHJRWOWn98tHasDqWW1CEnADNZUINw== Subject: Re: [PATCH] rtc: ds1374: wdt:support suspend/resume for watchdog To: Alexandre Belloni , 18502523564 <18502523564@163.com> Cc: "a.zummo" , linux-rtc , linux-kernel , Wim Van Sebroeck , linux-watchdog@vger.kernel.org References: <1506340724-18108-1-git-send-email-18502523564@163.com> <20170925120742.ja54wu2orgai6fsr@piout.net> <20170926102239.qjmhfry4vtaow4gk@piout.net> From: Guenter Roeck Message-ID: <2b8f974f-6151-ea72-55e1-58df07279a06@roeck-us.net> Date: Tue, 26 Sep 2017 06:52:24 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20170926102239.qjmhfry4vtaow4gk@piout.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/26/2017 03:22 AM, Alexandre Belloni wrote: > (+Cc wdt maintainers) > > On 26/09/2017 at 09:56:32 +0800, 18502523564 wrote: >> Hi Alexandre, >> >> Thanks for your reply. >> Do you think is this a issue when using as a watchdog in suspend? >> I takes the drivers/watchdog/ subsystem for reference, some drivers in suspend >> also call disable_watchdog.Or do you have any better suggestion? > > I guess this is a question for the watchdog subsystem maintainers. > However, I think that everything can be handled properly from userspace > as I know some atmel based devices have their watchdog enabled while > the platform is suspended. > Depends on the driver, really. There is one thing wrong below, though: It appears that on resume, the watchdog is unconditionally enabled. Guenter >> Thank you. >> >> >> >> >> ------------------ Original ------------------ >> From: Alexandre Belloni >> Date: 周一,9月 25,2017 20:07 >> To: winton.liu <18502523564@163.com> >> Cc: a.zummo , linux-rtc , >> linux-kernel >> Subject: Re: [PATCH] rtc: ds1374: wdt:support suspend/resume for watchdog >> >> >> Hi, >> >> On 25/09/2017 at 19:58:44 +0800, winton.liu wrote: >>> When enable CONFIG_RTC_DRV_DS1374_WDT use as watchdog, >>> in suspend mode, watchdog is still working but no daemon >>> patting the watchdog. The system will reboot if timeout. >>> So disable watchdog in suspend and recover it in resume. >>> >> >> That is definitively not what we want. Many people will want to still >> have the watchdog running when the platform is suspended. Your options >> are to either disable the watchdog before going to suspend or wake up >> the platform just in time to ping the watchdog. >> >>> Signed-off-by: winton.liu <18502523564@163.com> >>> --- >>> drivers/rtc/rtc-ds1374.c | 8 ++++++++ >>> 1 file changed, 8 insertions(+) >>> >>> diff --git a/drivers/rtc/rtc-ds1374.c b/drivers/rtc/rtc-ds1374.c >>> index 38a2e9e..e990773 100644 >>> --- a/drivers/rtc/rtc-ds1374.c >>> +++ b/drivers/rtc/rtc-ds1374.c >>> @@ -690,6 +690,10 @@ static int ds1374_suspend(struct device *dev) >>> { >>> struct i2c_client *client = to_i2c_client(dev); >>> >>> +#ifdef CONFIG_RTC_DRV_DS1374_WDT >>> + ds1374_wdt_disable(); >>> +#endif >>> + >>> if (client->irq > 0 && device_may_wakeup(&client->dev)) >>> enable_irq_wake(client->irq); >>> return 0; >>> @@ -699,6 +703,10 @@ static int ds1374_resume(struct device *dev) >>> { >>> struct i2c_client *client = to_i2c_client(dev); >>> >>> +#ifdef CONFIG_RTC_DRV_DS1374_WDT >>> + ds1374_wdt_settimeout(131072); >>> +#endif >>> + >>> if (client->irq > 0 && device_may_wakeup(&client->dev)) >>> disable_irq_wake(client->irq); >>> return 0; >>> -- >>> 1.9.1 >>> >>> >> >> -- >> Alexandre Belloni, Free Electrons >> Embedded Linux and Kernel engineering >> http://free-electrons.com >> >