	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function spear_kbd_open
_spear_kbd_open:                        ## @spear_kbd_open
	.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
	callq	_input_get_drvdata
	movq	%rax, %rbx
	movq	_KEY_RESERVED@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 20(%rbx)
	movl	16(%rbx), %edi
	callq	_clk_enable
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_2
## %bb.1:
	movl	16(%rbx), %edi
	callq	_clk_get_rate
	cltq
	imulq	$1125899907, %rax, %rax         ## imm = 0x431BDE83
	movq	%rax, %rcx
	sarq	$50, %rcx
	shrq	$63, %rax
	addl	%ecx, %eax
	decl	%eax
	movq	_MODE_CTL_PCLK_FREQ_MSK@GOTPCREL(%rip), %rcx
	andl	(%rcx), %eax
	movq	_MODE_CTL_PCLK_FREQ_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	shll	%cl, %eax
	movq	_MODE_CTL_SCAN_RATE_80@GOTPCREL(%rip), %rdx
	movq	_MODE_CTL_KEYBOARD@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movq	_MODE_CTL_KEYNUM_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	movl	(%rbx), %edi
	shll	%cl, %edi
	orl	(%rdx), %esi
	orl	%esi, %edi
	orl	%eax, %edi
	movq	_MODE_CTL_REG@GOTPCREL(%rip), %r15
	movq	(%r15), %rsi
	addq	8(%rbx), %rsi
	callq	_writel_relaxed
	movq	_STATUS_REG@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%rbx), %rsi
	movl	$1, %edi
	callq	_writel_relaxed
	movq	(%r15), %rdi
	addq	8(%rbx), %rdi
	callq	_readl_relaxed
	movq	_MODE_CTL_START_SCAN@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movq	(%r15), %rsi
	addq	8(%rbx), %rsi
	movl	%eax, %edi
	callq	_writel_relaxed
LBB0_2:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_KEY_RESERVED,4,2               ## @KEY_RESERVED
	.comm	_MODE_CTL_PCLK_FREQ_MSK,4,2     ## @MODE_CTL_PCLK_FREQ_MSK
	.comm	_MODE_CTL_PCLK_FREQ_SHIFT,4,2   ## @MODE_CTL_PCLK_FREQ_SHIFT
	.comm	_MODE_CTL_SCAN_RATE_80,4,2      ## @MODE_CTL_SCAN_RATE_80
	.comm	_MODE_CTL_KEYBOARD,4,2          ## @MODE_CTL_KEYBOARD
	.comm	_MODE_CTL_KEYNUM_SHIFT,4,2      ## @MODE_CTL_KEYNUM_SHIFT
	.comm	_MODE_CTL_REG,8,3               ## @MODE_CTL_REG
	.comm	_STATUS_REG,8,3                 ## @STATUS_REG
	.comm	_MODE_CTL_START_SCAN,4,2        ## @MODE_CTL_START_SCAN
	.no_dead_strip	_spear_kbd_open
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function spear_kbd_open
_spear_kbd_open:                        ; @spear_kbd_open
	.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
	bl	_input_get_drvdata
	mov	x19, x0
Lloh0:
	adrp	x8, _KEY_RESERVED@GOTPAGE
Lloh1:
	ldr	x8, [x8, _KEY_RESERVED@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	str	w8, [x0, #20]
	ldr	w0, [x0, #16]
	bl	_clk_enable
	mov	x20, x0
	cbnz	w0, LBB0_2
; %bb.1:
	ldr	w0, [x19, #16]
	bl	_clk_get_rate
	mov	w8, #56963
	movk	w8, #17179, lsl #16
	smull	x8, w0, w8
	lsr	x9, x8, #63
	asr	x8, x8, #50
	add	w8, w8, w9
	sub	w8, w8, #1
Lloh3:
	adrp	x9, _MODE_CTL_PCLK_FREQ_MSK@GOTPAGE
Lloh4:
	ldr	x9, [x9, _MODE_CTL_PCLK_FREQ_MSK@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	and	w8, w8, w9
Lloh6:
	adrp	x9, _MODE_CTL_PCLK_FREQ_SHIFT@GOTPAGE
Lloh7:
	ldr	x9, [x9, _MODE_CTL_PCLK_FREQ_SHIFT@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
Lloh9:
	adrp	x10, _MODE_CTL_SCAN_RATE_80@GOTPAGE
Lloh10:
	ldr	x10, [x10, _MODE_CTL_SCAN_RATE_80@GOTPAGEOFF]
	lsl	w8, w8, w9
Lloh11:
	ldr	w9, [x10]
Lloh12:
	adrp	x10, _MODE_CTL_KEYBOARD@GOTPAGE
Lloh13:
	ldr	x10, [x10, _MODE_CTL_KEYBOARD@GOTPAGEOFF]
Lloh14:
	ldr	w10, [x10]
	orr	w9, w10, w9
	orr	w8, w9, w8
	ldr	w9, [x19]
Lloh15:
	adrp	x10, _MODE_CTL_KEYNUM_SHIFT@GOTPAGE
Lloh16:
	ldr	x10, [x10, _MODE_CTL_KEYNUM_SHIFT@GOTPAGEOFF]
Lloh17:
	ldr	w10, [x10]
	lsl	w9, w9, w10
	orr	w0, w8, w9
	ldr	x8, [x19, #8]
Lloh18:
	adrp	x21, _MODE_CTL_REG@GOTPAGE
Lloh19:
	ldr	x21, [x21, _MODE_CTL_REG@GOTPAGEOFF]
	ldr	x9, [x21]
	add	x1, x9, x8
	bl	_writel_relaxed
	ldr	x8, [x19, #8]
Lloh20:
	adrp	x9, _STATUS_REG@GOTPAGE
Lloh21:
	ldr	x9, [x9, _STATUS_REG@GOTPAGEOFF]
Lloh22:
	ldr	x9, [x9]
	add	x1, x9, x8
	mov	w0, #1
	bl	_writel_relaxed
	ldr	x8, [x19, #8]
	ldr	x9, [x21]
	add	x0, x9, x8
	bl	_readl_relaxed
Lloh23:
	adrp	x8, _MODE_CTL_START_SCAN@GOTPAGE
Lloh24:
	ldr	x8, [x8, _MODE_CTL_START_SCAN@GOTPAGEOFF]
Lloh25:
	ldr	w8, [x8]
	orr	w0, w8, w0
	ldr	x8, [x19, #8]
	ldr	x9, [x21]
	add	x1, x9, x8
	bl	_writel_relaxed
LBB0_2:
	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 AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_KEY_RESERVED,4,2               ; @KEY_RESERVED
	.comm	_MODE_CTL_PCLK_FREQ_MSK,4,2     ; @MODE_CTL_PCLK_FREQ_MSK
	.comm	_MODE_CTL_PCLK_FREQ_SHIFT,4,2   ; @MODE_CTL_PCLK_FREQ_SHIFT
	.comm	_MODE_CTL_SCAN_RATE_80,4,2      ; @MODE_CTL_SCAN_RATE_80
	.comm	_MODE_CTL_KEYBOARD,4,2          ; @MODE_CTL_KEYBOARD
	.comm	_MODE_CTL_KEYNUM_SHIFT,4,2      ; @MODE_CTL_KEYNUM_SHIFT
	.comm	_MODE_CTL_REG,8,3               ; @MODE_CTL_REG
	.comm	_STATUS_REG,8,3                 ; @STATUS_REG
	.comm	_MODE_CTL_START_SCAN,4,2        ; @MODE_CTL_START_SCAN
	.no_dead_strip	_spear_kbd_open
.subsections_via_symbols
