	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtk_dsi_poweron
_mtk_dsi_poweron:                       ## @mtk_dsi_poweron
	.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	64(%rdi), %r15
	movl	(%rdi), %eax
	leal	1(%rax), %ecx
	movl	%ecx, (%rdi)
	xorl	%ebx, %ebx
	testl	%eax, %eax
	jne	LBB0_13
## %bb.1:
	movq	%rdi, %r12
	movl	4(%rdi), %eax
	movl	8(%rdi), %esi
	cmpl	$129, %eax
	movl	$18, %ecx
	movl	$24, %edx
	cmovel	%ecx, %edx
	cmpl	$131, %eax
	movl	$16, %eax
	cmovnel	%edx, %eax
	movdqu	44(%rdi), %xmm0
	pshufd	$238, %xmm0, %xmm1              ## xmm1 = xmm0[2,3,2,3]
	paddd	%xmm0, %xmm1
	pshufd	$85, %xmm1, %xmm0               ## xmm0 = xmm1[1,1,1,1]
	paddd	%xmm1, %xmm0
	movq	_T_LPX@GOTPCREL(%rip), %rcx
	movq	_T_HS_PREP@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	addl	(%rcx), %edx
	movd	%xmm0, %ecx
	movq	_T_HS_ZERO@GOTPCREL(%rip), %rdi
	addl	(%rdi), %edx
	imull	%ecx, %eax
	movq	_T_HS_TRAIL@GOTPCREL(%rip), %rdi
	addl	(%rdi), %edx
	movq	_T_HS_EXIT@GOTPCREL(%rip), %rdi
	addl	(%rdi), %edx
	imull	%esi, %edx
	leal	(%rax,%rdx,8), %edi
	imull	40(%r12), %edi
	imull	%ecx, %esi
	callq	_DIV_ROUND_UP_ULL
	movl	%eax, 32(%r12)
	movl	36(%r12), %edi
	movl	%eax, %esi
	callq	_clk_set_rate
	testl	%eax, %eax
	js	LBB0_2
## %bb.3:
	movl	12(%r12), %edi
	callq	_phy_power_on
	movl	16(%r12), %edi
	callq	_clk_prepare_enable
	testl	%eax, %eax
	js	LBB0_4
## %bb.5:
	movl	20(%r12), %edi
	callq	_clk_prepare_enable
	movl	%eax, %r14d
	testl	%eax, %eax
	js	LBB0_6
## %bb.7:
	movq	%r12, %rdi
	callq	_mtk_dsi_enable
	movq	%r12, %rdi
	callq	_mtk_dsi_reset_engine
	movq	%r12, %rdi
	callq	_mtk_dsi_phy_timconfig
	movq	%r12, %rdi
	callq	_mtk_dsi_rxtx_control
	movq	%r12, %rdi
	callq	_mtk_dsi_ps_control_vact
	movq	%r12, %rdi
	callq	_mtk_dsi_set_vm_cmd
	movq	%r12, %rdi
	callq	_mtk_dsi_config_vdo_timing
	movq	%r12, %rdi
	callq	_mtk_dsi_set_interrupt_enable
	movq	%r12, %rdi
	callq	_mtk_dsi_clk_ulp_mode_leave
	movq	%r12, %rdi
	callq	_mtk_dsi_lane0_ulp_mode_leave
	xorl	%ebx, %ebx
	movq	%r12, %rdi
	xorl	%esi, %esi
	callq	_mtk_dsi_clk_hs_mode
	movq	24(%r12), %rdi
	testq	%rdi, %rdi
	je	LBB0_13
## %bb.8:
	callq	_drm_panel_prepare
	testq	%rax, %rax
	je	LBB0_13
## %bb.9:
	leaq	L_.str.3(%rip), %rdi
	callq	_DRM_ERROR
	movl	20(%r12), %edi
	callq	_clk_disable_unprepare
	jmp	LBB0_10
