Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
Merge commit 'bc7555383629a01fbaab2a53cf1238f105b7c21e'
Browse files Browse the repository at this point in the history
Change-Id: I40d9cb7c00a8dcdf4419af106cf1709a5be0e656
Signed-off-by: Vaisakh Murali <[email protected]>
  • Loading branch information
mvaisakh committed Mar 20, 2023
2 parents 8f18113 + bc75553 commit 3640960
Show file tree
Hide file tree
Showing 30 changed files with 1,006 additions and 18 deletions.
10 changes: 10 additions & 0 deletions techpack/audio/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ endif
ifeq ($(TARGET_SUPPORT), qrb5165)
KBUILD_OPTIONS += CONFIG_ARCH_KONA=y
endif
ifeq ($(TARGET_SUPPORT), qcs6490)
KBUILD_OPTIONS += CONFIG_ARCH_LAHAINA=y
endif

subdir-ccflags-y += -I$(AUDIO_ROOT)/include/uapi/

Expand Down Expand Up @@ -48,6 +51,13 @@ obj-m += asoc/codecs/wcd938x/
bj-m += asoc/codecs/wsa883x/
KBUILD_CFLAGS += -Wno-error
endif
ifeq ($(TARGET_SUPPORT), $(filter $(TARGET_SUPPORT), qcs6490))
obj-m += asoc/codecs/bolero/
obj-m += asoc/codecs/wcd937x/
obj-m += asoc/codecs/wcd938x/
obj-m += asoc/codecs/wsa883x/
KBUILD_CFLAGS += -Wno-error
endif
ifeq ($(TARGET_SUPPORT), sdmsteppe)
obj-m += asoc/codecs/bolero/
obj-m += asoc/codecs/wcd937x/
Expand Down
5 changes: 5 additions & 0 deletions techpack/audio/asoc/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ else
include $(AUDIO_ROOT)/config/konaauto.conf
INCS += -include $(AUDIO_ROOT)/config/konaautoconf.h
endif
ifeq ($(CONFIG_ARCH_LAHAINA), y)
include $(AUDIO_ROOT)/config/lahainaauto.conf
export
INCS += -include $(AUDIO_ROOT)/config/lahainaautoconf.h
endif
ifeq ($(CONFIG_ARCH_LITO), y)
include $(AUDIO_ROOT)/config/litoauto.conf
export
Expand Down
5 changes: 5 additions & 0 deletions techpack/audio/asoc/codecs/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ else
include $(AUDIO_ROOT)/config/konaauto.conf
INCS += -include $(AUDIO_ROOT)/config/konaautoconf.h
endif
ifeq ($(CONFIG_ARCH_LAHAINA), y)
include $(AUDIO_ROOT)/config/lahainaauto.conf
export
INCS += -include $(AUDIO_ROOT)/config/lahainaautoconf.h
endif
ifeq ($(CONFIG_ARCH_LITO), y)
include $(AUDIO_ROOT)/config/litoauto.conf
export
Expand Down
5 changes: 5 additions & 0 deletions techpack/audio/asoc/codecs/bolero/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ ifeq ($(KERNEL_BUILD), 0)
include $(AUDIO_ROOT)/config/konaauto.conf
INCS += -include $(AUDIO_ROOT)/config/konaautoconf.h
endif
ifeq ($(CONFIG_ARCH_LAHAINA), y)
include $(AUDIO_ROOT)/config/lahainaauto.conf
export
INCS += -include $(AUDIO_ROOT)/config/lahainaautoconf.h
endif
ifeq ($(CONFIG_ARCH_LITO), y)
include $(AUDIO_ROOT)/config/litoauto.conf
export
Expand Down
5 changes: 5 additions & 0 deletions techpack/audio/asoc/codecs/wcd937x/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ ifeq ($(KERNEL_BUILD), 0)
export
INCS += -include $(AUDIO_ROOT)/config/litoautoconf.h
endif
ifeq ($(CONFIG_ARCH_LAHAINA), y)
include $(AUDIO_ROOT)/config/lahainaauto.conf
export
INCS += -include $(AUDIO_ROOT)/config/lahainaautoconf.h
endif
endif

