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

Commit 21dd77e4 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "drivers: qcom: Add standalone mode support for RPMH"

parents e9f80ee3 d0748104
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -110,6 +110,8 @@ struct rsc_drv {
	int irq;
};

extern bool rpmh_standalone;

int rpmh_rsc_send_data(struct rsc_drv *drv, const struct tcs_request *msg);
int rpmh_rsc_write_ctrl_data(struct rsc_drv *drv,
			     const struct tcs_request *msg);
+4 −0
Original line number Diff line number Diff line
@@ -66,6 +66,8 @@
#define RSC_PDC_DRV_DATA		0x38
#define RSC_PDC_DATA_OFFSET		0x08

bool rpmh_standalone;

static u32 read_tcs_reg(struct rsc_drv *drv, int reg, int tcs_id, int cmd_id)
{
	return readl_relaxed(drv->tcs_base + reg + RSC_DRV_TCS_OFFSET * tcs_id +
@@ -808,6 +810,8 @@ static int rpmh_rsc_probe(struct platform_device *pdev)
		return ret;
	}

	rpmh_standalone = (cmd_db_is_standalone() == 1);

	drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL);
	if (!drv)
		return -ENOMEM;
+18 −0
Original line number Diff line number Diff line
@@ -279,6 +279,9 @@ int rpmh_write_async(const struct device *dev, enum rpmh_state state,
	struct rpmh_ctrlr *ctrlr = get_rpmh_ctrlr(dev);
	int ret;

	if (rpmh_standalone)
		return 0;

	ret = check_ctrlr_state(ctrlr, state);
	if (ret)
		return ret;
@@ -319,6 +322,9 @@ int rpmh_write(const struct device *dev, enum rpmh_state state,
	if (!cmd || !n || n > MAX_RPMH_PAYLOAD)
		return -EINVAL;

	if (rpmh_standalone)
		return 0;

	ret = check_ctrlr_state(ctrlr, state);
	if (ret)
		return ret;
@@ -416,6 +422,9 @@ int rpmh_write_batch(const struct device *dev, enum rpmh_state state,
	if (!cmd || !n)
		return -EINVAL;

	if (rpmh_standalone)
		return 0;

	ret = check_ctrlr_state(ctrlr, state);
	if (ret)
		return ret;
@@ -496,6 +505,9 @@ int rpmh_write_pdc_data(const struct device *dev,
	if (!n || n > MAX_RPMH_PAYLOAD)
		return -EINVAL;

	if (rpmh_standalone)
		return 0;

	memcpy(rpm_msg.cmd, cmd, n * sizeof(*cmd));
	rpm_msg.msg.num_cmds = n;
	rpm_msg.msg.wait_for_compl = false;
@@ -544,6 +556,9 @@ int rpmh_flush(const struct device *dev)
	struct rpmh_ctrlr *ctrlr = get_rpmh_ctrlr(dev);
	int ret;

	if (rpmh_standalone)
		return 0;

	if (!ctrlr->dirty) {
		pr_debug("Skipping flush, TCS has latest data.\n");
		return 0;
@@ -592,6 +607,9 @@ int rpmh_invalidate(const struct device *dev)
	struct rpmh_ctrlr *ctrlr = get_rpmh_ctrlr(dev);
	int ret;

	if (rpmh_standalone)
		return 0;

	invalidate_batch(ctrlr);
	ctrlr->dirty = true;