Snap for 7472464 from 7b27c71e08 to android12-5.10-keystone-qcom-release

Change-Id: I5174e8a3eaed4b41c47ee6bc82769edddae5a8fa
This commit is contained in:
Android Build Coastguard Worker
2021-06-18 20:00:58 +00:00
8 changed files with 68463 additions and 64630 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1453,6 +1453,7 @@
sdio_writel sdio_writel
sdio_writesb sdio_writesb
send_sig send_sig
send_sig_info
seq_hex_dump seq_hex_dump
seq_lseek seq_lseek
seq_open seq_open

View File

@@ -267,8 +267,8 @@ CONFIG_BT_HCIUART_BCM=y
CONFIG_BT_HCIUART_QCA=y CONFIG_BT_HCIUART_QCA=y
CONFIG_CFG80211=y CONFIG_CFG80211=y
CONFIG_NL80211_TESTMODE=y CONFIG_NL80211_TESTMODE=y
# CONFIG_CFG80211_DEFAULT_PS is not set CONFIG_CFG80211_CERTIFICATION_ONUS=y
# CONFIG_CFG80211_CRDA_SUPPORT is not set CONFIG_CFG80211_REG_CELLULAR_HINTS=y
CONFIG_MAC80211=y CONFIG_MAC80211=y
CONFIG_RFKILL=y CONFIG_RFKILL=y
CONFIG_PCI=y CONFIG_PCI=y

View File

@@ -244,6 +244,8 @@ CONFIG_BT_HCIUART_BCM=y
CONFIG_BT_HCIUART_QCA=y CONFIG_BT_HCIUART_QCA=y
CONFIG_CFG80211=y CONFIG_CFG80211=y
CONFIG_NL80211_TESTMODE=y CONFIG_NL80211_TESTMODE=y
CONFIG_CFG80211_CERTIFICATION_ONUS=y
CONFIG_CFG80211_REG_CELLULAR_HINTS=y
# CONFIG_CFG80211_DEFAULT_PS is not set # CONFIG_CFG80211_DEFAULT_PS is not set
# CONFIG_CFG80211_CRDA_SUPPORT is not set # CONFIG_CFG80211_CRDA_SUPPORT is not set
CONFIG_MAC80211=y CONFIG_MAC80211=y

View File

