	.file	"extr_ad_sigma_delta.c_ad_sd_calibrate.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	ad_sd_calibrate, @function
ad_sd_calibrate:
.LFB0:
	.cfi_startproc
	endbr64
	push	r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	push	r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	push	rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	mov	ebp, esi
	mov	esi, edx
	push	rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	mov	rbx, rdi
	sub	rsp, 8
	.cfi_def_cfa_offset 48
	call	ad_sigma_delta_set_channel@PLT
	mov	r12d, eax
	test	eax, eax
	je	.L7
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	mov	eax, r12d
	pop	rbx
	.cfi_def_cfa_offset 32
	pop	rbp
	.cfi_def_cfa_offset 24
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L7:
	.cfi_restore_state
	mov	rax, QWORD PTR 16[rbx]
	lea	r13, 24[rbx]
	mov	edi, DWORD PTR [rax]
	call	spi_bus_lock@PLT
	mov	rdi, r13
	movabs	rax, 4294967297
	mov	QWORD PTR [rbx], rax
	call	reinit_completion@PLT
	mov	esi, ebp
	mov	rdi, rbx
	call	ad_sigma_delta_set_mode@PLT
	test	eax, eax
	js	.L4
	mov	rax, QWORD PTR 16[rbx]
	mov	DWORD PTR 8[rbx], 0
	mov	edi, DWORD PTR 4[rax]
	call	enable_irq@PLT
	mov	eax, DWORD PTR HZ[rip]
	mov	rdi, r13
	lea	esi, [rax+rax]
	call	wait_for_completion_timeout@PLT
	test	rax, rax
	je	.L8
.L3:
	mov	DWORD PTR 4[rbx], 0
	mov	esi, DWORD PTR AD_SD_MODE_IDLE[rip]
	mov	rdi, rbx
	call	ad_sigma_delta_set_mode@PLT
	mov	rax, QWORD PTR 16[rbx]
	mov	DWORD PTR [rbx], 0
	mov	edi, DWORD PTR [rax]
	call	spi_bus_unlock@PLT
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	mov	eax, r12d
	pop	rbx
	.cfi_def_cfa_offset 32
	pop	rbp
	.cfi_def_cfa_offset 24
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	.cfi_restore_state
	mov	r12d, eax
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L8:
	mov	rax, QWORD PTR 16[rbx]
	mov	DWORD PTR 8[rbx], 1
	mov	edi, DWORD PTR 4[rax]
	call	disable_irq_nosync@PLT
	mov	r12d, DWORD PTR EIO[rip]
	neg	r12d
	jmp	.L3
	.cfi_endproc
.LFE0:
	.size	ad_sd_calibrate, .-ad_sd_calibrate
	.comm	HZ,4,4
	.comm	EIO,4,4
	.comm	AD_SD_MODE_IDLE,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_ad_sigma_delta.c_ad_sd_calibrate.c"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	ad_sd_calibrate, %function
ad_sd_calibrate:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, lr}
	mov	r5, r1
	mov	r1, r2
	mov	r4, r0
	bl	ad_sigma_delta_set_channel
	subs	r6, r0, #0
	beq	.L7
	mov	r0, r6
	pop	{r4, r5, r6, r7, r8, pc}
.L7:
	mov	r7, #1
	ldr	r3, [r4, #12]
	add	r8, r4, #16
	ldr	r0, [r3]
	bl	spi_bus_lock
	mov	r0, r8
	str	r7, [r4]
	str	r7, [r4, #4]
	bl	reinit_completion
	mov	r1, r5
	mov	r0, r4
	bl	ad_sigma_delta_set_mode
	cmp	r0, #0
	movlt	r6, r0
	blt	.L3
	ldr	r3, [r4, #12]
	str	r6, [r4, #8]
	ldr	r0, [r3, #4]
	bl	enable_irq
	ldr	r3, .L9
	mov	r0, r8
	ldr	r1, [r3]
	lsl	r1, r1, r7
	bl	wait_for_completion_timeout
	cmp	r0, #0
	beq	.L8
.L3:
	mov	r5, #0
	ldr	r3, .L9+4
	mov	r0, r4
	ldr	r1, [r3]
	str	r5, [r4, #4]
	bl	ad_sigma_delta_set_mode
	ldr	r3, [r4, #12]
	str	r5, [r4]
	ldr	r0, [r3]
	bl	spi_bus_unlock
	mov	r0, r6
	pop	{r4, r5, r6, r7, r8, pc}
.L8:
	ldr	r3, [r4, #12]
	str	r7, [r4, #8]
	ldr	r0, [r3, #4]
	bl	disable_irq_nosync
	ldr	r3, .L9+8
	ldr	r0, [r3]
	rsb	r6, r0, #0
	b	.L3
.L10:
	.align	2
.L9:
	.word	HZ
	.word	AD_SD_MODE_IDLE
	.word	EIO
	.size	ad_sd_calibrate, .-ad_sd_calibrate
	.comm	HZ,4,4
	.comm	EIO,4,4
	.comm	AD_SD_MODE_IDLE,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
