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

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

Merge "asoc: wcd937x: use swr device wakeup api"

parents 02358ac5 b6dda1e6
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -70,7 +70,6 @@ struct wcd937x_priv {
	struct codec_port_info
			rx_port_mapping[MAX_PORT][MAX_CH_PER_PORT];
	struct regulator_bulk_data *supplies;

	struct notifier_block nblock;
	/* wcd callback to bolero */
	void *handle;
@@ -78,7 +77,7 @@ struct wcd937x_priv {
	int (*register_notifier)(void *handle,
				struct notifier_block *nblock,
				bool enable);

	int (*wakeup)(void *handle, bool enable);
	u32 version;
	/* Entry for version info */
	struct snd_info_entry *entry;
+4 −0
Original line number Diff line number Diff line
@@ -240,6 +240,10 @@ static void wcd937x_mbhc_program_btn_thr(struct snd_soc_component *component,

static bool wcd937x_mbhc_lock_sleep(struct wcd_mbhc *mbhc, bool lock)
{
	struct snd_soc_component *component = mbhc->component;
	struct wcd937x_priv *wcd937x = dev_get_drvdata(component->dev);

	wcd937x->wakeup((void*)wcd937x, lock);
	return true;
}

+20 −0
Original line number Diff line number Diff line
@@ -2426,6 +2426,25 @@ struct wcd937x_pdata *wcd937x_populate_dt_data(struct device *dev)
	return pdata;
}

static int wcd937x_wakeup(void *handle, bool enable)
{
	struct wcd937x_priv *priv;

	if (!handle) {
		pr_err("%s: NULL handle\n", __func__);
		return -EINVAL;
	}
	priv = (struct wcd937x_priv *)handle;
	if (!priv->tx_swr_dev) {
		pr_err("%s: tx swr dev is NULL\n", __func__);
		return -EINVAL;
	}
	if (enable)
		return swr_device_wakeup_vote(priv->tx_swr_dev);
	else
		return swr_device_wakeup_unvote(priv->tx_swr_dev);
}

static int wcd937x_bind(struct device *dev)
{
	int ret = 0, i = 0;
@@ -2495,6 +2514,7 @@ static int wcd937x_bind(struct device *dev)
	 * as per HW requirement.
	 */
	usleep_range(5000, 5010);
	wcd937x->wakeup = wcd937x_wakeup;

	ret = component_bind_all(dev, wcd937x);
	if (ret) {
+28 −0
Original line number Diff line number Diff line
@@ -1535,6 +1535,32 @@ static int swrm_get_logical_dev_num(struct swr_master *mstr, u64 dev_id,
	pm_runtime_put_autosuspend(swrm->dev);
	return ret;
}

static void swrm_device_wakeup_vote(struct swr_master *mstr)
{
	struct swr_mstr_ctrl *swrm = swr_get_ctrl_data(mstr);

	if (!swrm) {
		pr_err("%s: Invalid handle to swr controller\n",
			__func__);
		return;
	}
	pm_runtime_get_sync(swrm->dev);
}

static void swrm_device_wakeup_unvote(struct swr_master *mstr)
{
	struct swr_mstr_ctrl *swrm = swr_get_ctrl_data(mstr);

	if (!swrm) {
		pr_err("%s: Invalid handle to swr controller\n",
			__func__);
		return;
	}
	pm_runtime_mark_last_busy(swrm->dev);
	pm_runtime_put_autosuspend(swrm->dev);
}

static int swrm_master_init(struct swr_mstr_ctrl *swrm)
{
	int ret = 0;
@@ -1777,6 +1803,8 @@ static int swrm_probe(struct platform_device *pdev)
	swrm->master.disconnect_port = swrm_disconnect_port;
	swrm->master.slvdev_datapath_control = swrm_slvdev_datapath_control;
	swrm->master.remove_from_group = swrm_remove_from_group;
	swrm->master.device_wakeup_vote = swrm_device_wakeup_vote;
	swrm->master.device_wakeup_unvote = swrm_device_wakeup_unvote;
	swrm->master.dev.parent = &pdev->dev;
	swrm->master.dev.of_node = pdev->dev.of_node;
	swrm->master.num_port = 0;