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

Commit 4a8655fb authored by Lina Iyer's avatar Lina Iyer
Browse files

drivers: qcom: rpmh: export controller status



Query the TCS mailbox driver to see if the driver and hardware are busy
handling RPMH requests or waiting for responses.

Change-Id: I2afca68776387b79447034f6554a683cb4df3cf1
Signed-off-by: default avatarLina Iyer <ilina@codeaurora.org>
parent 1996ec83
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -844,6 +844,28 @@ int rpmh_read(struct rpmh_client *rc, u32 addr, u32 *resp)
}
EXPORT_SYMBOL(rpmh_read);

/**
 * rpmh_ctrlr_idle: Check if the controller is idle
 *
 * @rc: The RPMH handle got from rpmh_get_dev_channel
 *
 * Returns if the controller is idle or not.
 */
int rpmh_ctrlr_idle(struct rpmh_client *rc)
{
	if (IS_ERR_OR_NULL(rc))
		return -EINVAL;

	if (rpmh_standalone)
		return 0;

	if (!mbox_controller_is_idle(rc->chan))
		return -EBUSY;

	return 0;
}
EXPORT_SYMBOL(rpmh_ctrlr_idle);

static inline int is_req_valid(struct rpmh_req *req)
{
	return (req->sleep_val != UINT_MAX && req->wake_val != UINT_MAX
+5 −0
Original line number Diff line number Diff line
@@ -40,6 +40,8 @@ int rpmh_write_control(struct rpmh_client *rc, struct tcs_cmd *cmd, int n);

int rpmh_invalidate(struct rpmh_client *rc);

int rpmh_ctrlr_idle(struct rpmh_client *rc);

int rpmh_flush(struct rpmh_client *rc);

int rpmh_read(struct rpmh_client *rc, u32 addr, u32 *resp);
@@ -82,6 +84,9 @@ static inline int rpmh_write_control(struct rpmh_client *rc,
static inline int rpmh_invalidate(struct rpmh_client *rc)
{ return -ENODEV; }

static inline int rpmh_ctrlr_idle(struct rpmh_client *rc)
{ return -ENODEV; }

static inline int rpmh_flush(struct rpmh_client *rc)
{ return -ENODEV; }