	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function repaper_pipe_enable
_repaper_pipe_enable:                   ## @repaper_pipe_enable
	.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, %rbx
	movl	(%rdi), %edi
	callq	_drm_to_epd
	movq	%rax, %r15
	movq	48(%rax), %r14
	movl	(%rbx), %edi
	leaq	-28(%rbp), %rsi
	callq	_drm_dev_enter
	testl	%eax, %eax
	je	LBB0_28
## %bb.1:
	leaq	L_.str(%rip), %rdi
	callq	_DRM_DEBUG_DRIVER
	movq	16(%r15), %rdi
	xorl	%esi, %esi
	callq	_gpiod_set_value_cansleep
	movq	32(%r15), %rdi
	xorl	%esi, %esi
	callq	_gpiod_set_value_cansleep
	movq	40(%r15), %rdi
	xorl	%esi, %esi
	callq	_gpiod_set_value_cansleep
	movq	24(%r15), %rdi
	testq	%rdi, %rdi
	je	LBB0_3
## %bb.2:
	xorl	%esi, %esi
	callq	_gpiod_set_value_cansleep
LBB0_3:
	movq	%r14, %rdi
	callq	_repaper_spi_mosi_low
	movl	$5000, %edi                     ## imm = 0x1388
	movl	$10000, %esi                    ## imm = 0x2710
	callq	_usleep_range
	movq	32(%r15), %rdi
	movl	$1, %esi
	callq	_gpiod_set_value_cansleep
	movl	$10000, %edi                    ## imm = 0x2710
	movl	$15000, %esi                    ## imm = 0x3A98
	callq	_usleep_range
	movq	16(%r15), %rdi
	movl	$1, %esi
	callq	_gpiod_set_value_cansleep
	movq	24(%r15), %rdi
	testq	%rdi, %rdi
	je	LBB0_5
## %bb.4:
	movl	$1, %esi
	callq	_gpiod_set_value_cansleep
LBB0_5:
	movl	$5000, %edi                     ## imm = 0x1388
	movl	$10000, %esi                    ## imm = 0x2710
	callq	_usleep_range
	movq	16(%r15), %rdi
	xorl	%esi, %esi
	callq	_gpiod_set_value_cansleep
	movl	$5000, %edi                     ## imm = 0x1388
	movl	$10000, %esi                    ## imm = 0x2710
	callq	_usleep_range
	movq	16(%r15), %rdi
	movl	$1, %esi
	callq	_gpiod_set_value_cansleep
	movl	$5000, %edi                     ## imm = 0x1388
	movl	$10000, %esi                    ## imm = 0x2710
	callq	_usleep_range
	movl	$101, %ebx
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movl	12(%r15), %edi
	callq	_gpiod_get_value_cansleep
	testl	%eax, %eax
	je	LBB0_9
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	movl	$10, %edi
	movl	$100, %esi
	callq	_usleep_range
	decl	%ebx
	cmpl	$1, %ebx
	ja	LBB0_6
## %bb.8:
	leaq	L_.str.1(%rip), %rsi
LBB0_15:
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_DRM_DEV_ERROR
	jmp	LBB0_16
LBB0_9:
	movq	%r14, %rdi
	callq	_repaper_read_id
	movq	%r14, %rdi
	callq	_repaper_read_id
	movq	_REPAPER_RID_G2_COG_ID@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_10
## %bb.11:
	movq	%r14, %rdi
	movl	$2, %esi
	movl	$64, %edx
	callq	_repaper_write_val
	movq	%r14, %rdi
	movl	$15, %esi
	callq	_repaper_read_val
	movl	%eax, %ecx
	andl	$-2147483520, %ecx              ## imm = 0x80000080
	cmpl	$128, %ecx
	jne	LBB0_12
## %bb.17:
	movq	%r14, %rdi
	movl	$11, %esi
	movl	$2, %edx
	callq	_repaper_write_val
	movl	8(%r15), %edx
	movq	%r14, %rdi
	movl	$1, %esi
	movl	$8, %ecx
	callq	_repaper_write_buf
	movq	%r14, %rdi
	movl	$7, %esi
	movl	$209, %edx
	callq	_repaper_write_val
	movq	%r14, %rdi
	movl	$8, %esi
	movl	$2, %edx
	callq	_repaper_write_val
	movq	%r14, %rdi
	movl	$9, %esi
	movl	$194, %edx
	callq	_repaper_write_val
	movq	%r14, %rdi
	movl	$4, %esi
	movl	$3, %edx
	callq	_repaper_write_val
	movq	%r14, %rdi
	movl	$3, %esi
	movl	$1, %edx
	callq	_repaper_write_val
	movq	%r14, %rdi
	movl	$3, %esi
	xorl	%edx, %edx
	callq	_repaper_write_val
	movl	$5000, %edi                     ## imm = 0x1388
	movl	$10000, %esi                    ## imm = 0x2710
	callq	_usleep_range
	movq	%r14, %rdi
	movl	$5, %esi
	movl	$1, %edx
	callq	_repaper_write_val
	movl	$240, %edi
	callq	_msleep
	movq	%r14, %rdi
	movl	$5, %esi
	movl	$3, %edx
	callq	_repaper_write_val
	movl	$40, %edi
	callq	_msleep
	movq	%r14, %rdi
	movl	$5, %esi
	movl	$15, %edx
	callq	_repaper_write_val
	movl	$40, %edi
	callq	_msleep
	movq	%r14, %rdi
	movl	$15, %esi
	callq	_repaper_read_val
	testl	%eax, %eax
	js	LBB0_13
## %bb.18:
	testb	$64, %al
	jne	LBB0_26
## %bb.19:
	movq	%r14, %rdi
	movl	$5, %esi
	movl	$1, %edx
	callq	_repaper_write_val
	movl	$240, %edi
	callq	_msleep
	movq	%r14, %rdi
	movl	$5, %esi
	movl	$3, %edx
	callq	_repaper_write_val
	movl	$40, %edi
	callq	_msleep
	movq	%r14, %rdi
	movl	$5, %esi
	movl	$15, %edx
	callq	_repaper_write_val
	movl	$40, %edi
	callq	_msleep
	movq	%r14, %rdi
	movl	$15, %esi
	callq	_repaper_read_val
	testl	%eax, %eax
	js	LBB0_13
## %bb.20:
	testb	$64, %al
	jne	LBB0_26
## %bb.21:
	movq	%r14, %rdi
	movl	$5, %esi
	movl	$1, %edx
	callq	_repaper_write_val
	movl	$240, %edi
	callq	_msleep
	movq	%r14, %rdi
	movl	$5, %esi
	movl	$3, %edx
	callq	_repaper_write_val
	movl	$40, %edi
	callq	_msleep
	movq	%r14, %rdi
	movl	$5, %esi
	movl	$15, %edx
	callq	_repaper_write_val
	movl	$40, %edi
	callq	_msleep
	movq	%r14, %rdi
	movl	$15, %esi
	callq	_repaper_read_val
	testl	%eax, %eax
	js	LBB0_13
## %bb.22:
	testb	$64, %al
	jne	LBB0_26
## %bb.23:
	movq	%r14, %rdi
	movl	$5, %esi
	movl	$1, %edx
	callq	_repaper_write_val
	movl	$240, %edi
	callq	_msleep
	movq	%r14, %rdi
	movl	$5, %esi
	movl	$3, %edx
	callq	_repaper_write_val
	movl	$40, %edi
	callq	_msleep
	movq	%r14, %rdi
	movl	$5, %esi
	movl	$15, %edx
	callq	_repaper_write_val
	movl	$40, %edi
	callq	_msleep
	movq	%r14, %rdi
	movl	$15, %esi
	callq	_repaper_read_val
	testl	%eax, %eax
	js	LBB0_13
