feature: charge: Add battery operate

Signed-off-by: liangdongdong<liangdongdong@xiaomi.com>
This commit is contained in:
liangdongdong 2023-10-25 19:40:54 +08:00 committed by Xiang Xiao
parent 5a796dfbff
commit 5238f2c200
3 changed files with 16 additions and 0 deletions

View File

@ -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;

View File

@ -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 */

View File

@ -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
};