|
@@ -1,7 +1,7 @@
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
|
|
/*
|
|
|
* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
|
|
|
- * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
|
|
+ * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
|
|
|
*/
|
|
|
|
|
|
#include <linux/gpio.h>
|
|
@@ -94,6 +94,7 @@ static const struct snd_pcm_hardware dummy_dma_hardware = {
|
|
|
#define MAX_CPU_CLUSTER 4 /* Silver, Gold, T, Prime */
|
|
|
|
|
|
static int qos_vote_status;
|
|
|
+static uint8_t cpu_vote_mask;
|
|
|
static bool lpi_pcm_logging_enable;
|
|
|
static bool vote_against_sleep_enable;
|
|
|
static unsigned int vote_against_sleep_cnt;
|
|
@@ -648,11 +649,13 @@ static void msm_audio_add_qos_request(void)
|
|
|
&msm_audio_req[cpu],
|
|
|
DEV_PM_QOS_RESUME_LATENCY,
|
|
|
PM_QOS_CPU_LATENCY_DEFAULT_VALUE);
|
|
|
- if (ret < 0)
|
|
|
+ if (ret < 0) {
|
|
|
pr_err("%s error (%d) adding resume latency to cpu %d.\n",
|
|
|
__func__, ret, cpu);
|
|
|
- pr_debug("%s set cpu affinity to logical core %d.\n", __func__, cpu);
|
|
|
-
|
|
|
+ } else {
|
|
|
+ cpu_vote_mask |= (1 << cpu);
|
|
|
+ pr_debug("%s set cpu affinity to logical core %d.\n", __func__, cpu);
|
|
|
+ }
|
|
|
/* Limit the request to 2 silver cpu cores. */
|
|
|
if (++num_req == 2)
|
|
|
break;
|
|
@@ -663,14 +666,21 @@ static void msm_audio_remove_qos_request(void)
|
|
|
{
|
|
|
int cpu = 0;
|
|
|
int ret = 0;
|
|
|
+ uint8_t cpu_bit = 0;
|
|
|
cpumask_t *cluster_cpu_mask = NULL;
|
|
|
|
|
|
cluster_cpu_mask = topology_core_cpumask(cluster_first_cpu[0]);
|
|
|
|
|
|
if (msm_audio_req) {
|
|
|
for_each_cpu(cpu, cluster_cpu_mask) {
|
|
|
- ret = dev_pm_qos_remove_request(
|
|
|
- &msm_audio_req[cpu]);
|
|
|
+ cpu_bit = 1 << cpu;
|
|
|
+ if (cpu_bit & cpu_vote_mask) {
|
|
|
+ ret = dev_pm_qos_remove_request(
|
|
|
+ &msm_audio_req[cpu]);
|
|
|
+ cpu_vote_mask &= ~cpu_bit;
|
|
|
+ } else
|
|
|
+ pr_debug("%s: core %d not voted.\n",
|
|
|
+ __func__, cpu);
|
|
|
if (ret < 0)
|
|
|
pr_err("%s error (%d) removing request from cpu %d.\n",
|
|
|
__func__, ret, cpu);
|
|
@@ -957,6 +967,7 @@ void msm_common_get_backend_name(const char *stream_name, char **backend_name)
|
|
|
static void msm_audio_update_qos_request(u32 latency)
|
|
|
{
|
|
|
int cpu = 0;
|
|
|
+ uint8_t cpu_bit = 0;
|
|
|
int ret = -1;
|
|
|
int num_req = 0;
|
|
|
cpumask_t *cluster_cpu_mask = NULL;
|
|
@@ -965,8 +976,13 @@ static void msm_audio_update_qos_request(u32 latency)
|
|
|
|
|
|
if (msm_audio_req) {
|
|
|
for_each_cpu(cpu, cluster_cpu_mask) {
|
|
|
- ret = dev_pm_qos_update_request(
|
|
|
- &msm_audio_req[cpu], latency);
|
|
|
+ cpu_bit = 1 << cpu;
|
|
|
+ if (cpu_bit & cpu_vote_mask)
|
|
|
+ ret = dev_pm_qos_update_request(
|
|
|
+ &msm_audio_req[cpu], latency);
|
|
|
+ else
|
|
|
+ pr_debug("%s: core %d not voted.\n",
|
|
|
+ __func__, cpu);
|
|
|
if (1 == ret ) {
|
|
|
pr_debug("%s: updated latency of core %d to %u.\n",
|
|
|
__func__, cpu, latency);
|