From: Scott Wood <scottwood@freescale.com>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: linux-serial@vger.kernel.org, linuxppc-dev@ozlabs.org,
Greg KH <greg@kroah.com>
Subject: Re: [PATCH, RFC] wake up from a serial port
Date: Mon, 13 Aug 2007 15:50:33 -0500 [thread overview]
Message-ID: <46C0C419.6060009@freescale.com> (raw)
In-Reply-To: <Pine.LNX.4.60.0708132207530.5643@poirot.grange>
Guennadi Liakhovetski wrote:
> Well, sort of. One of them is more "natural" - it has a button on the
> front panel, to use the other one you have to modify the hardware.
> However, I like the idea - generally it does seem to be a better approach
> to have it run-time configurable over sysfs... Only - how? The only
> differentitaion ATM between the two ports are these two links:
>
> # ls -l /sys/devices/platform/serial8250.0/tty*
> lrwxrwxrwx 1 root root 0 Aug 13 22:05 /sys/devices/platform/serial8250.0/tty:ttyS0 -> ../../../class/tty/ttyS0
> lrwxrwxrwx 1 root root 0 Aug 13 22:05 /sys/devices/platform/serial8250.0/tty:ttyS1 -> ../../../class/tty/ttyS1
>
> And placing some wakeup file under the class/tty/ directory doesn't seem
> very consistent with the current policy - until now they only live under
> devices/... (Greg added to cc:).
Hmm... I'd assumed each port would have its own device directory. Would
anything break horribly if it were changed so that each tty:ttySx is a
directory, which contains both a wakeup file and the symlink?
> Actually, it is good you replied, Scott:-) I wanted to ask you about the
> following: I've switched to your generic suspend/resume routines using the
> _TLF_NAPPING bit, the arch_suspend_{dis,en}able_irqs() hooks... On wakeup
> your _TLF_NAPPING trick should bypass calling the ISR and jump directly to
> the resume code. However, on wakeup, it looks like I do get the wakeup
> interrupt too.
You should get the interrupt, but not until after the PM code enables
IRQs. Are you saying that the interrupt handler runs before then?
> Is it the correct behaviour and is this the (approximately)
> correct explanation why:
>
> 1. the AVR connected to ttyS0 sends 1 byte on button press and 1 byte on
> button release. So, normally you would get 2 bytes and 2 interupts for one
> such button down-up.
>
> 2. Interrupt is configured as edge (is it correct - haven't found in
> mpc8245um, UARTs are usually edge), so,
>
> --- button down -> byte #1 -> IRQ line active -> IC interrupts
> --- on resume interrupts are disabled, an EOI is performed (the line is
> still active)
> --- interrupts are re-enabled
>
> 3. a second interrupt for the same byte is delivered.
No EOI is performed -- the idea is to defer the interrupt, not swallow
it. All that is done to defer the interrupt is clearing MSR[EE].
-Scott
WARNING: multiple messages have this Message-ID (diff)
From: Scott Wood <scottwood@freescale.com>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: linuxppc-dev@ozlabs.org, linux-serial@vger.kernel.org,
Greg KH <greg@kroah.com>
Subject: Re: [PATCH, RFC] wake up from a serial port
Date: Mon, 13 Aug 2007 15:50:33 -0500 [thread overview]
Message-ID: <46C0C419.6060009@freescale.com> (raw)
In-Reply-To: <Pine.LNX.4.60.0708132207530.5643@poirot.grange>
Guennadi Liakhovetski wrote:
> Well, sort of. One of them is more "natural" - it has a button on the
> front panel, to use the other one you have to modify the hardware.
> However, I like the idea - generally it does seem to be a better approach
> to have it run-time configurable over sysfs... Only - how? The only
> differentitaion ATM between the two ports are these two links:
>
> # ls -l /sys/devices/platform/serial8250.0/tty*
> lrwxrwxrwx 1 root root 0 Aug 13 22:05 /sys/devices/platform/serial8250.0/tty:ttyS0 -> ../../../class/tty/ttyS0
> lrwxrwxrwx 1 root root 0 Aug 13 22:05 /sys/devices/platform/serial8250.0/tty:ttyS1 -> ../../../class/tty/ttyS1
>
> And placing some wakeup file under the class/tty/ directory doesn't seem
> very consistent with the current policy - until now they only live under
> devices/... (Greg added to cc:).
Hmm... I'd assumed each port would have its own device directory. Would
anything break horribly if it were changed so that each tty:ttySx is a
directory, which contains both a wakeup file and the symlink?
> Actually, it is good you replied, Scott:-) I wanted to ask you about the
> following: I've switched to your generic suspend/resume routines using the
> _TLF_NAPPING bit, the arch_suspend_{dis,en}able_irqs() hooks... On wakeup
> your _TLF_NAPPING trick should bypass calling the ISR and jump directly to
> the resume code. However, on wakeup, it looks like I do get the wakeup
> interrupt too.
You should get the interrupt, but not until after the PM code enables
IRQs. Are you saying that the interrupt handler runs before then?
> Is it the correct behaviour and is this the (approximately)
> correct explanation why:
>
> 1. the AVR connected to ttyS0 sends 1 byte on button press and 1 byte on
> button release. So, normally you would get 2 bytes and 2 interupts for one
> such button down-up.
>
> 2. Interrupt is configured as edge (is it correct - haven't found in
> mpc8245um, UARTs are usually edge), so,
>
> --- button down -> byte #1 -> IRQ line active -> IC interrupts
> --- on resume interrupts are disabled, an EOI is performed (the line is
> still active)
> --- interrupts are re-enabled
>
> 3. a second interrupt for the same byte is delivered.
No EOI is performed -- the idea is to defer the interrupt, not swallow
it. All that is done to defer the interrupt is clearing MSR[EE].
-Scott
next prev parent reply other threads:[~2007-08-13 20:50 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-12 22:27 [PATCH, RFC] wake up from a serial port Guennadi Liakhovetski
2007-08-13 15:57 ` Scott Wood
2007-08-13 15:57 ` Scott Wood
2007-08-13 20:41 ` Guennadi Liakhovetski
2007-08-13 20:41 ` Guennadi Liakhovetski
2007-08-13 20:50 ` Scott Wood [this message]
2007-08-13 20:50 ` Scott Wood
2007-08-13 21:14 ` Guennadi Liakhovetski
2007-08-13 21:14 ` Guennadi Liakhovetski
2007-08-13 22:28 ` Greg KH
2007-08-13 22:28 ` Greg KH
2007-08-20 21:53 ` Guennadi Liakhovetski
-- strict thread matches above, loose matches on Subject: below --
2007-08-25 22:22 Guennadi Liakhovetski
2007-08-27 10:00 ` Pavel Machek
2007-08-27 10:00 ` [linux-pm] " Pavel Machek
2007-08-27 17:30 ` Guennadi Liakhovetski
2007-08-25 22:22 Guennadi Liakhovetski
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=46C0C419.6060009@freescale.com \
--to=scottwood@freescale.com \
--cc=g.liakhovetski@gmx.de \
--cc=greg@kroah.com \
--cc=linux-serial@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.