From: Anand Moon <linux.amoon@gmail.com>
To: Robin Murphy <robin.murphy@arm.com>
Cc: Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Heiko Stuebner <heiko@sntech.de>,
Jagan Teki <jagan@amarulasolutions.com>,
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
Daniel Schultz <d.schultz@phytec.de>,
devicetree <devicetree@vger.kernel.org>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
linux-rockchip@lists.infradead.org,
Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [RFCv1 2/8] mfd: rk808: use syscore for RK805 PMIC shutdown
Date: Mon, 9 Dec 2019 21:08:31 +0530 [thread overview]
Message-ID: <CANAwSgTSDX=36eF3UxVyVykguRjd90=x4iT27s=nJg5ezG_V7w@mail.gmail.com> (raw)
In-Reply-To: <f1327196-66c9-d152-c0ca-914d43d6f55e@arm.com>
Hi Robin,
On Mon, 9 Dec 2019 at 19:04, Robin Murphy <robin.murphy@arm.com> wrote:
>
> On 06/12/2019 6:45 pm, Anand Moon wrote:
> > Use common syscore_shutdown for RK805 PMIC to do
> > clean I2C shutdown, drop the unused pm_pwroff_prep_fn
> > and pm_pwroff_fn function pointers.
>
> Coincidentally, I've also been looking at RK805 for the sake of trying
> to get suspend to behave on my RK3328 box, and I've ended up with some
> slightly different cleanup patches - I'll tidy them up and post them for
> comparison as soon as I can.
No issue if their is better clean approach, I will definitely test that series.
>
> > Cc: Heiko Stuebner <heiko@sntech.de>
> > Signed-off-by: Anand Moon <linux.amoon@gmail.com>
> > ---
> > drivers/mfd/rk808.c | 33 +++++++++++++++++----------------
> > 1 file changed, 17 insertions(+), 16 deletions(-)
> >
> > diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c
> > index e637f5bcc8bb..713d989064ba 100644
> > --- a/drivers/mfd/rk808.c
> > +++ b/drivers/mfd/rk808.c
> > @@ -467,16 +467,6 @@ static void rk808_update_bits(unsigned int reg, unsigned int mask,
> > "can't write to register 0x%x: %x!\n", reg, ret);
> > }
> >
> > -static void rk805_device_shutdown(void)
> > -{
> > - rk808_update_bits(RK805_DEV_CTRL_REG, DEV_OFF, DEV_OFF);
> > -}
> > -
> > -static void rk805_device_shutdown_prepare(void)
> > -{
> > - rk808_update_bits(RK805_GPIO_IO_POL_REG, SLP_SD_MSK, SHUTDOWN_FUN);
> > -}
> > -
> > static void rk808_device_shutdown(void)
> > {
> > rk808_update_bits(RK808_DEVCTRL_REG, DEV_OFF_RST, DEV_OFF_RST);
> > @@ -491,10 +481,23 @@ static void rk8xx_syscore_shutdown(void)
> > {
> > struct rk808 *rk808 = i2c_get_clientdata(rk808_i2c_client);
> >
> > - if (system_state == SYSTEM_POWER_OFF &&
> > - (rk808->variant == RK809_ID || rk808->variant == RK817_ID)) {
> > - rk808_update_bits(RK817_SYS_CFG(3), RK817_SLPPIN_FUNC_MSK,
> > - SLPPIN_DN_FUN);
> > + if (system_state == SYSTEM_POWER_OFF) {
> > + dev_info(&rk808_i2c_client->dev, "System Shutdown Event\n");
> > +
> > + switch (rk808->variant) {
> > + case RK805_ID:
> > + rk808_update_bits(RK805_GPIO_IO_POL_REG,
> > + SLP_SD_MSK, SHUTDOWN_FUN);
> > + rk808_update_bits(RK805_DEV_CTRL_REG, DEV_OFF, DEV_OFF);
>
> Why this change? Shutdown via the SLEEP pin is working just fine on my
> box :/
>
> Robin.
As per RK-805 datasheet [0] below.
For clean poweroff we need to set in DEV_CTRL_REG reg
Bit 0 DEV_OFF: write “1” to turn down the PMU.
[0] http://files.pine64.org/doc/rock64/Rockchip_RK805_Datasheet_V1.1%C2%A020160921.pdf
-Anand
next prev parent reply other threads:[~2019-12-09 15:38 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-06 18:45 [RFCv1 0/8] RK3399 clean shutdown issue Anand Moon
2019-12-06 18:45 ` [RFCv1 1/8] mfd: rk808: Refactor shutdown functions Anand Moon
2019-12-16 11:11 ` Lee Jones
2019-12-06 18:45 ` [RFCv1 2/8] mfd: rk808: use syscore for RK805 PMIC shutdown Anand Moon
2019-12-09 13:34 ` Robin Murphy
2019-12-09 15:38 ` Anand Moon [this message]
2019-12-06 18:45 ` [RFCv1 3/8] mfd: rk808: use syscore for RK808 " Anand Moon
2019-12-06 18:45 ` [RFCv1 4/8] mfd: rk808: use syscore for RK818 " Anand Moon
2019-12-06 18:45 ` [RFCv1 5/8] mfd: rk808: cleanup unused function pointer Anand Moon
2019-12-06 18:45 ` [RFCv1 6/8] mfd: rk808: use common syscore for all PMCI for clean shutdown Anand Moon
2019-12-06 18:45 ` [RFCv1 7/8] arm64: rockchip: drop unused field from rk8xx i2c node Anand Moon
2019-12-06 18:45 ` [RFCv1 8/8] arm: " Anand Moon
2019-12-06 22:32 ` [RFCv1 0/8] RK3399 clean shutdown issue Heiko Stuebner
2019-12-07 5:07 ` Anand Moon
2019-12-07 11:45 ` Heiko Stuebner
2019-12-09 13:29 ` Robin Murphy
2019-12-09 13:37 ` Peter Geis
2019-12-09 13:53 ` Heiko Stübner
2019-12-09 13:58 ` Robin Murphy
2019-12-09 14:51 ` Tobias Schramm
2019-12-09 14:56 ` Anand Moon
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='CANAwSgTSDX=36eF3UxVyVykguRjd90=x4iT27s=nJg5ezG_V7w@mail.gmail.com' \
--to=linux.amoon@gmail.com \
--cc=d.schultz@phytec.de \
--cc=devicetree@vger.kernel.org \
--cc=heiko@sntech.de \
--cc=jagan@amarulasolutions.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=mark.rutland@arm.com \
--cc=robh+dt@kernel.org \
--cc=robin.murphy@arm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).