Synchronize codes for OnePlus 8T Oxygen OS 11.0.8.12.KB05AA and OnePlus 8 Oxygen OS 11.0.6.6.IN21AA and OnePlus 8 Pro Oxygen OS 11.0.6.6.IN11AA
1. Optimize charger experience. Change-Id: I261cfc70b7f5f6c19f548035ff2a766cb1683f01
This commit is contained in:
parent
65c6ea8df2
commit
01464e1133
@ -62,9 +62,12 @@
|
||||
|
||||
/* fod parameter*/
|
||||
op,fastchg-fod-enable;
|
||||
op,fastchg-match-q = /bits/ 8 <0x56>;
|
||||
op,fastchg-fod-parm = /bits/ 8 <0xac 0x32 0xac 0x28 0xa0 0xba
|
||||
op,fastchg-match-q-new = /bits/ 8 <0x56>;
|
||||
op,fastchg-match-q = /bits/ 8 <0x44>;
|
||||
op,fastchg-fod-parm-new = /bits/ 8 <0xac 0x32 0xac 0x28 0xa0 0xba
|
||||
0x9a 0xd3 0x9a 0xce 0x9f 0xf6>;
|
||||
op,fastchg-fod-parm = /bits/ 8 <0xac 0x32 0xac 0x28 0xa0 0x1e
|
||||
0x9a 0x37 0x9a 0x32 0x9f 0xc4>;
|
||||
op,fastchg-fod-parm-startup = /bits/ 8 <0xac 0x7f 0xac 0x28 0xa0 0x1e
|
||||
0x9a 0x37 0x9a 0x32 0x9f 0xc4>;
|
||||
|
||||
|
@ -3281,13 +3281,15 @@ static int fastrpc_internal_munmap(struct fastrpc_file *fl,
|
||||
mutex_unlock(&fl->map_mutex);
|
||||
if (err)
|
||||
goto bail;
|
||||
VERIFY(err, !fastrpc_munmap_on_dsp(fl, map->raddr,
|
||||
map->phys, map->size, map->flags));
|
||||
if (err)
|
||||
goto bail;
|
||||
mutex_lock(&fl->map_mutex);
|
||||
fastrpc_mmap_free(map, 0);
|
||||
mutex_unlock(&fl->map_mutex);
|
||||
if (map) {
|
||||
VERIFY(err, !fastrpc_munmap_on_dsp(fl, map->raddr,
|
||||
map->phys, map->size, map->flags));
|
||||
if (err)
|
||||
goto bail;
|
||||
mutex_lock(&fl->map_mutex);
|
||||
fastrpc_mmap_free(map, 0);
|
||||
mutex_unlock(&fl->map_mutex);
|
||||
}
|
||||
bail:
|
||||
if (err && map) {
|
||||
mutex_lock(&fl->map_mutex);
|
||||
|
@ -50,6 +50,8 @@ struct external_battery_gauge {
|
||||
bool (*is_usb_switch_on)(void);
|
||||
int (*get_battery_status)(void);
|
||||
int (*get_batt_remaining_capacity)(void);
|
||||
int (*get_batt_full_available_capacity)(void);
|
||||
int (*get_batt_full_available_capacity_filtered)(void);
|
||||
int (*get_batt_full_chg_capacity)(void);
|
||||
int (*get_batt_health)(void);
|
||||
int (*get_batt_bq_soc)(void);
|
||||
|
@ -886,6 +886,64 @@ static int bq27541_remaining_capacity(struct bq27541_device_info *di)
|
||||
di->remain_pre = cap;
|
||||
return cap;
|
||||
}
|
||||
|
||||
static int get_batt_full_available_capacity(struct bq27541_device_info *di)
|
||||
{
|
||||
int ret;
|
||||
int cap = 0;
|
||||
|
||||
if (atomic_read(&di->suspended) == 1)
|
||||
return di->full_available_capacity_pre;
|
||||
if (di->allow_reading || panel_flag1) {
|
||||
#ifdef CONFIG_GAUGE_BQ27411
|
||||
ret = bq27541_read(BQ27411_REG_FAC,
|
||||
&cap, 0, di);
|
||||
#else
|
||||
ret = bq27541_read(BQ27541_REG_RM, &cap, 0, di);
|
||||
#endif
|
||||
if (ret) {
|
||||
pr_err("error reading full_available_capacity.\n");
|
||||
return ret;
|
||||
}
|
||||
if (panel_flag1)
|
||||
panel_flag1 = 0;
|
||||
} else {
|
||||
return di->full_available_capacity_pre;
|
||||
}
|
||||
|
||||
di->full_available_capacity_pre = cap;
|
||||
return cap;
|
||||
}
|
||||
|
||||
|
||||
static int get_batt_full_available_capacity_filtered(struct bq27541_device_info *di)
|
||||
{
|
||||
int ret;
|
||||
int cap = 0;
|
||||
|
||||
if (atomic_read(&di->suspended) == 1)
|
||||
return di->full_available_capacity_filtered_pre;
|
||||
if (di->allow_reading || panel_flag1) {
|
||||
#ifdef CONFIG_GAUGE_BQ27411
|
||||
ret = bq27541_read(BQ27411_REG_FCCF,
|
||||
&cap, 0, di);
|
||||
#else
|
||||
ret = bq27541_read(BQ27541_REG_RM, &cap, 0, di);
|
||||
#endif
|
||||
if (ret) {
|
||||
pr_err("error reading full_available_capacity_filtered_pre.\n");
|
||||
return ret;
|
||||
}
|
||||
if (panel_flag1)
|
||||
panel_flag1 = 0;
|
||||
} else {
|
||||
return di->full_available_capacity_filtered_pre;
|
||||
}
|
||||
|
||||
di->full_available_capacity_filtered_pre = cap;
|
||||
return cap;
|
||||
}
|
||||
|
||||
static int bq27541_full_chg_capacity(struct bq27541_device_info *di)
|
||||
{
|
||||
int ret;
|
||||
@ -897,8 +955,12 @@ static int bq27541_full_chg_capacity(struct bq27541_device_info *di)
|
||||
|
||||
if (di->allow_reading || panel_flag2) {
|
||||
#ifdef CONFIG_GAUGE_BQ27411
|
||||
ret = bq27541_read(di->cmd_addr.reg_fcc,
|
||||
&cap, 0, di);
|
||||
if (di->batt_bq28z610)
|
||||
ret = bq27541_read(BQ28Z610_REG_CHARGE_FULL_CAPACITY,
|
||||
&cap, 0, di);
|
||||
else
|
||||
ret = bq27541_read(di->cmd_addr.reg_fcc,
|
||||
&cap, 0, di);
|
||||
#else
|
||||
ret = bq27541_read(BQ27541_REG_FCC, &cap, 0, di);
|
||||
#endif
|
||||
@ -923,8 +985,12 @@ static int bq27541_batt_health(struct bq27541_device_info *di)
|
||||
int health = 0;
|
||||
|
||||
if (di->allow_reading) {
|
||||
ret = bq27541_read(di->cmd_addr.reg_helth,
|
||||
&health, 0, di);
|
||||
if (di->batt_bq28z610)
|
||||
ret = bq27541_read(BQ28Z610_REG_BATTERY_HEALTH,
|
||||
&health, 0, di);
|
||||
else
|
||||
ret = bq27541_read(di->cmd_addr.reg_helth,
|
||||
&health, 0, di);
|
||||
if (ret) {
|
||||
pr_err("error reading health\n");
|
||||
return ret;
|
||||
@ -948,6 +1014,16 @@ static int bq27541_get_batt_remaining_capacity(void)
|
||||
return bq27541_remaining_capacity(bq27541_di);
|
||||
}
|
||||
|
||||
static int bq27541_get_batt_full_available_capacity(void)
|
||||
{
|
||||
return get_batt_full_available_capacity(bq27541_di);
|
||||
}
|
||||
|
||||
static int bq27541_get_batt_full_available_capacity_filtered(void)
|
||||
{
|
||||
return get_batt_full_available_capacity_filtered(bq27541_di);
|
||||
}
|
||||
|
||||
static int bq27541_get_batt_full_chg_capacity(void)
|
||||
{
|
||||
return bq27541_full_chg_capacity(bq27541_di);
|
||||
@ -1114,6 +1190,10 @@ static struct external_battery_gauge bq27541_batt_gauge = {
|
||||
.is_battery_id_valid = bq27541_is_battery_id_valid,
|
||||
.get_batt_remaining_capacity
|
||||
= bq27541_get_batt_remaining_capacity,
|
||||
.get_batt_full_available_capacity
|
||||
= bq27541_get_batt_full_available_capacity,
|
||||
.get_batt_full_available_capacity_filtered
|
||||
= bq27541_get_batt_full_available_capacity_filtered,
|
||||
.get_batt_full_chg_capacity
|
||||
= bq27541_get_batt_full_chg_capacity,
|
||||
.get_batt_health = bq27541_get_batt_health,
|
||||
|
@ -51,11 +51,13 @@
|
||||
#ifdef CONFIG_GAUGE_BQ27411
|
||||
#define BQ27411_REG_TEMP 0x02
|
||||
#define BQ27411_REG_VOLT 0x04
|
||||
#define BQ27411_REG_RM 0x0A
|
||||
#define BQ27411_REG_RM 0x0C
|
||||
#define BQ27411_REG_FAC 0x0A
|
||||
#define BQ27411_REG_AI 0x10
|
||||
#define BQ27411_REG_SOC 0x1c
|
||||
#define BQ27411_REG_HEALTH 0x20
|
||||
#define BQ27411_REG_FCC 0x2E
|
||||
#define BQ27411_REG_FCC 0xE
|
||||
#define BQ27411_REG_FCCF 0x2E
|
||||
|
||||
#define CONTROL_CMD 0x00
|
||||
#define CONTROL_STATUS 0x00
|
||||
@ -126,6 +128,8 @@
|
||||
#define BQ28Z610_BALANCING_CONFIG_BIT BIT(28)
|
||||
|
||||
#define BQ28Z610_REG_TIME_TO_FULL 0x18
|
||||
#define BQ28Z610_REG_CHARGE_FULL_CAPACITY 0x12
|
||||
#define BQ28Z610_REG_BATTERY_HEALTH 0x2e
|
||||
#endif
|
||||
|
||||
/* BQ27541 Control subcommands */
|
||||
@ -229,6 +233,8 @@ struct bq27541_device_info {
|
||||
int current_pre;
|
||||
int cap_pre;
|
||||
int remain_pre;
|
||||
int full_available_capacity_filtered_pre;
|
||||
int full_available_capacity_pre;
|
||||
int health_pre;
|
||||
unsigned long rtc_resume_time;
|
||||
unsigned long rtc_suspend_time;
|
||||
|
@ -524,6 +524,13 @@ static int wireless_chg_init(struct op_chg_chip *chip)
|
||||
|
||||
chg_param->fastchg_fod_enable = of_property_read_bool(node, "op,fastchg-fod-enable");
|
||||
if (chg_param->fastchg_fod_enable) {
|
||||
rc = of_property_read_u8(node, "op,fastchg-match-q-new",
|
||||
&chg_param->fastchg_match_q_new);
|
||||
if (rc < 0) {
|
||||
pr_err("op,fastchg-match-q-new reading failed, rc=%d\n", rc);
|
||||
chg_param->fastchg_match_q_new = 0x56;
|
||||
}
|
||||
|
||||
rc = of_property_read_u8(node, "op,fastchg-match-q",
|
||||
&chg_param->fastchg_match_q);
|
||||
if (rc < 0) {
|
||||
@ -531,6 +538,13 @@ static int wireless_chg_init(struct op_chg_chip *chip)
|
||||
chg_param->fastchg_match_q = 0x44;
|
||||
}
|
||||
|
||||
rc = of_property_read_u8_array(node, "op,fastchg-fod-parm-new",
|
||||
(u8 *)&chg_param->fastchg_fod_parm_new, FOD_PARM_LENGTH);
|
||||
if (rc < 0) {
|
||||
chg_param->fastchg_fod_enable = false;
|
||||
pr_err("Read op,fastchg-fod-parm-new failed, rc=%d\n", rc);
|
||||
}
|
||||
|
||||
rc = of_property_read_u8_array(node, "op,fastchg-fod-parm",
|
||||
(u8 *)&chg_param->fastchg_fod_parm, FOD_PARM_LENGTH);
|
||||
if (rc < 0) {
|
||||
@ -797,6 +811,7 @@ static void wlchg_reset_variables(struct op_chg_chip *chip)
|
||||
chg_status->startup_fod_parm = false;
|
||||
chg_status->adapter_type = ADAPTER_TYPE_UNKNOWN;
|
||||
chg_status->charge_type = WPC_CHARGE_TYPE_DEFAULT;
|
||||
chg_status->adapter_id = 0;
|
||||
chg_status->send_msg_timer = jiffies;
|
||||
chg_status->cep_ok_wait_timeout = jiffies;
|
||||
chg_status->fastchg_retry_timer = jiffies;
|
||||
@ -1612,16 +1627,22 @@ static long wlchg_dev_ioctl(struct file *filp, unsigned int cmd,
|
||||
|
||||
switch (cmd) {
|
||||
case WLCHG_NOTIFY_ADAPTER_TYPE:
|
||||
chg_status->adapter_type = arg;
|
||||
chg_status->adapter_type = arg & WPC_ADAPTER_TYPE_MASK;
|
||||
chg_status->adapter_id = (arg & WPC_ADAPTER_ID_MASK) >> 3;
|
||||
if (chip->wireless_psy != NULL)
|
||||
power_supply_changed(chip->wireless_psy);
|
||||
if (chg_status->adapter_type == ADAPTER_TYPE_FASTCHAGE_PD_65W)
|
||||
chg_status->adapter_type = ADAPTER_TYPE_FASTCHAGE_WARP;
|
||||
if (chip->chg_param.fastchg_fod_enable &&
|
||||
(chg_status->adapter_type == ADAPTER_TYPE_FASTCHAGE_DASH ||
|
||||
chg_status->adapter_type == ADAPTER_TYPE_FASTCHAGE_WARP))
|
||||
wlchg_rx_set_match_q_parm(g_rx_chip, chip->chg_param.fastchg_match_q);
|
||||
chg_info("adapter type is %d\n", chg_status->adapter_type);
|
||||
chg_status->adapter_type == ADAPTER_TYPE_FASTCHAGE_WARP)) {
|
||||
if (chg_status->adapter_id == 0x00 || chg_status->adapter_id == 0x01)
|
||||
wlchg_rx_set_match_q_parm(g_rx_chip, chip->chg_param.fastchg_match_q);
|
||||
else
|
||||
wlchg_rx_set_match_q_parm(g_rx_chip, chip->chg_param.fastchg_match_q_new);
|
||||
}
|
||||
chg_info("adapter arg is 0x%02x, adapter type is %d, adapter id is %d\n",
|
||||
arg, chg_status->adapter_type, chg_status->adapter_id);
|
||||
break;
|
||||
case WLCHG_NOTIFY_ADAPTER_TYPE_ERR:
|
||||
chg_status->get_adapter_err = true;
|
||||
@ -1632,7 +1653,11 @@ static long wlchg_dev_ioctl(struct file *filp, unsigned int cmd,
|
||||
chg_info("charge type is %d\n", arg);
|
||||
if (chip->chg_param.fastchg_fod_enable &&
|
||||
chg_status->charge_type == WPC_CHARGE_TYPE_FAST) {
|
||||
wlchg_rx_set_fod_parm(g_rx_chip, chip->chg_param.fastchg_fod_parm);
|
||||
if (chg_status->adapter_id == 0x00 || chg_status->adapter_id == 0x01)
|
||||
wlchg_rx_set_fod_parm(g_rx_chip, chip->chg_param.fastchg_fod_parm);
|
||||
else
|
||||
wlchg_rx_set_fod_parm(g_rx_chip, chip->chg_param.fastchg_fod_parm_new);
|
||||
|
||||
chg_status->startup_fod_parm = false;
|
||||
chg_info("write fastchg fod parm\n");
|
||||
}
|
||||
@ -2959,7 +2984,10 @@ static int fastchg_startup_process(struct op_chg_chip *chip)
|
||||
bq2597x_check_charge_enabled(exchgpump_bq, &cp2_is_enabled);
|
||||
if (cp2_is_enabled) {
|
||||
if (chip->chg_param.fastchg_fod_enable) {
|
||||
wlchg_rx_set_fod_parm(g_rx_chip, chip->chg_param.fastchg_fod_parm);
|
||||
if (chg_status->adapter_id == 0x00 || chg_status->adapter_id == 0x01)
|
||||
wlchg_rx_set_fod_parm(g_rx_chip, chip->chg_param.fastchg_fod_parm);
|
||||
else
|
||||
wlchg_rx_set_fod_parm(g_rx_chip, chip->chg_param.fastchg_fod_parm_new);
|
||||
chg_status->startup_fod_parm = false;
|
||||
chg_info("write fastchg fod parm\n");
|
||||
}
|
||||
@ -3140,7 +3168,10 @@ static int wlchg_charge_status_process(struct op_chg_chip *chip)
|
||||
(chg_status->charge_type == WPC_CHARGE_TYPE_FAST) &&
|
||||
chg_status->deviation_check_done) {
|
||||
if (chip->chg_param.fastchg_fod_enable && chg_status->startup_fod_parm) {
|
||||
wlchg_rx_set_fod_parm(g_rx_chip, chip->chg_param.fastchg_fod_parm);
|
||||
if (chg_status->adapter_id == 0x00 || chg_status->adapter_id == 0x01)
|
||||
wlchg_rx_set_fod_parm(g_rx_chip, chip->chg_param.fastchg_fod_parm);
|
||||
else
|
||||
wlchg_rx_set_fod_parm(g_rx_chip, chip->chg_param.fastchg_fod_parm_new);
|
||||
chg_status->startup_fod_parm = false;
|
||||
chg_info("write fastchg fod parm\n");
|
||||
}
|
||||
@ -3541,7 +3572,10 @@ freq_check_done:
|
||||
chg_err("<~WPC~> ..........WPC_CHG_STATUS_FAST_CHARGING_EXIT..........\n");
|
||||
if (chip->chg_param.fastchg_fod_enable && chg_status->startup_fod_parm &&
|
||||
chg_status->charge_type == WPC_CHARGE_TYPE_FAST) {
|
||||
wlchg_rx_set_fod_parm(g_rx_chip, chip->chg_param.fastchg_fod_parm);
|
||||
if (chg_status->adapter_id == 0x00 || chg_status->adapter_id == 0x01)
|
||||
wlchg_rx_set_fod_parm(g_rx_chip, chip->chg_param.fastchg_fod_parm);
|
||||
else
|
||||
wlchg_rx_set_fod_parm(g_rx_chip, chip->chg_param.fastchg_fod_parm_new);
|
||||
chg_status->startup_fod_parm = false;
|
||||
chg_info("write fastchg fod parm\n");
|
||||
}
|
||||
|
@ -139,6 +139,8 @@
|
||||
#define CHARGE_FULL_FAN_THREOD_HI 380
|
||||
|
||||
#define FASTCHG_CURR_ERR_MAX 5
|
||||
#define WPC_ADAPTER_TYPE_MASK 0x07
|
||||
#define WPC_ADAPTER_ID_MASK 0xF8
|
||||
|
||||
enum {
|
||||
WPC_CHG_STATUS_DEFAULT,
|
||||
@ -239,6 +241,7 @@ struct wpc_data {
|
||||
bool charge_done;
|
||||
int adapter_type;
|
||||
int charge_type;
|
||||
int adapter_id;
|
||||
int charge_voltage;
|
||||
int charge_current;
|
||||
enum WLCHG_TEMP_REGION_TYPE temp_region;
|
||||
@ -363,7 +366,9 @@ struct charge_param {
|
||||
int epp_curr_step[EPP_CURR_STEP_MAX];
|
||||
bool fastchg_fod_enable;
|
||||
unsigned char fastchg_match_q;
|
||||
unsigned char fastchg_match_q_new;
|
||||
unsigned char fastchg_fod_parm[FOD_PARM_LENGTH];
|
||||
unsigned char fastchg_fod_parm_new[FOD_PARM_LENGTH];
|
||||
unsigned char fastchg_fod_parm_startup[FOD_PARM_LENGTH];
|
||||
struct op_fastchg_ffc_step ffc_chg;
|
||||
};
|
||||
|
@ -344,6 +344,8 @@ static struct device_attribute power_supply_attrs[] = {
|
||||
POWER_SUPPLY_ATTR(charge_full_design),
|
||||
POWER_SUPPLY_ATTR(charge_empty_design),
|
||||
POWER_SUPPLY_ATTR(charge_full),
|
||||
POWER_SUPPLY_ATTR(full_available_capacity),
|
||||
POWER_SUPPLY_ATTR(full_charge_capacity_filtered),
|
||||
POWER_SUPPLY_ATTR(charge_empty),
|
||||
POWER_SUPPLY_ATTR(charge_now),
|
||||
POWER_SUPPLY_ATTR(charge_avg),
|
||||
|
@ -4608,6 +4608,28 @@ static int fg_psy_get_property(struct power_supply *psy,
|
||||
pval->intval = (int)temp;
|
||||
}
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_FULL_AVAILABLE_CAPACITY:
|
||||
if (!get_extern_fg_regist_done() && get_extern_bq_present())
|
||||
pval->intval = -EINVAL;
|
||||
else if (fg->use_external_fg && external_fg && external_fg->get_batt_full_available_capacity)
|
||||
pval->intval = external_fg->get_batt_full_available_capacity();
|
||||
else {
|
||||
rc = fg_gen4_get_learned_capacity(chip, &temp);
|
||||
if (!rc)
|
||||
pval->intval = (int)temp;
|
||||
}
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_CHARGE_FULL_CHARGE_CAPACITY_FILTERED:
|
||||
if (!get_extern_fg_regist_done() && get_extern_bq_present())
|
||||
pval->intval = -EINVAL;
|
||||
else if (fg->use_external_fg && external_fg && external_fg->get_batt_full_available_capacity_filtered)
|
||||
pval->intval = external_fg->get_batt_full_available_capacity_filtered();
|
||||
else {
|
||||
rc = fg_gen4_get_learned_capacity(chip, &temp);
|
||||
if (!rc)
|
||||
pval->intval = (int)temp;
|
||||
}
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_REMAINING_CAPACITY:
|
||||
if (!get_extern_fg_regist_done() && get_extern_bq_present())
|
||||
pval->intval = DEFALUT_BATT_TEMP;
|
||||
@ -4918,6 +4940,8 @@ static enum power_supply_property fg_psy_props[] = {
|
||||
POWER_SUPPLY_PROP_CHARGE_NOW_RAW,
|
||||
POWER_SUPPLY_PROP_CHARGE_NOW,
|
||||
POWER_SUPPLY_PROP_CHARGE_FULL,
|
||||
POWER_SUPPLY_PROP_FULL_AVAILABLE_CAPACITY,
|
||||
POWER_SUPPLY_PROP_CHARGE_FULL_CHARGE_CAPACITY_FILTERED,
|
||||
POWER_SUPPLY_PROP_CHARGE_COUNTER,
|
||||
POWER_SUPPLY_PROP_CHARGE_COUNTER_SHADOW,
|
||||
POWER_SUPPLY_PROP_CYCLE_COUNTS,
|
||||
|
@ -494,10 +494,10 @@ static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t
|
||||
if (session_of_pgrp(pgrp) != task_session(current))
|
||||
goto out_unlock;
|
||||
retval = 0;
|
||||
spin_lock_irq(&tty->ctrl_lock);
|
||||
spin_lock_irq(&real_tty->ctrl_lock);
|
||||
put_pid(real_tty->pgrp);
|
||||
real_tty->pgrp = get_pid(pgrp);
|
||||
spin_unlock_irq(&tty->ctrl_lock);
|
||||
spin_unlock_irq(&real_tty->ctrl_lock);
|
||||
out_unlock:
|
||||
rcu_read_unlock();
|
||||
return retval;
|
||||
|
@ -1463,10 +1463,8 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
|
||||
*/
|
||||
if (!for_part) {
|
||||
ret = devcgroup_inode_permission(bdev->bd_inode, perm);
|
||||
if (ret != 0) {
|
||||
bdput(bdev);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
restart:
|
||||
@ -1535,8 +1533,10 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
|
||||
goto out_clear;
|
||||
BUG_ON(for_part);
|
||||
ret = __blkdev_get(whole, mode, 1);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
bdput(whole);
|
||||
goto out_clear;
|
||||
}
|
||||
bdev->bd_contains = whole;
|
||||
bdev->bd_part = disk_get_part(disk, partno);
|
||||
if (!(disk->flags & GENHD_FL_UP) ||
|
||||
@ -1586,7 +1586,6 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
|
||||
disk_unblock_events(disk);
|
||||
put_disk_and_module(disk);
|
||||
out:
|
||||
bdput(bdev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -1672,6 +1671,9 @@ int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder)
|
||||
bdput(whole);
|
||||
}
|
||||
|
||||
if (res)
|
||||
bdput(bdev);
|
||||
|
||||
return res;
|
||||
}
|
||||
EXPORT_SYMBOL(blkdev_get);
|
||||
|
@ -214,6 +214,8 @@ enum power_supply_property {
|
||||
POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
|
||||
POWER_SUPPLY_PROP_CHARGE_EMPTY_DESIGN,
|
||||
POWER_SUPPLY_PROP_CHARGE_FULL,
|
||||
POWER_SUPPLY_PROP_FULL_AVAILABLE_CAPACITY,
|
||||
POWER_SUPPLY_PROP_CHARGE_FULL_CHARGE_CAPACITY_FILTERED,
|
||||
POWER_SUPPLY_PROP_CHARGE_EMPTY,
|
||||
POWER_SUPPLY_PROP_CHARGE_NOW,
|
||||
POWER_SUPPLY_PROP_CHARGE_AVG,
|
||||
|
@ -2271,6 +2271,8 @@ void __split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
|
||||
spinlock_t *ptl;
|
||||
struct mm_struct *mm = vma->vm_mm;
|
||||
unsigned long haddr = address & HPAGE_PMD_MASK;
|
||||
bool was_locked = false;
|
||||
pmd_t _pmd;
|
||||
|
||||
mmu_notifier_invalidate_range_start(mm, haddr, haddr + HPAGE_PMD_SIZE);
|
||||
ptl = pmd_lock(mm, pmd);
|
||||
@ -2280,11 +2282,32 @@ void __split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
|
||||
* pmd against. Otherwise we can end up replacing wrong page.
|
||||
*/
|
||||
VM_BUG_ON(freeze && !page);
|
||||
if (page && page != pmd_page(*pmd))
|
||||
goto out;
|
||||
if (page) {
|
||||
VM_WARN_ON_ONCE(!PageLocked(page));
|
||||
was_locked = true;
|
||||
if (page != pmd_page(*pmd))
|
||||
goto out;
|
||||
}
|
||||
|
||||
repeat:
|
||||
if (pmd_trans_huge(*pmd)) {
|
||||
page = pmd_page(*pmd);
|
||||
if (!page) {
|
||||
page = pmd_page(*pmd);
|
||||
if (unlikely(!trylock_page(page))) {
|
||||
get_page(page);
|
||||
_pmd = *pmd;
|
||||
spin_unlock(ptl);
|
||||
lock_page(page);
|
||||
spin_lock(ptl);
|
||||
if (unlikely(!pmd_same(*pmd, _pmd))) {
|
||||
unlock_page(page);
|
||||
put_page(page);
|
||||
page = NULL;
|
||||
goto repeat;
|
||||
}
|
||||
put_page(page);
|
||||
}
|
||||
}
|
||||
if (PageMlocked(page))
|
||||
clear_page_mlock(page);
|
||||
} else if (!(pmd_devmap(*pmd) || is_pmd_migration_entry(*pmd)))
|
||||
@ -2292,6 +2315,8 @@ void __split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
|
||||
__split_huge_pmd_locked(vma, pmd, haddr, freeze);
|
||||
out:
|
||||
spin_unlock(ptl);
|
||||
if (!was_locked && page)
|
||||
unlock_page(page);
|
||||
/*
|
||||
* No need to double call mmu_notifier->invalidate_range() callback.
|
||||
* They are 3 cases to consider inside __split_huge_pmd_locked():
|
||||
|
@ -272,7 +272,10 @@ bool icmp_global_allow(void)
|
||||
}
|
||||
credit = min_t(u32, icmp_global.credit + incr, sysctl_icmp_msgs_burst);
|
||||
if (credit) {
|
||||
credit--;
|
||||
/* We want to use a credit of one in average, but need to randomize
|
||||
* it for security reasons.
|
||||
*/
|
||||
credit = max_t(int, credit - prandom_u32_max(3), 0);
|
||||
rc = true;
|
||||
}
|
||||
WRITE_ONCE(icmp_global.credit, credit);
|
||||
|
@ -20,3 +20,10 @@
|
||||
#4. Optimize network experience;
|
||||
#5. Optimize TP experience.
|
||||
***********************************************************************************************************************************
|
||||
|
||||
|
||||
***********************************************************************************************************************************
|
||||
#Synchronize codes for OnePlus 8T Oxygen OS 11.0.8.12.KB05AA and OnePlus 8 Oxygen OS 11.0.6.6.IN21AA and OnePlus 8 Pro Oxygen OS 11.0.6.6.IN11AA
|
||||
#================
|
||||
#1. Optimize charger experience;
|
||||
***********************************************************************************************************************************
|
Loading…
Reference in New Issue
Block a user