From: Joseph Chen <che...@rock-chips.com>

Signed-off-by: Joseph Chen <che...@rock-chips.com>
Signed-off-by: Elaine Zhang <zhangq...@rock-chips.com>
---
 drivers/power/pmic/pmic-uclass.c | 11 +++++++++++
 include/power/pmic.h             |  9 +++++++++
 2 files changed, 20 insertions(+)

diff --git a/drivers/power/pmic/pmic-uclass.c b/drivers/power/pmic/pmic-uclass.c
index db68c766f5d7..28cfe0c987a2 100644
--- a/drivers/power/pmic/pmic-uclass.c
+++ b/drivers/power/pmic/pmic-uclass.c
@@ -191,6 +191,17 @@ static int pmic_pre_probe(struct udevice *dev)
        return 0;
 }
 
+
+int pmic_shutdown(struct udevice *dev)
+{
+       const struct dm_pmic_ops *ops = dev_get_driver_ops(dev);
+
+       if (!ops || !ops->shutdown)
+               return -ENOSYS;
+
+       return ops->shutdown(dev);
+}
+
 UCLASS_DRIVER(pmic) = {
        .id             = UCLASS_PMIC,
        .name           = "pmic",
diff --git a/include/power/pmic.h b/include/power/pmic.h
index be9de6b4de7e..231195e5ea85 100644
--- a/include/power/pmic.h
+++ b/include/power/pmic.h
@@ -164,6 +164,7 @@ struct dm_pmic_ops {
        int (*read)(struct udevice *dev, uint reg, uint8_t *buffer, int len);
        int (*write)(struct udevice *dev, uint reg, const uint8_t *buffer,
                     int len);
+       int (*shutdown)(struct udevice *dev);
 };
 
 /**
@@ -306,6 +307,14 @@ struct uc_pmic_priv {
        uint trans_len;
 };
 
+/**
+ * pmic_shutdown() - power off supplies of PMIC
+ *
+ * @dev:       PMIC device to update
+ * @return 0 on success or negative value of errno.
+ */
+int pmic_shutdown(struct udevice *dev);
+
 #endif /* CONFIG_DM_PMIC */
 
 #ifdef CONFIG_POWER
-- 
1.9.1



_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to