feature: charge: Add battery operate
Signed-off-by: liangdongdong<liangdongdong@xiaomi.com>
This commit is contained in:
parent
5a796dfbff
commit
5238f2c200
|
@ -354,6 +354,16 @@ static int bat_gauge_ioctl(FAR struct file *filep,
|
|||
}
|
||||
break;
|
||||
|
||||
case BATIOC_OPERATE:
|
||||
{
|
||||
FAR int *ptr = (FAR int *)((uintptr_t)arg);
|
||||
if (ptr)
|
||||
{
|
||||
ret = dev->ops->operate(dev, ptr);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
_err("ERROR: Unrecognized cmd: %d\n", cmd);
|
||||
ret = -ENOTTY;
|
||||
|
|
|
@ -120,6 +120,10 @@ struct battery_gauge_operations_s
|
|||
|
||||
CODE int (*chipid)(FAR struct battery_gauge_dev_s *dev,
|
||||
FAR unsigned int *value);
|
||||
|
||||
/* Do device specific operation */
|
||||
|
||||
CODE int (*operate)(FAR struct battery_gauge_dev_s *dev, FAR int *param);
|
||||
};
|
||||
|
||||
/* This structure defines the battery driver state structure */
|
||||
|
|
|
@ -146,6 +146,8 @@ enum batio_operate_e
|
|||
BATIO_OPRTN_WDOG,
|
||||
BATIO_OPRTN_SHIPMODE,
|
||||
BATIO_OPRTN_CUTOFF_CURRENT,
|
||||
BATIO_OPRTN_VBUS_STATE,
|
||||
BATIO_OPRTN_CAPACITY,
|
||||
BATIO_OPRTN_END
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue