	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cyapa_gen3_do_calibrate
_cyapa_gen3_do_calibrate:               ## @cyapa_gen3_do_calibrate
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, %r14
	movq	%rdi, %r15
	callq	_dev_get_drvdata
	movq	%rax, %r12
	movq	_CYAPA_CMD_DEV_STATUS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_cyapa_read_byte
	movl	%eax, %ebx
	testl	%eax, %eax
	js	LBB0_1
## %bb.3:
	movq	_CYAPA_DEV_NORMAL@GOTPCREL(%rip), %rcx
	movl	%ebx, %eax
	notl	%eax
	testl	%eax, (%rcx)
	jne	LBB0_4
## %bb.5:
	movq	_CYAPA_CMD_SOFT_RESET@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_OP_RECALIBRATION_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r12, %rdi
	callq	_cyapa_write_byte
	testl	%eax, %eax
	js	LBB0_6
## %bb.7:
	movq	_jiffies@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	movq	_HZ@GOTPCREL(%rip), %rcx
	movslq	(%rcx), %rcx
	leaq	(%rax,%rcx,2), %r13
	.p2align	4, 0x90
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	movl	$100, %edi
	callq	_msleep
	movq	_CYAPA_CMD_DEV_STATUS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_cyapa_read_byte
	movl	%eax, %ebx
	testl	%eax, %eax
	js	LBB0_1
## %bb.9:                               ##   in Loop: Header=BB0_8 Depth=1
	movl	%ebx, %eax
	notl	%eax
	movq	_CYAPA_DEV_NORMAL@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_10
## %bb.11:                              ##   in Loop: Header=BB0_8 Depth=1
	movq	%r13, %rdi
	callq	_time_is_after_jiffies
	testq	%rax, %rax
	jne	LBB0_8
## %bb.12:
	leaq	L_.str.4(%rip), %rsi
	xorl	%ebx, %ebx
	movq	%r15, %rdi
	xorl	%eax, %eax
	callq	_dev_err
	movq	_ETIMEDOUT@GOTPCREL(%rip), %rax
	jmp	LBB0_13
LBB0_1:
	leaq	L_.str(%rip), %rsi
	jmp	LBB0_2
LBB0_4:
	leaq	L_.str.1(%rip), %rsi
	movq	%r15, %rdi
	movl	%ebx, %edx
	callq	_dev_warn
	movq	_EAGAIN@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
LBB0_13:
	subl	(%rax), %ebx
	jmp	LBB0_14
LBB0_6:
	movl	%eax, %ebx
	leaq	L_.str.2(%rip), %rsi
LBB0_2:
	movq	%r15, %rdi
	movl	%ebx, %edx
	xorl	%eax, %eax
	callq	_dev_err
LBB0_14:
	testl	%ebx, %ebx
	cmovsl	%ebx, %r14d
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_10:
	leaq	L_.str.3(%rip), %rsi
	movq	%r15, %rdi
	callq	_dev_dbg
	jmp	LBB0_14
	.cfi_endproc
                                        ## -- End function
	.comm	_CYAPA_CMD_DEV_STATUS,4,2       ## @CYAPA_CMD_DEV_STATUS
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Error reading dev status: %d\n"

	.comm	_CYAPA_DEV_NORMAL,4,2           ## @CYAPA_DEV_NORMAL
L_.str.1:                               ## @.str.1
	.asciz	"Trackpad device is busy, device state: 0x%02x\n"

	.comm	_EAGAIN,4,2                     ## @EAGAIN
	.comm	_CYAPA_CMD_SOFT_RESET,4,2       ## @CYAPA_CMD_SOFT_RESET
	.comm	_OP_RECALIBRATION_MASK,4,2      ## @OP_RECALIBRATION_MASK
L_.str.2:                               ## @.str.2
	.asciz	"Failed to send calibrate command: %d\n"

	.comm	_jiffies,4,2                    ## @jiffies
	.comm	_HZ,4,2                         ## @HZ
L_.str.3:                               ## @.str.3
	.asciz	"Calibration successful.\n"

L_.str.4:                               ## @.str.4
	.asciz	"Failed to calibrate. Timeout.\n"

	.comm	_ETIMEDOUT,4,2                  ## @ETIMEDOUT
	.no_dead_strip	_cyapa_gen3_do_calibrate
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cyapa_gen3_do_calibrate
_cyapa_gen3_do_calibrate:               ; @cyapa_gen3_do_calibrate
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	mov	x19, x3
	mov	x20, x0
	bl	_dev_get_drvdata
	mov	x22, x0
Lloh0:
	adrp	x24, _CYAPA_CMD_DEV_STATUS@GOTPAGE
Lloh1:
	ldr	x24, [x24, _CYAPA_CMD_DEV_STATUS@GOTPAGEOFF]
	ldr	w1, [x24]
	bl	_cyapa_read_byte
	mov	x21, x0
	tbnz	w0, #31, LBB0_8
