	.file	"extr_clk-si570.c_si570_set_frequency.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	si570_set_frequency, @function
si570_set_frequency:
.LFB0:
	.cfi_startproc
	endbr64
	push	r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	push	rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	mov	rbx, rdi
	mov	rdi, rsi
	lea	rdx, 24[rbx]
	lea	r8, 4[rbx]
	mov	rcx, rbx
	mov	rsi, rbx
	sub	rsp, 8
	.cfi_def_cfa_offset 32
	call	si570_calc_divs@PLT
	mov	r12d, eax
	test	eax, eax
	jne	.L1
	mov	edi, DWORD PTR 8[rbx]
	mov	edx, DWORD PTR SI570_FREEZE_DCO[rip]
	mov	rsi, QWORD PTR SI570_REG_FREEZE_DCO[rip]
	call	regmap_write@PLT
	mov	eax, DWORD PTR [rbx]
	mov	ecx, DWORD PTR HS_DIV_SHIFT[rip]
	mov	edx, DWORD PTR 4[rbx]
	sub	edx, DWORD PTR HS_DIV_OFFSET[rip]
	sub	eax, 1
	sal	edx, cl
	mov	edi, DWORD PTR 8[rbx]
	mov	rsi, QWORD PTR SI570_REG_HS_N1[rip]
	sar	eax, 2
	and	eax, DWORD PTR N1_6_2_MASK[rip]
	add	rsi, QWORD PTR 16[rbx]
	or	edx, eax
	call	regmap_write@PLT
	mov	rdi, rbx
	call	si570_update_rfreq@PLT
	mov	edi, DWORD PTR 8[rbx]
	mov	rsi, QWORD PTR SI570_REG_FREEZE_DCO[rip]
	xor	edx, edx
	call	regmap_write@PLT
	mov	edi, DWORD PTR 8[rbx]
	mov	rsi, QWORD PTR SI570_REG_CONTROL[rip]
	mov	edx, DWORD PTR SI570_CNTRL_NEWFREQ[rip]
	call	regmap_write@PLT
	mov	esi, 12000
	mov	edi, 10000
	call	usleep_range@PLT
.L1:
	add	rsp, 8
	.cfi_def_cfa_offset 24
	mov	eax, r12d
	pop	rbx
	.cfi_def_cfa_offset 16
	pop	r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE0:
	.size	si570_set_frequency, .-si570_set_frequency
	.comm	SI570_REG_HS_N1,8,8
	.comm	SI570_REG_FREEZE_DCO,8,8
	.comm	SI570_REG_CONTROL,8,8
	.comm	SI570_FREEZE_DCO,4,4
	.comm	SI570_CNTRL_NEWFREQ,4,4
	.comm	N1_6_2_MASK,4,4
	.comm	HS_DIV_SHIFT,4,4
	.comm	HS_DIV_OFFSET,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_clk-si570.c_si570_set_frequency.c"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	si570_set_frequency, %function
si570_set_frequency:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, lr}
	mov	r4, r0
	add	r3, r0, #4
	sub	sp, sp, #8
	mov	r0, r1
	str	r3, [sp]
	mov	r1, r4
	mov	r3, r4
	add	r2, r4, #16
	bl	si570_calc_divs
	subs	r5, r0, #0
	bne	.L1
	ldr	r3, .L5
	ldr	r6, .L5+4
	ldr	r2, [r3]
	ldr	r1, [r6]
	ldr	r0, [r4, #8]
	bl	regmap_write
	ldr	r2, .L5+8
	ldr	r3, .L5+12
	ldr	ip, [r2]
	ldr	r1, [r4]
	ldr	r0, [r4, #4]
	ldr	r2, .L5+16
	ldr	r3, [r3]
	sub	r0, r0, ip
	ldr	r2, [r2]
	ldr	ip, .L5+20
	sub	r1, r1, #1
	and	r3, r3, r1, asr #2
	orr	r2, r3, r0, lsl r2
	ldr	r1, [ip]
	ldr	r3, [r4, #12]
	ldr	r0, [r4, #8]
	add	r1, r3, r1
	bl	regmap_write
	mov	r0, r4
	bl	si570_update_rfreq
	mov	r2, r5
	ldr	r1, [r6]
	ldr	r0, [r4, #8]
	bl	regmap_write
	ldr	r3, .L5+24
	ldr	r2, .L5+28
	ldr	r1, [r3]
	ldr	r0, [r4, #8]
	ldr	r2, [r2]
	bl	regmap_write
	ldr	r1, .L5+32
	ldr	r0, .L5+36
	bl	usleep_range
.L1:
	mov	r0, r5
	add	sp, sp, #8
	@ sp needed
	pop	{r4, r5, r6, pc}
.L6:
	.align	2
.L5:
	.word	SI570_FREEZE_DCO
	.word	SI570_REG_FREEZE_DCO
	.word	HS_DIV_OFFSET
	.word	N1_6_2_MASK
	.word	HS_DIV_SHIFT
	.word	SI570_REG_HS_N1
	.word	SI570_REG_CONTROL
	.word	SI570_CNTRL_NEWFREQ
	.word	12000
	.word	10000
	.size	si570_set_frequency, .-si570_set_frequency
	.comm	SI570_REG_HS_N1,4,4
	.comm	SI570_REG_FREEZE_DCO,4,4
	.comm	SI570_REG_CONTROL,4,4
	.comm	SI570_FREEZE_DCO,4,4
	.comm	SI570_CNTRL_NEWFREQ,4,4
	.comm	N1_6_2_MASK,4,4
	.comm	HS_DIV_SHIFT,4,4
	.comm	HS_DIV_OFFSET,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
