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

Commit df85b0eb authored by Satyajit Desai's avatar Satyajit Desai Committed by Gerrit - the friendly Code Review server
Browse files

coresight: add node to reset all coresight devices



Add new reset_source_sink node to be able to disable all
active coresight devices.

Change-Id: Id35f625f11e16ff4770992bd81f0964ea9b755e6
Signed-off-by: default avatarSatyajit Desai <sadesai@codeaurora.org>
Signed-off-by: default avatarRama Aparna Mallavarapu <aparnam@codeaurora.org>
parent cc9e502e
Loading
Loading
Loading
Loading
+35 −1
Original line number Diff line number Diff line
@@ -991,8 +991,42 @@ int coresight_timeout(void __iomem *addr, u32 offset, int position, int value)
	return -EAGAIN;
}

static ssize_t reset_source_sink_store(struct bus_type *bus,
				       const char *buf, size_t size)
{
	int ret = 0;
	unsigned long val;
	struct coresight_path *cspath = NULL;
	struct coresight_path *cspath_next = NULL;
	struct coresight_device *csdev;

	ret = kstrtoul(buf, 10, &val);
	if (ret)
		return ret;

	mutex_lock(&coresight_mutex);

	list_for_each_entry_safe(cspath, cspath_next, &cs_active_paths, link) {
		csdev = coresight_get_source(cspath->path);
		if (!csdev)
			continue;
		coresight_disable(csdev);
	}

	mutex_unlock(&coresight_mutex);
	return size;
}
static BUS_ATTR_WO(reset_source_sink);

static struct attribute *coresight_reset_source_sink_attrs[] = {
	&bus_attr_reset_source_sink.attr,
	NULL,
};
ATTRIBUTE_GROUPS(coresight_reset_source_sink);

struct bus_type coresight_bustype = {
	.name		= "coresight",
	.bus_groups	= coresight_reset_source_sink_groups,
};

static int __init coresight_init(void)