	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function radeon_dp_link_train_ce
_radeon_dp_link_train_ce:               ## @radeon_dp_link_train_ce
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	cmpq	$0, 32(%rdi)
	jne	LBB0_1
## %bb.2:
	movq	_DP_TRAINING_PATTERN_2@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_1:
	movq	_DP_TRAINING_PATTERN_3@GOTPCREL(%rip), %rax
LBB0_3:
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_radeon_dp_set_tp
	movl	$0, (%rbx)
	movl	28(%rbx), %edi
	callq	_drm_dp_link_train_channel_eq_delay
	movl	20(%rbx), %esi
	movl	24(%rbx), %edi
	callq	_drm_dp_dpcd_read_link_status
	leaq	L_.str(%rip), %r14
	testq	%rax, %rax
	jle	LBB0_9
## %bb.4:
	leaq	L_.str.1(%rip), %r15
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movl	16(%rbx), %esi
	movl	20(%rbx), %edi
	callq	_drm_dp_channel_eq_ok
	testq	%rax, %rax
	jne	LBB0_10
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	cmpl	$5, (%rbx)
	jg	LBB0_7
## %bb.8:                               ##   in Loop: Header=BB0_5 Depth=1
	movl	20(%rbx), %edi
	movl	16(%rbx), %esi
	movq	8(%rbx), %rdx
	callq	_dp_get_adjust_train
	movq	%rbx, %rdi
	callq	_radeon_dp_update_vs_emph
	incl	(%rbx)
	movl	28(%rbx), %edi
	callq	_drm_dp_link_train_channel_eq_delay
	movl	20(%rbx), %esi
	movl	24(%rbx), %edi
	callq	_drm_dp_dpcd_read_link_status
	testq	%rax, %rax
	jg	LBB0_5
	jmp	LBB0_9
LBB0_10:
	movq	8(%rbx), %rax
	movl	(%rax), %edx
	movq	_DP_TRAIN_VOLTAGE_SWING_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	andl	%edx, %esi
	movq	_DP_TRAIN_PRE_EMPHASIS_MASK@GOTPCREL(%rip), %rax
	andl	(%rax), %edx
	movq	_DP_TRAIN_PRE_EMPHASIS_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	sarl	%cl, %edx
	leaq	L_.str.3(%rip), %rdi
	callq	_DRM_DEBUG_KMS
	xorl	%eax, %eax
	jmp	LBB0_11
LBB0_7:
	movq	%r15, %r14
LBB0_9:
	movq	%r14, %rdi
	callq	_DRM_ERROR
	leaq	L_.str.2(%rip), %rdi
	callq	_DRM_ERROR
	movl	$-1, %eax
LBB0_11:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_DP_TRAINING_PATTERN_3,4,2      ## @DP_TRAINING_PATTERN_3
	.comm	_DP_TRAINING_PATTERN_2,4,2      ## @DP_TRAINING_PATTERN_2
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"displayport link status failed\n"

L_.str.1:                               ## @.str.1
	.asciz	"channel eq failed: 5 tries\n"

L_.str.2:                               ## @.str.2
	.asciz	"channel eq failed\n"

L_.str.3:                               ## @.str.3
	.asciz	"channel eq at voltage %d pre-emphasis %d\n"

	.comm	_DP_TRAIN_VOLTAGE_SWING_MASK,4,2 ## @DP_TRAIN_VOLTAGE_SWING_MASK
	.comm	_DP_TRAIN_PRE_EMPHASIS_MASK,4,2 ## @DP_TRAIN_PRE_EMPHASIS_MASK
	.comm	_DP_TRAIN_PRE_EMPHASIS_SHIFT,4,2 ## @DP_TRAIN_PRE_EMPHASIS_SHIFT
	.no_dead_strip	_radeon_dp_link_train_ce
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function radeon_dp_link_train_ce
_radeon_dp_link_train_ce:               ; @radeon_dp_link_train_ce
	.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	x19, x0
Lloh0:
	adrp	x8, _DP_TRAINING_PATTERN_2@GOTPAGE
