mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-13 08:07:32 -04:00
drivers: qcom: rpmh: Add standalone mode support for RPMH
Allow RPMH requests to succeed even when the always-On subsystem is not available. In standalone mode, requests are never sent to the TCS mailbox driver. The command DB provides the information to make the decision to run in standalone mode or not. Change-Id: Ia2bc5024da0d7e6607347b1a481b2feb9584059a Signed-off-by: Lina Iyer <ilina@codeaurora.org>
This commit is contained in:
parent
340f786f9b
commit
1ef26f82e1
3 changed files with 30 additions and 0 deletions
|
|
@ -109,6 +109,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);
|
||||
|
|
|
|||
|
|
@ -75,6 +75,8 @@ static const char * const accl_str[] = {
|
|||
static struct rsc_drv *__rsc_drv[2];
|
||||
static int __rsc_count;
|
||||
|
||||
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 +
|
||||
|
|
@ -846,6 +848,11 @@ static int rpmh_rsc_probe(struct platform_device *pdev)
|
|||
return ret;
|
||||
}
|
||||
|
||||
rpmh_standalone = cmd_db_is_standalone();
|
||||
if (rpmh_standalone)
|
||||
dev_info(&pdev->dev, "RPMH is running in standalone mode.\n");
|
||||
|
||||
|
||||
drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL);
|
||||
if (!drv)
|
||||
return -ENOMEM;
|
||||
|
|
|
|||
|
|
@ -270,6 +270,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;
|
||||
|
|
@ -310,6 +313,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;
|
||||
|
|
@ -408,6 +414,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;
|
||||
|
|
@ -494,6 +503,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;
|
||||
|
|
@ -542,6 +554,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;
|
||||
|
|
@ -590,6 +605,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;
|
||||
|
||||
|
|
@ -610,6 +628,9 @@ int rpmh_ctrlr_idle(const struct device *dev)
|
|||
{
|
||||
struct rpmh_ctrlr *ctrlr = get_rpmh_ctrlr(dev);
|
||||
|
||||
if (rpmh_standalone)
|
||||
return 0;
|
||||
|
||||
return rpmh_rsc_ctrlr_is_idle(ctrlr_to_drv(ctrlr));
|
||||
}
|
||||
EXPORT_SYMBOL(rpmh_ctrlr_idle);
|
||||
|
|
|
|||
Loading…
Reference in a new issue