dm: pmic: add suspend/resume callback
Signed-off-by: Joseph Chen <chenjh@rock-chips.com> Change-Id: Iaa3b0b7f7b3a0563370baace876e095deb64c28f
This commit is contained in:
parent
e632c0509c
commit
2a7051be6c
|
|
@ -189,6 +189,25 @@ int pmic_clrsetbits(struct udevice *dev, uint reg, uint clr, uint set)
|
||||||
return pmic_reg_write(dev, reg, byte);
|
return pmic_reg_write(dev, reg, byte);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int pmic_suspend(struct udevice *dev)
|
||||||
|
{
|
||||||
|
const struct dm_pmic_ops *ops = dev_get_driver_ops(dev);
|
||||||
|
|
||||||
|
if (!ops || !ops->suspend)
|
||||||
|
return -ENOSYS;
|
||||||
|
|
||||||
|
return ops->suspend(dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
int pmic_resume(struct udevice *dev)
|
||||||
|
{
|
||||||
|
const struct dm_pmic_ops *ops = dev_get_driver_ops(dev);
|
||||||
|
|
||||||
|
if (!ops || !ops->resume)
|
||||||
|
return -ENOSYS;
|
||||||
|
|
||||||
|
return ops->resume(dev);
|
||||||
|
}
|
||||||
|
|
||||||
int pmic_shutdown(struct udevice *dev)
|
int pmic_shutdown(struct udevice *dev)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -165,6 +165,8 @@ struct dm_pmic_ops {
|
||||||
int (*read)(struct udevice *dev, uint reg, uint8_t *buffer, int len);
|
int (*read)(struct udevice *dev, uint reg, uint8_t *buffer, int len);
|
||||||
int (*write)(struct udevice *dev, uint reg, const uint8_t *buffer,
|
int (*write)(struct udevice *dev, uint reg, const uint8_t *buffer,
|
||||||
int len);
|
int len);
|
||||||
|
int (*suspend)(struct udevice *dev);
|
||||||
|
int (*resume)(struct udevice *dev);
|
||||||
int (*shutdown)(struct udevice *dev);
|
int (*shutdown)(struct udevice *dev);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -300,6 +302,22 @@ int pmic_reg_write(struct udevice *dev, uint reg, uint value);
|
||||||
*/
|
*/
|
||||||
int pmic_clrsetbits(struct udevice *dev, uint reg, uint clr, uint set);
|
int pmic_clrsetbits(struct udevice *dev, uint reg, uint clr, uint set);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pmic_suspend() - suspend of PMIC
|
||||||
|
*
|
||||||
|
* @dev: PMIC device
|
||||||
|
* @return 0 on success or negative value of errno.
|
||||||
|
*/
|
||||||
|
int pmic_suspend(struct udevice *dev);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pmic_resume() - resume of PMIC
|
||||||
|
*
|
||||||
|
* @dev: PMIC device
|
||||||
|
* @return 0 on success or negative value of errno.
|
||||||
|
*/
|
||||||
|
int pmic_resume(struct udevice *dev);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pmic_shutdown() - power off supplies of PMIC
|
* pmic_shutdown() - power off supplies of PMIC
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue