From: Robin Murphy <robin.murphy@arm.com>
To: lee.jones@linaro.org
Cc: linux-kernel@vger.kernel.org, heiko@sntech.de,
linux-rockchip@lists.infradead.org, smoch@web.de
Subject: [PATCH v2 5/5] mfd: rk808: Convert RK805 to shutdown/suspend hooks
Date: Sun, 12 Jan 2020 01:55:04 +0000 [thread overview]
Message-ID: <02639ae880b9d945c4134a28b1eef3db2ed9353f.1578789410.git.robin.murphy@arm.com> (raw)
In-Reply-To: <cover.1578789410.git.robin.murphy@arm.com>
RK805 has the same kind of dual-role sleep/shutdown pin as RK809/RK817,
so it makes little sense for the driver to have to have two completely
different mechanisms to handle essentially the same thing. Move RK805
over to the shutdown/suspend flow to clean things up.
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---
drivers/mfd/rk808.c | 37 ++++++++++++-------------------------
include/linux/mfd/rk808.h | 1 -
2 files changed, 12 insertions(+), 26 deletions(-)
diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c
index b2265c6e94ae..d109b9f14407 100644
--- a/drivers/mfd/rk808.c
+++ b/drivers/mfd/rk808.c
@@ -185,7 +185,6 @@ static const struct rk808_reg_data rk805_pre_init_reg[] = {
{RK805_BUCK4_CONFIG_REG, RK805_BUCK3_4_ILMAX_MASK,
RK805_BUCK4_ILMAX_3500MA},
{RK805_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_400MA},
- {RK805_GPIO_IO_POL_REG, SLP_SD_MSK, SLEEP_FUN},
{RK805_THERMAL_REG, TEMP_HOTDIE_MSK, TEMP115C},
};
@@ -448,21 +447,6 @@ static const struct regmap_irq_chip rk818_irq_chip = {
static struct i2c_client *rk808_i2c_client;
-static void rk805_device_shutdown_prepare(void)
-{
- int ret;
- struct rk808 *rk808 = i2c_get_clientdata(rk808_i2c_client);
-
- if (!rk808)
- return;
-
- ret = regmap_update_bits(rk808->regmap,
- RK805_GPIO_IO_POL_REG,
- SLP_SD_MSK, SHUTDOWN_FUN);
- if (ret)
- dev_err(&rk808_i2c_client->dev, "Failed to shutdown device!\n");
-}
-
static void rk808_pm_power_off(void)
{
int ret;
@@ -496,6 +480,12 @@ static void rk8xx_shutdown(struct i2c_client *client)
int ret;
switch (rk808->variant) {
+ case RK805_ID:
+ ret = regmap_update_bits(rk808->regmap,
+ RK805_GPIO_IO_POL_REG,
+ SLP_SD_MSK,
+ SHUTDOWN_FUN);
+ break;
case RK809_ID:
case RK817_ID:
ret = regmap_update_bits(rk808->regmap,
@@ -574,7 +564,6 @@ static int rk808_probe(struct i2c_client *client,
nr_pre_init_regs = ARRAY_SIZE(rk805_pre_init_reg);
cells = rk805s;
nr_cells = ARRAY_SIZE(rk805s);
- rk808->pm_pwroff_prep_fn = rk805_device_shutdown_prepare;
break;
case RK808_ID:
rk808->regmap_cfg = &rk808_regmap_config;
@@ -653,7 +642,6 @@ static int rk808_probe(struct i2c_client *client,
if (of_property_read_bool(np, "rockchip,system-power-controller")) {
rk808_i2c_client = client;
pm_power_off = rk808_pm_power_off;
- pm_power_off_prepare = rk808->pm_pwroff_prep_fn;
}
return 0;
@@ -676,13 +664,6 @@ static int rk808_remove(struct i2c_client *client)
if (pm_power_off == rk808_pm_power_off)
pm_power_off = NULL;
- /**
- * As above, check if the pointer is set by us before overwrite.
- */
- if (rk808->pm_pwroff_prep_fn &&
- pm_power_off_prepare == rk808->pm_pwroff_prep_fn)
- pm_power_off_prepare = NULL;
-
return 0;
}
@@ -692,6 +673,12 @@ static int __maybe_unused rk8xx_suspend(struct device *dev)
int ret = 0;
switch (rk808->variant) {
+ case RK805_ID:
+ ret = regmap_update_bits(rk808->regmap,
+ RK805_GPIO_IO_POL_REG,
+ SLP_SD_MSK,
+ SLEEP_FUN);
+ break;
case RK809_ID:
case RK817_ID:
ret = regmap_update_bits(rk808->regmap,
diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h
index b038653fa87e..e07f6e61cd38 100644
--- a/include/linux/mfd/rk808.h
+++ b/include/linux/mfd/rk808.h
@@ -620,6 +620,5 @@ struct rk808 {
long variant;
const struct regmap_config *regmap_cfg;
const struct regmap_irq_chip *regmap_irq_chip;
- void (*pm_pwroff_prep_fn)(void);
};
#endif /* __LINUX_REGULATOR_RK808_H */
--
2.17.1
next prev parent reply other threads:[~2020-01-12 1:55 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-12 1:54 [PATCH v2 0/5] mfd: RK8xx tidyup Robin Murphy
2020-01-12 1:55 ` [PATCH v2 1/5] mfd: rk808: Always use poweroff when requested Robin Murphy
2020-02-26 10:32 ` Lee Jones
2020-01-12 1:55 ` [PATCH v2 2/5] mfd: rk808: Ensure suspend/resume hooks always work Robin Murphy
2020-02-26 10:32 ` Lee Jones
2020-01-12 1:55 ` [PATCH v2 3/5] mfd: rk808: Stop using syscore ops Robin Murphy
2020-02-26 9:45 ` Lee Jones
2020-02-26 10:32 ` Lee Jones
2020-01-12 1:55 ` [PATCH v2 4/5] mfd: rk808: Reduce shutdown duplication Robin Murphy
2020-02-26 10:32 ` Lee Jones
2020-01-12 1:55 ` Robin Murphy [this message]
2020-02-26 10:33 ` [PATCH v2 5/5] mfd: rk808: Convert RK805 to shutdown/suspend hooks Lee Jones
2020-01-12 10:17 ` [PATCH v2 0/5] mfd: RK8xx tidyup Soeren Moch
2020-01-13 14:51 ` Anand Moon
2020-02-18 21:44 ` Robin Murphy
2020-04-27 18:41 ` Anand Moon
2020-04-27 18:46 ` Soeren Moch
2020-04-27 18: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=02639ae880b9d945c4134a28b1eef3db2ed9353f.1578789410.git.robin.murphy@arm.com \
--to=robin.murphy@arm.com \
--cc=heiko@sntech.de \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=smoch@web.de \
/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).