Lloh1:
	ldr	x8, [x8, _DP_TRAINING_PATTERN_2@GOTPAGEOFF]
	ldr	x9, [x0, #32]
Lloh2:
	adrp	x10, _DP_TRAINING_PATTERN_3@GOTPAGE
Lloh3:
	ldr	x10, [x10, _DP_TRAINING_PATTERN_3@GOTPAGEOFF]
	cmp	x9, #0
	csel	x8, x8, x10, eq
	ldr	w1, [x8]
	bl	_radeon_dp_set_tp
	str	wzr, [x19]
	ldr	w0, [x19, #28]
	bl	_drm_dp_link_train_channel_eq_delay
	ldp	w1, w0, [x19, #20]
	bl	_drm_dp_dpcd_read_link_status
	cmp	x0, #1
	b.lt	LBB0_6
; %bb.1:
Lloh4:
	adrp	x20, l_.str.1@PAGE
Lloh5:
	add	x20, x20, l_.str.1@PAGEOFF
Lloh6:
	adrp	x21, l_.str@PAGE
Lloh7:
	add	x21, x21, l_.str@PAGEOFF
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldp	w1, w0, [x19, #16]
	bl	_drm_dp_channel_eq_ok
	cbnz	x0, LBB0_8
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	w8, [x19]
	cmp	w8, #5
	b.gt	LBB0_7
; %bb.4:                                ;   in Loop: Header=BB0_2 Depth=1
	ldp	w1, w0, [x19, #16]
	ldr	x2, [x19, #8]
	bl	_dp_get_adjust_train
	mov	x0, x19
	bl	_radeon_dp_update_vs_emph
	ldr	w8, [x19]
	add	w8, w8, #1
	str	w8, [x19]
	ldr	w0, [x19, #28]
	bl	_drm_dp_link_train_channel_eq_delay
	ldp	w1, w0, [x19, #20]
	bl	_drm_dp_dpcd_read_link_status
	cmp	x0, #0
	b.gt	LBB0_2
; %bb.5:
	mov	x20, x21
	b	LBB0_7
LBB0_6:
Lloh8:
	adrp	x20, l_.str@PAGE
Lloh9:
	add	x20, x20, l_.str@PAGEOFF
LBB0_7:
	mov	x0, x20
	bl	_DRM_ERROR
Lloh10:
	adrp	x0, l_.str.2@PAGE
Lloh11:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_DRM_ERROR
	mov	w0, #-1
	b	LBB0_9
LBB0_8:
	ldr	x8, [x19, #8]
	ldr	w8, [x8]
Lloh12:
	adrp	x9, _DP_TRAIN_VOLTAGE_SWING_MASK@GOTPAGE
Lloh13:
	ldr	x9, [x9, _DP_TRAIN_VOLTAGE_SWING_MASK@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	and	w1, w9, w8
Lloh15:
	adrp	x9, _DP_TRAIN_PRE_EMPHASIS_MASK@GOTPAGE
Lloh16:
	ldr	x9, [x9, _DP_TRAIN_PRE_EMPHASIS_MASK@GOTPAGEOFF]
Lloh17:
	ldr	w9, [x9]
	and	w8, w9, w8
Lloh18:
	adrp	x9, _DP_TRAIN_PRE_EMPHASIS_SHIFT@GOTPAGE
Lloh19:
	ldr	x9, [x9, _DP_TRAIN_PRE_EMPHASIS_SHIFT@GOTPAGEOFF]
Lloh20:
	ldr	w9, [x9]
	asr	w2, w8, w9
Lloh21:
	adrp	x0, l_.str.3@PAGE
Lloh22:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_DRM_DEBUG_KMS
	mov	w0, #0
LBB0_9:
	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 AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_DP_TRAINING_PATTERN_3,4,2      ; @DP_TRAINING_PATTERN_3
	.comm	_DP_TRAINING_PATTERN_2,4,2      ; @DP_TRAINING_PATTERN_2
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"displayport link status failed\n"

l_.str.1:                               ; @.str.1
	.asciz	"channel eq failed: 5 tries\n"

l_.str.2:                               ; @.str.2
	.asciz	"channel eq failed\n"

l_.str.3:                               ; @.str.3
	.asciz	"channel eq at voltage %d pre-emphasis %d\n"

	.comm	_DP_TRAIN_VOLTAGE_SWING_MASK,4,2 ; @DP_TRAIN_VOLTAGE_SWING_MASK
	.comm	_DP_TRAIN_PRE_EMPHASIS_MASK,4,2 ; @DP_TRAIN_PRE_EMPHASIS_MASK
	.comm	_DP_TRAIN_PRE_EMPHASIS_SHIFT,4,2 ; @DP_TRAIN_PRE_EMPHASIS_SHIFT
	.no_dead_strip	_radeon_dp_link_train_ce
.subsections_via_symbols