## %bb.24:
	testb	$64, %al
	jne	LBB0_26
## %bb.25:
	leaq	L_.str.5(%rip), %rsi
	jmp	LBB0_15
LBB0_10:
	testl	%eax, %eax
	leaq	L_.str.2(%rip), %rcx
	leaq	L_.str.3(%rip), %rsi
	cmovsq	%rcx, %rsi
	movq	%r14, %rdi
	movl	%eax, %edx
	callq	_dev_err
	jmp	LBB0_16
LBB0_12:
	testl	%eax, %eax
	js	LBB0_13
## %bb.14:
	leaq	L_.str.4(%rip), %rsi
	jmp	LBB0_15
LBB0_13:
	leaq	L_.str.2(%rip), %rsi
	movq	%r14, %rdi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_DRM_DEV_ERROR
LBB0_16:
	movq	%r15, %rdi
	callq	_power_off
LBB0_27:
	movl	-28(%rbp), %edi
	callq	_drm_dev_exit
LBB0_28:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_26:
	movq	%r14, %rdi
	movl	$2, %esi
	movl	$4, %edx
	callq	_repaper_write_val
	movq	$1, (%r15)
	jmp	LBB0_27
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"\n"

L_.str.1:                               ## @.str.1
	.asciz	"timeout waiting for panel to become ready.\n"

	.comm	_REPAPER_RID_G2_COG_ID,4,2      ## @REPAPER_RID_G2_COG_ID
L_.str.2:                               ## @.str.2
	.asciz	"failed to read chip (%d)\n"

L_.str.3:                               ## @.str.3
	.asciz	"wrong COG ID 0x%02x\n"

L_.str.4:                               ## @.str.4
	.asciz	"panel is reported broken\n"

L_.str.5:                               ## @.str.5
	.asciz	"dc/dc failed\n"

	.no_dead_strip	_repaper_pipe_enable
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal8,8byte_literals
	.p2align	3                               ; -- Begin function repaper_pipe_enable
