mirror of
https://github.com/torvalds/linux.git
synced 2026-08-01 20:22:08 +02: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> Signed-off-by: Maulik Shah <quic_mkshah@quicinc.com>
This commit is contained in:
parent
f1cbc5124a
commit
08c5639165
|
|
@ -131,6 +131,8 @@ struct rsc_drv {
|
|||
struct rpmh_ctrlr client;
|
||||
};
|
||||
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@ static const char * const accl_str[] = {
|
|||
|
||||
static struct rsc_drv *__rsc_drv[MAX_RSC_COUNT];
|
||||
static int __rsc_count;
|
||||
bool rpmh_standalone;
|
||||
|
||||
/*
|
||||
* Here's a high level overview of how all the registers in RPMH work
|
||||
|
|
@ -1074,6 +1075,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;
|
||||
|
|
|
|||
|
|
@ -249,6 +249,9 @@ int rpmh_write_async(const struct device *dev, enum rpmh_state state,
|
|||
struct rpmh_request *rpm_msg;
|
||||
int ret;
|
||||
|
||||
if (rpmh_standalone)
|
||||
return 0;
|
||||
|
||||
ret = check_ctrlr_state(ctrlr, state);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
|
@ -286,6 +289,9 @@ int rpmh_write(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;
|
||||
|
|
@ -368,6 +374,9 @@ int rpmh_write_batch(const struct device *dev, enum rpmh_state state,
|
|||
int ret, i;
|
||||
void *ptr;
|
||||
|
||||
if (rpmh_standalone)
|
||||
return 0;
|
||||
|
||||
ret = check_ctrlr_state(ctrlr, state);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
|
@ -472,6 +481,9 @@ int rpmh_flush(struct rpmh_ctrlr *ctrlr)
|
|||
struct cache_req *p;
|
||||
int ret = 0;
|
||||
|
||||
if (rpmh_standalone)
|
||||
return 0;
|
||||
|
||||
lockdep_assert_irqs_disabled();
|
||||
|
||||
/*
|
||||
|
|
@ -531,6 +543,9 @@ void rpmh_invalidate(const struct device *dev)
|
|||
struct batch_cache_req *req, *tmp;
|
||||
unsigned long flags;
|
||||
|
||||
if (rpmh_standalone)
|
||||
return;
|
||||
|
||||
spin_lock_irqsave(&ctrlr->cache_lock, flags);
|
||||
list_for_each_entry_safe(req, tmp, &ctrlr->batch_cache, list)
|
||||
kfree(req);
|
||||
|
|
@ -555,6 +570,9 @@ int rpmh_mode_solver_set(const struct device *dev, bool enable)
|
|||
int ret;
|
||||
struct rpmh_ctrlr *ctrlr = get_rpmh_ctrlr(dev);
|
||||
|
||||
if (rpmh_standalone)
|
||||
return 0;
|
||||
|
||||
spin_lock(&ctrlr->cache_lock);
|
||||
ret = rpmh_rsc_mode_solver_set(ctrlr_to_drv(ctrlr), enable);
|
||||
if (!ret)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user