ASoC: add null check for component prefix

Check if component prefix is set before use.
Add component prefix for dai widgets before calling
ignore suspend.

Change-Id: Ifa0c727bf46af661cd19b6018bfc25af9a7e3753
Signed-off-by: Vignesh Kulothungan <vigneshk@codeaurora.org>
This commit is contained in:
Vignesh Kulothungan
2020-07-21 12:09:05 -07:00
parent 04a841333a
commit 91ba27cac5
2 changed files with 40 additions and 29 deletions

View File

@@ -37,7 +37,7 @@
#define TEMP_INVALID 0xFFFF
#define WSA883X_TEMP_RETRY 3
#define MAX_NAME_LEN 30
#define MAX_NAME_LEN 40
#define WSA883X_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\
SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000 |\
SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_192000 |\
@@ -1219,12 +1219,12 @@ static int wsa883x_get_temperature(struct snd_soc_component *component,
static int wsa883x_codec_probe(struct snd_soc_component *component)
{
char w_name[MAX_NAME_LEN];
struct wsa883x_priv *wsa883x = snd_soc_component_get_drvdata(component);
struct swr_device *dev;
int variant = 0, version = 0;
struct snd_soc_dapm_context *dapm =
snd_soc_component_get_dapm(component);
char w_name[100];
if (!wsa883x)
return -EINVAL;
@@ -1248,22 +1248,26 @@ static int wsa883x_codec_probe(struct snd_soc_component *component)
wsa883x_codec_init(component);
wsa883x->global_pa_cnt = 0;
snd_soc_dapm_ignore_suspend(dapm,
wsa883x->dai_driver->playback.stream_name);
memset(w_name, 0, 100);
strlcpy(w_name, component->name_prefix, 100);
strlcat(w_name, " IN", 100);
memset(w_name, 0, sizeof(w_name));
strlcpy(w_name, component->name_prefix, sizeof(w_name));
strlcat(w_name, " ", sizeof(w_name));
strlcat(w_name, wsa883x->dai_driver->playback.stream_name,
sizeof(w_name));
snd_soc_dapm_ignore_suspend(dapm, w_name);
memset(w_name, 0, 100);
strlcpy(w_name, component->name_prefix, 100);
strlcat(w_name, " SWR DAC_PORT", 100);
memset(w_name, 0, sizeof(w_name));
strlcpy(w_name, component->name_prefix, sizeof(w_name));
strlcat(w_name, " IN", sizeof(w_name));
snd_soc_dapm_ignore_suspend(dapm, w_name);
memset(w_name, 0, 100);
strlcpy(w_name, component->name_prefix, 100);
strlcat(w_name, " SPKR", 100);
memset(w_name, 0, sizeof(w_name));
strlcpy(w_name, component->name_prefix, sizeof(w_name));
strlcat(w_name, " SWR DAC_PORT", sizeof(w_name));
snd_soc_dapm_ignore_suspend(dapm, w_name);
memset(w_name, 0, sizeof(w_name));
strlcpy(w_name, component->name_prefix, sizeof(w_name));
strlcat(w_name, " SPKR", sizeof(w_name));
snd_soc_dapm_ignore_suspend(dapm, w_name);
snd_soc_dapm_sync(dapm);