// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
/*
 * Samsung Galaxy Note20 5G (c1s/SM-N981B) device tree source
 *
 * Copyright (c) 2024, Igor Belwon <igor.belwon@mentallysanemainliners.org>
 */

/dts-v1/;
#include "exynos990.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/interrupt-controller/irq.h>

/ {
	model = "Samsung Galaxy Note20";
	compatible = "samsung,c1s", "samsung,exynos990";

	#address-cells = <2>;
	#size-cells = <2>;

	chosen {
		#address-cells = <2>;
		#size-cells = <2>;
		ranges;

		framebuffer0: framebuffer@f1000000 {
			compatible = "simple-framebuffer";
			reg = <0 0xf1000000 0 (1080 * 2400 * 4)>;
			width = <1080>;
			height = <2400>;
			stride = <(1080 * 4)>;
			format = "a8r8g8b8";
		};
	};

	memory@80000000 {
		device_type = "memory";
		reg = <0x0 0x80000000 0x0 0x3ab00000>,
		      /* Memory hole */
		      <0x0 0xc1200000 0x0 0x1ee00000>,
		      /* Memory hole */
		      <0x0 0xe1900000 0x0 0x1e700000>,
		      /* Memory hole - last block */
		      <0x8 0x80000000 0x1 0x7ec00000>;
	};

	reserved-memory {
		#address-cells = <2>;
		#size-cells = <2>;
		ranges;

		cont_splash_mem: framebuffer@f1000000 {
			reg = <0 0xf1000000 0 0x13c6800>;
			no-map;
		};

		abox_reserved: audio@f7fb0000 {
			reg = <0 0xf7fb0000 0 0x2a50000>;
			no-map;
		};
	};

	gpio-keys {
		compatible = "gpio-keys";

		pinctrl-0 = <&key_power &key_voldown &key_volup>;
		pinctrl-names = "default";

		power-key {
			label = "Power";
			linux,code = <KEY_POWER>;
			gpios = <&gpa2 4 GPIO_ACTIVE_LOW>;
			wakeup-source;
		};

		voldown-key {
			label = "Volume Down";
			linux,code = <KEY_VOLUMEDOWN>;
			gpios = <&gpa0 4 GPIO_ACTIVE_LOW>;
		};

		volup-key {
			label = "Volume Up";
			linux,code = <KEY_VOLUMEUP>;
			gpios = <&gpa0 3 GPIO_ACTIVE_LOW>;
		};
	};
};

&oscclk {
	clock-frequency = <26000000>;
};

&pinctrl_alive {
	key_power: key-power-pins {
		samsung,pins = "gpa2-4";
		samsung,pin-function = <EXYNOS_PIN_FUNC_EINT>;
		samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
		samsung,pin-drv = <EXYNOS5420_PIN_DRV_LV1>;
	};

	key_voldown: key-voldown-pins {
		samsung,pins = "gpa0-4";
		samsung,pin-function = <EXYNOS_PIN_FUNC_EINT>;
		samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
		samsung,pin-drv = <EXYNOS5420_PIN_DRV_LV1>;
	};

	key_volup: key-volup-pins {
		samsung,pins = "gpa0-3";
		samsung,pin-function = <EXYNOS_PIN_FUNC_EINT>;
		samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
		samsung,pin-drv = <EXYNOS5420_PIN_DRV_LV1>;
	};
};