	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtk_dsi_poweroff
_mtk_dsi_poweroff:                      ## @mtk_dsi_poweroff
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -24
	movq	%rdi, %rbx
	xorl	%edi, %edi
	cmpq	$0, (%rbx)
	sete	%dil
	callq	_WARN_ON
	testq	%rax, %rax
	jne	LBB0_6
## %bb.1:
	decq	(%rbx)
	je	LBB0_2
LBB0_6:
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	retq
LBB0_2:
	movq	%rbx, %rdi
	callq	_mtk_dsi_stop
	movq	_VM_DONE_INT_FLAG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	movl	$500, %edx                      ## imm = 0x1F4
	callq	_mtk_dsi_switch_to_cmd_mode
	testl	%eax, %eax
	je	LBB0_3
LBB0_5:
	movq	%rbx, %rdi
	callq	_mtk_dsi_reset_engine
	movq	%rbx, %rdi
	callq	_mtk_dsi_lane0_ulp_mode_enter
	movq	%rbx, %rdi
	callq	_mtk_dsi_clk_ulp_mode_enter
	movq	%rbx, %rdi
	callq	_mtk_dsi_disable
	movl	16(%rbx), %edi
	callq	_clk_disable_unprepare
	movl	12(%rbx), %edi
	callq	_clk_disable_unprepare
	movl	8(%rbx), %edi
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	jmp	_phy_power_off                  ## TAILCALL
LBB0_3:
	movq	24(%rbx), %rdi
	testq	%rdi, %rdi
	je	LBB0_5
## %bb.4:
	callq	_drm_panel_unprepare
	testq	%rax, %rax
	je	LBB0_5
## %bb.7:
	leaq	L_.str(%rip), %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	jmp	_DRM_ERROR                      ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_VM_DONE_INT_FLAG,4,2           ## @VM_DONE_INT_FLAG
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"failed to unprepare the panel\n"

	.no_dead_strip	_mtk_dsi_poweroff
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mtk_dsi_poweroff
_mtk_dsi_poweroff:                      ; @mtk_dsi_poweroff
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
	ldr	x8, [x0]
	cmp	x8, #0
	cset	w0, eq
	bl	_WARN_ON
	cbnz	x0, LBB0_2
; %bb.1:
	ldr	x8, [x19]
	subs	x8, x8, #1
	str	x8, [x19]
	b.eq	LBB0_3
LBB0_2:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
LBB0_3:
	mov	x0, x19
	bl	_mtk_dsi_stop
Lloh0:
	adrp	x8, _VM_DONE_INT_FLAG@GOTPAGE
Lloh1:
	ldr	x8, [x8, _VM_DONE_INT_FLAG@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #500
	bl	_mtk_dsi_switch_to_cmd_mode
	cbz	w0, LBB0_5
LBB0_4:
	mov	x0, x19
	bl	_mtk_dsi_reset_engine
	mov	x0, x19
	bl	_mtk_dsi_lane0_ulp_mode_enter
	mov	x0, x19
	bl	_mtk_dsi_clk_ulp_mode_enter
	mov	x0, x19
	bl	_mtk_dsi_disable
	ldr	w0, [x19, #16]
	bl	_clk_disable_unprepare
	ldr	w0, [x19, #12]
	bl	_clk_disable_unprepare
	ldr	w0, [x19, #8]
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_phy_power_off
LBB0_5:
	ldr	x0, [x19, #24]
	cbz	x0, LBB0_4
; %bb.6:
	bl	_drm_panel_unprepare
	cbz	x0, LBB0_4
; %bb.7:
Lloh3:
	adrp	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_DRM_ERROR
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.cfi_endproc
                                        ; -- End function
	.comm	_VM_DONE_INT_FLAG,4,2           ; @VM_DONE_INT_FLAG
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"failed to unprepare the panel\n"

	.no_dead_strip	_mtk_dsi_poweroff
.subsections_via_symbols
