	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function pwm_setup_backlight
_pwm_setup_backlight:                   ## @pwm_setup_backlight
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movq	40(%rdi), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	callq	_pwm_get
	movq	%rax, 24(%r14)
	movq	%rax, %rdi
	callq	_IS_ERR
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	leaq	L_.str.1(%rip), %rdi
	callq	_DRM_ERROR
	movq	$0, 24(%r14)
	movq	_ENODEV@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_5
LBB0_2:
	movq	24(%r14), %rdi
	callq	_pwm_apply_args
	movq	24(%r14), %rdi
	movq	_CRC_PMIC_PWM_PERIOD_NS@GOTPCREL(%rip), %r15
	movl	(%r15), %edx
	movl	%edx, %esi
	callq	_pwm_config
	testl	%eax, %eax
	js	LBB0_3
## %bb.4:
	movq	$0, 32(%r14)
	movl	$100, (%r14)
	movq	24(%r14), %rdi
	callq	_pwm_get_duty_cycle
	imull	$100, %eax, %edi
	movl	(%r15), %esi
	callq	_DIV_ROUND_UP
	movq	%rax, 8(%r14)
	xorl	%ecx, %ecx
	testq	%rax, %rax
	setne	%cl
	movl	%ecx, 16(%r14)
	xorl	%ebx, %ebx
	jmp	LBB0_5
LBB0_3:
	movl	%eax, %ebx
	leaq	L_.str.2(%rip), %rdi
	callq	_DRM_ERROR
	movq	24(%r14), %rdi
	callq	_pwm_put
	movq	$0, 24(%r14)
LBB0_5:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"pwm_backlight"

L_.str.1:                               ## @.str.1
	.asciz	"Failed to own the pwm chip\n"

	.comm	_ENODEV,4,2                     ## @ENODEV
	.comm	_CRC_PMIC_PWM_PERIOD_NS,4,2     ## @CRC_PMIC_PWM_PERIOD_NS
L_.str.2:                               ## @.str.2
	.asciz	"Failed to configure the pwm chip\n"

	.no_dead_strip	_pwm_setup_backlight
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function pwm_setup_backlight
_pwm_setup_backlight:                   ; @pwm_setup_backlight
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x19, x0
	ldr	x8, [x0, #40]
	ldr	w0, [x8]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_pwm_get
	str	x0, [x19, #24]
	bl	_IS_ERR
	cbz	x0, LBB0_2
; %bb.1:
Lloh2:
	adrp	x0, l_.str.1@PAGE
Lloh3:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_DRM_ERROR
	str	xzr, [x19, #24]
Lloh4:
	adrp	x8, _ENODEV@GOTPAGE
Lloh5:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_5
LBB0_2:
	ldr	x0, [x19, #24]
	bl	_pwm_apply_args
	ldr	x0, [x19, #24]
Lloh7:
	adrp	x21, _CRC_PMIC_PWM_PERIOD_NS@GOTPAGE
Lloh8:
	ldr	x21, [x21, _CRC_PMIC_PWM_PERIOD_NS@GOTPAGEOFF]
	ldr	w1, [x21]
	mov	x2, x1
	bl	_pwm_config
	tbnz	w0, #31, LBB0_4
; %bb.3:
	str	xzr, [x19, #32]
	mov	w20, #100
	str	w20, [x19]
	ldr	x0, [x19, #24]
	bl	_pwm_get_duty_cycle
	mul	w0, w0, w20
	ldr	w1, [x21]
	bl	_DIV_ROUND_UP
	mov	w20, #0
	str	x0, [x19, #8]
	cmp	x0, #0
	cset	w8, ne
	str	w8, [x19, #16]
	b	LBB0_5
LBB0_4:
	mov	x20, x0
Lloh9:
	adrp	x0, l_.str.2@PAGE
Lloh10:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_DRM_ERROR
	ldr	x0, [x19, #24]
	bl	_pwm_put
	str	xzr, [x19, #24]
LBB0_5:
	mov	x0, x20
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"pwm_backlight"

l_.str.1:                               ; @.str.1
	.asciz	"Failed to own the pwm chip\n"

	.comm	_ENODEV,4,2                     ; @ENODEV
	.comm	_CRC_PMIC_PWM_PERIOD_NS,4,2     ; @CRC_PMIC_PWM_PERIOD_NS
l_.str.2:                               ; @.str.2
	.asciz	"Failed to configure the pwm chip\n"

	.no_dead_strip	_pwm_setup_backlight
.subsections_via_symbols
