summaryrefslogtreecommitdiff
path: root/gxp-debugfs.c
diff options
context:
space:
mode:
authorNeela Chithirala <chithiralan@google.com>2022-03-14 05:24:14 +0000
committerNeela Chithirala <chithiralan@google.com>2022-03-14 05:24:14 +0000
commit8f54b9374e56fd08f990fe2fe4dc8b3bde1c00d2 (patch)
tree241cb59b01b6985fba593e162c85bc14050ed1b1 /gxp-debugfs.c
parent6d71338807ebff13916d2285d67ce59f261eab3e (diff)
downloadgs201-8f54b9374e56fd08f990fe2fe4dc8b3bde1c00d2.tar.gz
Merge branch 'gs201-release' to android13-gs-pixel-5.10
* gs201-release: gxp: ignore AUR_OFF in power voting Bug: 223286553 gxp: change memory power state asynchronously Bug: 221187219 gxp: cancel the vote when the client is destroyed Bug: 201600514 gxp: refactor pm interface Bug: 201600514 gxp: Make a power state vote for debugfs wakelocks Bug: 223286553 gxp: Return error if gxp_vd_allocate() fails Signed-off-by: Neela Chithirala <chithiralan@google.com> Change-Id: Ibb879ffffa83e787409debec4e5e55bfe8858808
Diffstat (limited to 'gxp-debugfs.c')
-rw-r--r--gxp-debugfs.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/gxp-debugfs.c b/gxp-debugfs.c
index 0576c9a..480dca2 100644
--- a/gxp-debugfs.c
+++ b/gxp-debugfs.c
@@ -148,15 +148,16 @@ static int gxp_firmware_run_set(void *data, u64 val)
if (IS_ERR(gxp->debugfs_client->vd)) {
dev_err(gxp->dev, "Failed to allocate VD\n");
ret = PTR_ERR(gxp->debugfs_client->vd);
- goto err_start;
+ goto err_wakelock;
}
ret = gxp_wakelock_acquire(gxp);
if (ret) {
dev_err(gxp->dev, "Failed to acquire BLOCK wakelock\n");
- goto err_start;
+ goto err_wakelock;
}
gxp->debugfs_client->has_block_wakelock = true;
+ gxp_pm_update_requested_power_state(gxp, AUR_OFF, AUR_UUD);
down_write(&gxp->vd_semaphore);
ret = gxp_vd_start(gxp->debugfs_client->vd);
@@ -179,6 +180,7 @@ static int gxp_firmware_run_set(void *data, u64 val)
*/
gxp_client_destroy(gxp->debugfs_client);
gxp->debugfs_client = NULL;
+ gxp_pm_update_requested_power_state(gxp, AUR_UUD, AUR_OFF);
}
out:
@@ -187,6 +189,9 @@ out:
return ret;
err_start:
+ gxp_wakelock_release(gxp);
+ gxp_pm_update_requested_power_state(gxp, AUR_UUD, AUR_OFF);
+err_wakelock:
/* Destroying a client cleans up any VDss or wakelocks it held. */
gxp_client_destroy(gxp->debugfs_client);
gxp->debugfs_client = NULL;
@@ -210,32 +215,42 @@ static int gxp_wakelock_set(void *data, u64 val)
struct gxp_dev *gxp = (struct gxp_dev *)data;
int ret = 0;
+ mutex_lock(&gxp->debugfs_client_lock);
+
if (val > 0) {
/* Wakelock Acquire */
if (gxp->debugfs_wakelock_held) {
dev_warn(gxp->dev,
"Debugfs wakelock is already held.\n");
- return -EBUSY;
+ ret = -EBUSY;
+ goto out;
}
ret = gxp_wakelock_acquire(gxp);
- if (ret)
+ if (ret) {
dev_err(gxp->dev,
"Failed to acquire debugfs wakelock ret=%d\n",
ret);
- else
- gxp->debugfs_wakelock_held = true;
+ goto out;
+ }
+ gxp->debugfs_wakelock_held = true;
+ gxp_pm_update_requested_power_state(gxp, AUR_OFF, AUR_UUD);
} else {
/* Wakelock Release */
if (!gxp->debugfs_wakelock_held) {
dev_warn(gxp->dev, "Debugfs wakelock not held.\n");
- return -EIO;
+ ret = -EIO;
+ goto out;
}
gxp_wakelock_release(gxp);
gxp->debugfs_wakelock_held = false;
+ gxp_pm_update_requested_power_state(gxp, AUR_UUD, AUR_OFF);
}
+out:
+ mutex_unlock(&gxp->debugfs_client_lock);
+
return ret;
}