// SPDX-License-Identifier: (GPL-2.0+ OR MIT)

#include "rk3588s-nanopi.dtsi"

/ {
	gpio-keys {
		compatible = "gpio-keys";
		pinctrl-names = "default";
		pinctrl-0 = <&key1_pin>;

		button-user {
			label = "User";
			linux,code = <BTN_1>;
			gpios = <&gpio1 RK_PC0 GPIO_ACTIVE_LOW>;
			debounce-interval = <50>;
		};
	};

	leds {
		compatible = "gpio-leds";

		sys_led: led-0 {
			label = "sys_led";
			gpios = <&gpio1 RK_PC1 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "heartbeat";
			pinctrl-names = "default";
			pinctrl-0 = <&sys_led_pin>;
		};

		wan_led: led-1 {
			label = "wan_led";
			gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_HIGH>;
			pinctrl-names = "default";
			pinctrl-0 = <&wan_led_pin>;
		};

		lan1_led: led-2 {
			label = "lan1_led";
			gpios = <&gpio1 RK_PC3 GPIO_ACTIVE_HIGH>;
			pinctrl-names = "default";
			pinctrl-0 = <&lan1_led_pin>;
		};

		lan2_led: led-3 {
			gpios = <&gpio1 RK_PC4 GPIO_ACTIVE_HIGH>;
			pinctrl-names = "default";
			pinctrl-0 = <&lan2_led_pin>;
		};
	};

	vcc5v0_usb_otg0: regulator-vcc5v0-usb-otg0 {
		compatible = "regulator-fixed";
		enable-active-high;
		gpios = <&gpio1 RK_PD2 GPIO_ACTIVE_HIGH>;
		pinctrl-names = "default";
		pinctrl-0 = <&typec5v_pwren>;
		regulator-name = "vcc5v0_usb_otg0";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		vin-supply = <&vcc5v0_sys>;
	};
};

&pinctrl {
	gpio-key {
		key1_pin: key1-pin {
			rockchip,pins = <1 RK_PC0 RK_FUNC_GPIO &pcfg_pull_up>;
		};
	};

	gpio-leds {
		sys_led_pin: sys-led-pin {
			rockchip,pins =
				<1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>;
		};

		wan_led_pin: wan-led-pin {
			rockchip,pins =
				<1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>;
		};

		lan1_led_pin: lan1-led-pin {
			rockchip,pins =
				<1 RK_PC3 RK_FUNC_GPIO &pcfg_pull_none>;
		};

		lan2_led_pin: lan2-led-pin {
			rockchip,pins =
				<1 RK_PC4 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};

	usb {
		typec5v_pwren: typec5v-pwren {
			rockchip,pins = <1 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};
};