driver/power: add charge protocol get
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
parent
fc35cf4737
commit
4ef7cf068b
|
@ -388,6 +388,16 @@ static int bat_charger_ioctl(FAR struct file *filep, int cmd,
|
|||
}
|
||||
break;
|
||||
|
||||
case BATIOC_GET_PROTOCOL:
|
||||
{
|
||||
FAR int *ptr = (FAR int *)(uintptr_t)arg;
|
||||
if (ptr)
|
||||
{
|
||||
ret = dev->ops->get_protocol(dev, ptr);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
_err("ERROR: Unrecognized cmd: %d\n", cmd);
|
||||
ret = -ENOTTY;
|
||||
|
|
|
@ -125,7 +125,11 @@ struct battery_charger_operations_s
|
|||
|
||||
/* Get the actual output voltage for charging */
|
||||
|
||||
int (*get_voltage)(struct battery_charger_dev_s *dev, int *value);
|
||||
int (*get_voltage)(struct battery_charger_dev_s *dev, FAR int *value);
|
||||
|
||||
/* Get charge protocol */
|
||||
|
||||
int (*get_protocol)(struct battery_charger_dev_s *dev, FAR int *value);
|
||||
};
|
||||
|
||||
/* This structure defines the battery driver state structure */
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
#define BATIOC_COULOMBS _BATIOC(0x0010)
|
||||
#define BATIOC_CHIPID _BATIOC(0x0011)
|
||||
#define BATIOC_GET_VOLTAGE _BATIOC(0x0012)
|
||||
#define BATIOC_GET_PROTOCOL _BATIOC(0x0013)
|
||||
|
||||
/* Special input values for BATIOC_INPUT_CURRENT that may optionally
|
||||
* be supported by lower-half driver:
|
||||
|
@ -110,6 +111,14 @@ enum battery_health_e
|
|||
BATTERY_HEALTH_DISCONNECTED /* Battery is not connected */
|
||||
};
|
||||
|
||||
/* battery charge protocol type */
|
||||
|
||||
enum battery_protocol_e
|
||||
{
|
||||
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 */
|
||||
};
|
||||
|
||||
/* Battery operation message */
|
||||
|
||||
struct batio_operate_msg_s
|
||||
|
|
Loading…
Reference in New Issue