From: Pavel Machek <pavel@ucw.cz>
To: Nickhu <nickhu@andestech.com>
Cc: greentime@andestech.com, linux-kernel@vger.kernel.org,
arnd@arndb.de, deanbo422@gmail.com, rjw@rjwysocki.net,
tglx@linutronix.de, jason@lakedaemon.net, marc.zyngier@arm.com,
zong@andestech.com, linux-pm@vger.kernel.org,
alankao@andestech.com, green.hu@gmail.com
Subject: Re: [PATCH 1/1] nds32: Power management for nds32
Date: Wed, 24 Oct 2018 08:51:17 +0200 [thread overview]
Message-ID: <20181024065117.GA18779@amd> (raw)
In-Reply-To: <ccc18702a8d93c0a31e46f53c498b6d34c9c17e1.1540349342.git.nickhu@andestech.com>
[-- Attachment #1: Type: text/plain, Size: 2502 bytes --]
On Wed 2018-10-24 11:40:07, Nickhu wrote:
> There are three sleep states in nds32:
> suspend to idle,
> suspend to standby,
> suspend to ram
>
> In suspend to ram, we use the 'standby' instruction to emulate
> power management device to hang the system util wakeup source
> send wakeup events to break the loop.
>
> First, we push the general purpose registers and system registers
> to stack. Second, we translate stack pointer to physical address
> and store to memory to save the stack pointer. Third, after write
> back and invalid the cache we hang in 'standby' intruction.
> When wakeup source trigger wake up events, the loop will be break
> and resume the system.
>
> Signed-off-by: Nickhu <nickhu@andestech.com>
Is "Nickhu" complete name?
> diff --git a/arch/nds32/kernel/pm.c b/arch/nds32/kernel/pm.c
> new file mode 100644
> index 000000000000..e1eaf3bac709
> --- /dev/null
> +++ b/arch/nds32/kernel/pm.c
> @@ -0,0 +1,91 @@
> +// SPDX-License-Identifier: GPL-2.0
> +// Copyright (C) 2008-2017 Andes Technology Corporation
> +
> +/*
> + * nds32 Power Management Routines
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License.
> + *
> + * Abstract:
> + *
> + * This program is for nds32 power management routines.
> + *
> + */
I'd get rid of "abstract" here, repeating GPL twice and "nds32 power
management routines" twice does not make much sense either.
> @@ -0,0 +1,129 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/* Copyright (C) 2017 Andes Technology Corporation */
> +
> +#include<asm/memory.h>
Missing space.
> +static int nointc_set_wake(struct irq_data *data, unsigned int on)
> +{
> + unsigned long int_mask = __nds32__mfsr(NDS32_SR_INT_MASK);
> + static bool is_bit_1[NR_IRQS] = {false};
> + u32 bit = 1 << data->hwirq;
> +
> + if (on) {
> + if (int_mask & bit)
> + is_bit_1[data->hwirq] = true;
> + else
> + is_bit_1[data->hwirq] = false;
> +
> + int_mask |= bit;
> + wake_mask |= bit;
> + } else {
> + if (!is_bit_1[data->hwirq])
> + int_mask &= ~bit;
> +
> + wake_mask &= ~bit;
> + is_bit_1[data->hwirq] = false;
> + }
Can we get rid of "is_bit_1" array here, and use normal bit operations
on another variable here?
Thanks,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
next prev parent reply other threads:[~2018-10-24 6:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-24 3:40 [PATCH 0/1] nds32: Power management Nickhu
2018-10-24 3:40 ` Nickhu
2018-10-24 3:40 ` [PATCH 1/1] nds32: Power management for nds32 Nickhu
2018-10-24 3:40 ` Nickhu
2018-10-24 6:51 ` Pavel Machek [this message]
2018-10-24 9:38 ` Nick Hu
2018-10-24 9:46 ` Pavel Machek
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=20181024065117.GA18779@amd \
--to=pavel@ucw.cz \
--cc=alankao@andestech.com \
--cc=arnd@arndb.de \
--cc=deanbo422@gmail.com \
--cc=green.hu@gmail.com \
--cc=greentime@andestech.com \
--cc=jason@lakedaemon.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=marc.zyngier@arm.com \
--cc=nickhu@andestech.com \
--cc=rjw@rjwysocki.net \
--cc=tglx@linutronix.de \
--cc=zong@andestech.com \
/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.