drivers/power: Run tools/nxstyle against all .c and .h files in this directory.
This commit is contained in:
parent
41d9365f06
commit
2852b3a8c8
@ -112,30 +112,42 @@ struct bq2425x_dev_s
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/* I2C support */
|
||||
|
||||
static int bq2425x_getreg8(FAR struct bq2425x_dev_s *priv, uint8_t regaddr,
|
||||
FAR uint8_t *regval);
|
||||
FAR uint8_t *regval);
|
||||
static int bq2425x_putreg8(FAR struct bq2425x_dev_s *priv, uint8_t regaddr,
|
||||
uint8_t regval);
|
||||
uint8_t regval);
|
||||
|
||||
static inline int bq2425x_getreport(FAR struct bq2425x_dev_s *priv,
|
||||
uint8_t *report);
|
||||
static inline int bq2425x_reset(FAR struct bq2425x_dev_s *priv);
|
||||
static inline int bq2425x_watchdog(FAR struct bq2425x_dev_s *priv, bool enable);
|
||||
static inline int bq2425x_powersupply(FAR struct bq2425x_dev_s *priv, int current);
|
||||
static inline int bq2425x_setvolt(FAR struct bq2425x_dev_s *priv, int volts);
|
||||
static inline int bq2425x_setcurr(FAR struct bq2425x_dev_s *priv, int current);
|
||||
static inline int bq2425x_watchdog(FAR struct bq2425x_dev_s *priv,
|
||||
bool enable);
|
||||
static inline int bq2425x_powersupply(FAR struct bq2425x_dev_s *priv,
|
||||
int current);
|
||||
static inline int bq2425x_setvolt(FAR struct bq2425x_dev_s *priv,
|
||||
int volts);
|
||||
static inline int bq2425x_setcurr(FAR struct bq2425x_dev_s *priv,
|
||||
int current);
|
||||
|
||||
/* Battery driver lower half methods */
|
||||
|
||||
static int bq2425x_state(struct battery_charger_dev_s *dev, int *status);
|
||||
static int bq2425x_health(struct battery_charger_dev_s *dev, int *health);
|
||||
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);
|
||||
static int bq2425x_state(FAR struct battery_charger_dev_s *dev,
|
||||
FAR int *status);
|
||||
static int bq2425x_health(FAR struct battery_charger_dev_s *dev,
|
||||
FAR int *health);
|
||||
static int bq2425x_online(FAR struct battery_charger_dev_s *dev,
|
||||
FAR bool *status);
|
||||
static int bq2425x_voltage(FAR struct battery_charger_dev_s *dev,
|
||||
int value);
|
||||
static int bq2425x_current(FAR struct battery_charger_dev_s *dev,
|
||||
int value);
|
||||
static int bq2425x_input_current(FAR struct battery_charger_dev_s *dev,
|
||||
int value);
|
||||
static int bq2425x_operate(FAR struct battery_charger_dev_s *dev,
|
||||
uintptr_t param);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
@ -247,7 +259,7 @@ static int bq2425x_putreg8(FAR struct bq2425x_dev_s *priv, uint8_t regaddr,
|
||||
****************************************************************************/
|
||||
|
||||
static inline int bq2425x_getreport(FAR struct bq2425x_dev_s *priv,
|
||||
uint8_t *report)
|
||||
FAR uint8_t *report)
|
||||
{
|
||||
uint8_t regval = 0;
|
||||
int ret;
|
||||
@ -318,7 +330,8 @@ static inline int bq2425x_reset(FAR struct bq2425x_dev_s *priv)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline int bq2425x_watchdog(FAR struct bq2425x_dev_s *priv, bool enable)
|
||||
static inline int bq2425x_watchdog(FAR struct bq2425x_dev_s *priv,
|
||||
bool enable)
|
||||
{
|
||||
int ret;
|
||||
uint8_t regval;
|
||||
@ -357,7 +370,8 @@ static inline int bq2425x_watchdog(FAR struct bq2425x_dev_s *priv, bool enable)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int bq2425x_state(struct battery_charger_dev_s *dev, int *status)
|
||||
static int bq2425x_state(FAR struct battery_charger_dev_s *dev,
|
||||
FAR int *status)
|
||||
{
|
||||
FAR struct bq2425x_dev_s *priv = (FAR struct bq2425x_dev_s *)dev;
|
||||
uint8_t regval = 0;
|
||||
@ -414,7 +428,8 @@ static int bq2425x_state(struct battery_charger_dev_s *dev, int *status)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int bq2425x_health(struct battery_charger_dev_s *dev, int *health)
|
||||
static int bq2425x_health(FAR struct battery_charger_dev_s *dev,
|
||||
FAR int *health)
|
||||
{
|
||||
FAR struct bq2425x_dev_s *priv = (FAR struct bq2425x_dev_s *)dev;
|
||||
uint8_t regval = 0;
|
||||
@ -476,7 +491,8 @@ static int bq2425x_health(struct battery_charger_dev_s *dev, int *health)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int bq2425x_online(struct battery_charger_dev_s *dev, bool *status)
|
||||
static int bq2425x_online(FAR struct battery_charger_dev_s *dev,
|
||||
FAR bool *status)
|
||||
{
|
||||
/* There is no concept of online/offline in this driver */
|
||||
|
||||
@ -492,10 +508,12 @@ static int bq2425x_online(struct battery_charger_dev_s *dev, bool *status)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline int bq2425x_powersupply(FAR struct bq2425x_dev_s *priv, int current)
|
||||
static inline int bq2425x_powersupply(FAR struct bq2425x_dev_s *priv,
|
||||
int current)
|
||||
{
|
||||
uint8_t regval;
|
||||
int ret, idx;
|
||||
int idx;
|
||||
int ret;
|
||||
|
||||
switch (current)
|
||||
{
|
||||
@ -572,7 +590,8 @@ static inline int bq2425x_powersupply(FAR struct bq2425x_dev_s *priv, int curren
|
||||
static inline int bq2425x_setvolt(FAR struct bq2425x_dev_s *priv, int volts)
|
||||
{
|
||||
uint8_t regval;
|
||||
int ret, idx;
|
||||
int idx;
|
||||
int ret;
|
||||
|
||||
/* Verify if voltage is in the acceptable range */
|
||||
|
||||
@ -620,7 +639,8 @@ static inline int bq2425x_setvolt(FAR struct bq2425x_dev_s *priv, int volts)
|
||||
static inline int bq2425x_setcurr(FAR struct bq2425x_dev_s *priv, int current)
|
||||
{
|
||||
uint8_t regval;
|
||||
int ret, idx;
|
||||
int idx;
|
||||
int ret;
|
||||
|
||||
/* Verify if voltage is in the acceptable range */
|
||||
|
||||
@ -657,7 +677,6 @@ static inline int bq2425x_setcurr(FAR struct bq2425x_dev_s *priv, int current)
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Name: bq2425x_voltage
|
||||
*
|
||||
@ -666,7 +685,7 @@ static inline int bq2425x_setcurr(FAR struct bq2425x_dev_s *priv, int current)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int bq2425x_voltage(struct battery_charger_dev_s *dev, int value)
|
||||
static int bq2425x_voltage(FAR struct battery_charger_dev_s *dev, int value)
|
||||
{
|
||||
FAR struct bq2425x_dev_s *priv = (FAR struct bq2425x_dev_s *)dev;
|
||||
int ret;
|
||||
@ -691,7 +710,7 @@ 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_current(FAR struct battery_charger_dev_s *dev, int value)
|
||||
{
|
||||
FAR struct bq2425x_dev_s *priv = (FAR struct bq2425x_dev_s *)dev;
|
||||
int ret;
|
||||
@ -716,7 +735,8 @@ 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_input_current(FAR struct battery_charger_dev_s *dev,
|
||||
int value)
|
||||
{
|
||||
FAR struct bq2425x_dev_s *priv = (FAR struct bq2425x_dev_s *)dev;
|
||||
int ret;
|
||||
@ -739,7 +759,8 @@ 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)
|
||||
static int bq2425x_operate(FAR struct battery_charger_dev_s *dev,
|
||||
uintptr_t param)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
@ -135,6 +135,7 @@ struct bq2429x_dev_s
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/* I2C support */
|
||||
|
||||
static int bq2429x_getreg8(FAR struct bq2429x_dev_s *priv, uint8_t regaddr,
|
||||
@ -840,7 +841,8 @@ static int bq2429x_online(FAR struct battery_charger_dev_s *dev,
|
||||
|
||||
static int bq2429x_powersupply(FAR struct bq2429x_dev_s *priv, int current)
|
||||
{
|
||||
uint8_t regval, idx;
|
||||
uint8_t regval;
|
||||
uint8_t idx;
|
||||
int ret;
|
||||
|
||||
switch (current)
|
||||
@ -918,7 +920,8 @@ static int bq2429x_powersupply(FAR struct bq2429x_dev_s *priv, int current)
|
||||
static inline int bq2429x_setvolt(FAR struct bq2429x_dev_s *priv, int req_volts)
|
||||
{
|
||||
uint8_t regval;
|
||||
int ret, idx;
|
||||
int idx;
|
||||
int ret;
|
||||
|
||||
/* Verify if voltage is in the acceptable range */
|
||||
|
||||
@ -967,8 +970,9 @@ static inline int bq2429x_setcurr(FAR struct bq2429x_dev_s *priv,
|
||||
int req_current)
|
||||
{
|
||||
uint8_t regval;
|
||||
int ret, idx;
|
||||
bool force_20pct = false;
|
||||
int idx;
|
||||
int ret;
|
||||
|
||||
/* If requested current is below the minimum for fast charge,
|
||||
* configure for trickle charging. Trickle charging uses 20%
|
||||
@ -1164,8 +1168,9 @@ static int bq2429x_operate(FAR struct battery_charger_dev_s *dev,
|
||||
uintptr_t param)
|
||||
{
|
||||
FAR struct bq2429x_dev_s *priv = (FAR struct bq2429x_dev_s *)dev;
|
||||
struct batio_operate_msg_s *msg = (struct batio_operate_msg_s *)param;
|
||||
int op, value;
|
||||
FAR struct batio_operate_msg_s *msg = (FAR struct batio_operate_msg_s *)param;
|
||||
int op;
|
||||
int value;
|
||||
int ret = OK;
|
||||
|
||||
bq2429x_dump_regs(priv);
|
||||
|
@ -69,7 +69,9 @@
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
/* CONFIG_I2C_MAX17040 or CONFIG_I2C_MAX17041 - The driver must know which
|
||||
* chip is on the board in order to scale the voltage correctly.
|
||||
*/
|
||||
@ -80,6 +82,7 @@
|
||||
#endif
|
||||
|
||||
/* MAX1704x Register Definitions ********************************************/
|
||||
|
||||
/* "All host interaction with the MAX17040/MAX17041 is handled by writing to
|
||||
* and reading from register locations. The MAX17040/MAX17041 have six 16-bit
|
||||
* registers: SOC, VCELL, MODE, VERSION, RCOMP, and COMMAND. Register reads
|
||||
@ -190,6 +193,7 @@ struct max1704x_dev_s
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/* I2C support */
|
||||
|
||||
static int max1704x_getreg16(FAR struct max1704x_dev_s *priv, uint8_t regaddr,
|
||||
@ -328,8 +332,9 @@ static inline int max1704x_getvcell(FAR struct max1704x_dev_s *priv,
|
||||
ret = max1704x_getreg16(priv, MAX1407X_VCELL_ADDR, ®val);
|
||||
if (ret == OK)
|
||||
{
|
||||
*vcell = MAX1407X_VCELL(regval);
|
||||
*vcell = MAX1407X_VCELL(regval);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -350,8 +355,9 @@ static inline int max1704x_getsoc(FAR struct max1704x_dev_s *priv,
|
||||
ret = max1704x_getreg16(priv, MAX1407X_VCELL_ADDR, ®val);
|
||||
if (ret == OK)
|
||||
{
|
||||
*soc = MAX1407X_SOC(regval);
|
||||
*soc = MAX1407X_SOC(regval);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -560,6 +566,7 @@ FAR struct battery_gauge_dev_s *max1704x_initialize(FAR struct i2c_master_s *i2c
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return (FAR struct battery_gauge_dev_s *)priv;
|
||||
}
|
||||
|
||||
|
@ -207,14 +207,15 @@ static ssize_t motor_read(FAR struct file *filep, FAR char *buffer, size_t bufle
|
||||
* Name: motor_write
|
||||
****************************************************************************/
|
||||
|
||||
static ssize_t motor_write(FAR struct file *filep, FAR const char *buffer, size_t buflen)
|
||||
static ssize_t motor_write(FAR struct file *filep, FAR const char *buffer,
|
||||
size_t buflen)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: motor_ioctl
|
||||
****************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
static int motor_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
{
|
||||
@ -359,7 +360,7 @@ static int motor_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
case PWRIOC_GET_FAULT:
|
||||
{
|
||||
uint8_t *fault = ((uint8_t*)arg);
|
||||
FAR uint8_t *fault = ((FAR uint8_t *)arg);
|
||||
|
||||
ret = dev->ops->fault_get(dev, fault);
|
||||
if (ret != OK)
|
||||
|
@ -55,6 +55,7 @@
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
/* Convert the time slice interval into system clock ticks.
|
||||
@ -126,7 +127,7 @@ struct pm_domain_s
|
||||
* CONFIG_PM_COEFn provides weight for each sample. Default: 1
|
||||
*/
|
||||
|
||||
int16_t memory[CONFIG_PM_MEMORY-1];
|
||||
int16_t memory[CONFIG_PM_MEMORY - 1];
|
||||
#endif
|
||||
|
||||
/* stime - The time (in ticks) at the start of the current time slice */
|
||||
|
@ -205,7 +205,7 @@ static inline void pm_changeall(int domain, enum pm_state_e newstate)
|
||||
{
|
||||
FAR dq_entry_t *entry;
|
||||
|
||||
if (newstate <= g_pmglobals.domain[domain].state)
|
||||
if (newstate <= g_pmglobals.domain[domain].state)
|
||||
{
|
||||
/* Visit each registered callback structure in normal order. */
|
||||
|
||||
@ -226,7 +226,7 @@ if (newstate <= g_pmglobals.domain[domain].state)
|
||||
{
|
||||
/* Visit each registered callback structure in reverse order. */
|
||||
|
||||
for (entry = dq_tail(&g_pmglobals.registry); entry; entry = dq_prev(entry))
|
||||
for (entry = dq_tail(&g_pmglobals.registry); entry; entry = dq_prev(entry))
|
||||
{
|
||||
/* Is the notification callback supported? */
|
||||
|
||||
@ -278,9 +278,9 @@ int pm_changestate(int domain, enum pm_state_e newstate)
|
||||
irqstate_t flags;
|
||||
int ret;
|
||||
|
||||
DEBUGASSERT(domain >=0 && domain < CONFIG_PM_NDOMAINS);
|
||||
DEBUGASSERT(domain >= 0 && domain < CONFIG_PM_NDOMAINS);
|
||||
|
||||
/* Disable interrupts throught this operation... changing driver states
|
||||
/* Disable interrupts throughout this operation... changing driver states
|
||||
* could cause additional driver activity that might interfere with the
|
||||
* state change. When the state change is complete, interrupts will be
|
||||
* re-enabled.
|
||||
|
@ -58,7 +58,7 @@
|
||||
*/
|
||||
|
||||
#if CONFIG_PM_MEMORY > 1
|
||||
static const int16_t g_pmcoeffs[CONFIG_PM_MEMORY-1] =
|
||||
static const int16_t g_pmcoeffs[CONFIG_PM_MEMORY - 1] =
|
||||
{
|
||||
CONFIG_PM_COEF1
|
||||
#if CONFIG_PM_MEMORY > 2
|
||||
@ -159,7 +159,7 @@ void pm_update(int domain, int16_t accum)
|
||||
* CONFIG_PM_MEMORY-1 samples.
|
||||
*/
|
||||
|
||||
if (pdom->mcnt < CONFIG_PM_MEMORY-1)
|
||||
if (pdom->mcnt < CONFIG_PM_MEMORY - 1)
|
||||
{
|
||||
index = pdom->mcnt++;
|
||||
pdom->memory[index] = accum;
|
||||
@ -185,10 +185,10 @@ void pm_update(int domain, int16_t accum)
|
||||
*/
|
||||
|
||||
for (i = 0, j = pdom->mndx;
|
||||
i < CONFIG_PM_MEMORY-1;
|
||||
i < CONFIG_PM_MEMORY - 1;
|
||||
i++, j++)
|
||||
{
|
||||
if (j >= CONFIG_PM_MEMORY-1)
|
||||
if (j >= CONFIG_PM_MEMORY - 1)
|
||||
{
|
||||
j = 0;
|
||||
}
|
||||
@ -203,7 +203,7 @@ void pm_update(int domain, int16_t accum)
|
||||
|
||||
index = pdom->mndx++;
|
||||
pdom->memory[index] = Y;
|
||||
if (pdom->mndx >= CONFIG_PM_MEMORY-1)
|
||||
if (pdom->mndx >= CONFIG_PM_MEMORY - 1)
|
||||
{
|
||||
pdom->mndx = 0;
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ static int powerled_close(FAR struct file *filep)
|
||||
|
||||
/****************************************************************************
|
||||
* Name: powerled_ioctl
|
||||
****************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
static int powerled_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
{
|
||||
@ -206,7 +206,6 @@ static int powerled_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
{
|
||||
case PWRIOC_START:
|
||||
{
|
||||
|
||||
/* Allow powerled start only when limits set and structure is locked */
|
||||
|
||||
if (powerled->limits.lock == false ||
|
||||
@ -312,7 +311,7 @@ static int powerled_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
case PWRIOC_GET_FAULT:
|
||||
{
|
||||
uint8_t *fault = ((uint8_t*)arg);
|
||||
FAR uint8_t *fault = ((FAR uint8_t *)arg);
|
||||
|
||||
ret = dev->ops->fault_get(dev, fault);
|
||||
if (ret != OK)
|
||||
@ -385,7 +384,8 @@ errout:
|
||||
* Name: powerled_register
|
||||
****************************************************************************/
|
||||
|
||||
int powerled_register(FAR const char *path, FAR struct powerled_dev_s *dev, FAR void *lower)
|
||||
int powerled_register(FAR const char *path, FAR struct powerled_dev_s *dev,
|
||||
FAR void *lower)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -208,14 +208,15 @@ static ssize_t smps_read(FAR struct file *filep, FAR char *buffer, size_t buflen
|
||||
* Name: smps_write
|
||||
****************************************************************************/
|
||||
|
||||
static ssize_t smps_write(FAR struct file *filep, FAR const char *buffer, size_t buflen)
|
||||
static ssize_t smps_write(FAR struct file *filep, FAR const char *buffer,
|
||||
size_t buflen)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: smps_ioctl
|
||||
****************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
static int smps_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
{
|
||||
@ -236,7 +237,7 @@ static int smps_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
if ((smps->limits.lock == false) ||
|
||||
(smps->limits.v_in <= 0 && smps->limits.v_out <= 0 &&
|
||||
smps->limits.i_in <= 0 && smps->limits.i_out <= 0 &&
|
||||
smps->limits.p_in <= 0 && smps->limits.p_out <= 0 ))
|
||||
smps->limits.p_in <= 0 && smps->limits.p_out <= 0))
|
||||
{
|
||||
pwrerr("ERROR: SMPS limits data must be set"
|
||||
" and locked before SMPS start\n");
|
||||
@ -369,7 +370,7 @@ static int smps_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
case PWRIOC_GET_FAULT:
|
||||
{
|
||||
uint8_t *fault = ((uint8_t*)arg);
|
||||
FAR uint8_t *fault = ((FAR uint8_t *)arg);
|
||||
|
||||
ret = dev->ops->fault_get(dev, fault);
|
||||
if (ret != OK)
|
||||
@ -407,7 +408,7 @@ static int smps_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
if ((smps->limits.lock == false) ||
|
||||
(smps->limits.v_in <= 0 && smps->limits.v_out <= 0 &&
|
||||
smps->limits.i_in <= 0 && smps->limits.i_out <= 0 &&
|
||||
smps->limits.p_in <= 0 && smps->limits.p_out <= 0 ))
|
||||
smps->limits.p_in <= 0 && smps->limits.p_out <= 0))
|
||||
{
|
||||
pwrerr("ERROR: limits must be set prior to params!\n");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user