Skip to content

Commit

Permalink
driver: act8865: use console_printf to print error messages
Browse files Browse the repository at this point in the history
In our act8865 i2c communication, we used dbg_printf to print error
messages. This is not very good if the communication with act8865 fails
and we cannot configure the regulators in PMIC.
Modify messages to be printed at boottime in case of errors regardless
of the DEBUG settings.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
  • Loading branch information
ehristev committed May 30, 2018
1 parent 49c3cba commit 43897e0
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 24 deletions.
10 changes: 5 additions & 5 deletions board/sama5d2_xplained/sama5d2_xplained.c
Original file line number Diff line number Diff line change
Expand Up @@ -936,35 +936,35 @@ int at91_board_act8865_set_reg_voltage(void)
value = ACT8865_2V5;
ret = act8865_set_reg_voltage(reg, value);
if (ret)
dbg_loud("ACT8865: Failed to make REG4 output 2500mV\n");
console_printf("ACT8865: Failed to make REG4 output 2500mV\n");

/* Enable REG5 output 3.3V */
reg = REG5_0;
value = ACT8865_3V3;
ret = act8865_set_reg_voltage(reg, value);
if (ret)
dbg_loud("ACT8865: Failed to make REG5 output 3300mV\n");
console_printf("ACT8865: Failed to make REG5 output 3300mV\n");

/* Enable REG6 output 2.5V */
reg = REG6_0;
value = ACT8865_2V5;
ret = act8865_set_reg_voltage(reg, value);
if (ret)
dbg_loud("ACT8865: Failed to make REG6 output 2500mV\n");
console_printf("ACT8865: Failed to make REG6 output 2500mV\n");

/* Enable REG7 output 1.8V */
reg = REG7_0;
value = ACT8865_1V8;
ret = act8865_set_reg_voltage(reg, value);
if (ret)
dbg_loud("ACT8865: Failed to make REG7 output 1800mV\n");
console_printf("ACT8865: Failed to make REG7 output 1800mV\n");

/* Enable REG2 output 1.2V */
reg = REG2_1;
value = ACT8865_1V2;
ret = act8865_set_reg_voltage(reg, value);
if (ret)
dbg_loud("ACT8865: Failed to make REG2 output 1200mV\n");
console_printf("ACT8865: Failed to make REG2 output 1200mV\n");

/* Enable REG4 output 2.5V */
return 0;
Expand Down
4 changes: 2 additions & 2 deletions board/sama5d3_xplained/sama5d3_xplained.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,14 +340,14 @@ int at91_board_act8865_set_reg_voltage(void)
value = ACT8865_3V3;
ret = act8865_set_reg_voltage(reg, value);
if (ret)
dbg_loud("ACT8865: Failed to make REG5 output 3300mV\n");
console_printf("ACT8865: Failed to make REG5 output 3300mV\n");

/* Enable REG2 output 1.25V */
reg = REG2_0;
value = ACT8865_1V25;
ret = act8865_set_reg_voltage(reg, value);
if (ret)
dbg_loud("ACT8865: Failed to make REG2 output 1250mV\n");
console_printf("ACT8865: Failed to make REG2 output 1250mV\n");

return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions board/sama5d3x_cmp/sama5d3x_cmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,14 +454,14 @@ int at91_board_act8865_set_reg_voltage(void)
value = ACT8865_3V3;
ret = act8865_set_reg_voltage(reg, value);
if (ret)
dbg_loud("ACT8865: Failed to make REG4 output 3300mV\n");
console_printf("ACT8865: Failed to make REG4 output 3300mV\n");

/* Enable REG2 output 1.25V */
reg = REG2_0;
value = ACT8865_1V25;
ret = act8865_set_reg_voltage(reg, value);
if (ret)
dbg_loud("ACT8865: Failed to make REG2 output 1250mV\n");
console_printf("ACT8865: Failed to make REG2 output 1250mV\n");

return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions board/sama5d4_xplained/sama5d4_xplained.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,14 +544,14 @@ int at91_board_act8865_set_reg_voltage(void)
value = ACT8865_3V3;
ret = act8865_set_reg_voltage(reg, value);
if (ret)
dbg_loud("ACT8865: Failed to make REG5 output 3300mV\n");
console_printf("ACT8865: Failed to make REG5 output 3300mV\n");

/* Enable REG6 output 1.8V */
reg = REG6_0;
value = ACT8865_1V8;
ret = act8865_set_reg_voltage(reg, value);
if (ret)
dbg_loud("ACT8865: Failed to make REG6 output 1800mV\n");
console_printf("ACT8865: Failed to make REG6 output 1800mV\n");

