Merge "dsp: Add support for setting USB packet service interval" into audio-drivers.lnx.3.0
This commit is contained in:
commit
45e64b92bb
3 changed files with 106 additions and 8 deletions
|
@ -1774,7 +1774,7 @@ static int msm_dai_q6_usb_audio_hw_params(struct snd_pcm_hw_params *params,
|
|||
return -EINVAL;
|
||||
}
|
||||
dai_data->port_config.usb_audio.cfg_minor_version =
|
||||
AFE_API_MINIOR_VERSION_USB_AUDIO_CONFIG;
|
||||
AFE_API_MINOR_VERSION_USB_AUDIO_CONFIG;
|
||||
dai_data->port_config.usb_audio.num_channels = dai_data->channels;
|
||||
dai_data->port_config.usb_audio.sample_rate = dai_data->rate;
|
||||
|
||||
|
@ -2241,6 +2241,38 @@ static int msm_dai_q6_usb_audio_endian_cfg_get(struct snd_kcontrol *kcontrol,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int msm_dai_q6_usb_audio_svc_interval_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct msm_dai_q6_dai_data *dai_data = kcontrol->private_data;
|
||||
u32 val = ucontrol->value.integer.value[0];
|
||||
|
||||
if (!dai_data) {
|
||||
pr_err("%s: dai_data is NULL\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
dai_data->port_config.usb_audio.service_interval = val;
|
||||
pr_debug("%s: new service interval = %u\n", __func__,
|
||||
dai_data->port_config.usb_audio.service_interval);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int msm_dai_q6_usb_audio_svc_interval_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: dai_data is NULL\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
ucontrol->value.integer.value[0] =
|
||||
dai_data->port_config.usb_audio.service_interval;
|
||||
pr_debug("%s: service interval = %d\n", __func__,
|
||||
dai_data->port_config.usb_audio.service_interval);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int msm_dai_q6_afe_enc_cfg_info(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_info *uinfo)
|
||||
{
|
||||
|
@ -2671,6 +2703,10 @@ static const struct snd_kcontrol_new usb_audio_cfg_controls[] = {
|
|||
SOC_SINGLE_EXT("USB_AUDIO_TX endian", 0, 0, 1, 0,
|
||||
msm_dai_q6_usb_audio_endian_cfg_get,
|
||||
msm_dai_q6_usb_audio_endian_cfg_put),
|
||||
SOC_SINGLE_EXT("USB_AUDIO_RX service_interval", SND_SOC_NOPM, 0,
|
||||
UINT_MAX, 0,
|
||||
msm_dai_q6_usb_audio_svc_interval_get,
|
||||
msm_dai_q6_usb_audio_svc_interval_put),
|
||||
};
|
||||
|
||||
static const struct snd_kcontrol_new avd_drift_config_controls[] = {
|
||||
|
@ -2772,6 +2808,9 @@ static int msm_dai_q6_dai_probe(struct snd_soc_dai *dai)
|
|||
rc = snd_ctl_add(dai->component->card->snd_card,
|
||||
snd_ctl_new1(&usb_audio_cfg_controls[1],
|
||||
dai_data));
|
||||
rc = snd_ctl_add(dai->component->card->snd_card,
|
||||
snd_ctl_new1(&usb_audio_cfg_controls[4],
|
||||
dai_data));
|
||||
break;
|
||||
case AFE_PORT_ID_USB_TX:
|
||||
rc = snd_ctl_add(dai->component->card->snd_card,
|
||||
|
|
32
dsp/q6afe.c
32
dsp/q6afe.c
|
@ -2858,8 +2858,9 @@ int afe_port_send_usb_dev_param(u16 port_id, union afe_port_config *afe_config)
|
|||
{
|
||||
struct afe_param_id_usb_audio_dev_params usb_dev;
|
||||
struct afe_param_id_usb_audio_dev_lpcm_fmt lpcm_fmt;
|
||||
struct afe_param_id_usb_audio_svc_interval svc_int;
|
||||
struct param_hdr_v3 param_hdr;
|
||||
int ret = 0;
|
||||
int ret = 0, index = 0;
|
||||
|
||||
if (!afe_config) {
|
||||
pr_err("%s: Error, no configuration data\n", __func__);
|
||||
|
@ -2867,6 +2868,13 @@ int afe_port_send_usb_dev_param(u16 port_id, union afe_port_config *afe_config)
|
|||
goto exit;
|
||||
}
|
||||
|
||||
index = q6audio_get_port_index(port_id);
|
||||
|
||||
if (index < 0 || index >= AFE_MAX_PORTS) {
|
||||
pr_err("%s: AFE port index[%d] invalid!\n",
|
||||
__func__, index);
|
||||
return -EINVAL;
|
||||
}
|
||||
memset(&usb_dev, 0, sizeof(usb_dev));
|
||||
memset(&lpcm_fmt, 0, sizeof(lpcm_fmt));
|
||||
memset(¶m_hdr, 0, sizeof(param_hdr));
|
||||
|
@ -2875,7 +2883,7 @@ int afe_port_send_usb_dev_param(u16 port_id, union afe_port_config *afe_config)
|
|||
|
||||
param_hdr.param_id = AFE_PARAM_ID_USB_AUDIO_DEV_PARAMS;
|
||||
param_hdr.param_size = sizeof(usb_dev);
|
||||
usb_dev.cfg_minor_version = AFE_API_MINIOR_VERSION_USB_AUDIO_CONFIG;
|
||||
usb_dev.cfg_minor_version = AFE_API_MINOR_VERSION_USB_AUDIO_CONFIG;
|
||||
usb_dev.dev_token = afe_config->usb_audio.dev_token;
|
||||
|
||||
ret = q6afe_pack_and_set_param_in_band(port_id,
|
||||
|
@ -2889,7 +2897,7 @@ int afe_port_send_usb_dev_param(u16 port_id, union afe_port_config *afe_config)
|
|||
|
||||
param_hdr.param_id = AFE_PARAM_ID_USB_AUDIO_DEV_LPCM_FMT;
|
||||
param_hdr.param_size = sizeof(lpcm_fmt);
|
||||
lpcm_fmt.cfg_minor_version = AFE_API_MINIOR_VERSION_USB_AUDIO_CONFIG;
|
||||
lpcm_fmt.cfg_minor_version = AFE_API_MINOR_VERSION_USB_AUDIO_CONFIG;
|
||||
lpcm_fmt.endian = afe_config->usb_audio.endian;
|
||||
|
||||
ret = q6afe_pack_and_set_param_in_band(port_id,
|
||||
|
@ -2900,7 +2908,25 @@ int afe_port_send_usb_dev_param(u16 port_id, union afe_port_config *afe_config)
|
|||
__func__, ret);
|
||||
goto exit;
|
||||
}
|
||||
param_hdr.param_id = AFE_PARAM_ID_USB_AUDIO_SVC_INTERVAL;
|
||||
param_hdr.param_size = sizeof(svc_int);
|
||||
svc_int.cfg_minor_version =
|
||||
AFE_API_MINOR_VERSION_USB_AUDIO_CONFIG;
|
||||
svc_int.svc_interval = afe_config->usb_audio.service_interval;
|
||||
|
||||
pr_debug("%s: AFE device param cmd sending SVC_INTERVAL %d\n",
|
||||
__func__, svc_int.svc_interval);
|
||||
|
||||
ret = q6afe_pack_and_set_param_in_band(port_id,
|
||||
q6audio_get_port_index(port_id),
|
||||
param_hdr, (u8 *) &svc_int);
|
||||
|
||||
if (ret) {
|
||||
pr_err("%s: AFE device param cmd svc_interval failed %d\n",
|
||||
__func__, ret);
|
||||
ret = -EINVAL;
|
||||
goto exit;
|
||||
}
|
||||
exit:
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -2586,6 +2586,17 @@ struct afe_param_id_internal_bt_fm_cfg {
|
|||
* shared channel approach.
|
||||
*/
|
||||
|
||||
/* ID of the parameter used to set the latency mode of the
|
||||
* USB audio device.
|
||||
*/
|
||||
#define AFE_PARAM_ID_PORT_LATENCY_MODE_CONFIG 0x000102B3
|
||||
|
||||
/* Minor version used for tracking USB audio latency mode */
|
||||
#define AFE_API_MINOR_VERSION_USB_AUDIO_LATENCY_MODE 0x1
|
||||
|
||||
/* Supported AFE port latency modes */
|
||||
#define AFE_PORT_DEFAULT_LATENCY_MODE 0x0
|
||||
#define AFE_PORT_LOW_LATENCY_MODE 0x1
|
||||
|
||||
#define AFE_PARAM_ID_SLIMBUS_CONFIG 0x00010212
|
||||
|
||||
|
@ -2679,14 +2690,14 @@ struct afe_param_id_slimbus_cfg {
|
|||
#define AFE_PARAM_ID_USB_AUDIO_DEV_LPCM_FMT 0x000102AA
|
||||
|
||||
/* Minor version used for tracking USB audio configuration */
|
||||
#define AFE_API_MINIOR_VERSION_USB_AUDIO_CONFIG 0x1
|
||||
#define AFE_API_MINOR_VERSION_USB_AUDIO_CONFIG 0x1
|
||||
|
||||
/* Payload of the AFE_PARAM_ID_USB_AUDIO_DEV_PARAMS parameter used by
|
||||
* AFE_MODULE_AUDIO_DEV_INTERFACE.
|
||||
*/
|
||||
struct afe_param_id_usb_audio_dev_params {
|
||||
/* Minor version used for tracking USB audio device parameter.
|
||||
* Supported values: AFE_API_MINIOR_VERSION_USB_AUDIO_CONFIG
|
||||
* Supported values: AFE_API_MINOR_VERSION_USB_AUDIO_CONFIG
|
||||
*/
|
||||
u32 cfg_minor_version;
|
||||
/* Token of actual end USB aduio device */
|
||||
|
@ -2695,13 +2706,33 @@ struct afe_param_id_usb_audio_dev_params {
|
|||
|
||||
struct afe_param_id_usb_audio_dev_lpcm_fmt {
|
||||
/* Minor version used for tracking USB audio device parameter.
|
||||
* Supported values: AFE_API_MINIOR_VERSION_USB_AUDIO_CONFIG
|
||||
* Supported values: AFE_API_MINOR_VERSION_USB_AUDIO_CONFIG
|
||||
*/
|
||||
u32 cfg_minor_version;
|
||||
/* Endianness of actual end USB audio device */
|
||||
u32 endian;
|
||||
} __packed;
|
||||
|
||||
struct afe_param_id_usb_audio_dev_latency_mode {
|
||||
/* Minor version used for tracking USB audio device parameter.
|
||||
* Supported values: AFE_API_MINOR_VERSION_USB_AUDIO_LATENCY_MODE
|
||||
*/
|
||||
u32 minor_version;
|
||||
/* latency mode for the USB audio device */
|
||||
u32 mode;
|
||||
} __packed;
|
||||
|
||||
#define AFE_PARAM_ID_USB_AUDIO_SVC_INTERVAL 0x000102B7
|
||||
|
||||
struct afe_param_id_usb_audio_svc_interval {
|
||||
/* Minor version used for tracking USB audio device parameter.
|
||||
* Supported values: AFE_API_MINOR_VERSION_USB_AUDIO_CONFIG
|
||||
*/
|
||||
u32 cfg_minor_version;
|
||||
/* Endianness of actual end USB audio device */
|
||||
u32 svc_interval;
|
||||
} __packed;
|
||||
|
||||
/* ID of the parameter used by AFE_PARAM_ID_USB_AUDIO_CONFIG to configure
|
||||
* USB audio interface. It should be used with AFE_MODULE_AUDIO_DEV_INTERFACE
|
||||
*/
|
||||
|
@ -2712,7 +2743,7 @@ struct afe_param_id_usb_audio_dev_lpcm_fmt {
|
|||
*/
|
||||
struct afe_param_id_usb_audio_cfg {
|
||||
/* Minor version used for tracking USB audio device configuration.
|
||||
* Supported values: AFE_API_MINIOR_VERSION_USB_AUDIO_CONFIG
|
||||
* Supported values: AFE_API_MINOR_VERSION_USB_AUDIO_CONFIG
|
||||
*/
|
||||
u32 cfg_minor_version;
|
||||
/* Sampling rate of the port.
|
||||
|
@ -2748,6 +2779,8 @@ struct afe_param_id_usb_audio_cfg {
|
|||
u32 dev_token;
|
||||
/* endianness of this interface */
|
||||
u32 endian;
|
||||
/* service interval */
|
||||
u32 service_interval;
|
||||
} __packed;
|
||||
|
||||
/* This param id is used to configure Real Time Proxy interface. */
|
||||
|
|
Loading…
Add table
Reference in a new issue