	.file	"extr_ad5398.c_ad5398_set_current_limit.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"changing current %duA\n"
	.text
	.p2align 4
	.type	ad5398_set_current_limit, @function
ad5398_set_current_limit:
.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, edx
	push	rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	mov	ebx, esi
	sub	rsp, 24
	.cfi_def_cfa_offset 64
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 8[rsp], rax
	xor	eax, eax
	call	rdev_get_drvdata@PLT
	mov	esi, DWORD PTR [rax]
	mov	r12, rax
	mov	eax, DWORD PTR 4[rax]
	cmp	ebx, eax
	cmovb	ebx, eax
	cmp	esi, ebp
	cmovb	ebp, esi
	cmp	esi, ebx
	jb	.L9
	cmp	eax, ebp
	jbe	.L4
.L9:
	mov	eax, DWORD PTR EINVAL[rip]
	neg	eax
.L1:
	mov	rcx, QWORD PTR 8[rsp]
	xor	rcx, QWORD PTR fs:40
	jne	.L11
	add	rsp, 24
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	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
	sub	ebx, eax
	imul	ebx, DWORD PTR 8[r12]
	sub	esi, eax
	mov	r13, QWORD PTR 24[r12]
	mov	edi, ebx
	call	DIV_ROUND_UP@PLT
	mov	rdi, r12
	mov	esi, eax
	mov	ebx, eax
	call	ad5398_calc_current@PLT
	cmp	eax, ebp
	jg	.L9
	mov	esi, ebx
	mov	rdi, r12
	call	ad5398_calc_current@PLT
	lea	rsi, .LC0[rip]
	mov	rdi, r13
	mov	edx, eax
	call	dev_dbg@PLT
	lea	rsi, 6[rsp]
	mov	rdi, r13
	call	ad5398_read_reg@PLT
	test	eax, eax
	js	.L1
	mov	ecx, DWORD PTR 12[r12]
	movzx	esi, WORD PTR 6[rsp]
	mov	rdi, r13
	and	si, WORD PTR AD5398_CURRENT_EN_MASK[rip]
	sal	ebx, cl
	and	ebx, DWORD PTR 16[r12]
	or	ebx, esi
	movzx	esi, bx
	mov	WORD PTR 6[rsp], bx
	call	ad5398_write_reg@PLT
	jmp	.L1
.L11:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	ad5398_set_current_limit, .-ad5398_set_current_limit
	.comm	EINVAL,4,4
	.comm	AD5398_CURRENT_EN_MASK,2,2
	.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_ad5398.c_ad5398_set_current_limit.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"changing current %duA\012\000"
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC1:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	ad5398_set_current_limit, %function
ad5398_set_current_limit:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, lr}
	ldr	r3, .L12
	sub	sp, sp, #12
	mov	r4, r1
	mov	r5, r2
	ldr	r3, [r3]
	str	r3, [sp, #4]
	mov	r3,#0
	bl	rdev_get_drvdata
	ldr	r1, [r0, #4]
	ldr	r3, [r0]
	cmp	r4, r1
	movcc	r4, r1
	cmp	r5, r3
	movcs	r5, r3
	cmp	r3, r4
	bcc	.L9
	cmp	r1, r5
	bls	.L4
.L9:
	ldr	r3, .L12+4
	ldr	r0, [r3]
	rsb	r0, r0, #0
.L1:
	ldr	r3, .L12
	ldr	r2, [r3]
	ldr	r3, [sp, #4]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L11
	add	sp, sp, #12
	@ sp needed
	pop	{r4, r5, r6, r7, pc}
.L4:
	mov	r6, r0
	ldr	r0, [r0, #8]
	sub	r4, r4, r1
	mul	r0, r4, r0
	sub	r1, r3, r1
	ldr	r7, [r6, #20]
	bl	DIV_ROUND_UP
	mov	r4, r0
	mov	r0, r6
	mov	r1, r4
	bl	ad5398_calc_current
	cmp	r0, r5
	bgt	.L9
	mov	r1, r4
	mov	r0, r6
	bl	ad5398_calc_current
	ldr	r1, .L12+8
	mov	r2, r0
	mov	r0, r7
	bl	dev_dbg
	mov	r0, r7
	add	r1, sp, #2
	bl	ad5398_read_reg
	cmp	r0, #0
	blt	.L1
	ldr	r3, .L12+12
	ldrh	r1, [sp, #2]
	ldrh	r2, [r3]
	ldr	r0, [r6, #16]
	ldr	r3, [r6, #12]
	and	r1, r1, r2
	and	r4, r0, r4, lsl r3
	orr	r1, r1, r4
	lsl	r1, r1, #16
	lsr	r1, r1, #16
	mov	r0, r7
	strh	r1, [sp, #2]	@ movhi
	bl	ad5398_write_reg
	b	.L1
.L11:
	bl	__stack_chk_fail
.L13:
	.align	2
.L12:
	.word	.LC1
	.word	EINVAL
	.word	.LC0
	.word	AD5398_CURRENT_EN_MASK
	.size	ad5398_set_current_limit, .-ad5398_set_current_limit
	.comm	EINVAL,4,4
	.comm	AD5398_CURRENT_EN_MASK,2,2
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
