sync: huiwei e92da50a54f00ae044eec58de8ae56cde5bb61dd

merge into 03a9fc66d7ddb7fd4ae80ad121ef1e5abd49aabd
This commit is contained in:
lin_jiayong
2024-02-04 16:23:28 +08:00
committed by Han Gao
parent 02f2afad91
commit 1aec90053d
26 changed files with 1621 additions and 1 deletions

View File

@@ -115,7 +115,9 @@ enum uclass_id {
UCLASS_W1, /* Dallas 1-Wire bus */
UCLASS_W1_EEPROM, /* one-wire EEPROMs */
UCLASS_WDT, /* Watchdog Timer driver */
UCLASS_FG, /* Fuel gauge */
UCLASS_CHARGE_DISPLAY, /* Charge display */
UCLASS_MCU, /* MCU device */
UCLASS_COUNT,
UCLASS_INVALID = -1,
};

23
include/mcu/mcu-uclass.h Executable file
View File

@@ -0,0 +1,23 @@
#ifndef __MCU_H
#define __MCU_H
struct mcu_ops {
int (*shutdown)(struct udevice *dev);
int (*poweron)(struct udevice *dev);
};
/**
* mcu_shutdown() - power off supplies
*
* @return 0 on success or negative value of errno.
*/
int mcu_shutdown(void);
/**
* mcu_poweron() - power on supplies
*
* @return 0 on success or negative value of errno.
*/
int mcu_poweron(void);
#endif

View File

@@ -0,0 +1,33 @@
/*
* (C) Copyright 2017 Rockchip Electronics Co., Ltd
*
* SPDX-License-Identifier: GPL-2.0+
*/
#ifndef _CHARGE_ANIMATION_H_
#define _CHARGE_ANIMATION_H_
struct regulator_mem {
struct udevice *dev;
bool enable;
};
struct charge_animation_pdata {
int android_charge; /* android charge, 1: enable, 0: disable */
int uboot_charge; /* u-boot charge, 1: enable, 0: disable */
int auto_exit_charge; /* energy enough auto exit uboot charging*/
int exit_charge_voltage;/* lowest voltage allowed to exit charging */
int exit_charge_level; /* lowest soc level allowed to exit charging */
int low_power_voltage; /* below this voltage, force system into charge mode anyway */
int screen_on_voltage; /* lowest voltage allowed to turn on screen */
int system_suspend; /* enter ATF system suspend, 1: enable, 0: disable */
int auto_wakeup_interval;/* timeout seconds to auto wakeup system */
int auto_wakeup_screen_invert;/* auto wakeup system, 1: enable, 0: disable */
int auto_off_screen_interval;/* timeout seconds to auto turn off screen */
struct regulator_mem *regulators_mem; /* assigned regulator suspend state */
};
#endif

17
include/power/charge_display.h Executable file
View File

@@ -0,0 +1,17 @@
/*
* (C) Copyright 2017 Rockchip Electronics Co., Ltd
*
* SPDX-License-Identifier: GPL-2.0+
*/
#ifndef _CHARGE_DISPLAY_H_
#define _CHARGE_DISPLAY_H_
struct dm_charge_display_ops {
int (*show)(struct udevice *dev);
};
int charge_display(void);
int charge_display_show(struct udevice *dev);
#endif

46
include/power/fuel_gauge.h Executable file
View File

@@ -0,0 +1,46 @@
/*
* (C) Copyright 2017 Rockchip Electronics Co., Ltd
*
* SPDX-License-Identifier: GPL-2.0+
*/
#ifndef _FUEL_GAUGE_H_
#define _FUEL_GAUGE_H_
#ifndef BIT
#define BIT(nr) (1 << (nr))
#endif
/* Capability */
#define FG_CAP_FUEL_GAUGE BIT(0)
#define FG_CAP_CHARGER BIT(1)
struct dm_fuel_gauge_ops {
int (*capability)(struct udevice *dev);
int (*bat_is_exist)(struct udevice *dev);
int (*get_soc)(struct udevice *dev);
int (*get_voltage)(struct udevice *dev);
int (*get_current)(struct udevice *dev);
int (*get_temperature)(struct udevice *dev, int *temp);
bool (*get_chrg_online)(struct udevice *dev);
int (*set_charger_voltage)(struct udevice *dev, int uV);
int (*set_charger_enable)(struct udevice *dev);
int (*set_charger_disable)(struct udevice *dev);
int (*set_iprechg_current)(struct udevice *dev, int iprechrg_uA);
int (*set_charger_current)(struct udevice *dev, int ichrg_uA);
};
int fuel_gauge_capability(struct udevice *dev);
int fuel_gauge_bat_is_exist(struct udevice *dev);
int fuel_gauge_update_get_soc(struct udevice *dev);
int fuel_gauge_get_voltage(struct udevice *dev);
int fuel_gauge_get_current(struct udevice *dev);
bool fuel_gauge_get_chrg_online(struct udevice *dev);
int fuel_gauge_get_temperature(struct udevice *dev, int *temp);
int charger_set_charger_voltage(struct udevice *dev, int uV);
int charger_set_iprechg_current(struct udevice *dev, int iprechrg_uA);
int charger_set_current(struct udevice *dev, int ichrg_uA);
int charger_set_enable(struct udevice *dev);
int charger_set_disable(struct udevice *dev);
#endif