Skip to content

Commit 58c1b9e

Browse files
committed
Revert "mfd: rk808: power off system in syscore shutdown"
This reverts commit 94a7fc2. Change-Id: I02121a53c450a30fb96e91ba1a32fbcd0a351f2b Reviewed-on: https://tp-biosrd-v02/gerrit/82368 Reviewed-by: Jamess Huang(黃以民) <Jamess_Huang@asus.com> Tested-by: Jamess Huang(黃以民) <Jamess_Huang@asus.com>
1 parent 8411c82 commit 58c1b9e

1 file changed

Lines changed: 8 additions & 33 deletions

File tree

drivers/mfd/rk808.c

Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
* more details.
1717
*/
1818

19-
#include <linux/delay.h>
2019
#include <linux/i2c.h>
2120
#include <linux/interrupt.h>
2221
#include <linux/kernel.h>
@@ -25,7 +24,6 @@
2524
#include <linux/module.h>
2625
#include <linux/of_device.h>
2726
#include <linux/regmap.h>
28-
#include <linux/syscore_ops.h>
2927

3028
struct rk808_reg_data {
3129
int addr;
@@ -814,7 +812,7 @@ static void rk808_device_shutdown_prepare(void)
814812
}
815813
}
816814

817-
static void rk808_syscore_shutdown(void)
815+
static void rk808_device_shutdown(void)
818816
{
819817
int ret;
820818
struct rk808 *rk808 = i2c_get_clientdata(rk808_i2c_client);
@@ -832,35 +830,13 @@ static void rk808_syscore_shutdown(void)
832830
regmap_update_bits(rk808->regmap,
833831
RK808_RTC_INT_REG,
834832
(0x3 << 2), (0x0 << 2));
835-
/*
836-
* For PMIC that power off supplies by write register via i2c bus,
837-
* it's better to do power off at syscore shutdown here.
838-
*
839-
* Because when run to kernel's "pm_power_off" call, i2c may has
840-
* been stopped or PMIC may not be able to get i2c transfer while
841-
* there are too many devices are competiting.
842-
*/
843-
if (system_state == SYSTEM_POWER_OFF) {
844-
/* power off supplies ! */
845-
if (pm_shutdown) {
846-
dev_info(&rk808_i2c_client->dev, "System power off\n");
847-
ret = pm_shutdown(rk808->regmap);
848-
if (ret)
849-
dev_err(&rk808_i2c_client->dev,
850-
"System power off error!\n");
851-
mdelay(10);
852-
dev_info(&rk808_i2c_client->dev,
853-
"Cpu should never reach here, stop!\n");
854-
while (1)
855-
;
856-
}
833+
if (pm_shutdown) {
834+
ret = pm_shutdown(rk808->regmap);
835+
if (ret)
836+
dev_err(&rk808_i2c_client->dev, "power off error!\n");
857837
}
858838
}
859839

860-
static struct syscore_ops rk808_syscore_ops = {
861-
.shutdown = rk808_syscore_shutdown,
862-
};
863-
864840
static ssize_t rk8xx_dbg_store(struct device *dev,
865841
struct device_attribute *attr,
866842
const char *buf, size_t count)
@@ -1128,7 +1104,7 @@ static int rk808_probe(struct i2c_client *client,
11281104
}
11291105
if (pm_shutdown_fn) {
11301106
pm_shutdown = pm_shutdown_fn;
1131-
register_syscore_ops(&rk808_syscore_ops);
1107+
pm_power_off = rk808_device_shutdown;
11321108
}
11331109
}
11341110

@@ -1194,11 +1170,10 @@ static int rk808_remove(struct i2c_client *client)
11941170

11951171
regmap_del_irq_chip(client->irq, rk808->irq_data);
11961172
mfd_remove_devices(&client->dev);
1197-
1173+
if (pm_power_off == rk808_device_shutdown)
1174+
pm_power_off = NULL;
11981175
if (pm_power_off_prepare == rk808_device_shutdown_prepare)
11991176
pm_power_off_prepare = NULL;
1200-
if (pm_shutdown)
1201-
unregister_syscore_ops(&rk808_syscore_ops);
12021177

12031178
return 0;
12041179
}

0 commit comments

Comments
 (0)