From: Mark Brown <broonie@kernel.org>
To: Chris Zhong <zyw@rock-chips.com>
Cc: robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com,
ijc+devicetree@hellion.org.uk, galak@codeaurora.org,
sameo@linux.intel.com, lee.jones@linaro.org, lgirdwood@gmail.com,
a.zummo@towertech.it, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, rtc-linux@googlegroups.com,
grant.likely@linaro.org, hl@rock-chips.com,
huangtao@rock-chips.com, cf@rock-chips.com,
zhangqing@rock-chips.com, xxx@rock-chips.com,
dianders@chromium.org, heiko@sntech.de, olof@lixom.net,
sonnyrao@chromium.org, dtor@chromium.org,
javier.martinez@collabora.co.uk, kever.yang@rock-chips.com
Subject: Re: [PATCH 2/4] MFD: RK808: Add new mfd device for RK808
Date: Sun, 17 Aug 2014 09:13:41 -0500 [thread overview]
Message-ID: <20140817141341.GH14537@sirena.org.uk> (raw)
In-Reply-To: <1408240705-29472-1-git-send-email-zyw@rock-chips.com>
[-- Attachment #1: Type: text/plain, Size: 1494 bytes --]
On Sun, Aug 17, 2014 at 09:58:25AM +0800, Chris Zhong wrote:
> +static void rk808_device_shutdown(void)
> +{
> + int ret;
> + struct rk808 *rk808 = g_rk808;
> +
> + if (!rk808) {
> + dev_err(rk808->dev, "%s have no g_rk808\n", __func__);
> + return;
> + }
This is a bit dodgy but I can't think of a better way of doing it :/
> +
> + ret = regmap_update_bits(rk808->regmap,
> + RK808_INT_STS_MSK_REG1,
> + (0x3 << 5), (0x3 << 5));
> + /* close rtc int when power off */
> + ret = regmap_update_bits(rk808->regmap,
> + RK808_RTC_INT_REG,
> + (0x3 << 2), 0);
> + /* close rtc int when power off */
> + ret = regmap_update_bits(rk808->regmap,
> + RK808_DEVCTRL_REG,
> + (0x1 << 3), (0x1 << 3));
> + if (ret < 0)
> + dev_err(rk808->dev, "rk808 power off error!\n");
Defines for these bits would be good, though if this turns off the RTC
alarm then it might be better not to do it - one thing people do with
RTC alarms is use them to wake the system up from deep sleep.
> + while (1)
> + wfi();
> +}
Just let the kernel shut down by itself - or is that last write a system
power off request?
> + ret = regmap_read(rk808->regmap, 0x2f, &val);
> + if (ret < 0) {
> + dev_err(rk808->dev, "The device is not rk808 %d\n", ret);
> + return ret;
> + }
That error message is misleading - an error from regmap_read() means
that I/O failed, usually "device is not rk808" would mean that you'd
read back and ID register on the device and it didn't match what was
expected.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
prev parent reply other threads:[~2014-08-17 14:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-17 1:58 Chris Zhong
2014-08-17 14:13 ` Mark Brown [this message]
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=20140817141341.GH14537@sirena.org.uk \
--to=broonie@kernel.org \
--cc=a.zummo@towertech.it \
--cc=cf@rock-chips.com \
--cc=devicetree@vger.kernel.org \
--cc=dianders@chromium.org \
--cc=dtor@chromium.org \
--cc=galak@codeaurora.org \
--cc=grant.likely@linaro.org \
--cc=heiko@sntech.de \
--cc=hl@rock-chips.com \
--cc=huangtao@rock-chips.com \
--cc=ijc+devicetree@hellion.org.uk \
--cc=javier.martinez@collabora.co.uk \
--cc=kever.yang@rock-chips.com \
--cc=lee.jones@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=olof@lixom.net \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.org \
--cc=rtc-linux@googlegroups.com \
--cc=sameo@linux.intel.com \
--cc=sonnyrao@chromium.org \
--cc=xxx@rock-chips.com \
--cc=zhangqing@rock-chips.com \
--cc=zyw@rock-chips.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
all inboxes | Powered by JetHome®