diff --git a/drivers/char/diag/diagchar_core.c b/drivers/char/diag/diagchar_core.c index cb23bb704a7ed..2e4bb65b26a51 100644 --- a/drivers/char/diag/diagchar_core.c +++ b/drivers/char/diag/diagchar_core.c @@ -451,7 +451,7 @@ static void diag_close_logging_process(const int pid) int i, j; int session_mask = 0; int device_mask = 0; - uint32_t p_mask; + uint32_t p_mask = 0; struct diag_md_session_t *session_info = NULL; struct diag_logging_mode_param_t params; @@ -498,9 +498,11 @@ static void diag_close_logging_process(const int pid) } } } + mutex_lock(&driver->hdlc_disable_mutex); mutex_lock(&driver->md_session_lock); diag_md_session_close(pid); mutex_unlock(&driver->md_session_lock); + mutex_unlock(&driver->hdlc_disable_mutex); diag_switch_logging(¶ms); mutex_unlock(&driver->diagchar_mutex); } @@ -1436,6 +1438,8 @@ static void diag_md_session_close(int pid) driver->md_session_map[proc][i] = NULL; driver->md_session_mask[proc] &= ~session_info->peripheral_mask[proc]; + driver->p_hdlc_disabled[i] = + driver->hdlc_disabled; } } diag_log_mask_free(session_info->log_mask); diff --git a/drivers/char/diag/diagfwd_mhi.c b/drivers/char/diag/diagfwd_mhi.c index 11355bd564726..bd6772e9ebc37 100644 --- a/drivers/char/diag/diagfwd_mhi.c +++ b/drivers/char/diag/diagfwd_mhi.c @@ -320,6 +320,8 @@ static int __mhi_open(struct diag_mhi_info *mhi_info, int open_flag) static int mhi_open(int id) { + int err = 0; + if (id < 0 || id >= NUM_MHI_DEV) { pr_err("diag: In %s, invalid index %d\n", __func__, id); return -EINVAL; @@ -330,7 +332,9 @@ static int mhi_open(int id) * explicitly by Diag. Open both the read and write channels (denoted by * OPEN_CHANNELS flag) */ - __mhi_open(&diag_mhi[id], OPEN_CHANNELS); + err = __mhi_open(&diag_mhi[id], OPEN_CHANNELS); + if (err) + return err; diag_remote_dev_open(diag_mhi[id].dev_id); queue_work(diag_mhi[id].mhi_wq, &(diag_mhi[id].read_work)); diff --git a/drivers/gpu/drm/msm/sde/sde_crtc.c b/drivers/gpu/drm/msm/sde/sde_crtc.c index d412450586770..71100d5c2b75e 100644 --- a/drivers/gpu/drm/msm/sde/sde_crtc.c +++ b/drivers/gpu/drm/msm/sde/sde_crtc.c @@ -1391,14 +1391,24 @@ static u32 _sde_crtc_get_displays_affected(struct drm_crtc *crtc, { struct sde_crtc *sde_crtc; struct sde_crtc_state *crtc_state; + struct drm_encoder *encoder; u32 disp_bitmask = 0; int i; + bool is_ppsplit = false; sde_crtc = to_sde_crtc(crtc); crtc_state = to_sde_crtc_state(state); + list_for_each_entry(encoder, + &crtc->dev->mode_config.encoder_list, head) { + if (encoder->crtc != state->crtc) + continue; + + is_ppsplit |= sde_encoder_is_topology_ppsplit(encoder); + } + /* pingpong split: one ROI, one LM, two physical displays */ - if (crtc_state->is_ppsplit) { + if (is_ppsplit) { u32 lm_split_width = crtc_state->lm_bounds[0].w / 2; struct sde_rect *roi = &crtc_state->lm_roi[0]; @@ -2016,7 +2026,8 @@ static void _sde_crtc_blend_setup_mixer(struct drm_crtc *crtc, cnt++; } - sort(pstates, cnt, sizeof(pstates[0]), pstate_cmp, NULL); + if (cnt) + sort(pstates, cnt, sizeof(pstates[0]), pstate_cmp, NULL); _sde_crtc_set_src_split_order(crtc, pstates, cnt); if (lm && lm->ops.setup_dim_layer) { @@ -5278,7 +5289,8 @@ static int sde_crtc_atomic_check(struct drm_crtc *crtc, } /* assign mixer stages based on sorted zpos property */ - sort(pstates, cnt, sizeof(pstates[0]), pstate_cmp, NULL); + if (cnt) + sort(pstates, cnt, sizeof(pstates[0]), pstate_cmp, NULL); rc = _sde_crtc_excl_dim_layer_check(state, pstates, cnt); if (rc) diff --git a/drivers/gpu/drm/msm/sde/sde_encoder.c b/drivers/gpu/drm/msm/sde/sde_encoder.c index d97490f2a77ec..8e397029dd5fc 100644 --- a/drivers/gpu/drm/msm/sde/sde_encoder.c +++ b/drivers/gpu/drm/msm/sde/sde_encoder.c @@ -943,6 +943,24 @@ bool sde_encoder_in_clone_mode(struct drm_encoder *drm_enc) return false; } +bool sde_encoder_is_topology_ppsplit(struct drm_encoder *drm_enc) +{ + struct sde_encoder_virt *sde_enc; + struct sde_encoder_phys *master; + + if (!drm_enc) + return false; + + sde_enc = to_sde_encoder_virt(drm_enc); + master = sde_enc->cur_master; + + if (!master || !master->connector) + return false; + + return (sde_connector_get_topology_name(master->connector) + == SDE_RM_TOPOLOGY_PPSPLIT); +} + static int sde_encoder_virt_atomic_check( struct drm_encoder *drm_enc, struct drm_crtc_state *crtc_state, @@ -2684,8 +2702,6 @@ static void sde_encoder_virt_mode_set(struct drm_encoder *drm_enc, struct sde_kms *sde_kms; struct list_head *connector_list; struct drm_connector *conn = NULL, *conn_iter; - struct sde_connector_state *sde_conn_state = NULL; - struct sde_connector *sde_conn = NULL; struct sde_rm_hw_iter dsc_iter, pp_iter; struct sde_rm_hw_request request_hw; bool is_cmd_mode = false; @@ -2734,20 +2750,6 @@ static void sde_encoder_virt_mode_set(struct drm_encoder *drm_enc, return; } - sde_conn = to_sde_connector(conn); - sde_conn_state = to_sde_connector_state(conn->state); - if (sde_conn && sde_conn_state) { - ret = sde_conn->ops.get_mode_info(&sde_conn->base, adj_mode, - &sde_conn_state->mode_info, - sde_kms->catalog->max_mixer_width, - sde_conn->display); - if (ret) { - SDE_ERROR_ENC(sde_enc, - "failed to get mode info from the display\n"); - return; - } - } - /* release resources before seamless mode change */ if (msm_is_mode_seamless_dms(adj_mode) || (msm_is_mode_seamless_dyn_clk(adj_mode) && diff --git a/drivers/gpu/drm/msm/sde/sde_encoder.h b/drivers/gpu/drm/msm/sde/sde_encoder.h index 83b207236cfcf..74f26d40e08a6 100644 --- a/drivers/gpu/drm/msm/sde/sde_encoder.h +++ b/drivers/gpu/drm/msm/sde/sde_encoder.h @@ -284,6 +284,14 @@ void sde_encoder_recovery_events_handler(struct drm_encoder *encoder, */ bool sde_encoder_in_clone_mode(struct drm_encoder *enc); +/** + *sde_encoder_is_topology_ppsplit - checks if the current encoder is in + ppsplit topology. + *@drm_enc: Pointer to drm encoder structure + *@Return: true if the present topology is ppsplit + */ +bool sde_encoder_is_topology_ppsplit(struct drm_encoder *drm_enc); + /** * sde_encoder_is_primary_display - checks if underlying display is primary * display or not. diff --git a/drivers/media/platform/msm/vidc/venus_hfi.c b/drivers/media/platform/msm/vidc/venus_hfi.c index faf8d6f28d9d0..21e58ea84c1b9 100644 --- a/drivers/media/platform/msm/vidc/venus_hfi.c +++ b/drivers/media/platform/msm/vidc/venus_hfi.c @@ -4043,11 +4043,8 @@ static inline void __unprepare_ahb2axi_bridge(struct venus_hfi_device *device, if (version != (0x5 << 28 | 0x10 << 16)) return; - if (!(device->intr_status & VIDC_WRAPPER_INTR_STATUS_A2HWD_BMSK)) - return; - dprintk(VIDC_ERR, - "reset axi cbcr to recover from hung\n"); + "reset axi cbcr to recover\n"); /* read registers */ axi0_cbcr_status = __read_gcc_register(device, VIDEO_GCC_AXI0_CBCR); @@ -4800,7 +4797,8 @@ static int __venus_power_on(struct venus_hfi_device *device) return rc; } -static void __venus_power_off(struct venus_hfi_device *device) +static void __venus_power_off(struct venus_hfi_device *device, + bool axi_reset) { u32 version; @@ -4810,11 +4808,13 @@ static void __venus_power_off(struct venus_hfi_device *device) if (!(device->intr_status & VIDC_WRAPPER_INTR_STATUS_A2HWD_BMSK)) disable_irq_nosync(device->hal_data->irq); - version = __read_register(device, VIDC_WRAPPER_HW_VERSION); + if (axi_reset) + version = __read_register(device, VIDC_WRAPPER_HW_VERSION); __disable_unprepare_clks(device); - __unprepare_ahb2axi_bridge(device, version); + if (axi_reset) + __unprepare_ahb2axi_bridge(device, version); device->intr_status = 0; @@ -4852,7 +4852,7 @@ static inline int __suspend(struct venus_hfi_device *device) __disable_subcaches(device); - __venus_power_off(device); + __venus_power_off(device, false); dprintk(VIDC_PROF, "Venus power off\n"); return rc; @@ -4927,7 +4927,7 @@ static inline int __resume(struct venus_hfi_device *device) err_reset_core: __tzbsp_set_video_state(TZBSP_VIDEO_STATE_SUSPEND); err_set_video_state: - __venus_power_off(device); + __venus_power_off(device, false); err_venus_power_on: dprintk(VIDC_ERR, "Failed to resume from power collapse\n"); return rc; @@ -4986,7 +4986,7 @@ static int __load_fw(struct venus_hfi_device *device) subsystem_put(device->resources.fw.cookie); device->resources.fw.cookie = NULL; fail_load_fw: - __venus_power_off(device); + __venus_power_off(device, true); fail_venus_power_on: fail_init_pkt: __deinit_resources(device); @@ -5007,7 +5007,7 @@ static void __unload_fw(struct venus_hfi_device *device) __vote_buses(device, NULL, 0); subsystem_put(device->resources.fw.cookie); __interface_queues_release(device); - __venus_power_off(device); + __venus_power_off(device, true); device->resources.fw.cookie = NULL; __deinit_resources(device); diff --git a/drivers/misc/qseecom.c b/drivers/misc/qseecom.c index 3efd59ce06de1..e16dce0bb2458 100644 --- a/drivers/misc/qseecom.c +++ b/drivers/misc/qseecom.c @@ -6734,9 +6734,11 @@ static int __qseecom_update_qteec_req_buf(struct qseecom_qteec_modfd_req *req, for (i = 0; i < MAX_ION_FD; i++) { if (req->ifd_data[i].fd > 0) { ion_fd = req->ifd_data[i].fd; - if ((req->req_len < sizeof(uint32_t)) || + if ((req->req_len < + sizeof(struct qseecom_param_memref)) || (req->ifd_data[i].cmd_buf_offset > - req->req_len - sizeof(uint32_t))) { + req->req_len - + sizeof(struct qseecom_param_memref))) { pr_err("Invalid offset/req len 0x%x/0x%x\n", req->req_len, req->ifd_data[i].cmd_buf_offset); diff --git a/drivers/platform/msm/gsi/gsi.c b/drivers/platform/msm/gsi/gsi.c index 13de320287024..ca98c6e4cf9d9 100644 --- a/drivers/platform/msm/gsi/gsi.c +++ b/drivers/platform/msm/gsi/gsi.c @@ -175,7 +175,8 @@ static void gsi_channel_state_change_wait(unsigned long chan_hdl, } if (op == GSI_CH_START) { - if (curr_state == GSI_CHAN_STATE_STARTED) { + if (curr_state == GSI_CHAN_STATE_STARTED || + curr_state == GSI_CHAN_STATE_FLOW_CONTROL) { ctx->state = curr_state; return; } @@ -2697,7 +2698,8 @@ int gsi_start_channel(unsigned long chan_hdl) ctx, GSI_START_CMD_TIMEOUT_MS, op); - if (ctx->state != GSI_CHAN_STATE_STARTED) { + if (ctx->state != GSI_CHAN_STATE_STARTED && + ctx->state != GSI_CHAN_STATE_FLOW_CONTROL) { /* * Hardware returned unexpected status, unexpected * hardware state. diff --git a/drivers/platform/msm/gsi/gsi.h b/drivers/platform/msm/gsi/gsi.h index e4b524949967b..b1396626f37ac 100644 --- a/drivers/platform/msm/gsi/gsi.h +++ b/drivers/platform/msm/gsi/gsi.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. +/* Copyright (c) 2015-2019, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -90,6 +90,7 @@ enum gsi_chan_state { GSI_CHAN_STATE_STARTED = 0x2, GSI_CHAN_STATE_STOPPED = 0x3, GSI_CHAN_STATE_STOP_IN_PROC = 0x4, + GSI_CHAN_STATE_FLOW_CONTROL = 0x5, GSI_CHAN_STATE_ERROR = 0xf }; diff --git a/drivers/power/supply/qcom/fg-alg.c b/drivers/power/supply/qcom/fg-alg.c index 3a1db2ce99b3b..a382d60299d9f 100644 --- a/drivers/power/supply/qcom/fg-alg.c +++ b/drivers/power/supply/qcom/fg-alg.c @@ -898,7 +898,7 @@ static int get_step_chg_current_window(struct ttf *ttf) struct range_data *step_chg_cfg = ttf->step_chg_cfg; int i, rc, curr_window, vbatt; - if (ttf->mode == TTF_MODE_V_STEP_CHG) { + if (ttf->mode == TTF_MODE_VBAT_STEP_CHG) { rc = ttf->get_ttf_param(ttf->data, TTF_VBAT, &vbatt); if (rc < 0) { pr_err("failed to get battery voltage, rc=%d\n", rc); @@ -1024,7 +1024,7 @@ static int get_time_to_full_locked(struct ttf *ttf, int *val) /* estimated battery current at the CC to CV transition */ switch (ttf->mode) { case TTF_MODE_NORMAL: - case TTF_MODE_V_STEP_CHG: + case TTF_MODE_VBAT_STEP_CHG: case TTF_MODE_OCV_STEP_CHG: i_cc2cv = ibatt_avg * vbatt_avg / max(MILLI_UNIT, float_volt_uv / MILLI_UNIT); @@ -1082,7 +1082,7 @@ static int get_time_to_full_locked(struct ttf *ttf, int *val) ibatt_this_step, t_predicted_this_step); } break; - case TTF_MODE_V_STEP_CHG: + case TTF_MODE_VBAT_STEP_CHG: case TTF_MODE_OCV_STEP_CHG: if (!step_chg_data || !step_chg_cfg) break; @@ -1123,7 +1123,7 @@ static int get_time_to_full_locked(struct ttf *ttf, int *val) MILLI_UNIT); } - if (ttf->mode == TTF_MODE_V_STEP_CHG) + if (ttf->mode == TTF_MODE_VBAT_STEP_CHG) step_chg_data[i].ocv = step_chg_cfg[i].high_threshold - (rbatt * i_step); diff --git a/drivers/power/supply/qcom/fg-alg.h b/drivers/power/supply/qcom/fg-alg.h index 24d078735c676..24fc37b033629 100644 --- a/drivers/power/supply/qcom/fg-alg.h +++ b/drivers/power/supply/qcom/fg-alg.h @@ -75,7 +75,7 @@ struct cap_learning { enum ttf_mode { TTF_MODE_NORMAL = 0, TTF_MODE_QNOVO, - TTF_MODE_V_STEP_CHG, + TTF_MODE_VBAT_STEP_CHG, TTF_MODE_OCV_STEP_CHG, }; diff --git a/drivers/power/supply/qcom/qpnp-fg-gen4.c b/drivers/power/supply/qcom/qpnp-fg-gen4.c index 76e91cd82bf3b..197027688f6f4 100644 --- a/drivers/power/supply/qcom/qpnp-fg-gen4.c +++ b/drivers/power/supply/qcom/qpnp-fg-gen4.c @@ -951,7 +951,7 @@ static int fg_gen4_get_ttf_param(void *data, enum ttf_param param, int *val) if (is_qnovo_en(fg)) *val = TTF_MODE_QNOVO; else if (chip->ttf->step_chg_cfg_valid) - *val = TTF_MODE_V_STEP_CHG; + *val = TTF_MODE_VBAT_STEP_CHG; else if (chip->ttf->ocv_step_chg_cfg_valid) *val = TTF_MODE_OCV_STEP_CHG; else diff --git a/drivers/power/supply/qcom/qpnp-qg.c b/drivers/power/supply/qcom/qpnp-qg.c index 13c3fca11e9a1..4debea696ef75 100644 --- a/drivers/power/supply/qcom/qpnp-qg.c +++ b/drivers/power/supply/qcom/qpnp-qg.c @@ -1615,7 +1615,7 @@ static int qg_get_ttf_param(void *data, enum ttf_param param, int *val) break; case TTF_MODE: if (chip->ttf->step_chg_cfg_valid) - *val = TTF_MODE_V_STEP_CHG; + *val = TTF_MODE_VBAT_STEP_CHG; else *val = TTF_MODE_NORMAL; break; diff --git a/drivers/rpmsg/qcom_glink_smem.c b/drivers/rpmsg/qcom_glink_smem.c index 8b279dc2a713e..600c3619051cf 100644 --- a/drivers/rpmsg/qcom_glink_smem.c +++ b/drivers/rpmsg/qcom_glink_smem.c @@ -231,6 +231,7 @@ struct qcom_glink *qcom_glink_smem_register(struct device *parent, ret = device_register(dev); if (ret) { pr_err("failed to register glink edge\n"); + kfree(dev); return ERR_PTR(ret); } @@ -238,21 +239,21 @@ struct qcom_glink *qcom_glink_smem_register(struct device *parent, &remote_pid); if (ret) { dev_err(dev, "failed to parse qcom,remote-pid\n"); - goto err_put_dev; + goto unregister; } rx_pipe = devm_kzalloc(dev, sizeof(*rx_pipe), GFP_KERNEL); tx_pipe = devm_kzalloc(dev, sizeof(*tx_pipe), GFP_KERNEL); if (!rx_pipe || !tx_pipe) { ret = -ENOMEM; - goto err_put_dev; + goto unregister; } ret = qcom_smem_alloc(remote_pid, SMEM_GLINK_NATIVE_XPRT_DESCRIPTOR, 32); if (ret && ret != -EEXIST) { dev_err(dev, "failed to allocate glink descriptors\n"); - goto err_put_dev; + goto unregister; } descs = qcom_smem_get(remote_pid, @@ -260,13 +261,13 @@ struct qcom_glink *qcom_glink_smem_register(struct device *parent, if (IS_ERR(descs)) { dev_err(dev, "failed to acquire xprt descriptor\n"); ret = PTR_ERR(descs); - goto err_put_dev; + goto unregister; } if (size != 32) { dev_err(dev, "glink descriptor of invalid size\n"); ret = -EINVAL; - goto err_put_dev; + goto unregister; } tx_pipe->tail = &descs[0]; @@ -278,7 +279,7 @@ struct qcom_glink *qcom_glink_smem_register(struct device *parent, SZ_16K); if (ret && ret != -EEXIST) { dev_err(dev, "failed to allocate TX fifo\n"); - goto err_put_dev; + goto unregister; } tx_pipe->fifo = qcom_smem_get(remote_pid, SMEM_GLINK_NATIVE_XPRT_FIFO_0, @@ -286,7 +287,7 @@ struct qcom_glink *qcom_glink_smem_register(struct device *parent, if (IS_ERR(tx_pipe->fifo)) { dev_err(dev, "failed to acquire TX fifo\n"); ret = PTR_ERR(tx_pipe->fifo); - goto err_put_dev; + goto unregister; } rx_pipe->native.avail = glink_smem_rx_avail; @@ -307,13 +308,13 @@ struct qcom_glink *qcom_glink_smem_register(struct device *parent, false); if (IS_ERR(glink)) { ret = PTR_ERR(glink); - goto err_put_dev; + goto unregister; } return glink; -err_put_dev: - put_device(dev); +unregister: + device_unregister(dev); return ERR_PTR(ret); } diff --git a/drivers/soc/qcom/icnss.c b/drivers/soc/qcom/icnss.c index 0859fb6687568..ff45a87f37436 100644 --- a/drivers/soc/qcom/icnss.c +++ b/drivers/soc/qcom/icnss.c @@ -1417,7 +1417,10 @@ static int icnss_modem_notifier_nb(struct notifier_block *nb, if (code == SUBSYS_BEFORE_SHUTDOWN && !notif->crashed && atomic_read(&priv->is_shutdown)) { atomic_set(&priv->is_shutdown, false); - icnss_call_driver_remove(priv); + if (!test_bit(ICNSS_PD_RESTART, &priv->state) && + !test_bit(ICNSS_SHUTDOWN_DONE, &priv->state)) { + icnss_call_driver_remove(priv); + } } if (code == SUBSYS_BEFORE_SHUTDOWN && !notif->crashed && diff --git a/drivers/usb/dwc3/dwc3-msm.c b/drivers/usb/dwc3/dwc3-msm.c index 5e25046e74ff6..80b88e0e13277 100644 --- a/drivers/usb/dwc3/dwc3-msm.c +++ b/drivers/usb/dwc3/dwc3-msm.c @@ -2854,7 +2854,7 @@ static void dwc3_resume_work(struct work_struct *w) dwc->maximum_speed = USB_SPEED_HIGH; if (mdwc->override_usb_speed && - mdwc->override_usb_speed < dwc->maximum_speed) { + mdwc->override_usb_speed <= dwc->maximum_speed) { dwc->maximum_speed = mdwc->override_usb_speed; dwc->gadget.max_speed = dwc->maximum_speed; dbg_event(0xFF, "override_speed",