	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function csi2_phy_config
_csi2_phy_config:                       ## @csi2_phy_config
	.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	%r13
	pushq	%r12
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movslq	(%rdi), %rax
	imulq	$1125899907, %rax, %rbx         ## imm = 0x431BDE83
	movq	%rbx, %rax
	shrq	$63, %rax
	sarq	$51, %rbx
	addl	%eax, %ebx
	movl	$1000000, %eax                  ## imm = 0xF4240
	xorl	%edx, %edx
	divl	%ebx
	movl	%eax, %r15d
	leaq	L_.str(%rip), %rdx
	movl	$1, %edi
	movq	%r14, %rsi
	movl	%eax, %ecx
	xorl	%eax, %eax
	callq	_ctx_dbg
	movl	$20000, %eax                    ## imm = 0x4E20
	xorl	%edx, %edx
	divl	%r15d
                                        ## kill: def $eax killed $eax def $rax
	leal	-2(%rax), %r13d
	cmpl	$100, %ebx
	cmovbl	%eax, %r13d
	leaq	L_.str.1(%rip), %rdx
	movl	$1, %edi
	movq	%r14, %rsi
	movl	%r13d, %ecx
	movl	%r13d, %r8d
	xorl	%eax, %eax
	callq	_ctx_dbg
	movq	_THS_SETTLE@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	leaq	L_.str.2(%rip), %rdx
	movl	$1, %edi
	movq	%r14, %rsi
	movl	%r15d, %ecx
	movl	%r15d, %r8d
	xorl	%eax, %eax
	callq	_ctx_dbg
	movl	8(%r14), %edi
	movq	_CAL_CSI2_PHY_REG0@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	callq	_reg_read
	movl	%eax, -48(%rbp)
	movq	_CAL_CSI2_PHY_REG0_HSCLOCKCONFIG_DISABLE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_CAL_CSI2_PHY_REG0_HSCLOCKCONFIG_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	leaq	-48(%rbp), %r12
	movq	%r12, %rdi
	callq	_set_field
	movq	_CAL_CSI2_PHY_REG0_THS_TERM_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r12, %rdi
	movl	%r13d, %esi
	callq	_set_field
	movq	_CAL_CSI2_PHY_REG0_THS_SETTLE_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r12, %rdi
	movl	%r15d, %esi
	callq	_set_field
	movl	4(%r14), %ecx
	decl	%ecx
	movl	-48(%rbp), %r8d
	leaq	L_.str.3(%rip), %rdx
	movl	$1, %edi
	movq	%r14, %rsi
	xorl	%eax, %eax
	callq	_ctx_dbg
	movl	8(%r14), %edi
	movl	(%rbx), %esi
	movl	-48(%rbp), %edx
	callq	_reg_write
	movl	8(%r14), %edi
	movq	_CAL_CSI2_PHY_REG1@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	callq	_reg_read
	movl	%eax, -44(%rbp)
	movq	_TCLK_TERM@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_CAL_CSI2_PHY_REG1_TCLK_TERM_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	leaq	-44(%rbp), %rbx
	movq	%rbx, %rdi
	callq	_set_field
	movq	_CAL_CSI2_PHY_REG1_DPHY_HS_SYNC_PATTERN_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	movl	$184, %esi
	callq	_set_field
	movq	_TCLK_MISS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_CAL_CSI2_PHY_REG1_CTRLCLK_DIV_FACTOR_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	callq	_set_field
	movq	_TCLK_SETTLE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_CAL_CSI2_PHY_REG1_TCLK_SETTLE_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	callq	_set_field
	movl	4(%r14), %ecx
	decl	%ecx
	movl	-44(%rbp), %r8d
	leaq	L_.str.4(%rip), %rdx
	movl	$1, %edi
	movq	%r14, %rsi
	xorl	%eax, %eax
	callq	_ctx_dbg
	movl	8(%r14), %edi
	movl	(%r15), %esi
	movl	-44(%rbp), %edx
	callq	_reg_write
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"ddrclkperiod_us: %d\n"

L_.str.1:                               ## @.str.1
	.asciz	"ths_term: %d (0x%02x)\n"

	.comm	_THS_SETTLE,4,2                 ## @THS_SETTLE