@@ -572,8 +572,10 @@ typec_register_altmode(struct device *parent,
int ret; int ret;
alt = kzalloc(sizeof(*alt), GFP_KERNEL); alt = kzalloc(sizeof(*alt), GFP_KERNEL);
if (!alt) if (!alt) {
altmode_id_remove(parent, id);
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
}
alt->adev.svid = desc->svid; alt->adev.svid = desc->svid;
alt->adev.mode = desc->mode; alt->adev.mode = desc->mode;

View File

@@ -22,8 +22,12 @@
#define PD_RETRY_COUNT_DEFAULT 3 #define PD_RETRY_COUNT_DEFAULT 3
#define PD_RETRY_COUNT_3_0_OR_HIGHER 2 #define PD_RETRY_COUNT_3_0_OR_HIGHER 2
#define AUTO_DISCHARGE_DEFAULT_THRESHOLD_MV 3500 #define AUTO_DISCHARGE_DEFAULT_THRESHOLD_MV 3500
#define AUTO_DISCHARGE_PD_HEADROOM_MV 850 #define VSINKPD_MIN_IR_DROP_MV 750
#define AUTO_DISCHARGE_PPS_HEADROOM_MV 1250 #define VSRC_NEW_MIN_PERCENT 95
#define VSRC_VALID_MIN_MV 500
#define VPPS_NEW_MIN_PERCENT 95
#define VPPS_VALID_MIN_MV 100
#define VSINKDISCONNECT_PD_MIN_PERCENT 90
#define tcpc_presenting_rd(reg, cc) \ #define tcpc_presenting_rd(reg, cc) \
(!(TCPC_ROLE_CTRL_DRP & (reg)) && \ (!(TCPC_ROLE_CTRL_DRP & (reg)) && \
@@ -364,11 +368,13 @@ static int tcpci_set_auto_vbus_discharge_threshold(struct tcpc_dev *dev, enum ty
threshold = AUTO_DISCHARGE_DEFAULT_THRESHOLD_MV; threshold = AUTO_DISCHARGE_DEFAULT_THRESHOLD_MV;
} else if (mode == TYPEC_PWR_MODE_PD) { } else if (mode == TYPEC_PWR_MODE_PD) {
if (pps_active) if (pps_active)
threshold = (95 * requested_vbus_voltage_mv / 100) - threshold = ((VPPS_NEW_MIN_PERCENT * requested_vbus_voltage_mv / 100) -
AUTO_DISCHARGE_PD_HEADROOM_MV; VSINKPD_MIN_IR_DROP_MV - VPPS_VALID_MIN_MV) *
VSINKDISCONNECT_PD_MIN_PERCENT / 100;
else else
threshold = (95 * requested_vbus_voltage_mv / 100) - threshold = ((VSRC_NEW_MIN_PERCENT * requested_vbus_voltage_mv / 100) -
AUTO_DISCHARGE_PPS_HEADROOM_MV; VSINKPD_MIN_IR_DROP_MV - VSRC_VALID_MIN_MV) *
VSINKDISCONNECT_PD_MIN_PERCENT / 100;
} else { } else {
/* 3.5V for non-pd sink */ /* 3.5V for non-pd sink */
threshold = AUTO_DISCHARGE_DEFAULT_THRESHOLD_MV; threshold = AUTO_DISCHARGE_DEFAULT_THRESHOLD_MV;

View File

@@ -2629,6 +2629,11 @@ static void tcpm_pd_ctrl_request(struct tcpm_port *port,
} else { } else {
next_state = SNK_WAIT_CAPABILITIES; next_state = SNK_WAIT_CAPABILITIES;
} }
/* Threshold was relaxed before sending Request. Restore it back. */
tcpm_set_auto_vbus_discharge_threshold(port, TYPEC_PWR_MODE_PD,
port->pps_data.active,
port->supply_voltage);
tcpm_set_state(port, next_state, 0); tcpm_set_state(port, next_state, 0);
break; break;
case SNK_NEGOTIATE_PPS_CAPABILITIES: case SNK_NEGOTIATE_PPS_CAPABILITIES:
@@ -2642,6 +2647,11 @@ static void tcpm_pd_ctrl_request(struct tcpm_port *port,
port->send_discover) port->send_discover)
port->vdm_sm_running = true; port->vdm_sm_running = true;
/* Threshold was relaxed before sending Request. Restore it back. */
tcpm_set_auto_vbus_discharge_threshold(port, TYPEC_PWR_MODE_PD,
port->pps_data.active,
port->supply_voltage);
tcpm_set_state(port, SNK_READY, 0); tcpm_set_state(port, SNK_READY, 0);
break; break;
case DR_SWAP_SEND: case DR_SWAP_SEND:
@@ -3361,6 +3371,12 @@ static int tcpm_pd_send_request(struct tcpm_port *port)
if (ret < 0) if (ret < 0)
return ret; return ret;
/*
* Relax the threshold as voltage will be adjusted after Accept Message plus tSrcTransition.
* It is safer to modify the threshold here.
*/
tcpm_set_auto_vbus_discharge_threshold(port, TYPEC_PWR_MODE_USB, false, 0);
memset(&msg, 0, sizeof(msg)); memset(&msg, 0, sizeof(msg));
msg.header = PD_HEADER_LE(PD_DATA_REQUEST, msg.header = PD_HEADER_LE(PD_DATA_REQUEST,
port->pwr_role, port->pwr_role,
@@ -3458,6 +3474,9 @@ static int tcpm_pd_send_pps_request(struct tcpm_port *port)
if (ret < 0) if (ret < 0)
return ret; return ret;
/* Relax the threshold as voltage will be adjusted right after Accept Message. */
tcpm_set_auto_vbus_discharge_threshold(port, TYPEC_PWR_MODE_USB, false, 0);
memset(&msg, 0, sizeof(msg)); memset(&msg, 0, sizeof(msg));
msg.header = PD_HEADER_LE(PD_DATA_REQUEST, msg.header = PD_HEADER_LE(PD_DATA_REQUEST,
port->pwr_role, port->pwr_role,
@@ -4285,6 +4304,10 @@ static void run_state_machine(struct tcpm_port *port)
port->hard_reset_count = 0; port->hard_reset_count = 0;
ret = tcpm_pd_send_request(port); ret = tcpm_pd_send_request(port);
if (ret < 0) { if (ret < 0) {
/* Restore back to the original state */
tcpm_set_auto_vbus_discharge_threshold(port, TYPEC_PWR_MODE_PD,
port->pps_data.active,
port->supply_voltage);
/* Let the Source send capabilities again. */ /* Let the Source send capabilities again. */
tcpm_set_state(port, SNK_WAIT_CAPABILITIES, 0); tcpm_set_state(port, SNK_WAIT_CAPABILITIES, 0);
} else { } else {
@@ -4295,6 +4318,10 @@ static void run_state_machine(struct tcpm_port *port)
case SNK_NEGOTIATE_PPS_CAPABILITIES: case SNK_NEGOTIATE_PPS_CAPABILITIES:
ret = tcpm_pd_send_pps_request(port); ret = tcpm_pd_send_pps_request(port);
if (ret < 0) { if (ret < 0) {
/* Restore back to the original state */
tcpm_set_auto_vbus_discharge_threshold(port, TYPEC_PWR_MODE_PD,
port->pps_data.active,
port->supply_voltage);
port->pps_status = ret; port->pps_status = ret;
/* /*
* If this was called due to updates to sink * If this was called due to updates to sink
@@ -5332,6 +5359,7 @@ static void _tcpm_pd_vbus_vsafe0v(struct tcpm_port *port)
} }
break; break;
case PR_SWAP_SNK_SRC_SINK_OFF: case PR_SWAP_SNK_SRC_SINK_OFF:
case PR_SWAP_SNK_SRC_SOURCE_ON:
/* Do nothing, vsafe0v is expected during transition */ /* Do nothing, vsafe0v is expected during transition */
break; break;
default: default:

View File

@@ -112,7 +112,7 @@ static void notify_netlink_uevent(const char *iface, struct idletimer_tg *timer)
res = snprintf(iface_msg, NLMSG_MAX_SIZE, "INTERFACE=%s", res = snprintf(iface_msg, NLMSG_MAX_SIZE, "INTERFACE=%s",
iface); iface);
if (NLMSG_MAX_SIZE <= res) { if (NLMSG_MAX_SIZE <= res) {
pr_err("message too long (%d)", res); pr_err("message too long (%d)\n", res);
return; return;
} }
@@ -122,25 +122,25 @@ static void notify_netlink_uevent(const char *iface, struct idletimer_tg *timer)
state ? "active" : "inactive"); state ? "active" : "inactive");
if (NLMSG_MAX_SIZE <= res) { if (NLMSG_MAX_SIZE <= res) {
pr_err("message too long (%d)", res); pr_err("message too long (%d)\n", res);
return; return;
} }
if (state) { if (state) {
res = snprintf(uid_msg, NLMSG_MAX_SIZE, "UID=%u", timer->uid); res = snprintf(uid_msg, NLMSG_MAX_SIZE, "UID=%u", timer->uid);
if (NLMSG_MAX_SIZE <= res) if (NLMSG_MAX_SIZE <= res)
pr_err("message too long (%d)", res); pr_err("message too long (%d)\n", res);
} else { } else {
res = snprintf(uid_msg, NLMSG_MAX_SIZE, "UID="); res = snprintf(uid_msg, NLMSG_MAX_SIZE, "UID=");
if (NLMSG_MAX_SIZE <= res) if (NLMSG_MAX_SIZE <= res)
pr_err("message too long (%d)", res); pr_err("message too long (%d)\n", res);
} }
time_ns = timespec64_to_ns(&ts); time_ns = timespec64_to_ns(&ts);
res = snprintf(timestamp_msg, NLMSG_MAX_SIZE, "TIME_NS=%llu", time_ns); res = snprintf(timestamp_msg, NLMSG_MAX_SIZE, "TIME_NS=%llu", time_ns);
if (NLMSG_MAX_SIZE <= res) { if (NLMSG_MAX_SIZE <= res) {
timestamp_msg[0] = '\0'; timestamp_msg[0] = '\0';
pr_err("message too long (%d)", res); pr_err("message too long (%d)\n", res);
} }
pr_debug("putting nlmsg: <%s> <%s> <%s> <%s>\n", iface_msg, state_msg, pr_debug("putting nlmsg: <%s> <%s> <%s> <%s>\n", iface_msg, state_msg,
@@ -323,12 +323,12 @@ static int idletimer_tg_create(struct idletimer_tg_info *info)
ret = sysfs_create_file(idletimer_tg_kobj, &info->timer->attr.attr); ret = sysfs_create_file(idletimer_tg_kobj, &info->timer->attr.attr);
if (ret < 0) { if (ret < 0) {
pr_debug("couldn't add file to sysfs"); pr_debug("couldn't add file to sysfs\n");
goto out_free_attr; goto out_free_attr;
} }
list_add(&info->timer->entry, &idletimer_tg_list); list_add(&info->timer->entry, &idletimer_tg_list);
pr_debug("timer type value is 0."); pr_debug("timer type value is 0.\n");
info->timer->timer_type = 0; info->timer->timer_type = 0;
info->timer->refcnt = 1; info->timer->refcnt = 1;
info->timer->send_nl_msg = false; info->timer->send_nl_msg = false;
@@ -389,7 +389,7 @@ static int idletimer_tg_create_v1(struct idletimer_tg_info_v1 *info)
ret = sysfs_create_file(idletimer_tg_kobj, &info->timer->attr.attr); ret = sysfs_create_file(idletimer_tg_kobj, &info->timer->attr.attr);
if (ret < 0) { if (ret < 0) {
pr_debug("couldn't add file to sysfs"); pr_debug("couldn't add file to sysfs\n");
goto out_free_attr; goto out_free_attr;
} }
@@ -397,7 +397,7 @@ static int idletimer_tg_create_v1(struct idletimer_tg_info_v1 *info)
kobject_uevent(idletimer_tg_kobj,KOBJ_ADD); kobject_uevent(idletimer_tg_kobj,KOBJ_ADD);
list_add(&info->timer->entry, &idletimer_tg_list); list_add(&info->timer->entry, &idletimer_tg_list);
pr_debug("timer type value is %u", info->timer_type); pr_debug("timer type value is %u\n", info->timer_type);
info->timer->timer_type = info->timer_type; info->timer->timer_type = info->timer_type;
info->timer->refcnt = 1; info->timer->refcnt = 1;
info->timer->send_nl_msg = (info->send_nl_msg != 0); info->timer->send_nl_msg = (info->send_nl_msg != 0);