test: rockchip: improve regulator test
1. dump all regulator fdt configure and current status; 2. only adjudst voltage for bucks; Change-Id: Ib1b1730e0eb8157a9c979e3552932b2c80f40458 Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
This commit is contained in:
parent
3403638a65
commit
0b4606ef44
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include <asm/io.h>
|
||||
#include <common.h>
|
||||
#include <common.h>
|
||||
#include <console.h>
|
||||
#include <dm.h>
|
||||
#include <power/pmic.h>
|
||||
#include <power/regulator.h>
|
||||
|
|
@ -15,36 +15,44 @@
|
|||
static void regulator_show_dt(struct udevice *dev)
|
||||
{
|
||||
struct dm_regulator_uclass_platdata *uc_pdata;
|
||||
int uV;
|
||||
|
||||
uc_pdata = dev_get_uclass_platdata(dev);
|
||||
uV = regulator_get_value(dev);
|
||||
|
||||
printf("\t%s@%s: \t[", dev->name, uc_pdata->name);
|
||||
if (uc_pdata->flags & REGULATOR_FLAG_AUTOSET_UV)
|
||||
printf("%d uV", uc_pdata->min_uV);
|
||||
else
|
||||
printf("%d ~ %d uV", uc_pdata->min_uV, uc_pdata->max_uV);
|
||||
printf("%25s@%15s: ", dev->name, uc_pdata->name);
|
||||
printf("%7duV <-> %7duV, set %7duV, %s",
|
||||
uc_pdata->min_uV, uc_pdata->max_uV, uV,
|
||||
(uc_pdata->always_on || uc_pdata->boot_on) ?
|
||||
"enabling" : "disabled");
|
||||
|
||||
printf(" | supsend %7duV, %s",
|
||||
uc_pdata->suspend_uV,
|
||||
uc_pdata->suspend_on ? "enabling" : "disabled");
|
||||
if (uc_pdata->init_uV != -ENODATA)
|
||||
printf("; init %7duV", uc_pdata->init_uV);
|
||||
|
||||
printf("\n");
|
||||
|
||||
printf("; %s]\n", uc_pdata->boot_on ? "enable" : "disabled");
|
||||
}
|
||||
|
||||
static void regulator_show_state(struct udevice *dev)
|
||||
{
|
||||
struct dm_regulator_uclass_platdata *uc_pdata;
|
||||
int enable, uV;
|
||||
int same = 1;
|
||||
int enable, uV, suspend_enable, suspend_uV;
|
||||
|
||||
uc_pdata = dev_get_uclass_platdata(dev);
|
||||
|
||||
enable = regulator_get_enable(dev);
|
||||
uV = regulator_get_value(dev);
|
||||
|
||||
if (uc_pdata->flags & REGULATOR_FLAG_AUTOSET_UV)
|
||||
same = (enable == uc_pdata->boot_on) &&
|
||||
(uV == uc_pdata->min_uV);
|
||||
suspend_enable = regulator_get_suspend_enable(dev);
|
||||
suspend_uV = regulator_get_suspend_value(dev);
|
||||
|
||||
printf("\t%s@%s: \t[", dev->name, uc_pdata->name);
|
||||
printf("%d uV", uV);
|
||||
printf("; %s] <%s>\n", enable ? "enable" : "disabled",
|
||||
same ? "same" : "Not same");
|
||||
printf("%25s@%15s: set %7duV, %s | suspend %7duV, %s\n",
|
||||
dev->name, uc_pdata->name, uV,
|
||||
enable ? "enabling" : "disabled", suspend_uV,
|
||||
suspend_enable ? "enabling" : "disabled");
|
||||
}
|
||||
|
||||
static int regulator_confirm_dt(void)
|
||||
|
|
@ -57,25 +65,21 @@ static int regulator_confirm_dt(void)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
printf("<FDT config>:\n");
|
||||
printf("<Board dts config>:\n");
|
||||
for (uclass_first_device(UCLASS_REGULATOR, &dev);
|
||||
dev;
|
||||
uclass_next_device(&dev)) {
|
||||
regulator_show_dt(dev);
|
||||
}
|
||||
|
||||
printf("\n\n\n<NOW state>:\n");
|
||||
printf("\n<Board current status>:\n");
|
||||
for (uclass_first_device(UCLASS_REGULATOR, &dev);
|
||||
dev;
|
||||
uclass_next_device(&dev)) {
|
||||
regulator_show_state(dev);
|
||||
}
|
||||
|
||||
printf("\n\n\n");
|
||||
printf("1. Please compare <NOW state> and <FDT config>.\n");
|
||||
printf("2. Please measure the volatge of all regulators "
|
||||
"and compare with <Now state> voltage.\n\n");
|
||||
printf("After above done, you can hit any key to continue test case2...\n\n\n\n");
|
||||
printf("\n");
|
||||
|
||||
while (!getc())
|
||||
;
|
||||
|
|
@ -92,7 +96,7 @@ static int regulator_adjust_voltage(struct udevice *dev)
|
|||
|
||||
/* only not fix voltage regulator will be tested! */
|
||||
if ((uc_pdata->max_uV == uc_pdata->min_uV) ||
|
||||
!regulator_get_enable(dev))
|
||||
!regulator_get_enable(dev) || strncmp("DCDC", dev->name, 4))
|
||||
return 0;
|
||||
|
||||
/* save for restore after test done */
|
||||
|
|
@ -100,13 +104,12 @@ static int regulator_adjust_voltage(struct udevice *dev)
|
|||
|
||||
for (i = 1; i < 4; i++) {
|
||||
uV = regulator_get_value(dev);
|
||||
printf("[%s] ", uc_pdata->name);
|
||||
printf("Try: %d uV --> %d uV; ", uV, uV + step_uV * i);
|
||||
printf("[%s@%s] set: %d uV -> %d uV; ",
|
||||
dev->name, uc_pdata->name, uV, uV + step_uV * i);
|
||||
uV += (step_uV * i);
|
||||
regulator_set_value(dev, uV);
|
||||
printf("Now: %d uV.\n\n", regulator_get_value(dev));
|
||||
printf("Please measure voltage of [%s].\n"
|
||||
"After done, hit any key to continue...\n\n\n\n",
|
||||
printf("ReadBack: %d uV\n\n", regulator_get_value(dev));
|
||||
printf("Confirm '%s' voltage, then hit any key to continue...\n\n",
|
||||
uc_pdata->name);
|
||||
|
||||
while (!getc())
|
||||
|
|
@ -141,12 +144,12 @@ static int regulator_confirm_voltage_accuracy(void)
|
|||
int board_regulator_test(int argc, char * const argv[])
|
||||
{
|
||||
printf("----------------------------------------------------\n");
|
||||
printf("REGULATOR test case 1: regulator fdt config confirm\n");
|
||||
printf("REGULATOR: status show\n");
|
||||
printf("----------------------------------------------------\n\n");
|
||||
regulator_confirm_dt();
|
||||
|
||||
printf("----------------------------------------------------\n");
|
||||
printf("REGULATOR test case 2: regulator voltage accuracy confirm\n");
|
||||
printf("REGULATOR: voltage accuracy confirm\n");
|
||||
printf("----------------------------------------------------\n\n");
|
||||
regulator_confirm_voltage_accuracy();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue