driver/ioexpander/tca64xxa.c: Format with clang-format
BRANCH=none
TEST=none
* of chip is used.
*/
#define TCA64XXA_PORT_ID(port, reg, flags) \
- ((((flags) & TCA64XXA_FLAG_VER_MASK) \
- >> TCA64XXA_FLAG_VER_OFFSET) * (reg) + (port))
+ ((((flags)&TCA64XXA_FLAG_VER_MASK) >> TCA64XXA_FLAG_VER_OFFSET) * \
+ (reg) + \
+ (port))
static int tca64xxa_write_byte(int ioex, int port, int reg, uint8_t val)
{
const struct ioexpander_config_t *ioex_p = &ioex_config[ioex];
- const int reg_addr = TCA64XXA_PORT_ID(port, reg,
- (ioex_p->flags & IOEX_FLAGS_TCA64XXA_FLAG_VER_TCA6416A) ? 2:4);
+ const int reg_addr = TCA64XXA_PORT_ID(
+ port, reg,
+ (ioex_p->flags & IOEX_FLAGS_TCA64XXA_FLAG_VER_TCA6416A) ? 2 :
+ 4);
- return i2c_write8(ioex_p->i2c_host_port,
- ioex_p->i2c_addr_flags,
- reg_addr,
- val);
+ return i2c_write8(ioex_p->i2c_host_port, ioex_p->i2c_addr_flags,
+ reg_addr, val);
}
static int tca64xxa_read_byte(int ioex, int port, int reg, int *val)
{
const struct ioexpander_config_t *ioex_p = &ioex_config[ioex];
- const int reg_addr = TCA64XXA_PORT_ID(port, reg,
- (ioex_p->flags & IOEX_FLAGS_TCA64XXA_FLAG_VER_TCA6416A) ? 2:4);
+ const int reg_addr = TCA64XXA_PORT_ID(
+ port, reg,
+ (ioex_p->flags & IOEX_FLAGS_TCA64XXA_FLAG_VER_TCA6416A) ? 2 :
+ 4);
- return i2c_read8(ioex_p->i2c_host_port,
- ioex_p->i2c_addr_flags,
- reg_addr,
- val);
+ return i2c_read8(ioex_p->i2c_host_port, ioex_p->i2c_addr_flags,
+ reg_addr, val);
}
/* Restore default values in registers */
@@ -59,23 +60,17 @@ static int tca64xxa_reset(int ioex, int portsCount)
* This loop sets default values (from specification) to all registers.
*/
for (port = 0; port < portsCount; port++) {
- ret = tca64xxa_write_byte(ioex,
- port,
- TCA64XXA_REG_OUTPUT,
+ ret = tca64xxa_write_byte(ioex, port, TCA64XXA_REG_OUTPUT,
TCA64XXA_DEFAULT_OUTPUT);
if (ret)
return ret;
- ret = tca64xxa_write_byte(ioex,
- port,
- TCA64XXA_REG_POLARITY_INV,
+ ret = tca64xxa_write_byte(ioex, port, TCA64XXA_REG_POLARITY_INV,
TCA64XXA_DEFAULT_POLARITY_INV);
if (ret)
return ret;
- ret = tca64xxa_write_byte(ioex,
- port,
- TCA64XXA_REG_CONF,
+ ret = tca64xxa_write_byte(ioex, port, TCA64XXA_REG_CONF,
TCA64XXA_DEFAULT_CONF);
if (ret)
return ret;