# As per target team, build is done as follows:
Expand Down
8 changes: 5 additions & 3 deletions techpack/audio/asoc/codecs/wcd937x/wcd937x.c
Original file line number Diff line number Diff line change
Expand Up @@ -1738,8 +1738,9 @@ static int wcd937x_event_notify(struct notifier_block *block,
mbhc->plug_before_ssr = mbhc->current_plug;
pr_info("%s: mbhc->plug_before_ssr=%d\n", __func__, mbhc->plug_before_ssr);
#endif /* OPLUS_ARCH_EXTENDS */
wcd937x->usbc_hs_status = get_usbc_hs_status(component,
mbhc->mbhc_cfg);
if(mbhc->mbhc_cfg)
wcd937x->usbc_hs_status = get_usbc_hs_status(component,
mbhc->mbhc_cfg);
wcd937x_mbhc_ssr_down(wcd937x->mbhc, component);
wcd937x_reset_low(wcd937x->dev);
break;
Expand All @@ -1759,7 +1760,8 @@ static int wcd937x_event_notify(struct notifier_block *block,
dev_err(component->dev, "%s: mbhc initialization failed\n",
__func__);
} else {
wcd937x_mbhc_hs_detect(component, mbhc->mbhc_cfg);
if(mbhc->mbhc_cfg)
wcd937x_mbhc_hs_detect(component, mbhc->mbhc_cfg);
if (wcd937x->usbc_hs_status)
mdelay(500);
}
Expand Down
5 changes: 5 additions & 0 deletions techpack/audio/asoc/codecs/wcd938x/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ ifeq ($(KERNEL_BUILD), 0)
export
INCS += -include $(AUDIO_ROOT)/config/litoautoconf.h
endif
ifeq ($(CONFIG_ARCH_LAHAINA), y)
include $(AUDIO_ROOT)/config/lahainaauto.conf
export
INCS += -include $(AUDIO_ROOT)/config/lahainaautoconf.h
endif

endif

Expand Down
8 changes: 5 additions & 3 deletions techpack/audio/asoc/codecs/wcd938x/wcd938x.c
Original file line number Diff line number Diff line change
Expand Up @@ -2169,8 +2169,9 @@ static int wcd938x_event_notify(struct notifier_block *block,
mbhc->plug_before_ssr = mbhc->current_plug;
pr_info("%s: mbhc->plug_before_ssr=%d\n", __func__, mbhc->plug_before_ssr);
#endif /* OPLUS_ARCH_EXTENDS */
wcd938x->usbc_hs_status = get_usbc_hs_status(component,
mbhc->mbhc_cfg);
if(mbhc->mbhc_cfg)
wcd938x->usbc_hs_status = get_usbc_hs_status(component,
mbhc->mbhc_cfg);
wcd938x_mbhc_ssr_down(wcd938x->mbhc, component);
wcd938x_reset_low(wcd938x->dev);
break;
Expand All @@ -2192,7 +2193,8 @@ static int wcd938x_event_notify(struct notifier_block *block,
dev_err(component->dev, "%s: mbhc initialization failed\n",
__func__);
} else {
wcd938x_mbhc_hs_detect(component, mbhc->mbhc_cfg);
if(mbhc->mbhc_cfg)
wcd938x_mbhc_hs_detect(component, mbhc->mbhc_cfg);
}
wcd938x->mbhc->wcd_mbhc.deinit_in_progress = false;
wcd938x->dev_up = true;
Expand Down
28 changes: 26 additions & 2 deletions techpack/audio/asoc/codecs/wsa881x-analog.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ struct wsa881x_pdata {
int clk_cnt;
int enable_cnt;
int version;
int wsa881x_id;
struct mutex bg_lock;
struct mutex res_lock;
struct delayed_work ocp_ctl_work;
Expand All @@ -91,6 +92,10 @@ enum {
WSA881X_STATUS_I2C,
};

enum {
WSA8810,
WSA8815,
};
#define WSA881X_OCP_CTL_TIMER_SEC 2
#define WSA881X_OCP_CTL_TEMP_CELSIUS 25
#define WSA881X_OCP_CTL_POLL_TIMER_SEC 60
Expand Down Expand Up @@ -119,9 +124,14 @@ static int wsa881x_i2c_addr = -1;
static int wsa881x_probing_count;
static int wsa881x_presence_count;

/* Gain value maximum of 18dBv supported on WSA8815
* and maximum of 13.5dBv on WSA8810
*/
static const char * const wsa881x_spk_pa_gain_text[] = {
"POS_13P5_DB", "POS_12_DB", "POS_10P5_DB", "POS_9_DB", "POS_7P5_DB",
"POS_6_DB", "POS_4P5_DB", "POS_3_DB", "POS_1P5_DB", "POS_0_DB"};
"POS_18_DB", "POS_16P5_DB", "POS_15_DB", "POS_13P5_DB",
"POS_12_DB", "POS_10P5_DB", "POS_9_DB", "POS_7P5_DB",
"POS_6_DB", "POS_4P5_DB", "POS_3_DB", "POS_1P5_DB",
"POS_0_DB"};

static const struct soc_enum wsa881x_spk_pa_gain_enum[] = {
SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(wsa881x_spk_pa_gain_text),
Expand Down Expand Up @@ -158,6 +168,12 @@ static int wsa881x_spk_pa_gain_put(struct snd_kcontrol *kcontrol,
__func__, ucontrol->value.integer.value[0]);
return -EINVAL;
}
if (ucontrol->value.integer.value[0] < 3 &&
wsa881x->wsa881x_id == WSA8810) {
dev_err(component->dev, "%s: Unsupported gain val %ld for WSA8810\n",
__func__, ucontrol->value.integer.value[0]);
return -EINVAL;
}
wsa881x->spk_pa_gain = ucontrol->value.integer.value[0];
dev_dbg(component->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
__func__, ucontrol->value.integer.value[0]);
Expand Down Expand Up @@ -1538,6 +1554,14 @@ static int wsa881x_i2c_probe(struct i2c_client *client,
pdata->regmap[WSA881X_DIGITAL_SLAVE],
WSA881X_DIGITAL_SLAVE);
}
pdata->wsa881x_id = wsa881x_i2c_read_device(pdata,
WSA881X_OTP_REG_0);
if (pdata->wsa881x_id & 0x01) {
pdata->wsa881x_id = WSA8815;
} else {
pdata->wsa881x_id = WSA8810;
}
pr_debug("%s: wsa881x_id : %d\n", __func__, pdata->wsa881x_id);
wsa881x_presence_count++;
wsa881x_probing_count++;

Expand Down
1 change: 1 addition & 0 deletions techpack/audio/asoc/codecs/wsa883x/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ endif
ifeq ($(KERNEL_BUILD), 0)
ifeq ($(CONFIG_ARCH_LAHAINA), y)
include $(AUDIO_ROOT)/config/lahainaauto.conf
export
INCS += -include $(AUDIO_ROOT)/config/lahainaautoconf.h
endif
ifeq ($(CONFIG_ARCH_LITO), y)
Expand Down
3 changes: 2 additions & 1 deletion techpack/audio/asoc/kona.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. All rights reserved.
*/

#include <linux/clk.h>
Expand Down Expand Up @@ -328,6 +328,7 @@ static u32 mi2s_ebit_clk[MI2S_MAX] = {
Q6AFE_LPASS_CLK_ID_PRI_MI2S_EBIT,
Q6AFE_LPASS_CLK_ID_SEC_MI2S_EBIT,
Q6AFE_LPASS_CLK_ID_TER_MI2S_EBIT,
Q6AFE_LPASS_CLK_ID_QUAD_MI2S_EBIT,
};

static struct mi2s_conf mi2s_intf_conf[MI2S_MAX];
Expand Down
2 changes: 2 additions & 0 deletions techpack/audio/asoc/lahaina.c
Original file line number Diff line number Diff line change
Expand Up @@ -8259,6 +8259,8 @@ static int msm_rx_tx_codec_init(struct snd_soc_pcm_runtime *rtd)
bolero_register_wake_irq(component, false);

if (pdata->wcd_disabled) {
bolero_set_port_map(bolero_component,
ARRAY_SIZE(sm_port_map), sm_port_map);
codec_reg_done = true;
return 0;
}
Expand Down
4 changes: 3 additions & 1 deletion techpack/audio/asoc/msm-pcm-hostless.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2011-2014, 2017-2019 The Linux Foundation. All rights reserved.
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
*/

#include <linux/init.h>
Expand All @@ -18,7 +19,8 @@ static int msm_pcm_hostless_prepare(struct snd_pcm_substream *substream)
pr_err("%s: invalid params\n", __func__);
return -EINVAL;
}
pm_qos_remove_request(&substream->latency_pm_qos_req);
if (pm_qos_request_active(&substream->latency_pm_qos_req))
pm_qos_remove_request(&substream->latency_pm_qos_req);
return 0;
}

