Skip to content

Commit d9a1cbf

Browse files
committed
Minor bug fix and tidy up for sof_sdw
Merge series from Charles Keepax <[email protected]>: Fix a small bug that can cause the sof_sdw machine driver to fail probe after the first time it has probed. Also do some minor tidy up on the handling of the platform_component of the dai links.
2 parents 599b86f + 6c965d3 commit d9a1cbf

File tree

5 files changed

+18
-29
lines changed

5 files changed

+18
-29
lines changed

include/sound/soc_sdw_utils.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,8 @@ void asoc_sdw_init_dai_link(struct device *dev, struct snd_soc_dai_link *dai_lin
159159
int asoc_sdw_init_simple_dai_link(struct device *dev, struct snd_soc_dai_link *dai_links,
160160
int *be_id, char *name, int playback, int capture,
161161
const char *cpu_dai_name, const char *platform_comp_name,
162-
int num_platforms, const char *codec_name,
163-
const char *codec_dai_name, int no_pcm,
164-
int (*init)(struct snd_soc_pcm_runtime *rtd),
162+
const char *codec_name, const char *codec_dai_name,
163+
int no_pcm, int (*init)(struct snd_soc_pcm_runtime *rtd),
165164
const struct snd_soc_ops *ops);
166165

167166
int asoc_sdw_count_sdw_endpoints(struct snd_soc_card *card, int *num_devs, int *num_ends);

sound/soc/amd/acp/acp-sdw-legacy-mach.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ static int create_dmic_dailinks(struct snd_soc_card *card,
321321
*be_id = ACP_DMIC_BE_ID;
322322
ret = asoc_sdw_init_simple_dai_link(dev, *dai_links, be_id, "acp-dmic-codec",
323323
0, 1, // DMIC only supports capture
324-
pdm_cpu->name, pdm_platform->name, 1,
324+
pdm_cpu->name, pdm_platform->name,
325325
"dmic-codec.0", "dmic-hifi", no_pcm,
326326
asoc_sdw_dmic_init, NULL);
327327
if (ret)

sound/soc/amd/acp/acp-sdw-sof-mach.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,6 @@ static int create_dmic_dailinks(struct snd_soc_card *card,
252252
ret = asoc_sdw_init_simple_dai_link(dev, *dai_links, be_id, "acp-dmic-codec",
253253
0, 1, // DMIC only supports capture
254254
"acp-sof-dmic", platform_component->name,
255-
ARRAY_SIZE(platform_component),
256255
"dmic-codec", "dmic-hifi", no_pcm,
257256
asoc_sdw_dmic_init, NULL);
258257
if (ret)

sound/soc/intel/boards/sof_sdw.c

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -780,13 +780,6 @@ static void sof_sdw_check_ssid_quirk(const struct snd_soc_acpi_mach *mach)
780780
sof_sdw_quirk = quirk_entry->value;
781781
}
782782

783-
static struct snd_soc_dai_link_component platform_component[] = {
784-
{
785-
/* name might be overridden during probe */
786-
.name = "0000:00:1f.3"
787-
}
788-
};
789-
790783
static const struct snd_soc_ops sdw_ops = {
791784
.startup = asoc_sdw_startup,
792785
.prepare = asoc_sdw_prepare,
@@ -836,6 +829,7 @@ static int create_sdw_dailink(struct snd_soc_card *card,
836829
struct snd_soc_dai_link_ch_map *codec_maps;
837830
struct snd_soc_dai_link_component *codecs;
838831
struct snd_soc_dai_link_component *cpus;
832+
struct snd_soc_dai_link_component *platform;
839833
int num_cpus = hweight32(sof_dai->link_mask[stream]);
840834
int num_codecs = sof_dai->num_devs[stream];
841835
int playback, capture;
@@ -876,6 +870,10 @@ static int create_sdw_dailink(struct snd_soc_card *card,
876870
if (!codecs)
877871
return -ENOMEM;
878872

873+
platform = devm_kzalloc(dev, sizeof(*platform), GFP_KERNEL);
874+
if (!platform)
875+
return -ENOMEM;
876+
879877
codec_maps = devm_kcalloc(dev, num_codecs, sizeof(*codec_maps), GFP_KERNEL);
880878
if (!codec_maps)
881879
return -ENOMEM;
@@ -917,8 +915,7 @@ static int create_sdw_dailink(struct snd_soc_card *card,
917915
capture = (stream == SNDRV_PCM_STREAM_CAPTURE);
918916

919917
asoc_sdw_init_dai_link(dev, *dai_links, be_id, name, playback, capture,
920-
cpus, num_cpus, platform_component,
921-
ARRAY_SIZE(platform_component), codecs, num_codecs,
918+
cpus, num_cpus, platform, 1, codecs, num_codecs,
922919
1, asoc_sdw_rtd_init, &sdw_ops);
923920

924921
/*
@@ -994,8 +991,7 @@ static int create_ssp_dailinks(struct snd_soc_card *card,
994991

995992
ret = asoc_sdw_init_simple_dai_link(dev, *dai_links, be_id, name,
996993
playback, capture, cpu_dai_name,
997-
platform_component->name,
998-
ARRAY_SIZE(platform_component), codec_name,
994+
"dummy", codec_name,
999995
ssp_info->dais[0].dai_name, 1, NULL,
1000996
ssp_info->ops);
1001997
if (ret)
@@ -1019,8 +1015,7 @@ static int create_dmic_dailinks(struct snd_soc_card *card,
10191015

10201016
ret = asoc_sdw_init_simple_dai_link(dev, *dai_links, be_id, "dmic01",
10211017
0, 1, // DMIC only supports capture
1022-
"DMIC01 Pin", platform_component->name,
1023-
ARRAY_SIZE(platform_component),
1018+
"DMIC01 Pin", "dummy",
10241019
"dmic-codec", "dmic-hifi", 1,
10251020
asoc_sdw_dmic_init, NULL);
10261021
if (ret)
@@ -1030,8 +1025,7 @@ static int create_dmic_dailinks(struct snd_soc_card *card,
10301025

10311026
ret = asoc_sdw_init_simple_dai_link(dev, *dai_links, be_id, "dmic16k",
10321027
0, 1, // DMIC only supports capture
1033-
"DMIC16k Pin", platform_component->name,
1034-
ARRAY_SIZE(platform_component),
1028+
"DMIC16k Pin", "dummy",
10351029
"dmic-codec", "dmic-hifi", 1,
10361030
/* don't call asoc_sdw_dmic_init() twice */
10371031
NULL, NULL);
@@ -1074,8 +1068,7 @@ static int create_hdmi_dailinks(struct snd_soc_card *card,
10741068

10751069
ret = asoc_sdw_init_simple_dai_link(dev, *dai_links, be_id, name,
10761070
1, 0, // HDMI only supports playback
1077-
cpu_dai_name, platform_component->name,
1078-
ARRAY_SIZE(platform_component),
1071+
cpu_dai_name, "dummy",
10791072
codec_name, codec_dai_name, 1,
10801073
i == 0 ? sof_sdw_hdmi_init : NULL, NULL);
10811074
if (ret)
@@ -1101,8 +1094,7 @@ static int create_bt_dailinks(struct snd_soc_card *card,
11011094
int ret;
11021095

11031096
ret = asoc_sdw_init_simple_dai_link(dev, *dai_links, be_id, name,
1104-
1, 1, cpu_dai_name, platform_component->name,
1105-
ARRAY_SIZE(platform_component),
1097+
1, 1, cpu_dai_name, "dummy",
11061098
snd_soc_dummy_dlc.name, snd_soc_dummy_dlc.dai_name,
11071099
1, NULL, NULL);
11081100
if (ret)

sound/soc/sdw_utils/soc_sdw_utils.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,9 +1067,8 @@ EXPORT_SYMBOL_NS(asoc_sdw_init_dai_link, "SND_SOC_SDW_UTILS");
10671067
int asoc_sdw_init_simple_dai_link(struct device *dev, struct snd_soc_dai_link *dai_links,
10681068
int *be_id, char *name, int playback, int capture,
10691069
const char *cpu_dai_name, const char *platform_comp_name,
1070-
int num_platforms, const char *codec_name,
1071-
const char *codec_dai_name, int no_pcm,
1072-
int (*init)(struct snd_soc_pcm_runtime *rtd),
1070+
const char *codec_name, const char *codec_dai_name,
1071+
int no_pcm, int (*init)(struct snd_soc_pcm_runtime *rtd),
10731072
const struct snd_soc_ops *ops)
10741073
{
10751074
struct snd_soc_dai_link_component *dlc;
@@ -1086,8 +1085,8 @@ int asoc_sdw_init_simple_dai_link(struct device *dev, struct snd_soc_dai_link *d
10861085
dlc[2].dai_name = codec_dai_name;
10871086

10881087
asoc_sdw_init_dai_link(dev, dai_links, be_id, name, playback, capture,
1089-
&dlc[0], 1, &dlc[1], num_platforms,
1090-
&dlc[2], 1, no_pcm, init, ops);
1088+
&dlc[0], 1, &dlc[1], 1, &dlc[2], 1,
1089+
no_pcm, init, ops);
10911090

10921091
return 0;
10931092
}

0 commit comments

Comments
 (0)