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

Commit 0f03d92f authored by Lina Iyer's avatar Lina Iyer
Browse files

drivers: qcom: rpmh: write PDC data



In addition to requests that are send to the remote processor, the
controller may allow certain data to be written to the controller for
use in specific cases like wakeup value when entering idle states.
Allow a pass through to write PDC data.

Change-Id: I00d8875c2aa7d7f2a12543e40b14dd7f8f51cb12
Signed-off-by: default avatarLina Iyer <ilina@codeaurora.org>
Signed-off-by: default avatarRaju P.L.S.S.S.N <rplsssn@codeaurora.org>
parent a8ccd462
Loading
Loading
Loading
Loading
+28 −0
Original line number Diff line number Diff line
@@ -472,6 +472,34 @@ int rpmh_write_batch(const struct device *dev, enum rpmh_state state,
}
EXPORT_SYMBOL(rpmh_write_batch);

/**
 * rpmh_write_pdc_data: Write PDC data to the controller
 *
 * @dev: the device making the request
 * @cmd: The payload data
 * @n: The number of elements in payload
 *
 * Write PDC data to the controller. The messages are always sent async.
 *
 * May be called from atomic contexts.
 */
int rpmh_write_pdc_data(const struct device *dev,
			const struct tcs_cmd *cmd, u32 n)
{
	DEFINE_RPMH_MSG_ONSTACK(dev, 0, NULL, rpm_msg);
	struct rpmh_ctrlr *ctrlr = get_rpmh_ctrlr(dev);

	if (!n || n > MAX_RPMH_PAYLOAD)
		return -EINVAL;

	memcpy(rpm_msg.cmd, cmd, n * sizeof(*cmd));
	rpm_msg.msg.num_cmds = n;
	rpm_msg.msg.wait_for_compl = false;

	return rpmh_rsc_write_pdc_data(ctrlr_to_drv(ctrlr), &rpm_msg.msg);
}
EXPORT_SYMBOL(rpmh_write_pdc_data);

static int is_req_valid(struct cache_req *req)
{
	return (req->sleep_val != UINT_MAX &&
+6 −0
Original line number Diff line number Diff line
@@ -28,6 +28,9 @@ int rpmh_ctrlr_idle(const struct device *dev);

int rpmh_mode_solver_set(const struct device *dev, bool enable);

int rpmh_write_pdc_data(const struct device *dev,
			const struct tcs_cmd *cmd, u32 n);

#else

static inline int rpmh_write(const struct device *dev, enum rpmh_state state,
@@ -56,6 +59,9 @@ static inline int rpmh_ctrlr_idle(const struct device *dev)
static inline int rpmh_mode_solver_set(const struct device *dev, bool enable)
{ return -ENODEV; }

static inline int rpmh_write_pdc_data(const struct device *dev,
				      const struct tcs_cmd *cmd, u32 n)
{ return -ENODEV; }
#endif /* CONFIG_QCOM_RPMH */

#endif /* __SOC_QCOM_RPMH_H__ */