Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.

Commit

Permalink
Techpack: audio: Remove pm_qos usage for sdm660
Browse files Browse the repository at this point in the history
[Divyanshu-Modi: adapt for 4.19]
Signed-off-by: Divyanshu-Modi <divyan.m05@gmail.com>
  • Loading branch information
D3nesyan authored and Divyanshu-Modi committed Oct 24, 2021
1 parent c4b9de8 commit ca2ba0a
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 105 deletions.
59 changes: 0 additions & 59 deletions techpack/audio/asoc/sdm660-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

#define DEV_NAME_STR_LEN 32
#define DEFAULT_MCLK_RATE 9600000
#define MSM_LL_QOS_VALUE 300 /* time in us to ensure LPM doesn't go in C3/C4 */

enum {
DP_RX_IDX,
Expand Down Expand Up @@ -331,7 +330,6 @@ static char const *usb_sample_rate_text[] = {"KHZ_8", "KHZ_11P025",
static char const *ext_disp_bit_format_text[] = {"S16_LE", "S24_LE"};
static char const *ext_disp_sample_rate_text[] = {"KHZ_48", "KHZ_96",
"KHZ_192"};
static const char *const qos_text[] = {"Disable", "Enable"};

static SOC_ENUM_SINGLE_EXT_DECL(ext_disp_rx_chs, ch_text);
static SOC_ENUM_SINGLE_EXT_DECL(proxy_rx_chs, ch_text);
Expand Down Expand Up @@ -392,9 +390,6 @@ static SOC_ENUM_SINGLE_EXT_DECL(tdm_rx_format, tdm_bit_format_text);
static SOC_ENUM_SINGLE_EXT_DECL(tdm_rx_sample_rate, tdm_sample_rate_text);
static SOC_ENUM_SINGLE_EXT_DECL(tdm_slot_num, tdm_slot_num_text);
static SOC_ENUM_SINGLE_EXT_DECL(tdm_slot_width, tdm_slot_width_text);
static SOC_ENUM_SINGLE_EXT_DECL(qos_vote, qos_text);

static int qos_vote_status;

static struct afe_clk_set mi2s_clk[MI2S_MAX] = {
{
Expand Down Expand Up @@ -2915,58 +2910,6 @@ static int ext_disp_rx_sample_rate_put(struct snd_kcontrol *kcontrol,
return 0;
}

static int msm_qos_ctl_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
ucontrol->value.enumerated.item[0] = qos_vote_status;

return 0;
}

static int msm_qos_ctl_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_component *component =
snd_soc_kcontrol_component(kcontrol);
struct snd_soc_card *card = component->card;
const char *fe_name = MSM_DAILINK_NAME(LowLatency);
struct snd_soc_pcm_runtime *rtd;
struct snd_pcm_substream *substream;
s32 usecs;

rtd = snd_soc_get_pcm_runtime(card, fe_name);
if (!rtd) {
pr_err("%s: fail to get pcm runtime for %s\n",
__func__, fe_name);
return -EINVAL;
}

substream = rtd->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream;
if (!substream) {
pr_err("%s: substream is null\n", __func__);
return -EINVAL;
}

qos_vote_status = ucontrol->value.enumerated.item[0];
if (qos_vote_status) {
if (pm_qos_request_active(&substream->latency_pm_qos_req))
pm_qos_remove_request(&substream->latency_pm_qos_req);
if (!substream->runtime) {
pr_err("%s: runtime is null\n", __func__);
return -EINVAL;
}
usecs = MSM_LL_QOS_VALUE;
if (usecs >= 0)
pm_qos_add_request(&substream->latency_pm_qos_req,
PM_QOS_CPU_DMA_LATENCY, usecs);
} else {
if (pm_qos_request_active(&substream->latency_pm_qos_req))
pm_qos_remove_request(&substream->latency_pm_qos_req);
}

return 0;
}

const struct snd_kcontrol_new msm_common_snd_controls[] = {
SOC_ENUM_EXT("PROXY_RX Channels", proxy_rx_chs,
proxy_rx_ch_get, proxy_rx_ch_put),
Expand Down Expand Up @@ -3451,8 +3394,6 @@ const struct snd_kcontrol_new msm_common_snd_controls[] = {
SOC_SINGLE_MULTI_EXT("QUIN_TDM_TX_7 SlotMapping",
SND_SOC_NOPM, 0, 0xFFFF, 0, TDM_SLOT_OFFSET_MAX,
tdm_tx_slot_mapping_get, tdm_tx_slot_mapping_put),
SOC_ENUM_EXT("MultiMedia5_RX QOS Vote", qos_vote, msm_qos_ctl_get,
msm_qos_ctl_put),
};

/**
Expand Down
23 changes: 0 additions & 23 deletions techpack/audio/asoc/sdm660-ext-dai-links.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@
#include <asoc/sdm660-external.h>
#include <asoc/core.h>
#include "codecs/wcd9335.h"
#include <linux/pm_qos.h>

#define DEV_NAME_STR_LEN 32
#define __CHIPSET__ "SDM660 "
#define MSM_DAILINK_NAME(name) (__CHIPSET__#name)

#define WCN_CDC_SLIM_RX_CH_MAX 2
#define WCN_CDC_SLIM_TX_CH_MAX 3
#define MSM_LL_QOS_VALUE 300 /* time in us to ensure LPM doesn't go in C3/C4 */

static struct snd_soc_card snd_soc_card_msm_card_tavil = {
.name = "sdm670-tavil-snd-card",
Expand Down Expand Up @@ -111,25 +109,6 @@ static struct snd_soc_ops msm_wcn_ops = {
.hw_params = msm_wcn_hw_params,
};

static int msm_fe_qos_prepare(struct snd_pcm_substream *substream)
{
if (pm_qos_request_active(&substream->latency_pm_qos_req))
pm_qos_remove_request(&substream->latency_pm_qos_req);

substream->latency_pm_qos_req.cpus_affine = BIT(1) | BIT(2);

substream->latency_pm_qos_req.type = PM_QOS_REQ_AFFINE_CORES;

pm_qos_add_request(&substream->latency_pm_qos_req,
PM_QOS_CPU_DMA_LATENCY,
MSM_LL_QOS_VALUE);
return 0;
}

static struct snd_soc_ops msm_fe_qos_ops = {
.prepare = msm_fe_qos_prepare,
};

static struct snd_soc_dai_link msm_ext_tasha_fe_dai[] = {
/* tasha_vifeedback for speaker protection */
{
Expand Down Expand Up @@ -836,7 +815,6 @@ static struct snd_soc_dai_link msm_ext_common_fe_dai[] = {
/* this dai link has playback support */
.ignore_pmdown_time = 1,
.id = MSM_FRONTEND_DAI_MULTIMEDIA5,
.ops = &msm_fe_qos_ops,
},
/* LSM FE */
{/* hw:x,14 */
Expand Down Expand Up @@ -904,7 +882,6 @@ static struct snd_soc_dai_link msm_ext_common_fe_dai[] = {
.ignore_pmdown_time = 1,
/* this dai link has playback support */
.id = MSM_FRONTEND_DAI_MULTIMEDIA8,
.ops = &msm_fe_qos_ops,
},
{/* hw:x,18 */
.name = "HDMI_RX_HOSTLESS",
Expand Down
24 changes: 1 addition & 23 deletions techpack/audio/asoc/sdm660-internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "codecs/sdm660_cdc/msm-digital-cdc.h"
#include "codecs/sdm660_cdc/msm-analog-cdc.h"
#include "codecs/msm_sdw/msm_sdw.h"
#include <linux/pm_qos.h>

#define __CHIPSET__ "SDM660 "
#define MSM_DAILINK_NAME(name) (__CHIPSET__#name)
Expand All @@ -25,7 +24,7 @@

#define WSA8810_NAME_1 "wsa881x.20170211"
#define WSA8810_NAME_2 "wsa881x.20170212"
#define MSM_LL_QOS_VALUE 300 /* time in us to ensure LPM doesn't go in C3/C4 */

enum {
INT0_MI2S = 0,
INT1_MI2S,
Expand Down Expand Up @@ -1505,25 +1504,6 @@ static struct snd_soc_ops msm_sdw_mi2s_be_ops = {
.shutdown = msm_sdw_mi2s_snd_shutdown,
};

static int msm_fe_qos_prepare(struct snd_pcm_substream *substream)
{
if (pm_qos_request_active(&substream->latency_pm_qos_req))
pm_qos_remove_request(&substream->latency_pm_qos_req);

substream->latency_pm_qos_req.cpus_affine = BIT(1) | BIT(2);

substream->latency_pm_qos_req.type = PM_QOS_REQ_AFFINE_CORES;

pm_qos_add_request(&substream->latency_pm_qos_req,
PM_QOS_CPU_DMA_LATENCY,
MSM_LL_QOS_VALUE);
return 0;
}

static struct snd_soc_ops msm_fe_qos_ops = {
.prepare = msm_fe_qos_prepare,
};

struct snd_soc_dai_link_component dlc_rx1[] = {
{
.of_node = NULL,
Expand Down Expand Up @@ -1779,7 +1759,6 @@ static struct snd_soc_dai_link msm_int_dai[] = {
/* this dai link has playback support */
.ignore_pmdown_time = 1,
.id = MSM_FRONTEND_DAI_MULTIMEDIA5,
.ops = &msm_fe_qos_ops,
},
/* LSM FE */
{/* hw:x,14 */
Expand Down Expand Up @@ -1846,7 +1825,6 @@ static struct snd_soc_dai_link msm_int_dai[] = {
.ignore_pmdown_time = 1,
/* this dai link has playback support */
.id = MSM_FRONTEND_DAI_MULTIMEDIA8,
.ops = &msm_fe_qos_ops,
},
{/* hw:x,18 */
.name = "HDMI_RX_HOSTLESS",
Expand Down

0 comments on commit ca2ba0a

Please sign in to comment.