@@ -153,25 +153,6 @@ static inline void hda_dma_inc_link_fp(struct dma *dma, uint32_t chan,
153153 /* TODO: wp update should inc LLPI and LPIBI in the input DMA */
154154}
155155
156- /* TODO: might be implemented as buffer_size - get_data_size() */
157- static inline uint32_t hda_dma_get_free_size (struct dma * dma , uint32_t chan )
158- {
159- const uint32_t cs = host_dma_reg_read (dma , chan , DGCS );
160- const uint32_t bs = host_dma_reg_read (dma , chan , DGBS );
161- const uint32_t rp = host_dma_reg_read (dma , chan , DGBRP );
162- const uint32_t wp = host_dma_reg_read (dma , chan , DGBRP );
163- int32_t fs ;
164-
165- if (cs & DGCS_BF )
166- return 0 ; /* buffer is full */
167- if (!(cs & DGCS_BNE ))
168- return bs ; /* buffer is empty */
169- fs = rp - wp ;
170- if (wp >= rp )
171- fs += bs ;
172- return fs ;
173- }
174-
175156static inline uint32_t hda_dma_get_data_size (struct dma * dma , uint32_t chan )
176157{
177158 const uint32_t cs = host_dma_reg_read (dma , chan , DGCS );
@@ -190,6 +171,13 @@ static inline uint32_t hda_dma_get_data_size(struct dma *dma, uint32_t chan)
190171 return ds ;
191172}
192173
174+ static inline uint32_t hda_dma_get_free_size (struct dma * dma , uint32_t chan )
175+ {
176+ const uint32_t bs = host_dma_reg_read (dma , chan , DGBS );
177+
178+ return bs - hda_dma_get_data_size (dma , chan );
179+ }
180+
193181static int hda_dma_preload (struct dma * dma , struct hda_chan_data * chan )
194182{
195183 struct dma_sg_elem next = {
0 commit comments