All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Heiko Stübner" <heiko@sntech.de>
To: Doug Anderson <dianders@chromium.org>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Jeffy Chen <jeffy.chen@rock-chips.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] pinctrl: rockchip: Only mask interrupts; never disable
Date: Mon, 26 Jan 2015 17:56:19 +0100	[thread overview]
Message-ID: <1844800.Wx1PProku3@diego> (raw)
In-Reply-To: <1422289444-15142-1-git-send-email-dianders@chromium.org>

Am Montag, 26. Januar 2015, 08:24:03 schrieb Doug Anderson:
> The Rockchip GPIO interrupt controller totally throws away all status
> about an interrupt when you "disable" the interrupt.  That has
> unfortunate consequences in the following situation:
> 
> 1. An edge-triggered interrupt is enabled and should wake the system.
> 2. System suspend happens: interrupt is disabled and marked for wake.
> 3. rockchip_irq_suspend() reenables the interrupt so we can wake.
> 4. Interrupt happens when asleep.
> 5. rockchip_irq_resume() redisables the interrupt.
> 6. Disabling the interrupt throws away all status about it.
> 7. Normal system resume happens and we enable the interrupt again,
>    since we threw away status about the interrupt we don't know it
>    fired while suspended.  Even worse: if we need both edges of the
>    interrupt the logic to swap edges never runs.
> 
> Note: even if we somehow can post the status about wakeup interrupts
> in rockchip_irq_resume() we would still have a window of losing any
> edges that came in while interrupts were disabled.
> 
> If we use mask only then we don't need to worry.  The GPIO Interrupt
> controller keeps track of pending interrupts that are enabled and just
> masked.
> 
> There was no real strong reason to support the enable/disable
> functionality (other than that it seemed right), so let's go back to
> just supporting mask/unmask but actually map it to the real
> mask/unmask.  This ends up with slightly different (and more correct)
> behavior than before (f2dd028 pinctrl: rockchip: Fix
> enable/disable/mask/unmask).
> 
> Signed-off-by: Doug Anderson <dianders@chromium.org>

I talked with Doug about it and this looks sane, so
Reviewed-by: Heiko Stuebner <heiko@sntech.de>


Heiko

WARNING: multiple messages have this Message-ID (diff)
From: heiko@sntech.de (Heiko Stübner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] pinctrl: rockchip: Only mask interrupts; never disable
Date: Mon, 26 Jan 2015 17:56:19 +0100	[thread overview]
Message-ID: <1844800.Wx1PProku3@diego> (raw)
In-Reply-To: <1422289444-15142-1-git-send-email-dianders@chromium.org>

Am Montag, 26. Januar 2015, 08:24:03 schrieb Doug Anderson:
> The Rockchip GPIO interrupt controller totally throws away all status
> about an interrupt when you "disable" the interrupt.  That has
> unfortunate consequences in the following situation:
> 
> 1. An edge-triggered interrupt is enabled and should wake the system.
> 2. System suspend happens: interrupt is disabled and marked for wake.
> 3. rockchip_irq_suspend() reenables the interrupt so we can wake.
> 4. Interrupt happens when asleep.
> 5. rockchip_irq_resume() redisables the interrupt.
> 6. Disabling the interrupt throws away all status about it.
> 7. Normal system resume happens and we enable the interrupt again,
>    since we threw away status about the interrupt we don't know it
>    fired while suspended.  Even worse: if we need both edges of the
>    interrupt the logic to swap edges never runs.
> 
> Note: even if we somehow can post the status about wakeup interrupts
> in rockchip_irq_resume() we would still have a window of losing any
> edges that came in while interrupts were disabled.
> 
> If we use mask only then we don't need to worry.  The GPIO Interrupt
> controller keeps track of pending interrupts that are enabled and just
> masked.
> 
> There was no real strong reason to support the enable/disable
> functionality (other than that it seemed right), so let's go back to
> just supporting mask/unmask but actually map it to the real
> mask/unmask.  This ends up with slightly different (and more correct)
> behavior than before (f2dd028 pinctrl: rockchip: Fix
> enable/disable/mask/unmask).
> 
> Signed-off-by: Doug Anderson <dianders@chromium.org>

I talked with Doug about it and this looks sane, so
Reviewed-by: Heiko Stuebner <heiko@sntech.de>


Heiko

  reply	other threads:[~2015-01-26 16:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-26 16:24 [PATCH] pinctrl: rockchip: Only mask interrupts; never disable Doug Anderson
2015-01-26 16:24 ` Doug Anderson
2015-01-26 16:56 ` Heiko Stübner [this message]
2015-01-26 16:56   ` Heiko Stübner
2015-01-30  9:39 ` Linus Walleij
2015-01-30  9:39   ` Linus Walleij

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=1844800.Wx1PProku3@diego \
    --to=heiko@sntech.de \
    --cc=dianders@chromium.org \
    --cc=jeffy.chen@rock-chips.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.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.