lCPI0_0:
	.long	1                               ; 0x1
	.long	0                               ; 0x0
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	2
_repaper_pipe_enable:                   ; @repaper_pipe_enable
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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	x21, x0
	ldr	w0, [x0]
	bl	_drm_to_epd
	mov	x19, x0
	ldr	x20, [x0, #48]
	ldr	w0, [x21]
	add	x1, sp, #12
	bl	_drm_dev_enter
	cbz	w0, LBB0_24
; %bb.1:
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DRM_DEBUG_DRIVER
	ldr	x0, [x19, #16]
	mov	w1, #0
	bl	_gpiod_set_value_cansleep
	ldr	x0, [x19, #32]
	mov	w1, #0
	bl	_gpiod_set_value_cansleep
	ldr	x0, [x19, #40]
	mov	w1, #0
	bl	_gpiod_set_value_cansleep
	ldr	x0, [x19, #24]
	cbz	x0, LBB0_3
; %bb.2:
	mov	w1, #0
	bl	_gpiod_set_value_cansleep
LBB0_3:
	mov	x0, x20
	bl	_repaper_spi_mosi_low
	mov	w0, #5000
	mov	w1, #10000
	bl	_usleep_range
	ldr	x0, [x19, #32]
	mov	w1, #1
	bl	_gpiod_set_value_cansleep
	mov	w0, #10000
	mov	w1, #15000
	bl	_usleep_range
	ldr	x0, [x19, #16]
	mov	w1, #1
	bl	_gpiod_set_value_cansleep
	ldr	x0, [x19, #24]
	cbz	x0, LBB0_5
; %bb.4:
	mov	w1, #1
	bl	_gpiod_set_value_cansleep
LBB0_5:
	mov	w0, #5000
	mov	w1, #10000
	bl	_usleep_range
	ldr	x0, [x19, #16]
	mov	w1, #0
	bl	_gpiod_set_value_cansleep
	mov	w0, #5000
	mov	w1, #10000
	bl	_usleep_range
	ldr	x0, [x19, #16]
	mov	w1, #1
	bl	_gpiod_set_value_cansleep
	mov	w0, #5000
	mov	w1, #10000
	bl	_usleep_range
	mov	w21, #101
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x19, #12]
	bl	_gpiod_get_value_cansleep
	cbz	w0, LBB0_10
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	mov	w0, #10
	mov	w1, #100
	bl	_usleep_range
	sub	w21, w21, #1
	cmp	w21, #1
	b.hi	LBB0_6
; %bb.8:
Lloh2:
	adrp	x1, l_.str.1@PAGE
Lloh3:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_9:
	mov	x0, x20
	bl	_DRM_DEV_ERROR
	b	LBB0_22
LBB0_10:
	mov	x0, x20
	bl	_repaper_read_id
	mov	x0, x20
	bl	_repaper_read_id
Lloh4:
	adrp	x8, _REPAPER_RID_G2_COG_ID@GOTPAGE
Lloh5:
	ldr	x8, [x8, _REPAPER_RID_G2_COG_ID@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	cmp	w0, w8
	b.ne	LBB0_21
; %bb.11:
	mov	x0, x20
	mov	w1, #2
	mov	w2, #64
	bl	_repaper_write_val
	mov	x0, x20
	mov	w1, #15
	bl	_repaper_read_val
                                        ; kill: def $w0 killed $w0 def $x0
	and	w8, w0, #0xffffff80
	and	w8, w8, #0x800000ff
	cmp	w8, #128
	b.ne	LBB0_25
; %bb.12:
	mov	x0, x20
	mov	w1, #11
	mov	w2, #2
	bl	_repaper_write_val
	ldr	w2, [x19, #8]
	mov	x0, x20
	mov	w1, #1
	mov	w3, #8
	bl	_repaper_write_buf
	mov	x0, x20
	mov	w1, #7
	mov	w2, #209
	bl	_repaper_write_val
	mov	x0, x20
	mov	w1, #8
	mov	w2, #2
	bl	_repaper_write_val
	mov	x0, x20
	mov	w1, #9
	mov	w2, #194
	bl	_repaper_write_val
	mov	x0, x20
	mov	w1, #4
	mov	w2, #3
	bl	_repaper_write_val
	mov	x0, x20
	mov	w1, #3
	mov	w2, #1
	bl	_repaper_write_val
	mov	x0, x20
	mov	w1, #3
	mov	w2, #0
	bl	_repaper_write_val
	mov	w0, #5000
	mov	w1, #10000
	bl	_usleep_range
	mov	x0, x20
	mov	w1, #5
	mov	w2, #1
	bl	_repaper_write_val
	mov	w0, #240
	bl	_msleep
	mov	x0, x20
	mov	w1, #5
	mov	w2, #3
	bl	_repaper_write_val
	mov	w0, #40
	bl	_msleep
	mov	x0, x20
	mov	w1, #5
	mov	w2, #15
	bl	_repaper_write_val
	mov	w0, #40
	bl	_msleep
	mov	x0, x20
	mov	w1, #15
	bl	_repaper_read_val
                                        ; kill: def $w0 killed $w0 def $x0
	tbnz	w0, #31, LBB0_27
; %bb.13:
	tbnz	w0, #6, LBB0_28
; %bb.14:
	mov	x0, x20
	mov	w1, #5
	mov	w2, #1
	bl	_repaper_write_val
	mov	w0, #240
	bl	_msleep
	mov	x0, x20
	mov	w1, #5
	mov	w2, #3
	bl	_repaper_write_val
	mov	w0, #40
	bl	_msleep
	mov	x0, x20
	mov	w1, #5
	mov	w2, #15
	bl	_repaper_write_val
	mov	w0, #40
	bl	_msleep
	mov	x0, x20
	mov	w1, #15
	bl	_repaper_read_val
                                        ; kill: def $w0 killed $w0 def $x0
	tbnz	w0, #31, LBB0_27
; %bb.15:
	tbnz	w0, #6, LBB0_28
; %bb.16:
	mov	x0, x20
	mov	w1, #5
	mov	w2, #1
	bl	_repaper_write_val
	mov	w0, #240
	bl	_msleep
	mov	x0, x20
	mov	w1, #5
	mov	w2, #3
	bl	_repaper_write_val
	mov	w0, #40
	bl	_msleep
	mov	x0, x20
	mov	w1, #5
	mov	w2, #15
	bl	_repaper_write_val
	mov	w0, #40
	bl	_msleep
	mov	x0, x20
	mov	w1, #15
	bl	_repaper_read_val
                                        ; kill: def $w0 killed $w0 def $x0
	tbnz	w0, #31, LBB0_27
; %bb.17:
	tbnz	w0, #6, LBB0_28
; %bb.18:
	mov	x0, x20
	mov	w1, #5
	mov	w2, #1
	bl	_repaper_write_val
	mov	w0, #240
	bl	_msleep
	mov	x0, x20
	mov	w1, #5
	mov	w2, #3
	bl	_repaper_write_val
	mov	w0, #40
	bl	_msleep
	mov	x0, x20
	mov	w1, #5
	mov	w2, #15
	bl	_repaper_write_val
	mov	w0, #40
	bl	_msleep
	mov	x0, x20
	mov	w1, #15
	bl	_repaper_read_val
                                        ; kill: def $w0 killed $w0 def $x0
	tbnz	w0, #31, LBB0_27
; %bb.19:
	tbnz	w0, #6, LBB0_28
; %bb.20:
Lloh7:
	adrp	x1, l_.str.5@PAGE
Lloh8:
	add	x1, x1, l_.str.5@PAGEOFF
	b	LBB0_9
LBB0_21:
	mov	x2, x0
Lloh9:
	adrp	x8, l_.str.3@PAGE
Lloh10:
	add	x8, x8, l_.str.3@PAGEOFF
Lloh11:
	adrp	x9, l_.str.2@PAGE
Lloh12:
	add	x9, x9, l_.str.2@PAGEOFF
	cmp	w0, #0
	csel	x1, x9, x8, lt
	mov	x0, x20
	bl	_dev_err
LBB0_22:
	mov	x0, x19
	bl	_power_off
LBB0_23:
	ldr	w0, [sp, #12]
	bl	_drm_dev_exit
LBB0_24:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
LBB0_25:
	tbnz	w0, #31, LBB0_27
; %bb.26:
Lloh13:
	adrp	x1, l_.str.4@PAGE
Lloh14:
	add	x1, x1, l_.str.4@PAGEOFF
	b	LBB0_9
LBB0_27:
	str	x0, [sp]
Lloh15:
	adrp	x1, l_.str.2@PAGE
Lloh16:
	add	x1, x1, l_.str.2@PAGEOFF
	b	LBB0_9
LBB0_28:
	mov	x0, x20
	mov	w1, #2
	mov	w2, #4
	bl	_repaper_write_val
Lloh17:
	adrp	x8, lCPI0_0@PAGE
Lloh18:
	ldr	d0, [x8, lCPI0_0@PAGEOFF]
	str	d0, [x19]
	b	LBB0_23
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdr	Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"\n"

l_.str.1:                               ; @.str.1
	.asciz	"timeout waiting for panel to become ready.\n"

	.comm	_REPAPER_RID_G2_COG_ID,4,2      ; @REPAPER_RID_G2_COG_ID
l_.str.2:                               ; @.str.2
	.asciz	"failed to read chip (%d)\n"

l_.str.3:                               ; @.str.3
	.asciz	"wrong COG ID 0x%02x\n"

l_.str.4:                               ; @.str.4
	.asciz	"panel is reported broken\n"

l_.str.5:                               ; @.str.5
	.asciz	"dc/dc failed\n"

	.no_dead_strip	_repaper_pipe_enable
.subsections_via_symbols
