	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function rk3x_i2c_xfer
_rk3x_i2c_xfer:                         ## @rk3x_i2c_xfer
	.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	%r13
	pushq	%r12
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r14d
	movq	%rsi, -72(%rbp)                 ## 8-byte Spill
	movq	(%rdi), %r12
	leaq	8(%r12), %rdi
	movq	%rdi, -64(%rbp)                 ## 8-byte Spill
	callq	_spin_lock_irqsave
	movl	12(%r12), %edi
	callq	_clk_enable
	movl	16(%r12), %edi
	callq	_clk_enable
	movl	$0, (%r12)
	testl	%r14d, %r14d
	jle	LBB0_1
## %bb.2:
	xorl	%ebx, %ebx
	movl	%r14d, -44(%rbp)                ## 4-byte Spill
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movslq	%ebx, %rax
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	leaq	(%rcx,%rax,4), %rsi
	movl	%r14d, %edx
	subl	%eax, %edx
	movq	%r12, %rdi
	callq	_rk3x_i2c_setup
	movl	%eax, %r15d
	testl	%eax, %eax
	js	LBB0_4
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	%r15d, -48(%rbp)                ## 4-byte Spill
	addl	%r15d, %ebx
	movl	%ebx, -52(%rbp)                 ## 4-byte Spill
	cmpl	%r14d, %ebx
	jl	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	$1, (%r12)
LBB0_7:                                 ##   in Loop: Header=BB0_3 Depth=1
	movq	-64(%rbp), %r15                 ## 8-byte Reload
	movq	%r15, %rdi
	callq	_spin_unlock_irqrestore
	movq	%r12, %rdi
	callq	_rk3x_i2c_start
	movl	32(%r12), %r13d
	xorl	%r14d, %r14d
	cmpl	$0, 28(%r12)
	sete	%r14b
	movq	_WAIT_TIMEOUT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_msecs_to_jiffies
	movl	%r13d, %edi
	movl	%r14d, %esi
	movl	%eax, %edx
	callq	_wait_event_timeout
	movq	%rax, %rbx
	movq	%r15, %rdi
	callq	_spin_lock_irqsave
	testq	%rbx, %rbx
	je	LBB0_8
## %bb.9:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	4(%r12), %eax
	testl	%eax, %eax
	movl	-44(%rbp), %r14d                ## 4-byte Reload
	movl	-52(%rbp), %ebx                 ## 4-byte Reload
	jne	LBB0_11
## %bb.10:                              ##   in Loop: Header=BB0_3 Depth=1
	cmpl	%r14d, %ebx
	jl	LBB0_3
LBB0_11:
	testl	%eax, %eax
	movl	-48(%rbp), %r15d                ## 4-byte Reload
	cmovnel	%eax, %r15d
	jmp	LBB0_12
LBB0_1:
	xorl	%r15d, %r15d
	jmp	LBB0_12
LBB0_4:
	movl	24(%r12), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_12
LBB0_8:
	movl	24(%r12), %ebx
	movq	_REG_IPD@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_i2c_readl
	movl	20(%r12), %ecx
	leaq	L_.str.1(%rip), %rsi
	xorl	%r15d, %r15d
	movl	%ebx, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_dev_err
	movq	_REG_IEN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r12, %rdi
	xorl	%esi, %esi
	callq	_i2c_writel
	movq	_REG_CON@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	movq	%r12, %rdi
	callq	_i2c_readl
	movq	_REG_CON_TUNING_MASK@GOTPCREL(%rip), %rcx
	andl	(%rcx), %eax
	movq	_REG_CON_EN@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movq	_REG_CON_STOP@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movl	(%rbx), %edx
	movq	%r12, %rdi
	movl	%eax, %esi
	callq	_i2c_writel
	movq	_STATE_IDLE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 20(%r12)
	movq	_ETIMEDOUT@GOTPCREL(%rip), %rax
	subl	(%rax), %r15d
	movl	-44(%rbp), %r14d                ## 4-byte Reload
LBB0_12:
	movl	16(%r12), %edi
	callq	_clk_disable
	movl	12(%r12), %edi
	callq	_clk_disable
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_spin_unlock_irqrestore
	testl	%r15d, %r15d
	cmovsl	%r15d, %r14d
	movl	%r14d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"rk3x_i2c_setup() failed\n"

	.comm	_WAIT_TIMEOUT,4,2               ## @WAIT_TIMEOUT
