cmd: add 'charge' cmd support
It calls charge display. Change-Id: Iced07ec388b48f6849516cc67715b6a50860bc9c Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
This commit is contained in:
parent
37cb087dbc
commit
c0b38c6cdf
|
|
@ -1219,6 +1219,11 @@ config CMD_REGULATOR
|
|||
the limits, which are found in device-tree and are kept in regulator's
|
||||
uclass platdata structure.
|
||||
|
||||
config CMD_CHARGE_DISPLAY
|
||||
bool "Enable Driver Model Charge Display command"
|
||||
help
|
||||
Support U-Boot charge display.
|
||||
|
||||
endmenu
|
||||
|
||||
menu "Security commands"
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ obj-$(CONFIG_CMD_CLK) += clk.o
|
|||
obj-$(CONFIG_CMD_CONFIG) += config.o
|
||||
obj-$(CONFIG_CMD_CONSOLE) += console.o
|
||||
obj-$(CONFIG_CMD_CPU) += cpu.o
|
||||
obj-$(CONFIG_CMD_CHARGE_DISPLAY) += charge.o
|
||||
obj-$(CONFIG_DATAFLASH_MMC_SELECT) += dataflash_mmc_mux.o
|
||||
obj-$(CONFIG_CMD_DATE) += date.o
|
||||
obj-$(CONFIG_CMD_DEMO) += demo.o
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* (C) Copyright 2017 Rockchip Electronics Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <command.h>
|
||||
#include <dm.h>
|
||||
#include <power/charge_display.h>
|
||||
|
||||
static int charge_display(cmd_tbl_t *cmdtp, int flag, int argc,
|
||||
char *const argv[])
|
||||
{
|
||||
int ret;
|
||||
struct udevice *dev;
|
||||
|
||||
if (argc != 1)
|
||||
return CMD_RET_USAGE;
|
||||
|
||||
ret = uclass_get_device(UCLASS_CHARGE_DISPLAY, 0, &dev);
|
||||
if (ret) {
|
||||
if (ret != -ENODEV) {
|
||||
printf("Get UCLASS CHARGE DISPLAY failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return charge_display_show(dev);
|
||||
}
|
||||
|
||||
U_BOOT_CMD(
|
||||
charge, 1, 0, charge_display,
|
||||
"Charge display",
|
||||
""
|
||||
);
|
||||
Loading…
Reference in New Issue