dm: pmic: add pmic_shutdown() interface

Change-Id: I9bed8de6d3733ab90175f26f68160ddd8f12e295
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
This commit is contained in:
Joseph Chen 2017-10-30 11:13:46 +08:00
parent 0849a734fe
commit c8d15c4375
2 changed files with 20 additions and 0 deletions

View File

@ -163,6 +163,17 @@ int pmic_clrsetbits(struct udevice *dev, uint reg, uint clr, uint set)
return pmic_reg_write(dev, reg, byte);
}
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",

View File

@ -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);
};
/**
@ -297,6 +298,14 @@ int pmic_reg_write(struct udevice *dev, uint reg, uint value);
*/
int pmic_clrsetbits(struct udevice *dev, uint reg, uint clr, uint set);
/**
* 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