Expand Down
39 changes: 37 additions & 2 deletions techpack/audio/asoc/msm-pcm-q6-v2.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*/
/*
* Add support for 24 and 32bit format for ASM loopback and playback session.
Expand Down Expand Up @@ -565,6 +565,8 @@ static int msm_pcm_playback_prepare(struct snd_pcm_substream *substream)
uint16_t format = 0;
uint16_t req_format = 0;
uint16_t input_file_format = 0;
int port_id = 0, copp_idx = -1;
bool found = false;

if (!component) {
pr_err("%s: component is NULL\n", __func__);
Expand Down Expand Up @@ -691,6 +693,15 @@ static int msm_pcm_playback_prepare(struct snd_pcm_substream *substream)
return ret;
}

found = msm_pcm_routing_get_portid_copp_idx(soc_prtd->dai_link->id,
SESSION_TYPE_RX, &port_id, &copp_idx);
if (found) {
q6adm_update_rtd_info(soc_prtd, port_id, copp_idx,
soc_prtd->dai_link->id, 1);
} else {
pr_err("%s: copp_idx not found\n", __func__);
}

/*Format block is configure with input file bits_per_sample*/
switch (input_file_format) {
case SNDRV_PCM_FORMAT_S32_LE:
Expand Down Expand Up @@ -1070,8 +1081,10 @@ static int msm_pcm_open(struct snd_pcm_substream *substream)
prtd->reset_event = false;
runtime->private_data = prtd;

if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
msm_adsp_init_mixer_ctl_pp_event_queue(soc_prtd);
msm_adsp_init_mixer_ctl_adm_pp_event_queue(soc_prtd);
}

