power: battery/charger: move battery/charger drivers to power/supply
Change-Id: I70092715368a9d5c7241258a97dc51e55659499b Signed-off-by: Shengfei Xu <xsf@rock-chips.com> Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
This commit is contained in:
@@ -230,6 +230,8 @@ static const struct mfd_cell rk816s[] = {
|
||||
static const struct mfd_cell rk817s[] = {
|
||||
{ .name = "rk808-clkout",},
|
||||
{ .name = "rk808-regulator",},
|
||||
{ .name = "rk817-battery", .of_compatible = "rk817,battery", },
|
||||
{ .name = "rk817-charger", .of_compatible = "rk817,charger", },
|
||||
{
|
||||
.name = "rk805-pwrkey",
|
||||
.num_resources = ARRAY_SIZE(rk817_pwrkey_resources),
|
||||
@@ -249,6 +251,8 @@ static const struct mfd_cell rk817s[] = {
|
||||
static const struct mfd_cell rk818s[] = {
|
||||
{ .name = "rk808-clkout", },
|
||||
{ .name = "rk808-regulator", },
|
||||
{ .name = "rk818-battery", .of_compatible = "rk818-battery", },
|
||||
{ .name = "rk818-charger", },
|
||||
{
|
||||
.name = "rk808-rtc",
|
||||
.num_resources = ARRAY_SIZE(rtc_resources),
|
||||
|
||||
@@ -629,6 +629,12 @@ config CHARGER_BQ2515X
|
||||
rail, ADC for battery and system monitoring, and push-button
|
||||
controller.
|
||||
|
||||
config CHARGER_BQ25700
|
||||
tristate "TI BQ25700 battery charger driver"
|
||||
depends on REGMAP_I2C
|
||||
help
|
||||
Say Y to enable support for the TI BQ25700 battery charger.
|
||||
|
||||
config CHARGER_BQ25890
|
||||
tristate "TI BQ25890 battery charger driver"
|
||||
depends on I2C
|
||||
@@ -775,4 +781,41 @@ config RN5T618_POWER
|
||||
This driver can also be built as a module. If so, the module will be
|
||||
called rn5t618_power.
|
||||
|
||||
config BATTERY_RK816
|
||||
tristate "RK816 Battery driver"
|
||||
depends on MFD_RK808
|
||||
help
|
||||
If you say yes here you will get support for the battery of RK816 PMIC.
|
||||
This driver can give support for Rk816 Battery Charge Interface.
|
||||
|
||||
config BATTERY_RK817
|
||||
tristate "RK817 Battery driver"
|
||||
depends on MFD_RK808
|
||||
help
|
||||
If you say yes here you will get support for the battery of RK817 PMIC.
|
||||
This driver can give support for Rk817 Battery Interface.
|
||||
|
||||
config CHARGER_RK817
|
||||
tristate "RK817 Charger driver"
|
||||
depends on MFD_RK808
|
||||
help
|
||||
If you say yes here you will get support for the charger of RK817 PMIC.
|
||||
This driver can give support for Rk817 Charger Interface.
|
||||
|
||||
config BATTERY_RK818
|
||||
tristate "RK818 Battery driver"
|
||||
depends on MFD_RK808
|
||||
default n
|
||||
help
|
||||
If you say yes here you will get support for the battery of RK818 PMIC.
|
||||
This driver can give support for Rk818 Battery Charge Interface.
|
||||
|
||||
config CHARGER_RK818
|
||||
tristate "RK818 Charger driver"
|
||||
depends on MFD_RK808
|
||||
default n
|
||||
help
|
||||
If you say yes here you will get support for the charger of RK818 PMIC.
|
||||
This driver can give support for Rk818 Charger Interface.
|
||||
|
||||
endif # POWER_SUPPLY
|
||||
|
||||
@@ -83,6 +83,7 @@ obj-$(CONFIG_CHARGER_BQ24190) += bq24190_charger.o
|
||||
obj-$(CONFIG_CHARGER_BQ24257) += bq24257_charger.o
|
||||
obj-$(CONFIG_CHARGER_BQ24735) += bq24735-charger.o
|
||||
obj-$(CONFIG_CHARGER_BQ2515X) += bq2515x_charger.o
|
||||
obj-$(CONFIG_CHARGER_BQ25700) += bq25700_charger.o
|
||||
obj-$(CONFIG_CHARGER_BQ25890) += bq25890_charger.o
|
||||
obj-$(CONFIG_CHARGER_BQ25980) += bq25980_charger.o
|
||||
obj-$(CONFIG_CHARGER_SMB347) += smb347-charger.o
|
||||
@@ -98,3 +99,9 @@ obj-$(CONFIG_CHARGER_BD70528) += bd70528-charger.o
|
||||
obj-$(CONFIG_CHARGER_BD99954) += bd99954-charger.o
|
||||
obj-$(CONFIG_CHARGER_WILCO) += wilco-charger.o
|
||||
obj-$(CONFIG_RN5T618_POWER) += rn5t618_power.o
|
||||
obj-$(CONFIG_BATTERY_CW2015) += cw2015_battery.o
|
||||
obj-$(CONFIG_BATTERY_RK816) += rk816_battery.o
|
||||
obj-$(CONFIG_BATTERY_RK817) += rk817_battery.o
|
||||
obj-$(CONFIG_CHARGER_RK817) += rk817_charger.o
|
||||
obj-$(CONFIG_BATTERY_RK818) += rk818_battery.o
|
||||
obj-$(CONFIG_CHARGER_RK818) += rk818_charger.o
|
||||
|
||||
@@ -172,7 +172,7 @@ struct rk816_battery {
|
||||
struct wake_lock wake_lock;
|
||||
struct notifier_block fb_nb;
|
||||
struct timer_list caltimer;
|
||||
time_t rtc_base;
|
||||
time64_t rtc_base;
|
||||
struct iio_channel *iio_chan;
|
||||
struct notifier_block cable_cg_nb;
|
||||
struct notifier_block cable_host_nb;
|
||||
@@ -303,9 +303,9 @@ static struct led_ops *rk816_led_ops;
|
||||
|
||||
static u64 get_boot_sec(void)
|
||||
{
|
||||
struct timespec ts;
|
||||
struct timespec64 ts;
|
||||
|
||||
get_monotonic_boottime(&ts);
|
||||
ktime_get_boottime_ts64(&ts);
|
||||
|
||||
return ts.tv_sec;
|
||||
}
|
||||
@@ -1873,15 +1873,13 @@ static int rk816_bat_fb_notifier(struct notifier_block *nb,
|
||||
struct rk816_battery *di;
|
||||
struct fb_event *evdata = data;
|
||||
|
||||
if (event != FB_EVENT_BLANK)
|
||||
return NOTIFY_DONE;
|
||||
|
||||
di = container_of(nb, struct rk816_battery, fb_nb);
|
||||
di->fb_blank = *(int *)evdata->data;
|
||||
|
||||
if (event == FB_EVENT_BLANK || event == FB_EARLY_EVENT_BLANK ||
|
||||
event == FB_R_EARLY_EVENT_BLANK)
|
||||
di->fb_blank = *(int *)evdata->data;
|
||||
else
|
||||
di->fb_blank = 1;
|
||||
|
||||
return 0;
|
||||
return NOTIFY_OK;
|
||||
}
|
||||
|
||||
static int rk816_bat_register_fb_notify(struct rk816_battery *di)
|
||||
@@ -4352,13 +4350,11 @@ static int rk816_bat_init_charger(struct rk816_battery *di)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static time_t rk816_get_rtc_sec(void)
|
||||
static time64_t rk816_get_rtc_sec(void)
|
||||
{
|
||||
int err;
|
||||
struct rtc_time tm;
|
||||
struct timespec tv = { .tv_nsec = NSEC_PER_SEC >> 1, };
|
||||
struct rtc_device *rtc = rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE);
|
||||
time_t sec;
|
||||
|
||||
err = rtc_read_time(rtc, &tm);
|
||||
if (err) {
|
||||
@@ -4372,10 +4368,7 @@ static time_t rk816_get_rtc_sec(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
rtc_tm_to_time(&tm, &tv.tv_sec);
|
||||
sec = tv.tv_sec;
|
||||
|
||||
return sec;
|
||||
return rtc_tm_to_time64(&tm);
|
||||
}
|
||||
|
||||
static int rk816_bat_rtc_sleep_sec(struct rk816_battery *di)
|
||||
|
||||
@@ -560,7 +560,7 @@ struct rk817_battery_device {
|
||||
int zero_batocv_to_cap;
|
||||
int zero_xsoc;
|
||||
unsigned long finish_base;
|
||||
time_t rtc_base;
|
||||
time64_t rtc_base;
|
||||
int sm_remain_cap;
|
||||
int sm_linek;
|
||||
int sm_chrg_dsoc;
|
||||
@@ -631,9 +631,9 @@ static void rk817_bat_resume_work(struct work_struct *work);
|
||||
|
||||
static u64 get_boot_sec(void)
|
||||
{
|
||||
struct timespec ts;
|
||||
struct timespec64 ts;
|
||||
|
||||
get_monotonic_boottime(&ts);
|
||||
ktime_get_boottime_ts64(&ts);
|
||||
|
||||
return ts.tv_sec;
|
||||
}
|
||||
@@ -3079,13 +3079,11 @@ static void rk817_battery_shutdown(struct platform_device *dev)
|
||||
{
|
||||
}
|
||||
|
||||
static time_t rk817_get_rtc_sec(void)
|
||||
static time64_t rk817_get_rtc_sec(void)
|
||||
{
|
||||
int err;
|
||||
struct rtc_time tm;
|
||||
struct timespec tv = { .tv_nsec = NSEC_PER_SEC >> 1, };
|
||||
struct rtc_device *rtc = rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE);
|
||||
time_t sec;
|
||||
|
||||
err = rtc_read_time(rtc, &tm);
|
||||
if (err) {
|
||||
@@ -3099,10 +3097,7 @@ static time_t rk817_get_rtc_sec(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
rtc_tm_to_time(&tm, &tv.tv_sec);
|
||||
sec = tv.tv_sec;
|
||||
|
||||
return sec;
|
||||
return rtc_tm_to_time64(&tm);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
|
||||
@@ -170,7 +170,7 @@ struct rk818_battery {
|
||||
struct wake_lock wake_lock;
|
||||
struct notifier_block fb_nb;
|
||||
struct timer_list caltimer;
|
||||
time_t rtc_base;
|
||||
time64_t rtc_base;
|
||||
int bat_res;
|
||||
int chrg_status;
|
||||
bool is_initialized;
|
||||
@@ -262,9 +262,9 @@ struct rk818_battery {
|
||||
|
||||
static u64 get_boot_sec(void)
|
||||
{
|
||||
struct timespec ts;
|
||||
struct timespec64 ts;
|
||||
|
||||
get_monotonic_boottime(&ts);
|
||||
ktime_get_boottime_ts64(&ts);
|
||||
|
||||
return ts.tv_sec;
|
||||
}
|
||||
@@ -1206,13 +1206,13 @@ static int rk818_bat_fb_notifier(struct notifier_block *nb,
|
||||
struct rk818_battery *di;
|
||||
struct fb_event *evdata = data;
|
||||
|
||||
if (event != FB_EARLY_EVENT_BLANK && event != FB_EVENT_BLANK)
|
||||
return NOTIFY_OK;
|
||||
if (event != FB_EVENT_BLANK)
|
||||
return NOTIFY_DONE;
|
||||
|
||||
di = container_of(nb, struct rk818_battery, fb_nb);
|
||||
di->fb_blank = *(int *)evdata->data;
|
||||
|
||||
return 0;
|
||||
return NOTIFY_OK;
|
||||
}
|
||||
|
||||
static int rk818_bat_register_fb_notify(struct rk818_battery *di)
|
||||
@@ -3127,13 +3127,11 @@ static void rk818_bat_init_info(struct rk818_battery *di)
|
||||
SAMPLE_RES_DIV1 : SAMPLE_RES_DIV2;
|
||||
}
|
||||
|
||||
static time_t rk818_get_rtc_sec(void)
|
||||
static time64_t rk818_get_rtc_sec(void)
|
||||
{
|
||||
int err;
|
||||
struct rtc_time tm;
|
||||
struct timespec tv = { .tv_nsec = NSEC_PER_SEC >> 1, };
|
||||
struct rtc_device *rtc = rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE);
|
||||
time_t sec;
|
||||
|
||||
err = rtc_read_time(rtc, &tm);
|
||||
if (err) {
|
||||
@@ -3147,10 +3145,7 @@ static time_t rk818_get_rtc_sec(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
rtc_tm_to_time(&tm, &tv.tv_sec);
|
||||
sec = tv.tv_sec;
|
||||
|
||||
return sec;
|
||||
return rtc_tm_to_time64(&tm);
|
||||
}
|
||||
|
||||
static int rk818_bat_rtc_sleep_sec(struct rk818_battery *di)
|
||||
|
||||
@@ -266,9 +266,9 @@ static int rk818_cg_get_ts2_voltage(struct rk818_charger *cg)
|
||||
|
||||
static u64 get_boot_sec(void)
|
||||
{
|
||||
struct timespec ts;
|
||||
struct timespec64 ts;
|
||||
|
||||
get_monotonic_boottime(&ts);
|
||||
ktime_get_boottime_ts64(&ts);
|
||||
|
||||
return ts.tv_sec;
|
||||
}
|
||||
|
||||
@@ -367,6 +367,8 @@ enum rk818_reg {
|
||||
RK818_ID_OTG_SWITCH,
|
||||
};
|
||||
|
||||
#define RK818_VB_MON_REG 0x21
|
||||
#define RK818_THERMAL_REG 0x22
|
||||
#define RK818_DCDC_EN_REG 0x23
|
||||
#define RK818_LDO_EN_REG 0x24
|
||||
#define RK818_SLEEP_SET_OFF_REG1 0x25
|
||||
@@ -419,6 +421,7 @@ enum rk818_reg {
|
||||
#define RK818_BOOST_LDO9_SLP_VSEL_REG 0x55
|
||||
#define RK818_BOOST_CTRL_REG 0x56
|
||||
#define RK818_DCDC_ILMAX 0x90
|
||||
#define RK818_CHRG_COMP_REG 0x9a
|
||||
#define RK818_SUP_STS_REG 0xa0
|
||||
#define RK818_USB_CTRL_REG 0xa1
|
||||
#define RK818_CHRG_CTRL_REG1 0xa3
|
||||
@@ -495,6 +498,7 @@ enum rk818_reg {
|
||||
#define RK818_CALC_REST_REGH 0xf0
|
||||
#define RK818_CALC_REST_REGL 0xf1
|
||||
#define RK818_SAVE_DATA19 0xf2
|
||||
#define RK818_NUM_REGULATOR 17
|
||||
|
||||
#define RK818_H5V_EN BIT(0)
|
||||
#define RK818_REF_RDY_CTRL BIT(1)
|
||||
|
||||
Reference in New Issue
Block a user