feat: charger: add operation to get out voltage
Signed-off-by: zhangguoliang <zhangguoliang3@xiaomi.com>
This commit is contained in:
parent
e20becd91b
commit
b16eea4f14
|
@ -370,6 +370,16 @@ static int bat_charger_ioctl(FAR struct file *filep, int cmd,
|
|||
}
|
||||
break;
|
||||
|
||||
case BATIOC_GET_VOLTAGE:
|
||||
{
|
||||
FAR int *outvoltsp = (FAR int *)((uintptr_t)arg);
|
||||
if (outvoltsp)
|
||||
{
|
||||
ret = dev->ops->get_voltage(dev, outvoltsp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
_err("ERROR: Unrecognized cmd: %d\n", cmd);
|
||||
ret = -ENOTTY;
|
||||
|
|
|
@ -122,6 +122,10 @@ struct battery_charger_operations_s
|
|||
/* Get chip id */
|
||||
|
||||
int (*chipid)(struct battery_charger_dev_s *dev, unsigned int *value);
|
||||
|
||||
/* Get the actual output voltage for charging */
|
||||
|
||||
int (*get_voltage)(struct battery_charger_dev_s *dev, int *value);
|
||||
};
|
||||
|
||||
/* This structure defines the battery driver state structure */
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
#define BATIOC_CLEARFAULTS _BATIOC(0x000F)
|
||||
#define BATIOC_COULOMBS _BATIOC(0x0010)
|
||||
#define BATIOC_CHIPID _BATIOC(0x0011)
|
||||
#define BATIOC_GET_VOLTAGE _BATIOC(0x0012)
|
||||
|
||||
/* Special input values for BATIOC_INPUT_CURRENT that may optionally
|
||||
* be supported by lower-half driver:
|
||||
|
|
Loading…
Reference in New Issue