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

Commit acca7836 authored by Dilip Kota's avatar Dilip Kota
Browse files

slim-msm: Differentiate SSR from Noise during power up



During power up operation check whether power up
failure is due to SSR or noise over slimbus.
If power up failure is due to SSR prevent retry
operation.
This change also do allocate DMA memory for slimbus
bulk trasactions. Memory should be DMA for slimbus
transactions as using non-DMA memory will end up
in creating bounce buffers and affect the performance.

Change-Id: Iaca520d92c4ee2d73f8e751699779e6cfc9ddb87
Signed-off-by: default avatarDilip Kota <dkota@codeaurora.org>
parent e97b6a0e
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -167,6 +167,7 @@ static int ngd_qmi_available(struct notifier_block *n, unsigned long code,
	SLIM_INFO(dev, "Slimbus QMI NGD CB received event:%ld\n", code);
	switch (code) {
	case QMI_SERVER_ARRIVE:
		atomic_set(&dev->ssr_in_progress, 0);
		schedule_work(&dev->dsp.dom_up);
		break;
	default:
@@ -214,6 +215,8 @@ static int dsp_domr_notify_cb(struct notifier_block *n, unsigned long code,
	switch (code) {
	case SUBSYS_BEFORE_SHUTDOWN:
	case SERVREG_NOTIF_SERVICE_STATE_DOWN_V01:
		SLIM_INFO(dev, "SLIM DSP SSR notify cb:%lu\n", code);
		atomic_set(&dev->ssr_in_progress, 1);
		/* wait for current transaction */
		mutex_lock(&dev->tx_lock);
		/* make sure autosuspend is not called until ADSP comes up*/
@@ -866,7 +869,7 @@ static int ngd_bulk_wr(struct slim_controller *ctrl, u8 la, u8 mt, u8 mc,
	}
	if (dev->bulk.size > dev->bulk.buf_sz) {
		void *temp = krealloc(dev->bulk.base, dev->bulk.size,
				      GFP_KERNEL);
				      GFP_KERNEL | GFP_DMA);
		if (!temp) {
			ret = -ENOMEM;
			goto retpath;
@@ -1316,8 +1319,10 @@ hw_init_retry:
		if (ret) {
			SLIM_WARN(dev, "SLIM power req failed:%d, retry:%d\n",
					ret, retries);
			if (!atomic_read(&dev->ssr_in_progress))
				msm_slim_qmi_power_request(dev, false);
			if (retries < INIT_MX_RETRIES) {
			if (retries < INIT_MX_RETRIES &&
				!atomic_read(&dev->ssr_in_progress)) {
				retries++;
				goto hw_init_retry;
			}
@@ -1416,7 +1421,8 @@ capability_retry:
		SLIM_WARN(dev,
			  "slim capability time-out:%d, stat:0x%x,cfg:0x%x\n",
				retries, laddr, cfg);
		if (retries < INIT_MX_RETRIES) {
		if ((retries < INIT_MX_RETRIES) &&
				!atomic_read(&dev->ssr_in_progress)) {
			retries++;
			goto capability_retry;
		}
@@ -1683,7 +1689,7 @@ static int ngd_slim_probe(struct platform_device *pdev)

	/* typical txn numbers and size used in bulk operation */
	dev->bulk.buf_sz = SLIM_MAX_TXNS * 8;
	dev->bulk.base = kzalloc(dev->bulk.buf_sz, GFP_KERNEL);
	dev->bulk.base = kzalloc(dev->bulk.buf_sz, GFP_KERNEL | GFP_DMA);
	if (!dev->bulk.base) {
		ret = -ENOMEM;
		goto err_nobulk;
@@ -1780,6 +1786,7 @@ static int ngd_slim_probe(struct platform_device *pdev)
	dev->ee = 1;
	dev->irq = irq->start;
	dev->bam.irq = bam_irq->start;
	atomic_set(&dev->ssr_in_progress, 0);

	if (rxreg_access)
		dev->use_rx_msgqs = MSM_MSGQ_DISABLED;
@@ -1938,6 +1945,7 @@ static int ngd_slim_runtime_resume(struct device *device)
	struct platform_device *pdev = to_platform_device(device);
	struct msm_slim_ctrl *dev = platform_get_drvdata(pdev);
	int ret = 0;

	mutex_lock(&dev->tx_lock);
	if (dev->state >= MSM_CTRL_ASLEEP)
		ret = ngd_slim_power_up(dev, false);
+1 −0
Original line number Diff line number Diff line
@@ -314,6 +314,7 @@ struct msm_slim_ctrl {
	void (*rx_slim)(struct msm_slim_ctrl *dev, u8 *buf);
	u32			current_rx_buf[10];
	int			current_count;
	atomic_t		ssr_in_progress;
};

struct msm_sat_chan {