LBB0_2:
	movl	%eax, %r14d
	leaq	L_.str(%rip), %rsi
	movq	%r15, %rdi
	movl	%eax, %edx
	callq	_dev_err
	jmp	LBB0_12
LBB0_4:
	movl	%eax, %r14d
	leaq	L_.str.1(%rip), %rsi
	movq	%r15, %rdi
	movl	%eax, %edx
	callq	_dev_err
	jmp	LBB0_11
LBB0_6:
	leaq	L_.str.2(%rip), %rsi
	movq	%r15, %rdi
	movl	%r14d, %edx
	callq	_dev_err
LBB0_10:
	movl	16(%r12), %edi
	callq	_clk_disable_unprepare
LBB0_11:
	movl	12(%r12), %edi
	callq	_phy_power_off
LBB0_12:
	decl	(%r12)
	movl	%r14d, %ebx
LBB0_13:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_T_LPX,4,2                      ## @T_LPX
	.comm	_T_HS_PREP,4,2                  ## @T_HS_PREP
	.comm	_T_HS_ZERO,4,2                  ## @T_HS_ZERO
	.comm	_T_HS_TRAIL,4,2                 ## @T_HS_TRAIL
	.comm	_T_HS_EXIT,4,2                  ## @T_HS_EXIT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to set data rate: %d\n"

L_.str.1:                               ## @.str.1
	.asciz	"Failed to enable engine clock: %d\n"

L_.str.2:                               ## @.str.2
	.asciz	"Failed to enable digital clock: %d\n"

