All of lore.kernel.org
 help / color / mirror / Atom feed
From: Elaine Zhang <zhangqing@rock-chips.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v1 4/7] dm: pmic: add pmic_shutdown() interface
Date: Wed,  4 Sep 2019 15:08:24 +0800	[thread overview]
Message-ID: <1567580907-9561-5-git-send-email-zhangqing@rock-chips.com> (raw)
In-Reply-To: <1567580907-9561-1-git-send-email-zhangqing@rock-chips.com>

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

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Signed-off-by: Elaine Zhang <zhangqing@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

  parent reply	other threads:[~2019-09-04  7:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-04  7:08 [U-Boot] [PATCH v1 0/8] power: pmic: support more PMIC Elaine Zhang
2019-09-04  7:08 ` [U-Boot] [PATCH v1 1/7] dm: regulator: support regulator more state Elaine Zhang
2019-09-04 10:19   ` Lukasz Majewski
2019-09-17  5:47   ` Simon Glass
2019-09-04  7:08 ` [U-Boot] [PATCH v1 2/7] power: pmic: rk816: support rk816 pmic Elaine Zhang
2019-09-04  7:45   ` Kever Yang
2019-09-04  7:08 ` [U-Boot] [PATCH v1 3/7] power: pmic: rk805: support rk805 pmic Elaine Zhang
2019-09-04  7:08 ` Elaine Zhang [this message]
2019-09-04  7:10 ` [U-Boot] [PATCH v1 5/7] power: pmic: rk8xx: add pmic_shutdown() implement Elaine Zhang
2019-09-04  7:10 ` [U-Boot] [PATCH v1 6/7] pmic: add RK817 support Elaine Zhang
2019-09-04  7:40   ` Kever Yang
2019-09-04  7:10 ` [U-Boot] [PATCH v1 7/7] pmic: add rk809 support Elaine Zhang

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=1567580907-9561-5-git-send-email-zhangqing@rock-chips.com \
    --to=zhangqing@rock-chips.com \
    --cc=u-boot@lists.denx.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.