dsp: add scrambler support in DSP over split a2dp
Add support to enable scrambler in COP Packetizer module over split A2DP path to fix 44.1Khz playback. CRs-Fixed: 2143142 Change-Id: I52fec39e10a1c0939fd49d1e1303b03312544abf Signed-off-by: Preetam Singh Ranawat <apranawat@codeaurora.org>
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

parent
9326b2df53
commit
f746a87965
@@ -2419,6 +2419,36 @@ static int msm_dai_q6_afe_input_bit_format_put(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int msm_dai_q6_afe_scrambler_mode_get(
|
||||||
|
struct snd_kcontrol *kcontrol,
|
||||||
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
|
{
|
||||||
|
struct msm_dai_q6_dai_data *dai_data = kcontrol->private_data;
|
||||||
|
|
||||||
|
if (!dai_data) {
|
||||||
|
pr_err("%s: Invalid dai data\n", __func__);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
ucontrol->value.integer.value[0] = dai_data->enc_config.scrambler_mode;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int msm_dai_q6_afe_scrambler_mode_put(
|
||||||
|
struct snd_kcontrol *kcontrol,
|
||||||
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
|
{
|
||||||
|
struct msm_dai_q6_dai_data *dai_data = kcontrol->private_data;
|
||||||
|
|
||||||
|
if (!dai_data) {
|
||||||
|
pr_err("%s: Invalid dai data\n", __func__);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
dai_data->enc_config.scrambler_mode = ucontrol->value.integer.value[0];
|
||||||
|
pr_debug("%s: afe scrambler mode : %d\n",
|
||||||
|
__func__, dai_data->enc_config.scrambler_mode);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static const struct snd_kcontrol_new afe_enc_config_controls[] = {
|
static const struct snd_kcontrol_new afe_enc_config_controls[] = {
|
||||||
{
|
{
|
||||||
@@ -2436,6 +2466,10 @@ static const struct snd_kcontrol_new afe_enc_config_controls[] = {
|
|||||||
SOC_ENUM_EXT("AFE Input Bit Format", afe_input_bit_format_enum[0],
|
SOC_ENUM_EXT("AFE Input Bit Format", afe_input_bit_format_enum[0],
|
||||||
msm_dai_q6_afe_input_bit_format_get,
|
msm_dai_q6_afe_input_bit_format_get,
|
||||||
msm_dai_q6_afe_input_bit_format_put),
|
msm_dai_q6_afe_input_bit_format_put),
|
||||||
|
SOC_SINGLE_EXT("AFE Scrambler Mode",
|
||||||
|
0, 0, 1, 0,
|
||||||
|
msm_dai_q6_afe_scrambler_mode_get,
|
||||||
|
msm_dai_q6_afe_scrambler_mode_put),
|
||||||
};
|
};
|
||||||
|
|
||||||
static int msm_dai_q6_slim_rx_drift_info(struct snd_kcontrol *kcontrol,
|
static int msm_dai_q6_slim_rx_drift_info(struct snd_kcontrol *kcontrol,
|
||||||
@@ -2598,6 +2632,9 @@ static int msm_dai_q6_dai_probe(struct snd_soc_dai *dai)
|
|||||||
rc = snd_ctl_add(dai->component->card->snd_card,
|
rc = snd_ctl_add(dai->component->card->snd_card,
|
||||||
snd_ctl_new1(&afe_enc_config_controls[2],
|
snd_ctl_new1(&afe_enc_config_controls[2],
|
||||||
dai_data));
|
dai_data));
|
||||||
|
rc = snd_ctl_add(dai->component->card->snd_card,
|
||||||
|
snd_ctl_new1(&afe_enc_config_controls[3],
|
||||||
|
dai_data));
|
||||||
rc = snd_ctl_add(dai->component->card->snd_card,
|
rc = snd_ctl_add(dai->component->card->snd_card,
|
||||||
snd_ctl_new1(&avd_drift_config_controls[2],
|
snd_ctl_new1(&avd_drift_config_controls[2],
|
||||||
dai));
|
dai));
|
||||||
|
28
dsp/q6afe.c
28
dsp/q6afe.c
@@ -2961,7 +2961,8 @@ exit:
|
|||||||
static int q6afe_send_enc_config(u16 port_id,
|
static int q6afe_send_enc_config(u16 port_id,
|
||||||
union afe_enc_config_data *cfg, u32 format,
|
union afe_enc_config_data *cfg, u32 format,
|
||||||
union afe_port_config afe_config,
|
union afe_port_config afe_config,
|
||||||
u16 afe_in_channels, u16 afe_in_bit_width)
|
u16 afe_in_channels, u16 afe_in_bit_width,
|
||||||
|
u32 scrambler_mode)
|
||||||
{
|
{
|
||||||
struct afe_audioif_config_command config;
|
struct afe_audioif_config_command config;
|
||||||
int index;
|
int index;
|
||||||
@@ -3058,6 +3059,20 @@ static int q6afe_send_enc_config(u16 port_id,
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
config.param.payload_size =
|
||||||
|
payload_size + sizeof(config.port.enc_set_scrambler_param);
|
||||||
|
pr_debug("%s:sending AFE_ENCODER_PARAM_ID_ENABLE_SCRAMBLING mode= %d to DSP payload = %d\n",
|
||||||
|
__func__, scrambler_mode, config.param.payload_size);
|
||||||
|
config.pdata.param_id = AFE_ENCODER_PARAM_ID_ENABLE_SCRAMBLING;
|
||||||
|
config.pdata.param_size = sizeof(config.port.enc_set_scrambler_param);
|
||||||
|
config.port.enc_set_scrambler_param.enable_scrambler = scrambler_mode;
|
||||||
|
ret = afe_apr_send_pkt(&config, &this_afe.wait[index]);
|
||||||
|
if (ret) {
|
||||||
|
pr_err("%s: AFE_ENCODER_PARAM_ID_ENABLE_SCRAMBLING for port 0x%x failed %d\n",
|
||||||
|
__func__, port_id, ret);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
config.param.payload_size =
|
config.param.payload_size =
|
||||||
payload_size + sizeof(config.port.media_type);
|
payload_size + sizeof(config.port.media_type);
|
||||||
config.pdata.param_size = sizeof(config.port.media_type);
|
config.pdata.param_size = sizeof(config.port.media_type);
|
||||||
@@ -3094,7 +3109,8 @@ exit:
|
|||||||
|
|
||||||
static int __afe_port_start(u16 port_id, union afe_port_config *afe_config,
|
static int __afe_port_start(u16 port_id, union afe_port_config *afe_config,
|
||||||
u32 rate, u16 afe_in_channels, u16 afe_in_bit_width,
|
u32 rate, u16 afe_in_channels, u16 afe_in_bit_width,
|
||||||
union afe_enc_config_data *cfg, u32 enc_format)
|
union afe_enc_config_data *cfg, u32 enc_format,
|
||||||
|
u32 scrambler_mode)
|
||||||
{
|
{
|
||||||
struct afe_audioif_config_command config;
|
struct afe_audioif_config_command config;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@@ -3357,7 +3373,8 @@ static int __afe_port_start(u16 port_id, union afe_port_config *afe_config,
|
|||||||
__func__, enc_format);
|
__func__, enc_format);
|
||||||
ret = q6afe_send_enc_config(port_id, cfg, enc_format,
|
ret = q6afe_send_enc_config(port_id, cfg, enc_format,
|
||||||
*afe_config, afe_in_channels,
|
*afe_config, afe_in_channels,
|
||||||
afe_in_bit_width);
|
afe_in_bit_width,
|
||||||
|
scrambler_mode);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
pr_err("%s: AFE encoder config for port 0x%x failed %d\n",
|
pr_err("%s: AFE encoder config for port 0x%x failed %d\n",
|
||||||
__func__, port_id, ret);
|
__func__, port_id, ret);
|
||||||
@@ -3410,7 +3427,7 @@ int afe_port_start(u16 port_id, union afe_port_config *afe_config,
|
|||||||
u32 rate)
|
u32 rate)
|
||||||
{
|
{
|
||||||
return __afe_port_start(port_id, afe_config, rate,
|
return __afe_port_start(port_id, afe_config, rate,
|
||||||
0, 0, NULL, ASM_MEDIA_FMT_NONE);
|
0, 0, NULL, ASM_MEDIA_FMT_NONE, 0);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(afe_port_start);
|
EXPORT_SYMBOL(afe_port_start);
|
||||||
|
|
||||||
@@ -3433,7 +3450,8 @@ int afe_port_start_v2(u16 port_id, union afe_port_config *afe_config,
|
|||||||
{
|
{
|
||||||
return __afe_port_start(port_id, afe_config, rate,
|
return __afe_port_start(port_id, afe_config, rate,
|
||||||
afe_in_channels, afe_in_bit_width,
|
afe_in_channels, afe_in_bit_width,
|
||||||
&enc_cfg->data, enc_cfg->format);
|
&enc_cfg->data, enc_cfg->format,
|
||||||
|
enc_cfg->scrambler_mode);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(afe_port_start_v2);
|
EXPORT_SYMBOL(afe_port_start_v2);
|
||||||
|
|
||||||
|
@@ -3118,6 +3118,12 @@ struct afe_param_id_aptx_sync_mode {
|
|||||||
*/
|
*/
|
||||||
#define AFE_ENCODER_PARAM_ID_ENC_FMT_ID 0x0001322B
|
#define AFE_ENCODER_PARAM_ID_ENC_FMT_ID 0x0001322B
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Encoder scrambler parameter for the #AVS_MODULE_ID_ENCODER module.
|
||||||
|
* This parameter cannot be set runtime.
|
||||||
|
*/
|
||||||
|
#define AFE_ENCODER_PARAM_ID_ENABLE_SCRAMBLING 0x0001323C
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Data format to send compressed data
|
* Data format to send compressed data
|
||||||
* is transmitted/received over Slimbus lines.
|
* is transmitted/received over Slimbus lines.
|
||||||
@@ -3451,6 +3457,7 @@ union afe_enc_config_data {
|
|||||||
|
|
||||||
struct afe_enc_config {
|
struct afe_enc_config {
|
||||||
u32 format;
|
u32 format;
|
||||||
|
u32 scrambler_mode;
|
||||||
union afe_enc_config_data data;
|
union afe_enc_config_data data;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -3474,6 +3481,18 @@ struct avs_enc_packetizer_id_param_t {
|
|||||||
uint32_t enc_packetizer_id;
|
uint32_t enc_packetizer_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Payload of the AVS_ENCODER_PARAM_ID_ENABLE_SCRAMBLING parameter.
|
||||||
|
*/
|
||||||
|
struct avs_enc_set_scrambler_param_t {
|
||||||
|
/*
|
||||||
|
* Supported values:
|
||||||
|
* 1 : enable scrambler
|
||||||
|
* 0 : disable scrambler
|
||||||
|
*/
|
||||||
|
uint32_t enable_scrambler;
|
||||||
|
};
|
||||||
|
|
||||||
union afe_port_config {
|
union afe_port_config {
|
||||||
struct afe_param_id_pcm_cfg pcm;
|
struct afe_param_id_pcm_cfg pcm;
|
||||||
struct afe_param_id_i2s_cfg i2s;
|
struct afe_param_id_i2s_cfg i2s;
|
||||||
@@ -3492,6 +3511,7 @@ union afe_port_config {
|
|||||||
struct afe_port_media_type_t media_type;
|
struct afe_port_media_type_t media_type;
|
||||||
struct afe_enc_cfg_blk_param_t enc_blk_param;
|
struct afe_enc_cfg_blk_param_t enc_blk_param;
|
||||||
struct avs_enc_packetizer_id_param_t enc_pkt_id_param;
|
struct avs_enc_packetizer_id_param_t enc_pkt_id_param;
|
||||||
|
struct avs_enc_set_scrambler_param_t enc_set_scrambler_param;
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
struct afe_audioif_config_command_no_payload {
|
struct afe_audioif_config_command_no_payload {
|
||||||
|
Reference in New Issue
Block a user