build/patch/kernel/archive/meson64-6.2/add-board-t95z.patch

367 lines
9.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Christian Hewitt <christianshewitt@gmail.com>
Date: Mon, 13 Feb 2023 11:38:16 +0000
Subject: WIP: arm64: dts: meson: add support for Sunvell T95Z Plus + VFD
WIP: arm64: dts: meson: add SPI VFD to Sunvell T95Z Plus
making guesses at the config..
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
WIP: arm64: dts: meson: add support for Sunvell T95Z Plus
Sunvell T95Z Pluz is based on the Amlogic Q200 reference design with
an S912 chip and the following specifications:
- 2GB DDR3 RAM
- 16GB eMMC
- 10/100/1000 Base-T Ethernet
- AP6255 Wireless (802.11 b/g/n/ac, BT 4.1)
- HDMI 2.0a video
- FTD628 VFD for clock/status
- 2x USB 2.0 ports
- IR receiver
- 1x Power LED (white)
- 1x Update/Reset button (underside)
- 1x micro SD card slot
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
WIP: dt-bindings: arm: amlogic: add support for Sunvell T95Z Plus
Sunvell T95Z Plus is an Android STB based on the Amlogic Q200 reference
board with S912 chip.
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
WIP: media: rc: add keymap for Sunvell T95Z Plus
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
WIP: dt-bindings: media: rc: add rc-sunvell-t95z-plus
Add a binding for the rc-sunvell-t95z-plus remote keymap
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
WIP: dt-bindings: add sunvell vendor prefix
Add vendor prefix for Shenzhen Sunvell Electronics Co., Ltd
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
Documentation/devicetree/bindings/media/rc.yaml | 1 +
Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 +
arch/arm64/boot/dts/amlogic/meson-gxm-t95z-plus.dts | 166 ++++++++++
drivers/media/rc/keymaps/Makefile | 1 +
drivers/media/rc/keymaps/rc-sunvell-t95z-plus.c | 75 +++++
include/media/rc-map.h | 1 +
6 files changed, 246 insertions(+)
diff --git a/Documentation/devicetree/bindings/media/rc.yaml b/Documentation/devicetree/bindings/media/rc.yaml
index e732b7f3a635..1f9359c214ee 100644
--- a/Documentation/devicetree/bindings/media/rc.yaml
+++ b/Documentation/devicetree/bindings/media/rc.yaml
@@ -125,6 +125,7 @@ properties:
- rc-reddo
- rc-snapstream-firefly
- rc-streamzap
+ - rc-sunvell-t95z-plus
- rc-su3000
- rc-tanix-tx3mini
- rc-tanix-tx5max
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml
index 70ffb3780621..3482651d510c 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.yaml
+++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml
@@ -1268,6 +1268,8 @@ patternProperties:
description: Sundance DSP Inc.
"^sunplus,.*":
description: Sunplus Technology Co., Ltd.
+ "^sunvell,.*":
+ description: Shenzhen Sunvell Electronics Co., Ltd
"^SUNW,.*":
description: Sun Microsystems, Inc
"^supermicro,.*":
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-t95z-plus.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-t95z-plus.dts
new file mode 100644
index 000000000000..5f4bd19d5d77
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/meson-gxm-t95z-plus.dts
@@ -0,0 +1,166 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) Christian Hewitt <christianshewitt@gmail.com>
+ */
+
+/dts-v1/;
+
+#include "meson-gxm.dtsi"
+#include "meson-gx-p23x-q20x.dtsi"
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
+
+/ {
+ compatible = "sunvell,t95z-plus", "amlogic,s912", "amlogic,meson-gxm";
+ model = "Sunvell T95Z Plus";
+
+ leds {
+ compatible = "gpio-leds";
+
+ led-green {
+ color = <LED_COLOR_ID_GREEN>;
+ function = LED_FUNCTION_POWER;
+ gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>;
+ default-state = "on";
+ };
+
+ led-blue {
+ color = <LED_COLOR_ID_BLUE>;
+ function = LED_FUNCTION_POWER;
+ gpios = <&gpio GPIODV_25 GPIO_ACTIVE_HIGH>;
+ default-state = "off";
+ panic-indicator;
+ };
+ };
+
+ adc-keys {
+ compatible = "adc-keys";
+ io-channels = <&saradc 0>;
+ io-channel-names = "buttons";
+ keyup-threshold-microvolt = <1710000>;
+
+ button-function {
+ label = "update";
+ linux,code = <KEY_VENDOR>;
+ press-threshold-microvolt = <10000>;
+ };
+ };
+
+ spi {
+ compatible = "spi-gpio";
+
+ /* T95Z v1 (enabled) */
+ sck-gpios = <&gpio GPIODV_22 GPIO_ACTIVE_HIGH>;
+ mosi-gpios = <&gpio GPIODV_23 GPIO_ACTIVE_HIGH>;
+ cs-gpios = <&gpio GPIODV_21 GPIO_ACTIVE_LOW>;
+
+ /* T95Z v2 (disabled)
+ sck-gpios = <&gpio GPIODV_19 GPIO_ACTIVE_HIGH>;
+ mosi-gpios = <&gpio GPIODV_18 GPIO_ACTIVE_HIGH>;
+ cs-gpios = <&gpio GPIODV_20 GPIO_ACTIVE_LOW>;
+ */
+
+ num-chipselects = <1>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ tm1628: led-controller@0 {
+ compatible = "titanmec,tm1628";
+ reg = <0>;
+ spi-3wire;
+ spi-lsb-first;
+ spi-rx-delay-us = <1>;
+ spi-max-frequency = <500000>;
+ #address-cells = <2>;
+ #size-cells = <0>;
+
+ titanmec,segment-mapping = /bits/ 8 <4 5 6 1 2 3 7>;
+ titanmec,grid = /bits/ 8 <2 3 4 5 1>;
+
+ alarm@1,1 {
+ reg = <1 1>;
+ function = LED_FUNCTION_ALARM;
+ };
+
+ usb@1,2 {
+ reg = <1 2>;
+ function = LED_FUNCTION_USB;
+ };
+
+ play@1,3 {
+ reg = <1 3>;
+ function = "play";
+ };
+
+ pause@1,4 {
+ reg = <1 4>;
+ function = "pause";
+ };
+
+ colon@1,5 {
+ reg = <1 5>;
+ function = "colon";
+ };
+
+ lan@1,6 {
+ reg = <1 6>;
+ function = LED_FUNCTION_LAN;
+ };
+
+ wlan@1,7 {
+ reg = <1 7>;
+ function = LED_FUNCTION_WLAN;
+ };
+ };
+ };
+};
+
+&ethmac {
+ pinctrl-0 = <&eth_pins>;
+ pinctrl-names = "default";
+
+ phy-handle = <&external_phy>;
+ phy-mode = "rgmii";
+
+ amlogic,tx-delay-ns = <2>;
+};
+
+&external_mdio {
+ external_phy: ethernet-phy@1 {
+ /* ZTE ZX2AA500 */
+ compatible = "ethernet-phy-id0381.5c11",
+ "ethernet-phy-ieee802.3-c22";
+ reg = <1>;
+ max-speed = <1000>;
+
+ reset-assert-us = <10000>;
+ reset-deassert-us = <80000>;
+ reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>;
+
+ interrupt-parent = <&gpio_intc>;
+ /* MAC_INTR on GPIOZ_15 */
+ interrupts = <25 IRQ_TYPE_LEVEL_LOW>;
+ };
+};
+
+&sd_emmc_a {
+ brcmf: wifi@1 {
+ reg = <1>;
+ compatible = "brcm,bcm4329-fmac";
+ };
+};
+
+&uart_A {
+ status = "okay";
+ pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
+ pinctrl-names = "default";
+ uart-has-rtscts;
+
+ bluetooth {
+ compatible = "brcm,bcm43438-bt";
+ shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
+ max-speed = <2000000>;
+ clocks = <&wifi32k>;
+ clock-names = "lpo";
+ };
+};
diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile
index f513ff5caf4e..d286beafb389 100644
--- a/drivers/media/rc/keymaps/Makefile
+++ b/drivers/media/rc/keymaps/Makefile
@@ -105,6 +105,7 @@ obj-$(CONFIG_RC_MAP) += \
rc-reddo.o \
rc-snapstream-firefly.o \
rc-streamzap.o \
+ rc-sunvell-t95z-plus.o \
rc-su3000.o \
rc-tanix-tx3mini.o \
rc-tanix-tx5max.o \
diff --git a/drivers/media/rc/keymaps/rc-sunvell-t95z-plus.c b/drivers/media/rc/keymaps/rc-sunvell-t95z-plus.c
new file mode 100644
index 000000000000..aaaf6b1c0045
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-sunvell-t95z-plus.c
@@ -0,0 +1,75 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2023 Christian Hewitt <christianshewitt@gmail.com
+ */
+
+#include <media/rc-map.h>
+#include <linux/module.h>
+
+/*
+ * Keytable for Sunvell T95Z Plus remote control
+ *
+ */
+
+static struct rc_map_table sunvell_t95z_plus[] = {
+ { 0xdf1c, KEY_POWER },
+ // TV CONTROLS
+
+ { 0xdf4b, KEY_PREVIOUS },
+ { 0xdf01, KEY_SCREEN }, // TV
+ { 0xdf5d, KEY_VOLUMEUP },
+
+ { 0xdf4f, KEY_NEXT },
+ { 0xdf5f, KEY_FAVORITES }, // KODI
+ { 0xdf5c, KEY_VOLUMEDOWN },
+
+ { 0xdf42, KEY_HOME },
+ { 0xdf0a, KEY_BACK },
+
+ { 0xdf1a, KEY_UP },
+ { 0xdf47, KEY_LEFT },
+ { 0xdf06, KEY_ENTER },
+ { 0xdf07, KEY_RIGHT },
+ { 0xdf48, KEY_DOWN },
+
+ { 0xdf03, KEY_INFO }, // MOUSE
+ { 0xdf18, KEY_MENU },
+
+ { 0xdf54, KEY_1 },
+ { 0xdf16, KEY_2 },
+ { 0xdf15, KEY_3 },
+ { 0xdf50, KEY_4 },
+ { 0xdf12, KEY_5 },
+ { 0xdf11, KEY_6 },
+ { 0xdf4c, KEY_7 },
+ { 0xdf0e, KEY_8 },
+ { 0xdf0d, KEY_9 },
+ { 0xdf41, KEY_WWW }, // WORLD
+ { 0xdf0c, KEY_0 },
+ { 0xdf10, KEY_DELETE },
+};
+
+static struct rc_map_list sunvell_t95z_plus_map = {
+ .map = {
+ .scan = sunvell_t95z_plus,
+ .size = ARRAY_SIZE(sunvell_t95z_plus),
+ .rc_proto = RC_PROTO_NEC,
+ .name = RC_MAP_SUNVELL_T95Z_PLUS,
+ }
+};
+
+static int __init init_rc_map_sunvell_t95z_plus(void)
+{
+ return rc_map_register(&sunvell_t95z_plus_map);
+}
+
+static void __exit exit_rc_map_sunvell_t95z_plus(void)
+{
+ rc_map_unregister(&sunvell_t95z_plus_map);
+}
+
+module_init(init_rc_map_sunvell_t95z_plus)
+module_exit(exit_rc_map_sunvell_t95z_plus)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Christian Hewitt <christianshewitt@gmail.com>");
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index 793b54342dff..10f07975e7d8 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -312,6 +312,7 @@ struct rc_map *rc_map_get(const char *name);
#define RC_MAP_REDDO "rc-reddo"
#define RC_MAP_SNAPSTREAM_FIREFLY "rc-snapstream-firefly"
#define RC_MAP_STREAMZAP "rc-streamzap"
+#define RC_MAP_SUNVELL_T95Z_PLUS "rc-sunvell-t95z-plus"
#define RC_MAP_SU3000 "rc-su3000"
#define RC_MAP_TANIX_TX3MINI "rc-tanix-tx3mini"
#define RC_MAP_TANIX_TX5MAX "rc-tanix-tx5max"
--
Armbian