# SPDX-License-Identifier: GPL-2.0-or-later
fw_config
	field FP 0
		option FP_ABSENT 0
		option FP_PRESENT 1
	end
end

chip soc/amd/mendocino

	# Set DPTC multi-profile common parameters

	# Refer the spec "FT6 Infrastructure Roadmap"#57316
	# Set system_configuration to 3 for 15W. Spec lists 4 for 15W,
	# however, setting to 3 will avoid an additional communication
	# with the SMU and save boot time.
	register "system_configuration" = "3"
	register "thermctl_limit_degreeC" = "97"

	register "stt_control" = "1"
	register "stt_pcb_sensor_count" = "2"
	register "stt_alpha_apu" = "0x6666"
	register "stt_error_coeff" = "0x38"
	register "stt_error_rate_coefficient" = "0xB44"

	# These registers are defined in AMD DevHub document #57316.
	# Normal
	register "vrm_current_limit_mA"                  = "28000"
	register "vrm_maximum_current_limit_mA"          = "50000"
	register "vrm_soc_current_limit_mA"              = "10000"
	# Throttle (e.g., Low/No Battery)
	register "vrm_current_limit_throttle_mA"         = "20000"
	register "vrm_maximum_current_limit_throttle_mA" = "20000"
	register "vrm_soc_current_limit_throttle_mA"     = "10000"

	# Set Dynamic DPTC thermal profile Table A (Default)
	register "fast_ppt_limit_mW" = "30000"
	register "slow_ppt_limit_mW" = "25000"
	register "slow_ppt_time_constant_s" = "5"

	register "stt_min_limit" = "15000"
	register "stt_m1" = "0xAE"
	register "stt_m2" = "0xB8F"
	register "stt_c_apu" = "0xC13B"
	register "stt_skin_temp_apu" = "0x3000"

	# Set Dynamic DPTC thermal profile confiuration. Table B
	register "fast_ppt_limit_mW_B" = "15000"
	register "slow_ppt_limit_mW_B" = "15000"
	register "slow_ppt_time_constant_s_B" = "5"

	register "stt_min_limit_B" = "10500"
	register "stt_m1_B" = "0xAE"
	register "stt_m2_B" = "0xB8F"
	register "stt_c_apu_B" = "0xC13B"
	register "stt_skin_temp_apu_B" = "0x3000"

	# Set Dynamic DPTC thermal profile confiuration. Table C
	register "fast_ppt_limit_mW_C" = "30000"
	register "slow_ppt_limit_mW_C" = "25000"
	register "slow_ppt_time_constant_s_C" = "5"

	register "stt_min_limit_C" = "15000"
	register "stt_m1_C" = "0x129"
	register "stt_m2_C" = "0xAF6"
	register "stt_c_apu_C" = "0xC3D2"
	register "stt_skin_temp_apu_C" = "0x3000"

	# Set Dynamic DPTC thermal profile confiuration. Table D
	register "fast_ppt_limit_mW_D" = "15000"
	register "slow_ppt_limit_mW_D" = "15000"
	register "slow_ppt_time_constant_s_D" = "5"

	register "stt_min_limit_D" = "10500"
	register "stt_m1_D" = "0x129"
	register "stt_m2_D" = "0xAF6"
	register "stt_c_apu_D" = "0xC3D2"
	register "stt_skin_temp_apu_D" = "0x3000"

	# Set Dynamic DPTC thermal profile confiuration. Table E
	register "fast_ppt_limit_mW_E" = "24000"
	register "slow_ppt_limit_mW_E" = "20000"
	register "slow_ppt_time_constant_s_E" = "5"

	register "stt_min_limit_E" = "12000"
	register "stt_m1_E" = "0xAE"
	register "stt_m2_E" = "0xB8F"
	register "stt_c_apu_E" = "0xC13B"
	register "stt_skin_temp_apu_E" = "0x2F00"


	# Set Dynamic DPTC thermal profile confiuration. Table F
	register "fast_ppt_limit_mW_F" = "12000"
	register "slow_ppt_limit_mW_F" = "12000"
	register "slow_ppt_time_constant_s_F" = "5"

	register "stt_min_limit_F" = "8000"
	register "stt_m1_F" = "0xAE"
	register "stt_m2_F" = "0xB8F"
	register "stt_c_apu_F" = "0xC13B"
	register "stt_skin_temp_apu_F" = "0x2F00"

	register "i2c[0]" = "{
		.speed = I2C_SPEED_FAST,
		.speed_config[0] = {
			.speed = I2C_SPEED_FAST,
			.scl_hcnt = 107,
			.scl_lcnt = 230,
			.sda_hold = 100
		}
	}"

	device domain 0 on

		register "dxio_tx_vboost_enable" = "1"

		# The unit is set to one per ms
		register "edp_panel_t8_ms" = "112"
		register "edp_panel_t9_ms" = "8"

		device ref gpp_bridge_1 on
			# Required so the NVMe gets placed into D3 when entering S0i3.
			chip drivers/pcie/rtd3/device
				register "name" = ""NVME""
				device pci 00.0 on end
			end
		end # eMMC
		device ref gpp_bridge_2 on
			# Required so the NVMe gets placed into D3 when entering S0i3.
			chip drivers/pcie/rtd3/device
				register "name" = ""NVME""
				device pci 00.0 on end
			end
		end # NVMe

		device ref gpp_bridge_a on  # Internal GPP Bridge 0 to Bus A
			device ref xhci_1 on # XHCI1 controller
				chip drivers/usb/acpi
					device ref xhci_1_root_hub on # XHCI1 root hub
						chip drivers/usb/acpi
							register "desc" = ""USB3 Type-A Port A0 (MLB)""
							register "type" = "UPC_TYPE_USB3_A"
							register "use_custom_pld" = "true"
							register "custom_pld" = "ACPI_PLD_TYPE_A(LEFT, LEFT, ACPI_PLD_GROUP(3, 1))"
							device ref usb3_port3 on end # USB 3.1 port3
						end
						chip drivers/usb/acpi
							register "desc" = ""USB2 Type-A Port A0 (MLB)""
							register "type" = "UPC_TYPE_USB3_A"
							register "use_custom_pld" = "true"
							register "custom_pld" = "ACPI_PLD_TYPE_A(LEFT, LEFT, ACPI_PLD_GROUP(3, 1))"
							device ref usb2_port3 on end # USB 2 port3
						end
					end # XHCI1 root hub
				end
			end # XHCI1 controller
		end # Internal GPP Bridge 0 to Bus A
	end # domain

	device ref i2c_0 on
		chip drivers/i2c/generic
			register "hid" = ""ELAN0000""
			register "desc" = ""ELAN Touchpad""
			register "irq_gpio" = "ACPI_GPIO_IRQ_EDGE_LOW(GPIO_40)"
			register "wake" = "GEVENT_20"
			register "detect" = "1"
			device i2c 15 on end
		end
		chip drivers/i2c/hid
			register "generic.hid" = ""GXTP7863""
			register "generic.desc" = ""Goodix Touchpad""
			register "generic.irq_gpio" = "ACPI_GPIO_IRQ_LEVEL_LOW(GPIO_40)"
			register "generic.wake" = "GEVENT_20"
			register "generic.detect" = "1"
			register "hid_desc_reg_offset" = "0x20"
			device i2c 2c on end
		end
	end # I2C0
	device ref i2c_1 on
		chip drivers/i2c/hid
			register "generic.hid" = ""ELAN900C""
			register "generic.desc" = ""ELAN Touchscreen""
			register "generic.irq_gpio" = "ACPI_GPIO_IRQ_LEVEL_LOW(GPIO_29)"
			register "generic.detect" = "1"
			register "generic.enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPIO_131)"
			register "generic.enable_delay_ms" = "10"
			register "generic.reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPIO_136)"
			register "generic.reset_off_delay_ms" = "1"
			register "generic.reset_delay_ms" = "10"
			register "generic.stop_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPIO_76)"
			register "generic.stop_delay_ms" = "150"
			register "generic.stop_off_delay_ms" = "1"
			register "generic.has_power_resource" = "1"
			register "hid_desc_reg_offset" = "0x01"
			device i2c 10 on end
		end
		chip drivers/i2c/generic
			register "hid" = ""MLFS0000""
			register "desc" = ""Melfas Touchscreen""
			register "detect" = "1"
			register "irq_gpio" = "ACPI_GPIO_IRQ_EDGE_LOW(GPIO_29)"
			register "enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPIO_131)"
			register "enable_delay_ms" = "1"
			register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPIO_136)"
			register "reset_delay_ms" = "20"
			register "reset_off_delay_ms" = "2"
			register "stop_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPIO_76)"
			register "stop_off_delay_ms" = "2"
			register "has_power_resource" = "1"
			device i2c 34 on end
		end
	end # I2C1
	device ref i2c_2 on
		chip drivers/i2c/generic
			register "hid" = ""RTL5682""
			register "name" = ""RT58""
			register "desc" = ""Realtek RT5682""
			register "irq_gpio" = "ACPI_GPIO_IRQ_EDGE_BOTH(GPIO_90)"
			register "property_count" = "1"
			register "property_list[0].type" = "ACPI_DP_TYPE_INTEGER"
			register "property_list[0].name" = ""realtek,jd-src""
			register "property_list[0].integer" = "1"
			device i2c 1a on end
		end
		chip drivers/i2c/generic
			register "hid" = ""10EC1019""
			register "desc" = ""Realtek SPK AMP R""
			register "uid" = "1"
			device i2c 29 on end
		end
		chip drivers/i2c/generic
			register "hid" = ""10EC1019""
			register "desc" = ""Realtek SPK AMP L""
			register "uid" = "2"
			register "probed" = "1"
			device i2c 2a on end
		end
	end # I2C2

	device ref uart_1 on
		chip drivers/uart/acpi
			register "name" = ""CRFP""
			register "desc" = ""Fingerprint Reader""
			register "hid" = "ACPI_DT_NAMESPACE_HID"
			register "compat_string" = ""google,cros-ec-uart""
			register "irq_gpio" = "ACPI_GPIO_IRQ_LEVEL_LOW(GPIO_24)"
			register "wake" = "GEVENT_15"
			register "uart" = "ACPI_UART_RAW_DEVICE(3000000, 64)"
			register "has_power_resource" = "1"
			register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPIO_12)"
			register "enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPIO_4)"
			register "enable_delay_ms" = "3"
			device generic 0 alias fpmcu on
				probe FP FP_PRESENT
			end
		end
	end # UART1

end	# chip soc/amd/mendocino