	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtk_cqdma_free_chan_resources
_mtk_cqdma_free_chan_resources:         ## @mtk_cqdma_free_chan_resources
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	callq	_to_cqdma_vchan
	movq	%rax, %rbx
	movq	%r14, %rdi
	callq	_mtk_cqdma_terminate_all
	movq	(%rbx), %rdi
	callq	_spin_lock_irqsave
	movq	(%rbx), %rdi
	addq	$4, %rdi
	callq	_refcount_dec_and_test
	testq	%rax, %rax
	je	LBB0_4
## %bb.1:
	movq	(%rbx), %rdi
	movq	_MTK_CQDMA_FLUSH@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	movq	_MTK_CQDMA_FLUSH_BIT@GOTPCREL(%rip), %r12
	movl	(%r12), %edx
	callq	_mtk_dma_set
	movq	(%rbx), %rdi
	movl	$1, %esi
	callq	_mtk_cqdma_poll_engine_done
	testq	%rax, %rax
	jns	LBB0_3
## %bb.2:
	movq	%r14, %rdi
	callq	_to_cqdma_dev
	movl	%eax, %edi
	callq	_cqdma2dev
	leaq	L_.str(%rip), %rsi
	movl	%eax, %edi
	callq	_dev_err
LBB0_3:
	movq	(%rbx), %rdi
	movl	(%r15), %esi
	movl	(%r12), %edx
	callq	_mtk_dma_clr
	movq	(%rbx), %rdi
	movq	_MTK_CQDMA_INT_FLAG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_MTK_CQDMA_INT_FLAG_BIT@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_mtk_dma_clr
	movq	(%rbx), %rdi
	movq	_MTK_CQDMA_INT_EN@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_MTK_CQDMA_INT_EN_BIT@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_mtk_dma_clr
LBB0_4:
	movq	(%rbx), %rdi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_spin_unlock_irqrestore         ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_MTK_CQDMA_FLUSH,4,2            ## @MTK_CQDMA_FLUSH
	.comm	_MTK_CQDMA_FLUSH_BIT,4,2        ## @MTK_CQDMA_FLUSH_BIT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"cqdma flush timeout\n"

	.comm	_MTK_CQDMA_INT_FLAG,4,2         ## @MTK_CQDMA_INT_FLAG
	.comm	_MTK_CQDMA_INT_FLAG_BIT,4,2     ## @MTK_CQDMA_INT_FLAG_BIT
	.comm	_MTK_CQDMA_INT_EN,4,2           ## @MTK_CQDMA_INT_EN
	.comm	_MTK_CQDMA_INT_EN_BIT,4,2       ## @MTK_CQDMA_INT_EN_BIT
	.no_dead_strip	_mtk_cqdma_free_chan_resources
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mtk_cqdma_free_chan_resources
_mtk_cqdma_free_chan_resources:         ; @mtk_cqdma_free_chan_resources
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	mov	x20, x0
	bl	_to_cqdma_vchan
	mov	x19, x0
	mov	x0, x20
	bl	_mtk_cqdma_terminate_all
	ldr	x0, [x19]
	bl	_spin_lock_irqsave
	ldr	x8, [x19]
	add	x0, x8, #4
	bl	_refcount_dec_and_test
	cbz	x0, LBB0_4
; %bb.1:
	ldr	x0, [x19]
Lloh0:
	adrp	x21, _MTK_CQDMA_FLUSH@GOTPAGE
Lloh1:
	ldr	x21, [x21, _MTK_CQDMA_FLUSH@GOTPAGEOFF]
	ldr	w1, [x21]
Lloh2:
	adrp	x22, _MTK_CQDMA_FLUSH_BIT@GOTPAGE
Lloh3:
	ldr	x22, [x22, _MTK_CQDMA_FLUSH_BIT@GOTPAGEOFF]
	ldr	w2, [x22]
	bl	_mtk_dma_set
	ldr	x0, [x19]
	mov	w1, #1
	bl	_mtk_cqdma_poll_engine_done
	tbz	x0, #63, LBB0_3
; %bb.2:
	mov	x0, x20
	bl	_to_cqdma_dev
	bl	_cqdma2dev
Lloh4:
	adrp	x1, l_.str@PAGE
Lloh5:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
LBB0_3:
	ldr	x0, [x19]
	ldr	w1, [x21]
	ldr	w2, [x22]
	bl	_mtk_dma_clr
	ldr	x0, [x19]
Lloh6:
	adrp	x8, _MTK_CQDMA_INT_FLAG@GOTPAGE
Lloh7:
	ldr	x8, [x8, _MTK_CQDMA_INT_FLAG@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
Lloh9:
	adrp	x8, _MTK_CQDMA_INT_FLAG_BIT@GOTPAGE
Lloh10:
	ldr	x8, [x8, _MTK_CQDMA_INT_FLAG_BIT@GOTPAGEOFF]
Lloh11:
	ldr	w2, [x8]
	bl	_mtk_dma_clr
	ldr	x0, [x19]
Lloh12:
	adrp	x8, _MTK_CQDMA_INT_EN@GOTPAGE
Lloh13:
	ldr	x8, [x8, _MTK_CQDMA_INT_EN@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
Lloh15:
	adrp	x8, _MTK_CQDMA_INT_EN_BIT@GOTPAGE
Lloh16:
	ldr	x8, [x8, _MTK_CQDMA_INT_EN_BIT@GOTPAGEOFF]
Lloh17:
	ldr	w2, [x8]
	bl	_mtk_dma_clr
LBB0_4:
	ldr	x0, [x19]
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	b	_spin_unlock_irqrestore
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_MTK_CQDMA_FLUSH,4,2            ; @MTK_CQDMA_FLUSH
	.comm	_MTK_CQDMA_FLUSH_BIT,4,2        ; @MTK_CQDMA_FLUSH_BIT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"cqdma flush timeout\n"

	.comm	_MTK_CQDMA_INT_FLAG,4,2         ; @MTK_CQDMA_INT_FLAG
	.comm	_MTK_CQDMA_INT_FLAG_BIT,4,2     ; @MTK_CQDMA_INT_FLAG_BIT
	.comm	_MTK_CQDMA_INT_EN,4,2           ; @MTK_CQDMA_INT_EN
	.comm	_MTK_CQDMA_INT_EN_BIT,4,2       ; @MTK_CQDMA_INT_EN_BIT
	.no_dead_strip	_mtk_cqdma_free_chan_resources
.subsections_via_symbols
