mfd: rk808: Always use poweroff when requested
authorSoeren Moch <smoch@web.de>
Sun, 12 Jan 2020 01:55:00 +0000 (01:55 +0000)
committerLee Jones <lee.jones@linaro.org>
Mon, 30 Mar 2020 06:35:27 +0000 (07:35 +0100)
With the device tree property "rockchip,system-power-controller" we
explicitly request to use this PMIC to power off the system. So always
register our poweroff function, even if some other handler (probably
PSCI poweroff) was registered before.

This does tend to reveal a warning on shutdown due to the Rockchip I2C
driver not implementing an atomic transfer method, however since the
write to DEV_OFF takes effect immediately the I2C completion interrupt
is moot anyway, and as the very last thing written to the console it is
only visible to users going out of their way to capture serial output.

Signed-off-by: Soeren Moch <smoch@web.de>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
[ rm: note potential warning in commit message ]
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/mfd/rk808.c

index a69a6742ecdc3786e69652b5a79f304e11d74a2e..616e44e7ef984345ae300a56cc116f1d99ac286f 100644 (file)
@@ -550,7 +550,7 @@ static int rk808_probe(struct i2c_client *client,
        const struct mfd_cell *cells;
        int nr_pre_init_regs;
        int nr_cells;
-       int pm_off = 0, msb, lsb;
+       int msb, lsb;
        unsigned char pmic_id_msb, pmic_id_lsb;
        int ret;
        int i;
@@ -674,16 +674,9 @@ static int rk808_probe(struct i2c_client *client,
                goto err_irq;
        }
 
-       pm_off = of_property_read_bool(np,
-                               "rockchip,system-power-controller");
-       if (pm_off && !pm_power_off) {
+       if (of_property_read_bool(np, "rockchip,system-power-controller")) {
                rk808_i2c_client = client;
                pm_power_off = rk808->pm_pwroff_fn;
-       }
-
-       if (pm_off && !pm_power_off_prepare) {
-               if (!rk808_i2c_client)
-                       rk808_i2c_client = client;
                pm_power_off_prepare = rk808->pm_pwroff_prep_fn;
        }