mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 11:56:10 +08:00
power: add driver for TI bq2429x battery charger. TODO: Untested. Does not have poll() support.
This commit is contained in:
committed by
Gregory Nutt
parent
1be5f0a3fc
commit
cc1f7a63fa
@@ -292,6 +292,25 @@ config BQ2425X
|
||||
---help---
|
||||
The BQ24250/BQ24251 are battery charger for lithium-ion batteries.
|
||||
|
||||
config BQ2429X
|
||||
bool "BQ2429X Battery charger support"
|
||||
default n
|
||||
select I2C
|
||||
select I2C_BQ2429X
|
||||
depends on BATTERY_CHARGER
|
||||
---help---
|
||||
The BQ24296/BQ24297/BQ24296M are battery charger for lithium-ion batteries.
|
||||
|
||||
if BQ2429X
|
||||
|
||||
config DEBUG_BQ2429X
|
||||
bool "BQ2429X Debug Features"
|
||||
default n
|
||||
---help---
|
||||
Enable BQ2429X battery management debug features.
|
||||
|
||||
endif # BQ2429X
|
||||
|
||||
config BATTERY_GAUGE
|
||||
bool "Battery Fuel Gauge support"
|
||||
default n
|
||||
@@ -312,6 +331,10 @@ config I2C_BQ2425X
|
||||
bool
|
||||
default y if BQ2425X
|
||||
|
||||
config I2C_BQ2429X
|
||||
bool
|
||||
default y if BQ2429X
|
||||
|
||||
config I2C_MAX1704X
|
||||
bool
|
||||
default y if MAX1704X
|
||||
|
||||
@@ -80,6 +80,12 @@ ifeq ($(CONFIG_I2C_BQ2425X),y)
|
||||
CSRCS += bq2425x.c
|
||||
endif
|
||||
|
||||
# Add the BQ2429x I2C-based battery charger driver
|
||||
|
||||
ifeq ($(CONFIG_I2C_BQ2429X),y)
|
||||
CSRCS += bq2429x.c
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
# Include power support in the build
|
||||
|
||||
@@ -160,7 +160,7 @@ static int bat_charger_ioctl(FAR struct file *filep, int cmd,
|
||||
FAR struct battery_charger_dev_s *dev = inode->i_private;
|
||||
int ret;
|
||||
|
||||
/* Inforce mutually exclusive access to the battery driver */
|
||||
/* Enforce mutually exclusive access to the battery driver */
|
||||
|
||||
ret = sem_wait(&dev->batsem);
|
||||
if (ret < 0)
|
||||
@@ -168,7 +168,7 @@ static int bat_charger_ioctl(FAR struct file *filep, int cmd,
|
||||
return -errno; /* Probably EINTR */
|
||||
}
|
||||
|
||||
/* Procss the IOCTL command */
|
||||
/* Process the IOCTL command */
|
||||
|
||||
ret = -EINVAL; /* Assume a bad argument */
|
||||
switch (cmd)
|
||||
@@ -239,6 +239,16 @@ static int bat_charger_ioctl(FAR struct file *filep, int cmd,
|
||||
}
|
||||
break;
|
||||
|
||||
case BATIOC_OPERATE:
|
||||
{
|
||||
FAR int *ptr = (FAR int *)((uintptr_t)arg);
|
||||
if (ptr)
|
||||
{
|
||||
ret = dev->ops->operate(dev, (uintptr_t)arg);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
_err("ERROR: Unrecognized cmd: %d\n", cmd);
|
||||
ret = -ENOTTY;
|
||||
|
||||
+16
-1
@@ -134,6 +134,7 @@ static int bq2425x_online(struct battery_charger_dev_s *dev, bool *status);
|
||||
static int bq2425x_voltage(struct battery_charger_dev_s *dev, int value);
|
||||
static int bq2425x_current(struct battery_charger_dev_s *dev, int value);
|
||||
static int bq2425x_input_current(struct battery_charger_dev_s *dev, int value);
|
||||
static int bq2425x_operate(struct battery_charger_dev_s *dev, uintptr_t param);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
@@ -146,7 +147,8 @@ static const struct battery_charger_operations_s g_bq2425xops =
|
||||
bq2425x_online,
|
||||
bq2425x_voltage,
|
||||
bq2425x_current,
|
||||
bq2425x_input_current
|
||||
bq2425x_input_current,
|
||||
bq2425x_operate
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
@@ -728,6 +730,19 @@ static int bq2425x_input_current(struct battery_charger_dev_s *dev, int value)
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: bq2425x_operate
|
||||
*
|
||||
* Description:
|
||||
* Do miscellaneous battery ioctl()
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int bq2425x_operate(struct battery_charger_dev_s *dev, uintptr_t param)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user