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

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

coresight: tpdm: Add hw-enable-check when tpdm_probe



Add qcom,hw-enable-check in tpdm_probe to check if the tpdm need
to be probed.

Change-Id: I1160361e99a8d4487827b9adba63f6cfeee09029
Signed-off-by: default avatarMao Jinlong <jinlmao@codeaurora.org>
parent e5728a8c
Loading
Loading
Loading
Loading
+13 −0
Original line number Original line Diff line number Diff line
@@ -21,6 +21,7 @@
#include <linux/of.h>
#include <linux/of.h>
#include <linux/coresight.h>
#include <linux/coresight.h>
#include <linux/regulator/consumer.h>
#include <linux/regulator/consumer.h>
#include <soc/qcom/scm.h>


#include "coresight-priv.h"
#include "coresight-priv.h"


@@ -138,6 +139,8 @@ do { \
#define TPDM_REVISION_A		0
#define TPDM_REVISION_A		0
#define TPDM_REVISION_B		1
#define TPDM_REVISION_B		1


#define HW_ENABLE_CHECK_VALUE   0x10

enum tpdm_dataset {
enum tpdm_dataset {
	TPDM_DS_IMPLDEF,
	TPDM_DS_IMPLDEF,
	TPDM_DS_DSB,
	TPDM_DS_DSB,
@@ -4352,12 +4355,22 @@ static int tpdm_probe(struct amba_device *adev, const struct amba_id *id)
	static int traceid = TPDM_TRACE_ID_START;
	static int traceid = TPDM_TRACE_ID_START;
	uint32_t version;
	uint32_t version;
	const char *tclk_name, *treg_name;
	const char *tclk_name, *treg_name;
	struct scm_desc des = {0};
	u32 scm_ret = 0;


	pdata = of_get_coresight_platform_data(dev, adev->dev.of_node);
	pdata = of_get_coresight_platform_data(dev, adev->dev.of_node);
	if (IS_ERR(pdata))
	if (IS_ERR(pdata))
		return PTR_ERR(pdata);
		return PTR_ERR(pdata);
	adev->dev.platform_data = pdata;
	adev->dev.platform_data = pdata;


	if (of_property_read_bool(adev->dev.of_node, "qcom,hw-enable-check")) {
		ret = scm_call2(SCM_SIP_FNID(SCM_SVC_UTIL,
				HW_ENABLE_CHECK_VALUE),	&des);
		scm_ret = des.ret[0];
		if (scm_ret == 0)
			return -ENXIO;
	}

	drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
	drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
	if (!drvdata)
	if (!drvdata)
		return -ENOMEM;
		return -ENOMEM;