ASoC: Change platform driver to component driver

snd_soc_platform_driver is removed in kernel-4.19.
Update snd_soc_platform_driver to snd_soc_component_driver.

Change-Id: I434b6fd173d1f4365a610d9164342d5d04d6c5bc
Signed-off-by: Meng Wang <mengw@codeaurora.org>
This commit is contained in:
Meng Wang 2018-09-04 16:11:58 +08:00 committed by Gerrit - the friendly Code Review server
parent 6463cdbf2f
commit ee084a068e
19 changed files with 600 additions and 250 deletions

View File

@ -38,6 +38,8 @@
#include "msm-pcm-routing-v2.h"
#include "msm-qti-pp-config.h"
#define DRV_NAME "msm-compress-q6-v2"
#define DSP_PP_BUFFERING_IN_MSEC 25
#define PARTIAL_DRAIN_ACK_EARLY_BY_MSEC 150
#define MP3_OUTPUT_FRAME_SZ 1152
@ -346,6 +348,7 @@ static int msm_compr_set_volume(struct snd_compr_stream *cstream,
uint32_t avg_vol, gain_list[VOLUME_CONTROL_MAX_CHANNELS];
uint32_t num_channels;
struct snd_soc_pcm_runtime *rtd;
struct snd_soc_component *component = NULL;
struct msm_compr_pdata *pdata;
bool use_default = true;
u8 *chmap = NULL;
@ -358,12 +361,13 @@ static int msm_compr_set_volume(struct snd_compr_stream *cstream,
}
rtd = cstream->private_data;
prtd = cstream->runtime->private_data;
component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
if (!rtd || !rtd->platform || !prtd || !prtd->audio_client) {
if (!rtd || !component || !prtd || !prtd->audio_client) {
pr_err("%s: invalid rtd, prtd or audio client", __func__);
return rc;
}
pdata = snd_soc_platform_get_drvdata(rtd->platform);
pdata = snd_soc_component_get_drvdata(component);
if (prtd->compr_passthr != LEGACY_PCM) {
pr_debug("%s: No volume config for passthrough %d\n",
@ -952,8 +956,8 @@ static int msm_compr_send_media_format_block(struct snd_compr_stream *cstream,
struct snd_compr_runtime *runtime = cstream->runtime;
struct msm_compr_audio *prtd = runtime->private_data;
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct msm_compr_pdata *pdata =
snd_soc_platform_get_drvdata(rtd->platform);
struct snd_soc_component *component =NULL;
struct msm_compr_pdata *pdata = NULL;
struct asm_aac_cfg aac_cfg;
struct asm_wma_cfg wma_cfg;
struct asm_wmapro_cfg wma_pro_cfg;
@ -974,6 +978,13 @@ static int msm_compr_send_media_format_block(struct snd_compr_stream *cstream,
pr_debug("%s: use_gapless_codec_options %d\n",
__func__, use_gapless_codec_options);
component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
pdata = snd_soc_component_get_drvdata(component);
if (use_gapless_codec_options)
codec_options = &(prtd->gapless_state.codec_options);
else
@ -1598,11 +1609,17 @@ static int msm_compr_playback_open(struct snd_compr_stream *cstream)
{
struct snd_compr_runtime *runtime = cstream->runtime;
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct snd_soc_component *component = NULL;
struct msm_compr_audio *prtd = NULL;
struct msm_compr_pdata *pdata =
snd_soc_platform_get_drvdata(rtd->platform);
struct msm_compr_pdata *pdata = NULL;
pr_debug("%s\n", __func__);
component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
pdata = snd_soc_component_get_drvdata(component);
if (pdata->is_in_use[rtd->dai_link->id] == true) {
pr_err("%s: %s is already in use, err: %d\n",
__func__, rtd->dai_link->cpu_dai_name, -EBUSY);
@ -1699,13 +1716,23 @@ static int msm_compr_capture_open(struct snd_compr_stream *cstream)
{
struct snd_compr_runtime *runtime = cstream->runtime;
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct snd_soc_component *component = NULL;
struct msm_compr_audio *prtd;
struct msm_compr_pdata *pdata =
snd_soc_platform_get_drvdata(rtd->platform);
struct msm_compr_pdata *pdata = NULL;
pr_debug("%s\n", __func__);
component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
pdata = snd_soc_component_get_drvdata(component);
if (!pdata) {
pr_err("%s: pdata is NULL\n", __func__);
return -EINVAL;
}
prtd = kzalloc(sizeof(struct msm_compr_audio), GFP_KERNEL);
if (prtd == NULL) {
if (!prtd) {
pr_err("Failed to allocate memory for msm_compr_audio\n");
return -ENOMEM;
}
@ -1766,6 +1793,7 @@ static int msm_compr_playback_free(struct snd_compr_stream *cstream)
struct snd_compr_runtime *runtime;
struct msm_compr_audio *prtd;
struct snd_soc_pcm_runtime *soc_prtd;
struct snd_soc_component *component = NULL;
struct msm_compr_pdata *pdata;
struct audio_client *ac;
int dir = IN, ret = 0, stream_id;
@ -1780,8 +1808,9 @@ static int msm_compr_playback_free(struct snd_compr_stream *cstream)
}
runtime = cstream->runtime;
soc_prtd = cstream->private_data;
if (!runtime || !soc_prtd || !(soc_prtd->platform)) {
pr_err("%s runtime or soc_prtd or platform is null\n",
component = snd_soc_rtdcom_lookup(soc_prtd, DRV_NAME);
if (!runtime || !soc_prtd || !component) {
pr_err("%s runtime or soc_prtd or component is null\n",
__func__);
return 0;
}
@ -1792,7 +1821,7 @@ static int msm_compr_playback_free(struct snd_compr_stream *cstream)
}
prtd->cmd_interrupt = 1;
wake_up(&prtd->drain_wait);
pdata = snd_soc_platform_get_drvdata(soc_prtd->platform);
pdata = snd_soc_component_get_drvdata(component);
ac = prtd->audio_client;
if (!pdata || !ac) {
pr_err("%s pdata or ac is null\n", __func__);
@ -1867,6 +1896,7 @@ static int msm_compr_capture_free(struct snd_compr_stream *cstream)
struct snd_compr_runtime *runtime;
struct msm_compr_audio *prtd;
struct snd_soc_pcm_runtime *soc_prtd;
struct snd_soc_component *component = NULL;
struct msm_compr_pdata *pdata;
struct audio_client *ac;
int dir = OUT, stream_id;
@ -1879,8 +1909,9 @@ static int msm_compr_capture_free(struct snd_compr_stream *cstream)
}
runtime = cstream->runtime;
soc_prtd = cstream->private_data;
if (!runtime || !soc_prtd || !(soc_prtd->platform)) {
pr_err("%s runtime or soc_prtd or platform is null\n",
component = snd_soc_rtdcom_lookup(soc_prtd, DRV_NAME);
if (!runtime || !soc_prtd || !component) {
pr_err("%s runtime or soc_prtd or component is null\n",
__func__);
return 0;
}
@ -1889,7 +1920,7 @@ static int msm_compr_capture_free(struct snd_compr_stream *cstream)
pr_err("%s prtd is null\n", __func__);
return 0;
}
pdata = snd_soc_platform_get_drvdata(soc_prtd->platform);
pdata = snd_soc_component_get_drvdata(component);
ac = prtd->audio_client;
if (!pdata || !ac) {
pr_err("%s pdata or ac is null\n", __func__);
@ -2207,9 +2238,9 @@ static int msm_compr_trigger(struct snd_compr_stream *cstream, int cmd)
struct snd_compr_runtime *runtime = cstream->runtime;
struct msm_compr_audio *prtd = runtime->private_data;
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct msm_compr_pdata *pdata =
snd_soc_platform_get_drvdata(rtd->platform);
uint32_t *volume = pdata->volume[rtd->dai_link->id];
struct snd_soc_component *component = NULL;
struct msm_compr_pdata *pdata = NULL;
uint32_t *volume = NULL;
struct audio_client *ac = prtd->audio_client;
unsigned long fe_id = rtd->dai_link->id;
int rc = 0;
@ -2219,6 +2250,18 @@ static int msm_compr_trigger(struct snd_compr_stream *cstream, int cmd)
uint32_t stream_index;
uint16_t bits_per_sample = 16;
component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
pdata = snd_soc_component_get_drvdata(component);
if (!pdata) {
pr_err("%s: pdata is NULL\n", __func__);
return -EINVAL;
}
volume = pdata->volume[rtd->dai_link->id];
spin_lock_irqsave(&prtd->lock, flags);
if (atomic_read(&prtd->error)) {
pr_err("%s Got RESET EVENTS notification, return immediately",
@ -2676,6 +2719,7 @@ static int msm_compr_pointer(struct snd_compr_stream *cstream,
struct snd_compr_runtime *runtime = cstream->runtime;
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct msm_compr_audio *prtd = runtime->private_data;
struct snd_soc_component *component = NULL;
struct msm_compr_pdata *pdata = NULL;
struct snd_compr_tstamp tstamp;
uint64_t timestamp = 0;
@ -2683,7 +2727,17 @@ static int msm_compr_pointer(struct snd_compr_stream *cstream,
unsigned long flags;
uint32_t gapless_transition;
pdata = snd_soc_platform_get_drvdata(rtd->platform);
component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
pdata = snd_soc_component_get_drvdata(component);
if (!pdata) {
pr_err("%s: pdata is NULL\n", __func__);
return -EINVAL;
}
pr_debug("%s\n", __func__);
memset(&tstamp, 0x0, sizeof(struct snd_compr_tstamp));
@ -3906,7 +3960,7 @@ static const struct snd_kcontrol_new msm_compr_gapless_controls[] = {
msm_compr_gapless_put),
};
static int msm_compr_probe(struct snd_soc_platform *platform)
static int msm_compr_probe(struct snd_soc_component *component)
{
struct msm_compr_pdata *pdata;
int i;
@ -3919,7 +3973,7 @@ static int msm_compr_probe(struct snd_soc_platform *platform)
if (!pdata)
return -ENOMEM;
snd_soc_platform_set_drvdata(platform, pdata);
snd_soc_component_set_drvdata(component, pdata);
for (i = 0; i < MSM_FRONTEND_DAI_MAX; i++) {
pdata->volume[i][0] = COMPRESSED_LR_VOL_MAX_STEPS;
@ -3931,10 +3985,10 @@ static int msm_compr_probe(struct snd_soc_platform *platform)
pdata->is_in_use[i] = false;
}
snd_soc_add_platform_controls(platform, msm_compr_gapless_controls,
snd_soc_add_component_controls(component, msm_compr_gapless_controls,
ARRAY_SIZE(msm_compr_gapless_controls));
rc = of_property_read_string(platform->dev->of_node,
rc = of_property_read_string(component->dev->of_node,
"qcom,adsp-version", &qdsp_version);
if (!rc) {
if (!strcmp(qdsp_version, "MDSP 1.2"))
@ -4018,6 +4072,7 @@ static int msm_compr_channel_map_info(struct snd_kcontrol *kcontrol,
static int msm_compr_add_volume_control(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = "Compress Playback";
const char *deviceNo = "NN";
const char *suffix = "Volume";
@ -4041,6 +4096,12 @@ static int msm_compr_add_volume_control(struct snd_soc_pcm_runtime *rtd)
pr_err("%s NULL rtd\n", __func__);
return 0;
}
component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return 0;
}
pr_debug("%s: added new compr FE with name %s, id %d, cpu dai %s, device no %d\n",
__func__, rtd->dai_link->name, rtd->dai_link->id,
rtd->dai_link->cpu_dai_name, rtd->pcm->device);
@ -4056,7 +4117,7 @@ static int msm_compr_add_volume_control(struct snd_soc_pcm_runtime *rtd)
fe_volume_control[0].name = mixer_str;
fe_volume_control[0].private_value = rtd->dai_link->id;
pr_debug("Registering new mixer ctl %s", mixer_str);
snd_soc_add_platform_controls(rtd->platform, fe_volume_control,
snd_soc_add_component_controls(component, fe_volume_control,
ARRAY_SIZE(fe_volume_control));
kfree(mixer_str);
return 0;
@ -4064,6 +4125,7 @@ static int msm_compr_add_volume_control(struct snd_soc_pcm_runtime *rtd)
static int msm_compr_add_audio_effects_control(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = "Audio Effects Config";
const char *deviceNo = "NN";
char *mixer_str = NULL;
@ -4080,12 +4142,17 @@ static int msm_compr_add_audio_effects_control(struct snd_soc_pcm_runtime *rtd)
}
};
if (!rtd) {
pr_err("%s NULL rtd\n", __func__);
return 0;
}
component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return 0;
}
pr_debug("%s: added new compr FE with name %s, id %d, cpu dai %s, device no %d\n",
__func__, rtd->dai_link->name, rtd->dai_link->id,
rtd->dai_link->cpu_dai_name, rtd->pcm->device);
@ -4101,7 +4168,7 @@ static int msm_compr_add_audio_effects_control(struct snd_soc_pcm_runtime *rtd)
fe_audio_effects_config_control[0].name = mixer_str;
fe_audio_effects_config_control[0].private_value = rtd->dai_link->id;
pr_debug("Registering new mixer ctl %s\n", mixer_str);
snd_soc_add_platform_controls(rtd->platform,
snd_soc_add_component_controls(component,
fe_audio_effects_config_control,
ARRAY_SIZE(fe_audio_effects_config_control));
kfree(mixer_str);
@ -4111,6 +4178,7 @@ static int msm_compr_add_audio_effects_control(struct snd_soc_pcm_runtime *rtd)
static int msm_compr_add_query_audio_effect_control(
struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = "Query Audio Effect Param";
const char *deviceNo = "NN";
char *mixer_str = NULL;
@ -4130,6 +4198,13 @@ static int msm_compr_add_query_audio_effect_control(
pr_err("%s NULL rtd\n", __func__);
return 0;
}
component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return 0;
}
pr_debug("%s: added new compr FE with name %s, id %d, cpu dai %s, device no %d\n",
__func__, rtd->dai_link->name, rtd->dai_link->id,
rtd->dai_link->cpu_dai_name, rtd->pcm->device);
@ -4143,7 +4218,7 @@ static int msm_compr_add_query_audio_effect_control(
fe_query_audio_effect_control[0].name = mixer_str;
fe_query_audio_effect_control[0].private_value = rtd->dai_link->id;
pr_debug("%s: registering new mixer ctl %s\n", __func__, mixer_str);
snd_soc_add_platform_controls(rtd->platform,
snd_soc_add_component_controls(component,
fe_query_audio_effect_control,
ARRAY_SIZE(fe_query_audio_effect_control));
kfree(mixer_str);
@ -4153,6 +4228,7 @@ static int msm_compr_add_query_audio_effect_control(
static int msm_compr_add_audio_adsp_stream_cmd_control(
struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = DSP_STREAM_CMD;
const char *deviceNo = "NN";
char *mixer_str = NULL;
@ -4170,23 +4246,26 @@ static int msm_compr_add_audio_adsp_stream_cmd_control(
if (!rtd) {
pr_err("%s NULL rtd\n", __func__);
ret = -EINVAL;
goto done;
return -EINVAL;
}
component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
ctl_len = strlen(mixer_ctl_name) + 1 + strlen(deviceNo) + 1;
mixer_str = kzalloc(ctl_len, GFP_KERNEL);
if (!mixer_str) {
ret = -ENOMEM;
goto done;
}
if (!mixer_str)
return -ENOMEM;
snprintf(mixer_str, ctl_len, "%s %d", mixer_ctl_name, rtd->pcm->device);
fe_audio_adsp_stream_cmd_config_control[0].name = mixer_str;
fe_audio_adsp_stream_cmd_config_control[0].private_value =
rtd->dai_link->id;
pr_debug("%s: Registering new mixer ctl %s\n", __func__, mixer_str);
ret = snd_soc_add_platform_controls(rtd->platform,
ret = snd_soc_add_component_controls(component,
fe_audio_adsp_stream_cmd_config_control,
ARRAY_SIZE(fe_audio_adsp_stream_cmd_config_control));
if (ret < 0)
@ -4201,6 +4280,7 @@ done:
static int msm_compr_add_audio_adsp_stream_callback_control(
struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = DSP_STREAM_CALLBACK;
const char *deviceNo = "NN";
char *mixer_str = NULL;
@ -4224,6 +4304,12 @@ static int msm_compr_add_audio_adsp_stream_callback_control(
goto done;
}
component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
ctl_len = strlen(mixer_ctl_name) + 1 + strlen(deviceNo) + 1;
mixer_str = kzalloc(ctl_len, GFP_KERNEL);
if (!mixer_str) {
@ -4236,7 +4322,7 @@ static int msm_compr_add_audio_adsp_stream_callback_control(
fe_audio_adsp_callback_config_control[0].private_value =
rtd->dai_link->id;
pr_debug("%s: Registering new mixer ctl %s\n", __func__, mixer_str);
ret = snd_soc_add_platform_controls(rtd->platform,
ret = snd_soc_add_component_controls(component,
fe_audio_adsp_callback_config_control,
ARRAY_SIZE(fe_audio_adsp_callback_config_control));
if (ret < 0) {
@ -4264,6 +4350,7 @@ done:
static int msm_compr_add_dec_runtime_params_control(
struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = "Audio Stream";
const char *deviceNo = "NN";
const char *suffix = "Dec Params";
@ -4286,6 +4373,12 @@ static int msm_compr_add_dec_runtime_params_control(
return 0;
}
component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return 0;
}
pr_debug("%s: added new compr FE with name %s, id %d, cpu dai %s, device no %d\n",
__func__, rtd->dai_link->name, rtd->dai_link->id,
rtd->dai_link->cpu_dai_name, rtd->pcm->device);
@ -4303,7 +4396,7 @@ static int msm_compr_add_dec_runtime_params_control(
fe_dec_params_control[0].name = mixer_str;
fe_dec_params_control[0].private_value = rtd->dai_link->id;
pr_debug("Registering new mixer ctl %s", mixer_str);
snd_soc_add_platform_controls(rtd->platform,
snd_soc_add_component_controls(component,
fe_dec_params_control,
ARRAY_SIZE(fe_dec_params_control));
kfree(mixer_str);
@ -4312,6 +4405,7 @@ static int msm_compr_add_dec_runtime_params_control(
static int msm_compr_add_app_type_cfg_control(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_component *component = NULL;
const char *playback_mixer_ctl_name = "Audio Stream";
const char *capture_mixer_ctl_name = "Audio Stream Capture";
const char *deviceNo = "NN";
@ -4335,6 +4429,12 @@ static int msm_compr_add_app_type_cfg_control(struct snd_soc_pcm_runtime *rtd)
return 0;
}
component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return 0;
}
pr_debug("%s: added new compr FE ctl with name %s, id %d, cpu dai %s, device no %d\n",
__func__, rtd->dai_link->name, rtd->dai_link->id,
rtd->dai_link->cpu_dai_name, rtd->pcm->device);
@ -4372,7 +4472,7 @@ static int msm_compr_add_app_type_cfg_control(struct snd_soc_pcm_runtime *rtd)
msm_compr_capture_app_type_cfg_get;
}
pr_debug("Registering new mixer ctl %s", mixer_str);
snd_soc_add_platform_controls(rtd->platform,
snd_soc_add_component_controls(component,
fe_app_type_cfg_control,
ARRAY_SIZE(fe_app_type_cfg_control));
kfree(mixer_str);
@ -4381,6 +4481,7 @@ static int msm_compr_add_app_type_cfg_control(struct snd_soc_pcm_runtime *rtd)
static int msm_compr_add_channel_map_control(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = "Playback Channel Map";
const char *deviceNo = "NN";
char *mixer_str = NULL;
@ -4403,6 +4504,12 @@ static int msm_compr_add_channel_map_control(struct snd_soc_pcm_runtime *rtd)
return -EINVAL;
}
component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
pr_debug("%s: added new compr FE with name %s, id %d, cpu dai %s, device no %d\n",
__func__, rtd->dai_link->name, rtd->dai_link->id,
rtd->dai_link->cpu_dai_name, rtd->pcm->device);
@ -4418,11 +4525,11 @@ static int msm_compr_add_channel_map_control(struct snd_soc_pcm_runtime *rtd)
fe_channel_map_control[0].name = mixer_str;
fe_channel_map_control[0].private_value = rtd->dai_link->id;
pr_debug("%s: Registering new mixer ctl %s\n", __func__, mixer_str);
snd_soc_add_platform_controls(rtd->platform,
snd_soc_add_component_controls(component,
fe_channel_map_control,
ARRAY_SIZE(fe_channel_map_control));
pdata = snd_soc_platform_get_drvdata(rtd->platform);
pdata = snd_soc_component_get_drvdata(component);
pdata->ch_map[rtd->dai_link->id] =
kzalloc(sizeof(struct msm_compr_ch_map), GFP_KERNEL);
if (!pdata->ch_map[rtd->dai_link->id]) {
@ -4437,6 +4544,7 @@ static int msm_compr_add_channel_map_control(struct snd_soc_pcm_runtime *rtd)
static int msm_compr_add_io_fd_cmd_control(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = "Playback ION FD";
const char *deviceNo = "NN";
char *mixer_str = NULL;
@ -4454,22 +4562,25 @@ static int msm_compr_add_io_fd_cmd_control(struct snd_soc_pcm_runtime *rtd)
if (!rtd) {
pr_err("%s NULL rtd\n", __func__);
ret = -EINVAL;
goto done;
return -EINVAL;
}
component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
ctl_len = strlen(mixer_ctl_name) + 1 + strlen(deviceNo) + 1;
mixer_str = kzalloc(ctl_len, GFP_KERNEL);
if (!mixer_str) {
ret = -ENOMEM;
goto done;
}
if (!mixer_str)
return -ENOMEM;
snprintf(mixer_str, ctl_len, "%s %d", mixer_ctl_name, rtd->pcm->device);
fe_ion_fd_config_control[0].name = mixer_str;
fe_ion_fd_config_control[0].private_value = rtd->dai_link->id;
pr_debug("%s: Registering new mixer ctl %s\n", __func__, mixer_str);
ret = snd_soc_add_platform_controls(rtd->platform,
ret = snd_soc_add_component_controls(component,
fe_ion_fd_config_control,
ARRAY_SIZE(fe_ion_fd_config_control));
if (ret < 0)
@ -4482,6 +4593,7 @@ done:
static int msm_compr_add_event_ack_cmd_control(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = "Playback Event Ack";
const char *deviceNo = "NN";
char *mixer_str = NULL;
@ -4499,22 +4611,25 @@ static int msm_compr_add_event_ack_cmd_control(struct snd_soc_pcm_runtime *rtd)
if (!rtd) {
pr_err("%s NULL rtd\n", __func__);
ret = -EINVAL;
goto done;
return -EINVAL;
}
component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
ctl_len = strlen(mixer_ctl_name) + 1 + strlen(deviceNo) + 1;
mixer_str = kzalloc(ctl_len, GFP_KERNEL);
if (!mixer_str) {
ret = -ENOMEM;
goto done;
}
if (!mixer_str)
return -ENOMEM;
snprintf(mixer_str, ctl_len, "%s %d", mixer_ctl_name, rtd->pcm->device);
fe_event_ack_config_control[0].name = mixer_str;
fe_event_ack_config_control[0].private_value = rtd->dai_link->id;
pr_debug("%s: Registering new mixer ctl %s\n", __func__, mixer_str);
ret = snd_soc_add_platform_controls(rtd->platform,
ret = snd_soc_add_component_controls(component,
fe_event_ack_config_control,
ARRAY_SIZE(fe_event_ack_config_control));
if (ret < 0)
@ -4593,7 +4708,8 @@ static struct snd_compr_ops msm_compr_ops = {
.get_codec_caps = msm_compr_get_codec_caps,
};
static struct snd_soc_platform_driver msm_soc_platform = {
static struct snd_soc_component_driver msm_soc_component = {
.name = DRV_NAME,
.probe = msm_compr_probe,
.compr_ops = &msm_compr_ops,
.pcm_new = msm_compr_new,
@ -4603,13 +4719,13 @@ static int msm_compr_dev_probe(struct platform_device *pdev)
{
pr_debug("%s: dev name %s\n", __func__, dev_name(&pdev->dev));
return snd_soc_register_platform(&pdev->dev,
&msm_soc_platform);
return snd_soc_register_component(&pdev->dev,
&msm_soc_component, NULL, 0);
}
static int msm_compr_remove(struct platform_device *pdev)
{
snd_soc_unregister_platform(&pdev->dev);
snd_soc_unregister_component(&pdev->dev);
return 0;
}

View File

@ -20,6 +20,8 @@
#include "msm-slim-dma.h"
#include "codecs/cpe_core.h"
#define DRV_NAME "msm-cpe-lsm"
#define SAMPLE_RATE_48KHZ 48000
#define SAMPLE_RATE_16KHZ 16000
#define LSM_VOICE_WAKEUP_APP_V2 2
@ -3202,55 +3204,57 @@ fail:
}
/*
* msm_asoc_cpe_lsm_probe: ASoC framework for lsm platform driver
* @platform: platform registered with ASoC core
* msm_asoc_cpe_lsm_probe: ASoC framework for lsm component driver
* @component: component registered with ASoC core
*
* Allocate the private data for this platform and obtain the ops for
* Allocate the private data for this component and obtain the ops for
* lsm and afe modules from underlying driver. Also find the codec
* for this platform as specified by machine driver for ASoC framework.
* for this component as specified by machine driver for ASoC framework.
*/
static int msm_asoc_cpe_lsm_probe(struct snd_soc_platform *platform)
static int msm_asoc_cpe_lsm_probe(struct snd_soc_component *component)
{
struct snd_soc_card *card;
struct snd_soc_pcm_runtime *rtd;
struct snd_soc_codec *codec;
struct cpe_priv *cpe_priv;
struct snd_soc_component *component_rtd = NULL;
const struct snd_kcontrol_new *kcontrol;
bool found_runtime = false;
const char *cpe_dev_id = "qcom,msm-cpe-lsm-id";
u32 port_id = 0;
int ret = 0;
if (!platform || !platform->component.card) {
pr_err("%s: Invalid platform or card\n",
if (!component || !component->card) {
pr_err("%s: Invalid component or card\n",
__func__);
return -EINVAL;
}
card = platform->component.card;
card = component->card;
/* Match platform to codec */
/* Match component to codec */
list_for_each_entry(rtd, &card->rtd_list, list) {
if (!rtd->platform)
component_rtd = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
if (!component_rtd)
continue;
if (!strcmp(rtd->platform->component.name,
platform->component.name)) {
if (!strcmp(component_rtd->name,
component->name)) {
found_runtime = true;
break;
}
}
if (!found_runtime) {
dev_err(platform->dev,
"%s: Failed to find runtime for platform\n",
dev_err(component->dev,
"%s: Failed to find runtime for component\n",
__func__);
return -EINVAL;
}
ret = of_property_read_u32(platform->dev->of_node, cpe_dev_id,
ret = of_property_read_u32(component->dev->of_node, cpe_dev_id,
&port_id);
if (ret) {
dev_dbg(platform->dev,
dev_dbg(component->dev,
"%s: missing 0x%x in dt node\n", __func__, port_id);
port_id = 1;
}
@ -3267,7 +3271,7 @@ static int msm_asoc_cpe_lsm_probe(struct snd_soc_platform *platform)
wcd_cpe_get_lsm_ops(&cpe_priv->lsm_ops);
wcd_cpe_get_afe_ops(&cpe_priv->afe_ops);
snd_soc_platform_set_drvdata(platform, cpe_priv);
snd_soc_component_set_drvdata(component, cpe_priv);
kcontrol = &msm_cpe_kcontrols[0];
snd_ctl_add(card->snd_card, snd_ctl_new1(kcontrol, cpe_priv));
return 0;
@ -3285,7 +3289,8 @@ static const struct snd_pcm_ops msm_cpe_lsm_ops = {
.compat_ioctl = msm_cpe_lsm_ioctl_compat,
};
static struct snd_soc_platform_driver msm_soc_cpe_platform = {
static struct snd_soc_component_driver msm_soc_cpe_component = {
.name = DRV_NAME,
.ops = &msm_cpe_lsm_ops,
.probe = msm_asoc_cpe_lsm_probe,
};
@ -3299,8 +3304,9 @@ static struct snd_soc_platform_driver msm_soc_cpe_platform = {
static int msm_cpe_lsm_probe(struct platform_device *pdev)
{
return snd_soc_register_platform(&pdev->dev,
&msm_soc_cpe_platform);
return snd_soc_register_component(&pdev->dev,
&msm_soc_cpe_component,
NULL, 0);
}
/*
@ -3311,7 +3317,7 @@ static int msm_cpe_lsm_probe(struct platform_device *pdev)
*/
static int msm_cpe_lsm_remove(struct platform_device *pdev)
{
snd_soc_unregister_platform(&pdev->dev);
snd_soc_unregister_commponent(&pdev->dev);
return 0;
}

View File

@ -67,7 +67,7 @@ int msm_dolby_dap_init(int port_id, int copp_idx, int channels,
return 0;
}
void msm_dolby_dap_deinit(int port_id) { }
void msm_dolby_dap_add_controls(struct snd_soc_platform *platform) { }
void msm_dolby_dap_add_controls(struct snd_soc_component *component) { }
int dolby_dap_set_custom_stereo_onoff(int port_id, int copp_idx,
bool is_custom_stereo_enabled)
{

View File

@ -25,6 +25,8 @@
#include <dsp/q6lsm.h>
#include "msm-pcm-routing-v2.h"
#define DRV_NAME "msm-lsm-client"
#define CAPTURE_MIN_NUM_PERIODS 2
#define CAPTURE_MAX_NUM_PERIODS 8
#define CAPTURE_MAX_PERIOD_SIZE 61440
@ -2932,14 +2934,15 @@ static int msm_asoc_lsm_new(struct snd_soc_pcm_runtime *rtd)
return ret;
}
static int msm_asoc_lsm_probe(struct snd_soc_platform *platform)
static int msm_asoc_lsm_probe(struct snd_soc_component *component)
{
pr_debug("enter %s\n", __func__);
return 0;
}
static struct snd_soc_platform_driver msm_soc_platform = {
static struct snd_soc_component_driver msm_soc_component = {
.name = DRV_NAME,
.ops = &msm_lsm_ops,
.pcm_new = msm_asoc_lsm_new,
.probe = msm_asoc_lsm_probe,
@ -2948,12 +2951,13 @@ static struct snd_soc_platform_driver msm_soc_platform = {
static int msm_lsm_probe(struct platform_device *pdev)
{
return snd_soc_register_platform(&pdev->dev, &msm_soc_platform);
return snd_soc_register_component(&pdev->dev, &msm_soc_component,
NULL, 0);
}
static int msm_lsm_remove(struct platform_device *pdev)
{
snd_soc_unregister_platform(&pdev->dev);
snd_soc_unregister_component(&pdev->dev);
return 0;
}

View File

@ -24,6 +24,8 @@
#include <dsp/q6adm-v2.h>
#include "msm-pcm-afe-v2.h"
#define DRV_NAME "msm-pcm-afe-v2"
#define MIN_PLAYBACK_PERIOD_SIZE (128 * 2)
#define MAX_PLAYBACK_PERIOD_SIZE (128 * 2 * 2 * 6)
#define MIN_PLAYBACK_NUM_PERIODS (4)
@ -854,13 +856,14 @@ static int msm_asoc_pcm_new(struct snd_soc_pcm_runtime *rtd)
return ret;
}
static int msm_afe_afe_probe(struct snd_soc_platform *platform)
static int msm_afe_afe_probe(struct snd_soc_component *component)
{
pr_debug("%s\n", __func__);
return 0;
}
static struct snd_soc_platform_driver msm_soc_platform = {
static struct snd_soc_component_driver msm_soc_component = {
.name = DRV_NAME,
.ops = &msm_afe_ops,
.pcm_new = msm_asoc_pcm_new,
.probe = msm_afe_afe_probe,
@ -870,14 +873,14 @@ static int msm_afe_probe(struct platform_device *pdev)
{
pr_debug("%s: dev name %s\n", __func__, dev_name(&pdev->dev));
return snd_soc_register_platform(&pdev->dev,
&msm_soc_platform);
return snd_soc_register_component(&pdev->dev,
&msm_soc_component, NULL, 0);
}
static int msm_afe_remove(struct platform_device *pdev)
{
pr_debug("%s\n", __func__);
snd_soc_unregister_platform(&pdev->dev);
snd_soc_unregister_component(&pdev->dev);
return 0;
}
static const struct of_device_id msm_pcm_afe_dt_match[] = {

View File

@ -18,6 +18,8 @@
#include "msm-pcm-q6-v2.h"
#include "msm-pcm-routing-v2.h"
#define DRV_NAME "msm-pcm-dtmf-v2"
enum {
DTMF_IN_RX,
DTMF_IN_TX,
@ -157,9 +159,9 @@ static struct snd_kcontrol_new msm_dtmf_controls[] = {
msm_dtmf_detect_volte_rx_put),
};
static int msm_pcm_dtmf_probe(struct snd_soc_platform *platform)
static int msm_pcm_dtmf_probe(struct snd_soc_component *component)
{
snd_soc_add_platform_controls(platform, msm_dtmf_controls,
snd_soc_add_component_controls(component, msm_dtmf_controls,
ARRAY_SIZE(msm_dtmf_controls));
return 0;
}
@ -531,7 +533,8 @@ static int msm_asoc_pcm_new(struct snd_soc_pcm_runtime *rtd)
return ret;
}
static struct snd_soc_platform_driver msm_soc_platform = {
static struct snd_soc_component_driver msm_soc_component = {
.name = DRV_NAME,
.ops = &msm_pcm_ops,
.pcm_new = msm_asoc_pcm_new,
.probe = msm_pcm_dtmf_probe,
@ -541,13 +544,13 @@ static int msm_pcm_probe(struct platform_device *pdev)
{
pr_debug("%s: dev name %s\n", __func__, dev_name(&pdev->dev));
return snd_soc_register_platform(&pdev->dev,
&msm_soc_platform);
return snd_soc_register_component(&pdev->dev,
&msm_soc_component, NULL, 0);
}
static int msm_pcm_remove(struct platform_device *pdev)
{
snd_soc_unregister_platform(&pdev->dev);
snd_soc_unregister_component(&pdev->dev);
return 0;
}

View File

@ -20,6 +20,8 @@
#include <dsp/msm_audio_ion.h>
#include <dsp/q6voice.h>
#define DRV_NAME "msm-pcm-host-voice-v2"
#define HPCM_MAX_Q_LEN 2
#define HPCM_MIN_VOC_PKT_SIZE 320
#define HPCM_MAX_VOC_PKT_SIZE 640
@ -1435,15 +1437,16 @@ static int msm_asoc_pcm_new(struct snd_soc_pcm_runtime *rtd)
return 0;
}
static int msm_pcm_hpcm_probe(struct snd_soc_platform *platform)
static int msm_pcm_hpcm_probe(struct snd_soc_component *component)
{
snd_soc_add_platform_controls(platform, msm_hpcm_controls,
snd_soc_add_component_controls(component, msm_hpcm_controls,
ARRAY_SIZE(msm_hpcm_controls));
return 0;
}
static struct snd_soc_platform_driver msm_soc_platform = {
static struct snd_soc_component_driver msm_soc_component = {
.name = DRV_NAME,
.ops = &msm_pcm_ops,
.pcm_new = msm_asoc_pcm_new,
.probe = msm_pcm_hpcm_probe,
@ -1453,12 +1456,13 @@ static int msm_pcm_probe(struct platform_device *pdev)
{
pr_info("%s: dev name %s\n", __func__, dev_name(&pdev->dev));
return snd_soc_register_platform(&pdev->dev, &msm_soc_platform);
return snd_soc_register_component(&pdev->dev, &msm_soc_component,
NULL, 0);
}
static int msm_pcm_remove(struct platform_device *pdev)
{
snd_soc_unregister_platform(&pdev->dev);
snd_soc_unregister_component(&pdev->dev);
return 0;
}

View File

@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2011-2014, 2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2014, 2017-2018, The Linux Foundation. All rights reserved.
*/
#include <linux/init.h>
@ -10,6 +10,7 @@
#include <sound/soc.h>
#include <sound/pcm.h>
#define DRV_NAME "msm-pcm-hostless"
static int msm_pcm_hostless_prepare(struct snd_pcm_substream *substream)
{
@ -25,7 +26,8 @@ static const struct snd_pcm_ops msm_pcm_hostless_ops = {
.prepare = msm_pcm_hostless_prepare
};
static struct snd_soc_platform_driver msm_soc_hostless_platform = {
static struct snd_soc_component_driver msm_soc_hostless_component = {
.name = DRV_NAME,
.ops = &msm_pcm_hostless_ops,
};
@ -33,13 +35,14 @@ static int msm_pcm_hostless_probe(struct platform_device *pdev)
{
pr_debug("%s: dev name %s\n", __func__, dev_name(&pdev->dev));
return snd_soc_register_platform(&pdev->dev,
&msm_soc_hostless_platform);
return snd_soc_register_component(&pdev->dev,
&msm_soc_hostless_component,
NULL, 0);
}
static int msm_pcm_hostless_remove(struct platform_device *pdev)
{
snd_soc_unregister_platform(&pdev->dev);
snd_soc_unregister_component(&pdev->dev);
return 0;
}

View File

@ -21,6 +21,8 @@
#include "msm-pcm-routing-v2.h"
#define DRV_NAME "msm-pcm-loopback-v2"
#define LOOPBACK_VOL_MAX_STEPS 0x2000
#define LOOPBACK_SESSION_MAX 4
@ -151,9 +153,9 @@ static struct snd_kcontrol_new msm_loopback_controls[] = {
msm_loopback_session_mute_put),
};
static int msm_pcm_loopback_probe(struct snd_soc_platform *platform)
static int msm_pcm_loopback_probe(struct snd_soc_component *component)
{
snd_soc_add_platform_controls(platform, msm_loopback_controls,
snd_soc_add_component_controls(component, msm_loopback_controls,
ARRAY_SIZE(msm_loopback_controls));
return 0;
@ -180,10 +182,17 @@ static int pcm_loopback_set_volume(struct msm_pcm_loopback *prtd,
static int msm_pcm_loopback_get_session(struct snd_soc_pcm_runtime *rtd,
struct msm_pcm_loopback **pcm)
{
struct snd_soc_component *component =
snd_soc_rtdcom_lookup(rtd, DRV_NAME);
int ret = 0;
int n, index = -1;
dev_dbg(rtd->platform->dev, "%s: stream %s\n", __func__,
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
dev_dbg(component->dev, "%s: stream %s\n", __func__,
rtd->dai_link->stream_name);
mutex_lock(&loopback_session_lock);
@ -206,7 +215,7 @@ static int msm_pcm_loopback_get_session(struct snd_soc_pcm_runtime *rtd,
}
if (index < 0) {
dev_err(rtd->platform->dev, "%s: Max Sessions allocated\n",
dev_err(component->dev, "%s: Max Sessions allocated\n",
__func__);
ret = -EAGAIN;
goto exit;
@ -222,7 +231,7 @@ static int msm_pcm_loopback_get_session(struct snd_soc_pcm_runtime *rtd,
strlcpy(session_map[index].stream_name,
rtd->dai_link->stream_name,
sizeof(session_map[index].stream_name));
dev_dbg(rtd->platform->dev, "%s: stream %s index %d\n",
dev_dbg(component->dev, "%s: stream %s index %d\n",
__func__, session_map[index].stream_name, index);
mutex_init(&session_map[index].loopback_priv->lock);
@ -236,6 +245,8 @@ static int msm_pcm_open(struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
struct snd_soc_component *component =
snd_soc_rtdcom_lookup(rtd, DRV_NAME);
struct msm_pcm_loopback *pcm = NULL;
int ret = 0;
uint16_t bits_per_sample = 16;
@ -244,6 +255,11 @@ static int msm_pcm_open(struct snd_pcm_substream *substream)
uint32_t param_id;
struct msm_pcm_pdata *pdata;
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
ret = msm_pcm_loopback_get_session(rtd, &pcm);
if (ret)
return ret;
@ -258,7 +274,7 @@ static int msm_pcm_open(struct snd_pcm_substream *substream)
pcm->capture_substream = substream;
pcm->instance++;
dev_dbg(rtd->platform->dev, "%s: pcm out open: %d,%d\n", __func__,
dev_dbg(component->dev, "%s: pcm out open: %d,%d\n", __func__,
pcm->instance, substream->stream);
if (pcm->instance == 2) {
struct snd_soc_pcm_runtime *soc_pcm_rx =
@ -269,9 +285,9 @@ static int msm_pcm_open(struct snd_pcm_substream *substream)
stop_pcm(pcm);
pdata = (struct msm_pcm_pdata *)
dev_get_drvdata(rtd->platform->dev);
dev_get_drvdata(component->dev);
if (!pdata) {
dev_err(rtd->platform->dev,
dev_err(component->dev,
"%s: platform data not populated\n", __func__);
mutex_unlock(&pcm->lock);
return -EINVAL;
@ -280,7 +296,7 @@ static int msm_pcm_open(struct snd_pcm_substream *substream)
pcm->audio_client = q6asm_audio_client_alloc(
(app_cb)msm_pcm_loopback_event_handler, pcm);
if (!pcm->audio_client) {
dev_err(rtd->platform->dev,
dev_err(component->dev,
"%s: Could not allocate memory\n", __func__);
mutex_unlock(&pcm->lock);
return -ENOMEM;
@ -290,7 +306,7 @@ static int msm_pcm_open(struct snd_pcm_substream *substream)
ret = q6asm_open_loopback_v2(pcm->audio_client,
bits_per_sample);
if (ret < 0) {
dev_err(rtd->platform->dev,
dev_err(component->dev,
"%s: pcm out open failed\n", __func__);
q6asm_audio_client_free(pcm->audio_client);
mutex_unlock(&pcm->lock);
@ -309,7 +325,7 @@ static int msm_pcm_open(struct snd_pcm_substream *substream)
pcm->playback_substream = substream;
ret = pcm_loopback_set_volume(pcm, pcm->volume);
if (ret < 0)
dev_err(rtd->platform->dev,
dev_err(component->dev,
"Error %d setting volume", ret);
}
/* Set to largest negative value */
@ -327,7 +343,7 @@ static int msm_pcm_open(struct snd_pcm_substream *substream)
&asm_mtmx_strtr_window,
param_id);
}
dev_info(rtd->platform->dev, "%s: Instance = %d, Stream ID = %s\n",
dev_info(component->dev, "%s: Instance = %d, Stream ID = %s\n",
__func__, pcm->instance, substream->pcm->id);
runtime->private_data = pcm;
@ -364,12 +380,19 @@ static int msm_pcm_close(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime;
struct msm_pcm_loopback *pcm = runtime->private_data;
struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
struct snd_soc_component *component =
snd_soc_rtdcom_lookup(rtd, DRV_NAME);
int ret = 0, n;
bool found = false;
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
mutex_lock(&pcm->lock);
dev_dbg(rtd->platform->dev, "%s: end pcm call:%d\n",
dev_dbg(component->dev, "%s: end pcm call:%d\n",
__func__, substream->stream);
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
pcm->playback_start = 0;
@ -378,7 +401,7 @@ static int msm_pcm_close(struct snd_pcm_substream *substream)
pcm->instance--;
if (!pcm->playback_start || !pcm->capture_start) {
dev_dbg(rtd->platform->dev, "%s: end pcm call\n", __func__);
dev_dbg(component->dev, "%s: end pcm call\n", __func__);
stop_pcm(pcm);
}
@ -398,7 +421,7 @@ static int msm_pcm_close(struct snd_pcm_substream *substream)
mutex_destroy(&session_map[n].loopback_priv->lock);
session_map[n].loopback_priv = NULL;
kfree(pcm);
dev_dbg(rtd->platform->dev, "%s: stream freed %s\n",
dev_dbg(component->dev, "%s: stream freed %s\n",
__func__, rtd->dai_link->stream_name);
mutex_unlock(&loopback_session_lock);
return 0;
@ -415,10 +438,17 @@ static int msm_pcm_prepare(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime;
struct msm_pcm_loopback *pcm = runtime->private_data;
struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
struct snd_soc_component *component =
snd_soc_rtdcom_lookup(rtd, DRV_NAME);
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
mutex_lock(&pcm->lock);
dev_dbg(rtd->platform->dev, "%s: ASM loopback stream:%d\n",
dev_dbg(component->dev, "%s: ASM loopback stream:%d\n",
__func__, substream->stream);
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
if (!pcm->playback_start)
@ -437,12 +467,19 @@ static int msm_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
struct snd_pcm_runtime *runtime = substream->runtime;
struct msm_pcm_loopback *pcm = runtime->private_data;
struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
struct snd_soc_component *component =
snd_soc_rtdcom_lookup(rtd, DRV_NAME);
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
dev_dbg(rtd->platform->dev,
dev_dbg(component->dev,
"%s: playback_start:%d,capture_start:%d\n", __func__,
pcm->playback_start, pcm->capture_start);
if (pcm->playback_start && pcm->capture_start)
@ -451,7 +488,7 @@ static int msm_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
case SNDRV_PCM_TRIGGER_STOP:
dev_dbg(rtd->platform->dev,
dev_dbg(component->dev,
"%s:Pause/Stop - playback_start:%d,capture_start:%d\n",
__func__, pcm->playback_start, pcm->capture_start);
if (pcm->playback_start && pcm->capture_start)
@ -727,7 +764,8 @@ static int msm_asoc_pcm_new(struct snd_soc_pcm_runtime *rtd)
return ret;
}
static struct snd_soc_platform_driver msm_soc_platform = {
static struct snd_soc_component_driver msm_soc_component = {
.name = DRV_NAME,
.ops = &msm_pcm_ops,
.pcm_new = msm_asoc_pcm_new,
.probe = msm_pcm_loopback_probe,
@ -752,13 +790,14 @@ static int msm_pcm_probe(struct platform_device *pdev)
dev_set_drvdata(&pdev->dev, pdata);
return snd_soc_register_platform(&pdev->dev,
&msm_soc_platform);
return snd_soc_register_component(&pdev->dev,
&msm_soc_component,
NULL, 0);
}
static int msm_pcm_remove(struct platform_device *pdev)
{
snd_soc_unregister_platform(&pdev->dev);
snd_soc_unregister_component(&pdev->dev);
return 0;
}

View File

@ -33,6 +33,9 @@
#include "msm-pcm-q6-v2.h"
#include "msm-pcm-routing-v2.h"
#define DRV_NAME "msm-pcm-q6-noirq"
#define PCM_MASTER_VOL_MAX_STEPS 0x2000
static const DECLARE_TLV_DB_LINEAR(msm_pcm_vol_gain, 0,
PCM_MASTER_VOL_MAX_STEPS);
@ -256,6 +259,8 @@ static int msm_pcm_hw_params(struct snd_pcm_substream *substream,
{
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_soc_pcm_runtime *soc_prtd = substream->private_data;
struct snd_soc_component *component =
snd_soc_rtdcom_lookup(soc_prtd, DRV_NAME);
struct msm_audio *prtd = runtime->private_data;
struct msm_plat_data *pdata;
struct snd_dma_buffer *dma_buf = &substream->dma_buffer;
@ -270,8 +275,13 @@ static int msm_pcm_hw_params(struct snd_pcm_substream *substream,
bool use_default_chmap = true;
char *chmap = NULL;
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
pdata = (struct msm_plat_data *)
dev_get_drvdata(soc_prtd->platform->dev);
dev_get_drvdata(component->dev);
if (!pdata) {
ret = -EINVAL;
pr_err("%s: platform data not populated ret: %d\n", __func__,
@ -790,6 +800,7 @@ end:
static int msm_pcm_add_channel_map_control(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = "Playback Channel Map";
const char *deviceNo = "NN";
char *mixer_str = NULL;
@ -812,6 +823,12 @@ static int msm_pcm_add_channel_map_control(struct snd_soc_pcm_runtime *rtd)
return -EINVAL;
}
component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
pr_debug("%s: added new pcm FE with name %s, id %d, cpu dai %s, device no %d\n",
__func__, rtd->dai_link->name, rtd->dai_link->id,
rtd->dai_link->cpu_dai_name, rtd->pcm->device);
@ -826,11 +843,11 @@ static int msm_pcm_add_channel_map_control(struct snd_soc_pcm_runtime *rtd)
fe_channel_map_control[0].name = mixer_str;
fe_channel_map_control[0].private_value = rtd->dai_link->id;
pr_debug("%s: Registering new mixer ctl %s\n", __func__, mixer_str);
snd_soc_add_platform_controls(rtd->platform,
snd_soc_add_component_controls(component,
fe_channel_map_control,
ARRAY_SIZE(fe_channel_map_control));
pdata = snd_soc_platform_get_drvdata(rtd->platform);
pdata = snd_soc_component_get_drvdata(component);
pdata->ch_map[rtd->dai_link->id] =
kzalloc(sizeof(struct msm_pcm_ch_map), GFP_KERNEL);
if (!pdata->ch_map[rtd->dai_link->id]) {
@ -893,6 +910,7 @@ static int msm_pcm_fe_topology_put(struct snd_kcontrol *kcontrol,
static int msm_pcm_add_fe_topology_control(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = "PCM_Dev";
const char *deviceNo = "NN";
const char *topo_text = "Topology";
@ -911,6 +929,12 @@ static int msm_pcm_add_fe_topology_control(struct snd_soc_pcm_runtime *rtd)
},
};
component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
ctl_len = strlen(mixer_ctl_name) + 1 + strlen(deviceNo) + 1 +
strlen(topo_text) + 1;
mixer_str = kzalloc(ctl_len, GFP_KERNEL);
@ -923,7 +947,7 @@ static int msm_pcm_add_fe_topology_control(struct snd_soc_pcm_runtime *rtd)
topology_control[0].name = mixer_str;
topology_control[0].private_value = rtd->dai_link->id;
ret = snd_soc_add_platform_controls(rtd->platform, topology_control,
ret = snd_soc_add_component_controls(component, topology_control,
ARRAY_SIZE(topology_control));
msm_pcm_fe_topology[rtd->dai_link->id] = 0;
kfree(mixer_str);
@ -1240,7 +1264,8 @@ static const struct snd_pcm_ops msm_pcm_ops = {
.close = msm_pcm_close,
};
static struct snd_soc_platform_driver msm_soc_platform = {
static struct snd_soc_component_driver msm_soc_component = {
.name = DRV_NAME,
.ops = &msm_pcm_ops,
.pcm_new = msm_asoc_pcm_new,
};
@ -1279,8 +1304,9 @@ static int msm_pcm_probe(struct platform_device *pdev)
dev_dbg(&pdev->dev, "%s: dev name %s\n",
__func__, dev_name(&pdev->dev));
dev_dbg(&pdev->dev, "Pull mode driver register\n");
rc = snd_soc_register_platform(&pdev->dev,
&msm_soc_platform);
rc = snd_soc_register_component(&pdev->dev,
&msm_soc_component,
NULL, 0);
if (rc)
dev_err(&pdev->dev, "Failed to register pull mode driver\n");
@ -1295,7 +1321,7 @@ static int msm_pcm_remove(struct platform_device *pdev)
dev_dbg(&pdev->dev, "Pull mode remove\n");
pdata = dev_get_drvdata(&pdev->dev);
devm_kfree(&pdev->dev, pdata);
snd_soc_unregister_platform(&pdev->dev);
snd_soc_unregister_component(&pdev->dev);
return 0;
}
static const struct of_device_id msm_pcm_noirq_dt_match[] = {

View File

@ -34,6 +34,8 @@
#include "msm-pcm-routing-v2.h"
#include "msm-qti-pp-config.h"
#define DRV_NAME "msm-pcm-q6-v2"
enum stream_state {
IDLE = 0,
STOPPED,
@ -312,6 +314,8 @@ static int msm_pcm_playback_prepare(struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_soc_pcm_runtime *soc_prtd = substream->private_data;
struct snd_soc_component *component =
snd_soc_rtdcom_lookup(soc_prtd, DRV_NAME);
struct msm_audio *prtd = runtime->private_data;
struct msm_plat_data *pdata;
struct snd_pcm_hw_params *params;
@ -320,8 +324,13 @@ static int msm_pcm_playback_prepare(struct snd_pcm_substream *substream)
uint16_t bits_per_sample;
uint16_t sample_word_size;
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
pdata = (struct msm_plat_data *)
dev_get_drvdata(soc_prtd->platform->dev);
dev_get_drvdata(component->dev);
if (!pdata) {
pr_err("%s: platform data not populated\n", __func__);
return -EINVAL;
@ -464,6 +473,8 @@ static int msm_pcm_capture_prepare(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime;
struct msm_audio *prtd = runtime->private_data;
struct snd_soc_pcm_runtime *soc_prtd = substream->private_data;
struct snd_soc_component *component =
snd_soc_rtdcom_lookup(soc_prtd, DRV_NAME);
struct msm_plat_data *pdata;
struct snd_pcm_hw_params *params;
struct msm_pcm_routing_evt event;
@ -472,8 +483,13 @@ static int msm_pcm_capture_prepare(struct snd_pcm_substream *substream)
uint16_t bits_per_sample = 16;
uint16_t sample_word_size;
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
pdata = (struct msm_plat_data *)
dev_get_drvdata(soc_prtd->platform->dev);
dev_get_drvdata(component->dev);
if (!pdata) {
pr_err("%s: platform data not populated\n", __func__);
return -EINVAL;
@ -658,12 +674,19 @@ static int msm_pcm_open(struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_soc_pcm_runtime *soc_prtd = substream->private_data;
struct snd_soc_component *component =
snd_soc_rtdcom_lookup(soc_prtd, DRV_NAME);
struct msm_audio *prtd;
struct msm_plat_data *pdata;
int ret = 0;
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
pdata = (struct msm_plat_data *)
dev_get_drvdata(soc_prtd->platform->dev);
dev_get_drvdata(component->dev);
if (!pdata) {
pr_err("%s: platform data not populated\n", __func__);
return -EINVAL;
@ -682,7 +705,7 @@ static int msm_pcm_open(struct snd_pcm_substream *substream)
return -ENOMEM;
}
prtd->audio_client->dev = soc_prtd->platform->dev;
prtd->audio_client->dev = component->dev;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
runtime->hw = msm_pcm_hardware_playback;
@ -858,6 +881,8 @@ static int msm_pcm_playback_close(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_soc_pcm_runtime *soc_prtd = substream->private_data;
struct msm_audio *prtd = runtime->private_data;
struct snd_soc_component *component =
snd_soc_rtdcom_lookup(soc_prtd, DRV_NAME);
struct msm_plat_data *pdata;
uint32_t timeout;
int dir = 0;
@ -867,13 +892,17 @@ static int msm_pcm_playback_close(struct snd_pcm_substream *substream)
if (prtd->audio_client) {
dir = IN;
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
/*
* Unvote to downgrade the Rx thread priority from
* RT Thread for Low-Latency use case.
*/
pdata = (struct msm_plat_data *)
dev_get_drvdata(soc_prtd->platform->dev);
dev_get_drvdata(component->dev);
if (pdata) {
if (pdata->perf_mode == LOW_LATENCY_PCM_MODE)
apr_end_rx_rt(prtd->audio_client->apr);
@ -1139,14 +1168,20 @@ static const struct snd_pcm_ops msm_pcm_ops = {
static int msm_pcm_adsp_stream_cmd_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_component *pcm = snd_kcontrol_chip(kcontrol);
struct snd_soc_platform *platform = snd_soc_component_to_platform(pcm);
struct msm_plat_data *pdata = dev_get_drvdata(platform->dev);
struct snd_soc_component *component =
snd_soc_kcontrol_component(kcontrol);
struct msm_plat_data *pdata = NULL;
struct snd_pcm_substream *substream;
struct msm_audio *prtd;
int ret = 0;
struct msm_adsp_event_data *event_data = NULL;
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
pdata = dev_get_drvdata(component->dev);
if (!pdata) {
pr_err("%s pdata is NULL\n", __func__);
ret = -ENODEV;
@ -1207,6 +1242,7 @@ done:
static int msm_pcm_add_audio_adsp_stream_cmd_control(
struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = DSP_STREAM_CMD;
const char *deviceNo = "NN";
char *mixer_str = NULL;
@ -1228,6 +1264,12 @@ static int msm_pcm_add_audio_adsp_stream_cmd_control(
goto done;
}
component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
ctl_len = strlen(mixer_ctl_name) + 1 + strlen(deviceNo) + 1;
mixer_str = kzalloc(ctl_len, GFP_KERNEL);
if (!mixer_str) {
@ -1240,7 +1282,7 @@ static int msm_pcm_add_audio_adsp_stream_cmd_control(
fe_audio_adsp_stream_cmd_config_control[0].private_value =
rtd->dai_link->id;
pr_debug("Registering new mixer ctl %s\n", mixer_str);
ret = snd_soc_add_platform_controls(rtd->platform,
ret = snd_soc_add_component_controls(component,
fe_audio_adsp_stream_cmd_config_control,
ARRAY_SIZE(fe_audio_adsp_stream_cmd_config_control));
if (ret < 0)
@ -1255,6 +1297,7 @@ done:
static int msm_pcm_add_audio_adsp_stream_callback_control(
struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = DSP_STREAM_CALLBACK;
const char *deviceNo = "NN";
char *mixer_str = NULL;
@ -1278,6 +1321,12 @@ static int msm_pcm_add_audio_adsp_stream_callback_control(
goto done;
}
component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
pr_debug("%s: added new pcm FE with name %s, id %d, cpu dai %s, device no %d\n",
__func__, rtd->dai_link->name, rtd->dai_link->id,
rtd->dai_link->cpu_dai_name, rtd->pcm->device);
@ -1293,7 +1342,7 @@ static int msm_pcm_add_audio_adsp_stream_callback_control(
fe_audio_adsp_callback_config_control[0].private_value =
rtd->dai_link->id;
pr_debug("%s: Registering new mixer ctl %s\n", __func__, mixer_str);
ret = snd_soc_add_platform_controls(rtd->platform,
ret = snd_soc_add_component_controls(component,
fe_audio_adsp_callback_config_control,
ARRAY_SIZE(fe_audio_adsp_callback_config_control));
if (ret < 0) {
@ -1419,9 +1468,8 @@ static int msm_pcm_compress_ctl_info(struct snd_kcontrol *kcontrol,
static int msm_pcm_compress_ctl_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol);
struct snd_soc_platform *platform = snd_soc_component_to_platform(comp);
struct msm_plat_data *pdata = dev_get_drvdata(platform->dev);
struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol);
struct msm_plat_data *pdata = dev_get_drvdata(comp->dev);
struct snd_pcm_substream *substream;
struct msm_audio *prtd;
@ -1448,9 +1496,8 @@ static int msm_pcm_compress_ctl_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
int rc = 0;
struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol);
struct snd_soc_platform *platform = snd_soc_component_to_platform(comp);
struct msm_plat_data *pdata = dev_get_drvdata(platform->dev);
struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol);
struct msm_plat_data *pdata = dev_get_drvdata(comp->dev);
struct snd_pcm_substream *substream;
struct msm_audio *prtd;
int compress = ucontrol->value.integer.value[0];
@ -1480,6 +1527,7 @@ static int msm_pcm_compress_ctl_put(struct snd_kcontrol *kcontrol,
static int msm_pcm_add_compress_control(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = "Playback ";
const char *mixer_ctl_end_name = " Compress";
const char *deviceNo = "NN";
@ -1504,6 +1552,12 @@ static int msm_pcm_add_compress_control(struct snd_soc_pcm_runtime *rtd)
return -EINVAL;
}
component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
ctl_len = strlen(mixer_ctl_name) + strlen(deviceNo) +
strlen(mixer_ctl_end_name) + 1;
mixer_str = kzalloc(ctl_len, GFP_KERNEL);
@ -1517,16 +1571,16 @@ static int msm_pcm_add_compress_control(struct snd_soc_pcm_runtime *rtd)
pcm_compress_control[0].name = mixer_str;
pcm_compress_control[0].private_value = rtd->dai_link->id;
pr_debug("%s: Registering new mixer ctl %s\n", __func__, mixer_str);
pdata = dev_get_drvdata(rtd->platform->dev);
pdata = dev_get_drvdata(component->dev);
if (pdata) {
if (!pdata->pcm) {
pdata->pcm = rtd->pcm;
snd_soc_add_platform_controls(rtd->platform,
snd_soc_add_component_controls(component,
pcm_compress_control,
ARRAY_SIZE
(pcm_compress_control));
pr_debug("%s: add control success plt = %pK\n",
__func__, rtd->platform);
__func__, component);
}
} else {
pr_err("%s: NULL pdata\n", __func__);
@ -1860,7 +1914,8 @@ static snd_pcm_sframes_t msm_pcm_delay_blk(struct snd_pcm_substream *substream,
return frames;
}
static struct snd_soc_platform_driver msm_soc_platform = {
static struct snd_soc_component_driver msm_soc_component = {
.name = DRV_NAME,
.ops = &msm_pcm_ops,
.pcm_new = msm_asoc_pcm_new,
.delay_blk = msm_pcm_delay_blk,
@ -1907,8 +1962,9 @@ static int msm_pcm_probe(struct platform_device *pdev)
dev_dbg(&pdev->dev, "%s: dev name %s\n",
__func__, dev_name(&pdev->dev));
return snd_soc_register_platform(&pdev->dev,
&msm_soc_platform);
return snd_soc_register_component(&pdev->dev,
&msm_soc_component,
NULL, 0);
}
static int msm_pcm_remove(struct platform_device *pdev)
@ -1917,7 +1973,7 @@ static int msm_pcm_remove(struct platform_device *pdev)
pdata = dev_get_drvdata(&pdev->dev);
kfree(pdata);
snd_soc_unregister_platform(&pdev->dev);
snd_soc_unregister_component(&pdev->dev);
return 0;
}
static const struct of_device_id msm_pcm_dt_match[] = {

View File

@ -38,6 +38,8 @@
#include "msm-dolby-dap-config.h"
#include "msm-ds2-dap-config.h"
#define DRV_NAME "msm-pcm-routing-v2"
#ifndef CONFIG_DOLBY_DAP
#undef DOLBY_ADM_COPP_TOPOLOGY_ID
#define DOLBY_ADM_COPP_TOPOLOGY_ID 0xFFFFFFFE
@ -23588,75 +23590,76 @@ static const struct snd_pcm_ops msm_routing_pcm_ops = {
};
/* Not used but frame seems to require it */
static int msm_routing_probe(struct snd_soc_platform *platform)
static int msm_routing_probe(struct snd_soc_component *component)
{
snd_soc_dapm_new_controls(&platform->component.dapm, msm_qdsp6_widgets,
snd_soc_dapm_new_controls(&component->dapm, msm_qdsp6_widgets,
ARRAY_SIZE(msm_qdsp6_widgets));
snd_soc_dapm_add_routes(&platform->component.dapm, intercon,
snd_soc_dapm_add_routes(&component->dapm, intercon,
ARRAY_SIZE(intercon));
snd_soc_dapm_new_widgets(platform->component.dapm.card);
snd_soc_dapm_new_widgets(component->dapm.card);
snd_soc_add_platform_controls(platform, lsm_controls,
snd_soc_add_component_controls(component, lsm_controls,
ARRAY_SIZE(lsm_controls));
snd_soc_add_platform_controls(platform, aanc_slim_0_rx_mux,
snd_soc_add_component_controls(component, aanc_slim_0_rx_mux,
ARRAY_SIZE(aanc_slim_0_rx_mux));
snd_soc_add_platform_controls(platform, aanc_noise_level,
snd_soc_add_component_controls(component, aanc_noise_level,
ARRAY_SIZE(aanc_noise_level));
snd_soc_add_platform_controls(platform, msm_voc_session_controls,
snd_soc_add_component_controls(component, msm_voc_session_controls,
ARRAY_SIZE(msm_voc_session_controls));
snd_soc_add_platform_controls(platform, app_type_cfg_controls,
snd_soc_add_component_controls(component, app_type_cfg_controls,
ARRAY_SIZE(app_type_cfg_controls));
snd_soc_add_platform_controls(platform, lsm_app_type_cfg_controls,
snd_soc_add_component_controls(component, lsm_app_type_cfg_controls,
ARRAY_SIZE(lsm_app_type_cfg_controls));
snd_soc_add_platform_controls(platform, module_cfg_controls,
snd_soc_add_component_controls(component, module_cfg_controls,
ARRAY_SIZE(module_cfg_controls));
snd_soc_add_platform_controls(platform,
snd_soc_add_component_controls(component,
stereo_to_custom_stereo_controls,
ARRAY_SIZE(stereo_to_custom_stereo_controls));
snd_soc_add_platform_controls(platform, ec_ref_param_controls,
snd_soc_add_component_controls(component, ec_ref_param_controls,
ARRAY_SIZE(ec_ref_param_controls));
snd_soc_add_platform_controls(platform, channel_mixer_controls,
snd_soc_add_component_controls(component, channel_mixer_controls,
ARRAY_SIZE(channel_mixer_controls));
msm_qti_pp_add_controls(platform);
msm_qti_pp_add_controls(component);
msm_dts_srs_tm_add_controls(platform);
msm_dts_srs_tm_add_controls(component);
msm_dolby_dap_add_controls(platform);
msm_dolby_dap_add_controls(component);
snd_soc_add_platform_controls(platform,
snd_soc_add_component_controls(component,
use_ds1_or_ds2_controls,
ARRAY_SIZE(use_ds1_or_ds2_controls));
snd_soc_add_platform_controls(platform,
snd_soc_add_component_controls(component,
device_pp_params_mixer_controls,
ARRAY_SIZE(device_pp_params_mixer_controls));
snd_soc_add_platform_controls(platform,
snd_soc_add_component_controls(component,
msm_routing_be_dai_name_table_mixer_controls,
ARRAY_SIZE(msm_routing_be_dai_name_table_mixer_controls));
snd_soc_add_platform_controls(platform, msm_source_tracking_controls,
snd_soc_add_component_controls(component, msm_source_tracking_controls,
ARRAY_SIZE(msm_source_tracking_controls));
snd_soc_add_platform_controls(platform, adm_channel_config_controls,
snd_soc_add_component_controls(component, adm_channel_config_controls,
ARRAY_SIZE(adm_channel_config_controls));
snd_soc_add_platform_controls(platform, aptx_dec_license_controls,
snd_soc_add_component_controls(component, aptx_dec_license_controls,
ARRAY_SIZE(aptx_dec_license_controls));
snd_soc_add_platform_controls(platform, stereo_channel_reverse_control,
snd_soc_add_component_controls(component,
stereo_channel_reverse_control,
ARRAY_SIZE(stereo_channel_reverse_control));
snd_soc_add_platform_controls(
platform, msm_routing_feature_support_mixer_controls,
snd_soc_add_component_controls(
component, msm_routing_feature_support_mixer_controls,
ARRAY_SIZE(msm_routing_feature_support_mixer_controls));
return 0;
@ -23672,7 +23675,8 @@ void msm_routing_pcm_free(struct snd_pcm *pcm)
msm_pcm_routing_hwdep_free(pcm);
}
static struct snd_soc_platform_driver msm_soc_routing_platform = {
static struct snd_soc_component_driver msm_soc_routing_component = {
.name = DRV_NAME,
.ops = &msm_routing_pcm_ops,
.probe = msm_routing_probe,
.pcm_new = msm_routing_pcm_new,
@ -23683,13 +23687,14 @@ static int msm_routing_pcm_probe(struct platform_device *pdev)
{
dev_dbg(&pdev->dev, "dev name %s\n", dev_name(&pdev->dev));
return snd_soc_register_platform(&pdev->dev,
&msm_soc_routing_platform);
return snd_soc_register_component(&pdev->dev,
&msm_soc_routing_component,
NULL, 0);
}
static int msm_routing_pcm_remove(struct platform_device *pdev)
{
snd_soc_unregister_platform(&pdev->dev);
snd_soc_unregister_component(&pdev->dev);
return 0;
}

View File

@ -22,6 +22,8 @@
#include "msm-pcm-voice-v2.h"
#define DRV_NAME "msm-pcm-voice-v2"
static struct msm_voice voice_info[VOICE_SESSION_INDEX_MAX];
static struct snd_pcm_hardware msm_pcm_hardware = {
@ -697,15 +699,16 @@ static int msm_asoc_pcm_new(struct snd_soc_pcm_runtime *rtd)
return ret;
}
static int msm_pcm_voice_probe(struct snd_soc_platform *platform)
static int msm_pcm_voice_probe(struct snd_soc_component *component)
{
snd_soc_add_platform_controls(platform, msm_voice_controls,
snd_soc_add_component_controls(component, msm_voice_controls,
ARRAY_SIZE(msm_voice_controls));
return 0;
}
static struct snd_soc_platform_driver msm_soc_platform = {
static struct snd_soc_component_driver msm_soc_component = {
.name = DRV_NAME,
.ops = &msm_pcm_ops,
.pcm_new = msm_asoc_pcm_new,
.probe = msm_pcm_voice_probe,
@ -742,8 +745,9 @@ static int msm_pcm_probe(struct platform_device *pdev)
is_destroy_cvd);
voc_set_destroy_cvd_flag(destroy_cvd);
rc = snd_soc_register_platform(&pdev->dev,
&msm_soc_platform);
rc = snd_soc_register_component(&pdev->dev,
&msm_soc_component,
NULL, 0);
done:
return rc;
@ -751,7 +755,7 @@ done:
static int msm_pcm_remove(struct platform_device *pdev)
{
snd_soc_unregister_platform(&pdev->dev);
snd_soc_unregister_component(&pdev->dev);
return 0;
}

View File

@ -23,6 +23,8 @@
#include "msm-pcm-q6-v2.h"
#include "msm-pcm-routing-v2.h"
#define DRV_NAME "msm-pcm-voip-v2"
#define SHARED_MEM_BUF 2
#define VOIP_MAX_Q_LEN 10
#define VOIP_MAX_VOC_PKT_SIZE 4096
@ -300,9 +302,9 @@ static struct snd_kcontrol_new msm_voip_controls[] = {
msm_voip_dtx_mode_get, msm_voip_dtx_mode_put),
};
static int msm_pcm_voip_probe(struct snd_soc_platform *platform)
static int msm_pcm_voip_probe(struct snd_soc_component *component)
{
snd_soc_add_platform_controls(platform, msm_voip_controls,
snd_soc_add_component_controls(component, msm_voip_controls,
ARRAY_SIZE(msm_voip_controls));
return 0;
@ -1605,7 +1607,8 @@ static int msm_asoc_pcm_new(struct snd_soc_pcm_runtime *rtd)
return ret;
}
static struct snd_soc_platform_driver msm_soc_platform = {
static struct snd_soc_component_driver msm_soc_component = {
.name = DRV_NAME,
.ops = &msm_pcm_ops,
.pcm_new = msm_asoc_pcm_new,
.probe = msm_pcm_voip_probe,
@ -1642,8 +1645,9 @@ static int msm_pcm_probe(struct platform_device *pdev)
pr_debug("%s: dev name %s\n", __func__, dev_name(&pdev->dev));
rc = snd_soc_register_platform(&pdev->dev,
&msm_soc_platform);
rc = snd_soc_register_component(&pdev->dev,
&msm_soc_component,
NULL, 0);
done:
return rc;
@ -1651,7 +1655,7 @@ done:
static int msm_pcm_remove(struct platform_device *pdev)
{
snd_soc_unregister_platform(&pdev->dev);
snd_soc_unregister_component(&pdev->dev);
return 0;
}

View File

@ -1561,63 +1561,68 @@ static const struct snd_kcontrol_new asphere_mixer_controls[] = {
};
#ifdef CONFIG_QTI_PP
void msm_qti_pp_add_controls(struct snd_soc_platform *platform)
void msm_qti_pp_add_controls(struct snd_soc_component *component)
{
snd_soc_add_platform_controls(platform, int_fm_vol_mixer_controls,
snd_soc_add_component_controls(component, int_fm_vol_mixer_controls,
ARRAY_SIZE(int_fm_vol_mixer_controls));
snd_soc_add_platform_controls(platform, pri_mi2s_lb_vol_mixer_controls,
snd_soc_add_component_controls(component,
pri_mi2s_lb_vol_mixer_controls,
ARRAY_SIZE(pri_mi2s_lb_vol_mixer_controls));
snd_soc_add_platform_controls(platform, sec_mi2s_lb_vol_mixer_controls,
snd_soc_add_component_controls(component,
sec_mi2s_lb_vol_mixer_controls,
ARRAY_SIZE(sec_mi2s_lb_vol_mixer_controls));
snd_soc_add_platform_controls(platform, tert_mi2s_lb_vol_mixer_controls,
snd_soc_add_component_controls(component,
tert_mi2s_lb_vol_mixer_controls,
ARRAY_SIZE(tert_mi2s_lb_vol_mixer_controls));
snd_soc_add_platform_controls(platform, slimbus_7_lb_vol_mixer_controls,
snd_soc_add_component_controls(component,
slimbus_7_lb_vol_mixer_controls,
ARRAY_SIZE(slimbus_7_lb_vol_mixer_controls));
snd_soc_add_platform_controls(platform, slimbus_8_lb_vol_mixer_controls,
snd_soc_add_component_controls(component,
slimbus_8_lb_vol_mixer_controls,
ARRAY_SIZE(slimbus_8_lb_vol_mixer_controls));
snd_soc_add_platform_controls(platform, int_hfp_vol_mixer_controls,
snd_soc_add_component_controls(component, int_hfp_vol_mixer_controls,
ARRAY_SIZE(int_hfp_vol_mixer_controls));
snd_soc_add_platform_controls(platform, int_icc_vol_mixer_controls,
snd_soc_add_component_controls(component, int_icc_vol_mixer_controls,
ARRAY_SIZE(int_icc_vol_mixer_controls));
snd_soc_add_platform_controls(platform,
snd_soc_add_component_controls(component,
pri_auxpcm_lb_vol_mixer_controls,
ARRAY_SIZE(pri_auxpcm_lb_vol_mixer_controls));
snd_soc_add_platform_controls(platform,
snd_soc_add_component_controls(component,
sec_auxpcm_lb_vol_mixer_controls,
ARRAY_SIZE(sec_auxpcm_lb_vol_mixer_controls));
snd_soc_add_platform_controls(platform,
snd_soc_add_component_controls(component,
multi_ch_channel_map_mixer_controls,
ARRAY_SIZE(multi_ch_channel_map_mixer_controls));
snd_soc_add_platform_controls(platform, get_rms_controls,
snd_soc_add_component_controls(component, get_rms_controls,
ARRAY_SIZE(get_rms_controls));
snd_soc_add_platform_controls(platform, eq_enable_mixer_controls,
snd_soc_add_component_controls(component, eq_enable_mixer_controls,
ARRAY_SIZE(eq_enable_mixer_controls));
snd_soc_add_platform_controls(platform, eq_band_mixer_controls,
snd_soc_add_component_controls(component, eq_band_mixer_controls,
ARRAY_SIZE(eq_band_mixer_controls));
snd_soc_add_platform_controls(platform, eq_coeff_mixer_controls,
snd_soc_add_component_controls(component, eq_coeff_mixer_controls,
ARRAY_SIZE(eq_coeff_mixer_controls));
snd_soc_add_platform_controls(platform, asphere_mixer_controls,
snd_soc_add_component_controls(component, asphere_mixer_controls,
ARRAY_SIZE(asphere_mixer_controls));
snd_soc_add_platform_controls(platform, msm_multichannel_ec_controls,
snd_soc_add_component_controls(component, msm_multichannel_ec_controls,
ARRAY_SIZE(msm_multichannel_ec_controls));
snd_soc_add_platform_controls(platform, dsp_bit_width_controls,
snd_soc_add_component_controls(component, dsp_bit_width_controls,
ARRAY_SIZE(dsp_bit_width_controls));
}
#endif /* CONFIG_QTI_PP */

View File

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
*/
#ifndef _MSM_QTI_PP_H_
@ -26,7 +26,7 @@ int msm_qti_pp_send_stereo_to_custom_stereo_cmd(int port_id, int copp_idx,
uint16_t op_FL_ip_FR_weight,
uint16_t op_FR_ip_FL_weight,
uint16_t op_FR_ip_FR_weight);
void msm_qti_pp_add_controls(struct snd_soc_platform *platform);
void msm_qti_pp_add_controls(struct snd_soc_component *component);
int msm_qti_pp_send_chmix_cfg_cmd(int port_id, int copp_idx,
unsigned int session_id, int ip_channel_count,
int out_channel_cnt, int *ch_wght_coeff,

View File

@ -33,6 +33,8 @@
#include "msm-pcm-routing-v2.h"
#include "msm-qti-pp-config.h"
#define DRV_NAME "msm-transcode-loopback-v2"
#define LOOPBACK_SESSION_MAX_NUM_STREAMS 2
/* Max volume corresponding to 24dB */
#define TRANSCODE_LR_VOL_MAX_DB 0xFFFF
@ -199,6 +201,7 @@ static int msm_transcode_loopback_open(struct snd_compr_stream *cstream)
struct snd_soc_pcm_runtime *rtd;
struct msm_transcode_loopback *trans = &transcode_info;
struct trans_loopback_pdata *pdata;
struct snd_soc_component *component;
if (cstream == NULL) {
pr_err("%s: Invalid substream\n", __func__);
@ -206,7 +209,13 @@ static int msm_transcode_loopback_open(struct snd_compr_stream *cstream)
}
runtime = cstream->runtime;
rtd = snd_pcm_substream_chip(cstream);
pdata = snd_soc_platform_get_drvdata(rtd->platform);
component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
pdata = snd_soc_component_get_drvdata(component);
pdata->cstream[rtd->dai_link->id] = cstream;
pdata->audio_effects[rtd->dai_link->id] =
kzalloc(sizeof(struct msm_transcode_audio_effects), GFP_KERNEL);
@ -299,10 +308,17 @@ static int msm_transcode_loopback_free(struct snd_compr_stream *cstream)
struct snd_compr_runtime *runtime = cstream->runtime;
struct msm_transcode_loopback *trans = runtime->private_data;
struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(cstream);
struct snd_soc_component *component;
struct trans_loopback_pdata *pdata;
int ret = 0;
pdata = snd_soc_platform_get_drvdata(rtd->platform);
component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
pdata = snd_soc_component_get_drvdata(component);
mutex_lock(&trans->lock);
@ -404,6 +420,7 @@ static int msm_transcode_loopback_set_params(struct snd_compr_stream *cstream,
struct snd_soc_pcm_runtime *soc_pcm_rx;
struct snd_soc_pcm_runtime *soc_pcm_tx;
struct snd_soc_pcm_runtime *rtd;
struct snd_soc_component *component;
struct trans_loopback_pdata *pdata;
uint32_t bit_width = 16;
int ret = 0;
@ -416,7 +433,8 @@ static int msm_transcode_loopback_set_params(struct snd_compr_stream *cstream,
mutex_lock(&trans->lock);
rtd = snd_pcm_substream_chip(cstream);
pdata = snd_soc_platform_get_drvdata(rtd->platform);
component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
pdata = snd_soc_component_get_drvdata(component);
if (cstream->direction == SND_COMPRESS_PLAYBACK) {
if (codec_param->codec.id == SND_AUDIOCODEC_PCM) {
@ -570,6 +588,7 @@ static int msm_transcode_loopback_set_metadata(struct snd_compr_stream *cstream,
struct snd_soc_pcm_runtime *rtd;
struct trans_loopback_pdata *pdata;
struct msm_transcode_loopback *prtd = NULL;
struct snd_soc_component *component;
struct audio_client *ac = NULL;
if (!metadata || !cstream) {
@ -578,7 +597,8 @@ static int msm_transcode_loopback_set_metadata(struct snd_compr_stream *cstream,
}
rtd = snd_pcm_substream_chip(cstream);
pdata = snd_soc_platform_get_drvdata(rtd->platform);
component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
pdata = snd_soc_component_get_drvdata(component);
prtd = cstream->runtime->private_data;
@ -870,7 +890,7 @@ static int msm_transcode_set_volume(struct snd_compr_stream *cstream,
rtd = cstream->private_data;
prtd = cstream->runtime->private_data;
if (!rtd || !rtd->platform || !prtd || !prtd->audio_client) {
if (!rtd || !prtd || !prtd->audio_client) {
pr_err("%s: invalid rtd, prtd or audio client", __func__);
return -EINVAL;
}
@ -1065,6 +1085,7 @@ exit:
static int msm_transcode_add_audio_effects_control(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = "Audio Effects Config";
const char *deviceNo = "NN";
char *mixer_str = NULL;
@ -1088,6 +1109,12 @@ static int msm_transcode_add_audio_effects_control(struct snd_soc_pcm_runtime *r
goto done;
}
component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
pr_debug("%s: added new compr FE with name %s, id %d, cpu dai %s, device no %d\n", __func__,
rtd->dai_link->name, rtd->dai_link->id,
rtd->dai_link->cpu_dai_name, rtd->pcm->device);
@ -1104,7 +1131,7 @@ static int msm_transcode_add_audio_effects_control(struct snd_soc_pcm_runtime *r
fe_audio_effects_config_control[0].name = mixer_str;
fe_audio_effects_config_control[0].private_value = rtd->dai_link->id;
ret = snd_soc_add_platform_controls(rtd->platform,
ret = snd_soc_add_component_controls(component,
fe_audio_effects_config_control,
ARRAY_SIZE(fe_audio_effects_config_control));
if (ret < 0)
@ -1118,6 +1145,7 @@ done:
static int msm_transcode_stream_cmd_control(
struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = DSP_STREAM_CMD;
const char *deviceNo = "NN";
char *mixer_str = NULL;
@ -1139,6 +1167,12 @@ static int msm_transcode_stream_cmd_control(
goto done;
}
component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
ctl_len = strlen(mixer_ctl_name) + 1 + strlen(deviceNo) + 1;
mixer_str = kzalloc(ctl_len, GFP_KERNEL);
if (!mixer_str) {
@ -1151,7 +1185,7 @@ static int msm_transcode_stream_cmd_control(
fe_loopback_stream_cmd_config_control[0].private_value =
rtd->dai_link->id;
pr_debug("%s: Registering new mixer ctl %s\n", __func__, mixer_str);
ret = snd_soc_add_platform_controls(rtd->platform,
ret = snd_soc_add_component_controls(component,
fe_loopback_stream_cmd_config_control,
ARRAY_SIZE(fe_loopback_stream_cmd_config_control));
if (ret < 0)
@ -1166,6 +1200,7 @@ done:
static int msm_transcode_stream_callback_control(
struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = DSP_STREAM_CALLBACK;
const char *deviceNo = "NN";
char *mixer_str = NULL;
@ -1189,6 +1224,12 @@ static int msm_transcode_stream_callback_control(
goto done;
}
component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
ctl_len = strlen(mixer_ctl_name) + 1 + strlen(deviceNo) + 1;
mixer_str = kzalloc(ctl_len, GFP_KERNEL);
if (!mixer_str) {
@ -1201,7 +1242,7 @@ static int msm_transcode_stream_callback_control(
fe_loopback_callback_config_control[0].private_value =
rtd->dai_link->id;
pr_debug("%s: Registering new mixer ctl %s\n", __func__, mixer_str);
ret = snd_soc_add_platform_controls(rtd->platform,
ret = snd_soc_add_component_controls(component,
fe_loopback_callback_config_control,
ARRAY_SIZE(fe_loopback_callback_config_control));
if (ret < 0) {
@ -1227,6 +1268,7 @@ done:
static int msm_transcode_add_ion_fd_cmd_control(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = "Playback ION FD";
const char *deviceNo = "NN";
char *mixer_str = NULL;
@ -1248,6 +1290,12 @@ static int msm_transcode_add_ion_fd_cmd_control(struct snd_soc_pcm_runtime *rtd)
goto done;
}
component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
ctl_len = strlen(mixer_ctl_name) + 1 + strlen(deviceNo) + 1;
mixer_str = kzalloc(ctl_len, GFP_KERNEL);
if (!mixer_str) {
@ -1259,7 +1307,7 @@ static int msm_transcode_add_ion_fd_cmd_control(struct snd_soc_pcm_runtime *rtd)
fe_ion_fd_config_control[0].name = mixer_str;
fe_ion_fd_config_control[0].private_value = rtd->dai_link->id;
pr_debug("%s: Registering new mixer ctl %s\n", __func__, mixer_str);
ret = snd_soc_add_platform_controls(rtd->platform,
ret = snd_soc_add_component_controls(component,
fe_ion_fd_config_control,
ARRAY_SIZE(fe_ion_fd_config_control));
if (ret < 0)
@ -1273,6 +1321,7 @@ done:
static int msm_transcode_add_event_ack_cmd_control(
struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_component *component = NULL;
const char *mixer_ctl_name = "Playback Event Ack";
const char *deviceNo = "NN";
char *mixer_str = NULL;
@ -1294,6 +1343,12 @@ static int msm_transcode_add_event_ack_cmd_control(
goto done;
}
component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
ctl_len = strlen(mixer_ctl_name) + 1 + strlen(deviceNo) + 1;
mixer_str = kzalloc(ctl_len, GFP_KERNEL);
if (!mixer_str) {
@ -1305,7 +1360,7 @@ static int msm_transcode_add_event_ack_cmd_control(
fe_event_ack_config_control[0].name = mixer_str;
fe_event_ack_config_control[0].private_value = rtd->dai_link->id;
pr_debug("%s: Registering new mixer ctl %s\n", __func__, mixer_str);
ret = snd_soc_add_platform_controls(rtd->platform,
ret = snd_soc_add_component_controls(component,
fe_event_ack_config_control,
ARRAY_SIZE(fe_event_ack_config_control));
if (ret < 0)
@ -1329,6 +1384,7 @@ static int msm_transcode_app_type_cfg_info(struct snd_kcontrol *kcontrol,
static int msm_transcode_add_app_type_cfg_control(
struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_component *component = NULL;
char mixer_str[32];
struct snd_kcontrol_new fe_app_type_cfg_control[1] = {
{
@ -1346,6 +1402,12 @@ static int msm_transcode_add_app_type_cfg_control(
return -EINVAL;
}
component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
if (rtd->compr->direction == SND_COMPRESS_PLAYBACK) {
snprintf(mixer_str, sizeof(mixer_str),
"Audio Stream %d App Type Cfg",
@ -1360,7 +1422,7 @@ static int msm_transcode_add_app_type_cfg_control(
msm_transcode_playback_app_type_cfg_get;
pr_debug("Registering new mixer ctl %s", mixer_str);
snd_soc_add_platform_controls(rtd->platform,
snd_soc_add_component_controls(component,
fe_app_type_cfg_control,
ARRAY_SIZE(fe_app_type_cfg_control));
}
@ -1379,6 +1441,7 @@ static int msm_transcode_volume_info(struct snd_kcontrol *kcontrol,
static int msm_transcode_add_volume_control(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_component *component = NULL;
struct snd_kcontrol_new fe_volume_control[1] = {
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@ -1396,11 +1459,18 @@ static int msm_transcode_add_volume_control(struct snd_soc_pcm_runtime *rtd)
pr_err("%s NULL rtd\n", __func__);
return -EINVAL;
}
component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
if (!component) {
pr_err("%s: component is NULL\n", __func__);
return -EINVAL;
}
if (rtd->compr->direction == SND_COMPRESS_PLAYBACK) {
fe_volume_control[0].private_value = rtd->dai_link->id;
pr_debug("Registering new mixer ctl %s",
fe_volume_control[0].name);
snd_soc_add_platform_controls(rtd->platform, fe_volume_control,
snd_soc_add_component_controls(component, fe_volume_control,
ARRAY_SIZE(fe_volume_control));
}
return 0;
@ -1457,7 +1527,7 @@ static struct snd_compr_ops msm_transcode_loopback_ops = {
};
static int msm_transcode_loopback_probe(struct snd_soc_platform *platform)
static int msm_transcode_loopback_probe(struct snd_soc_component *component)
{
struct trans_loopback_pdata *pdata = NULL;
int i;
@ -1473,21 +1543,22 @@ static int msm_transcode_loopback_probe(struct snd_soc_platform *platform)
for (i = 0; i < MSM_FRONTEND_DAI_MAX; i++)
pdata->audio_effects[i] = NULL;
snd_soc_platform_set_drvdata(platform, pdata);
snd_soc_component_set_drvdata(component, pdata);
return 0;
}
static int msm_transcode_loopback_remove(struct snd_soc_platform *platform)
static void msm_transcode_loopback_remove(struct snd_soc_component *component)
{
struct trans_loopback_pdata *pdata = NULL;
pdata = (struct trans_loopback_pdata *)
snd_soc_platform_get_drvdata(platform);
snd_soc_component_get_drvdata(component);
kfree(pdata);
return 0;
return;
}
static struct snd_soc_platform_driver msm_soc_platform = {
static struct snd_soc_component_driver msm_soc_component = {
.name = DRV_NAME,
.probe = msm_transcode_loopback_probe,
.compr_ops = &msm_transcode_loopback_ops,
.pcm_new = msm_transcode_loopback_new,
@ -1501,13 +1572,14 @@ static int msm_transcode_dev_probe(struct platform_device *pdev)
if (pdev->dev.of_node)
dev_set_name(&pdev->dev, "%s", "msm-transcode-loopback");
return snd_soc_register_platform(&pdev->dev,
&msm_soc_platform);
return snd_soc_register_component(&pdev->dev,
&msm_soc_component,
NULL, 0);
}
static int msm_transcode_remove(struct platform_device *pdev)
{
snd_soc_unregister_platform(&pdev->dev);
snd_soc_unregister_component(&pdev->dev);
return 0;
}

View File

@ -264,23 +264,23 @@ static const struct snd_kcontrol_new lpa_srs_trumedia_controls_mi2s[] = {
* msm_dts_srs_tm_add_controls -
* Add DTS SRS module controls
*
* @platform: component to which controls can be registered
* @component: component to which controls can be registered
*
*/
void msm_dts_srs_tm_add_controls(struct snd_soc_platform *platform)
void msm_dts_srs_tm_add_controls(struct snd_soc_component *component)
{
snd_soc_add_platform_controls(platform,
snd_soc_add_component_controls(component,
lpa_srs_trumedia_controls,
ARRAY_SIZE(lpa_srs_trumedia_controls));
snd_soc_add_platform_controls(platform,
snd_soc_add_component_controls(component,
lpa_srs_trumedia_controls_hdmi,
ARRAY_SIZE(lpa_srs_trumedia_controls_hdmi));
snd_soc_add_platform_controls(platform,
snd_soc_add_component_controls(component,
lpa_srs_trumedia_controls_i2s,
ARRAY_SIZE(lpa_srs_trumedia_controls_i2s));
snd_soc_add_platform_controls(platform,
snd_soc_add_component_controls(component,
lpa_srs_trumedia_controls_mi2s,
ARRAY_SIZE(lpa_srs_trumedia_controls_mi2s));
}

View File

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2012-2014, 2017, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2014, 2017-2018, The Linux Foundation. All rights reserved.
*/
#ifndef _MSM_DTS_SRS_TM_CONFIG_H_
@ -21,13 +21,13 @@ union srs_trumedia_params_u {
void msm_dts_srs_tm_ion_memmap(struct param_outband *po_);
void msm_dts_srs_tm_init(int port_id, int copp_idx);
void msm_dts_srs_tm_deinit(int port_id);
void msm_dts_srs_tm_add_controls(struct snd_soc_platform *platform);
void msm_dts_srs_tm_add_controls(struct snd_soc_component *component);
#else
static inline void msm_dts_srs_tm_ion_memmap(struct param_outband *po_) { }
static inline void msm_dts_srs_tm_init(int port_id, int copp_idx) { }
static inline void msm_dts_srs_tm_deinit(int port_id) { }
static inline void msm_dts_srs_tm_add_controls(
struct snd_soc_platform *platform) { }
struct snd_soc_component *component) { }
#endif