bluetooth: add QDSP6 internal BT-SCO audio routing, fix A2DP/HSP-HFP profile handling, and add in-call Bluetooth route

This commit is contained in:
Luxferre committed 2026-11-04 13:34:18 +02:00
1 parent 02ce3ab1f4
commit b2ade2dc42
70 files changed
+1182 -97

No files matched your search

@@ -0,0 +1,623 @@
--- a/include/dt-bindings/sound/qcom,q6dsp-lpass-ports.h
+++ b/include/dt-bindings/sound/qcom,q6dsp-lpass-ports.h
@@ -139,6 +139,8 @@
#define DISPLAY_PORT_RX_5 133
#define DISPLAY_PORT_RX_6 134
#define DISPLAY_PORT_RX_7 135
+#define INTERNAL_BT_SCO_RX 136
+#define INTERNAL_BT_SCO_TX 137
#define LPASS_CLK_ID_PRI_MI2S_IBIT 1
#define LPASS_CLK_ID_PRI_MI2S_EBIT 2
--- a/sound/soc/qcom/qdsp6/q6afe.h
+++ b/sound/soc/qcom/qdsp6/q6afe.h
@@ -3,7 +3,7 @@
#ifndef __Q6AFE_H__
#define __Q6AFE_H__
-#define AFE_PORT_MAX 129
+#define AFE_PORT_MAX 138
#define MSM_AFE_PORT_TYPE_RX 0
#define MSM_AFE_PORT_TYPE_TX 1
@@ -203,6 +203,11 @@
u16 active_channels_mask;
};
+struct q6afe_bt_fm_cfg {
+ u32 sample_rate;
+ u16 bit_width;
+ u16 num_channels;
+};
struct q6afe_port_config {
struct q6afe_hdmi_cfg hdmi;
@@ -210,6 +215,7 @@
struct q6afe_i2s_cfg i2s_cfg;
struct q6afe_tdm_cfg tdm;
struct q6afe_cdc_dma_cfg dma_cfg;
+ struct q6afe_bt_fm_cfg bt_fm_cfg;
};
struct q6afe_port;
@@ -227,6 +233,8 @@
void q6afe_tdm_port_prepare(struct q6afe_port *port, struct q6afe_tdm_cfg *cfg);
void q6afe_cdc_dma_port_prepare(struct q6afe_port *port,
struct q6afe_cdc_dma_cfg *cfg);
+void q6afe_bt_fm_port_prepare(struct q6afe_port *port,
+ struct q6afe_bt_fm_cfg *cfg);
int q6afe_port_set_sysclk(struct q6afe_port *port, int clk_id,
int clk_src, int clk_root,
--- a/sound/soc/qcom/qdsp6/q6afe.c
+++ b/sound/soc/qcom/qdsp6/q6afe.c
@@ -44,6 +44,8 @@
#define AFE_PARAM_ID_TDM_CONFIG 0x0001029D
#define AFE_PARAM_ID_PORT_SLOT_MAPPING_CONFIG 0x00010297
#define AFE_PARAM_ID_CODEC_DMA_CONFIG 0x000102B8
+#define AFE_PARAM_ID_INTERNAL_BT_FM_CONFIG 0x00010211
+#define AFE_API_VERSION_INTERNAL_BT_FM_CONFIG 0x1
#define AFE_CMD_REMOTE_LPASS_CORE_HW_VOTE_REQUEST 0x000100f4
#define AFE_CMD_RSP_REMOTE_LPASS_CORE_HW_VOTE_REQUEST 0x000100f5
#define AFE_CMD_REMOTE_LPASS_CORE_HW_DEVOTE_REQUEST 0x000100f6
@@ -76,6 +78,8 @@
/* Port IDs */
#define AFE_API_VERSION_HDMI_CONFIG 0x1
#define AFE_PORT_ID_MULTICHAN_HDMI_RX 0x100E
+#define AFE_PORT_ID_INTERNAL_BT_SCO_RX 0x3000
+#define AFE_PORT_ID_INTERNAL_BT_SCO_TX 0x3001
#define AFE_PORT_ID_HDMI_OVER_DP_RX 0x6020
#define AFE_API_VERSION_SLIMBUS_CONFIG 0x1
@@ -513,12 +517,20 @@
u16 active_channels_mask;
} __packed;
+struct afe_param_id_internal_bt_fm_cfg {
+ u32 bt_fm_cfg_minor_version;
+ u16 num_channels;
+ u16 bit_width;
+ u32 sample_rate;
+} __packed;
+
union afe_port_config {
struct afe_param_id_hdmi_multi_chan_audio_cfg hdmi_multi_ch;
struct afe_param_id_slimbus_cfg slim_cfg;
struct afe_param_id_i2s_cfg i2s_cfg;
struct afe_param_id_tdm_cfg tdm_cfg;
struct afe_param_id_cdc_dma_cfg dma_cfg;
+ struct afe_param_id_internal_bt_fm_cfg bt_fm_cfg;
} __packed;
@@ -833,6 +845,10 @@
RX_CODEC_DMA_RX_6, 1, 1},
[RX_CODEC_DMA_RX_7] = { AFE_PORT_ID_RX_CODEC_DMA_RX_7,
RX_CODEC_DMA_RX_7, 1, 1},
+ [INTERNAL_BT_SCO_RX] = { AFE_PORT_ID_INTERNAL_BT_SCO_RX,
+ INTERNAL_BT_SCO_RX, 1, 1},
+ [INTERNAL_BT_SCO_TX] = { AFE_PORT_ID_INTERNAL_BT_SCO_TX,
+ INTERNAL_BT_SCO_TX, 0, 1},
};
static void q6afe_port_free(struct kref *ref)
@@ -1505,6 +1521,18 @@
dma_cfg->active_channels_mask = (1 << cfg->num_channels) - 1;
}
EXPORT_SYMBOL_GPL(q6afe_cdc_dma_port_prepare);
+
+void q6afe_bt_fm_port_prepare(struct q6afe_port *port,
+ struct q6afe_bt_fm_cfg *cfg)
+{
+ union afe_port_config *pcfg = &port->port_cfg;
+
+ pcfg->bt_fm_cfg.bt_fm_cfg_minor_version = AFE_API_VERSION_INTERNAL_BT_FM_CONFIG;
+ pcfg->bt_fm_cfg.num_channels = cfg->num_channels;
+ pcfg->bt_fm_cfg.bit_width = cfg->bit_width;
+ pcfg->bt_fm_cfg.sample_rate = cfg->sample_rate;
+}
+EXPORT_SYMBOL_GPL(q6afe_bt_fm_port_prepare);
/**
* q6afe_port_start() - Start a afe port
*
@@ -1640,6 +1668,10 @@
case AFE_PORT_ID_WSA_CODEC_DMA_RX_0 ... AFE_PORT_ID_RX_CODEC_DMA_RX_7:
cfg_type = AFE_PARAM_ID_CODEC_DMA_CONFIG;
break;
+ case AFE_PORT_ID_INTERNAL_BT_SCO_RX:
+ case AFE_PORT_ID_INTERNAL_BT_SCO_TX:
+ cfg_type = AFE_PARAM_ID_INTERNAL_BT_FM_CONFIG;
+ break;
default:
dev_err(dev, "Invalid port id 0x%x\n", port_id);
return ERR_PTR(-EINVAL);
--- a/sound/soc/qcom/qdsp6/q6dsp-lpass-ports.h
+++ b/sound/soc/qcom/qdsp6/q6dsp-lpass-ports.h
@@ -11,6 +11,7 @@
const struct snd_soc_dai_ops *q6i2s_ops;
const struct snd_soc_dai_ops *q6tdm_ops;
const struct snd_soc_dai_ops *q6dma_ops;
+ const struct snd_soc_dai_ops *q6btfm_ops;
};
struct snd_soc_dai_driver *q6dsp_audio_ports_set_config(struct device *dev,
--- a/sound/soc/qcom/qdsp6/q6dsp-lpass-ports.c
+++ b/sound/soc/qcom/qdsp6/q6dsp-lpass-ports.c
@@ -574,6 +574,32 @@
Q6AFE_CDC_DMA_TX_DAI(TX_CODEC_DMA_TX_5),
Q6AFE_CDC_DMA_RX_DAI(RX_CODEC_DMA_RX_6),
Q6AFE_CDC_DMA_RX_DAI(RX_CODEC_DMA_RX_7),
+ {
+ .playback = {
+ .stream_name = "Internal BT-SCO Playback",
+ .rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000,
+ .formats = SNDRV_PCM_FMTBIT_S16_LE,
+ .channels_min = 1,
+ .channels_max = 1,
+ .rate_min = 8000,
+ .rate_max = 16000,
+ },
+ .name = "INT_BT_SCO_RX",
+ .id = INTERNAL_BT_SCO_RX,
+ },
+ {
+ .capture = {
+ .stream_name = "Internal BT-SCO Capture",
+ .rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000,
+ .formats = SNDRV_PCM_FMTBIT_S16_LE,
+ .channels_min = 1,
+ .channels_max = 1,
+ .rate_min = 8000,
+ .rate_max = 16000,
+ },
+ .name = "INT_BT_SCO_TX",
+ .id = INTERNAL_BT_SCO_TX,
+ },
};
int q6dsp_audio_ports_of_xlate_dai_name(struct snd_soc_component *component,
@@ -624,6 +650,10 @@
case WSA_CODEC_DMA_RX_0 ... RX_CODEC_DMA_RX_7:
q6dsp_audio_fe_dais[i].ops = cfg->q6dma_ops;
break;
+ case INTERNAL_BT_SCO_RX:
+ case INTERNAL_BT_SCO_TX:
+ q6dsp_audio_fe_dais[i].ops = cfg->q6btfm_ops;
+ break;
default:
break;
}
--- a/sound/soc/qcom/qdsp6/q6afe-dai.c
+++ b/sound/soc/qcom/qdsp6/q6afe-dai.c
@@ -395,6 +395,11 @@
q6afe_cdc_dma_port_prepare(dai_data->port[dai->id],
&dai_data->port_config[dai->id].dma_cfg);
break;
+ case INTERNAL_BT_SCO_RX:
+ case INTERNAL_BT_SCO_TX:
+ q6afe_bt_fm_port_prepare(dai_data->port[dai->id],
+ &dai_data->port_config[dai->id].bt_fm_cfg);
+ break;
default:
return -EINVAL;
}
@@ -692,6 +697,10 @@
{"TX_CODEC_DMA_TX_5", NULL, "TX_CODEC_DMA_TX_5 Capture"},
{"RX_CODEC_DMA_RX_6 Playback", NULL, "RX_CODEC_DMA_RX_6"},
{"RX_CODEC_DMA_RX_7 Playback", NULL, "RX_CODEC_DMA_RX_7"},
+ {"Internal BT-SCO Playback", NULL, "INT_BT_SCO_RX"},
+ {"BT_SCO_PB", NULL, "Internal BT-SCO Playback"},
+ {"INT_BT_SCO_TX", NULL, "Internal BT-SCO Capture"},
+ {"Internal BT-SCO Capture", NULL, "BT_SCO_CAP"},
};
static int msm_dai_q6_dai_probe(struct snd_soc_dai *dai)
@@ -767,6 +776,28 @@
.hw_params = q6dma_hw_params,
};
+static int q6btfm_hw_params(struct snd_pcm_substream *substream,
+ struct snd_pcm_hw_params *params,
+ struct snd_soc_dai *dai)
+{
+ struct q6afe_dai_data *dai_data = dev_get_drvdata(dai->dev);
+ struct q6afe_bt_fm_cfg *bt_fm = &dai_data->port_config[dai->id].bt_fm_cfg;
+
+ bt_fm->sample_rate = params_rate(params);
+ bt_fm->num_channels = params_channels(params);
+ bt_fm->bit_width = params_width(params);
+
+ return 0;
+}
+
+static const struct snd_soc_dai_ops q6btfm_ops = {
+ .probe = msm_dai_q6_dai_probe,
+ .remove = msm_dai_q6_dai_remove,
+ .prepare = q6afe_dai_prepare,
+ .hw_params = q6btfm_hw_params,
+ .shutdown = q6afe_dai_shutdown,
+};
+
static const struct snd_soc_dapm_widget q6afe_dai_widgets[] = {
SND_SOC_DAPM_AIF_IN("HDMI_RX", NULL, 0, SND_SOC_NOPM, 0, 0),
SND_SOC_DAPM_AIF_IN("SLIMBUS_0_RX", NULL, 0, SND_SOC_NOPM, 0, 0),
@@ -1017,6 +1048,10 @@
0, SND_SOC_NOPM, 0, 0),
SND_SOC_DAPM_AIF_IN("RX_CODEC_DMA_RX_7", "NULL",
0, SND_SOC_NOPM, 0, 0),
+ SND_SOC_DAPM_AIF_IN("INT_BT_SCO_RX", NULL, 0, SND_SOC_NOPM, 0, 0),
+ SND_SOC_DAPM_AIF_OUT("INT_BT_SCO_TX", NULL, 0, SND_SOC_NOPM, 0, 0),
+ SND_SOC_DAPM_OUTPUT("BT_SCO_PB"),
+ SND_SOC_DAPM_INPUT("BT_SCO_CAP"),
};
static const struct snd_soc_component_driver q6afe_dai_component = {
@@ -1131,6 +1166,7 @@
cfg.q6i2s_ops = &q6i2s_ops;
cfg.q6tdm_ops = &q6tdm_ops;
cfg.q6dma_ops = &q6dma_ops;
+ cfg.q6btfm_ops = &q6btfm_ops;
dais = q6dsp_audio_ports_set_config(dev, &cfg, &num_dais);
return devm_snd_soc_register_component(dev, &q6afe_dai_component, dais, num_dais);
--- a/sound/soc/qcom/qdsp6/q6routing.c
+++ b/sound/soc/qcom/qdsp6/q6routing.c
@@ -127,7 +127,8 @@
{ mix_name, "TX_CODEC_DMA_TX_2", "TX_CODEC_DMA_TX_2"}, \
{ mix_name, "TX_CODEC_DMA_TX_3", "TX_CODEC_DMA_TX_3"}, \
{ mix_name, "TX_CODEC_DMA_TX_4", "TX_CODEC_DMA_TX_4"}, \
- { mix_name, "TX_CODEC_DMA_TX_5", "TX_CODEC_DMA_TX_5"}
+ { mix_name, "TX_CODEC_DMA_TX_5", "TX_CODEC_DMA_TX_5"}, \
+ { mix_name, "INT_BT_SCO_TX", "INT_BT_SCO_TX"}
#define Q6ROUTING_TX_MIXERS(id) \
SOC_SINGLE_EXT("PRI_MI2S_TX", PRIMARY_MI2S_TX, \
@@ -321,6 +322,9 @@
msm_routing_put_audio_mixer), \
SOC_SINGLE_EXT("TX_CODEC_DMA_TX_5", TX_CODEC_DMA_TX_5, \
id, 1, 0, msm_routing_get_audio_mixer, \
+ msm_routing_put_audio_mixer), \
+ SOC_SINGLE_EXT("INT_BT_SCO_TX", INTERNAL_BT_SCO_TX, \
+ id, 1, 0, msm_routing_get_audio_mixer, \
msm_routing_put_audio_mixer),
struct session_data {
@@ -707,6 +711,9 @@
static const struct snd_kcontrol_new rx_codec_dma_rx_7_mixer_controls[] = {
Q6ROUTING_RX_MIXERS(RX_CODEC_DMA_RX_7) };
+static const struct snd_kcontrol_new int_bt_sco_rx_mixer_controls[] = {
+ Q6ROUTING_RX_MIXERS(INTERNAL_BT_SCO_RX) };
+
static const struct snd_kcontrol_new mmul1_mixer_controls[] = {
Q6ROUTING_TX_MIXERS(MSM_FRONTEND_DAI_MULTIMEDIA1) };
@@ -933,6 +940,9 @@
SND_SOC_DAPM_MIXER("RX_CODEC_DMA_RX_7 Audio Mixer", SND_SOC_NOPM, 0, 0,
rx_codec_dma_rx_7_mixer_controls,
ARRAY_SIZE(rx_codec_dma_rx_7_mixer_controls)),
+ SND_SOC_DAPM_MIXER("INT_BT_SCO_RX Audio Mixer", SND_SOC_NOPM, 0, 0,
+ int_bt_sco_rx_mixer_controls,
+ ARRAY_SIZE(int_bt_sco_rx_mixer_controls)),
SND_SOC_DAPM_MIXER("MultiMedia1 Mixer", SND_SOC_NOPM, 0, 0,
mmul1_mixer_controls, ARRAY_SIZE(mmul1_mixer_controls)),
SND_SOC_DAPM_MIXER("MultiMedia2 Mixer", SND_SOC_NOPM, 0, 0,
@@ -1026,6 +1036,7 @@
Q6ROUTING_RX_DAPM_ROUTE("RX_CODEC_DMA_RX_5 Audio Mixer", "RX_CODEC_DMA_RX_5"),
Q6ROUTING_RX_DAPM_ROUTE("RX_CODEC_DMA_RX_6 Audio Mixer", "RX_CODEC_DMA_RX_6"),
Q6ROUTING_RX_DAPM_ROUTE("RX_CODEC_DMA_RX_7 Audio Mixer", "RX_CODEC_DMA_RX_7"),
+ Q6ROUTING_RX_DAPM_ROUTE("INT_BT_SCO_RX Audio Mixer", "INT_BT_SCO_RX"),
Q6ROUTING_TX_DAPM_ROUTE("MultiMedia1 Mixer"),
Q6ROUTING_TX_DAPM_ROUTE("MultiMedia2 Mixer"),
Q6ROUTING_TX_DAPM_ROUTE("MultiMedia3 Mixer"),
--- a/sound/soc/qcom/qdsp6/q6voice-dai.c
+++ b/sound/soc/qcom/qdsp6/q6voice-dai.c
@@ -159,12 +159,15 @@
return -EINVAL;
}
- if (val)
+ if (val) {
+ snd_soc_dapm_mixer_update_power(dapm, kcontrol, val, NULL);
q6voice_set_port(v, path, capture, mc->reg);
- else if (q6voice_get_port(v, path, capture) == mc->reg)
- q6voice_set_port(v, path, capture, 0);
+ } else {
+ if (q6voice_get_port(v, path, capture) == mc->reg)
+ q6voice_set_port(v, path, capture, 0);
+ snd_soc_dapm_mixer_update_power(dapm, kcontrol, val, NULL);
+ }
- snd_soc_dapm_mixer_update_power(dapm, kcontrol, val, NULL);
return 1;
}
@@ -199,6 +202,8 @@
q6voice_get_mixer_capture, q6voice_put_mixer_capture),
SOC_SINGLE_EXT("QUIN_MI2S_TX", QUINARY_MI2S_TX, CS_VOICE, 1, 0,
q6voice_get_mixer_capture, q6voice_put_mixer_capture),
+ SOC_SINGLE_EXT("INT_BT_SCO_TX", INTERNAL_BT_SCO_TX, CS_VOICE, 1, 0,
+ q6voice_get_mixer_capture, q6voice_put_mixer_capture),
};
static const struct snd_kcontrol_new voicemmode1_tx_mixer_controls[] = {
@@ -212,6 +217,8 @@
q6voice_get_mixer_capture, q6voice_put_mixer_capture),
SOC_SINGLE_EXT("QUIN_MI2S_TX", QUINARY_MI2S_TX, VOICEMMODE1, 1, 0,
q6voice_get_mixer_capture, q6voice_put_mixer_capture),
+ SOC_SINGLE_EXT("INT_BT_SCO_TX", INTERNAL_BT_SCO_TX, VOICEMMODE1, 1, 0,
+ q6voice_get_mixer_capture, q6voice_put_mixer_capture),
};
static const struct snd_kcontrol_new primary_mi2s_rx_mixer_controls[] = {
@@ -249,6 +256,13 @@
q6voice_get_mixer_playback, q6voice_put_mixer_playback),
};
+static const struct snd_kcontrol_new int_bt_sco_rx_mixer_controls[] = {
+ SOC_SINGLE_EXT("CS-Voice", INTERNAL_BT_SCO_RX, CS_VOICE, 1, 0,
+ q6voice_get_mixer_playback, q6voice_put_mixer_playback),
+ SOC_SINGLE_EXT("VoiceMMode1", INTERNAL_BT_SCO_RX, VOICEMMODE1, 1, 0,
+ q6voice_get_mixer_playback, q6voice_put_mixer_playback),
+};
+
static const struct snd_soc_dapm_widget q6voice_dapm_widgets[] = {
SND_SOC_DAPM_AIF_IN("CS-VOICE_DL1", "CS-VOICE Playback", 0, SND_SOC_NOPM, 0, 0),
SND_SOC_DAPM_AIF_OUT("CS-VOICE_UL1", "CS-VOICE Capture", 0, SND_SOC_NOPM, 0, 0),
@@ -275,6 +289,9 @@
SND_SOC_DAPM_MIXER("QUIN_MI2S_RX Voice Mixer", SND_SOC_NOPM, 0, 0,
quinary_mi2s_rx_mixer_controls,
ARRAY_SIZE(quinary_mi2s_rx_mixer_controls)),
+ SND_SOC_DAPM_MIXER("INT_BT_SCO_RX Voice Mixer", SND_SOC_NOPM, 0, 0,
+ int_bt_sco_rx_mixer_controls,
+ ARRAY_SIZE(int_bt_sco_rx_mixer_controls)),
};
static const struct snd_soc_dapm_route q6voice_dapm_routes[] = {
@@ -283,12 +300,14 @@
{ "CS-Voice Capture Mixer", "TERT_MI2S_TX", "TERT_MI2S_TX" },
{ "CS-Voice Capture Mixer", "QUAT_MI2S_TX", "QUAT_MI2S_TX" },
{ "CS-Voice Capture Mixer", "QUIN_MI2S_TX", "QUIN_MI2S_TX" },
+ { "CS-Voice Capture Mixer", "INT_BT_SCO_TX", "INT_BT_SCO_TX" },
{ "CS-VOICE_UL1", NULL, "CS-Voice Capture Mixer" },
{ "VoiceMMode1 Capture Mixer", "PRI_MI2S_TX", "PRI_MI2S_TX" },
{ "VoiceMMode1 Capture Mixer", "SEC_MI2S_TX", "SEC_MI2S_TX" },
{ "VoiceMMode1 Capture Mixer", "TERT_MI2S_TX", "TERT_MI2S_TX" },
{ "VoiceMMode1 Capture Mixer", "QUAT_MI2S_TX", "QUAT_MI2S_TX" },
{ "VoiceMMode1 Capture Mixer", "QUIN_MI2S_TX", "QUIN_MI2S_TX" },
+ { "VoiceMMode1 Capture Mixer", "INT_BT_SCO_TX", "INT_BT_SCO_TX" },
{ "VOICEMMODE1_UL1", NULL, "VoiceMMode1 Capture Mixer" },
{ "PRI_MI2S_RX Voice Mixer", "CS-Voice", "CS-VOICE_DL1" },
@@ -296,17 +315,20 @@
{ "TERT_MI2S_RX Voice Mixer", "CS-Voice", "CS-VOICE_DL1" },
{ "QUAT_MI2S_RX Voice Mixer", "CS-Voice", "CS-VOICE_DL1" },
{ "QUIN_MI2S_RX Voice Mixer", "CS-Voice", "CS-VOICE_DL1" },
+ { "INT_BT_SCO_RX Voice Mixer", "CS-Voice", "CS-VOICE_DL1" },
{ "PRI_MI2S_RX Voice Mixer", "VoiceMMode1", "VOICEMMODE1_DL1" },
{ "SEC_MI2S_RX Voice Mixer", "VoiceMMode1", "VOICEMMODE1_DL1" },
{ "TERT_MI2S_RX Voice Mixer", "VoiceMMode1", "VOICEMMODE1_DL1" },
{ "QUAT_MI2S_RX Voice Mixer", "VoiceMMode1", "VOICEMMODE1_DL1" },
{ "QUIN_MI2S_RX Voice Mixer", "VoiceMMode1", "VOICEMMODE1_DL1" },
+ { "INT_BT_SCO_RX Voice Mixer", "VoiceMMode1", "VOICEMMODE1_DL1" },
{ "PRI_MI2S_RX", NULL, "PRI_MI2S_RX Voice Mixer" },
{ "SEC_MI2S_RX", NULL, "SEC_MI2S_RX Voice Mixer" },
{ "TERT_MI2S_RX", NULL, "TERT_MI2S_RX Voice Mixer" },
{ "QUAT_MI2S_RX", NULL, "QUAT_MI2S_RX Voice Mixer" },
{ "QUIN_MI2S_RX", NULL, "QUIN_MI2S_RX Voice Mixer" },
+ { "INT_BT_SCO_RX", NULL, "INT_BT_SCO_RX Voice Mixer" },
};
static unsigned int q6voice_reg_read(struct snd_soc_component *component,
--- a/sound/soc/qcom/qdsp6/q6voice.c
+++ b/sound/soc/qcom/qdsp6/q6voice.c
@@ -252,11 +252,25 @@
bool capture, int index)
{
struct q6voice_path *p = &v->paths[path];
+ int old_port;
+ mutex_lock(&p->lock);
+ old_port = capture ? p->tx_port : p->rx_port;
if (capture)
p->tx_port = index;
else
p->rx_port = index;
+
+ if (old_port != index && p->runtime && p->runtime->started == 3) {
+ if (p->runtime->sessions[Q6VOICE_SERVICE_CVP]) {
+ q6voice_path_stop(p);
+ q6voice_session_release(p->runtime->sessions[Q6VOICE_SERVICE_CVP]);
+ p->runtime->sessions[Q6VOICE_SERVICE_CVP] = NULL;
+ }
+ if (p->tx_port > 0 && p->rx_port > 0)
+ q6voice_path_start(p);
+ }
+ mutex_unlock(&p->lock);
}
EXPORT_SYMBOL_GPL(q6voice_set_port);
--- a/sound/soc/qcom/common.c
+++ b/sound/soc/qcom/common.c
@@ -146,6 +146,12 @@
link->no_pcm = 1;
link->ignore_pmdown_time = 1;
}
+ } else if (platform) {
+ /* DPCM backend with dummy codec (e.g. Internal BT-SCO) */
+ link->codecs = &snd_soc_dummy_dlc;
+ link->num_codecs = 1;
+ link->no_pcm = 1;
+ link->ignore_pmdown_time = 1;
} else {
/* DPCM frontend */
link->codecs = &snd_soc_dummy_dlc;
--- a/sound/soc/qcom/apq8016_sbc.c
+++ b/sound/soc/qcom/apq8016_sbc.c
@@ -186,6 +186,10 @@
{
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
+ if (cpu_dai->id == INTERNAL_BT_SCO_RX ||
+ cpu_dai->id == INTERNAL_BT_SCO_TX)
+ return 0;
+
snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_BP_FP);
return apq8016_dai_init(rtd, qdsp6_dai_get_lpass_id(cpu_dai));
}
@@ -198,6 +202,10 @@
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
int mi2s, ret;
+ if (cpu_dai->id == INTERNAL_BT_SCO_RX ||
+ cpu_dai->id == INTERNAL_BT_SCO_TX)
+ return 0;
+
mi2s = qdsp6_dai_get_lpass_id(cpu_dai);
if (mi2s < 0)
return mi2s;
@@ -219,6 +227,10 @@
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
int mi2s, ret;
+ if (cpu_dai->id == INTERNAL_BT_SCO_RX ||
+ cpu_dai->id == INTERNAL_BT_SCO_TX)
+ return;
+
mi2s = qdsp6_dai_get_lpass_id(cpu_dai);
if (mi2s < 0)
return;
@@ -239,14 +251,21 @@
static int msm8916_qdsp6_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_hw_params *params)
{
+ struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
struct snd_interval *rate = hw_param_interval(params,
SNDRV_PCM_HW_PARAM_RATE);
struct snd_interval *channels = hw_param_interval(params,
SNDRV_PCM_HW_PARAM_CHANNELS);
struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
- rate->min = rate->max = 48000;
- channels->min = channels->max = 2;
+ if (cpu_dai->id == INTERNAL_BT_SCO_RX ||
+ cpu_dai->id == INTERNAL_BT_SCO_TX) {
+ rate->min = rate->max = 8000;
+ channels->min = channels->max = 1;
+ } else {
+ rate->min = rate->max = 48000;
+ channels->min = channels->max = 2;
+ }
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S16_LE);
return 0;
--- a/drivers/bluetooth/btqcomsmd.c
+++ b/drivers/bluetooth/btqcomsmd.c
@@ -84,6 +84,11 @@
hdev->stat.cmd_tx++;
hdev->stat.byte_tx += skb->len;
break;
+ case HCI_SCODATA_PKT:
+ ret = 0;
+ hdev->stat.sco_tx++;
+ hdev->stat.byte_tx += skb->len;
+ break;
default:
ret = -EILSEQ;
break;
--- a/arch/arm/boot/dts/qcom/qcom-msm8905-nokia-argon.dts
+++ b/arch/arm/boot/dts/qcom/qcom-msm8905-nokia-argon.dts
@@ -208,8 +208,8 @@
};
&pm8909_charger {
- qcom,fast-charge-safe-current = <360000>;
- qcom,fast-charge-safe-voltage = <4350000>;
+ qcom,fast-charge-safe-current = <540000>;
+ qcom,fast-charge-safe-voltage = <4375000>;
monitored-battery = <&bat>;
@@ -240,6 +240,12 @@
reg = <TERTIARY_MI2S_TX>;
qcom,sd-lines = <0 1>;
};
+ dai@136 {
+ reg = <INTERNAL_BT_SCO_RX>;
+ };
+ dai@137 {
+ reg = <INTERNAL_BT_SCO_TX>;
+ };
};
&q6asmdai {
@@ -364,6 +370,26 @@
};
platform {
sound-dai = <&q6routing>;
+ };
+ };
+
+ dai-link-bt-sco-rx {
+ link-name = "Internal BT-SCO RX";
+ cpu {
+ sound-dai = <&q6afedai INTERNAL_BT_SCO_RX>;
+ };
+ platform {
+ sound-dai = <&q6routing>;
+ };
+ };
+
+ dai-link-bt-sco-tx {
+ link-name = "Internal BT-SCO TX";
+ cpu {
+ sound-dai = <&q6afedai INTERNAL_BT_SCO_TX>;
+ };
+ platform {
+ sound-dai = <&q6routing>;
};
};
};
--- a/arch/arm/boot/dts/qcom/qcom-msm8909-nokia-leo-common.dtsi
+++ b/arch/arm/boot/dts/qcom/qcom-msm8909-nokia-leo-common.dtsi
@@ -202,6 +202,12 @@
reg = <TERTIARY_MI2S_TX>;
qcom,sd-lines = <0 1>;
};
+ dai@136 {
+ reg = <INTERNAL_BT_SCO_RX>;
+ };
+ dai@137 {
+ reg = <INTERNAL_BT_SCO_TX>;
+ };
};
&q6asmdai {
@@ -326,6 +332,26 @@
};
platform {
sound-dai = <&q6routing>;
+ };
+ };
+
+ dai-link-bt-sco-rx {
+ link-name = "Internal BT-SCO RX";
+ cpu {
+ sound-dai = <&q6afedai INTERNAL_BT_SCO_RX>;
+ };
+ platform {
+ sound-dai = <&q6routing>;
+ };
+ };
+
+ dai-link-bt-sco-tx {
+ link-name = "Internal BT-SCO TX";
+ cpu {
+ sound-dai = <&q6afedai INTERNAL_BT_SCO_TX>;
+ };
+ platform {
+ sound-dai = <&q6routing>;
};
};
};