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

Commit 37ae0619 authored by Sudheer Papothi's avatar Sudheer Papothi
Browse files

soundwire: Remove pm runtime sync during soundwire read and write



sync to pm runtime increments the count and calls soundwire runtime
resume function. This is not needed for every soundwire register read
and write operation. Change removes syncing to pm runtime during
soundwire register read and write operations.

Change-Id: Id75dae4fb9d5a1785c3829541dbca9a3c4b4698f
Signed-off-by: default avatarSudheer Papothi <spapothi@codeaurora.org>
parent d9479b68
Loading
Loading
Loading
Loading
+3 −9
Original line number Diff line number Diff line
@@ -30,13 +30,13 @@
#include "swr-wcd-ctrl.h"

#define SWR_BROADCAST_CMD_ID            0x0F
#define SWR_AUTO_SUSPEND_DELAY_MS	3000 /* delay in msec */
#define SWR_AUTO_SUSPEND_DELAY          3 /* delay in sec */
#define SWR_DEV_ID_MASK			0xFFFFFFFF
#define SWR_REG_VAL_PACK(data, dev, id, reg)	\
			((reg) | ((id) << 16) | ((dev) << 20) | ((data) << 24))

/* pm runtime auto suspend timer in msecs */
static int auto_suspend_timer = SWR_AUTO_SUSPEND_DELAY_MS;
static int auto_suspend_timer = SWR_AUTO_SUSPEND_DELAY * 1000;
module_param(auto_suspend_timer, int,
		S_IRUGO | S_IWUSR | S_IWGRP);
MODULE_PARM_DESC(auto_suspend_timer, "timer for auto suspend");
@@ -482,7 +482,6 @@ static int swrm_read(struct swr_master *master, u8 dev_num, u16 reg_addr,
		return -EINVAL;
	}

	pm_runtime_get_sync(&swrm->pdev->dev);
	if (dev_num)
		ret = swrm_cmd_fifo_rd_cmd(swrm, &val, dev_num, 0, reg_addr,
					   len);
@@ -491,7 +490,6 @@ static int swrm_read(struct swr_master *master, u8 dev_num, u16 reg_addr,

	*reg_val = (u8)val;
	pm_runtime_mark_last_busy(&swrm->pdev->dev);
	pm_runtime_put_autosuspend(&swrm->pdev->dev);

	return ret;
}
@@ -508,14 +506,12 @@ static int swrm_write(struct swr_master *master, u8 dev_num, u16 reg_addr,
		return -EINVAL;
	}

	pm_runtime_get_sync(&swrm->pdev->dev);
	if (dev_num)
		ret = swrm_cmd_fifo_wr_cmd(swrm, reg_val, dev_num, 0, reg_addr);
	else
		ret = swrm->write(swrm->handle, reg_addr, reg_val);

	pm_runtime_mark_last_busy(&swrm->pdev->dev);
	pm_runtime_put_autosuspend(&swrm->pdev->dev);

	return ret;
}
@@ -536,7 +532,6 @@ static int swrm_bulk_write(struct swr_master *master, u8 dev_num, void *reg,
	if (len <= 0)
		return -EINVAL;

	pm_runtime_get_sync(&swrm->pdev->dev);
	if (dev_num) {
		swr_fifo_reg = kcalloc(len, sizeof(u32), GFP_KERNEL);
		if (!swr_fifo_reg) {
@@ -574,7 +569,6 @@ mem_fail:
	kfree(swr_fifo_reg);
err:
	pm_runtime_mark_last_busy(&swrm->pdev->dev);
	pm_runtime_put_autosuspend(&swrm->pdev->dev);
	return ret;
}

@@ -1411,7 +1405,7 @@ int swrm_wcd_notify(struct platform_device *pdev, u32 id, void *data)
				ret = swr_reset_device(swr_dev);
				if (ret) {
					dev_err(swrm->dev,
						"%s: failed to wakeup swr device %d\n",
						"%s: failed to reset swr device %d\n",
						__func__, swr_dev->dev_num);
					swrm_clk_request(swrm, false);
				}