L_.str.2:                               ## @.str.2
	.asciz	"ths_settle: %d (0x%02x)\n"

	.comm	_CAL_CSI2_PHY_REG0,4,2          ## @CAL_CSI2_PHY_REG0
	.comm	_CAL_CSI2_PHY_REG0_HSCLOCKCONFIG_DISABLE,4,2 ## @CAL_CSI2_PHY_REG0_HSCLOCKCONFIG_DISABLE
	.comm	_CAL_CSI2_PHY_REG0_HSCLOCKCONFIG_MASK,4,2 ## @CAL_CSI2_PHY_REG0_HSCLOCKCONFIG_MASK
	.comm	_CAL_CSI2_PHY_REG0_THS_TERM_MASK,4,2 ## @CAL_CSI2_PHY_REG0_THS_TERM_MASK
	.comm	_CAL_CSI2_PHY_REG0_THS_SETTLE_MASK,4,2 ## @CAL_CSI2_PHY_REG0_THS_SETTLE_MASK
L_.str.3:                               ## @.str.3
	.asciz	"CSI2_%d_REG0 = 0x%08x\n"

	.comm	_CAL_CSI2_PHY_REG1,4,2          ## @CAL_CSI2_PHY_REG1
	.comm	_TCLK_TERM,4,2                  ## @TCLK_TERM
	.comm	_CAL_CSI2_PHY_REG1_TCLK_TERM_MASK,4,2 ## @CAL_CSI2_PHY_REG1_TCLK_TERM_MASK
	.comm	_CAL_CSI2_PHY_REG1_DPHY_HS_SYNC_PATTERN_MASK,4,2 ## @CAL_CSI2_PHY_REG1_DPHY_HS_SYNC_PATTERN_MASK
	.comm	_TCLK_MISS,4,2                  ## @TCLK_MISS
	.comm	_CAL_CSI2_PHY_REG1_CTRLCLK_DIV_FACTOR_MASK,4,2 ## @CAL_CSI2_PHY_REG1_CTRLCLK_DIV_FACTOR_MASK
	.comm	_TCLK_SETTLE,4,2                ## @TCLK_SETTLE
	.comm	_CAL_CSI2_PHY_REG1_TCLK_SETTLE_MASK,4,2 ## @CAL_CSI2_PHY_REG1_TCLK_SETTLE_MASK
L_.str.4:                               ## @.str.4
	.asciz	"CSI2_%d_REG1 = 0x%08x\n"

	.no_dead_strip	_csi2_phy_config
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function csi2_phy_config
_csi2_phy_config:                       ; @csi2_phy_config
	.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	x19, x0
	ldrsw	x8, [x0]
	mov	w9, #56963
	movk	w9, #17179, lsl #16
	mul	x8, x8, x9
	lsr	x9, x8, #63
	asr	x8, x8, #51
	add	w21, w8, w9
	mov	w8, #16960
	movk	w8, #15, lsl #16
	udiv	w20, w8, w21
Lloh0:
	adrp	x2, l_.str@PAGE
Lloh1:
	add	x2, x2, l_.str@PAGEOFF
	mov	w0, #1
	mov	x1, x19
	mov	x3, x20
	bl	_ctx_dbg
	mov	w8, #20000
	udiv	w8, w8, w20
	sub	w9, w8, #2
	cmp	w21, #99
	csel	w20, w9, w8, hi
	str	x20, [sp]
Lloh2:
	adrp	x2, l_.str.1@PAGE
Lloh3:
	add	x2, x2, l_.str.1@PAGEOFF
	mov	w0, #1
	mov	x1, x19
	mov	x3, x20
	bl	_ctx_dbg
Lloh4:
	adrp	x8, _THS_SETTLE@GOTPAGE
Lloh5:
	ldr	x8, [x8, _THS_SETTLE@GOTPAGEOFF]
Lloh6:
	ldr	w21, [x8]
	str	x21, [sp]
Lloh7:
	adrp	x2, l_.str.2@PAGE
