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:
@@ -33,6 +33,8 @@
|
|||||||
#define NUM_ATTEMPTS 5
|
#define NUM_ATTEMPTS 5
|
||||||
#define SWRS_SCP_CONTROL 0x44
|
#define SWRS_SCP_CONTROL 0x44
|
||||||
|
|
||||||
|
#define MAX_NAME_LEN 40
|
||||||
|
|
||||||
static int swr_master_channel_map[] = {
|
static int swr_master_channel_map[] = {
|
||||||
ZERO,
|
ZERO,
|
||||||
SWRM_TX1_CH1,
|
SWRM_TX1_CH1,
|
||||||
@@ -294,32 +296,37 @@ static int swr_dmic_codec_probe(struct snd_soc_component *component)
|
|||||||
snd_soc_component_get_drvdata(component);
|
snd_soc_component_get_drvdata(component);
|
||||||
struct snd_soc_dapm_context *dapm =
|
struct snd_soc_dapm_context *dapm =
|
||||||
snd_soc_component_get_dapm(component);
|
snd_soc_component_get_dapm(component);
|
||||||
char w_name[100];
|
char w_name[MAX_NAME_LEN];
|
||||||
|
|
||||||
if (!swr_dmic)
|
if (!swr_dmic)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
swr_dmic->component = component;
|
swr_dmic->component = component;
|
||||||
snd_soc_dapm_ignore_suspend(dapm,
|
if (!component->name_prefix) {
|
||||||
swr_dmic->dai_driver->capture.stream_name);
|
dev_err(component->dev, "%s: component prefix is NULL\n", __func__);
|
||||||
memset(w_name, 0, 100);
|
return -EPROBE_DEFER;
|
||||||
strlcpy(w_name, component->name_prefix, 100);
|
}
|
||||||
strlcat(w_name, " SWR_DMIC", 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, swr_dmic->dai_driver->capture.stream_name,
|
||||||
|
sizeof(w_name));
|
||||||
snd_soc_dapm_ignore_suspend(dapm, w_name);
|
snd_soc_dapm_ignore_suspend(dapm, w_name);
|
||||||
|
|
||||||
memset(w_name, 0, 100);
|
memset(w_name, 0, sizeof(w_name));
|
||||||
strlcpy(w_name, component->name_prefix, 100);
|
strlcpy(w_name, component->name_prefix, sizeof(w_name));
|
||||||
strlcat(w_name, " SMIC_SUPPLY", 100);
|
strlcat(w_name, " SWR_DMIC", sizeof(w_name));
|
||||||
snd_soc_dapm_ignore_suspend(dapm, w_name);
|
snd_soc_dapm_ignore_suspend(dapm, w_name);
|
||||||
|
|
||||||
memset(w_name, 0, 100);
|
memset(w_name, 0, sizeof(w_name));
|
||||||
strlcpy(w_name, component->name_prefix, 100);
|
strlcpy(w_name, component->name_prefix, sizeof(w_name));
|
||||||
strlcat(w_name, " SMIC_PORT_EN", 100);
|
strlcat(w_name, " SMIC_PORT_EN", sizeof(w_name));
|
||||||
snd_soc_dapm_ignore_suspend(dapm, w_name);
|
snd_soc_dapm_ignore_suspend(dapm, w_name);
|
||||||
|
|
||||||
memset(w_name, 0, 100);
|
memset(w_name, 0, sizeof(w_name));
|
||||||
strlcpy(w_name, component->name_prefix, 100);
|
strlcpy(w_name, component->name_prefix, sizeof(w_name));
|
||||||
strlcat(w_name, " SWR_DMIC_OUTPUT", 100);
|
strlcat(w_name, " SWR_DMIC_OUTPUT", sizeof(w_name));
|
||||||
snd_soc_dapm_ignore_suspend(dapm, w_name);
|
snd_soc_dapm_ignore_suspend(dapm, w_name);
|
||||||
|
|
||||||
snd_soc_dapm_sync(dapm);
|
snd_soc_dapm_sync(dapm);
|
||||||
|
@@ -37,7 +37,7 @@
|
|||||||
#define TEMP_INVALID 0xFFFF
|
#define TEMP_INVALID 0xFFFF
|
||||||
#define WSA883X_TEMP_RETRY 3
|
#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 |\
|
#define WSA883X_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\
|
||||||
SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000 |\
|
SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000 |\
|
||||||
SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_192000 |\
|
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)
|
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 wsa883x_priv *wsa883x = snd_soc_component_get_drvdata(component);
|
||||||
struct swr_device *dev;
|
struct swr_device *dev;
|
||||||
int variant = 0, version = 0;
|
int variant = 0, version = 0;
|
||||||
struct snd_soc_dapm_context *dapm =
|
struct snd_soc_dapm_context *dapm =
|
||||||
snd_soc_component_get_dapm(component);
|
snd_soc_component_get_dapm(component);
|
||||||
char w_name[100];
|
|
||||||
|
|
||||||
if (!wsa883x)
|
if (!wsa883x)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@@ -1248,22 +1248,26 @@ static int wsa883x_codec_probe(struct snd_soc_component *component)
|
|||||||
wsa883x_codec_init(component);
|
wsa883x_codec_init(component);
|
||||||
wsa883x->global_pa_cnt = 0;
|
wsa883x->global_pa_cnt = 0;
|
||||||
|
|
||||||
snd_soc_dapm_ignore_suspend(dapm,
|
memset(w_name, 0, sizeof(w_name));
|
||||||
wsa883x->dai_driver->playback.stream_name);
|
strlcpy(w_name, component->name_prefix, sizeof(w_name));
|
||||||
|
strlcat(w_name, " ", sizeof(w_name));
|
||||||
memset(w_name, 0, 100);
|
strlcat(w_name, wsa883x->dai_driver->playback.stream_name,
|
||||||
strlcpy(w_name, component->name_prefix, 100);
|
sizeof(w_name));
|
||||||
strlcat(w_name, " IN", 100);
|
|
||||||
snd_soc_dapm_ignore_suspend(dapm, w_name);
|
snd_soc_dapm_ignore_suspend(dapm, w_name);
|
||||||
|
|
||||||
memset(w_name, 0, 100);
|
memset(w_name, 0, sizeof(w_name));
|
||||||
strlcpy(w_name, component->name_prefix, 100);
|
strlcpy(w_name, component->name_prefix, sizeof(w_name));
|
||||||
strlcat(w_name, " SWR DAC_PORT", 100);
|
strlcat(w_name, " IN", sizeof(w_name));
|
||||||
snd_soc_dapm_ignore_suspend(dapm, w_name);
|
snd_soc_dapm_ignore_suspend(dapm, w_name);
|
||||||
|
|
||||||
memset(w_name, 0, 100);
|
memset(w_name, 0, sizeof(w_name));
|
||||||
strlcpy(w_name, component->name_prefix, 100);
|
strlcpy(w_name, component->name_prefix, sizeof(w_name));
|
||||||
strlcat(w_name, " SPKR", 100);
|
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_ignore_suspend(dapm, w_name);
|
||||||
|
|
||||||
snd_soc_dapm_sync(dapm);
|
snd_soc_dapm_sync(dapm);
|
||||||
|
Reference in New Issue
Block a user