@@ -98,14 +98,89 @@ int cavs_hda_dma_host_out_config(const struct device *dev,
9898 return res ;
9999}
100100
101+ int cavs_hda_dma_link_in_config (const struct device * dev ,
102+ uint32_t channel ,
103+ struct dma_config * dma_cfg )
104+ {
105+ const struct cavs_hda_dma_cfg * const cfg = dev -> config ;
106+ struct dma_block_config * blk_cfg ;
107+ uint8_t * buf ;
108+ int res ;
109+
110+ __ASSERT (channel < cfg -> dma_channels , "Channel does not exist" );
111+ __ASSERT (dma_cfg -> block_count == 1 ,
112+ "HDA does not support scatter gather or chained "
113+ "block transfers." );
114+ __ASSERT (dma_cfg -> channel_direction == cfg -> direction ,
115+ "Unexpected channel direction, HDA link in supports "
116+ "PERIPHERAL_TO_MEMORY" );
117+
118+ blk_cfg = dma_cfg -> head_block ;
119+ buf = (uint8_t * )(uintptr_t )(blk_cfg -> source_address );
120+ res = cavs_hda_set_buffer (cfg -> base , channel , buf ,
121+ blk_cfg -> block_size );
122+
123+ if (res == 0 && dma_cfg -> source_data_size <= 3 ) {
124+ /* set the sample container set bit to 16bits */
125+ * DGCS (cfg -> base , channel ) |= DGCS_SCS ;
126+ }
127+
128+ return res ;
129+ }
130+
131+
132+ int cavs_hda_dma_link_out_config (const struct device * dev ,
133+ uint32_t channel ,
134+ struct dma_config * dma_cfg )
135+ {
136+ const struct cavs_hda_dma_cfg * const cfg = dev -> config ;
137+ struct dma_block_config * blk_cfg ;
138+ uint8_t * buf ;
139+ int res ;
140+
141+ __ASSERT (channel < cfg -> dma_channels , "Channel does not exist" );
142+ __ASSERT (dma_cfg -> block_count == 1 ,
143+ "HDA does not support scatter gather or chained "
144+ "block transfers." );
145+ __ASSERT (dma_cfg -> channel_direction == cfg -> direction ,
146+ "Unexpected channel direction, HDA link out supports "
147+ "MEMORY_TO_PERIPHERAL" );
148+
149+ blk_cfg = dma_cfg -> head_block ;
150+ buf = (uint8_t * )(uintptr_t )(blk_cfg -> dest_address );
151+
152+ res = cavs_hda_set_buffer (cfg -> base , channel , buf ,
153+ blk_cfg -> block_size );
154+
155+ if (res == 0 && dma_cfg -> dest_data_size <= 3 ) {
156+ /* set the sample container set bit to 16bits */
157+ * DGCS (cfg -> base , channel ) |= DGCS_SCS ;
158+ }
159+
160+ return res ;
161+ }
162+
163+
164+ int cavs_hda_dma_link_reload (const struct device * dev , uint32_t channel ,
165+ uint32_t src , uint32_t dst , size_t size )
166+ {
167+ const struct cavs_hda_dma_cfg * const cfg = dev -> config ;
168+
169+ __ASSERT (channel < cfg -> dma_channels , "Channel does not exist" );
170+
171+ cavs_hda_link_commit (cfg -> base , channel , size );
172+
173+ return 0 ;
174+ }
175+
101176int cavs_hda_dma_host_reload (const struct device * dev , uint32_t channel ,
102177 uint32_t src , uint32_t dst , size_t size )
103178{
104179 const struct cavs_hda_dma_cfg * const cfg = dev -> config ;
105180
106181 __ASSERT (channel < cfg -> dma_channels , "Channel does not exist" );
107182
108- cavs_hda_commit (cfg -> base , channel , size );
183+ cavs_hda_host_commit (cfg -> base , channel , size );
109184
110185 return 0 ;
111186}
0 commit comments