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

Commit f4c5ee9a authored by Satyajit Desai's avatar Satyajit Desai
Browse files

coresight-dummy: add support for dummy sink devices



Add driver support to configure dummy coresight sink
devices. This driver can be used for devices that are
controlled by other subsystems but rely on Linux drivers
to configure rest of the trace path.

Change-Id: I4abd0e2fe54c2258e68bb689a75c06846896a50e
Signed-off-by: default avatarSatyajit Desai <sadesai@codeaurora.org>
parent 80e47d47
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -87,6 +87,8 @@ its hardware characteristcs.
* Additional required property for coresight-dummy devices:
	* qcom,dummy-source: Configure the device as source.

	* qcom,dummy-sink: Configure the device as sink.

* Optional properties for all components:
	* reg-names: names corresponding to each reg property value.

+27 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/coresight.h>
#include <linux/of.h>

#define DUMMY_TRACE_ID_START	256

@@ -41,6 +42,22 @@ static void dummy_source_disable(struct coresight_device *csdev,
	dev_info(drvdata->dev, "Dummy source disabled\n");
}

static int dummy_sink_enable(struct coresight_device *csdev, u32 mode)
{
	struct dummy_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);

	dev_info(drvdata->dev, "Dummy sink enabled\n");

	return 0;
}

static void dummy_sink_disable(struct coresight_device *csdev)
{
	struct dummy_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);

	dev_info(drvdata->dev, "Dummy sink disabled\n");
}

static int dummy_trace_id(struct coresight_device *csdev)
{
	struct dummy_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
@@ -54,8 +71,14 @@ static const struct coresight_ops_source dummy_source_ops = {
	.disable	= dummy_source_disable,
};

static const struct coresight_ops_sink dummy_sink_ops = {
	.enable		= dummy_sink_enable,
	.disable	= dummy_sink_disable,
};

static const struct coresight_ops dummy_cs_ops = {
	.source_ops	= &dummy_source_ops,
	.sink_ops	= &dummy_sink_ops,
};

static int dummy_probe(struct platform_device *pdev)
@@ -88,6 +111,10 @@ static int dummy_probe(struct platform_device *pdev)
		desc->type = CORESIGHT_DEV_TYPE_SOURCE;
		desc->subtype.source_subtype =
					CORESIGHT_DEV_SUBTYPE_SOURCE_PROC;
	} else if (of_property_read_bool(pdev->dev.of_node,
					 "qcom,dummy-sink")) {
		desc->type = CORESIGHT_DEV_TYPE_SINK;
		desc->subtype.sink_subtype = CORESIGHT_DEV_SUBTYPE_SINK_BUFFER;
	} else {
		dev_info(dev, "Device type not set.\n");
		return -EINVAL;