L_.str.3:                               ## @.str.3
	.asciz	"failed to prepare the panel\n"

	.no_dead_strip	_mtk_dsi_poweron
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mtk_dsi_poweron
_mtk_dsi_poweron:                       ; @mtk_dsi_poweron
	.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
	ldr	x21, [x0, #64]
	ldr	w8, [x0]
	add	w9, w8, #1
	str	w9, [x0]
	cbz	w8, LBB0_2
LBB0_1:
	mov	w20, #0
	b	LBB0_14
LBB0_2:
	mov	x19, x0
	mov	w8, #24
	mov	w9, #18
	ldp	w10, w11, [x0, #4]
	cmp	w10, #129
	csel	w8, w9, w8, eq
	mov	w9, #16
	cmp	w10, #131
	csel	w8, w9, w8, eq
	ldr	w9, [x0, #40]
	ldur	q0, [x0, #44]
Lloh0:
	adrp	x10, _T_LPX@GOTPAGE
Lloh1:
	ldr	x10, [x10, _T_LPX@GOTPAGEOFF]
	addv.4s	s0, v0
Lloh2:
	ldr	w10, [x10]
Lloh3:
	adrp	x12, _T_HS_PREP@GOTPAGE
Lloh4:
	ldr	x12, [x12, _T_HS_PREP@GOTPAGEOFF]
Lloh5:
	adrp	x13, _T_HS_ZERO@GOTPAGE
Lloh6:
	ldr	x13, [x13, _T_HS_ZERO@GOTPAGEOFF]
Lloh7:
	ldr	w12, [x12]
Lloh8:
	ldr	w13, [x13]
	add	w10, w12, w10
	add	w10, w10, w13
Lloh9:
	adrp	x12, _T_HS_TRAIL@GOTPAGE
Lloh10:
	ldr	x12, [x12, _T_HS_TRAIL@GOTPAGEOFF]
Lloh11:
	ldr	w12, [x12]
Lloh12:
	adrp	x13, _T_HS_EXIT@GOTPAGE
Lloh13:
	ldr	x13, [x13, _T_HS_EXIT@GOTPAGEOFF]
Lloh14:
	ldr	w13, [x13]
	add	w10, w10, w12
	add	w10, w10, w13
	fmov	w12, s0
	mul	w8, w12, w8
	mul	w10, w11, w10
	add	w8, w8, w10, lsl #3
	mul	w0, w8, w9
	mul	w1, w11, w12
	bl	_DIV_ROUND_UP_ULL
	mov	x1, x0
	str	w0, [x19, #32]
	ldr	w0, [x19, #36]
	bl	_clk_set_rate
	tbnz	w0, #31, LBB0_8
; %bb.3:
	ldr	w0, [x19, #12]
	bl	_phy_power_on
	ldr	w0, [x19, #16]
	bl	_clk_prepare_enable
	tbnz	w0, #31, LBB0_9
; %bb.4:
	ldr	w0, [x19, #20]
	bl	_clk_prepare_enable
	mov	x20, x0
	tbnz	w0, #31, LBB0_10
; %bb.5:
	mov	x0, x19
	bl	_mtk_dsi_enable
	mov	x0, x19
	bl	_mtk_dsi_reset_engine
	mov	x0, x19
	bl	_mtk_dsi_phy_timconfig
	mov	x0, x19
	bl	_mtk_dsi_rxtx_control
	mov	x0, x19
	bl	_mtk_dsi_ps_control_vact
	mov	x0, x19
	bl	_mtk_dsi_set_vm_cmd
	mov	x0, x19
	bl	_mtk_dsi_config_vdo_timing
	mov	x0, x19
	bl	_mtk_dsi_set_interrupt_enable
	mov	x0, x19
	bl	_mtk_dsi_clk_ulp_mode_leave
	mov	x0, x19
	bl	_mtk_dsi_lane0_ulp_mode_leave
	mov	x0, x19
	mov	w1, #0
	bl	_mtk_dsi_clk_hs_mode
	ldr	x0, [x19, #24]
	cbz	x0, LBB0_1
; %bb.6:
	bl	_drm_panel_prepare
	cbz	x0, LBB0_1
; %bb.7:
Lloh15:
	adrp	x0, l_.str.3@PAGE
Lloh16:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_DRM_ERROR
	ldr	w0, [x19, #20]
	bl	_clk_disable_unprepare
	b	LBB0_11
LBB0_8:
	mov	x20, x0
Lloh17:
	adrp	x1, l_.str@PAGE
Lloh18:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x21
	mov	x2, x20
	bl	_dev_err
	b	LBB0_13
LBB0_9:
	mov	x20, x0
Lloh19:
	adrp	x1, l_.str.1@PAGE
Lloh20:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x21
	mov	x2, x20
	bl	_dev_err
	b	LBB0_12
LBB0_10:
Lloh21:
	adrp	x1, l_.str.2@PAGE
Lloh22:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x21
	mov	x2, x20
	bl	_dev_err
LBB0_11:
	ldr	w0, [x19, #16]
	bl	_clk_disable_unprepare
LBB0_12:
	ldr	w0, [x19, #12]
	bl	_phy_power_off
LBB0_13:
	ldr	w8, [x19]
	sub	w8, w8, #1
	str	w8, [x19]
LBB0_14:
	mov	x0, x20
	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
	ret
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh7
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpAdd	Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.comm	_T_LPX,4,2                      ; @T_LPX
	.comm	_T_HS_PREP,4,2                  ; @T_HS_PREP
	.comm	_T_HS_ZERO,4,2                  ; @T_HS_ZERO
	.comm	_T_HS_TRAIL,4,2                 ; @T_HS_TRAIL
	.comm	_T_HS_EXIT,4,2                  ; @T_HS_EXIT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to set data rate: %d\n"

l_.str.1:                               ; @.str.1
	.asciz	"Failed to enable engine clock: %d\n"

l_.str.2:                               ; @.str.2
	.asciz	"Failed to enable digital clock: %d\n"

l_.str.3:                               ; @.str.3
	.asciz	"failed to prepare the panel\n"

	.no_dead_strip	_mtk_dsi_poweron
.subsections_via_symbols
