@@ -831,7 +831,7 @@ static int intel_hw_params(struct snd_pcm_substream *substream,
831
831
int ch , dir ;
832
832
int ret ;
833
833
834
- dai_runtime = snd_soc_dai_get_dma_data ( dai , substream ) ;
834
+ dai_runtime = cdns -> dai_runtime_array [ dai -> id ] ;
835
835
if (!dai_runtime )
836
836
return - EIO ;
837
837
@@ -902,7 +902,7 @@ static int intel_prepare(struct snd_pcm_substream *substream,
902
902
int ch , dir ;
903
903
int ret = 0 ;
904
904
905
- dai_runtime = snd_soc_dai_get_dma_data ( dai , substream ) ;
905
+ dai_runtime = cdns -> dai_runtime_array [ dai -> id ] ;
906
906
if (!dai_runtime ) {
907
907
dev_err (dai -> dev , "failed to get dai runtime in %s\n" ,
908
908
__func__ );
@@ -949,7 +949,7 @@ intel_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)
949
949
struct sdw_cdns_dai_runtime * dai_runtime ;
950
950
int ret ;
951
951
952
- dai_runtime = snd_soc_dai_get_dma_data ( dai , substream ) ;
952
+ dai_runtime = cdns -> dai_runtime_array [ dai -> id ] ;
953
953
if (!dai_runtime )
954
954
return - EIO ;
955
955
@@ -996,13 +996,10 @@ static int intel_pcm_set_sdw_stream(struct snd_soc_dai *dai,
996
996
static void * intel_get_sdw_stream (struct snd_soc_dai * dai ,
997
997
int direction )
998
998
{
999
+ struct sdw_cdns * cdns = snd_soc_dai_get_drvdata (dai );
999
1000
struct sdw_cdns_dai_runtime * dai_runtime ;
1000
1001
1001
- if (direction == SNDRV_PCM_STREAM_PLAYBACK )
1002
- dai_runtime = dai -> playback_dma_data ;
1003
- else
1004
- dai_runtime = dai -> capture_dma_data ;
1005
-
1002
+ dai_runtime = cdns -> dai_runtime_array [dai -> id ];
1006
1003
if (!dai_runtime )
1007
1004
return ERR_PTR (- EINVAL );
1008
1005
@@ -1025,7 +1022,7 @@ static int intel_trigger(struct snd_pcm_substream *substream, int cmd, struct sn
1025
1022
if (res -> ops && res -> ops -> trigger )
1026
1023
res -> ops -> trigger (dai , cmd , substream -> stream );
1027
1024
1028
- dai_runtime = snd_soc_dai_get_dma_data ( dai , substream ) ;
1025
+ dai_runtime = cdns -> dai_runtime_array [ dai -> id ] ;
1029
1026
if (!dai_runtime ) {
1030
1027
dev_err (dai -> dev , "failed to get dai runtime in %s\n" ,
1031
1028
__func__ );
@@ -1092,15 +1089,9 @@ static int intel_component_dais_suspend(struct snd_soc_component *component)
1092
1089
struct sdw_cdns * cdns = snd_soc_dai_get_drvdata (dai );
1093
1090
struct sdw_intel * sdw = cdns_to_intel (cdns );
1094
1091
struct sdw_cdns_dai_runtime * dai_runtime ;
1095
- int stream ;
1096
1092
int ret ;
1097
1093
1098
- dai_runtime = dai -> playback_dma_data ;
1099
- stream = SNDRV_PCM_STREAM_PLAYBACK ;
1100
- if (!dai_runtime ) {
1101
- dai_runtime = dai -> capture_dma_data ;
1102
- stream = SNDRV_PCM_STREAM_CAPTURE ;
1103
- }
1094
+ dai_runtime = cdns -> dai_runtime_array [dai -> id ];
1104
1095
1105
1096
if (!dai_runtime )
1106
1097
continue ;
@@ -1111,7 +1102,7 @@ static int intel_component_dais_suspend(struct snd_soc_component *component)
1111
1102
if (dai_runtime -> paused ) {
1112
1103
dai_runtime -> suspended = true;
1113
1104
1114
- ret = intel_free_stream (sdw , stream , dai , sdw -> instance );
1105
+ ret = intel_free_stream (sdw , dai_runtime -> direction , dai , sdw -> instance );
1115
1106
if (ret < 0 )
1116
1107
return ret ;
1117
1108
}
@@ -1178,6 +1169,7 @@ static int intel_create_dai(struct sdw_cdns *cdns,
1178
1169
1179
1170
static int intel_register_dai (struct sdw_intel * sdw )
1180
1171
{
1172
+ struct sdw_cdns_dai_runtime * * dai_runtime_array ;
1181
1173
struct sdw_cdns_stream_config config ;
1182
1174
struct sdw_cdns * cdns = & sdw -> cdns ;
1183
1175
struct sdw_cdns_streams * stream ;
@@ -1195,6 +1187,13 @@ static int intel_register_dai(struct sdw_intel *sdw)
1195
1187
/* DAIs are created based on total number of PDIs supported */
1196
1188
num_dai = cdns -> pcm .num_pdi ;
1197
1189
1190
+ dai_runtime_array = devm_kcalloc (cdns -> dev , num_dai ,
1191
+ sizeof (struct sdw_cdns_dai_runtime * ),
1192
+ GFP_KERNEL );
1193
+ if (!dai_runtime_array )
1194
+ return - ENOMEM ;
1195
+ cdns -> dai_runtime_array = dai_runtime_array ;
1196
+
1198
1197
dais = devm_kcalloc (cdns -> dev , num_dai , sizeof (* dais ), GFP_KERNEL );
1199
1198
if (!dais )
1200
1199
return - ENOMEM ;
0 commit comments