summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlinyuny <linyuny@google.com>2023-08-01 03:29:23 +0000
committerlinyuny <linyuny@google.com>2023-11-27 23:28:50 +0000
commit1e5415d323a6f485a477f0296b5eb4e6463d4c87 (patch)
treee2a837f19b102735dc3cdfb4add3378abe2fa224
parent91ad6953bf05ee72c3d2fdfa1ae816406489f29c (diff)
downloadlwis-1e5415d323a6f485a477f0296b5eb4e6463d4c87.tar.gz
QOS update with new interface lwis_qos_setting_v3 via qos_family_name.
For backward compatibility, we keep the family_name and use it for qos update. But for new socs, we do qos update via qos_family_name. Bug: 308976572 Change-Id: I0047261ee5da293e7425782a5acc13dd472ce279 Signed-off-by: linyuny <linyuny@google.com>
-rw-r--r--lwis_device_dpm.c59
1 files changed, 43 insertions, 16 deletions
diff --git a/lwis_device_dpm.c b/lwis_device_dpm.c
index e0e8598..982949d 100644
--- a/lwis_device_dpm.c
+++ b/lwis_device_dpm.c
@@ -36,7 +36,8 @@ static int find_bts_block(struct lwis_device *lwis_dev, struct lwis_device *targ
int i;
if (strcmp(qos_setting->bts_block_name, "") == 0) {
- if (target_dev->bts_block_num != 1) {
+ if (target_dev->bts_block_num != 1 ||
+ target_dev->bts_block_names[0] != target_dev->name) {
dev_err(lwis_dev->dev,
"Device %s has %d bts blocks but no block name specified in qos setting\n",
target_dev->name, target_dev->bts_block_num);
@@ -57,28 +58,18 @@ static int find_bts_block(struct lwis_device *lwis_dev, struct lwis_device *targ
}
/*
- * lwis_dpm_update_qos: update qos requirement for lwis device.
+ * lwis_dpm_update_qos_with_clock_family: update qos requirement for lwis device with
+ * clock family (will deprecate soon).
*/
-int lwis_dpm_update_qos(struct lwis_device *lwis_dev, struct lwis_qos_setting_v3 *qos_setting)
+static int lwis_dpm_update_qos_with_clock_family(struct lwis_device *lwis_dev,
+ struct lwis_device *target_dev,
+ struct lwis_qos_setting_v3 *qos_setting)
{
int ret = 0, bts_block = -1;
int64_t peak_bw = 0;
int64_t read_bw = 0;
int64_t write_bw = 0;
int64_t rt_bw = 0;
- struct lwis_device *target_dev = lwis_find_dev_by_id(qos_setting->device_id);
- if (!target_dev) {
- dev_err(lwis_dev->dev, "Can't find device by id: %d\n", qos_setting->device_id);
- return -ENOENT;
- }
-
- /* b/190270885 : We see some ramdump issues due to dpm qos updates
- * when device is disabled. We might disallow to update qos on this case.
- */
- if (target_dev->enabled == 0 && target_dev->type != DEVICE_TYPE_DPM) {
- dev_warn(target_dev->dev, "%s disabled, no need to update qos\n", target_dev->name);
- return -EPERM;
- }
switch (qos_setting->clock_family) {
case CLOCK_FAMILY_MIF:
@@ -136,6 +127,42 @@ int lwis_dpm_update_qos(struct lwis_device *lwis_dev, struct lwis_qos_setting_v3
}
/*
+ * lwis_dpm_update_qos: update qos requirement for lwis device.
+ */
+int lwis_dpm_update_qos(struct lwis_device *lwis_dev, struct lwis_qos_setting_v3 *qos_setting)
+{
+ int ret = 0;
+ struct lwis_device *target_dev = lwis_find_dev_by_id(qos_setting->device_id);
+ if (!target_dev) {
+ dev_err(lwis_dev->dev, "Can't find device by id: %d\n", qos_setting->device_id);
+ return -ENOENT;
+ }
+
+ /* b/190270885 : We see some ramdump issues due to dpm qos updates
+ * when device is disabled. We might disallow to update qos on this case.
+ */
+ if (target_dev->enabled == 0 && target_dev->type != DEVICE_TYPE_DPM) {
+ dev_warn(target_dev->dev, "%s disabled, no need to update qos\n", target_dev->name);
+ return -EPERM;
+ }
+
+ // TODO: Real qos_family_name implementation will be done in b/291854347
+ // As for qos update, either of qos_family_name or clock_family need set.
+ if (strlen(qos_setting->qos_family_name) > 0) {
+ // (TODO: linyuny) Platform Related stuff will be separated into the following CL.
+ ret = 0;
+ } else if (qos_setting->clock_family != -1) {
+ ret = lwis_dpm_update_qos_with_clock_family(lwis_dev, target_dev, qos_setting);
+ } else {
+ dev_err(lwis_dev->dev, "Invalid clock family name and clock family %d\n",
+ qos_setting->clock_family);
+ ret = -EINVAL;
+ }
+
+ return ret;
+}
+
+/*
* lwis_dpm_update_clock: update specific clock settings to lwis device.
*/
int lwis_dpm_update_clock(struct lwis_device *lwis_dev, struct lwis_clk_setting *clk_settings,