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

Commit a8ece7e3 authored by Mao Jinlong's avatar Mao Jinlong Committed by Gerrit - the friendly Code Review server
Browse files

tmc-etr: Check if it is mode switch action during disable etr



When switch mode with etr being enabled more than one time, it needs
to reset all the etr settings for previous mode instead of return busy.

Change-Id: I243a6d910bb3dd8ac9ca30dadbd1c6ab3cefd00f
Signed-off-by: default avatarMao Jinlong <jinlmao@codeaurora.org>
parent 5537f3dc
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -1976,7 +1976,8 @@ static int tmc_enable_etr_sink(struct coresight_device *csdev,
	return -EINVAL;
}

static int _tmc_disable_etr_sink(struct coresight_device *csdev)
static int _tmc_disable_etr_sink(struct coresight_device *csdev,
			bool mode_switch)
{
	unsigned long flags;
	struct tmc_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
@@ -1988,7 +1989,7 @@ static int _tmc_disable_etr_sink(struct coresight_device *csdev)
		return -EBUSY;
	}

	if (atomic_dec_return(csdev->refcnt)) {
	if (atomic_dec_return(csdev->refcnt) && !mode_switch) {
		spin_unlock_irqrestore(&drvdata->spinlock, flags);
		return -EBUSY;
	}
@@ -2062,7 +2063,7 @@ static int tmc_disable_etr_sink(struct coresight_device *csdev)
	int ret;

	mutex_lock(&drvdata->mem_lock);
	ret = _tmc_disable_etr_sink(csdev);
	ret = _tmc_disable_etr_sink(csdev, false);
	mutex_unlock(&drvdata->mem_lock);
	return ret;
}
@@ -2093,7 +2094,7 @@ int tmc_etr_switch_mode(struct tmc_drvdata *drvdata, const char *out_mode)
	}

	coresight_disable_all_source_link();
	_tmc_disable_etr_sink(drvdata->csdev);
	_tmc_disable_etr_sink(drvdata->csdev, true);
	old_mode = drvdata->out_mode;
	drvdata->out_mode = new_mode;
	if (tmc_enable_etr_sink_sysfs(drvdata->csdev)) {