@@ -88,38 +88,18 @@ static const struct regmap_config rt5682_sdw_indirect_regmap = {
8888 .reg_write = rt5682_sdw_write ,
8989};
9090
91- struct sdw_stream_data {
92- struct sdw_stream_runtime * sdw_stream ;
93- };
94-
9591static int rt5682_set_sdw_stream (struct snd_soc_dai * dai , void * sdw_stream ,
9692 int direction )
9793{
98- struct sdw_stream_data * stream ;
99-
100- if (!sdw_stream )
101- return 0 ;
102-
103- stream = kzalloc (sizeof (* stream ), GFP_KERNEL );
104- if (!stream )
105- return - ENOMEM ;
106-
107- stream -> sdw_stream = sdw_stream ;
108-
109- /* Use tx_mask or rx_mask to configure stream tag and set dma_data */
110- snd_soc_dai_dma_data_set (dai , direction , stream );
94+ snd_soc_dai_dma_data_set (dai , direction , sdw_stream );
11195
11296 return 0 ;
11397}
11498
11599static void rt5682_sdw_shutdown (struct snd_pcm_substream * substream ,
116100 struct snd_soc_dai * dai )
117101{
118- struct sdw_stream_data * stream ;
119-
120- stream = snd_soc_dai_get_dma_data (dai , substream );
121102 snd_soc_dai_set_dma_data (dai , substream , NULL );
122- kfree (stream );
123103}
124104
125105static int rt5682_sdw_hw_params (struct snd_pcm_substream * substream ,
@@ -130,14 +110,14 @@ static int rt5682_sdw_hw_params(struct snd_pcm_substream *substream,
130110 struct rt5682_priv * rt5682 = snd_soc_component_get_drvdata (component );
131111 struct sdw_stream_config stream_config = {0 };
132112 struct sdw_port_config port_config = {0 };
133- struct sdw_stream_data * stream ;
113+ struct sdw_stream_runtime * sdw_stream ;
134114 int retval ;
135115 unsigned int val_p = 0 , val_c = 0 , osr_p = 0 , osr_c = 0 ;
136116
137117 dev_dbg (dai -> dev , "%s %s" , __func__ , dai -> name );
138118
139- stream = snd_soc_dai_get_dma_data (dai , substream );
140- if (!stream )
119+ sdw_stream = snd_soc_dai_get_dma_data (dai , substream );
120+ if (!sdw_stream )
141121 return - ENOMEM ;
142122
143123 if (!rt5682 -> slave )
@@ -152,7 +132,7 @@ static int rt5682_sdw_hw_params(struct snd_pcm_substream *substream,
152132 port_config .num = 2 ;
153133
154134 retval = sdw_stream_add_slave (rt5682 -> slave , & stream_config ,
155- & port_config , 1 , stream -> sdw_stream );
135+ & port_config , 1 , sdw_stream );
156136 if (retval ) {
157137 dev_err (dai -> dev , "Unable to configure port\n" );
158138 return retval ;
@@ -246,13 +226,13 @@ static int rt5682_sdw_hw_free(struct snd_pcm_substream *substream,
246226{
247227 struct snd_soc_component * component = dai -> component ;
248228 struct rt5682_priv * rt5682 = snd_soc_component_get_drvdata (component );
249- struct sdw_stream_data * stream =
229+ struct sdw_stream_runtime * sdw_stream =
250230 snd_soc_dai_get_dma_data (dai , substream );
251231
252232 if (!rt5682 -> slave )
253233 return - EINVAL ;
254234
255- sdw_stream_remove_slave (rt5682 -> slave , stream -> sdw_stream );
235+ sdw_stream_remove_slave (rt5682 -> slave , sdw_stream );
256236 return 0 ;
257237}
258238
0 commit comments