; %bb.1:
Lloh2:
	adrp	x25, _CYAPA_DEV_NORMAL@GOTPAGE
Lloh3:
	ldr	x25, [x25, _CYAPA_DEV_NORMAL@GOTPAGEOFF]
	ldr	w8, [x25]
	bics	wzr, w8, w21
	b.ne	LBB0_10
; %bb.2:
Lloh4:
	adrp	x8, _CYAPA_CMD_SOFT_RESET@GOTPAGE
Lloh5:
	ldr	x8, [x8, _CYAPA_CMD_SOFT_RESET@GOTPAGEOFF]
Lloh6:
	ldr	w1, [x8]
Lloh7:
	adrp	x8, _OP_RECALIBRATION_MASK@GOTPAGE
Lloh8:
	ldr	x8, [x8, _OP_RECALIBRATION_MASK@GOTPAGEOFF]
Lloh9:
	ldr	w2, [x8]
	mov	x0, x22
	bl	_cyapa_write_byte
	tbnz	w0, #31, LBB0_12
; %bb.3:
Lloh10:
	adrp	x8, _jiffies@GOTPAGE
Lloh11:
	ldr	x8, [x8, _jiffies@GOTPAGEOFF]
Lloh12:
	ldrsw	x8, [x8]
Lloh13:
	adrp	x9, _HZ@GOTPAGE
Lloh14:
	ldr	x9, [x9, _HZ@GOTPAGEOFF]
Lloh15:
	ldrsw	x9, [x9]
	add	x23, x8, x9, lsl #1
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	mov	w0, #100
	bl	_msleep
	ldr	w1, [x24]
	mov	x0, x22
	bl	_cyapa_read_byte
	mov	x21, x0
	tbnz	w0, #31, LBB0_13
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	w8, [x25]
	bics	wzr, w8, w21
	b.eq	LBB0_14
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x0, x23
	bl	_time_is_after_jiffies
	cbnz	x0, LBB0_4
; %bb.7:
Lloh16:
	adrp	x1, l_.str.4@PAGE
Lloh17:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	x0, x20
	bl	_dev_err
Lloh18:
	adrp	x8, _ETIMEDOUT@GOTPAGE
Lloh19:
	ldr	x8, [x8, _ETIMEDOUT@GOTPAGEOFF]
	b	LBB0_11
LBB0_8:
	str	x21, [sp]
LBB0_9:
Lloh20:
	adrp	x1, l_.str@PAGE
Lloh21:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x20
	bl	_dev_err
	b	LBB0_15
LBB0_10:
Lloh22:
	adrp	x1, l_.str.1@PAGE
Lloh23:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x20
	mov	x2, x21
	bl	_dev_warn
Lloh24:
	adrp	x8, _EAGAIN@GOTPAGE
Lloh25:
	ldr	x8, [x8, _EAGAIN@GOTPAGEOFF]
LBB0_11:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_15
LBB0_12:
	mov	x21, x0
	str	x21, [sp]
Lloh26:
	adrp	x1, l_.str.2@PAGE
Lloh27:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x20
	bl	_dev_err
                                        ; kill: def $w21 killed $w21 killed $x21 def $x21
	b	LBB0_15
LBB0_13:
	mov	x8, x21
	str	x8, [sp]
	b	LBB0_9
LBB0_14:
Lloh28:
	adrp	x1, l_.str.3@PAGE
Lloh29:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x0, x20
	bl	_dev_dbg
LBB0_15:
	cmp	w21, #0
	csel	w0, w21, w19, lt
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpAdd	Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.comm	_CYAPA_CMD_DEV_STATUS,4,2       ; @CYAPA_CMD_DEV_STATUS
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Error reading dev status: %d\n"

	.comm	_CYAPA_DEV_NORMAL,4,2           ; @CYAPA_DEV_NORMAL
l_.str.1:                               ; @.str.1
	.asciz	"Trackpad device is busy, device state: 0x%02x\n"

	.comm	_EAGAIN,4,2                     ; @EAGAIN
	.comm	_CYAPA_CMD_SOFT_RESET,4,2       ; @CYAPA_CMD_SOFT_RESET
	.comm	_OP_RECALIBRATION_MASK,4,2      ; @OP_RECALIBRATION_MASK
l_.str.2:                               ; @.str.2
	.asciz	"Failed to send calibrate command: %d\n"

	.comm	_jiffies,4,2                    ; @jiffies
	.comm	_HZ,4,2                         ; @HZ
l_.str.3:                               ; @.str.3
	.asciz	"Calibration successful.\n"

l_.str.4:                               ; @.str.4
	.asciz	"Failed to calibrate. Timeout.\n"

	.comm	_ETIMEDOUT,4,2                  ; @ETIMEDOUT
	.no_dead_strip	_cyapa_gen3_do_calibrate
.subsections_via_symbols