L_.str.1:                               ## @.str.1
	.asciz	"timeout, ipd: 0x%02x, state: %d\n"

	.comm	_REG_IPD,4,2                    ## @REG_IPD
	.comm	_REG_IEN,4,2                    ## @REG_IEN
	.comm	_REG_CON,4,2                    ## @REG_CON
	.comm	_REG_CON_TUNING_MASK,4,2        ## @REG_CON_TUNING_MASK
	.comm	_REG_CON_EN,4,2                 ## @REG_CON_EN
	.comm	_REG_CON_STOP,4,2               ## @REG_CON_STOP
	.comm	_STATE_IDLE,4,2                 ## @STATE_IDLE
	.comm	_ETIMEDOUT,4,2                  ## @ETIMEDOUT
	.no_dead_strip	_rk3x_i2c_xfer
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function rk3x_i2c_xfer
_rk3x_i2c_xfer:                         ; @rk3x_i2c_xfer
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x2
	mov	x22, x1
	ldr	x21, [x0]
	add	x20, x21, #8
	mov	x0, x20
	bl	_spin_lock_irqsave
	ldr	w0, [x21, #12]
	bl	_clk_enable
	ldr	w0, [x21, #16]
	bl	_clk_enable
	str	wzr, [x21]
	cmp	w19, #1
	b.lt	LBB0_9
; %bb.1:
	mov	w26, #0
Lloh0:
	adrp	x27, _WAIT_TIMEOUT@GOTPAGE
Lloh1:
	ldr	x27, [x27, _WAIT_TIMEOUT@GOTPAGEOFF]
	mov	w28, #1
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	add	x1, x22, w26, sxtw #2
	sub	w2, w19, w26
	mov	x0, x21
	bl	_rk3x_i2c_setup
	mov	x23, x0
	tbnz	w0, #31, LBB0_10
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	add	w26, w23, w26
	cmp	w26, w19
	b.lt	LBB0_5
; %bb.4:                                ;   in Loop: Header=BB0_2 Depth=1
	str	w28, [x21]
LBB0_5:                                 ;   in Loop: Header=BB0_2 Depth=1
	mov	x0, x20
	bl	_spin_unlock_irqrestore
	mov	x0, x21
	bl	_rk3x_i2c_start
	ldp	w8, w24, [x21, #28]
	cmp	w8, #0
	cset	w25, eq
	ldr	w0, [x27]
	bl	_msecs_to_jiffies
	mov	x2, x0
	mov	x0, x24
	mov	x1, x25
	bl	_wait_event_timeout
	mov	x24, x0
	mov	x0, x20
	bl	_spin_lock_irqsave
	cbz	x24, LBB0_11
; %bb.6:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	w8, [x21, #4]
	cbnz	w8, LBB0_8
; %bb.7:                                ;   in Loop: Header=BB0_2 Depth=1
	cmp	w26, w19
	b.lt	LBB0_2
LBB0_8:
	cmp	w8, #0
	csel	w23, w8, w23, ne
	b	LBB0_12
LBB0_9:
	mov	w23, #0
	b	LBB0_12
LBB0_10:
	ldr	w0, [x21, #24]
Lloh2:
	adrp	x1, l_.str@PAGE
Lloh3:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	b	LBB0_12
LBB0_11:
	ldr	w22, [x21, #24]
Lloh4:
	adrp	x8, _REG_IPD@GOTPAGE
Lloh5:
	ldr	x8, [x8, _REG_IPD@GOTPAGEOFF]
Lloh6:
	ldr	w1, [x8]
	mov	x0, x21
	bl	_i2c_readl
                                        ; kill: def $w0 killed $w0 def $x0
	ldr	w8, [x21, #20]
	stp	x0, x8, [sp]
Lloh7:
	adrp	x1, l_.str.1@PAGE
Lloh8:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x22
	bl	_dev_err
Lloh9:
	adrp	x8, _REG_IEN@GOTPAGE
Lloh10:
	ldr	x8, [x8, _REG_IEN@GOTPAGEOFF]
Lloh11:
	ldr	w2, [x8]
	mov	x0, x21
	mov	w1, #0
	bl	_i2c_writel
Lloh12:
	adrp	x22, _REG_CON@GOTPAGE
Lloh13:
	ldr	x22, [x22, _REG_CON@GOTPAGEOFF]
	ldr	w1, [x22]
	mov	x0, x21
	bl	_i2c_readl
Lloh14:
	adrp	x8, _REG_CON_TUNING_MASK@GOTPAGE
Lloh15:
	ldr	x8, [x8, _REG_CON_TUNING_MASK@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
	and	w8, w8, w0
Lloh17:
	adrp	x9, _REG_CON_EN@GOTPAGE
Lloh18:
	ldr	x9, [x9, _REG_CON_EN@GOTPAGEOFF]
Lloh19:
	ldr	w9, [x9]
Lloh20:
	adrp	x10, _REG_CON_STOP@GOTPAGE
Lloh21:
	ldr	x10, [x10, _REG_CON_STOP@GOTPAGEOFF]
Lloh22:
	ldr	w10, [x10]
	orr	w8, w8, w9
	orr	w1, w8, w10
	ldr	w2, [x22]
	mov	x0, x21
	bl	_i2c_writel
Lloh23:
	adrp	x8, _STATE_IDLE@GOTPAGE
Lloh24:
	ldr	x8, [x8, _STATE_IDLE@GOTPAGEOFF]
Lloh25:
	ldr	w8, [x8]
	str	w8, [x21, #20]
Lloh26:
	adrp	x8, _ETIMEDOUT@GOTPAGE
Lloh27:
	ldr	x8, [x8, _ETIMEDOUT@GOTPAGEOFF]
Lloh28:
	ldr	w8, [x8]
	neg	w23, w8
LBB0_12:
	ldr	w0, [x21, #16]
	bl	_clk_disable
	ldr	w0, [x21, #12]
	bl	_clk_disable
	mov	x0, x20
	bl	_spin_unlock_irqrestore
	cmp	w23, #0
	csel	w0, w23, w19, lt
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"rk3x_i2c_setup() failed\n"

	.comm	_WAIT_TIMEOUT,4,2               ; @WAIT_TIMEOUT
l_.str.1:                               ; @.str.1
	.asciz	"timeout, ipd: 0x%02x, state: %d\n"

	.comm	_REG_IPD,4,2                    ; @REG_IPD
	.comm	_REG_IEN,4,2                    ; @REG_IEN
	.comm	_REG_CON,4,2                    ; @REG_CON
	.comm	_REG_CON_TUNING_MASK,4,2        ; @REG_CON_TUNING_MASK
	.comm	_REG_CON_EN,4,2                 ; @REG_CON_EN
	.comm	_REG_CON_STOP,4,2               ; @REG_CON_STOP
	.comm	_STATE_IDLE,4,2                 ; @STATE_IDLE
	.comm	_ETIMEDOUT,4,2                  ; @ETIMEDOUT
	.no_dead_strip	_rk3x_i2c_xfer
.subsections_via_symbols