return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions board/sama5d4ek/sama5d4ek.c
Original file line number Diff line number Diff line change
Expand Up @@ -555,14 +555,14 @@ int at91_board_act8865_set_reg_voltage(void)
value = ACT8865_3V3;
ret = act8865_set_reg_voltage(reg, value);
if (ret)
dbg_loud("ACT8865: Failed to make REG5 output 3300mV\n");
console_printf("ACT8865: Failed to make REG5 output 3300mV\n");

/* Enable REG6 output 1.8V */
reg = REG6_0;
value = ACT8865_1V8;
ret = act8865_set_reg_voltage(reg, value);
if (ret)
dbg_loud("ACT8865: Failed to make REG6 output 1800mV\n");
console_printf("ACT8865: Failed to make REG6 output 1800mV\n");

return 0;
}
Expand Down
10 changes: 5 additions & 5 deletions contrib/board/acme/sama5d2_roadrunner/sama5d2_roadrunner.c
Original file line number Diff line number Diff line change
Expand Up @@ -900,35 +900,35 @@ int at91_board_act8865_set_reg_voltage(void)
value = ACT8865_2V5;
ret = act8865_set_reg_voltage(reg, value);
if (ret)
dbg_loud("ACT8865: Failed to make REG4 output 2500mV\n");
console_printf("ACT8865: Failed to make REG4 output 2500mV\n");

/* Enable REG5 output 3.3V */
reg = REG5_0;
value = ACT8865_3V3;
ret = act8865_set_reg_voltage(reg, value);
if (ret)
dbg_loud("ACT8865: Failed to make REG5 output 3300mV\n");
console_printf("ACT8865: Failed to make REG5 output 3300mV\n");

/* Enable REG6 output 2.5V */
reg = REG6_0;
value = ACT8865_2V5;
ret = act8865_set_reg_voltage(reg, value);
if (ret)
dbg_loud("ACT8865: Failed to make REG6 output 2500mV\n");
console_printf("ACT8865: Failed to make REG6 output 2500mV\n");

/* Enable REG7 output 1.8V */
reg = REG7_0;
value = ACT8865_1V8;
ret = act8865_set_reg_voltage(reg, value);
if (ret)
dbg_loud("ACT8865: Failed to make REG7 output 1800mV\n");
console_printf("ACT8865: Failed to make REG7 output 1800mV\n");

/* Enable REG2 output 1.2V */
reg = REG2_1;
value = ACT8865_1V2;
ret = act8865_set_reg_voltage(reg, value);
if (ret)
dbg_loud("ACT8865: Failed to make REG2 output 1200mV\n");
console_printf("ACT8865: Failed to make REG2 output 1200mV\n");

/* Enable REG4 output 2.5V */
return 0;
Expand Down
12 changes: 6 additions & 6 deletions driver/act8865.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@ int act8865_set_power_saving_mode(void)
reg = reg_list[i];
ret = act8865_set_reg_mode(reg, mode);
if (ret)
dbg_loud("ACT8865: Failed to set Power-saving mode\n");
console_printf("ACT8865: Failed to set Power-saving mode\n");
}

dbg_loud("ACT8865: Set REG1/REG2/REG3 Power-saving mode\n");
console_printf("ACT8865: Set REG1/REG2/REG3 Power-saving mode\n");

return 0;
}
Expand Down Expand Up @@ -264,11 +264,11 @@ static int act8865_workaround_disable_i2c(void)
}

if (i >= ARRAY_SIZE(version_array)) {
dbg_loud("ACT8865: Failed to disable I2C interface\n");
console_printf("ACT8865: Failed to disable I2C interface\n");
return -1;
}

dbg_loud("ACT8865: Disable ACT8865's I2C interface\n");
console_printf("ACT8865: Disable ACT8865's I2C interface\n");

return 0;
}
Expand All @@ -288,7 +288,7 @@ void act8865_workaround(void)
#if defined(CONFIG_DISABLE_ACT8865_I2C)
/* Disable ACT8865 I2C interface, if failed, don't go on */
if (act8865_workaround_disable_i2c()) {
dbg_loud("ACT8865: Failed to disable I2C interface\n");
console_printf("ACT8865: Failed to disable I2C interface\n");
while (1)
;
}
Expand Down Expand Up @@ -343,7 +343,7 @@ int act8945a_suspend_charger(void)
return -1;

if ((data & APCH_STATE_CSTATE) != APCH_STATE_CSTATE_DISABLED) {
dbg_loud("ACT8945A: Failed to suspend charger\n");
console_printf("ACT8945A: Failed to suspend charger\n");
return -1;
}

Expand Down

0 comments on commit 43897e0

Please sign in to comment.