power/battery: add baterr, batinfo, batwarn for debug log
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
parent
c1e2fd9014
commit
1ed4118378
31
Kconfig
31
Kconfig
@ -931,6 +931,37 @@ config DEBUG_POWER_INFO
|
||||
|
||||
endif # DEBUG_POWER
|
||||
|
||||
config DEBUG_BATTERY
|
||||
bool "Battery-related Debug Features"
|
||||
default n
|
||||
---help---
|
||||
Enable Battery-related debug features.
|
||||
|
||||
if DEBUG_BATTERY
|
||||
|
||||
config DEBUG_BATTERY_ERROR
|
||||
bool "Battery-related Error Output"
|
||||
default n
|
||||
depends on DEBUG_ERROR
|
||||
---help---
|
||||
Enable battery-related error output to SYSLOG.
|
||||
|
||||
config DEBUG_BATTERY_WARN
|
||||
bool "Battery-related Warnings Output"
|
||||
default n
|
||||
depends on DEBUG_WARN
|
||||
---help---
|
||||
Enable battery-related warning output to SYSLOG.
|
||||
|
||||
config DEBUG_BATTERY_INFO
|
||||
bool "Battery-related Informational Output"
|
||||
default n
|
||||
depends on DEBUG_INFO
|
||||
---help---
|
||||
Enable battery-related informational output to SYSLOG.
|
||||
|
||||
endif # DEBUG_BATTERY
|
||||
|
||||
config DEBUG_WIRELESS
|
||||
bool "Wireless Debug Features"
|
||||
default n
|
||||
|
@ -276,16 +276,6 @@ config CXD56_GAUGE
|
||||
Enable battery gauge driver.
|
||||
This is not a lower half of power driver, but compatible with NuttX gauge driver.
|
||||
|
||||
if CXD56_GAUGE
|
||||
|
||||
config CXD56_GAUGE_DEBUG
|
||||
bool "Battery Gauge Debug"
|
||||
default n
|
||||
---help---
|
||||
Enable battery driver debug messages and debug IO command.
|
||||
|
||||
endif
|
||||
|
||||
config CXD56_CHARGER
|
||||
bool "CXD5247 battery charger"
|
||||
default n
|
||||
@ -303,13 +293,6 @@ config CXD56_CHARGER_TEMP_PRECISE
|
||||
Get temperature precisely. If this option is enabled, driver calculate precisely
|
||||
from register value to degrees Celsius.
|
||||
This option requires libm.
|
||||
|
||||
config CXD56_CHARGER_DEBUG
|
||||
bool "Battery Charger Debug"
|
||||
default n
|
||||
---help---
|
||||
Enable battery charger driver debug messages.
|
||||
|
||||
endif
|
||||
|
||||
comment "Peripheral Support"
|
||||
|
@ -52,14 +52,6 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Debug ********************************************************************/
|
||||
|
||||
#ifdef CONFIG_CXD56_CHARGER_DEBUG
|
||||
#define baterr(fmt, ...) _err(fmt, ## __VA_ARGS__)
|
||||
#else
|
||||
#define baterr(fmt, ...)
|
||||
#endif
|
||||
|
||||
/* Configuration */
|
||||
|
||||
#ifdef CONFIG_CXD56_CHARGER_TEMP_PRECISE
|
||||
|
@ -49,16 +49,6 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Debug ********************************************************************/
|
||||
|
||||
#ifdef CONFIG_CXD56_GAUGE_DEBUG
|
||||
#define baterr(fmt, ...) _err(fmt, ## __VA_ARGS__)
|
||||
#define batinfo(fmt, ...) _info(fmt, ## __VA_ARGS__)
|
||||
#else
|
||||
#define baterr(fmt, ...)
|
||||
#define batinfo(fmt, ...)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
@ -454,16 +454,6 @@ config BQ27426
|
||||
It can be interrogated by a system processor to provide cell information,
|
||||
such as state-of-charge (SOC).
|
||||
|
||||
if BQ27426
|
||||
|
||||
config DEBUG_BQ27426
|
||||
bool "BQ27426 Debug Features"
|
||||
default n
|
||||
---help---
|
||||
Enable BQ27426 battery management debug features.
|
||||
|
||||
endif # BQ27426
|
||||
|
||||
config I2C_BQ2425X
|
||||
bool
|
||||
default y if BQ2425X
|
||||
@ -499,10 +489,6 @@ config I2C_BQ769X0
|
||||
default y if BQ769X0
|
||||
|
||||
if BQ769X0
|
||||
config DEBUG_BQ769X0
|
||||
bool "BQ769X0 debug features"
|
||||
default n
|
||||
|
||||
config BQ769X0_USE_INTERNAL_TS
|
||||
bool "Use internal temperature sensor on BQ769X0"
|
||||
default n
|
||||
|
@ -59,16 +59,6 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Debug ********************************************************************/
|
||||
|
||||
#ifdef CONFIG_DEBUG_BQ2425X
|
||||
# define baterr _err
|
||||
# define batreg _err
|
||||
#else
|
||||
# define baterr _none
|
||||
# define batreg _none
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private
|
||||
****************************************************************************/
|
||||
@ -215,7 +205,7 @@ static int bq2425x_putreg8(FAR struct bq2425x_dev_s *priv, uint8_t regaddr,
|
||||
config.address = priv->addr;
|
||||
config.addrlen = 7;
|
||||
|
||||
batreg("addr: %02x regval: %08x\n", regaddr, regval);
|
||||
batinfo("addr: %02x regval: %08x\n", regaddr, regval);
|
||||
|
||||
/* Set up a 3 byte message to send */
|
||||
|
||||
|
@ -97,18 +97,6 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Debug ********************************************************************/
|
||||
|
||||
#ifdef CONFIG_DEBUG_BQ2429X
|
||||
# define baterr _err
|
||||
# define batdbg _info
|
||||
# define batinfo _info
|
||||
#else
|
||||
# define baterr _none
|
||||
# define batdbg _none
|
||||
# define batinfo _none
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private
|
||||
****************************************************************************/
|
||||
@ -259,7 +247,7 @@ static int bq2429x_putreg8(FAR struct bq2429x_dev_s *priv, uint8_t regaddr,
|
||||
config.address = priv->addr;
|
||||
config.addrlen = 7;
|
||||
|
||||
batdbg("addr: %02x regval: %08x\n", regaddr, regval);
|
||||
batinfo("addr: %02x regval: %08x\n", regaddr, regval);
|
||||
|
||||
/* Set up a message to send */
|
||||
|
||||
@ -278,28 +266,28 @@ static int (bq2429x_dump_regs) (FAR struct bq2429x_dev_s * priv)
|
||||
uint8_t value = 0;
|
||||
|
||||
ret = bq2429x_getreg8(priv, BQ2429X_REG00, &value, 1);
|
||||
batdbg("REG#0: 0x%08X\n", value);
|
||||
batinfo("REG#0: 0x%08X\n", value);
|
||||
ret |= bq2429x_getreg8(priv, BQ2429X_REG01, &value, 1);
|
||||
batdbg("REG#1: 0x%08X\n", value);
|
||||
batinfo("REG#1: 0x%08X\n", value);
|
||||
ret |= bq2429x_getreg8(priv, BQ2429X_REG02, &value, 1);
|
||||
batdbg("REG#2: 0x%08X\n", value);
|
||||
batinfo("REG#2: 0x%08X\n", value);
|
||||
ret |= bq2429x_getreg8(priv, BQ2429X_REG03, &value, 1);
|
||||
batdbg("REG#3: 0x%08X\n", value);
|
||||
batinfo("REG#3: 0x%08X\n", value);
|
||||
ret |= bq2429x_getreg8(priv, BQ2429X_REG04, &value, 1);
|
||||
batdbg("REG#4: 0x%08X\n", value);
|
||||
batinfo("REG#4: 0x%08X\n", value);
|
||||
ret |= bq2429x_getreg8(priv, BQ2429X_REG05, &value, 1);
|
||||
batdbg("REG#5: 0x%08X\n", value);
|
||||
batinfo("REG#5: 0x%08X\n", value);
|
||||
ret |= bq2429x_getreg8(priv, BQ2429X_REG06, &value, 1);
|
||||
batdbg("REG#6: 0x%08X\n", value);
|
||||
batinfo("REG#6: 0x%08X\n", value);
|
||||
ret |= bq2429x_getreg8(priv, BQ2429X_REG07, &value, 1);
|
||||
batdbg("REG#7: 0x%08X\n", value);
|
||||
batinfo("REG#7: 0x%08X\n", value);
|
||||
ret |= bq2429x_getreg8(priv, BQ2429X_REG08, &value, 1);
|
||||
batdbg("REG#8: 0x%08X\n", value);
|
||||
batinfo("REG#8: 0x%08X\n", value);
|
||||
|
||||
/* Not reading fault register. */
|
||||
|
||||
ret |= bq2429x_getreg8(priv, BQ2429X_REG0A, &value, 1);
|
||||
batdbg("REG#10: 0x%08X\n", value);
|
||||
batinfo("REG#10: 0x%08X\n", value);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -415,7 +403,7 @@ static int bq2429x_sysoff(FAR struct bq2429x_dev_s *priv)
|
||||
uint8_t value = 0;
|
||||
|
||||
ret = bq2429x_getreg8(priv, BQ2429X_REG07, &value, 1);
|
||||
batdbg("REG7 read value: 0x%08X\n", value);
|
||||
batinfo("REG7 read value: 0x%08X\n", value);
|
||||
value |= BQ2429XR7_BATFET_DISABLE;
|
||||
ret |= bq2429x_putreg8(priv, BQ2429X_REG07, value);
|
||||
|
||||
@ -436,7 +424,7 @@ static int bq2429x_syson(FAR struct bq2429x_dev_s *priv)
|
||||
uint8_t value = 0;
|
||||
|
||||
ret = bq2429x_getreg8(priv, BQ2429X_REG07, &value, 1);
|
||||
batdbg("REG7 read value: 0x%08X\n", value);
|
||||
batinfo("REG7 read value: 0x%08X\n", value);
|
||||
value &= ~BQ2429XR7_BATFET_DISABLE;
|
||||
ret |= bq2429x_putreg8(priv, BQ2429X_REG07, value);
|
||||
|
||||
@ -464,7 +452,7 @@ static int bq2429x_en_term(FAR struct bq2429x_dev_s *priv, bool state)
|
||||
return ret;
|
||||
}
|
||||
|
||||
batdbg("en_term: REG05 %02X EN_TERM=%d\n",
|
||||
batinfo("en_term: REG05 %02X EN_TERM=%d\n",
|
||||
regval, !!(regval & BQ2429XR5_EN_TERM));
|
||||
|
||||
/* Clear previous and set new value */
|
||||
@ -509,8 +497,8 @@ static int bq2429x_en_hiz(FAR struct bq2429x_dev_s *priv, bool state)
|
||||
return ret;
|
||||
}
|
||||
|
||||
batdbg("en_hiz: REG00 %02X EN_HIZ=%d\n",
|
||||
regval, !!(regval & BQ2429XR1_EN_HIZ));
|
||||
batinfo("en_hiz: REG00 %02X EN_HIZ=%d\n",
|
||||
regval, !!(regval & BQ2429XR1_EN_HIZ));
|
||||
|
||||
/* Clear previous and set new value */
|
||||
|
||||
@ -553,8 +541,9 @@ static int bq2429x_en_stat(FAR struct bq2429x_dev_s *priv, bool state)
|
||||
return ret;
|
||||
}
|
||||
|
||||
batdbg("int stat: REG07 %02X INT_MASK1=%d INT_MASK0=%d\n", regval,
|
||||
!!(regval & BQ2429XR7_INT_MASK1), !!(regval & BQ2429XR7_INT_MASK0));
|
||||
batinfo("int stat: REG07 %02X INT_MASK1=%d INT_MASK0=%d\n", regval,
|
||||
!!(regval & BQ2429XR7_INT_MASK1),
|
||||
!!(regval & BQ2429XR7_INT_MASK0));
|
||||
|
||||
/* We always set or clear both interrupts together. */
|
||||
|
||||
@ -621,8 +610,8 @@ static int bq2429x_setboost_otg_config(FAR struct bq2429x_dev_s *priv,
|
||||
}
|
||||
|
||||
#define BST_CONFIG_MASK (BQ2429XR1_CHG_CONFIG | BQ2429XR1_OTG_CONFIG)
|
||||
batdbg("otg_config: REG01 %02X Boost=%d\n", regval,
|
||||
((BQ2429XR1_OTG_CONFIG == (regval & BST_CONFIG_MASK)) ? 1 : 0));
|
||||
batinfo("otg_config: REG01 %02X Boost=%d\n", regval,
|
||||
((BQ2429XR1_OTG_CONFIG == (regval & BST_CONFIG_MASK)) ? 1 : 0));
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
@ -55,24 +55,6 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Debug ********************************************************************/
|
||||
|
||||
#ifdef CONFIG_DEBUG_BQ27426
|
||||
# define baterr _err
|
||||
# define batdbg _info
|
||||
# define batinfo _info
|
||||
#else
|
||||
# ifdef CONFIG_CPP_HAVE_VARARGS
|
||||
# define baterr(x...)
|
||||
# define batdbg(x...)
|
||||
# define batinfo(x...)
|
||||
# else
|
||||
# define baterr (void)
|
||||
# define batdbg (void)
|
||||
# define batinfo(void)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private
|
||||
****************************************************************************/
|
||||
|
@ -74,18 +74,6 @@
|
||||
#define WR_ADDR(a) ((a) << 1)
|
||||
#define RD_ADDR(a) (((a) << 1) | 1)
|
||||
|
||||
/* Debug ********************************************************************/
|
||||
|
||||
#ifdef CONFIG_DEBUG_BQ769X0
|
||||
# define baterr _err
|
||||
# define batreg _err
|
||||
# define batinfo _info
|
||||
#else
|
||||
# define baterr _none
|
||||
# define batreg _none
|
||||
# define batinfo _none
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private
|
||||
****************************************************************************/
|
||||
@ -424,7 +412,7 @@ static int bq769x0_putreg8(FAR struct bq769x0_dev_s *priv, uint8_t regaddr,
|
||||
config.address = priv->addr;
|
||||
config.addrlen = 7;
|
||||
|
||||
batreg("addr: %02x regval: %02x\n", regaddr, regval);
|
||||
batinfo("addr: %02x regval: %02x\n", regaddr, regval);
|
||||
|
||||
/* Set up a 3 byte message to send */
|
||||
|
||||
@ -440,7 +428,7 @@ static int bq769x0_putreg8(FAR struct bq769x0_dev_s *priv, uint8_t regaddr,
|
||||
crc = crc8ccittpart(&sl_addr, 1, 0);
|
||||
crc = crc8ccittpart(buffer, 2, crc);
|
||||
buffer[2] = crc;
|
||||
batreg("write crc: %02x\n", crc);
|
||||
batinfo("write crc: %02x\n", crc);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -146,14 +146,6 @@
|
||||
|
||||
#define MAX1407X_COMMAND_POR 0x5400
|
||||
|
||||
/* Debug ********************************************************************/
|
||||
|
||||
#ifdef CONFIG_DEBUG_MAX1704X
|
||||
# define baterr _err
|
||||
#else
|
||||
# define baterr _none
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private
|
||||
****************************************************************************/
|
||||
|
@ -55,16 +55,6 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Debug ********************************************************************/
|
||||
|
||||
#ifdef CONFIG_DEBUG_MCP73871
|
||||
# define baterr _err
|
||||
# define batreg _err
|
||||
#else
|
||||
# define baterr _none
|
||||
# define batreg _none
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private
|
||||
****************************************************************************/
|
||||
|
@ -250,6 +250,24 @@
|
||||
# define pwrinfo _none
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG_BATTERY_ERROR
|
||||
# define baterr _err
|
||||
#else
|
||||
# define baterr _none
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG_BATTERY_WARN
|
||||
# define batwarn _warn
|
||||
#else
|
||||
# define batwarn _none
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG_BATTERY_INFO
|
||||
# define batinfo _info
|
||||
#else
|
||||
# define batinfo _none
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG_WIRELESS_ERROR
|
||||
# define wlerr _err
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user