/* Vote to update the Rx thread priority to RT Thread for playback */
if ((substream->stream == SNDRV_PCM_STREAM_PLAYBACK) &&
Expand Down Expand Up @@ -1189,6 +1202,8 @@ static int msm_pcm_playback_close(struct snd_pcm_substream *substream)
uint32_t timeout;
int dir = 0;
int ret = 0;
int port_id = 0, copp_idx = -1;
bool found = false;

pr_debug("%s: cmd_pending 0x%lx\n", __func__, prtd->cmd_pending);

Expand Down Expand Up @@ -1239,9 +1254,21 @@ static int msm_pcm_playback_close(struct snd_pcm_substream *substream)
prtd->audio_client);
q6asm_audio_client_free(prtd->audio_client);
}

found = msm_pcm_routing_get_portid_copp_idx(soc_prtd->dai_link->id,
SESSION_TYPE_RX, &port_id, &copp_idx);
if (found) {
q6adm_update_rtd_info(soc_prtd, port_id, copp_idx,
soc_prtd->dai_link->id, 0);
q6adm_clear_callback();
} else {
pr_err("%s: copp_idx not found\n", __func__);
}

msm_pcm_routing_dereg_phy_stream(soc_prtd->dai_link->id,
SNDRV_PCM_STREAM_PLAYBACK);
msm_adsp_clean_mixer_ctl_pp_event_queue(soc_prtd);
msm_adsp_clean_mixer_ctl_adm_pp_event_queue(soc_prtd);
kfree(prtd);
runtime->private_data = NULL;
mutex_unlock(&pdata->lock);
Expand Down Expand Up @@ -1301,6 +1328,14 @@ static int msm_pcm_capture_copy(struct snd_pcm_substream *substream,
xfer = size;
offset = prtd->in_frame_info[idx].offset;
pr_debug("Offset value = %d\n", offset);

if (offset >= size) {
pr_err("%s: Invalid dsp buf offset\n", __func__);
ret = -EFAULT;
q6asm_cpu_buf_release(OUT, prtd->audio_client);
goto fail;
}

if (size == 0 || size < prtd->pcm_count) {
memset(bufptr + offset + size, 0, prtd->pcm_count - size);
if (fbytes > prtd->pcm_count)
Expand Down
Loading

0 comments on commit 3640960

Please sign in to comment.