mirror of
https://github.com/apache/nuttx.git
synced 2026-05-23 23:28:29 +08:00
power:add default protocol for the driver which not impl get_protocol
add default protocol for the driver which not impl get_protocol Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
This commit is contained in:
@@ -391,7 +391,15 @@ static int bat_charger_ioctl(FAR struct file *filep, int cmd,
|
||||
FAR int *ptr = (FAR int *)((uintptr_t)arg);
|
||||
if (ptr)
|
||||
{
|
||||
ret = dev->ops->get_protocol(dev, ptr);
|
||||
if (dev->ops->get_protocol)
|
||||
{
|
||||
ret = dev->ops->get_protocol(dev, ptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
*ptr = BATTERY_PROTOCOL_DEFAULT;
|
||||
ret = OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -116,6 +116,7 @@ enum battery_health_e
|
||||
|
||||
enum battery_protocol_e
|
||||
{
|
||||
BATTERY_PROTOCOL_DEFAULT = 0, /* Battery charge protocol of adapter is DEFAULT */
|
||||
BATTERY_PROTOCOL_QC3P0 = 1 << 0, /* Battery charge protocol of adapter is QC 3.0 */
|
||||
BATTERY_PROTOCOL_TX_XIAOMI = 1 << 1, /* Battery charge protocol of TX is xiaomi standard */
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user