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

Commit a6cf4c02 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "soundwire: Update pm runtime last busy for read/write functions"

parents f4123156 a322e67b
Loading
Loading
Loading
Loading
+22 −4
Original line number Diff line number Diff line
@@ -457,12 +457,16 @@ static int swrm_read(struct swr_master *master, u8 dev_num, u32 reg_addr,
{
	struct swr_mstr_ctrl *swrm = swr_get_ctrl_data(master);

	if (!swrm) {
		dev_err(&master->dev, "%s: swrm is NULL\n", __func__);
		return -EINVAL;
	}

	if (pm_runtime_suspended(&swrm->pdev->dev)) {
		dev_dbg(swrm->dev, "%s: suspended state, enable pm_runtime\n",
			__func__);
		pm_runtime_get_sync(&swrm->pdev->dev);
		pm_runtime_mark_last_busy(&swrm->pdev->dev);
		pm_runtime_put_autosuspend(&swrm->pdev->dev);
		swrm->is_suspend = true;
	}

	if (dev_num) {
@@ -477,6 +481,11 @@ static int swrm_read(struct swr_master *master, u8 dev_num, u32 reg_addr,
			return -EINVAL;
		}
	}
	pm_runtime_mark_last_busy(&swrm->pdev->dev);
	if (swrm->is_suspend) {
		pm_runtime_put_autosuspend(&swrm->pdev->dev);
		swrm->is_suspend = false;
	}
	return 0;
}

@@ -486,12 +495,16 @@ static int swrm_write(struct swr_master *master, u8 dev_num, u32 reg_addr,
	struct swr_mstr_ctrl *swrm = swr_get_ctrl_data(master);
	int ret = 0;

	if (!swrm) {
		dev_err(&master->dev, "%s: swrm is NULL\n", __func__);
		return -EINVAL;
	}

	if (pm_runtime_suspended(&swrm->pdev->dev)) {
		dev_dbg(swrm->dev, "%s: suspended state, enable pm_runtime\n",
			__func__);
		pm_runtime_get_sync(&swrm->pdev->dev);
		pm_runtime_mark_last_busy(&swrm->pdev->dev);
		pm_runtime_put_autosuspend(&swrm->pdev->dev);
		swrm->is_suspend = true;
	}

	if (dev_num) {
@@ -505,6 +518,11 @@ static int swrm_write(struct swr_master *master, u8 dev_num, u32 reg_addr,
			return -EINVAL;
		}
	}
	pm_runtime_mark_last_busy(&swrm->pdev->dev);
	if (swrm->is_suspend) {
		pm_runtime_put_autosuspend(&swrm->pdev->dev);
		swrm->is_suspend = false;
	}
	return ret;
}

+1 −0
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@ struct swr_mstr_ctrl {
	struct list_head mport_list;
	int state;
	struct platform_device *pdev;
	bool is_suspend;
};

#endif /* _SWR_WCD_CTRL_H */