mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Cypher Wu <cypher.w@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Questions about Watch Dog Timer under Linux.
Date: Wed, 9 Dec 2009 14:59:19 +0000	[thread overview]
Message-ID: <20091209145919.GH9018@sirena.org.uk> (raw)
In-Reply-To: <f9f38a550912090647q5af6cb14w84ea8d9223d82bd9@mail.gmail.com>

On Wed, Dec 09, 2009 at 10:47:28PM +0800, Cypher Wu wrote:
> I'm used to work on embedded systems, the Watch Dog Timer in our
> products is usually a seperate chip on the board wich will start to
> work after power reset and will time out in 2 seconds. The system has
> to start dog clearing from the very beginning and there have no way to
> disable WDT.

> Now I want to use WDT under Linux, while I read
> Documentation/watchdog/watchdog-api.txt and then look though some
> drivers of WDT under Linux, it seems WDT under Linux has to be able to
> be disabled, and it will be disabled from the beginning, and starting
> to work after the application open the special driver file?  The
> sample code under Linux use a very bigger time span than our embedded
> system:

You don't *have* to be able to disable the watchdog - the API supports
it but you can always fail to do so (and even where you can Linux
watchdogs support a non-disabling mode, look for WATCHDOG_NOWAYOUT in
existing drivers).  Similarly, there's no problem with having the
watchdog be live at system startup - if the watchdog is already enabled
when the driver is opened then the driver just needs to handle that
gracefully.

> 	while (1) {
> 		ret = write(fd, "\0", 1);

...

> 		sleep(10);
> 	}
> 

> Is this the pattern we have to follow to use WDT under Linux? We have

You're free to update the watchdog as often as you like, the 10s is
just a number that was picked which is suitable for that application.

> to choose a chip as WDT, and it seems the chip we've familiar under
> embedded systems can't be used under Linux?

Nothing about your watchdog sounds particularly unusual for Linux.

  reply	other threads:[~2009-12-09 14:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-09 14:47 Cypher Wu
2009-12-09 14:59 ` Mark Brown [this message]
2009-12-11  8:27   ` Cypher Wu
2009-12-11 10:21     ` Mark Brown
2009-12-12  3:46       ` Cypher Wu
2009-12-12 13:50         ` Alan Cox
2009-12-09 16:29 ` Alan Cox
2009-12-11  8:33   ` Cypher Wu
2009-12-09 17:26 ` Pádraig Brady
2009-12-11  8:38   ` Cypher Wu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091209145919.GH9018@sirena.org.uk \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=cypher.w@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®