Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d4ed06de authored by Prudhvi Yarlagadda's avatar Prudhvi Yarlagadda
Browse files

slim-msm-ngd: Depend on PIL driver notification instead of qmi



Depend on PIL driver subsys up notification instead of qmi
notifications for SSR/PDR to avoid race conditions between qmi
and PIL notifications. This race condition can happen when qmi
connections got killed without an actual SSR/PDR.

Change-Id: I3472999057f43bb5eec7b51c114ccf471be35a79
Signed-off-by: default avatarPrudhvi Yarlagadda <pyarlaga@codeaurora.org>
parent 6cbd30c5
Loading
Loading
Loading
Loading
+22 −9
Original line number Original line Diff line number Diff line
@@ -167,17 +167,10 @@ static int ngd_slim_qmi_new_server(struct qmi_handle *hdl,
		container_of(qmi, struct msm_slim_ctrl, qmi);
		container_of(qmi, struct msm_slim_ctrl, qmi);


	SLIM_INFO(dev, "Slimbus QMI new server event received\n");
	SLIM_INFO(dev, "Slimbus QMI new server event received\n");
	/* Hold wake lock until notify slaves thread is done */
	pm_stay_awake(dev->dev);
	qmi->svc_info.sq_family = AF_QIPCRTR;
	qmi->svc_info.sq_family = AF_QIPCRTR;
	qmi->svc_info.sq_node = service->node;
	qmi->svc_info.sq_node = service->node;
	qmi->svc_info.sq_port = service->port;
	qmi->svc_info.sq_port = service->port;
	if (dev->lpass_mem_usage) {
	complete(&dev->qmi_up);
		dev->lpass_mem->start = dev->lpass_phy_base;
		dev->lpass.base = dev->lpass_virt_base;
	}
	atomic_set(&dev->ssr_in_progress, 0);
	schedule_work(&dev->dsp.dom_up);


	return 0;
	return 0;
}
}
@@ -187,7 +180,10 @@ static void ngd_slim_qmi_del_server(struct qmi_handle *hdl,
{
{
	struct msm_slim_qmi *qmi =
	struct msm_slim_qmi *qmi =
		container_of(hdl, struct msm_slim_qmi, svc_event_hdl);
		container_of(hdl, struct msm_slim_qmi, svc_event_hdl);
	struct msm_slim_ctrl *dev =
		container_of(qmi, struct msm_slim_ctrl, qmi);


	reinit_completion(&dev->qmi_up);
	qmi->svc_info.sq_node = 0;
	qmi->svc_info.sq_node = 0;
	qmi->svc_info.sq_port = 0;
	qmi->svc_info.sq_port = 0;
}
}
@@ -275,6 +271,18 @@ static int dsp_domr_notify_cb(struct notifier_block *n, unsigned long code,
		ngd_dom_down(dev);
		ngd_dom_down(dev);
		mutex_unlock(&dev->tx_lock);
		mutex_unlock(&dev->tx_lock);
		break;
		break;
	case SUBSYS_AFTER_POWERUP:
	case SERVREG_NOTIF_SERVICE_STATE_UP_V01:
		SLIM_INFO(dev, "SLIM DSP SSR notify cb:%lu\n", code);
		/* Hold wake lock until notify slaves thread is done */
		pm_stay_awake(dev->dev);
		if (dev->lpass_mem_usage) {
			dev->lpass_mem->start = dev->lpass_phy_base;
			dev->lpass.base = dev->lpass_virt_base;
		}
		atomic_set(&dev->ssr_in_progress, 0);
		schedule_work(&dev->dsp.dom_up);
		break;
	case LOCATOR_UP:
	case LOCATOR_UP:
		reg = _cmd;
		reg = _cmd;
		if (!reg || reg->total_domains != 1) {
		if (!reg || reg->total_domains != 1) {
@@ -1627,6 +1635,7 @@ static int ngd_notify_slaves(void *data)
		pm_relax(dev->dev);
		pm_relax(dev->dev);
		return ret;
		return ret;
	}
	}
	ngd_dom_init(dev);


	while (!kthread_should_stop()) {
	while (!kthread_should_stop()) {
		wait_for_completion_interruptible(&dev->qmi.slave_notify);
		wait_for_completion_interruptible(&dev->qmi.slave_notify);
@@ -1642,7 +1651,6 @@ static int ngd_notify_slaves(void *data)
			 * controller is up
			 * controller is up
			 */
			 */
			slim_ctrl_add_boarddevs(&dev->ctrl);
			slim_ctrl_add_boarddevs(&dev->ctrl);
			ngd_dom_init(dev);
		} else {
		} else {
			slim_framer_booted(ctrl);
			slim_framer_booted(ctrl);
		}
		}
@@ -1689,6 +1697,10 @@ static void ngd_dom_up(struct work_struct *work)
		container_of(work, struct msm_slim_ss, dom_up);
		container_of(work, struct msm_slim_ss, dom_up);
	struct msm_slim_ctrl *dev =
	struct msm_slim_ctrl *dev =
		container_of(dsp, struct msm_slim_ctrl, dsp);
		container_of(dsp, struct msm_slim_ctrl, dsp);

	/* Make sure qmi service is up before continuing */
	wait_for_completion_interruptible(&dev->qmi_up);

	mutex_lock(&dev->ssr_lock);
	mutex_lock(&dev->ssr_lock);
	ngd_slim_enable(dev, true);
	ngd_slim_enable(dev, true);
	mutex_unlock(&dev->ssr_lock);
	mutex_unlock(&dev->ssr_lock);
@@ -1960,6 +1972,7 @@ static int ngd_slim_probe(struct platform_device *pdev)


	init_completion(&dev->reconf);
	init_completion(&dev->reconf);
	init_completion(&dev->ctrl_up);
	init_completion(&dev->ctrl_up);
	init_completion(&dev->qmi_up);
	mutex_init(&dev->tx_lock);
	mutex_init(&dev->tx_lock);
	mutex_init(&dev->ssr_lock);
	mutex_init(&dev->ssr_lock);
	spin_lock_init(&dev->tx_buf_lock);
	spin_lock_init(&dev->tx_buf_lock);
+2 −1
Original line number Original line Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/* SPDX-License-Identifier: GPL-2.0-only */
/*
/*
 * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
 */
 */


#ifndef _SLIM_MSM_H
#ifndef _SLIM_MSM_H
@@ -324,6 +324,7 @@ struct msm_slim_ctrl {
	u32			current_rx_buf[10];
	u32			current_rx_buf[10];
	int			current_count;
	int			current_count;
	atomic_t		ssr_in_progress;
	atomic_t		ssr_in_progress;
	struct completion	qmi_up;
};
};


struct msm_sat_chan {
struct msm_sat_chan {