Lloh8:
	add	x2, x2, l_.str.2@PAGEOFF
	mov	w0, #1
	mov	x1, x19
	mov	x3, x21
	bl	_ctx_dbg
	ldr	w0, [x19, #8]
Lloh9:
	adrp	x22, _CAL_CSI2_PHY_REG0@GOTPAGE
Lloh10:
	ldr	x22, [x22, _CAL_CSI2_PHY_REG0@GOTPAGEOFF]
	ldr	w1, [x22]
	bl	_reg_read
	str	w0, [sp, #12]
Lloh11:
	adrp	x8, _CAL_CSI2_PHY_REG0_HSCLOCKCONFIG_DISABLE@GOTPAGE
Lloh12:
	ldr	x8, [x8, _CAL_CSI2_PHY_REG0_HSCLOCKCONFIG_DISABLE@GOTPAGEOFF]
Lloh13:
	ldr	w1, [x8]
Lloh14:
	adrp	x8, _CAL_CSI2_PHY_REG0_HSCLOCKCONFIG_MASK@GOTPAGE
Lloh15:
	ldr	x8, [x8, _CAL_CSI2_PHY_REG0_HSCLOCKCONFIG_MASK@GOTPAGEOFF]
Lloh16:
	ldr	w2, [x8]
	add	x0, sp, #12
	bl	_set_field
Lloh17:
	adrp	x8, _CAL_CSI2_PHY_REG0_THS_TERM_MASK@GOTPAGE
Lloh18:
	ldr	x8, [x8, _CAL_CSI2_PHY_REG0_THS_TERM_MASK@GOTPAGEOFF]
Lloh19:
	ldr	w2, [x8]
	add	x0, sp, #12
	mov	x1, x20
	bl	_set_field
Lloh20:
	adrp	x8, _CAL_CSI2_PHY_REG0_THS_SETTLE_MASK@GOTPAGE
Lloh21:
	ldr	x8, [x8, _CAL_CSI2_PHY_REG0_THS_SETTLE_MASK@GOTPAGEOFF]
Lloh22:
	ldr	w2, [x8]
	add	x0, sp, #12
	mov	x1, x21
	bl	_set_field
	ldr	w8, [x19, #4]
	sub	w3, w8, #1
	ldr	w8, [sp, #12]
	str	x8, [sp]
Lloh23:
	adrp	x2, l_.str.3@PAGE
Lloh24:
	add	x2, x2, l_.str.3@PAGEOFF
	mov	w0, #1
	mov	x1, x19
	bl	_ctx_dbg
	ldr	w0, [x19, #8]
	ldr	w1, [x22]
	ldr	w2, [sp, #12]
	bl	_reg_write
	ldr	w0, [x19, #8]
Lloh25:
	adrp	x20, _CAL_CSI2_PHY_REG1@GOTPAGE
Lloh26:
	ldr	x20, [x20, _CAL_CSI2_PHY_REG1@GOTPAGEOFF]
	ldr	w1, [x20]
	bl	_reg_read
	str	w0, [sp, #8]
Lloh27:
	adrp	x8, _TCLK_TERM@GOTPAGE
Lloh28:
	ldr	x8, [x8, _TCLK_TERM@GOTPAGEOFF]
Lloh29:
	ldr	w1, [x8]
Lloh30:
	adrp	x8, _CAL_CSI2_PHY_REG1_TCLK_TERM_MASK@GOTPAGE
Lloh31:
	ldr	x8, [x8, _CAL_CSI2_PHY_REG1_TCLK_TERM_MASK@GOTPAGEOFF]
Lloh32:
	ldr	w2, [x8]
	add	x0, sp, #8
	bl	_set_field
Lloh33:
	adrp	x8, _CAL_CSI2_PHY_REG1_DPHY_HS_SYNC_PATTERN_MASK@GOTPAGE
Lloh34:
	ldr	x8, [x8, _CAL_CSI2_PHY_REG1_DPHY_HS_SYNC_PATTERN_MASK@GOTPAGEOFF]
Lloh35:
	ldr	w2, [x8]
	add	x0, sp, #8
	mov	w1, #184
	bl	_set_field
Lloh36:
	adrp	x8, _TCLK_MISS@GOTPAGE
Lloh37:
	ldr	x8, [x8, _TCLK_MISS@GOTPAGEOFF]
Lloh38:
	ldr	w1, [x8]
Lloh39:
	adrp	x8, _CAL_CSI2_PHY_REG1_CTRLCLK_DIV_FACTOR_MASK@GOTPAGE
Lloh40:
	ldr	x8, [x8, _CAL_CSI2_PHY_REG1_CTRLCLK_DIV_FACTOR_MASK@GOTPAGEOFF]
Lloh41:
	ldr	w2, [x8]
	add	x0, sp, #8
	bl	_set_field
Lloh42:
	adrp	x8, _TCLK_SETTLE@GOTPAGE
Lloh43:
	ldr	x8, [x8, _TCLK_SETTLE@GOTPAGEOFF]
Lloh44:
	ldr	w1, [x8]
Lloh45:
	adrp	x8, _CAL_CSI2_PHY_REG1_TCLK_SETTLE_MASK@GOTPAGE
Lloh46:
	ldr	x8, [x8, _CAL_CSI2_PHY_REG1_TCLK_SETTLE_MASK@GOTPAGEOFF]
Lloh47:
	ldr	w2, [x8]
	add	x0, sp, #8
	bl	_set_field
	ldr	w8, [x19, #4]
	sub	w3, w8, #1
	ldr	w8, [sp, #8]
	str	x8, [sp]
Lloh48:
	adrp	x2, l_.str.4@PAGE
Lloh49:
	add	x2, x2, l_.str.4@PAGEOFF
	mov	w0, #1
	mov	x1, x19
	bl	_ctx_dbg
	ldr	w0, [x19, #8]
	ldr	w1, [x20]
	ldr	w2, [sp, #8]
	bl	_reg_write
	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
	.loh AdrpAdd	Lloh48, Lloh49
	.loh AdrpLdrGotLdr	Lloh45, Lloh46, Lloh47
	.loh AdrpLdrGotLdr	Lloh42, Lloh43, Lloh44
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh41
	.loh AdrpLdrGotLdr	Lloh36, Lloh37, Lloh38
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"ddrclkperiod_us: %d\n"

l_.str.1:                               ; @.str.1
	.asciz	"ths_term: %d (0x%02x)\n"

	.comm	_THS_SETTLE,4,2                 ; @THS_SETTLE
l_.str.2:                               ; @.str.2
	.asciz	"ths_settle: %d (0x%02x)\n"

	.comm	_CAL_CSI2_PHY_REG0,4,2          ; @CAL_CSI2_PHY_REG0
	.comm	_CAL_CSI2_PHY_REG0_HSCLOCKCONFIG_DISABLE,4,2 ; @CAL_CSI2_PHY_REG0_HSCLOCKCONFIG_DISABLE
	.comm	_CAL_CSI2_PHY_REG0_HSCLOCKCONFIG_MASK,4,2 ; @CAL_CSI2_PHY_REG0_HSCLOCKCONFIG_MASK
	.comm	_CAL_CSI2_PHY_REG0_THS_TERM_MASK,4,2 ; @CAL_CSI2_PHY_REG0_THS_TERM_MASK
	.comm	_CAL_CSI2_PHY_REG0_THS_SETTLE_MASK,4,2 ; @CAL_CSI2_PHY_REG0_THS_SETTLE_MASK
l_.str.3:                               ; @.str.3
	.asciz	"CSI2_%d_REG0 = 0x%08x\n"

	.comm	_CAL_CSI2_PHY_REG1,4,2          ; @CAL_CSI2_PHY_REG1
	.comm	_TCLK_TERM,4,2                  ; @TCLK_TERM
	.comm	_CAL_CSI2_PHY_REG1_TCLK_TERM_MASK,4,2 ; @CAL_CSI2_PHY_REG1_TCLK_TERM_MASK
	.comm	_CAL_CSI2_PHY_REG1_DPHY_HS_SYNC_PATTERN_MASK,4,2 ; @CAL_CSI2_PHY_REG1_DPHY_HS_SYNC_PATTERN_MASK
	.comm	_TCLK_MISS,4,2                  ; @TCLK_MISS
	.comm	_CAL_CSI2_PHY_REG1_CTRLCLK_DIV_FACTOR_MASK,4,2 ; @CAL_CSI2_PHY_REG1_CTRLCLK_DIV_FACTOR_MASK
	.comm	_TCLK_SETTLE,4,2                ; @TCLK_SETTLE
	.comm	_CAL_CSI2_PHY_REG1_TCLK_SETTLE_MASK,4,2 ; @CAL_CSI2_PHY_REG1_TCLK_SETTLE_MASK
l_.str.4:                               ; @.str.4
	.asciz	"CSI2_%d_REG1 = 0x%08x\n"

	.no_dead_strip	_csi2_phy_config
.subsections_via_symbols
